:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1b1f24; --muted: #66707c; --border: #e3e6ea;
  --accent: #1f5fbf; --accent-text: #ffffff; --danger: #b42318;
  --productive: #2f9e6b; --neutral: #9aa4b1; --unproductive: #d9534f; --idle: #e6e9ee;
  --ok-bg: #e8f5ee; --error-bg: #fdecea;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --surface: #1a1e24; --text: #e7eaee; --muted: #98a2ae; --border: #2a3038;
    --accent: #5b9bff; --accent-text: #0b0e12; --danger: #ff7b72;
    --productive: #3fb984; --neutral: #6b7582; --unproductive: #f06b66; --idle: #2a3038;
    --ok-bg: #12301f; --error-bg: #3a1614;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
main.narrow, .narrow { max-width: 420px; margin: 48px auto; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 16px; flex-wrap: wrap; }
.tabs a { color: var(--muted); }
.org-name { margin-left: auto; color: var(--muted); font-size: .9rem; }
.logout { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card.archived { opacity: .6; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 1rem; }
.heading h1, .heading h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + section { margin-top: 20px; }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 6px 10px; font-size: .9rem; }
.card .table { border: 0; margin: 0; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

form { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack h2 { margin-top: 12px; }
.inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.inline-form { display: inline; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); min-width: 0; }
input[type=checkbox] { width: 16px; height: 16px; }
fieldset.days { display: flex; gap: 8px; border: 0; padding: 0; margin: 0; }
fieldset.days label { flex-direction: row; align-items: center; gap: 4px; color: var(--text); }
button { font: inherit; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }
button.danger, .danger { color: var(--danger); }

.alert { padding: 10px 14px; border-radius: 8px; }
.alert.ok { background: var(--ok-bg); }
.alert.error { background: var(--error-bg); }
.badge { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--idle); color: var(--muted); vertical-align: middle; }
.chip { display: inline-block; padding: 2px 10px; margin: 0 6px 6px 0; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); font-size: .85rem; }
.code { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; user-select: all; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--border); }

.daynav { display: flex; align-items: center; gap: 8px; }
.daynav a { font-size: 1.2rem; padding: 2px 8px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpis div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpis span { display: block; color: var(--muted); font-size: .85rem; }
.kpis strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }

.productive { background: var(--productive); }
.neutral { background: var(--neutral); }
.unproductive { background: var(--unproductive); }
.idle { background: var(--idle); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.dot.idle { outline: 1px solid var(--border); }
.legend { color: var(--muted); font-size: .85rem; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.stack-bar { display: flex; height: 10px; width: 160px; border-radius: 99px; overflow: hidden; background: var(--idle); }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; gap: 12px; align-items: center; padding: 5px 0; }
.bars .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .bar { height: 10px; border-radius: 99px; }
.bars .value { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

.dayline { position: relative; height: 28px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.dayline span { position: absolute; top: 0; bottom: 0; }
.hours { display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; margin-top: 4px; }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.shots a { display: block; color: var(--muted); font-size: .8rem; }
.shots img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; margin-bottom: 4px; }

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 12px; }
  .org-name { margin-left: 0; }
  .table { display: block; overflow-x: auto; }
  .stack-bar { width: 100px; }
}
