/* Taskbox Admin: desktop-first dark console. Self-contained (no external
   fonts, icons or CDNs). Layout: fixed sidebar + page header + wide content
   grid; collapses to a single column on narrow screens. */

:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --sidebar: #0e1118;
  --surface: #12161f;
  --surface-2: #171c27;
  --surface-3: #1d2330;
  --border: #222938;
  --border-strong: #2f3748;
  --text: #e9ecf2;
  --text-muted: #a7b0c0;
  --text-faint: #8590a3;
  --accent: #6d70f5;
  --accent-text: #a9abff;
  --accent-soft: #6d70f51f;
  --good: #34d399;
  --good-soft: #34d3991c;
  --warn: #fbbf24;
  --warn-soft: #fbbf241c;
  --bad: #f87171;
  --bad-soft: #f871711c;
  --info: #60a5fa;
  --info-soft: #60a5fa1c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 #ffffff05 inset, 0 10px 30px -12px #00000080;
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}
/* Every icon is an inline SVG with only a viewBox; give bare ones a sane size. */
svg { width: 1em; height: 1em; display: inline-block; vertical-align: -2px; flex-shrink: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: #c7c8ff; }
button, input, select, textarea { font-family: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
code { font: 12.5px ui-monospace, "SF Mono", Menlo, monospace; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px 16px;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; color: var(--text); }
.side-brand:hover { color: var(--text); }
.mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: block;
  box-shadow: 0 6px 16px -6px #6d70f5aa;
}
.side-brand b { display: block; font-size: 15px; font-weight: 680; letter-spacing: -.01em; line-height: 1.2; }
.side-brand small { display: block; font-size: 11.5px; color: var(--text-faint); }

.side-section { margin-top: 14px; }
.side-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); padding: 0 12px; margin-bottom: 6px; opacity: .8;
}
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px;
  color: var(--text-muted); font-size: 13.5px; font-weight: 550; margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.side-link svg { width: 16px; height: 16px; opacity: .85; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side-link.active svg { color: var(--accent-text); opacity: 1; }
.side-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-foot {
  margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.side-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3);
  border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.side-user span { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.logout {
  font-size: 12.5px; color: var(--text-faint); padding: 5px 10px; border-radius: 7px;
  border: 1px solid var(--border); transition: color .12s, border-color .12s;
}
a.logout:hover { color: var(--bad); border-color: var(--bad); }

.main { min-width: 0; display: flex; flex-direction: column; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 30px 40px 22px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #11141c, var(--bg));
}
.crumb { font-size: 12.5px; color: var(--text-faint); margin-bottom: 6px; display: inline-flex; gap: 6px; }
.crumb a { color: var(--text-faint); }
.crumb a:hover { color: var(--text); }
.page-title { font-size: 26px; font-weight: 720; letter-spacing: -.025em; margin: 0; line-height: 1.2; }
.page-sub { font-size: 13.5px; color: var(--text-muted); margin-top: 6px; max-width: 760px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 28px 40px 72px; width: 100%; max-width: 1560px; }
.flashes { padding: 18px 40px 0; max-width: 1560px; }
.flashes > div { margin-bottom: 0; }

/* Two-column page body: main content + a side column of controls/context. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.layout.wide-side { grid-template-columns: minmax(0, 1fr) 440px; }
.layout.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.col { display: grid; gap: 24px; align-content: start; min-width: 0; }
.col > .card, .layout > .card { margin: 0; }
.stack { display: grid; gap: 24px; }
.stack > .card { margin: 0; }
.mt { margin-top: 24px; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 24px; box-shadow: var(--shadow); min-width: 0;
}
.card h2 {
  font-size: 14.5px; font-weight: 660; letter-spacing: -.005em; margin: 0 0 16px;
  display: flex; align-items: center; gap: 8px; color: var(--text); line-height: 1.4;
}
.card h2 svg { width: 15px; height: 15px; color: var(--accent-text); opacity: .9; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.card-link { font-size: 12.5px; font-weight: 600; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 18px 22px 0; }

/* ---------------------------------------------------------------- stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px 20px; box-shadow: var(--shadow); min-width: 0; position: relative; overflow: hidden;
}
.stat-tile .label {
  font-size: 12.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.stat-tile .label svg {
  width: 26px; height: 26px; padding: 6px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-text);
}
.stat-tile .value { font-size: 28px; font-weight: 740; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-tile .sub { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }

.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 14px; }
.progress .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5b5ef0, #8b8dff); }
.progress .fill.good { background: linear-gradient(90deg, #10b981, #34d399); }
.progress .fill.warn { background: var(--warn); }
.progress .fill.bad { background: var(--bad); }

/* ---------------------------------------------------------------- badges, banners */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap; letter-spacing: .01em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-ok { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-3); color: var(--text-muted); }

.error-banner, .ok-banner {
  border-radius: 11px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 20px;
  display: flex; gap: 10px; align-items: flex-start;
}
.error-banner { background: var(--bad-soft); border: 1px solid #f8717140; color: #fecaca; }
.ok-banner { background: var(--good-soft); border: 1px solid #34d39940; color: #bbf7d0; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; margin: 0 -24px -22px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
td, th { text-align: left; padding: 13px 24px; border-top: 1px solid var(--border); vertical-align: top; }
th {
  color: var(--text-faint); font-weight: 650; font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; background: var(--surface-2); border-top: 1px solid var(--border);
}
tr:hover td { background: #ffffff03; }
tr.today td { background: var(--accent-soft); }
tr.today td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
td.desc { color: var(--text-muted); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
.day-cell { font-weight: 600; }
.hnum { font-weight: 700; font-variant-numeric: tabular-nums; }
.hnum-ok { color: var(--good); }
.hnum-warn { color: var(--warn); }
.hnum-info { color: var(--info); }
.hnum-muted { color: var(--text-faint); font-weight: 500; }

/* ---------------------------------------------------------------- text bits */
pre {
  white-space: pre-wrap; word-break: break-word; margin: 0;
  font: 12px/1.65 ui-monospace, "SF Mono", Menlo, monospace; color: var(--text-muted);
}
.log-box {
  background: #0a0c11; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; max-height: 340px; overflow: auto;
}
.muted { color: var(--text-faint); font-size: 12.5px; line-height: 1.55; }
.empty {
  color: var(--text-faint); font-size: 13.5px; padding: 26px 16px; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: 12px; background: #ffffff02;
}
.field-hint { font-size: 13.5px; color: var(--text-muted); margin: 0 0 14px; line-height: 1.6; }
.help-text { color: var(--text-muted); font-size: 13px; line-height: 1.6; margin: 0; }
.error { color: var(--bad); font-size: 13px; margin-top: 12px; }

/* key/value rows used in side cards */
.kv { display: grid; gap: 0; margin: 0; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 0; border-top: 1px solid var(--border); }
.kv > div:first-child { border-top: 0; padding-top: 2px; }
.kv dt { color: var(--text-faint); font-size: 13px; }
.kv dd { margin: 0; font-size: 13.5px; font-weight: 600; text-align: right; }

.link-list { display: grid; gap: 6px; }
.link-list a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 13.5px; font-weight: 550;
  transition: border-color .12s, background .12s;
}
.link-list a svg { color: var(--accent-text); width: 15px; height: 15px; }
.link-list a::after { content: "\2192"; margin-left: auto; color: var(--text-faint); }
.link-list a:hover { border-color: var(--accent); background: var(--surface-3); }

/* ---------------------------------------------------------------- forms */
label { font-size: 13.5px; color: var(--text); font-weight: 560; }
.field { min-width: 0; }
.field > label { display: block; margin-bottom: 7px; }
input:where(:not([type="checkbox"]):not([type="hidden"])), select {
  width: 100%; padding: 9px 12px; margin: 0; min-height: 40px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); vertical-align: middle; flex: 0 0 auto; }
input[type="hidden"] { display: none; }
input[type="date"], input[type="time"] { color-scheme: dark; font-variant-numeric: tabular-nums; }
textarea {
  width: 100%; min-height: 200px; resize: vertical; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 11px;
  color: var(--text); font-size: 14px; line-height: 1.65;
}
textarea.mono { font: 13px/1.7 ui-monospace, "SF Mono", Menlo, monospace; }

button {
  padding: 9px 16px; min-height: 38px; background: var(--accent); border: 1px solid transparent; border-radius: var(--radius-sm);
  color: #fff; font-size: 13.5px; font-weight: 650; cursor: pointer; transition: filter .12s, background .12s, border-color .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
button:hover { filter: brightness(1.1); }
button:active { transform: translateY(1px); }
.btn, a.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; min-height: 38px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 650; border: 1px solid transparent;
  background: var(--accent); color: #fff; white-space: nowrap;
}
a.btn:hover { color: #fff; filter: brightness(1.1); }
.btn svg { width: 15px; height: 15px; }
.btn-secondary, button.btn-secondary, a.btn.btn-secondary {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
}
.btn-secondary:hover, a.btn.btn-secondary:hover { background: var(--surface-3); color: var(--text); filter: none; }

.form-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--border);
}
.form-footer .help-text { font-size: 12.5px; }

/* manual run */
.run-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.run-form .field label { margin-bottom: 7px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #6d70f524, transparent 60%), var(--bg); }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px 30px 28px; box-shadow: var(--shadow); }
.login-box .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-box .brand h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -.015em; }
.login-box .brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-faint); }
.login-box label { display: block; margin-bottom: 7px; }
.login-box input { margin-bottom: 16px; }
.login-box button[type="submit"] { width: 100%; margin-top: 6px; min-height: 42px; }
.pw-field { position: relative; }
.pw-field input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 5px; top: 20px; transform: translateY(-50%);
  background: none; border: 0; padding: 6px; min-height: 0; color: var(--text-faint); line-height: 0;
}
.pw-toggle:hover { color: var(--text); filter: none; }
.pw-toggle svg { width: 18px; height: 18px; display: block; }

/* ---------------------------------------------------------------- automation switch */
.automation-row { display: flex; align-items: flex-start; gap: 16px; }
.automation-row form { margin: 0; flex-shrink: 0; padding-top: 2px; }
.automation-text { flex: 1; min-width: 0; }
.automation-state { font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.automation-state .on-txt { color: var(--good); }
.automation-state .off-txt { color: var(--text-faint); }
.switch {
  width: 44px; height: 24px; min-height: 0; border-radius: 99px; border: 1px solid var(--border-strong);
  background: var(--surface-3); padding: 2px; display: block; position: relative;
}
.switch:hover { filter: none; }
.switch .knob { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--text-faint); transition: transform .16s ease, background .15s; }
.switch.on { background: #34d39933; border-color: var(--good); }
.switch.on .knob { background: var(--good); transform: translateX(20px); }

/* ---------------------------------------------------------------- runs (Claude / Codex) */
.latest-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.latest-when { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.latest-tiles { margin: 18px 0 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.latest-tiles .stat-tile { background: var(--surface-2); box-shadow: none; }
.run-list { display: flex; flex-direction: column; }
.run-item { padding: 13px 0; border-top: 1px solid var(--border); }
.run-item:first-child { border-top: 0; padding-top: 2px; }
.run-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.run-when { font-size: 13.5px; font-weight: 650; }
.run-metrics { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.rmetric { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--text-faint); }
.rmetric i { font-style: normal; font-weight: 700; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.rmetric b { font-weight: 700; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.rmetric em { font-style: normal; }

.usage-chart { width: 100%; height: auto; display: block; }
.usage-chart text { fill: var(--text-faint); font-size: 11px; font-family: inherit; }
.usage-chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.usage-chart .limit { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.usage-chart .limit-label { fill: var(--warn); font-size: 10.5px; }

/* ---------------------------------------------------------------- approvals */
.appr-list { display: grid; gap: 12px; }
.appr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.appr-card {
  display: block; color: inherit; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; transition: border-color .12s, background .12s, transform .12s;
}
.appr-grid .appr-card { background: var(--surface); box-shadow: var(--shadow); }
.appr-card:hover { border-color: var(--accent); background: var(--surface-3); color: inherit; }
.appr-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.appr-card-day { font-size: 14.5px; font-weight: 680; }
.appr-card-go { font-size: 12.5px; font-weight: 650; color: var(--accent-text); white-space: nowrap; }
.appr-card-meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.appr-card-preview {
  font-size: 13px; color: var(--text-muted); margin-top: 10px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.appr-pos { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }

.commit-list { display: flex; flex-direction: column; }
.commit-repo {
  font-size: 10.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); margin: 16px 0 8px; display: flex; align-items: center; gap: 8px;
}
.commit-list .commit-repo:first-child { margin-top: 0; }
.commit-item {
  font-size: 13px; color: var(--text); line-height: 1.5; padding: 6px 0 6px 14px;
  border-left: 2px solid var(--border-strong);
}
.note-item {
  font-size: 13px; color: var(--text); line-height: 1.5; padding: 6px 0 6px 14px;
  border-left: 2px solid var(--info); margin-bottom: 2px;
}
.note-time { color: var(--text-faint); font-variant-numeric: tabular-nums; margin-right: 8px; }
.note-author { color: var(--text-muted); font-weight: 650; margin-right: 5px; }

.appr-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.appr-actions form { margin: 0; }
.appr-danger-row { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.link-danger {
  background: none; border: 0; padding: 0; min-height: 0; font-weight: 550;
  font-size: 12.5px; color: var(--text-faint); text-decoration: underline; text-underline-offset: 3px;
}
.link-danger:hover { color: var(--bad); filter: none; }
.confirm-line {
  display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--warn);
  margin: 14px 0 2px; padding: 12px 14px; line-height: 1.5;
  background: var(--warn-soft); border: 1px solid #fbbf2440; border-radius: 10px; font-weight: 500;
}
.prev-desc-box {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--warn);
  border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.6;
  color: var(--text-muted); white-space: pre-wrap; word-break: break-word;
}
.project-pill {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid #6d70f540; font-size: 13px; color: var(--text-muted); margin-bottom: 14px;
}
.project-pill svg { color: var(--accent-text); width: 16px; height: 16px; }
.project-pill strong { color: var(--text); }

.run-cards { display: grid; gap: 12px; margin-bottom: 16px; }
.run-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.run-card.running { border-color: #6d70f566; background: linear-gradient(90deg, var(--accent-soft), var(--surface) 70%); }
.run-card.failed { border-color: #f8717155; }
.run-card.empty { border-style: dashed; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2.5px solid #6d70f533; border-top-color: var(--accent-text); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ---------------------------------------------------------------- settings / timer */
.eyebrow { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: var(--text-faint); text-transform: uppercase; }
.fixed-details { display: flex; gap: 8px; flex-wrap: wrap; }
.fixed-details span, .method-label {
  border: 1px solid var(--border-strong); border-radius: 99px; padding: 4px 11px;
  color: var(--text-muted); font-size: 12px; white-space: nowrap; background: var(--surface-2);
}
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.settings-layout .card { margin: 0; }
.settings-aside { display: grid; gap: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 5px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  margin-bottom: 22px; cursor: pointer;
}
.toggle-row strong { display: block; margin-bottom: 2px; font-weight: 600; }
.toggle-row .help-text { display: block; font-weight: 400; }
input.toggle-input {
  appearance: none; width: 42px; height: 24px; border-radius: 20px; background: var(--surface-3);
  border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: background .15s;
}
input.toggle-input::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
input.toggle-input:checked { background: var(--accent); border-color: var(--accent); }
input.toggle-input:checked::after { transform: translateX(18px); }
.time-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.timer-settings .field { margin-bottom: 22px; }
.timer-settings .field .help-text { display: block; margin-top: 7px; font-size: 12.5px; }
.day-field { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.day-field legend { font-size: 13.5px; font-weight: 560; padding: 0; margin-bottom: 9px; }
.day-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day-option { position: relative; cursor: pointer; }
.day-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.day-option span {
  display: flex; align-items: center; justify-content: center; height: 40px; border: 1px solid var(--border-strong);
  border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-muted); background: var(--surface-2);
}
.day-option input:checked + span { color: #e0e1ff; background: var(--accent-soft); border-color: #6d70f580; }
.day-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-dot { height: 8px; width: 8px; background: var(--good); border-radius: 50%; box-shadow: 0 0 0 4px var(--good-soft); margin-top: 6px; }
.status-list { margin: 0; }
.status-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 0; border-top: 1px solid var(--border); }
.status-list > div:first-child { border-top: 0; padding-top: 0; }
.status-list dt { color: var(--text-faint); font-size: 13px; }
.status-list dd { text-align: right; margin: 0; font-size: 13.5px; font-weight: 600; }
.last-event { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 8px; }
.last-event p { margin: 8px 0 4px; font-size: 13.5px; overflow-wrap: anywhere; color: var(--text-muted); }
.last-event time { font-size: 12px; color: var(--text-faint); }
.event-title { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-weight: 600; }
.rules-note ul { margin: 0 0 14px; padding-left: 18px; color: var(--text-muted); }
.rules-note li { padding: 3px 0 3px 4px; font-size: 13.5px; }
.rules-note li::marker { color: var(--accent-text); }
.api-card { grid-column: 1 / -1; }
.endpoint-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 18px; margin-bottom: 12px; }
.endpoint-row > label { display: flex; align-items: center; gap: 9px; }
.endpoint-icon { color: var(--accent-text); width: 16px; text-align: center; }
.copy-field { display: flex; gap: 8px; align-items: center; min-width: 0; }
.copy-field input { min-width: 0; flex: 1; font: 12px ui-monospace, "SF Mono", Menlo, monospace; color: var(--text-muted); }
.copy-field .copy-url { flex: 0 0 auto; min-width: 78px; }
#copy-feedback { display: block; margin-top: 16px; font-size: 12.5px; }
.call-history-card .table-wrap { margin-top: 4px; }

/* schedule editor (Claude / Codex) */
.schedule-profiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.schedule-profile { border: 1px solid var(--border); border-radius: 12px; margin: 0; padding: 16px 18px 18px; min-width: 0; background: var(--surface-2); }
.schedule-profile legend { font-size: 14px; font-weight: 650; padding: 0 6px; }
.schedule-profile > p { margin-bottom: 16px; }
.schedule-profile .time-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; align-items: end; }
.schedule-profile .field > label { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.schedule-profile input[type="time"] { padding: 8px 8px; font-size: 13.5px; }
.schedule-note { margin: 18px 0; }
.schedule-preview { margin: 14px 0 0; color: var(--info); font-weight: 500; min-height: 1.6em; font-size: 12.5px; }
.claude-schedule .section-heading { margin-bottom: 18px; }

/* ---------------------------------------------------------------- notes */
.note-compose textarea { min-height: 180px; font-size: 14.5px; }
.note-day { display: flex; align-items: center; gap: 10px; margin: 0; }
.note-day input[type="date"] { width: auto; }
.note-compose > .help-text { display: block; margin-top: 12px; }
.retention-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.retention-form .field { display: flex; align-items: center; gap: 10px; margin: 0; }
.retention-form input[type="number"] { width: 84px; text-align: center; }
.note-list { display: grid; gap: 14px; }
.note-card { padding: 18px 20px; margin: 0; }
.note-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.note-card-head time { font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.note-card-head form { margin: 0; }
.note-delete {
  width: 30px; height: 30px; min-height: 0; padding: 0; background: transparent; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 8px;
}
.note-delete svg { width: 14px; height: 14px; }
.note-delete:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); filter: none; }
.note-card-body {
  margin: 0; font-size: 14px; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 6.6em; overflow: hidden; position: relative;
}
.note-card-body:not(.expanded)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 32px;
  background: linear-gradient(to bottom, transparent, var(--surface));
}
.note-card-body.expanded { max-height: none; }
.note-toggle { margin-top: 8px; padding: 0; min-height: 0; background: none; border: 0; color: var(--accent-text); font-size: 12.5px; font-weight: 650; }
.note-toggle:hover { filter: none; text-decoration: underline; }

/* ---------------------------------------------------------------- month calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-head { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); padding: 0 4px 2px; }
.cal-cell {
  min-height: 104px; border: 1px solid var(--border); border-radius: 11px; padding: 9px 10px;
  background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.cal-cell.out { background: transparent; border-style: dashed; opacity: .35; }
.cal-cell.weekend { background: #ffffff03; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.missing { border-color: #f8717155; }
.cal-date { font-size: 12px; font-weight: 650; color: var(--text-muted); }
table.compact td, table.compact th { padding: 11px 14px; }
table.compact td:first-child, table.compact th:first-child { padding-left: 24px; }
.cal-hours { white-space: nowrap; font-size: 16px; font-weight: 740; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cal-bar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.cal-bar span { display: block; height: 100%; background: linear-gradient(90deg, #10b981, #34d399); border-radius: 99px; }
.cal-proj { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-none { font-size: 11.5px; color: var(--bad); margin-top: auto; }
.cal-cell.leave { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.cal-leave { font-size: 11.5px; font-weight: 600; color: var(--accent); margin-top: auto; }
.leave-fields { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.leave-fields label, .leave-note { display: flex; flex-direction: column; gap: 4px; }
.leave-note { margin-bottom: 12px; }
.leave-note input { width: 100%; }
.cal-short { display: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .layout, .layout.wide-side, .settings-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1040px) {
  .layout, .layout.wide-side, .layout.even, .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .appr-grid, .schedule-profiles { grid-template-columns: minmax(0, 1fr); }
}
/* ---------------------------------------------------------------- phones */
.mobile-bar, .nav-scrim { display: none; }

@media (max-width: 820px) {
  body { font-size: 14.5px; }
  .app { display: block; }

  /* top bar + slide-in drawer */
  .mobile-bar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    height: 56px; padding: 0 12px; background: #0e1118ee; backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  }
  .menu-btn {
    width: 40px; height: 40px; min-height: 0; padding: 0; position: relative;
    background: transparent; border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  }
  .menu-btn svg { width: 20px; height: 20px; }
  .menu-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--sidebar); }
  .mobile-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 680; font-size: 15.5px; min-width: 0; }
  .mobile-brand .mark { width: 28px; height: 28px; border-radius: 8px; }
  .mobile-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; height: auto; width: min(290px, 84vw);
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 40px #00000080;
    padding-top: 16px;
  }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 40; background: #00000099; }
  .nav-scrim[hidden] { display: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: none; }
  .side-link { padding: 11px 12px; font-size: 14.5px; }

  /* page header */
  .page-head { padding: 18px 16px 16px; flex-direction: column; align-items: stretch; gap: 14px; }
  .page-title { font-size: 22px; }
  .page-sub { font-size: 13.5px; }
  .page-actions { justify-content: stretch; }
  .page-actions > .btn, .page-actions > form, .page-actions > form > button { flex: 1 1 0; justify-content: center; }
  .page-actions > .fixed-details { width: 100%; }
  .content { padding: 16px 12px 48px; }
  .flashes { padding: 12px 12px 0; }

  /* cards, tiles, tables */
  .layout, .layout.wide-side, .layout.even, .settings-layout { gap: 14px; }
  .col, .stack, .settings-aside { gap: 14px; }
  .card { padding: 16px; margin-bottom: 14px; border-radius: 12px; }
  .card h2 { margin-bottom: 12px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .stat-tile { padding: 13px 14px 14px; border-radius: 12px; }
  .stat-tile .label { font-size: 12px; margin-bottom: 6px; }
  .stat-tile .label svg { width: 22px; height: 22px; padding: 5px; }
  .stat-tile .value { font-size: 21px; }
  .stat-tile .sub { font-size: 11.5px; }
  .table-wrap { margin: 0 -16px -16px; }
  td, th { padding: 11px 14px; font-size: 13px; }
  table.compact td, table.compact th { padding: 10px 10px; }
  table.compact td:first-child, table.compact th:first-child { padding-left: 14px; }
  .time-grid, .latest-tiles { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .latest-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* forms and buttons: thumb-sized */
  .run-form { grid-template-columns: minmax(0, 1fr); }
  .run-form button, .form-footer button, .appr-actions button, .appr-actions .btn { width: 100%; min-height: 44px; }
  .appr-actions { flex-direction: column; align-items: stretch; }
  .form-footer { flex-direction: column; align-items: stretch; }
  input:where(:not([type="checkbox"]):not([type="hidden"])), select { min-height: 44px; font-size: 16px; }
  textarea { font-size: 15px; }
  .retention-form, .retention-form .field { width: 100%; }
  .retention-form button { width: 100%; }
  .endpoint-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .day-picker { gap: 4px; }
  .day-option span { height: 42px; font-size: 12px; }

  /* schedule editor */
  .schedule-profile { padding: 12px 12px 14px; }
  .schedule-profile .time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* approvals: editor first, context after */
  .appr-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }

  /* month calendar: date + hours only */
  .cal { gap: 4px; }
  .cal-head { font-size: 9.5px; padding: 0 0 2px; text-align: center; letter-spacing: .03em; }
  .cal-cell { min-height: 54px; padding: 5px 4px; border-radius: 8px; gap: 2px; align-items: center; }
  .cal-date { font-size: 11px; }
  .cal-hours { font-size: 11.5px; letter-spacing: -.01em; }
  .cal-bar, .cal-proj, .cal-long { display: none; }
  .cal-short { display: inline; }
  .cal-none { font-size: 9.5px; margin-top: 0; }
  .cal-leave { font-size: 9.5px; margin-top: 0; }

  .kv dd { font-size: 13px; }
  .log-box { max-height: 260px; }
}

/* very narrow phones */
@media (max-width: 340px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-hours { font-size: 10.5px; }
}

/* Regenerate a draft (approval detail) */
.regen-row { display: flex; gap: 8px; margin-top: 12px; }
.regen-row input { flex: 1; min-width: 0; }
