:root {
  --bg: #f5f5f3; --surface: #fff; --border: #dedfda; --text: #1d1f1c; --muted: #6a6d66;
  --brand: #0d037d; --brand-ink: #fff; --brand-soft: #ebeaf7;
  --prod: #2d7a55; --neut: #b3b5ad; --unprod: #b5443b; --idle: #e4e5e0;
  --radius: 6px; --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141513; --surface: #1c1d1a; --border: #2f312d; --text: #e6e7e2; --muted: #8e918a;
    --brand: #9a93f2; --brand-ink: #0c0933; --brand-soft: #1f1d36;
    --prod: #4cb585; --neut: #6a6d66; --unprod: #e0685e; --idle: #2a2c28;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-variant-numeric: tabular-nums; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); } .sm { font-size: 12.5px; } .r { text-align: right; }
.ic { width: 16px; height: 16px; flex: none; }

/* Layout */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; padding: 2px 12px 22px; letter-spacing: -.01em; }
.logo { width: 22px; height: 22px; border-radius: 4px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 4px; border-left: 2px solid transparent; color: var(--muted); }
.sidebar a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidebar a.active { background: var(--bg); color: var(--text); border-left-color: var(--brand); font-weight: 600; }
.sidebar .logout { margin-top: auto; }
.main { padding: 28px 36px 60px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.page-head p { margin: 4px 0 0; }
.head-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.back .ic { width: 15px; height: 15px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.grid-2 > .card, .grid-2 > .card + .card { margin: 0; }
.grid-2 + .card, .card + .grid-2, .kpis + .card, .card + .card { margin-top: 20px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.kpis .card { margin: 0; border: 0; border-radius: 0; background: none; border-right: 1px solid var(--border); }
.kpis .card:last-child { border-right: 0; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.kpi-value small { font-size: 16px; color: var(--muted); font-weight: 500; }
.kpi-value.sm-val { font-size: 24px; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 22px 6px; text-align: center; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 12px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.r { text-align: right; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--bg); }
.w-score { width: 220px; }
.person { display: flex; align-items: center; gap: 12px; }
.avatar { width: 30px; height: 30px; border-radius: 4px; background: var(--idle); color: var(--muted); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--neut); margin-right: 6px; }
.dot.on { background: var(--prod); }

/* Bars & charts */
.stack { display: flex; height: 6px; border-radius: 2px; overflow: hidden; background: var(--idle); margin-bottom: 4px; }
.stack i, .bar i { display: block; height: 100%; }
.c-prod { background: var(--prod); } .c-neut { background: var(--neut); } .c-unprod { background: var(--unprod); } .c-idle { background: var(--idle); }
.bar-row { margin-bottom: 14px; }
.bar-top { display: flex; justify-content: space-between; margin-bottom: 5px; }
.bar { height: 6px; background: var(--idle); border-radius: 2px; overflow: hidden; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 1px; margin-right: 6px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 6px; height: 170px; align-items: end; }
.hour { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; align-items: center; gap: 6px; }
.hour-bar { width: 100%; min-height: 3px; display: flex; flex-direction: column; border-radius: 2px; overflow: hidden; background: var(--idle); }
.hour > span { font-size: 11px; color: var(--muted); height: 14px; }
.chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 3px; font-size: 12px; border: 1px solid; }
.chip.c-prod { color: var(--prod); background: color-mix(in srgb, var(--prod) 10%, var(--surface)); border-color: color-mix(in srgb, var(--prod) 35%, var(--surface)); }
.chip.c-unprod { color: var(--unprod); background: color-mix(in srgb, var(--unprod) 10%, var(--surface)); border-color: color-mix(in srgb, var(--unprod) 35%, var(--surface)); }
.chip.c-neut { color: var(--muted); background: var(--bg); border-color: var(--border); }
.log { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.log li { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
.log li:last-child { border: 0; }
.log .time { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

/* Screenshots */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.shots.big { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.shots figure { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); cursor: zoom-in; }
.shots figure:hover { border-color: var(--muted); }
.shots img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--bg); }
.shots figcaption { padding: 8px 12px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.shots figcaption form { margin: 0; }
.lightbox { position: fixed; inset: 0; background: rgba(8,10,20,.86); display: grid; place-items: center; z-index: 50; padding: 28px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox button { position: absolute; top: 14px; right: 20px; background: none; border: 0; color: #fff; font-size: 38px; cursor: pointer; line-height: 1; }

/* Forms & buttons */
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 12.5px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; padding: 8px 14px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.15); }
.btn.danger { color: var(--unprod); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.icon { padding: 8px; } .btn.disabled { opacity: .4; pointer-events: none; }
.btn.block { width: 100%; padding: 11px; }
.sm-btn { padding: 6px 12px; font-size: 13px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }
.icon-btn:hover { color: var(--unprod); background: var(--bg); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.inline-form input { flex: 1; min-width: 160px; }
.datenav { display: flex; gap: 8px; align-items: center; }
.datenav input { padding: 8px 12px; }
.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 18px; border: 1px solid var(--border); }
.alert.okay { background: color-mix(in srgb, var(--prod) 14%, var(--surface)); color: var(--prod); }
.alert.err { background: color-mix(in srgb, var(--unprod) 14%, var(--surface)); color: var(--unprod); }

/* Team */
.token-card { border-color: var(--brand); }
.token-card pre { background: var(--bg); padding: 14px; border-radius: 4px; overflow-x: auto; margin: 0 0 12px; }

/* Settings */
.settings { display: flex; flex-direction: column; gap: 4px; }
.switch-row { flex-direction: row; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-row small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; margin-top: 2px; }
.switch-row input { appearance: none; width: 40px; height: 24px; border-radius: 99px; background: var(--idle); border: 0; position: relative; cursor: pointer; flex: none; padding: 0; transition: background .15s; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch-row input:checked { background: var(--brand); }
.switch-row input:checked::after { transform: translateX(16px); }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 18px 0; }
.rules { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rule { display: inline-flex; align-items: center; gap: 2px; margin: 0; }

/* Auth */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.auth-card .brand { padding: 0 0 20px; }
.auth-card h1 { font-size: 18px; } .auth-card p { margin: 4px 0 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }

/* Refinements */
.table td { white-space: nowrap; }
.table td .person { white-space: normal; }
.settings > .btn { align-self: flex-start; }

/* Responsive */
.main { min-width: 0; }
.shots { grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
.shots.big { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0; margin-right: auto; }
  .sidebar .logout { order: 2; margin: 0; padding: 6px 8px; font-size: 0; gap: 0; border-left: 0; }
  .sidebar .logout .ic { width: 18px; height: 18px; }
  .sidebar nav { order: 3; flex: 0 0 100%; flex-direction: row; gap: 0; margin: 8px -4px 0; overflow-x: auto; }
  .sidebar nav a { border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 12px; white-space: nowrap; }
  .sidebar nav a.active { background: none; border-bottom-color: var(--brand); }
  .main { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  .w-score { width: auto; }
}
@media (max-width: 700px) {
  h1 { font-size: 18px; }
  .page-head { align-items: flex-start; }
  .head-tools, .datenav { width: 100%; }
  .datenav input { flex: 1; min-width: 0; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .card { padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .kpis .card:nth-child(odd) { border-right: 1px solid var(--border); }
  .kpis .card:nth-last-child(-n+2) { border-bottom: 0; }
  .kpi-value { font-size: 22px; }
  .card { padding: 16px; }
  .table td, .table th { padding-left: 8px; padding-right: 8px; }
  .table .col-opt { display: none; }
  .sidebar nav a .ic { display: none; }
  .sidebar nav { margin: 8px 0 0; justify-content: space-between; }
  .sidebar nav a { padding: 10px 6px; font-size: 13px; }
  .inline-form > * { flex: 1 1 100%; }
  .switch-row { gap: 12px; }
  .log li { grid-template-columns: 58px 1fr auto; }
  .ellipsis { max-width: 100%; }
}

/* Two equal, equal-height cards */
.grid-eq { grid-template-columns: 1fr 1fr; align-items: stretch; margin-bottom: 20px; }
.grid-eq .inline-form { flex-wrap: nowrap; margin: 0; }
.grid-eq .inline-form select { flex: 0 1 150px; min-width: 0; }
.grid-eq .inline-form .btn { flex: none; }
@media (max-width: 1000px) { .grid-eq { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-eq .inline-form { flex-wrap: wrap; } }

/* Productivity rules */
.rule-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
.rule-col { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; min-width: 0; }
.rule-col-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.rule-col-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.rule-col-title i { width: 9px; height: 9px; border-radius: 1px; display: inline-block; }
.rule-col .rules { margin-top: 14px; gap: 6px; }
.chip .chip-x { background: none; border: 0; color: inherit; opacity: .55; cursor: pointer; font: inherit; line-height: 1; padding: 0 0 0 7px; margin-right: -3px; }
.chip .chip-x:hover { opacity: 1; }
@media (max-width: 700px) { .rule-cols { grid-template-columns: 1fr; } }

/* Employee roster */
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.card-head h2 { margin-bottom: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.roster form { margin: 0; display: inline; }
.roster tbody + tbody tr.grp td { border-top: 1px solid var(--border); }
.roster tr.grp td { background: var(--bg); border-bottom: 1px solid var(--border); padding-top: 10px; padding-bottom: 10px; }
.roster tr.dev td { padding-top: 9px; padding-bottom: 9px; }
.roster tr.dev td:first-child { padding-left: 54px; }
.roster tbody:last-child tr:last-child td { border-bottom: 0; }
.emp-name { font-weight: 600; color: var(--text); }
.emp-name:hover { color: var(--brand); }
.dev-name { font-weight: 500; }
.status { display: inline-flex; align-items: center; color: var(--muted); }
.status.on { color: var(--prod); }
@media (max-width: 700px) { .roster tr.dev td:first-child { padding-left: 8px; } }
@media (max-width: 700px) { .roster .btn { padding: 6px 10px; } .roster td:last-child { padding-left: 0; } }
@media (max-width: 700px) { .roster td { white-space: normal; } .roster .status { align-items: flex-start; } .roster .status .dot { margin-top: 6px; flex: none; } }
@media (max-width: 700px) { .roster .dev-name { white-space: nowrap; } }

/* Overview dashboard */
.kpis-5 { grid-template-columns: repeat(5, 1fr); }
.kpis-5 .card { padding: 16px 18px; }
.delta { font-weight: 500; }
.delta.good { color: var(--prod); } .delta.bad { color: var(--unprod); } .delta.flat { color: var(--muted); }
.grid-2 { margin-bottom: 20px; }
.grid-main { grid-template-columns: 1.7fr 1fr; }
.grid-main > .card { margin: 0; }
.side-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.side-stack .card { margin: 0; }
.card-head .sm { font-size: 12px; }
.stack-lg { height: 12px; border-radius: 3px; margin: 6px 0 16px; }
.breakdown { list-style: none; margin: 0; padding: 0; }
.breakdown li { display: grid; grid-template-columns: 1fr auto 44px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.breakdown li:last-child { border-bottom: 0; }
.bd-name { display: inline-flex; align-items: center; gap: 9px; }
.bd-name i { width: 9px; height: 9px; border-radius: 1px; display: inline-block; }
.bd-time { font-weight: 600; }
.bd-pct { text-align: right; }
.bd-idle { margin-top: 4px; border-top: 1px solid var(--border); }
.bd-note { margin: 10px 0 0; }
.avatar.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--prod) 55%, var(--surface)); }
.table .status.on { font-weight: 500; }
.count-pill { background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; }
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { border-bottom: 1px solid var(--border); }
.attn li:last-child { border-bottom: 0; }
.attn a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 6px; margin: 0 -6px; color: var(--text); border-radius: 4px; text-decoration: none; }
.attn a:hover { background: var(--bg); text-decoration: none; }
.attn small { display: block; color: var(--muted); font-size: 12.5px; }
.attn-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--neut); }
.attn-dot.bad { background: var(--unprod); } .attn-dot.warn { background: #c98a1b; }
.empty.ok { color: var(--prod); }
.shots figure:hover img { opacity: .92; }
@media (max-width: 1200px) { .kpis-5 { grid-template-columns: repeat(3, 1fr); } .kpis-5 .card { border-bottom: 1px solid var(--border); } }
@media (max-width: 1000px) { .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .kpis-5 { grid-template-columns: 1fr 1fr; }
  .kpis-5 .card:nth-child(odd) { border-right: 1px solid var(--border); }
  .kpis-5 .card:nth-child(3n) { border-right: 1px solid var(--border); }
  .kpis-5 .card:nth-child(even) { border-right: 0; }
  .kpis-5 .card:nth-last-child(-n+1) { border-bottom: 0; grid-column: 1 / -1; border-right: 0; }
  .hours { gap: 3px; }
}
.grid-top { align-items: stretch; }
.grid-top .hours { height: 190px; }
.table .person > div { white-space: nowrap; min-width: 0; }
.shots.strip { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); }
@media (max-width: 700px) { .table .person > div { white-space: normal; } }
.grid-main { align-items: stretch; }
@media (max-width: 700px) {
  .shots.strip { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis-5 .card:nth-child(n) { border-right: 0; border-bottom: 1px solid var(--border); }
  .kpis-5 .card:nth-child(odd):not(:last-child) { border-right: 1px solid var(--border); }
  .kpis-5 .card:last-child { border-bottom: 0; grid-column: 1 / -1; }
}
