:root {
  --ink: #e9edf2;
  --muted: #8c98a7;
  --faint: #5c6877;
  --bg: #0c1117;
  --surface: #121923;
  --surface-2: #18212c;
  --line: #25313e;
  --accent: #c8f36a;
  --accent-soft: rgba(200, 243, 106, .12);
  --success: #79d7a2;
  --danger: #ff8e84;
  --warning: #f7c76b;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-size: 14px; }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; background: radial-gradient(circle at 72% -10%, rgba(200, 243, 106, .08), transparent 30rem), var(--bg); }
.topbar { height: 76px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--accent); color: var(--accent); font: 700 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: -.08em; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font: 10px/1.1 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; letter-spacing: .12em; }
.topbar-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; letter-spacing: .05em; }
.logout-link { color: var(--muted); text-decoration: none; font-size: 10px; letter-spacing: .1em; }
.logout-link:hover { color: var(--accent); }
.connection-pill, .worker-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; }
.worker-pill { color: var(--accent); border-color: rgba(200, 243, 106, .25); }
.worker-pill.error, .worker-pill.stale { color: var(--danger); border-color: rgba(255, 142, 132, .3); }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(200, 243, 106, .08); }
.error .status-dot, .status-badge.error .status-dot { background: var(--danger); }
.running .status-dot { background: var(--warning); }
.success .status-dot { background: var(--success); }
.page-wrap { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0 88px; }
.intro-row { display: flex; justify-content: space-between; gap: 40px; align-items: flex-end; margin-bottom: 45px; }
.eyebrow, .micro-label { margin: 0 0 12px; color: var(--accent); font: 600 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(38px, 5vw, 70px); line-height: .99; letter-spacing: -.065em; font-weight: 670; }
h1 em { color: var(--accent); font-style: normal; }
h2 { margin-bottom: 0; font-size: 22px; line-height: 1; letter-spacing: -.04em; }
.intro-copy { max-width: 520px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.pulse-card { display: flex; align-items: center; gap: 15px; min-width: 265px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(18, 25, 35, .6); }
.pulse-card strong, .pulse-card small { display: block; }
.pulse-card strong { margin-bottom: 6px; font-size: 13px; }
.pulse-card small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.pulse-card .micro-label { margin-bottom: 7px; color: var(--faint); }
.pulse-orbit { width: 40px; height: 40px; border: 1px solid rgba(200, 243, 106, .35); border-radius: 50%; display: grid; place-items: center; }
.pulse-orbit span { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px var(--accent); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 42px; }
.stat-card { min-height: 130px; padding: 23px 22px 20px; border-left: 1px solid var(--line); }
.stat-card:first-child { border-left: 0; }
.stat-card strong { display: block; margin: 7px 0 5px; font-size: 30px; letter-spacing: -.05em; }
.stat-card small { color: var(--muted); font-size: 12px; }
.stat-card .micro-label { color: var(--faint); }
.accent-card strong, .stat-card .stat-status { color: var(--accent); }
.next-run-panel, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.next-run-panel { margin-bottom: 24px; padding: 25px; }
.section-heading, .panel-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-heading .eyebrow, .panel-header .eyebrow { margin-bottom: 9px; color: var(--faint); }
.live-tag, .panel-count { color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; letter-spacing: .1em; }
.live-tag { display: inline-flex; align-items: center; gap: 7px; color: var(--success); }
.live-tag .status-dot { background: var(--success); }
.next-run-grid { display: grid; grid-template-columns: 1.15fr .95fr 1.2fr; gap: 0; margin-top: 26px; }
.next-run-grid > div { min-height: 91px; padding: 3px 24px 0 0; border-right: 1px solid var(--line); }
.next-run-grid > div + div { padding-left: 24px; }
.next-run-grid > div:last-child { border-right: 0; padding-right: 0; }
.next-keyword strong, .next-time strong { display: block; overflow: hidden; color: var(--ink); font-size: clamp(20px, 2.6vw, 31px); line-height: 1.1; letter-spacing: -.045em; text-overflow: ellipsis; white-space: nowrap; }
.next-time strong { color: var(--accent); font-size: 20px; letter-spacing: -.03em; }
.queue-index { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; }
.meter-label { display: flex; justify-content: space-between; margin: 5px 0 11px; color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.meter-track { height: 5px; overflow: hidden; border-radius: 99px; background: #26313d; }
.meter-track span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
.sequence-meter p { margin: 12px 0 0; color: var(--faint); font-size: 11px; line-height: 1.35; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(315px, .8fr); gap: 24px; align-items: start; }
.panel { overflow: hidden; }
.panel-header { padding: 24px 24px 20px; border-bottom: 1px solid var(--line); }
.add-form { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; gap: 8px; padding: 17px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.015); }
input { width: 100%; border: 1px solid var(--line); border-radius: 9px; outline: none; background: var(--bg); color: var(--ink); padding: 11px 12px; }
input::placeholder { color: #657181; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.button { border: 0; border-radius: 9px; padding: 11px 14px; font-weight: 700; transition: transform .15s ease, background .15s ease; }
.button:active, .icon-button:active { transform: translateY(1px); }
.button.primary { background: var(--accent); color: #11170d; }
.button.primary:hover { background: #d8fb82; }
.button.ghost { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.queue-list { min-height: 150px; }
.keyword-row { display: grid; grid-template-columns: 35px minmax(150px, 1fr) 92px 48px auto; align-items: center; gap: 13px; padding: 15px 24px; border-bottom: 1px solid rgba(37, 49, 62, .75); }
.keyword-row:last-child { border-bottom: 0; }
.keyword-row.disabled { opacity: .5; }
.order-number { color: var(--faint); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.keyword-main { min-width: 0; }
.keyword-main strong { display: block; overflow: hidden; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.keyword-main span, .keyword-meta span { display: block; margin-top: 5px; color: var(--faint); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.status-badge.success { color: var(--success); }
.status-badge.error { color: var(--danger); }
.status-badge.running { color: var(--warning); }
.keyword-meta { text-align: right; }
.keyword-meta strong { display: block; color: var(--ink); font-size: 13px; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.icon-button { border: 0; background: transparent; color: var(--muted); padding: 7px 5px; font-size: 11px; }
.icon-button:hover { color: var(--accent); }
.icon-button.danger:hover { color: var(--danger); }
.activity-list { min-height: 264px; }
.activity-row { display: flex; gap: 11px; padding: 15px 24px; border-bottom: 1px solid rgba(37, 49, 62, .75); }
.activity-row > div { min-width: 0; }
.activity-row strong { display: block; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.activity-row span:not(.activity-line), .activity-error { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.activity-error { color: var(--danger); }
.activity-line { flex: 0 0 3px; align-self: stretch; min-height: 28px; border-radius: 3px; background: var(--faint); }
.activity-line.success { background: var(--success); }
.activity-line.error { background: var(--danger); }
.activity-line.running { background: var(--warning); }
.activity-note { display: flex; gap: 9px; align-items: center; margin: 16px 24px 20px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.activity-note .status-dot { flex: 0 0 auto; }
.empty-state { display: grid; place-items: center; min-height: 220px; padding: 30px; text-align: center; }
.empty-state.compact { min-height: 264px; }
.empty-mark { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 14px; border: 1px solid var(--line); color: var(--accent); font: 22px ui-monospace, SFMono-Regular, Consolas, monospace; }
.empty-state strong { font-size: 13px; }
.empty-state p { max-width: 230px; margin: 7px auto 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.flash { margin: -20px 0 32px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; font-size: 12px; }
.flash.success { color: var(--success); border-color: rgba(121, 215, 162, .3); background: rgba(121, 215, 162, .06); }
.flash.error, .error-panel { color: var(--danger); border-color: rgba(255, 142, 132, .3); background: rgba(255, 142, 132, .06); }
.error-panel { padding: 25px; border: 1px solid; border-radius: var(--radius); }
.error-panel h2 { margin: 8px 0 12px; color: var(--ink); }
.error-panel p { margin-bottom: 8px; color: var(--muted); font-size: 13px; }
code { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.edit-dialog { width: min(460px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 25px 80px rgba(0,0,0,.5); }
.edit-dialog::backdrop { background: rgba(5, 8, 11, .78); backdrop-filter: blur(5px); }
.edit-dialog form { padding: 25px; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.dialog-header .eyebrow { color: var(--faint); margin-bottom: 8px; }
.dialog-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.edit-dialog label { display: block; margin: 15px 0 7px; color: var(--muted); font-size: 12px; }
.dialog-note { margin: 15px 0 0; color: var(--faint); font-size: 11px; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 25px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: 28px 16px; background: radial-gradient(circle at 50% 0%, rgba(200, 243, 106, .1), transparent 33rem), var(--bg); }
.auth-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 25px 80px rgba(0,0,0,.25); }
.auth-brand { margin-bottom: 56px; }
.auth-copy h1 { margin-bottom: 13px; font-size: clamp(34px, 8vw, 48px); }
.auth-copy > p:last-child { color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-form { margin-top: 27px; }
.auth-form label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.auth-form .button { width: 100%; margin-top: 12px; display: flex; justify-content: space-between; align-items: center; }
.auth-message { margin-top: 18px; padding: 11px 12px; border: 1px solid; border-radius: 9px; font-size: 12px; }
.auth-message.error { color: var(--danger); border-color: rgba(255, 142, 132, .3); background: rgba(255, 142, 132, .06); }
.auth-message.success { color: var(--success); border-color: rgba(121, 215, 162, .3); background: rgba(121, 215, 162, .06); }
.auth-footnote { margin: 27px 0 0; color: var(--faint); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 920px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .activity-list { min-height: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .stat-card:nth-child(4) { border-top: 1px solid var(--line); }
}
@media (max-width: 680px) {
  .topbar { height: auto; min-height: 72px; padding: 15px 20px; gap: 15px; align-items: flex-start; }
  .topbar-meta { flex-direction: column; align-items: flex-end; gap: 5px; font-size: 9px; }
  .logout-link { font-size: 9px; }
  .page-wrap { width: min(100% - 28px, 1260px); padding-top: 45px; }
  .intro-row { display: block; margin-bottom: 34px; }
  .intro-copy { font-size: 13px; }
  .pulse-card { margin-top: 24px; }
  .next-run-grid { grid-template-columns: 1fr; gap: 20px; }
  .next-run-grid > div, .next-run-grid > div + div { min-height: auto; padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .next-run-grid > div:last-child { padding: 0; border-bottom: 0; }
  .add-form { grid-template-columns: 1fr 62px; }
  .add-form .button { grid-column: span 2; }
  .keyword-row { grid-template-columns: 25px minmax(0, 1fr) 52px; gap: 9px; padding: 14px 16px; }
  .keyword-row .status-badge, .keyword-row .keyword-meta { display: none; }
  .row-actions { grid-column: 2 / 4; justify-content: flex-start; border-top: 1px solid rgba(37,49,62,.7); padding-top: 8px; }
  .panel-header, .add-form { padding-left: 16px; padding-right: 16px; }
  .stats-grid { margin-bottom: 28px; }
  .stat-card { padding: 17px 14px; min-height: 110px; }
  .stat-card strong { font-size: 24px; }
}
