/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --bg: #e8ece8; --bg2: #dde3dc; --panel: #ffffff; --field: #ffffff; --fieldBg: #f4f8fc; --fieldBorder: #c0d4e8;
  --track: #d0e4f4; --tick: #94b4cc; --tickMaj: #82b9dc;
  --c1: #3a7cb5; --c2: #2a5f8f; --text: #000000; --muted: #000000; --line: #c0d4e8;
  --accent: #3a7cb5;
  --maint: #e05555; --maintBg: rgba(224, 85, 85, 0.08);
  --warn: var(--maint); --warn-bg: #fde8e8; --warn-border: #e0a0a0;
  --btn-text: #ffffff;
  --success-bg: #e0f5ec; --success-border: #82c9a0;
  --info: #3a7cb5; --info-bg: #e0edf8; --info-border: #82b9dc;
  --blocked: #e8943a; --blocked-bg: #fef3e0; --blocked-border: #e8c080;
  /* ── Border radius tokens ── */
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px; --radius-xl: 16px; --radius-xxl: 22px;
  /* ── State colors (shared by traffic light, dashboard, verification popup) ── */
  --state-waiting: #d9534f;
  --state-queued:    #e8943a;
  --state-running:   #22a85a;
  --state-done: #3a7cb5;
  --state-failed:    #8b5cf6;
  --state-off:  #000000;
  /* ── Navbar height (for toast positioning) ── */
  --navbar-height: 52px;
}

/* ── Reset ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, sans-serif; line-height: 1.5; }

/* ── Typography ─────────────────────────────────────────────────── */
h1 { font-size: 20px; font-weight: 600; line-height: 1.3; }
h2 { font-size: 16px; font-weight: 600; line-height: 1.4; margin-bottom: 16px; }
h3 { font-size: 13px; font-weight: 600; line-height: 1.4; }

/* ── Header ────────────────────────────────────────────────────── */
.header { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.header > :nth-child(2) { margin-left: auto; }
.header h1 { font-size: 20px; }
.header .meta { font-size: 12px; color: var(--muted); }
.header .stats,
.stats { font-size: 12px; color: var(--muted); display: flex; gap: 16px; }
.header .stats span,
.stats span { margin-left: 0; }
.header .stats .green,
.stats .green { color: var(--c1); }
.header .stats .blue,
.stats .blue { color: var(--info); }
.header .stats .orange,
.stats .orange { color: var(--blocked); }
.tz-badge { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 4px 10px; font-size: 11px; color: var(--muted); font-family: monospace; }

/* ── Card ──────────────────────────────────────────────────────── */
.card { max-width: 1100px; margin: 24px auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.card p { font-size: 13px; }
.card.full-width { max-width: none !important; margin: 24px 0; width: 100%; }
.card h2 { font-size: 16px; }
.card.wide { max-width: none; padding: 24px; }
.card.full-bottom { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn { background: var(--c1); color: var(--btn-text); border: none; border-radius: var(--radius-md); padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--c2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 11px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 18px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-block { background: var(--blocked); }
.btn-block:hover { background: #e08e0d; }
.btn-block.unblocked { background: var(--c1); }
.btn-warn { background: var(--warn); color: #fff; }
.btn-warn:hover { background: #e05555; }

/* ── Alerts ────────────────────────────────────────────────────── */
.error { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--radius-md); padding: 10px; font-size: 13px; color: var(--warn); margin-bottom: 16px; display: none; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); border-radius: var(--radius-md); padding: 10px; font-size: 13px; color: var(--c1); margin-bottom: 16px; display: none; }

/* ── Badge ─────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.badge.admin { background: rgba(116,192,252,0.12); color: var(--info); }
.badge.unredeemed { background: rgba(116,192,252,0.12); color: var(--info); }
.badge.redeemed { background: rgba(58,124,181,0.1); color: var(--c1); }
.badge.blocked { background: rgba(255,169,77,0.12); color: var(--blocked); }
.badge.warn { background: rgba(255,169,77,0.12); color: var(--blocked); }

/* ── Form ──────────────────────────────────────────────────────── */
.form-group { flex: 1; }
.form-group label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.form-group label.no-transform { text-transform: none; }
.form-group input, .form-group select { width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--fieldBorder); border-radius: var(--radius-md); padding: 10px 12px; font-size: 14px; font-family: monospace; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--c1); }
.referral-hint { display: block; font-size: 12px; color: #6b7c8d; margin-top: 4px; }

/* Credits preset grid */
.credits-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.credits-presets button { background: var(--field); color: var(--text); border: 1px solid var(--fieldBorder); border-radius: var(--radius-md); padding: 8px 0; font-size: 13px; font-family: monospace; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.credits-presets button:hover { border-color: var(--c1); color: var(--c1); }
.credits-presets button.active { background: rgba(58,124,181,0.1); border-color: var(--c1); color: var(--c1); }

/* Pricing reference */
.pricing-note { font-size: 11px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.pricing-controls { display: flex; gap: 16px; margin-bottom: 12px; align-items: flex-end; }
.pricing-controls .form-group { flex: 1; }

/* Pricing formula display */
.pricing-formula {
  background: var(--field);
  border: 1px solid var(--fieldBorder);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 16px;
  color: var(--text);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pricing sections */
.pricing-section {
  margin-top: 20px;
}
.section-divider {
  height: 1px;
  background: var(--line);
  margin-bottom: 12px;
}
.pricing-section h3 {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  font-weight: 600;
}

/* Table container with subtle background */
.table-container {
  background: var(--field);
  border: 1px solid var(--fieldBorder);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.pricing-table { border-collapse: collapse; font-size: 13px; width: max-content; margin: 0 auto; }
.pricing-table th { text-align: right; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 12px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); font-weight: 600; font-family: monospace; }
.pricing-table td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); font-family: monospace; }
.pricing-table th:last-child, .pricing-table td:last-child { border-right: none; }
.pricing-table tr:hover { background: rgba(58,124,181,0.06); }
.pricing-table tr.active td { background: rgba(58,124,181,0.08); color: var(--c1); }
.credits-select { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.check-icon { color: var(--c1); font-weight: 700; }

/* ── Filter bar ────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; }
.filter-bar select { background: var(--field); color: var(--text); border: 1px solid var(--fieldBorder); border-radius: var(--radius-md); padding: 6px 10px; font-size: 12px; }
.filter-bar .count { font-size: 12px; color: var(--muted); margin-left: auto; }
.filter-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Inline column filter (inside <th>) ───────────────────────── */
.column-filter {
  display: block;
  margin-top: 4px;
  background: var(--field);
  color: var(--muted);
  border: 1px solid var(--fieldBorder);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  font-size: 11px;
  font-family: monospace;
  cursor: pointer;
}
.column-filter:focus {
  border-color: var(--c1);
  color: var(--text);
}
.column-filter-text {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  width: 100%;
  min-width: 80px;
  padding: 2px 6px;
  cursor: text;
}
.column-filter-text::-webkit-calendar-picker-indicator {
  display: none;
}
.filter-input-row { display: flex; align-items: center; gap: 2px; }
.filter-clear {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 1px 4px; line-height: 1; opacity: 0.5;
}
.filter-clear:hover { opacity: 1; }

/* ── Pagination ────────────────────────────────────────────────── */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.pagination button { background: var(--field); border: 1px solid var(--fieldBorder); color: var(--muted); padding: 4px 12px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }
.pagination button:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination .page-info { font-size: 12px; color: var(--muted); }

/* ── Loading ───────────────────────────────────────────────────── */
.loading { text-align: center; padding: 40px; color: var(--muted); font-size: 13px; }

/* ── Tables (shared) ───────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
.data-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}
.code-table.data-table { width: max-content; min-width: 100%; }
.user-table.data-table { width: max-content; min-width: 100%; }
.data-table th {
  text-align: right;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-weight: 600;
  white-space: nowrap;
  font-family: monospace;
}
.data-table td {
  text-align: right;
  font-family: monospace;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table th:last-child { border-right: none; }
.data-table td:last-child { border-right: none; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .sortable {
  cursor: pointer;
  user-select: none;
}
.data-table .sortable:hover {
  color: var(--text);
}
.data-table .muted {
  color: var(--muted);
  font-size: 12px;
}
.user-table tbody tr {
  transition: background 0.15s;
}
.user-table tbody tr:hover {
  background: rgba(58,124,181,0.06);
}
.user-table tbody tr.selected {
  background: rgba(58,124,181,0.1);
}
.code-table .code-cell {
  font-weight: 600;
  font-size: 13px;
}

/* ── Activity log ──────────────────────────────────────────────── */
.activity-log, .activity-log-card { background: var(--panel); overflow-x: auto; }
.activity-log-card h2 { font-size: 16px; color: var(--text); margin-bottom: 8px; }
.activity-log h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.activity-feed {
  font-family: monospace;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(200, 220, 240, 0.4);
  border-collapse: collapse;
  width: 100%;
  table-layout: auto;
}
.activity-feed thead th {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-weight: 600;
  white-space: nowrap;
}
.activity-feed thead th:last-child { border-right: none; }
.activity-feed tbody tr {
  transition: background 0.15s;
}
.activity-feed tbody tr:hover {
  background: rgba(58,124,181,0.04);
}
.activity-feed td {
  padding: 3px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-feed td:last-child { border-right: none; }
/* Colgroup — defines the fixed column widths (table-layout: fixed reads from <col>) */
.activity-feed .col-time { width: 140px; }
.activity-feed .col-user { width: 160px; }
.activity-feed .col-level { width: 70px; }
.activity-feed .col-action { width: 160px; }
.activity-feed .col-message { width: auto; }

/* Cell content styling */
.activity-feed td .timestamp { color: var(--muted); }
.activity-feed td .user { font-weight: 600; }
.activity-feed .col-level,
.activity-feed td.level-debug,
.activity-feed td.level-info,
.activity-feed td.level-warn,
.activity-feed td.level-error,
.activity-feed td.level-critical { text-align: center; }
.activity-feed td.level-debug    { color: var(--muted); }
.activity-feed td.level-info     { color: var(--state-done); }
.activity-feed td.level-warn     { color: var(--state-queued); }
.activity-feed td.level-error    { color: var(--state-waiting); }
.activity-feed td.level-critical { color: var(--state-failed); }
.activity-feed td .action { font-weight: 600; }
.activity-feed td .message { color: var(--muted); }
.activity-feed .empty-msg { text-align: center; color: var(--muted); padding: 20px; }

/* ── Level-based row highlighting ── */
.activity-feed .entry-error {
  background: rgba(255, 107, 107, 0.06);
}
.activity-feed .entry-critical {
  background: rgba(139, 92, 246, 0.1);
}
.activity-feed .entry-warn {
  background: rgba(255, 169, 77, 0.06);
}

/* ── Action-word colors (by category) ── */

/* Schedule lifecycle — green */
.activity-feed .schedule_created          { color: var(--state-running); }
.activity-feed .schedule_completed        { color: var(--state-running); }
.activity-feed .schedule_window_advanced   { color: var(--state-running); }
.activity-feed .schedule_cancelled        { color: var(--state-running); }

/* Errors / failures — red */
.activity-feed .job_failed               { color: var(--state-waiting); }
.activity-feed .job_dispatch_error       { color: var(--state-waiting); }
.activity-feed .job_daemon_overloaded    { color: var(--state-failed); }
.activity-feed .orphaned_job             { color: var(--state-waiting); }

/* Cancelled / warnings — yellow */
.activity-feed .job_cancelled            { color: var(--state-queued); }
.activity-feed .job_aborted              { color: var(--state-queued); }
.activity-feed .job_dispatch_skipped     { color: var(--state-queued); }
.activity-feed .job_partial_fill         { color: var(--state-queued); }
.activity-feed .schedule_cancel_poll_timeout { color: var(--state-queued); }

/* Auth events — blue */
.activity-feed .logged_in                { color: var(--state-done); }
.activity-feed .logged_out               { color: var(--state-done); }
.activity-feed .signed_up                { color: var(--state-done); }
.activity-feed .login_failed             { color: var(--state-done); }
.activity-feed .login_input_too_long     { color: var(--state-done); }
.activity-feed .login_rate_limited       { color: var(--state-done); }
.activity-feed .signup_rate_limited      { color: var(--state-done); }
.activity-feed .signup_failed            { color: var(--state-done); }
.activity-feed .account_deleted          { color: var(--state-done); }

/* Credits / billing — orange */
.activity-feed .code_redeemed            { color: var(--state-queued); }
.activity-feed .code_redeem_failed       { color: var(--state-waiting); }
.activity-feed .code_generated           { color: var(--state-queued); }
.activity-feed .job_billed               { color: var(--state-queued); }
.activity-feed .job_completed            { color: var(--state-running); }
.activity-feed .job_dispatched           { color: var(--state-running); }

/* System / admin — orange */
.activity-feed .user_deleted             { color: var(--state-queued); }

/* Maintenance — gray */
.activity-feed .maintenance_created      { color: var(--muted); }
.activity-feed .maintenance_deleted      { color: var(--muted); }
.activity-feed .job_retry               { color: var(--state-queued); }
.activity-feed .job_retry_exhausted     { color: var(--state-failed); }
.activity-feed .job_frame_stats          { color: var(--muted); }
.activity-feed .referral_new_user        { color: var(--state-done); }
.activity-feed .referral_existing_user   { color: var(--state-done); }

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar { background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 20px; }
.navbar-inner { display: flex; align-items: center; gap: 20px; width: 100%; padding: 0 20px; min-height: 52px; }
.navbar-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link { font-size: 13px; color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: var(--radius-md); transition: all 0.15s; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.nav-link:hover { color: var(--text); background: rgba(58,124,181,0.08); }
.nav-link.active { color: var(--c1); background: rgba(58,124,181,0.12); font-weight: 600; box-shadow: inset 0 -2px 0 var(--c1); transform: translateY(0); }
.navbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; position: relative; flex-shrink: 0; }
.navbar-username { color: var(--text); font-weight: 600; }
.navbar-referral {
  color: var(--accent);
  font-family: monospace;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--field);
  border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s;
}
.navbar-referral:hover {
  background: var(--line);
  border-color: var(--accent);
}
@keyframes lowFundsPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 85, 85, 0); } 50% { box-shadow: 0 0 8px 2px rgba(224, 85, 85, 0.45); } }
.navbar-credits { background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 3px 8px; font-family: monospace; white-space: nowrap; }
.navbar-credits-low { animation: lowFundsPulse 2s ease-in-out infinite; }
.navbar-credits-spent { background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 3px 8px; font-family: monospace; white-space: nowrap; color: var(--muted); }
.navbar-delete { color: var(--muted); text-decoration: none; font-size: 14px; padding: 2px 4px; border-radius: var(--radius-sm); transition: color 0.15s; }
.navbar-delete:hover { color: var(--maint); }
.navbar-user button.nav-link { background: none; border: none; font-family: inherit; cursor: pointer; }
/* Redeem toast — centered below navbar, slides in from left, pauses, slides out right */
@keyframes toastSlide {
  0%   { transform: translateX(-120%); opacity: 0; }
  15%  { transform: translateX(0); opacity: 1; }
  80%  { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

.redeem-toast {
  position: fixed;
  top: calc(var(--navbar-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: monospace;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.redeem-toast.toast-visible {
  animation: toastSlide 3.5s ease forwards;
}

.redeem-toast.toast-success {
  background: var(--success-bg);
  color: var(--c1);
  border: 1px solid var(--success-border);
}

.redeem-toast.toast-error {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}
.redeem-form { display: flex; align-items: center; gap: 0; }
.redeem-input { background: var(--field); border: 1px solid var(--line); border-right: none; border-radius: var(--radius-md) 0 0 var(--radius-md); color: var(--text); padding: 5px 8px; font-size: 12px; font-family: monospace; width: 130px; outline: none; }
.redeem-input:focus { border-color: var(--c1); }
.redeem-input::placeholder { color: var(--muted); font-size: 11px; }
.redeem-btn { background: var(--c1); border: 1px solid var(--c1); color: var(--btn-text); border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 4px 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.redeem-btn:hover { background: var(--c2); border-color: var(--c2); }
.redeem-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.redeem-input.toast-success { border-color: var(--c1); background: var(--success-bg); }
.redeem-input.toast-error { border-color: var(--maint); background: var(--warn-bg); }

/* ── Traffic light ─────────────────────────────────────────────── */
.traffic-light { display: flex; gap: 12px; justify-content: center; }
.tl-light { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 56px; }
.tl-bulb {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--muted);
  background: var(--panel);
  opacity: 0.5;
  transition: all 0.3s;
}
.tl-bulb.grey   { background: #000000; border-color: #000000; }
.tl-bulb.red    { background: var(--state-waiting); border-color: var(--state-waiting); }
.tl-bulb.yellow { background: var(--state-queued); border-color: var(--state-queued); }
.tl-bulb.green  { background: var(--state-running); border-color: var(--state-running); }
.tl-bulb.blue   { background: var(--state-done); border-color: var(--state-done); }
.tl-bulb.violet { background: var(--state-failed); border-color: var(--state-failed); }

.tl-bulb.on {
  opacity: 1;
  box-shadow: 0 0 16px var(--bulb-glow, currentColor);
  transform: scale(1.1);
}
.tl-bulb.red.on    { box-shadow: 0 0 16px rgba(217,83,79,0.6), 0 0 32px rgba(217,83,79,0.25); animation: pulse 2s ease-in-out infinite; }
.tl-bulb.yellow.on { box-shadow: 0 0 16px rgba(232,148,58,0.6), 0 0 32px rgba(232,148,58,0.25); animation: blink 1.5s ease-in-out infinite; }
.tl-bulb.green.on  { box-shadow: 0 0 16px rgba(34,168,90,0.6), 0 0 32px rgba(34,168,90,0.25); animation: pulse 1.2s ease-in-out infinite; }
.tl-bulb.blue.on   { box-shadow: 0 0 16px rgba(58,124,181,0.6), 0 0 32px rgba(58,124,181,0.25); animation: pulse 2s ease-in-out infinite; }
.tl-bulb.violet.on { box-shadow: 0 0 16px rgba(139,92,246,0.6), 0 0 32px rgba(139,92,246,0.25); animation: throb 1s ease-in-out infinite; }
.tl-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Status row (traffic light + cycle counter) ─────────────────── */
.status-row { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 16px 24px; }
.mech-counter { margin-left: auto; }
.cycle-counter { display: flex; align-items: center; justify-content: center; min-width: 24px; font-size: 1.1rem; font-weight: 600; color: var(--c1); font-variant-numeric: tabular-nums; cursor: help; }

/* ── Mechanical cycle counter ───────────────────────────────────── */
.mech-counter {
  display: flex;
  padding: 8px 10px;
  border-radius: 4px;
  background: linear-gradient(180deg, #d6cfc0, #bfb8a6);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.3),
    inset 0 -2px 4px rgba(0,0,0,.25),
    0 4px 12px rgba(0,0,0,.2);
  cursor: help;
}
.cc-wheel {
  position: relative;
  width: 26px;
  height: 40px;
  overflow: hidden;
  background: #2a2a28;
  border-radius: 2px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.8);
}
.cc-wheel + .cc-wheel { margin-left: 3px; }
.cc-strip {
  display: flex;
  flex-direction: column;
  transform: translateY(calc(var(--pos, 0) * -1 * 40px));
  transition: transform .35s cubic-bezier(.65, 0, .35, 1);
}
.cc-strip span {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 22px/1 "Courier New", monospace;
  color: #f0ead6;
  text-shadow: 0 1px 0 rgba(0,0,0,.4);
}
.cc-wheel::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: rgba(0,0,0,.55);
  box-shadow: 0 1px 0 rgba(255,255,255,.05);
}
.cc-wheel::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.55), transparent 20%, transparent 80%, rgba(0,0,0,.55));
  pointer-events: none;
}

/* ── Verification modal (overlay + status indicator) ────────────── */
.spinner { display:inline-block; width:16px; height:16px; border:2px solid var(--fieldBorder); border-top-color:var(--c1); border-radius:50%; animation:spin 0.8s linear infinite; vertical-align:middle; margin-right:8px; }
.verify-status { text-align:center; margin-bottom:16px; }
.verify-status .status-indicator { display:inline-block; width:48px; height:48px; border-radius:50%; margin-bottom:8px; }
.verify-status .status-text { font-size:14px; font-weight:600; display:block; margin-top:4px; }
.verify-status .status-detail { font-size:12px; color:var(--muted); display:block; margin-top:2px; }
.status-queued .status-indicator { background:repeating-linear-gradient(45deg,var(--state-queued),var(--state-queued) 6px,#d49a3e 6px,#d49a3e 12px); animation:spin 2s linear infinite; box-shadow:0 0 12px rgba(240,173,78,0.4); }
.status-running .status-indicator { background:var(--state-running); animation:pulse 1.2s ease-in-out infinite; box-shadow:0 0 12px rgba(34,168,90,0.5); }
.status-success .status-indicator { background:var(--state-done); animation:glow-breathe 2s ease-in-out infinite; box-shadow:0 0 12px rgba(77,171,247,0.5); }
.status-failed .status-indicator { background:var(--state-failed); animation:throb 1s ease-in-out infinite; box-shadow:0 0 12px rgba(139,92,246,0.5); }
.status-queued .status-text { color:var(--state-queued); }
.status-running .status-text { color:var(--state-running); }
.status-success .status-text { color:var(--state-done); }
.status-failed .status-text { color:var(--state-failed); }
.overlay { position:fixed; inset:0; background:rgba(10,30,50,0.6); display:none; justify-content:center; align-items:center; z-index:1000; }
.overlay.active { display:flex; }
.modal { background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:32px; max-width:420px; width:90%; text-align:center; }
.modal h2 { font-size:17px; margin-bottom:12px; }
.modal p { font-size:14px; color:var(--muted); line-height:1.6; margin-bottom:16px; }
.modal .step { text-align:left; background:var(--bg); border-radius:8px; padding:12px 16px; margin-bottom:16px; font-size:13px; color:var(--text); line-height:1.6; }
.modal .btn-row { display:flex; gap:12px; }
.modal .btn-agree { flex:1; background:var(--c1); color:var(--btn-text); border:none; border-radius:var(--radius-lg); padding:12px; font-size:15px; font-weight:600; cursor:pointer; }
.modal .btn-agree:hover { background:var(--c2); }
.modal .btn-agree:disabled { opacity:0.4; cursor:not-allowed; }
.modal .btn-refuse { flex:1; background:transparent; color:var(--muted); border:1px solid var(--fieldBorder); border-radius:var(--radius-lg); padding:12px; font-size:15px; cursor:pointer; }
.modal .btn-refuse:hover { border-color:var(--warn-border); color:var(--maint); }

/* ── Dashboard timeline ────────────────────────────────────────── */
.timeline-wrap { padding: 12px 0; overflow-y: visible; }
.timeline { position: relative; width: 100%; background: var(--panel); border: 1px solid var(--line); }
.hour-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--fieldBorder); }
.hour-line.major { width: 2px; background: var(--tickMaj); }
.hour-label { position: absolute; top: -16px; font-size: 12px; color: var(--muted); font-family: monospace; transform: translateX(-50%); white-space: nowrap; }
.hour-label.bottom { top: auto; bottom: -16px; }
.maint-block { position: absolute; top: 0; bottom: 0; background: rgba(200, 210, 225, 0.25); border-left: 2px solid rgba(130,185,220,0.5); border-right: 2px solid rgba(130,185,220,0.5); opacity: 0.7; cursor: pointer; }
.maint-block:hover { opacity: 1; background: rgba(200, 210, 225, 0.35); }
.job-bar { position: absolute; height: 24px; border-radius: var(--radius-sm); display: flex; align-items: center; padding: 0 8px; font-size: 11px; font-weight: 600; color: #000; cursor: pointer; transition: filter 0.15s; min-width: 30px; }
.job-bar:hover { filter: brightness(1.2); z-index: 10; }
.job-bar .job-user { margin-right: 6px; font-family: monospace; opacity: 0.8; position: relative; z-index: 3; }
.job-bar .job-tasks { margin-right: 4px; font-family: monospace; opacity: 0.7; position: relative; z-index: 3; font-size: 10px; }
/* Tooltip */
.job-tooltip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 12px; font-size: 11px; color: var(--text); white-space: nowrap; z-index: 100; pointer-events: none; box-shadow: 0 4px 12px rgba(58,74,90,0.2); }
.job-tooltip .tt-row { display: flex; gap: 6px; margin-bottom: 3px; }
.job-tooltip .tt-label { color: var(--muted); min-width: 60px; }
.job-tooltip .tt-val { font-family: monospace; font-weight: 600; }
.job-tooltip:last-child { margin-bottom: 0; }
.job-bar:hover .job-tooltip { display: block; }

/* Maintenance tooltip */
.maint-tooltip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 12px; font-size: 11px; color: var(--text); white-space: nowrap; z-index: 100; pointer-events: none; box-shadow: 0 4px 12px rgba(58,74,90,0.2); }
.maint-tooltip .tt-row { display: flex; gap: 6px; margin-bottom: 3px; }
.maint-tooltip .tt-label { color: var(--muted); min-width: 60px; }
.maint-tooltip .tt-val { font-family: monospace; font-weight: 600; }
.maint-block:hover .maint-tooltip { display: block; }
.job-bar-track { position: absolute; left: 0; right: 0; top: 0; bottom: 0; border-radius: var(--radius-sm); opacity: 0.35; }
.job-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--radius-sm); z-index: 1; }
.now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--c1); z-index: 5; }
.now-label { position: absolute; top: 4px; left: 4px; font-size: 10px; color: var(--c1); font-weight: 700; }
.job-bar.disabled { opacity: 0.3; }
.job-bar .job-status { margin-right: 6px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 5px; border-radius: var(--radius-sm); background: rgba(10,30,48,0.3); color: inherit; position: relative; z-index: 3; white-space: nowrap; }

/* ── Refresh countdown ring ───────────────────────────────────── */
.refresh-ring-wrap { display: inline-flex; align-items: center; vertical-align: middle; margin-right: 4px; }
.refresh-ring { width: 24px; height: 24px; }
.refresh-ring-arc { transition: none; }

/* Track circle behind the arc for contrast against light bg */
.refresh-ring circle:first-child {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}

/* ── Shared animation keyframes (dashboard bars + verification popup) ── */
@keyframes spin { to { transform:rotate(360deg); } }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }
@keyframes glow-breathe { 0%,100%{box-shadow:0 0 8px currentColor} 50%{box-shadow:0 0 24px currentColor, 0 0 48px currentColor} }
@keyframes throb { 0%,100%{transform:scale(1)} 15%{transform:scale(1.2)} 30%{transform:scale(1)} 45%{transform:scale(1.1)} 60%{transform:scale(1)} }
@keyframes blink { 0%,100%{opacity:0.3} 50%{opacity:0.7} }


/* ── Per-state bar glow (static, no animation) ──────────────── */
.job-bar.state-waiting { box-shadow: 0 0 10px rgba(217,83,79,0.35); }
.job-bar.state-queued    { box-shadow: 0 0 10px rgba(232,148,58,0.35); }
.job-bar.state-running   { box-shadow: 0 0 10px rgba(34,168,90,0.35); }
.job-bar.state-done { box-shadow: 0 0 10px rgba(77,171,247,0.35); }
.job-bar.state-failed    { box-shadow: 0 0 10px rgba(139,92,246,0.35); }

/* ── Status legend ──────────────────────────────────────────────── */
.status-legend { display: flex; gap: 10px; padding: 8px 24px; justify-content: center; flex-wrap: wrap; }
.status-legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; padding: 4px 8px; }
.status-legend-item.hidden { opacity: 0.3; }
.status-legend-swatch { width: 18px; height: 18px; border-radius: var(--radius-sm); border: 1px solid var(--line); flex-shrink: 0; }

/* ── Summary grid (codes) ──────────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.summary-card { background: var(--field); border: 1px solid var(--fieldBorder); border-radius: var(--radius-lg); padding: 16px; }
.summary-card h3 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; font-weight: 600; }
.summary-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.summary-row .label { color: var(--muted); }
.summary-row .value { font-family: monospace; font-weight: 600; text-align: right; }
.summary-row .value.green { color: var(--c1); }
.summary-row .value.blue { color: var(--info); }
.summary-row .value.orange { color: var(--blocked); }
.summary-row .value.red { color: var(--maint); }
.summary-row .value.yellow { color: #eab308; }

/* ── Codes output ──────────────────────────────────────────────── */
.codes-output { background: var(--field); border: 1px solid var(--fieldBorder); border-radius: var(--radius-md); padding: 16px; font-family: monospace; font-size: 13px; max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; color: var(--text); }
.codes-output .code-line { padding: 2px 0; border-bottom: 1px solid var(--line); }
.codes-output .code-line:last-child { border-bottom: none; }
.copy-btn { margin-top: 12px; background: var(--panel); border: 1px solid var(--fieldBorder); color: var(--muted); padding: 6px 16px; border-radius: var(--radius-md); cursor: pointer; font-size: 12px; }
.copy-btn:hover { color: var(--text); border-color: var(--muted); }
.codes-output-section { display: none; }
.codes-output-section.visible { display: block; }

/* ── Tabs (codes) ──────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; max-width: 1200px; margin: 20px auto 0; }
.tab { flex: 1; padding: 10px 16px; font-size: 13px; font-weight: 500; text-align: center; background: var(--panel); border: 1px solid var(--line); color: var(--muted); cursor: pointer; transition: all 0.15s; font-family: inherit; }
.tab:first-child { border-radius: var(--radius-lg) 0 0 0; }
.tab:last-child { border-radius: 0 var(--radius-lg) 0 0; }
.tab:hover { color: var(--text); background: rgba(58,124,181,0.06); }
.tab.active { color: var(--c1); background: var(--panel); border-bottom-color: var(--panel); font-weight: 600; box-shadow: inset 0 -2px 0 var(--c1); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Scheduling form ───────────────────────────────────────────── */
p.sub { margin: 4px 0 18px; color: var(--muted); font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 32px; width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 16px; }
.stack.locked .card:not(.commit):not(.commit-section):not(.activity-log-card):not(.account-credentials-card):not(.crash-card) { opacity: 0.55; pointer-events: none; }
.task-panel { transition: opacity 0.15s ease-in; }
.form-row { display: flex; gap: 16px; margin-bottom: 16px; align-items: flex-end; }
input:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; }
input:disabled + label { opacity: 0.55; cursor: not-allowed; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header { padding: 16px; flex-direction: column; align-items: flex-start; }
  .header .stats span { margin-left: 12px; }
  .card { margin: 16px; padding: 16px; max-width: none; }
  .card.wide { max-width: none; }
  .stack { padding: 16px; max-width: none; }
  .summary-grid { grid-template-columns: 1fr; }
  .navbar-inner { flex-wrap: wrap; height: auto; padding: 8px 0; gap: 12px; }
  .navbar-user { margin-left: 0; width: 100%; justify-content: center; }
  .user-table th, .user-table td,
  .code-table th, .code-table td,
  .maintenance-table th, .maintenance-table td { padding: 6px 8px; font-size: 12px; }
  .user-table, .code-table, .maintenance-table { font-size: 12px; }
  .worker-status { padding: 12px 16px; }
  .traffic-light { gap: 8px; }
  .status-legend { padding: 8px 16px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .keys-row { gap: 2rem; }
}

@media (max-width: 480px) {
  .navbar-links { flex-wrap: wrap; }
  .nav-link { padding: 4px 8px; font-size: 12px; }
  .activity-feed { font-size: 10px; }
  .tabs { max-width: 100%; margin: 16px 16px 0; }
}

/* ── Resource monitoring page ──────────────────────────────────── */
.resources-page,
.page-container { max-width: 1200px; margin: 0 auto; padding: 28px 48px 40px; }
.page-container.resources-page,
.page-container.wide { max-width: none; padding: 28px 48px 40px; }
.refresh-indicator { color: var(--c1); font-family: monospace; font-size: 11px; margin-left: 6px; }

/* Three-column grid for CPU / Memory / Workers */
.resource-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 24px auto; max-width: 1400px; }
.resource-card { margin: 0; border-radius: 0; border-right: 1px solid var(--line); }
.resource-card:last-child { border-right: none; }

/* Gauge bar */
.gauge-bar { margin-bottom: 12px; }
.gauge-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.gauge-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.gauge-value { font-family: monospace; font-size: 13px; font-weight: 600; }
.gauge-track { width: 100%; height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease, background 0.3s ease; }

/* Resource metric (large value display) */
.resource-metric { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.resource-metric .metric-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.resource-metric .metric-value { font-family: monospace; font-size: 20px; font-weight: 700; }

/* Load averages */
.load-avg { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.load-avg .metric-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; display: block; margin-bottom: 4px; }
.load-values { font-family: monospace; font-size: 12px; color: var(--muted); }
.load-values strong { color: var(--text); }

/* Per-core bars */
.cores-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.core-label {
  font-family: monospace;
  font-size: 11px;
  color: var(--muted);
  min-width: 50px;
  flex-shrink: 0;
}
.core-value {
  font-family: monospace;
  font-size: 11px;
  font-weight: 600;
  min-width: 44px;
  text-align: right;
  flex-shrink: 0;
}
.cores-list { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.core-bar { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.core-track { flex: 1; height: 6px; }

/* Memory breakdown */
.memory-breakdown { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Worker status grid */
.worker-status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.worker-stat { text-align: center; padding: 12px 8px; background: var(--field); border: 1px solid var(--fieldBorder); border-radius: var(--radius-md); }
.worker-stat .stat-value { display: block; font-family: monospace; font-size: 22px; font-weight: 700; }
.worker-stat .stat-label { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

/* Worker bar */
.worker-bar { width: 100%; height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; margin-bottom: 16px; }
.worker-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* Worker resource totals (daemon RSS + VRAM) */
.worker-resource-totals { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Per-worker resource table */
.worker-resource-table { margin-top: 16px; }
.worker-resource-table .data-table { font-size: 12px; }
.worker-resource-table .data-table th {
  font-size: 9px;
  padding: 6px 8px;
}
.worker-resource-table .data-table td {
  padding: 6px 8px;
}
.worker-resource-table .data-table .worker-task-cell {
  text-align: left;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.worker-resource-table .data-table .worker-task-id {
  color: var(--muted);
  font-size: 10px;
}

/* Status dot in table */
.worker-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.worker-status-dot.running { background: var(--state-running); box-shadow: 0 0 4px var(--state-running); }
.worker-status-dot.queued  { background: var(--state-queued); box-shadow: 0 0 4px var(--state-queued); }
.worker-status-dot.idle    { background: var(--fieldBorder); }

/* Row highlighting by status */
.worker-resource-row.status-running { background: rgba(126, 231, 135, 0.04); }
.worker-resource-row.status-queued  { background: rgba(240, 173, 78, 0.04); }
.worker-resource-row.status-idle    { opacity: 0.6; }

/* Headroom card */
.headroom-card { max-width: 1400px !important; }
.headroom-grid { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.headroom-main { flex: 1; min-width: 280px; }
.headroom-status { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-radius: var(--radius-lg); }
.headroom-status.available { background: var(--success-bg); border: 1px solid var(--success-border); }
.headroom-status.at-capacity { background: var(--warn-bg); border: 1px solid var(--warn-border); }
.headroom-icon { font-size: 24px; }
.headroom-text { font-size: 14px; }
.headroom-limits { display: flex; flex-direction: column; gap: 6px; }
.limit-item { display: flex; align-items: center; gap: 8px; font-family: monospace; font-size: 13px; }
.limit-label { color: var(--muted); min-width: 70px; }
.limit-value { font-weight: 600; color: var(--muted); }
.limit-value.green { color: var(--c1); }

/* ── Responsive for resource page ─────────────────────────────── */
@media (max-width: 960px) {
  .resource-grid { grid-template-columns: 1fr; }
  .resource-card { border-right: none; border-bottom: 1px solid var(--line); border-radius: var(--radius-lg); margin: 24px auto 0; }
  .resource-card:last-child { border-bottom: 1px solid var(--line); }
}

/* ── Daemon Fleet Table ──────────────────────────────────────────── */
.daemon-fleet-card { max-width: none !important; margin: 24px 0 0; width: 100%; }
.daemon-fleet-table { margin-top: 16px; overflow-x: auto; }
.daemon-fleet-table .data-table { width: 100%; min-width: 1200px; }
.daemon-fleet-table .data-table th:first-child,
.daemon-fleet-table .data-table td:first-child { text-align: right; }
.daemon-fleet-table .data-table .daemon-id-cell { font-family: monospace; font-weight: 600; color: var(--text); white-space: nowrap; }
.daemon-fleet-table .data-table .expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  padding: 0;
  text-align: left;
  line-height: 1.3;
}
.daemon-fleet-table .data-table .expand-btn:hover { color: var(--c1); }
.daemon-fleet-table .data-table .daemon-url-cell { text-align: right; font-family: monospace; color: var(--muted); font-size: 12px; white-space: nowrap; }
.daemon-fleet-table .data-table .daemon-url-cell a { color: var(--c1); text-decoration: none; }
.daemon-fleet-table .data-table .daemon-url-cell a:hover { text-decoration: underline; }
.daemon-fleet-table .data-table th { vertical-align: top; }
.daemon-fleet-table .data-table td { vertical-align: top; }
.daemon-fleet-table .data-table .daemon-system-cell { vertical-align: top; white-space: nowrap; }
.daemon-fleet-table .data-table tr.daemon-unavailable-row { opacity: 0.5; }

/* Mini gauge inside table cells */
.mini-gauge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.mini-gauge-label {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 24px;
  font-weight: 600;
  font-family: monospace;
}
.mini-gauge-track {
  flex: 1;
  height: 6px;
  background: var(--track);
  border-radius: 3px;
  overflow: hidden;
}
.mini-gauge-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background 0.3s ease;
}
.mini-gauge-value {
  font-family: monospace;
  font-size: 11px;
  font-weight: 600;
  min-width: 38px;
  text-align: right;
}

/* Per-core mini bars stacked vertically */
.core-bars-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.core-bar-mini {
  display: flex;
  align-items: center;
  gap: 5px;
}
.core-bar-mini-label {
  font-size: 9px;
  color: var(--muted);
  font-family: monospace;
  min-width: 22px;
  font-weight: 600;
}
.core-bar-mini-track {
  flex: 1;
  height: 5px;
  background: var(--track);
  border-radius: 2px;
  overflow: hidden;
}
.core-bar-mini-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease, background 0.3s ease;
}
.core-bar-mini-value {
  font-family: monospace;
  font-size: 9px;
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

/* System detail text under gauges */
.system-detail-text {
  font-size: 10px;
  color: var(--muted);
  font-family: monospace;
  margin-top: 1px;
}
.system-gpu-name {
  font-size: 10px;
  color: var(--text);
  font-weight: 600;
  font-family: monospace;
  margin-bottom: 2px;
}

/* Status badge */
.daemon-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.daemon-status-badge.status-ok {
  background: var(--success-bg);
  color: var(--c1);
  border: 1px solid var(--success-border);
}
.daemon-status-badge.status-pending {
  background: var(--blocked-bg);
  color: var(--blocked);
  border: 1px solid var(--blocked-border);
}
.daemon-status-badge.status-drained {
  background: var(--blocked-bg);
  color: var(--blocked);
  border: 1px solid var(--blocked-border);
}
.daemon-status-badge.status-unavailable {
  background: var(--warn-bg);
  color: var(--maint);
  border: 1px solid var(--warn-border);
}

/* Totals row */
.daemon-totals-row td {
  border-top: 2px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: none !important;
  font-weight: 700;
  padding-top: 10px;
  padding-bottom: 10px;
}
.daemon-totals-row td:last-child {
  border-right: none;
}

/* Workers cell — nested worker table */
.daemon-fleet-table .data-table .daemon-workers-cell {
  vertical-align: top;
  text-align: left;
  width: 1%;
  white-space: nowrap;
}
.nested-worker-list {
  width: 100%;
  margin: 4px 0;
}
.nested-worker-table {
  border-collapse: collapse;
  font-size: 11px;
  width: auto;
  display: table;
}
.nested-worker-table tr {
  display: table-row;
}
.nested-worker-table th,
.nested-worker-table td {
  border-right: none;
  white-space: nowrap;
  padding: 3px 4px;
  text-align: right;
}
/* W column */
.nested-worker-table th:nth-child(1),
.nested-worker-table td:nth-child(1) {
  width: 24px;
  min-width: 24px;
}
/* Status column */
.nested-worker-table th:nth-child(2),
.nested-worker-table td:nth-child(2) {
  width: auto;
  min-width: 55px;
}
/* User column */
.nested-worker-table th:nth-child(3),
.nested-worker-table td:nth-child(3) {
  width: auto;
  min-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Duration column */
.nested-worker-table th:nth-child(4),
.nested-worker-table td:nth-child(4) {
  width: 50px;
  min-width: 50px;
}
.nested-worker-table th {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  text-align: left;
  font-family: monospace;
}
.nested-worker-table td {
  font-family: monospace;
  font-size: 11px;
  border-bottom: none;
}
.nested-worker-table tr.worker-row.status-idle {
  opacity: 0.6;
}
.nested-worker-table tr.worker-row.status-running {
  font-weight: 600;
  color: var(--state-running);
}
.nested-worker-table tr.worker-row.status-queued {
  font-weight: 600;
  color: var(--state-queued);
}
.nested-worker-table tr.worker-row.status-completed {
  font-weight: 600;
  color: var(--state-done);
}
.nested-worker-table tr.worker-row.status-failed {
  font-weight: 600;
  color: var(--state-waiting);
}
.nested-worker-table tr.worker-row.status-cancelled {
  font-weight: 600;
  color: var(--state-queued);
}
.worker-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
}
.worker-dot.idle { background: var(--muted); }
.worker-dot.running { background: var(--state-running); box-shadow: 0 0 4px var(--state-running); }
.worker-dot.queued { background: var(--state-queued); box-shadow: 0 0 4px var(--state-queued); }
.worker-dot.completed { background: var(--state-done); }
.worker-dot.failed { background: var(--state-waiting); }
.worker-dot.cancelled { background: var(--state-queued); }

/* Actions cell */
.daemon-fleet-table .data-table .actions-cell {
  text-align: right;
  vertical-align: top;
}
.daemon-fleet-table .actions-cell button {
  display: block;
  margin-bottom: 4px;
}
.daemon-fleet-table .actions-cell button:last-child {
  margin-bottom: 0;
}
.btn-shutdown {
  font-size: 11px;
  padding: 4px 10px;
  background: var(--field);
  color: var(--maint);
  border: 1px solid var(--maint);
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-shutdown:hover {
  opacity: 0.8;
}

.btn-activate {
  font-size: 11px;
  padding: 4px 10px;
  background: var(--field);
  color: var(--c1);
  border: 1px solid var(--c1);
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-activate:hover {
  opacity: 0.8;
}

.btn-remove {
  font-size: 11px;
  padding: 4px 10px;
  background: var(--field);
  color: #e74c3c;
  border: 1px solid #e74c3c;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-remove:hover {
  opacity: 0.8;
}

.actions-cell {
  white-space: nowrap;
}
.register-daemon-card {
  margin-bottom: 16px;
}
.register-daemon-card h3 {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
}
.register-daemon-form {
  display: flex;
  gap: 8px;
}
.daemon-url-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-family: monospace;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--fieldBorder);
  border-radius: var(--radius-md);
  outline: none;
}
.daemon-url-input:focus {
  border-color: var(--accent);
}
.btn-register {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--c1);
  color: var(--btn-text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-register:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-register:hover:not(:disabled) {
  background: var(--accent);
}

/* ── Load History Chart ────────────────────────────────────────── */
.load-history-section {
  margin-top: 16px;
}
.load-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.level-buttons {
  display: flex;
  gap: 4px;
}

.level-btn {
  font-family: monospace;
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.level-btn:hover {
  border-color: var(--c1);
  color: var(--text);
}

.level-btn.active {
  background: var(--c1);
  color: var(--bg);
  border-color: var(--c1);
}

.level-btn-sub {
  font-size: 8px;
  opacity: 0.6;
  margin-left: 2px;
  vertical-align: super;
}

.level-btn.active .level-btn-sub {
  opacity: 1;
}

.load-history-desc {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
  font-family: monospace;
}

.load-chart {
  width: 100%;
  height: 400px;
  display: block;
  border-radius: 4px;
  background: var(--bg2);
}

/* ── Maintenance banner (Scheduler page) ─────────────────────────── */
.maint-banner {
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 0 16px;
}
.maint-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--maintBg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}
.maint-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.maint-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--maint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.maint-detail {
  font-size: 13px;
  color: var(--text);
  font-family: monospace;
  line-height: 1.6;
}

/* ── Scheduler page inline styles (moved from scheduling-form.html) ── */
body.scheduler-page { display:flex; flex-direction:column; min-height:100vh; }
.clockInner { max-width:360px; margin:0 auto; }
.clockInner .meta { display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size:12px; }
.pill { font:12px monospace; background:var(--field); border:1px solid var(--fieldBorder); border-radius:var(--radius-md); padding:4px 9px; }
#dial { display:block; width:100%; max-width:340px; height:auto; margin:10px auto 0; user-select:none; touch-action:none; }
.lbl { fill:var(--muted); font:11px monospace; }
.read { fill:var(--text); font:600 28px monospace; }
.readSub { fill:var(--muted); font:13px monospace; }
.handle { cursor:grab; }
.minNote { text-align:center; font:12px monospace; color:var(--muted); margin-top:8px; min-height:16px; }
.minNote.warn { color:var(--maint); }
.commit { display:flex; flex-direction:column; gap:14px; align-items:stretch; width:100%; }
.seg { display:flex; flex:1 1 0%; min-width:0; border:1px solid var(--fieldBorder); border-radius:var(--radius-lg); overflow:hidden; }
.seg input { position:absolute; opacity:0; pointer-events:none; }
.seg label { flex:1; text-align:center; padding:9px 18px; font-size:13px; color:var(--muted); cursor:pointer; user-select:none; border-left:1px solid var(--fieldBorder); }
.seg label:first-of-type { border-left:none; }
.seg input:checked + label { background:var(--c2); color:var(--btn-text); font-weight:600; }
#commit { width:100%; background:var(--c1); color:var(--btn-text); border:none; border-radius:var(--radius-lg); padding:14px; font:600 15px system-ui; cursor:pointer; }
#commit:hover { background:var(--c2); }
#commit:disabled { opacity:.4; cursor:not-allowed; background:var(--c1); }
#commit.success { background:var(--maint); color:#fff; }
#commit.success:hover { background:#e05555; }
.num.over { color:var(--maint); }
.limitNote { font:12px monospace; color:var(--maint); min-height:0; }
.commitStatus { font:12px monospace; color:var(--muted); min-height:15px; }
.fine { font:12px system-ui; color:var(--muted); margin:0; }
.task-panel { display:flex; flex-direction:column; gap:14px; }
.task-row { display:flex; align-items:center; gap:12px; min-width:0; }
.task-label { font:10px/1 system-ui; color:var(--muted); text-transform:uppercase; letter-spacing:0.05em; min-width:80px; max-width:80px; text-align:right; font-weight:600; flex-shrink:0; }
.task-value { flex:1 1 0%; display:flex; align-items:center; min-width:0; }
.task-value select { width:100%; background:var(--field); color:var(--text); border:1px solid var(--fieldBorder); border-radius:var(--radius-md); padding:8px 12px; font:14px system-ui; }
.task-value select:focus { outline:none; border-color:var(--c1); }
.task-divider { border:none; border-top:1px solid var(--line); margin:2px 0; }
.derivation { display:flex; flex-direction:column; gap:6px; padding:12px; background:var(--field); border:1px solid var(--fieldBorder); border-radius:var(--radius-lg); }
.deriv-table { width:100%; border-collapse:collapse; }
.deriv-table td { padding:4px 0; font:14px monospace; vertical-align:middle; }
.deriv-table .deriv-label { color:var(--muted); white-space:nowrap; text-align:left; }
.deriv-table .deriv-value { text-align:right; }
.deriv-table-slider { margin-top:14px; }
.deriv-cost-row { display:flex; align-items:center; gap:6px; justify-content:flex-end; }
.deriv-arrow { color:var(--muted); font-weight:600; user-select:none; font-size:16px; }
.deriv-cell { padding:3px 10px; background:var(--panel); border:1px solid var(--fieldBorder); border-radius:var(--radius-sm); text-align:center; display:inline-block; min-width:60px; }
.deriv-cell.window { color:var(--text); font-weight:600; }
.deriv-cell.safety { color:var(--info); }
.deriv-cell.usable { color:var(--warn); }
.deriv-cell.cycles { color:var(--c1); font-weight:700; font-size:16px; }
.deriv-cell.cost { color:var(--c1); font-weight:700; font-size:16px; }
.deriv-cell.cycletime { color:var(--muted); }
.deriv-note { font:12px monospace; color:var(--text); margin-top:4px; padding-left:8px; }
.alloc-row { display:flex; align-items:center; gap:12px; padding:4px 0; }
.alloc-row input[type=range] { flex:1; accent-color:var(--c1); height:6px; cursor:pointer; }
.alloc-val { font:14px monospace; color:var(--c1); min-width:80px; text-align:right; }

/* Two-column grid (desktop) */
.scheduler-grid {
  display:flex;
  flex-direction:row;
  gap:32px;
  align-items:stretch;
}

/* Match vertical spacing: remove card margins inside .stack so flex gap is the only spacing */
.stack > .card,
.stack > .scheduler-grid > .card {
  padding: 8px;
  margin: 0;
}
.scheduler-grid > .card:first-child {
  flex:0 0 auto;
  width:380px;
}
.scheduler-grid > .card:not(:first-child) {
  flex:1 1 0%;
}
/* Stacked cards in the right column */
.scheduler-grid > div:not(.card) {
  flex:1 1 0%;
  display:flex;
  flex-direction:column;
  gap:32px;
}
.scheduler-grid > div:not(.card) > .card {
  padding:8px;
  margin:0;
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
  .scheduler-grid {
    flex-direction:column;
  }
}

/* ─── Account selector cards ──────────────────────────────────────── */
.account-section {
  margin-bottom: 16px;
}

.section-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  margin-top: 0;
}

.account-selector-card .account-cards {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px 0;
}

.account-card {
  position: relative;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--fieldBg);
  flex: 1 1 280px;
  max-width: 360px;
}

.account-card:hover {
  border-color: var(--accent, #7c6fe0);
  box-shadow: 0 0 8px rgba(124, 111, 224, 0.25);
}

.account-card-selected {
  border-color: var(--c1) !important;
  border-width: 3px !important;
  box-shadow: 0 0 0 2px rgba(58, 124, 181, 0.3), 0 0 20px rgba(58, 124, 181, 0.5) !important;
  background: rgba(58, 124, 181, 0.08) !important;
}

.account-card-selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  background: var(--c1);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  z-index: 1;
}

.account-card img {
  width: 100%;
  height: auto;
  display: block;
}

.account-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  text-align: center;
  font-size: 13px;
  padding: 6px 8px;
  font-family: var(--fontMono, monospace);
}

.account-placeholder {
  text-align: center;
  padding: 24px 0;
  color: var(--muted);
  font-size: 14px;
}

/* Account credentials status card */
.credentials-status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.credentials-status { font-size: 14px; }
.credentials-btn {
  background: var(--field); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 8px 20px; font-size: 14px; cursor: pointer;
  font-weight: 600; font-family: system-ui, -apple-system, sans-serif; transition: all 0.2s; white-space: nowrap;
}
.credentials-btn:hover { border-color: var(--c1); color: var(--c1); }
.credentials-btn.btn-urgent {
  color: var(--maint); border-color: var(--maint);
  animation: credentialPulse 1.5s ease-in-out infinite;
}
.credentials-btn.btn-urgent:hover { background: var(--maintBg); }
.credentials-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.credentials-btn:disabled:hover { border-color: var(--line); color: var(--text); }
.account-credentials-card.credentials-alert {
  border-color: var(--maint);
  background: var(--maintBg);
}
@keyframes credentialPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.15); }
}

/* ─── Finances page ──────────────────────────────────────────────── */

.finances-stats-card { margin-bottom: 16px; }

.fin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.fin-stat {
  text-align: center;
  padding: 12px 8px;
  border-radius: var(--radius-md, 8px);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line, #333);
}

.fin-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #999);
  margin-bottom: 6px;
}

.fin-stat-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fin-stat-sub {
  font-size: 11px;
  color: var(--muted, #777);
  margin-top: 4px;
}

/* ─── Badge ─────────────────────────────────────────────────────── */

.fin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.fin-charge {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.fin-credit {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.fin-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ─── Table ─────────────────────────────────────────────────────── */

.finances-table-card { margin-bottom: 16px; }

.fin-table-wrap {
  overflow-x: auto;
}

.finances-table {
  width: 100%;
  border-collapse: collapse;
}

.finances-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #999);
  border-bottom: 1px solid var(--line, #333);
  white-space: nowrap;
}

.finances-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.finances-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.fin-timestamp {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--muted, #aaa);
}

.fin-description {
  color: var(--text, #e5e7eb);
  max-width: 360px;
}

.fin-balance {
  font-variant-numeric: tabular-nums;
}

/* ─── Load more ─────────────────────────────────────────────────── */

.fin-load-more {
  text-align: center;
  margin-top: 16px;
}

.btn-load-more {
  background: rgba(255,255,255,0.05);
  color: var(--text, #e5e7eb);
  border: 1px solid var(--line, #444);
  border-radius: var(--radius-md, 8px);
  padding: 8px 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: system-ui, -apple-system, sans-serif;
  transition: background 0.15s;
}

.btn-load-more:hover {
  background: rgba(255,255,255,0.1);
}

/* ─── Footer ────────────────────────────────────────────────────── */

.fin-footer {
  text-align: center;
  padding: 8px 0 16px;
}

.fin-timezone {
  font-size: 11px;
  color: var(--muted, #666);
}

/* ─── Navbar credit polling: pause on finances page ──────────────── */
/* Navbar already skips polling on /scheduling; we skip it here too
 * to avoid double-polling (finances page polls /api/finances, not /api/status) */

/* ─── Analysis page ──────────────────────────────────────────────── */

/* ─── Session card ─────────────────────────────────────────────── */

.analysis-session-card {
  margin-bottom: 16px;
}

.analysis-session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  white-space: nowrap;
}

.analysis-session-task {
  font-weight: 600;
  font-family: monospace;
}

.analysis-session-time {
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

.analysis-session-total {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

/* ─── Line chart ─────────────────────────────────────────────── */

.analysis-chart-wrap {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 8px;
  padding: 0 4px;
}

.analysis-chart-svg {
  width: auto;
  height: auto;
  max-width: 100%;
}

.analysis-dot {
  cursor: pointer;
  transition: r 0.15s;
}

.analysis-dot:hover {
  r: 5;
}

.analysis-empty {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}




/* Crash screenshot card */
.crash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crash-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 4px;
  display: block;
  margin: 12px auto 0;
}

.crash-preview {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-2, #1a1a2e);
  border-radius: 8px;
}

.crash-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
