:root {
  --bg: #1d1d1d;
  --surface: #242424;
  --card: #2d2d2d;
  --border: #3a3a3a;
  --border-h: #555555;
  --accent: #ea141e;
  --accent-hover: #ff1f29;
  --accent-dim: rgba(234, 20, 30, 0.1);
  --accent-border: rgba(234, 20, 30, 0.22);
  --accent-glow: rgba(234, 20, 30, 0.28);
  --danger: var(--accent);
  --danger-dim: var(--accent-dim);
  --danger-border: var(--accent-border);
  --badge-opt-solid: #2d2d2d;
  --badge-accent-solid: #3b1d20;
  --badge-patreon-solid: #4a2d1d;
  --text: #e3e3e3;
  --muted: #77777a;
  --dim: #a0a0a3;
  --patreon-color: #fb923c;
  --patreon-bg: rgba(249, 115, 22, 0.12);
  --patreon-border: rgba(249, 115, 22, 0.28);
  --r: 6px;
  --sidebar: 240px;
  --mono: 'Google Sans Code', monospace;
  --syne: 'Syne', sans-serif;
  --dur: 0.25s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Google Sans', sans-serif;
  font-optical-sizing: auto;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

input[type='number'] {
  -webkit-appearance: none !important;
  -moz-appearance: textfield !important;
  appearance: none;
  margin: 0;
}

input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0;
}

/* ── PAGE WRAPPER ── */
.page-wrapper {
  display: flex;
  width: 100%;
  max-width: 1100px;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  user-select: none;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo-img {
  height: 26px;
  width: auto;
}

.brand-name {
  font-family: var(--syne);
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  display: block;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  display: block;
  letter-spacing: 0.04em;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0 16px;
}

.nav-label {
  font-family: var(--syne);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 10px 14px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--dim);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  transition: all 0.12s;
  border-left: 2px solid transparent;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-item iconify-icon.navigation-item-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-item.active iconify-icon.navigation-item-icon {
  opacity: 1;
}

.nav-chevron {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.35;
  transition: transform var(--dur) var(--ease);
}

.nav-group.open .nav-chevron {
  transform: rotate(90deg);
  opacity: 0.65;
}

.nav-sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur) var(--ease);
}

.nav-sub.open {
  grid-template-rows: 1fr;
}

.nav-sub > .nav-sub-inner {
  overflow: hidden;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 4px 34px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.12s;
  border-left: 2px solid transparent;
  margin-left: 2px;
}

.nav-sub-item:hover {
  color: var(--dim);
}

.nav-sub-item.active {
  color: var(--accent);
  border-left-color: var(--accent-border);
}

/* ── MAIN ── */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.main {
  width: 100%;
  max-width: 760px;
  padding: 32px 40px 100px;
}

/* ── BUTTONS ── */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  font-family: 'Google Sans', sans-serif;
  font-optical-sizing: auto;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.button-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  width: 100%;
  justify-content: center;
  padding: 10px 16px;
}

.button-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 18px var(--accent-glow);
}

.button-primary.disabled,
.button-primary[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.button-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
  border-color: var(--border);
  padding: 6px 12px;
  font-size: 12px;
}

.button-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: var(--border-h);
}

.button-danger {
  background: rgba(234, 20, 30, 0.08);
  color: var(--accent);
  border-color: var(--accent-border);
  padding: 6px 12px;
  font-size: 12px;
}

.button-danger:hover {
  background: rgba(234, 20, 30, 0.14);
  border-color: var(--accent);
}

.button-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 3px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
  border-radius: 999px;
}

.button-icon:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.button-collapse {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  transition: color 0.1s;
  padding: 2px 4px;
  border-radius: 3px;
}

.button-collapse iconify-icon {
  transition: transform var(--dur) var(--ease);
}

.button-collapse:hover {
  color: var(--dim);
  background: rgba(255, 255, 255, 0.06);
}

.button-collapse.open {
  color: var(--dim);
}

.button-collapse.open iconify-icon {
  transform: rotate(90deg);
}

.add-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px;
  border: 1px dashed var(--border-h);
  border-radius: var(--r);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
  font-family: 'Google Sans', sans-serif;
  font-optical-sizing: auto;
}

.add-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── SECTIONS ── */
.section {
  margin-bottom: 44px;
  scroll-margin-top: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.section-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.section-header h2 {
  font-family: var(--syne);
  font-weight: 700;
  font-size: 16px;
}

.section-header p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 10px;
  scroll-margin-top: 70px;
}

.card-title {
  font-family: var(--syne);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  user-select: none;
}

/* ── FORM ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 13px;
}

.grid-three-columns {
  grid-template-columns: 1fr 1fr 1fr;
}

.grid-single-column {
  grid-template-columns: 1fr;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.span-two-columns {
  grid-column: span 2;
}

/* Unified label style — matches toggle-label visual weight */
label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  line-height: 1.4;
}

input[type='text'],
input[type='number'],
input[type='password'],
input[type='time'],
input[type='date'],
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: 'Google Sans', sans-serif;
  font-optical-sizing: auto;
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2377777a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}

select option {
  background: var(--surface);
}

textarea {
  resize: vertical;
  min-height: 90px;
  font-family: var(--mono);
  font-size: 12px;
}

/* ── VALIDATION ── */
.form-field.form-field-error > input,
.form-field.form-field-error > select,
.form-field.form-field-error > textarea,
.form-field.form-field-error > .tag-wrap {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px var(--danger-dim) !important;
}

/* Toggle-row error — left accent strip */
.toggle-row.toggle-row-error {
  border-left: 2px solid var(--danger);
  padding-left: 8px;
  margin-left: -2px;
}

.toggle-row.toggle-row-error:last-child {
  padding-bottom: 0;
}

.validation-message {
  font-size: 11px;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.validation-message.validation-message-error {
  color: var(--danger);
}

/* ── TOGGLE ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.toggle-row:first-child {
  padding-top: 0;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-right: 14px;
  min-width: 0;
}

.toggle-label {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.toggle-desc {
  font-size: 11px;
  color: var(--muted);
}

.toggle-desc-dynamic {
  font-weight: 700;
  color: var(--dim);
}

.field-inline-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.field-inline-meta .toggle-desc {
  order: 2;
  margin-left: 0;
}

.form-field-inline-meta .validation-message {
  order: 1;
  margin-top: 0;
  margin-right: auto;
  white-space: nowrap;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 21px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 21px;
  cursor: pointer;
  transition: 0.18s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 15px;
  height: 15px;
  background: var(--muted);
  border-radius: 50%;
  transition: 0.18s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  left: 20px;
  background: #fff;
}

/* ── SLIDER ── */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type='range'] {
  -webkit-appearance: none !important;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  padding: 0;
  border: none;
  box-shadow: none;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

input[type='range']::-moz-range-thumb {
  width: 13px;
  height: 13px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: box-shadow 0.15s;
}

input[type='range']::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 4px var(--accent-dim);
}

input[type='range']::-moz-range-thumb:hover {
  box-shadow: 0 0 0 4px var(--accent-dim);
}

input[type='range']:focus {
  box-shadow: none;
  border: none;
}

/* Fixed-size slider value display — prevents layout shift on edit */
.slider-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  width: 52px;
  min-width: 52px;
  flex-shrink: 0;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  cursor: text;
  border-bottom: 1px dashed var(--accent-border);
  transition: color 0.15s;
}

.slider-val:hover {
  color: #ff2c35;
}

.slider-wrap .slider-edit-input {
  width: 52px !important;
  min-width: 52px;
  flex-shrink: 0;
  height: 24px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0 5px;
  outline: none;
  text-align: right;
}

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  vertical-align: middle;
  user-select: none;
  cursor: help;
  backface-visibility: hidden;
}

.badge-opt {
  background: rgba(255, 255, 255, 0.06);
  color: var(--dim);
  border: 1px solid var(--border-h);
}

.badge-csp {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.badge-req {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.badge-patreon {
  background: var(--patreon-bg);
  color: var(--patreon-color);
  border: 1px solid var(--patreon-border);
}

.badge-toast {
  position: absolute;
  z-index: 60;
  max-width: max-content;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border-h);
  color: var(--text);
  font-size: 11px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.badge-toast.open {
  opacity: 1;
  transform: translateY(0);
}

.badge-toast.badge-toast-opt {
  background: var(--badge-opt-solid);
  color: var(--dim);
  border: 1px solid var(--border-h);
}

.badge-toast.badge-toast-csp {
  background: var(--badge-accent-solid);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.badge-toast.badge-toast-req {
  background: var(--badge-accent-solid);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.badge-toast.badge-toast-patreon {
  background: var(--badge-patreon-solid);
  color: var(--patreon-color);
  border: 1px solid var(--patreon-border);
}

/* ── COLLAPSIBLE ── */
.collapsible-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur) var(--ease);
}

.collapsible-panel.open {
  grid-template-rows: 1fr;
}

.collapsible-panel > .collapsible-panel-inner {
  overflow: hidden;
}

/* ── SESSION BLOCKS ── */
.session-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 10px;
  overflow: hidden;
}

.session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.session-header h3 {
  font-family: var(--syne);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 1;
  color: var(--muted);
}

.session-body {
  padding: 14px;
}

/* ── ENTRY CARDS ── */
.entry-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 8px;
  transition: border-color 0.12s;
  user-select: none;
  /* prevents text selection while dragging */
}

/* Re-enable selection inside inputs/textareas */
.entry-card input,
.entry-card textarea,
.entry-card select {
  user-select: text;
}

.entry-card.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.entry-card.dragging {
  opacity: 0.4;
  border-style: dashed;
}

.entry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid var(--border);
  border-radius: var(--r) var(--r) 0 0;
}

/* When collapsed, header has no bottom border radius override needed — border-bottom handled by collapsible-panel */
.entry-card-body {
  padding: 13px;
}

.entry-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}

.entry-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}

.entry-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.sub-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.entry-actions .button,
.sub-card-actions .button {
  min-height: 30px;
  padding: 6px 12px;
}

.entry-actions .button iconify-icon,
.sub-card-actions .button iconify-icon {
  flex-shrink: 0;
}

.drag-handle {
  cursor: grab;
  color: var(--muted);
  padding: 2px 5px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
}

.drag-handle:hover {
  color: var(--dim);
  background: rgba(255, 255, 255, 0.07);
}

.drag-handle:active {
  cursor: grabbing;
}

/* ── TAG INPUT ── */
.tag-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  min-height: 36px;
  cursor: text;
  align-items: center;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.tag-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.tag {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11px;
}

.tag.tag-patreon {
  background: var(--patreon-bg);
  border-color: var(--patreon-border);
  color: var(--patreon-color);
}

.tag button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0 0 0 2px;
  opacity: 0.6;
}

.tag button:hover {
  opacity: 1;
}

.tag button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: currentColor;
}

.tag button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.tag-input-field {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
  min-width: 80px;
  flex: 1;
  padding: 0;
}

/* ── PLUGIN ROW ── */
.plugin-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.plugin-add-row select {
  flex: 1;
}

.plugin-config-card {
  margin-bottom: 12px;
}

.plugin-config-card .toggle-row {
  border-bottom: none;
}

.plugin-config-file {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.plugin-object-group {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.02);
}

.plugin-config-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

/* ── PASSWORD EYE TOGGLE ── */
.password-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrapper input {
  width: 100%;
  padding-right: 34px;
}

.password-toggle-button {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s;
}

.password-toggle-button:hover {
  color: var(--dim);
}

/* ── DOWNLOAD ERRORS ── */
.dl-error-box {
  margin-bottom: 16px;
  text-align: left;
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  border-radius: var(--r);
  padding: 12px 14px;
}

.dl-error-title {
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dl-error-item {
  font-size: 12px;
  color: var(--danger);
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-bottom: 3px;
  opacity: 0.9;
}

.dl-error-item iconify-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── TIME / DATE PICKERS (custom dark styling) ── */
input[type='time'],
input[type='date'] {
  color-scheme: dark;
}

input[type='time']::-webkit-calendar-picker-indicator,
input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(0.5) sepia(1) saturate(4) hue-rotate(320deg) brightness(0.9);
  cursor: pointer;
  border-radius: 3px;
  padding: 2px;
  transition:
    filter 0.15s,
    opacity 0.15s;
  opacity: 0.7;
}

input[type='time']::-webkit-calendar-picker-indicator:hover,
input[type='date']::-webkit-calendar-picker-indicator:hover {
  filter: invert(0.3) sepia(1) saturate(6) hue-rotate(320deg) brightness(1.1);
  opacity: 1;
}

/* ── WFX TIME/DATE SIDE-BY-SIDE GRID ── */
.wfx-time-date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── FIELD LABEL ROW (label + help button, click-safe) ── */
.field-label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 5px;
}

/* ── MISC ── */
.info-box {
  padding: 9px 13px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 14px;
}

.info-box strong {
  color: var(--accent);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

code {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 11px;
  display: inline-block;
  backface-visibility: hidden;
}

a {
  color: var(--accent);
}

/* ── HELP PANEL ── */
.help-panel {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-top: 8px;
}

.help-panel .bbcode-preview {
  padding: 12px 14px;
}

.help-panel p {
  font-size: 12px;
  color: var(--dim);
}

.help-panel pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 11px;
  overflow-x: auto;
  color: var(--dim);
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ── CSP VERSION HINT ── */
.csp-version-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  margin-top: 3px;
  display: block;
}

/* ── WFX PARAMS ── */
.wfx-params {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  margin-top: 10px;
}

.wfx-title {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.wfx-opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.wfx-opt-row:last-child {
  margin-bottom: 0;
}

.wfx-opt-field {
  flex: 1;
  min-width: 0;
}

.wfx-opt-field > label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
}

.wfx-opt-row.off .wfx-opt-field {
  opacity: 0.35;
  pointer-events: none;
}

/* ── SUB CARDS ── */
.sub-card {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  margin-bottom: 8px;
}

.sub-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  transition: margin-bottom 0.2s ease;
}

.sub-card.collapsed .sub-card-header {
  margin-bottom: 0;
}

.sub-card-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}

/* ── DRIVER OPTS SECTION ── */
.driver-options-header {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* ── DOWNLOAD ── */
.download-card {
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  border: 1px solid var(--accent-border);
  border-radius: var(--r);
  padding: 26px;
  text-align: center;
}

.download-card h3 {
  font-family: var(--syne);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
}

.download-card > p {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 16px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 20px;
  text-align: left;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  transition:
    max-height 0.2s,
    opacity 0.2s,
    padding 0.2s,
    border-width 0.2s,
    margin 0.2s;
  overflow: hidden;
  max-height: 50px;
  opacity: 1;
}

.file-item.hidden {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  margin: 0;
}

.file-item .file-item-icon {
  color: var(--accent);
  flex-shrink: 0;
}

/* ── SEGMENTED SWITCH ── */
.segmented-control {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 3px;
  gap: 2px;
}

.segmented-control.segmented-control-small .segmented-button {
  padding: 4px 10px;
  font-size: 11px;
}

.segmented-button {
  background: transparent;
  border: none;
  border-radius: calc(var(--r) - 2px);
  color: var(--muted);
  cursor: pointer;
  font-family: 'Google Sans', sans-serif;
  font-optical-sizing: auto;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  transition:
    background 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.segmented-button:hover {
  color: var(--dim);
  background: rgba(255, 255, 255, 0.04);
}

.segmented-button.active {
  background: var(--accent);
  color: #fff;
}

/* Seg switch sitting inside a toggle-row — keep it flush, no extra stretch */
.toggle-row .segmented-control {
  flex-shrink: 0;
}

/* ── DROPZONE ── */
.dropzone {
  border: 1px dashed var(--border-h);
  border-radius: var(--r);
  text-align: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  background: transparent;
}
.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}
.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.dropzone-content iconify-icon {
  color: var(--muted);
  margin-bottom: 10px;
  margin-top: 10px;
}

.import-download-card {
  margin-bottom: 24px;
}

.import-dropzone-footnote {
  margin-bottom: 0;
}

.dropzone.download-card:hover,
.dropzone.download-card.drag-over {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  color: inherit;
}

.sidebar-logo-fallback {
  width: 38px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-family: var(--syne);
  font-size: 11px;
  font-weight: 800;
}

.spacer-block-10 {
  height: 10px;
}

.spacer-block-12 {
  height: 12px;
}

.field-label-row-tight {
  margin-bottom: -6px;
}

.section-margin-top-8 {
  margin-top: 8px;
}

.section-margin-top-10 {
  margin-top: 10px;
}

.section-margin-top-12 {
  margin-top: 12px;
}

.section-margin-top-13 {
  margin-top: 13px;
}

.section-margin-top-14 {
  margin-top: 14px;
}

.section-margin-top-negative-5 {
  margin-top: -5px;
}

.section-margin-top-negative-9 {
  margin-top: -9px;
}

.section-margin-top-negative-14 {
  margin-top: -14px;
}

.section-margin-bottom-0 {
  margin-bottom: 0;
}

.section-margin-bottom-negative-9 {
  margin-bottom: -9px;
}

.section-margin-bottom-4 {
  margin-bottom: 4px;
}

.section-margin-bottom-7 {
  margin-bottom: 7px;
}

.section-margin-bottom-12 {
  margin-bottom: 12px;
}

.section-margin-bottom-13 {
  margin-bottom: 13px;
}

.section-margin-bottom-14 {
  margin-bottom: 14px;
}

.section-margin-bottom-20 {
  margin-bottom: 20px;
}

.toggle-row-no-border {
  border: none;
}

.toggle-row-no-bottom-spacing {
  border-bottom: 0;
  padding-bottom: 0;
}

.toggle-row-no-top-padding {
  padding-top: 0;
}

.toggle-row-no-padding {
  padding: 0;
}

.padding-top-13 {
  padding-top: 13px;
}

.padding-bottom-9 {
  padding-bottom: 9px;
}

.vertical-align-middle {
  vertical-align: middle;
}

.toggle-description-block {
  display: block;
}

.toggle-description-block-small {
  display: block;
  margin-bottom: 10px;
}

.toggle-description-block-medium {
  display: block;
  margin-bottom: 12px;
}

.toggle-description-top-padding {
  padding-top: 9px;
}

.small-toggle-label {
  font-size: 12px;
}

.minimum-csp-version-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
}

.minimum-csp-version-input {
  flex: 1;
}

.minimum-csp-version-hint {
  white-space: nowrap;
}

.download-button {
  max-width: 280px;
  margin: 0 auto;
  padding: 12px 24px;
  font-size: 14px;
}

.download-footnote {
  color: var(--muted);
  font-size: 11px;
}

.driver-option-row {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.driver-option-summary {
  display: flex;
  align-items: center;
  gap: 4px;
}

.driver-option-summary-wide {
  min-width: 0;
}

.driver-options-error {
  display: none;
  margin-bottom: 6px;
}

.weather-option-grid {
  margin-bottom: 10px;
}

.weather-option-row {
  margin-bottom: 0;
}

.weather-option-toggle {
  margin-top: 20px;
}

.weather-option-label {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.card-title-flat {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.lane-toggle-grid {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.group-entry-spacing-top {
  margin-top: 8px;
}

.is-hidden {
  display: none !important;
}

.initially-hidden {
  display: none;
}

@media (max-width: 760px) {
  .form-grid,
  .plugin-config-group,
  .grid-three-columns {
    grid-template-columns: 1fr;
  }

  .span-two-columns {
    grid-column: span 1;
  }

  .main {
    padding: 16px;
  }

  .sidebar {
    display: none;
  }
}
