/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Theme-independent tokens */
  --radius:    8px;
  --nav-w:     220px;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Dark theme (default) ──────────────────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #21262d;
  --text:      #e6edf3;
  --muted:     #7d8590;
  --accent:    #2d8cf0;
  --accent-hi: #58a6ff;
  --green:     #3fb950;
  --red:       #f85149;
  --amber:     #d29922;
  --yellow:    #d29922;
  --warning:   #d29922;
  --primary:   #2d8cf0;
  --violet:    #a371f7;

  /* Channel triplets — used with rgba() for tinted washes */
  --accent-rgb: 45, 140, 240;
  --green-rgb:  63, 185, 80;
  --red-rgb:    248, 81, 73;
  --amber-rgb:  210, 153, 34;
  --violet-rgb: 99, 102, 241;

  /* Surface effects */
  --hover:      rgba(255, 255, 255, .02);
  --hover-mid:  rgba(255, 255, 255, .025);
  --stripe:     rgba(255, 255, 255, .022);
  --scrim:      rgba(0, 0, 0, .6);
  --scrim-soft: rgba(0, 0, 0, .5);
  --shadow-lg:  0 20px 60px rgba(0, 0, 0, .5);
  --shadow-md:  0 8px 32px rgba(0, 0, 0, .35);
  --shadow-sm:  0 8px 24px rgba(0, 0, 0, .4);
  --shadow-drawer: -12px 0 40px rgba(0, 0, 0, .35);
  --on-accent:  #fff;

  /* JSON syntax highlighting */
  --syn-string:  #7ee787;
  --syn-number:  #79c0ff;
  --syn-boolean: #d2a8ff;

  color-scheme: dark;
}

/* ── Light theme ───────────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  --bg:        #ffffff;
  --surface:   #f6f8fa;
  --border:    #d0d7de;
  --text:      #1f2328;
  --muted:     #656d76;
  --accent:    #0969da;
  --accent-hi: #0550ae;
  --green:     #1a7f37;
  --red:       #cf222e;
  --amber:     #9a6700;
  --yellow:    #9a6700;
  --warning:   #9a6700;
  --primary:   #0969da;
  --violet:    #8250df;

  --accent-rgb: 9, 105, 218;
  --green-rgb:  26, 127, 55;
  --red-rgb:    207, 34, 46;
  --amber-rgb:  154, 103, 0;
  --violet-rgb: 130, 80, 223;

  --hover:      rgba(0, 0, 0, .035);
  --hover-mid:  rgba(0, 0, 0, .045);
  --stripe:     rgba(0, 0, 0, .03);
  --scrim:      rgba(0, 0, 0, .4);
  --scrim-soft: rgba(0, 0, 0, .32);
  --shadow-lg:  0 20px 60px rgba(31, 35, 40, .18);
  --shadow-md:  0 8px 32px rgba(31, 35, 40, .12);
  --shadow-sm:  0 8px 24px rgba(31, 35, 40, .14);
  --shadow-drawer: -12px 0 40px rgba(31, 35, 40, .12);
  --on-accent:  #fff;

  --syn-string:  #0a3069;
  --syn-number:  #0550ae;
  --syn-boolean: #8250df;

  color-scheme: light;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
}

/* ── Sidebar nav ───────────────────────────────────────────────────────────── */
.nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.nav-brand {
  padding: 0 20px 28px;
  border-bottom: 1px solid var(--border);
}

.nav-brand h1 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-hi);
}

.nav-brand p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.nav-section {
  padding: 20px 12px 0;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background .15s, color .15s;
}

.nav-item:hover {
  background: var(--border);
  color: var(--text);
}

.nav-item.active {
  background: rgba(var(--accent-rgb), .1);
  color: var(--accent-hi);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-footer {
  margin-top: auto;
  padding: 20px 20px 0;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}

.nav-footer > span {
  display: block;
  margin-top: 4px;
}

/* ── Theme toggle ──────────────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.theme-toggle:hover {
  background: var(--hover-mid);
  color: var(--text);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Show the icon for the theme you would switch *to*. */
.theme-icon-light { display: none; }
:root[data-theme="light"] .theme-icon-light { display: block; }
:root[data-theme="light"] .theme-icon-dark  { display: none; }

/* ── Main content ──────────────────────────────────────────────────────────── */
.main {
  padding: 36px 40px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.page-header p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Stat cards ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.stat-card .sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Status pill ───────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-green  { background: rgba(var(--green-rgb), .1);  color: var(--green);  }
.pill-green::before  { background: var(--green);  }
.pill-red    { background: rgba(var(--red-rgb), .1);  color: var(--red);    }
.pill-red::before    { background: var(--red);    }
.pill-amber  { background: rgba(var(--amber-rgb), .1); color: var(--amber);  }
.pill-amber::before  { background: var(--amber);  }
.pill-muted  { background: var(--border);          color: var(--muted);  }
.pill-muted::before  { background: var(--muted);  }

/* ── Section cards ─────────────────────────────────────────────────────────── */
.section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.section-header a {
  font-size: 12px;
  color: var(--accent-hi);
}

.section-header a:hover { text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty svg {
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  opacity: .35;
}

/* ── Quick-action grid ─────────────────────────────────────────────────────── */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.action-card:hover {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), .05);
}

.action-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), .1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-icon svg {
  width: 18px;
  height: 18px;
  color: var(--accent-hi);
}

.action-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.action-card p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Target env banner ─────────────────────────────────────────────────────── */
.env-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-size: 12px;
}

.env-banner .env-label {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 10px;
  flex-shrink: 0;
}

.env-banner .env-url {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--accent-hi);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.env-banner .env-url.unset {
  color: var(--amber);
}

/* ── Pill extra variants ───────────────────────────────────────────────────── */
.pill-blue { background: rgba(var(--accent-rgb), .12); color: var(--accent-hi); }
.pill-blue::before { background: var(--accent-hi); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-danger {
  background: rgba(var(--red-rgb), .1);
  color: var(--red);
  border-color: transparent;
}
.btn-danger:hover { background: rgba(var(--red-rgb), .2); }

.btn-ghost.btn-danger { background: transparent; color: var(--muted); }
.btn-ghost.btn-danger:hover { background: rgba(var(--red-rgb), .1); color: var(--red); border-color: transparent; }

.btn-sm { padding: 5px 8px; font-size: 12px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.seg-toggle {
  display: inline-flex;
  background: var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  color: var(--muted);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn-active { background: var(--accent); color: var(--on-accent); }
.seg-btn-active:hover { color: var(--on-accent); }

/* ── Data table ────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--hover); }

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  vertical-align: middle;
}

.cell-mono { font-family: monospace; font-size: 12px; }

.profile-name { font-weight: 500; }
.profile-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px var(--scrim-soft);
}

.modal-header {
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }

.modal-body {
  padding: 14px 24px 20px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.modal-body strong { color: var(--text); }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.form-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="date"],
.form-field input[type="time"],
.form-field textarea,
.form-field select {
  color-scheme: dark;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  padding: 8px 12px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--accent);
}

.form-field textarea { resize: vertical; }

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
  cursor: pointer;
}

.field-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.required { color: var(--red); margin-left: 1px; }

/* request type toggle */
.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.type-option { cursor: pointer; }
.type-option input[type="radio"] { display: none; }

.type-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s, background .15s;
}

.type-option input:checked + .type-card {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), .07);
}

.type-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.type-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* day picker */
.day-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.day-chip { cursor: pointer; }
.day-chip input[type="checkbox"] { display: none; }

.day-chip span {
  display: block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: border-color .15s, background .15s, color .15s;
}

.day-chip input:checked + span {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), .1);
  color: var(--accent-hi);
}

/* time tags */
.time-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-height: 42px;
  transition: border-color .15s;
}

.time-tags:focus-within { border-color: var(--accent); }

.time-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(var(--accent-rgb), .1);
  border: 1px solid rgba(var(--accent-rgb), .2);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  font-family: monospace;
  color: var(--accent-hi);
}

.time-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-hi);
  opacity: .6;
  padding: 0;
  display: flex;
  align-items: center;
  line-height: 1;
}

.time-tag-remove:hover { opacity: 1; }
.time-tag-remove svg { width: 10px; height: 10px; }

.time-add-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  transition: border-color .15s, color .15s, background .15s;
}

.time-add-circle:hover {
  border-color: var(--accent);
  color: var(--accent-hi);
  background: rgba(var(--violet-rgb), .08);
}

.time-add-circle svg { width: 13px; height: 13px; }

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-backdrop[hidden] { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 280px;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  display: flex;
  align-items: center;
}

.modal-close:hover { color: var(--text); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body {
  padding: 8px 16px 14px;
}

.modal-time-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 20px;
  font-family: monospace;
  padding: 10px 12px;
  text-align: center;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}

.modal-time-input:focus { border-color: var(--accent); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
}

/* form footer */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.form-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(var(--red-rgb), .1);
  border: 1px solid rgba(var(--red-rgb), .25);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--red);
}

/* ── Profile drawer ─────────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim-soft);
  z-index: 100;
  opacity: 0;
  transition: opacity .25s ease;
}
.drawer-backdrop[hidden] { display: none; }
.drawer-backdrop-visible { opacity: 1; }

.profile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 100vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s ease;
  box-shadow: var(--shadow-drawer);
}
.profile-drawer[hidden] { display: none; }
.drawer-open { transform: translateX(0) !important; }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  margin-top: 8px;
}

/* inline link-style button (used in empty state) */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-hi);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

/* DC picker */
.dc-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--bg);
}

.dc-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}

.dc-option:hover { background: var(--surface); }

.dc-option input[type="checkbox"] { display: none; }

.dc-option input:checked ~ .dc-option-name,
.dc-option input:checked ~ .dc-option-addr {
  color: var(--accent-hi);
}

.dc-option input:checked + .dc-option-name {
  color: var(--accent-hi);
}

.dc-option:has(input:checked) {
  background: rgba(var(--accent-rgb), .08);
  border-color: rgba(var(--accent-rgb), .3);
}

.dc-option-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.dc-option-addr {
  font-size: 11px;
  color: var(--muted);
}

/* ── Auth status ───────────────────────────────────────────────────────────── */
.auth-status {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
}

.auth-status-ok {
  background: rgba(var(--green-rgb), .1);
  color: var(--green);
  border: 1px solid rgba(var(--green-rgb), .25);
}

.auth-status-warn {
  background: rgba(var(--amber-rgb), .1);
  color: var(--amber);
  border: 1px solid rgba(var(--amber-rgb), .25);
}

.auth-status-error {
  background: rgba(var(--red-rgb), .1);
  color: var(--red);
  border: 1px solid rgba(var(--red-rgb), .25);
}

.btn-secondary {
  background: rgba(var(--accent-rgb), .12);
  color: var(--accent-hi);
  border: 1px solid rgba(var(--accent-rgb), .3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: rgba(var(--accent-rgb), .2); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Device auto toggle ────────────────────────────────────────────────────── */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.toggle-label input[type="checkbox"] { display: none; }

.toggle-track {
  width: 30px;
  height: 17px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  transition: background .15s;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s, background .15s;
}

.toggle-label input:checked + .toggle-track { background: var(--accent); }
.toggle-label input:checked + .toggle-track .toggle-thumb {
  transform: translateX(13px);
  background: var(--on-accent);
}

.device-fields-disabled input,
.device-fields-disabled textarea {
  opacity: 0.4;
  pointer-events: none;
  color: var(--muted);
}

/* ── Active account widget (nav footer) ────────────────────────────────────── */
.active-account {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.active-account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.active-account-manage {
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color .15s;
}
.active-account-manage:hover { color: var(--accent-hi); }
.active-account-manage svg { width: 13px; height: 13px; }

.active-account-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-account-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-account-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.active-account-empty {
  display: flex;
  flex-direction: column;
}

/* Pulsing dot for authenticated status */
.pill.pill-pulse::before { display: none; }

.auth-dot-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-green 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.75); }
}

/* Active row highlight in accounts table */
.active-row { background: rgba(var(--accent-rgb), .03); }
.active-row:hover { background: rgba(var(--accent-rgb), .06) !important; }

/* Active indicator button (set-active btn when already active) */
.btn-active-indicator { color: var(--accent-hi) !important; }
