:root {
  --bg: #10141c;
  --bg-2: #161c27;
  --panel: #1b2330;
  --line: #2c3648;
  --text: #e8edf5;
  --muted: #93a0b5;
  --accent: #0d9cde;
  --accent-2: #0ea5e9;
  --good: #3ecf8e;
  --warn: #e3b341;
  --bad: #f07178;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  /* Chart series, one per account in order. */
  --s1: #0d9cde;
  --s2: #3ecf8e;
  --s3: #e3b341;
  --s4: #a78bfa;
  --s5: #f472b6;
  --s6: #fb923c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(76, 141, 255, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
}

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}
.shell.wide { max-width: 1400px; }

/* The running version, pinned in the very top-right corner of every page. */
.app-version {
  position: fixed;
  top: 4px;
  right: 8px;
  z-index: 60;
  margin: 0;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface, #151a22);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.35;
  white-space: nowrap;
  user-select: all;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
}

h2 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.label-row h2 {
  margin: 0;
}

.run-flag {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.run-flag[data-state="running"] {
  color: #102016;
  background: var(--good);
  border-color: var(--good);
}

.run-flag[data-state="busy"] {
  color: #201a08;
  background: var(--warn);
  border-color: var(--warn);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

label, .label-row label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.log-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.log-tools .check {
  display: flex;
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.hint { color: var(--muted); font-size: 12px; }

input[type="text"],
input[type="url"],
input[type="number"],
input[type="time"],
textarea,
select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

textarea { resize: vertical; font-family: Consolas, "Cascadia Mono", monospace; }

input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(13, 156, 222, 0.45);
  border-color: var(--accent);
}

.drop {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px dashed #3d4b63;
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
}

.drop.over { border-color: var(--accent); background: rgba(76, 141, 255, 0.08); }

.drop-copy { flex: 1; min-width: 0; }
.drop-copy strong { display: block; }
.drop-copy span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; word-break: break-all; }

.csv-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

a.button-link {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.limits {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.limits input[type="number"] {
  width: 110px;
}

.mini {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
}

.mini input { width: 84px; }

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 12px;
}

.mode-label {
  color: var(--muted);
  font-size: 13px;
  min-width: 72px;
}

.actions, .inline-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions {
  justify-content: space-between;
  align-items: center;
}
.actions-run,
.actions-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.test-issue {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.test-issue label { white-space: nowrap; margin: 0; }
.test-issue input { flex: 1; min-width: 160px; }

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
}

.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-2); }
.smart {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 999px;
  font-weight: 650;
  letter-spacing: 0.03em;
  padding: 9px 18px;
}
.smart:hover {
  background: var(--accent);
  color: #fff;
}
.danger { background: var(--bad); color: #fff; }
.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.ghost:hover { border-color: var(--accent); }
button:disabled, input:disabled, textarea:disabled, select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.tiny { padding: 4px 10px; font-size: 12px; }

.bar {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3b6fd4, #4c8dff);
  transition: width 0.2s ease;
}

.batch-bar {
  height: 7px;
  margin-top: 8px;
  background: #0c1017;
  border: 1px dashed var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.batch-bar-fill {
  height: 100%;
  width: 0;
  background-image: repeating-linear-gradient(
    -55deg,
    #2dd4bf 0 6px,
    #0f766e 6px 12px
  );
  background-size: 16px 16px;
  animation: batch-stripe 0.7s linear infinite;
  transition: width 0.15s linear;
}

.batch-bar[data-phase="checking"] .batch-bar-fill {
  background-image: repeating-linear-gradient(
    -55deg,
    #38bdf8 0 6px,
    #0369a1 6px 12px
  );
}

.batch-bar[data-phase="preprocessing"] .batch-bar-fill {
  background-image: repeating-linear-gradient(
    -55deg,
    #fbbf24 0 6px,
    #b45309 6px 12px
  );
}

.batch-bar[data-phase="issuing"] .batch-bar-fill {
  background-image: repeating-linear-gradient(
    -55deg,
    #34d399 0 6px,
    #047857 6px 12px
  );
}

.batch-progress-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

@keyframes batch-stripe {
  to { background-position: 16px 0; }
}

.overlay-bar { margin-top: 14px; min-width: 220px; }
.csv-progress { margin-top: 14px; }
.status {
  color: var(--muted);
  white-space: pre-line;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.log-panel { min-height: 280px; }
.account-job { margin: 12px 0 16px; }
.account-log-wrap { height: 220px; margin-top: 10px; }
.log-wrap {
  height: 360px;
  overflow: auto;
  background: #0c1017;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.log-table {
  width: 100%;
  border-collapse: collapse;
  color: #d5deea;
  font: 12.5px/1.45 Consolas, "Cascadia Mono", monospace;
}
.log-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #151b26;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.log-table td {
  padding: 7px 10px;
  vertical-align: top;
  border-bottom: 1px solid #1b2230;
}
.log-table .log-link {
  width: 46%;
  word-break: break-all;
}
.log-table .log-status {
  width: 88px;
  white-space: nowrap;
  font-weight: 700;
}
.log-table .log-reason {
  word-break: break-word;
}
.log-table a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.log-row.log-issued { color: #3ecf8e; }
.log-row.log-issuable { color: #79b8ff; }
.log-row.log-skipped { color: #e3b341; }
.log-row.log-error { color: #f07178; }
.log-row.log-restricted { color: #ff5cad; }
.log-row.log-info { color: #d5deea; }

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.session-user {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.login-version {
  position: absolute;
  top: 14px;
  right: 18px;
}
a#logout {
  text-decoration: none;
}
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tab-btn {
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 8px;
}
.tab-btn.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
}

.tab-page[hidden] { display: none; }
.filter-field textarea { font-family: inherit; }
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}
.filter-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.filter-field { position: relative; }
.filter-field textarea,
.filter-field input,
.filter-field select {
  width: 220px;
  text-align: left;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
.filter-field textarea { min-height: 40px; max-height: 160px; resize: none; overflow: hidden; }
.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex: none;
}
.search-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.search-rules input { width: 88px; padding: 6px 8px; }
.search-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.search-meta { color: var(--muted); margin: 0; }
.search-select { display: flex; gap: 8px; flex-wrap: wrap; }
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 14px 0 8px;
  color: var(--muted);
}
.user-grid { user-select: none; }
.select-box {
  position: fixed;
  border: 2px dashed #0d9cde;
  background: rgba(13, 156, 222, 0.14);
  pointer-events: none;
  z-index: 10000;
}
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative;
  overflow: hidden;
}
.login-aurora {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(540px 280px at 12% 18%, rgba(13, 156, 222, 0.28), transparent 62%),
    radial-gradient(480px 320px at 88% 78%, rgba(244, 114, 182, 0.16), transparent 60%),
    radial-gradient(380px 220px at 70% 12%, rgba(34, 211, 238, 0.12), transparent 58%);
  pointer-events: none;
}
.login-frame {
  position: relative;
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 28px;
  align-items: stretch;
}
.login-copy {
  padding: 28px 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-copy h1 {
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
.login-lead {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 16px;
  max-width: 36ch;
}
.login-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  color: var(--text);
}
.login-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c9d4e4;
  font-size: 14px;
}
.login-points li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(13, 156, 222, 0.7);
  flex: none;
}
.login-card {
  width: 100%;
  background: rgba(27, 35, 48, 0.88);
  border: 1px solid rgba(76, 141, 255, 0.18);
  border-radius: 22px;
  padding: 28px 26px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(16px);
}
.login-card label {
  font-size: 13px;
  color: var(--muted);
}
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
}
.login-card-head h2 {
  margin: 8px 0 6px;
  font-size: 22px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}
.login-card-head p,
.login-card p { margin: 0; color: var(--muted); }
.login-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--line);
  background: rgba(13, 156, 222, 0.12);
  color: #8ecfff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.login-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.login-input-wrap input { flex: 1; }
.login-submit { margin-top: 6px; width: 100%; padding: 12px 16px; }
.login-error { color: var(--bad) !important; }
#gate-status[data-kind="ok"] { color: var(--good); }
#gate-status[data-kind="bad"] { color: var(--bad); }
#proxy-status[data-kind="ok"] { color: var(--good); }
#proxy-status[data-kind="bad"] { color: var(--bad); }
#proxy-save-status[data-kind="ok"] { color: var(--good); }
#proxy-save-status[data-kind="bad"] { color: var(--bad); }
#proxy-status:empty, #proxy-save-status:empty { display: none; }

/* Admin → Tokens & proxies */
.admin-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  font-size: 13px;
}
.admin-jump a {
  color: var(--accent-2);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.admin-jump a:hover { border-color: var(--accent-2); }
.admin-jump .hint { margin-left: auto; }
.tokens-toolbar,
.tokens-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.tokens-toolbar input[type="search"] {
  flex: 1 1 260px;
  min-width: 200px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel, transparent);
  color: inherit;
  font: inherit;
}
.tokens-bulk { padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; }
.tokens-bulk #tokens-help { flex: 1 1 320px; }
.tokens-wrap { max-height: 460px; }
.tokens-table .pick { width: 50px; text-align: center; }
/* Checkboxes are the main way to act on this table: give them a size and a hit
   area that do not need a steady hand. */
.tokens-table input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.tokens-table th.pick,
.tokens-table td.pick { padding-top: 7px; padding-bottom: 7px; }
.check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.tokens-table .token-tail,
.tokens-table .token-session,
.tokens-table .token-fingerprint {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}
.tokens-table .token-workspace { font-weight: 600; }
.tokens-table .token-actions { text-align: right; }
.tokens-table tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* The token cell copies on click now that the Copy button is gone. */
.tokens-table .token-tail.clickable { cursor: copy; }
.tokens-table .token-tail.clickable:hover { color: var(--accent); }

/* Progress bar for bulk admin actions. */
.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 10px;
}
.progress {
  position: relative;
  flex: 1 1 auto;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.35s ease;
}
.progress[data-indeterminate="1"] .progress-fill {
  width: 40% !important;
  animation: progress-slide 1.2s ease-in-out infinite;
}
@keyframes progress-slide {
  0% { transform: translateX(-60%); }
  100% { transform: translateX(220%); }
}
.tokens-toolbar-gap { flex: 1 1 auto; }
.tokens-table .token-readme,
.tokens-table .token-live { white-space: nowrap; }
.tokens-table .token-live {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.tokens-table .token-live-low { color: #f59e0b; }
.tokens-table .token-when { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* Logs tab: one row per line the app wrote. */
.logs-table .log-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0.75;
}
.logs-table .log-kind { white-space: nowrap; }
.logs-table .log-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.logs-table thead th { position: sticky; top: 0; }
.logs-table .button-link { margin-left: 4px; }

/* Admin tabs and the Monitor tab */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.admin-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.admin-tab:hover { color: var(--text); border-color: var(--accent-2); }
.admin-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-badge {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.monitor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.monitor-spacer { flex: 1 1 auto; }
.monitor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 4px;
}
.monitor-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: inherit;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
}
.monitor-row:hover { border-color: var(--accent-2); background: rgba(255, 255, 255, 0.05); }
.monitor-row-head { display: flex; gap: 10px; align-items: baseline; }
.monitor-repo {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--accent-2);
  white-space: nowrap;
}
.monitor-repo-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--accent-2);
  white-space: nowrap;
  text-decoration: none;
}
.monitor-repo-link:hover { text-decoration: underline; }
.monitor-title { flex: 1 1 auto; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor-title-link { color: var(--accent-2); text-decoration: none; }
.monitor-title-link:hover { color: var(--accent); text-decoration: underline; }
.monitor-row.closed { opacity: 0.55; cursor: default; }
.monitor-row.closed:hover { border-color: var(--line); }
.monitor-next { color: var(--muted); font-size: 12px; white-space: nowrap; }
.monitor-check { margin-left: auto; }
.monitor-age { color: var(--muted); font-size: 12px; white-space: nowrap; }
.monitor-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.monitor-badge {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid currentColor;
}
.monitor-badge.unread { color: #ff8fa3; }
.monitor-badge.answered { color: var(--good); }
.monitor-badge.waiting { color: #e0b341; }
.monitor-badge.silent { color: var(--muted); }
.monitor-badge.closed { color: #8d93a1; }
.monitor-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.monitor-pager { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.monitor-card { width: min(760px, 94vw); }
.monitor-body { display: flex; flex-direction: column; gap: 10px; }
.monitor-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}
.monitor-bubble {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
}
.monitor-bubble.opening { border-style: dashed; }
.monitor-bubble.mine { border-color: var(--accent-2); background: rgba(110, 168, 254, 0.08); }
.monitor-bubble-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.monitor-bubble-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.5; }
.monitor-reply { display: flex; flex-direction: column; gap: 8px; }
.monitor-reply textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font: inherit;
  resize: vertical;
}
.monitor-reply-actions { display: flex; gap: 10px; align-items: center; }
@media (max-width: 640px) {
  .admin-tab { padding: 7px 12px; font-size: 12px; }
  .monitor-card { width: 96vw; }
}

/* Collapsible admin panels (Tokens & proxies) and the workspace Analytics tab */
.tokens-fold > summary { cursor: pointer; list-style: none; }
.tokens-fold > summary::-webkit-details-marker { display: none; }
.tokens-fold > summary::before { content: "▸"; margin-right: 8px; color: var(--muted); }
.tokens-fold[open] > summary::before { content: "▾"; }
.tokens-fold[open] > summary { margin-bottom: 6px; }
.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 6px;
}
.stat-bars { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 18px; }
.stat-bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 64px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.stat-bar-label { color: var(--muted); white-space: nowrap; }
.stat-bar-track { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.stat-bar-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent, #6ea8fe));
}
.stat-bar-fill.is-zero { background: transparent; }
.stat-bar-value { text-align: right; font-variant-numeric: tabular-nums; }
.stat-bar-value.is-zero { color: var(--muted); }
@media (max-width: 640px) {
  .stat-bar-row { grid-template-columns: 48px 1fr 56px; }
}
@media (max-width: 820px) {
  .login-frame { grid-template-columns: 1fr; gap: 18px; }
  .login-copy { padding: 8px 4px 0; }
  .login-copy h1 { font-size: 32px; }
}
.csv-btn {
  min-width: auto;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.csv-btn:hover {
  border-color: var(--accent);
  color: #fff;
}
.csv-modal { z-index: 50; }
.csv-card {
  width: min(640px, 94vw);
  max-height: 88vh;
  padding: 0;
}
.csv-card .modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.csv-card .modal-head h3 { margin: 0; }
.csv-card .modal-body { padding: 18px 20px 22px; }
.settings-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
}
.settings-btn:hover {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.settings-modal { z-index: 50; }
.settings-card {
  width: min(1100px, 94vw);
  max-height: 88vh;
  padding: 0;
}
.settings-card .modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.settings-card .modal-head h3 { margin: 0; }
.settings-card .modal-body { padding: 18px 20px 22px; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  align-items: start;
}
.settings-grid h2 { margin-top: 18px; }
.settings-grid h2:first-child { margin-top: 0; }
.settings-limits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.settings-limits label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  color: var(--text);
}
@media (max-width: 980px) {
  .settings-grid { grid-template-columns: 1fr; }
}
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(32px, 32px));
  gap: 4px;
  justify-content: start;
}
.user-card {
  position: relative;
  width: 32px;
  height: 32px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  border: 1px solid transparent;
}
.user-card img { width: 32px; height: 32px; object-fit: cover; display: block; }
.user-card .user-initials {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #cfd5de;
  background: #2a2f37;
  user-select: none;
}
.user-card.owned { opacity: 0.5; cursor: not-allowed; }
.user-card.selected { border-color: var(--accent); }
.user-card.selected::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.user-card .owned-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 6px;
  font-weight: 700;
}
/* Already in another workspace: marked, selectable, warned about before adding. */
.user-card.taken .owned-mark.taken-mark {
  background: rgba(32,32,32,0.42);
  color: #ffd166;
  font-size: 5px;
  letter-spacing: 0.02em;
}
.add-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f472b6, #22d3ee);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(13, 156, 222, 0.35);
  z-index: 20;
}
.add-fab[hidden] { display: none; }
.add-fab span { font-size: 22px; font-weight: 800; line-height: 1; }
.add-fab small { font-size: 11px; font-weight: 700; }

.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.list-toolbar .pager { margin: 0; }
.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-btn {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
  min-width: 110px;
}
.cat-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.cat-btn span {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  font-size: 12px;
}
.list-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
  max-height: calc(100vh - 180px);
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg);
}
.list-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.list-wrap::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 999px;
  margin: 6px 0;
}
.list-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  border: 2px solid var(--bg);
}
.list-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}
.list-wrap::-webkit-scrollbar-corner {
  background: transparent;
}
.users-table {
  width: 100%;
  border-collapse: collapse;
}
.account-actions { margin-bottom: 12px; }
.account-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}
.sort-btn {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: 0;
}
.token-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}
/* Session id and fingerprint of each token, on the Tokens tab. */
.session-cell,
.fingerprint-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}
.fingerprint-cell { color: var(--muted); }
.muted-cell { opacity: 0.55; }
.account-log-toggle { margin-top: 6px; }

/* Settings → Proxy → Request log: what the server really sent to GitHub. */
.request-log-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.proxy-tokens-wrap { max-height: 280px; }
.request-log-wrap { height: 240px; }
.request-log-table td { font-size: 12px; vertical-align: top; }
.request-row { cursor: pointer; }
.request-row:hover td { background: rgba(255, 255, 255, 0.03); }
.request-time, .request-ms { color: var(--muted); white-space: nowrap; }
.request-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
}
.request-status-ok { color: var(--good); }
.request-status-bad { color: var(--bad); }
.request-detail td { padding: 0 0 10px; }
.request-headers {
  margin: 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--muted);
}
.users-table th, .users-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.users-table th {
  position: sticky;
  top: 0;
  background: #151b26;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}
.users-table a { color: var(--accent-2); }
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-new { background: rgba(13,156,222,0.18); color: #7dd3fc; }
.badge-issued { background: rgba(62,207,142,0.18); color: var(--good); }
.badge-skipped { background: rgba(227,179,65,0.18); color: var(--warn); }

.process-filter { margin-top: 16px; margin-bottom: 12px; }
.issue-delay { margin-bottom: 8px; }
.check { margin-top: 12px; }
.mode-row .check { margin-top: 0; }
.issue-delay .hint { display: block; margin-top: 8px; }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-row input { flex: 1; min-width: 180px; }
.filter-row .hint { white-space: nowrap; }

body.is-syncing .shell,
body.is-syncing .app-version {
  pointer-events: none;
  user-select: none;
}

.overlay, .modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}
.overlay[hidden], .modal[hidden] { display: none; }
.overlay-card, .modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  min-width: 280px;
}
.overlay-card { text-align: center; }
.modal-card { width: min(640px, 92vw); max-height: 80vh; display: flex; flex-direction: column; }
.modal-card.settings-card {
  width: min(1100px, 94vw);
  max-height: 90vh;
}
.modal-body { overflow: auto; flex: 1; }
.modal-head, .modal-foot { display: flex; justify-content: space-between; gap: 10px; }
.modal-foot { justify-content: flex-end; padding-top: 12px; }
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
.overlay-detail {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.overlay-card .overlay-bar { min-width: 240px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .top { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 24px; }
}

.account-action { white-space: nowrap; }
.account-action button + button { margin-left: 6px; }
.status-noscope { color: var(--bad); font-weight: 600; }
.status-restricted { color: var(--warn); }
.status-ready { color: var(--good); }

/* ---- Admin overview --------------------------------------------------- */
.admin-notice {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 14px;
}
.admin-notice.warn {
  border-color: rgba(227, 179, 65, 0.6);
  background: rgba(227, 179, 65, 0.12);
  color: #f3d58a;
}
.admin-notice.bad {
  border-color: rgba(240, 113, 120, 0.6);
  background: rgba(240, 113, 120, 0.12);
  color: #f7a0a5;
}
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-table-wrap { overflow: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.admin-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table .num { text-align: right; }
.admin-account { font-weight: 650; }
.admin-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-log { max-width: 260px; }
.admin-ok { color: var(--good); }
.admin-warn { color: var(--warn); }
.state-pill {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.state-pill[data-state="processing"],
.state-pill[data-state="smart"] {
  color: #102016;
  background: var(--good);
  border-color: var(--good);
}
.state-pill[data-state="preprocess"] {
  color: #201a08;
  background: var(--warn);
  border-color: var(--warn);
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 250px;
}
.admin-actions button { white-space: nowrap; }
.admin-table td.nowrap { white-space: nowrap; }
.admin-foot { margin: 14px 0 0; }
.admin-password {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}
.admin-password .field { margin-bottom: 0; }
.admin-password label { padding: 0; margin-bottom: 6px; cursor: default; }
.admin-password input[type="password"] { width: 100%; }
@media (max-width: 900px) {
  .admin-password { grid-template-columns: 1fr; }
}

/* ---- Admin analytics ---------------------------------------------------- */
.analytics-title {
  margin: 18px 0 4px;
  font-size: 14px;
  font-weight: 650;
}
.analytics-title:first-of-type { margin-top: 4px; }
.analytics-hint { margin: 0 0 12px; }
.chart-box { position: relative; margin-top: 4px; }
.analytics-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 18px;
}
.analytics-head .analytics-title { margin: 0; }
.analytics-head + .analytics-hint { margin-top: 6px; }
.analytics-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.analytics-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  cursor: default;
}
.analytics-control input,
.analytics-control select { width: auto; min-width: 150px; padding: 6px 10px; font-size: 13px; }
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.segmented .seg {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.segmented .seg + .seg { border-left: 1px solid var(--line); }
.segmented .seg:hover { color: var(--text); }
.segmented .seg.active { background: var(--accent); color: #fff; }
.analytics-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item strong { color: var(--text); font-weight: 600; }
.legend-total { margin-left: auto; }
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
  flex: none;
}
.swatch-issuable { background: var(--s4); }
.swatch-issued { background: var(--accent); }
.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart-svg .baseline { stroke: var(--line); stroke-width: 1; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-svg .axis-label { fill: var(--muted); font-size: 10px; font-family: inherit; pointer-events: none; }
.chart-svg .hit { fill: transparent; }
.chart-svg .area { opacity: 0.55; pointer-events: none; }
.chart-svg .area-line { fill: none; stroke-width: 1.5; pointer-events: none; }
.chart-svg .marker { stroke: var(--text); stroke-width: 1; opacity: 0.6; pointer-events: none; }
.chart-svg .bar-issuable { fill: var(--s4); pointer-events: none; }
.chart-svg .bar-issued { fill: var(--accent); pointer-events: none; }
.chart-svg .band:hover .bar-issuable,
.chart-svg .band:hover .bar-issued { opacity: 0.8; }
.chart-svg .tick { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart-svg .tick-mark { stroke: var(--line); stroke-width: 1; }
.chart-axis-label { color: var(--muted); font-size: 11px; align-self: start; }
.chart-tip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}
.chart-tip .admin-sub { margin-top: 2px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.chart-tip .tip-row span { color: var(--muted); }
.chart-tip .tip-row strong { margin-left: auto; padding-left: 10px; }
.chart-tip .swatch { width: 8px; height: 8px; }
.analytics-details { margin: 12px 0 0; }
.analytics-details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.analytics-details .admin-table-wrap { margin-top: 8px; max-height: 320px; }
.analytics-table td { padding: 7px 8px; }
.analytics-table td.muted { color: var(--muted); }
.analytics-table .account-start td { border-top: 1px solid var(--line); }
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 8px;
}
@media (max-width: 1000px) {
  .analytics-grid { grid-template-columns: 1fr; }
}

/* ---- Acting as admin inside a workspace ------------------------------- */
.admin-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
}
.admin-banner strong { color: var(--text); }

/* ---- Workspace settings and the shared website link ------------------- */
.ws-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.ws-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.ws-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ws-form legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.ws-form .mode-row { margin-top: 12px; }
.ws-form .mode-row .mode-label { flex-basis: 100%; }
.ws-form .ws-filter { margin: 12px 0 0; }
.ws-form textarea,
.website-form textarea { width: 100%; }
.ws-form.busy { opacity: 0.6; pointer-events: none; }
.ws-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.ws-actions .status { margin: 0; }
@media (max-width: 1100px) {
  .ws-grid { grid-template-columns: 1fr; }
}

/* ---- Admin activity and password resets -------------------------------- */
.audit-wrap { max-height: 360px; }
.admin-table td.wrap { white-space: normal; max-width: 420px; }
.admin-password select { width: 100%; }
.admin-foot code { color: var(--muted); font-size: 12px; }

/* ---- Refreshed look (admin and workspace pages) ------------------------- */
/* Scoped to body.modern, which the admin and workspace pages both set. */
body.modern {
  --bg: #0b0f17;
  --bg-2: #111724;
  --panel: #121a28;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e6ebf3;
  --muted: #8b97ad;
  --accent: #2ea8ff;
  --accent-2: #5ac0ff;
  --fill: rgba(255, 255, 255, 0.03);
  --fill-2: rgba(255, 255, 255, 0.05);
  --panel-top: rgba(255, 255, 255, 0.025);
  --table-head: #182235;
  --row-hover: rgba(255, 255, 255, 0.02);
  --tip-bg: #182235;
  --log-text: #d5deea;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(46, 168, 255, 0.16), transparent 60%),
    radial-gradient(800px 400px at 100% 0%, rgba(167, 139, 250, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  color-scheme: dark;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
/* Light theme: set by the inline theme script from the Settings dialog. */
html[data-theme="light"] { background: #eef1f6; }
html[data-theme="light"] body.modern {
  --bg: #eef1f6;
  --bg-2: #e4e9f1;
  --panel: #ffffff;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --muted: #5b6678;
  --accent: #1a8fe3;
  --accent-2: #2ea8ff;
  --good: #1a9e68;
  --warn: #b7791f;
  --bad: #d64550;
  --fill: rgba(15, 23, 42, 0.03);
  --fill-2: rgba(15, 23, 42, 0.06);
  --panel-top: rgba(255, 255, 255, 0);
  --table-head: #f1f4f9;
  --row-hover: rgba(15, 23, 42, 0.03);
  --tip-bg: #ffffff;
  --log-text: #1e293b;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(46, 168, 255, 0.14), transparent 60%),
    radial-gradient(800px 400px at 100% 0%, rgba(167, 139, 250, 0.12), transparent 60%),
    var(--bg);
  color-scheme: light;
}
html[data-theme="light"] body.modern .log-row.log-issued { color: #15803d; }
html[data-theme="light"] body.modern .log-row.log-issuable { color: #0369a1; }
html[data-theme="light"] body.modern .log-row.log-skipped { color: #b45309; }
html[data-theme="light"] body.modern .log-row.log-error { color: #dc2626; }
html[data-theme="light"] body.modern .log-row.log-restricted { color: #be185d; }
html[data-theme="light"] body.modern .log-row.log-info { color: var(--log-text); }
html[data-theme="light"] body.modern .state-pill[data-state="processing"],
html[data-theme="light"] body.modern .state-pill[data-state="smart"] { background: rgba(26, 158, 104, 0.12); }
html[data-theme="light"] body.modern .danger { color: #c0392b; }
html[data-theme="light"] body.modern .danger:hover { color: #fff; }
html[data-theme="light"] body.modern .chart-svg .marker { stroke: #334155; }
html[data-theme="light"] body.modern .user-card .user-initials { background: #cbd5e1; color: #1e293b; }
body.modern .shell.wide { max-width: 1440px; padding: 24px 24px 56px; }
body.modern .app-version { opacity: 0.7; }

/* Header */
body.modern .top { margin-bottom: 18px; }
body.modern .brand { gap: 14px; }
body.modern .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  box-shadow: 0 8px 20px rgba(46, 168, 255, 0.3);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  flex: none;
}
body.modern .eyebrow { margin: 0 0 2px; font-weight: 600; color: var(--muted); letter-spacing: 0.14em; }
body.modern h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
body.modern .header-right { gap: 10px; }
body.modern .header-right .hint { font-size: 12px; }
body.modern .session-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--fill);
  font-size: 13px;
}
body.modern .session-user::before {
  content: attr(data-initial);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* Panels and headings */
body.modern .panel {
  background: linear-gradient(180deg, var(--panel-top), rgba(255, 255, 255, 0)) , var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 22px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
body.modern h2 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.005em;
  text-transform: none;
  color: var(--text);
  margin: 0 0 14px;
}
body.modern .admin-head { align-items: center; margin-bottom: 14px; }
body.modern .admin-head h2 { margin: 0; }
body.modern .hint { font-size: 12.5px; line-height: 1.5; }
body.modern .admin-foot { margin-top: 14px; }
body.modern .admin-notice { border-radius: 12px; }

/* Stat tiles */
body.modern .stat-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
body.modern .stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--fill);
  min-width: 0;
}
body.modern .stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
body.modern .stat-value {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
body.modern .stat-value.good { color: var(--good); }
body.modern .stat-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  body.modern .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tables */
body.modern .admin-table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--fill);
}
body.modern .admin-table th {
  padding: 10px 10px;
  background: var(--fill-2);
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
body.modern .admin-table th:first-child { border-top-left-radius: 14px; }
body.modern .admin-table th:last-child { border-top-right-radius: 14px; }
body.modern .admin-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
body.modern .admin-table tbody tr:hover td { background: var(--row-hover); }
body.modern .admin-table tbody tr:last-child td { border-bottom: 0; }
body.modern .admin-account { font-size: 15px; font-weight: 650; }
body.modern .admin-sub { font-size: 12px; margin-top: 2px; }
body.modern .analytics-table td { padding: 9px 12px; }
body.modern .analytics-table .account-start td { border-top: 1px solid var(--line-strong); }
body.modern .audit-wrap { max-height: 380px; }

/* State pill with a dot */
body.modern .state-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--line);
  background: var(--fill-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
body.modern .state-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
body.modern .state-pill[data-state="processing"],
body.modern .state-pill[data-state="smart"] {
  color: var(--good);
  background: rgba(62, 207, 142, 0.12);
  border-color: rgba(62, 207, 142, 0.35);
}
body.modern .state-pill[data-state="processing"]::before,
body.modern .state-pill[data-state="smart"]::before {
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.2);
}
body.modern .state-pill[data-state="preprocess"] {
  color: var(--warn);
  background: rgba(227, 179, 65, 0.12);
  border-color: rgba(227, 179, 65, 0.35);
}
body.modern .state-pill[data-state="preprocess"]::before { background: var(--warn); }

/* Buttons */
body.modern button {
  border-radius: 10px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}
body.modern button:active:not(:disabled) { transform: translateY(1px); }
body.modern .primary {
  background: linear-gradient(135deg, var(--accent), #1f8df0);
  color: #fff;
  box-shadow: 0 6px 16px rgba(46, 168, 255, 0.25);
}
body.modern .primary:hover { background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
body.modern .ghost {
  background: var(--fill);
  border: 1px solid var(--line-strong);
  color: var(--text);
}
body.modern .ghost:hover { background: var(--fill-2); border-color: var(--accent); }
body.modern .smart {
  background: rgba(46, 168, 255, 0.12);
  border: 1px solid rgba(46, 168, 255, 0.5);
  color: var(--accent-2);
  border-radius: 10px;
  padding: 10px 16px;
  letter-spacing: 0;
}
body.modern .smart:hover { background: var(--accent); color: #fff; }
body.modern .danger {
  background: rgba(240, 113, 120, 0.12);
  border: 1px solid rgba(240, 113, 120, 0.45);
  color: #f7a0a5;
}
body.modern .danger:hover { background: var(--bad); color: #fff; }
body.modern .tiny { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
body.modern .smart.tiny { padding: 5px 11px; }
body.modern .admin-actions { gap: 5px; min-width: 260px; }
body.modern button:disabled { opacity: 0.4; box-shadow: none; }

/* Inputs */
body.modern input[type="text"],
body.modern input[type="number"],
body.modern input[type="date"],
body.modern input[type="password"],
body.modern textarea,
body.modern select {
  width: 100%;
  background: var(--fill);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13.5px;
  color-scheme: dark;
}
body.modern textarea { font-family: "JetBrains Mono", Consolas, "Cascadia Mono", monospace; font-size: 12.5px; line-height: 1.5; }
body.modern input:focus,
body.modern textarea:focus,
body.modern select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 168, 255, 0.25);
}
body.modern label { font-size: 12.5px; }
body.modern .check { font-size: 13.5px; }
body.modern .check input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
body.modern .mode-label { font-size: 12.5px; }
body.modern .analytics-control input,
body.modern .analytics-control select { width: auto; min-width: 150px; padding: 6px 10px; font-size: 13px; }

/* Analytics */
body.modern .analytics-title { font-size: 14px; font-weight: 650; }
body.modern .chart-box {
  padding: 14px 14px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--fill);
}
body.modern .analytics-legend { margin: 0 0 8px; }
body.modern .legend-item {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--fill);
}
body.modern .segmented { background: var(--fill); border-radius: 10px; padding: 3px; gap: 2px; border-color: var(--line-strong); }
body.modern .segmented .seg { border-radius: 8px; padding: 5px 13px; font-weight: 600; }
body.modern .segmented .seg + .seg { border-left: 0; }
body.modern .segmented .seg.active {
  background: linear-gradient(135deg, var(--accent), #1f8df0);
  color: #fff;
  box-shadow: 0 4px 10px rgba(46, 168, 255, 0.25);
}
body.modern .chart-svg .grid { stroke: var(--line); }
body.modern .chart-svg .baseline { stroke: var(--line-strong); }
body.modern .chart-svg .area { opacity: 1; }
body.modern .chart-svg .area-line { stroke-width: 1.75; }
body.modern .chart-tip {
  border-radius: 10px;
  background: var(--tip-bg);
  border-color: var(--line-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
body.modern .analytics-details summary { font-size: 12.5px; }
body.modern .analytics-details summary:hover { color: var(--text); }

/* Forms */
body.modern .ws-form fieldset,
body.modern .admin-password,
body.modern .website-form {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--fill);
}
body.modern .ws-form fieldset { padding: 14px 16px 16px; }
body.modern .ws-form legend {
  padding: 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
body.modern .admin-password { padding: 16px; }
body.modern .website-form { padding: 16px; }
body.modern .ws-actions .status,
body.modern .status { font-size: 12.5px; }
body.modern .settings-limits { gap: 12px 14px; }

/* Activity chips */
body.modern .chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--fill-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
body.modern .chip-login,
body.modern .chip-open,
body.modern .chip-close,
body.modern .chip-logout { color: var(--accent-2); border-color: rgba(46, 168, 255, 0.4); background: rgba(46, 168, 255, 0.1); }
body.modern .chip-start { color: var(--good); border-color: rgba(62, 207, 142, 0.4); background: rgba(62, 207, 142, 0.1); }
body.modern .chip-stop { color: var(--warn); border-color: rgba(227, 179, 65, 0.4); background: rgba(227, 179, 65, 0.1); }
body.modern .chip-settings,
body.modern .chip-website,
body.modern .chip-readme { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.4); background: rgba(167, 139, 250, 0.1); }
body.modern .chip-password,
body.modern .chip-reset_password,
body.modern .chip-admin_password { color: #f9a8d4; border-color: rgba(244, 114, 182, 0.4); background: rgba(244, 114, 182, 0.1); }
body.modern .chip-login_failed,
body.modern .chip-clear_repos { color: #f7a0a5; border-color: rgba(240, 113, 120, 0.45); background: rgba(240, 113, 120, 0.12); }
body.modern .admin-foot code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--fill-2);
  font-size: 11.5px;
}
body.modern .ws-form .mode-row .mini { gap: 8px; }
body.modern .ws-form .mini input[type="number"] { width: 96px; }

/* ---- Workspace page: refreshed look ------------------------------------- */
/* Header: tabs as a segmented pill, run flag as a dot pill. */
body.modern .tabs {
  gap: 2px;
  padding: 3px;
  background: var(--fill);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}
body.modern .tab-btn {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
body.modern .tab-btn:hover { color: var(--text); }
body.modern .tab-btn.active {
  background: linear-gradient(135deg, var(--accent), #1f8df0);
  color: #fff;
  box-shadow: 0 4px 10px rgba(46, 168, 255, 0.25);
}
body.modern .run-flag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--line);
  background: var(--fill-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
body.modern .run-flag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
body.modern .run-flag[data-state="running"] {
  color: var(--good);
  background: rgba(62, 207, 142, 0.12);
  border-color: rgba(62, 207, 142, 0.35);
}
body.modern .run-flag[data-state="running"]::before {
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.2);
}
body.modern .run-flag[data-state="busy"] {
  color: var(--warn);
  background: rgba(227, 179, 65, 0.12);
  border-color: rgba(227, 179, 65, 0.35);
}
body.modern .run-flag[data-state="busy"]::before { background: var(--warn); }
body.modern .csv-btn,
body.modern .settings-btn {
  height: 34px;
  background: var(--fill);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
}
body.modern .settings-btn { width: 34px; }
body.modern .settings-btn svg { width: 18px; height: 18px; }
body.modern .csv-btn:hover,
body.modern .settings-btn:hover { background: var(--fill-2); border-color: var(--accent); color: #fff; }
body.modern .admin-banner {
  padding: 8px 14px;
  background: var(--fill);
  border-color: var(--line);
  border-radius: 12px;
}

/* Search tab */
body.modern .filter-bar {
  padding: 12px;
  background: linear-gradient(180deg, var(--panel-top), rgba(255, 255, 255, 0)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
body.modern .filter-field textarea,
body.modern .filter-field input,
body.modern .filter-field select {
  width: 220px;
  background: var(--fill);
  border: 1px solid var(--line-strong);
  font-family: inherit;
}
body.modern .search-meta,
body.modern .pager { font-size: 13px; }
body.modern .pager span { font-variant-numeric: tabular-nums; }
body.modern .user-card { border-radius: 4px; }
body.modern .user-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
body.modern .add-fab { box-shadow: 0 14px 34px rgba(46, 168, 255, 0.35); }

/* List tab */
body.modern .cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 10px 7px 14px;
  border-radius: 999px;
  background: var(--fill);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
}
body.modern .cat-btn:hover { color: var(--text); border-color: var(--accent); }
body.modern .cat-btn.active {
  background: linear-gradient(135deg, var(--accent), #1f8df0);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 10px rgba(46, 168, 255, 0.25);
}
body.modern .cat-btn span {
  margin: 0;
  padding: 1px 8px;
  background: var(--fill-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
body.modern .cat-btn.active span { background: rgba(255, 255, 255, 0.2); border-color: transparent; }
body.modern .list-meta { color: var(--muted); font-size: 13px; }
body.modern .list-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  scrollbar-color: var(--line-strong) transparent;
}
body.modern .list-wrap::-webkit-scrollbar-track { background: transparent; }
body.modern .list-wrap::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 2px solid var(--panel);
}
body.modern .users-table th {
  padding: 10px 12px;
  background: var(--table-head);
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
body.modern .users-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
body.modern .users-table tbody tr:hover td { background: var(--row-hover); }
body.modern .users-table tbody tr:last-child td { border-bottom: 0; }
body.modern .badge { padding: 3px 9px; font-weight: 600; border: 1px solid transparent; }
body.modern .badge-new { border-color: rgba(46, 168, 255, 0.35); background: rgba(46, 168, 255, 0.1); color: var(--accent-2); }
body.modern .badge-issued { border-color: rgba(62, 207, 142, 0.35); background: rgba(62, 207, 142, 0.1); }
body.modern .badge-skipped { border-color: rgba(227, 179, 65, 0.35); background: rgba(227, 179, 65, 0.1); }

/* Process tab */
body.modern .actions-panel .actions { gap: 12px; }
body.modern .test-issue { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
body.modern .test-issue label { font-size: 12.5px; }
body.modern .bar {
  height: 9px;
  background: var(--fill-2);
  border: 1px solid var(--line);
}
body.modern .bar-fill { background: linear-gradient(90deg, var(--accent), #1f8df0); }
body.modern .batch-bar { background: var(--fill); border-color: var(--line-strong); border-radius: 4px; }
body.modern .progress-text { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
body.modern .issue-delay,
body.modern .process-filter {
  margin: 12px 0 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--fill);
}
body.modern .issue-delay > label,
body.modern .process-filter > label {
  margin-bottom: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
body.modern .issue-delay .hint { margin-top: 8px; }
body.modern .limits input[type="number"] { width: 110px; }
body.modern .mini input { width: 84px; }
body.modern .search-rules input { width: 88px; }
body.modern .filter-row input { width: auto; flex: 1; }
body.modern .log-wrap {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
body.modern .log-table { font-size: 12.5px; color: var(--log-text); }
body.modern .log-table th { background: var(--table-head); border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
body.modern .log-table td { border-bottom: 1px solid rgba(148, 163, 184, 0.08); }
body.modern .log-tools .check { font-size: 13px; }

/* Tokens tab */
body.modern .account-actions { gap: 8px; }
body.modern .account-summary { font-size: 13px; }
body.modern .account-job { margin: 14px 0 16px; }
body.modern .token-cell { font-size: 12px; color: var(--muted); }
body.modern .status-ready { color: var(--good); font-weight: 600; }
body.modern .status-restricted { color: var(--warn); font-weight: 600; }

/* Overlay and modals */
body.modern .overlay,
body.modern .modal { background: rgba(5, 8, 14, 0.6); backdrop-filter: blur(4px); }
body.modern .overlay-card,
body.modern .modal-card {
  background: linear-gradient(180deg, var(--panel-top), rgba(255, 255, 255, 0)), var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
body.modern .modal-head h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.005em; }
body.modern .settings-card .modal-head,
body.modern .csv-card .modal-head { border-bottom-color: var(--line); }
body.modern .settings-grid > section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--fill);
}
body.modern .settings-grid h2 { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
body.modern .settings-grid h2:not(:first-child) { margin-top: 20px; }
body.modern .drop {
  border: 1px dashed var(--line-strong);
  background: var(--fill);
  border-radius: 14px;
}
body.modern .drop.over { border-color: var(--accent); background: rgba(46, 168, 255, 0.08); }
body.modern .spinner { border-color: var(--line-strong); border-top-color: var(--accent); }
body.modern .select-box { border-color: var(--accent); background: rgba(46, 168, 255, 0.14); }

/* ---- Selects: one look everywhere, no browser-drawn box ----------------- */
body.modern select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--fill);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' fill='none' stroke='%238b97ad' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
  cursor: pointer;
}
body.modern select:disabled { cursor: not-allowed; }
body.modern select option { background: var(--panel); color: var(--text); }
body.modern .analytics-control select { min-width: 160px; }
body.modern input[type="date"] { cursor: pointer; }

/* ---- Admin accounts table: fits without a horizontal scrollbar ---------- */
body.modern .admin-table td { padding: 12px 8px; }
body.modern .admin-table th { padding-left: 8px; padding-right: 8px; }
body.modern .admin-table td:first-child,
body.modern .admin-table th:first-child { padding-left: 12px; }
body.modern .admin-table td.num .admin-sub { text-align: right; max-width: none; }
body.modern .admin-sub,
body.modern .admin-log { max-width: 170px; }
body.modern .admin-table .num { white-space: nowrap; }
body.modern .admin-actions {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 5px;
  min-width: 0;
}
body.modern .admin-actions .tiny { padding: 5px 10px; font-size: 12px; }
@media (max-width: 1180px) {
  body.modern .admin-table .col-extra { display: none; }
}
@media (max-width: 980px) {
  body.modern .admin-sub,
  body.modern .admin-log { max-width: 150px; }
  body.modern .admin-actions { grid-template-columns: repeat(2, max-content); }
}

/* ---- Hourly line chart --------------------------------------------------- */
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.chart-svg .line-issuable { stroke: var(--s4); }
.chart-svg .line-issued { stroke: var(--accent); }
.chart-svg .line-fill { pointer-events: none; opacity: 0.12; }
.chart-svg .line-fill-issuable { fill: var(--s4); }
.chart-svg .line-fill-issued { fill: var(--accent); }
.chart-svg .dot { pointer-events: none; stroke: var(--panel); stroke-width: 1.5; }
.chart-svg .dot-issuable { fill: var(--s4); }
.chart-svg .dot-issued { fill: var(--accent); }
.sender-link { color: var(--accent-2); text-decoration: none; }
.sender-link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---- Admin settings dialog ---------------------------------------------- */
body.modern .admin-settings-card { width: min(1000px, 94vw); }
body.modern .admin-settings-grid .admin-password { grid-template-columns: 1fr; gap: 10px; }
body.modern .admin-settings-grid .admin-password-submit { justify-self: start; }
body.modern .admin-settings-grid .website-form { padding: 0; border: 0; background: transparent; }
body.modern .admin-settings-grid .ws-actions { margin-top: 10px; }
body.modern .admin-settings-grid .status { margin: 8px 0 0; font-size: 12.5px; }
body.modern .admin-settings-grid .mode-row { margin-top: 0; }
body.modern .admin-settings-grid .mode-row + .hint { margin: 8px 0 0; }
body.modern .admin-settings-grid h2:not(:first-child) { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---- Workspace theme button ---------------------------------------------- */
body.modern .theme-btn .icon-sun { display: none; }
html[data-theme="light"] body.modern .theme-btn .icon-sun { display: block; }
html[data-theme="light"] body.modern .theme-btn .icon-moon { display: none; }

/* ---- Collapsible sender and skip tables ---------------------------------- */
.analytics-fold { margin: 18px 0 0; }
.analytics-fold summary.analytics-title {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.analytics-fold summary.analytics-title::-webkit-details-marker { display: none; }
.analytics-fold summary.analytics-title::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: none;
  margin-left: 2px;
}
.analytics-fold[open] summary.analytics-title::before { transform: rotate(45deg); }
.analytics-fold summary.analytics-title:hover::before { border-color: var(--text); }
.analytics-fold .analytics-hint { margin-top: 6px; }
.analytics-fold .admin-table-wrap { max-height: 420px; }

/* ---- Recent issues ------------------------------------------------------- */
.analytics-fold .fold-head { margin-top: 6px; align-items: center; }
.analytics-fold .fold-head .analytics-hint { margin: 0; }
.issues-table td { vertical-align: middle; }
.issues-table .admin-sub { max-width: 200px; }

/* ---- Value labels on the charts ------------------------------------------ */
.chart-svg .value-label {
  fill: var(--text);
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.chart-svg .value-label.issuable { fill: var(--s4); }
.chart-svg .value-label.issued { fill: var(--accent); }
.chart-svg .value-label.series-0 { fill: var(--s1); }
.chart-svg .value-label.series-1 { fill: var(--s2); }
.chart-svg .value-label.series-2 { fill: var(--s3); }
.chart-svg .value-label.series-3 { fill: var(--s4); }
.chart-svg .value-label.series-4 { fill: var(--s5); }
.chart-svg .value-label.series-5 { fill: var(--s6); }

/* ---- Account button rows (hourly chart, recent issues) ------------------- */
.account-seg { flex-wrap: wrap; }
.account-seg .seg { padding: 4px 10px; }
.account-seg:empty { display: none; }
body.modern .account-seg .seg { padding: 4px 11px; }
.analytics-control .account-seg { margin-left: 2px; }

/* ---- Workspace settings dialog ------------------------------------------- */
.ws-modal-card .ws-grid { margin-top: 12px; }
.ws-modal-card .ws-top { min-height: 26px; }
body.modern .ws-modal-card .ws-actions { margin-top: 14px; }
@media (max-width: 1100px) {
  .ws-modal-card .ws-grid { grid-template-columns: 1fr; }
}

/* Login page: which workspaces exist on this server */
.login-workspaces {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
.login-workspaces code { font-size: 11px; opacity: 0.85; }
.login-workspaces:empty { display: none; }


/* Admin → Tokens & proxies: what GitHub says about each token */
.token-health {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 16px;
  border: 1px solid currentColor;
}
.token-health.ok { color: var(--good); }
.token-health.dead { color: var(--bad); }

/* Admin ? Tokens & proxies: paste new tokens */
.tokens-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tokens-add textarea {
  flex: 1 1 320px;
  min-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}
.tokens-add #tokens-add-note { flex: 1 1 100%; }

/* Analytics: the token-changes chart (bars) with the tokens held (line). */
.chart-svg .flow-bar {
  opacity: 0.9;
}
.chart-svg .flow-count-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}
.chart-svg .flow-count-dot {
  fill: var(--accent);
  stroke: none;
}
.chart-svg .flow-count-label {
  fill: var(--accent);
  font-weight: 700;
}
.swatch-added { background: #58c98a; }
.swatch-suspended { background: #e2695f; }
.swatch-removed { background: #8d93a1; }
.swatch-line { background: var(--accent); }
.chart-svg .flow-count-axis {
  fill: var(--accent);
  opacity: 0.85;
}
/* One row of buttons that apply to every workspace. */
.accounts-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
}
.accounts-bulk .hint {
  margin-right: 2px;
}
