:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --text: #17201c;
  --muted: #5d6b64;
  --line: #e2e6e3;
  --accent: #0f6b5a;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ed;
  --break: #b26a00;
  --break-soft: #fbf0de;
  --stop: #a83232;
  --stop-soft: #f8e6e4;
  --good: #1d7a46;
  --bad: #a83232;
  --radius: 16px;
  --tap: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #18201d;
    --text: #e9efec;
    --muted: #9aa8a1;
    --line: #2a3430;
    --accent: #3fbf9f;
    --accent-ink: #062019;
    --accent-soft: #163029;
    --break: #f0a33a;
    --break-soft: #33270f;
    --stop: #f07a72;
    --stop-soft: #3a1c1a;
    --good: #5fd08f;
    --bad: #f07a72;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 1.9rem; margin: 0 0 1.5rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; color: var(--muted); font-weight: 600; }
small { display: block; color: var(--muted); font-size: .8rem; }

.shell { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
.content { padding: 12px 16px 48px; display: grid; gap: 20px; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}
.brand { font-weight: 700; }
.org { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-button {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem;
}
.menu {
  position: absolute; right: 16px; top: calc(56px + env(safe-area-inset-top));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(0 0 0 / .15); padding: 8px; min-width: 240px; display: grid; gap: 4px;
}
.menu-who { padding: 8px 10px; font-weight: 600; }
.menu-langs { display: flex; gap: 6px; padding: 4px 10px 8px; }
.menu-langs button { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 4px 12px; font-size: .85rem; }
.menu-langs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.menu-item { text-align: left; border: 0; background: none; padding: 12px 10px; border-radius: 10px; }
.menu-item:hover { background: var(--bg); }

.big { min-height: var(--tap); border-radius: var(--radius); padding: 0 20px; font-weight: 650; font-size: 1.05rem; border: 0; }
.primary { background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.secondary { background: var(--break-soft); color: var(--break); }
.stop { background: var(--stop-soft); color: var(--stop); }
.link { background: none; border: 0; color: var(--accent); padding: 10px 0; font-weight: 600; justify-self: start; }

.status {
  background: var(--surface); border-radius: 22px; padding: 20px; display: grid; gap: 10px;
  border: 1px solid var(--line);
}
.status-line { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.status.working .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.status.working .status-line { color: var(--accent); }
.status.on_break .dot { background: var(--break); box-shadow: 0 0 0 4px var(--break-soft); }
.status.on_break .status-line { color: var(--break); }
.timer { font-size: 3.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }
.current { font-size: 1.05rem; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions:empty { display: none; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row.current { border-color: var(--accent); background: var(--accent-soft); }
.row-main {
  width: 100%; min-height: 64px; display: flex; align-items: center; gap: 12px; text-align: left;
  background: none; border: 0; padding: 10px 16px;
}
.row-main:disabled { opacity: 1; }
.row-text { flex: 1; min-width: 0; display: grid; }
.row-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: .78rem; font-weight: 700; color: var(--accent); background: var(--surface); padding: 3px 10px; border-radius: 999px; }
.chev { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; min-height: 44px; padding: 0 16px; }

.search {
  width: 100%; min-height: 52px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); padding: 0 16px; margin-bottom: 8px;
}

.today { display: grid; gap: 10px; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.totals > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.totals strong { font-size: clamp(.85rem, 4.2vw, 1.05rem); font-variant-numeric: tabular-nums; white-space: nowrap; display: block; }
.plus { color: var(--good); }
.minus { color: var(--bad); }
.breakdown { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.breakdown li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.breakdown li:first-child { border-top: 0; }

.signin { padding-top: 12vh; display: grid; gap: 12px; }
.stack { display: grid; gap: 10px; }
.stack label { font-weight: 600; font-size: .92rem; }
.stack input {
  min-height: 54px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); padding: 0 16px;
}
.note { margin: 0; padding: 10px 14px; border-radius: 12px; font-size: .95rem; }
.note.good { background: var(--accent-soft); color: var(--accent); }
.note.bad { background: var(--stop-soft); color: var(--bad); }
.note.warn { background: var(--break-soft); color: var(--break); }
.muted { color: var(--muted); margin: 0; }
.center { text-align: center; }

.loading { display: grid; place-items: center; min-height: 60dvh; color: var(--muted); }

#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--stop-soft); color: var(--bad); padding: 14px 16px;
}
#blazor-error-ui .reload { color: inherit; font-weight: 700; margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 50; }
.dialog {
  position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  background: var(--surface); border-radius: 22px; padding: 20px; display: grid; gap: 14px;
  box-shadow: 0 20px 60px rgb(0 0 0 / .3);
}
.dialog h2 { margin: 0; color: var(--text); }
.mail-head { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .95rem; }
.mail-head dt { color: var(--muted); }
.mail-head dd { margin: 0; overflow-wrap: anywhere; }
.mail-body { background: var(--bg); border-radius: 14px; padding: 12px 14px; font-size: .95rem; }
.mail-body p { margin: 0 0 .5em; overflow-wrap: anywhere; }
.mail-body p:last-child { margin: 0; }
.mail-body a { color: var(--accent); font-weight: 600; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section-head h2 { margin: 0; }
.small { font-size: .85rem; }
.wide { width: 100%; }
.icon {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 1.5rem; line-height: 1;
}
.day-head { display: flex; align-items: center; gap: 12px; }
.day-title { flex: 1; text-align: center; display: grid; justify-items: center; }
.day-title .link { padding: 2px 0; justify-self: center; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd {
  position: relative; border: 1px solid var(--line); background: var(--surface); border-radius: 14px;
  min-height: 72px; display: grid; justify-items: center; align-content: center; gap: 1px; padding: 6px 0;
}
.wd.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.wd.on .wd-h, .wd.on .wd-name { color: var(--accent-ink); }
.wd.future { opacity: .4; }
.wd-name { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.wd-num { font-weight: 700; }
.wd-h { font-size: .75rem; color: var(--muted); min-height: 1em; font-variant-numeric: tabular-nums; }
.wd-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); }
.week-line { font-size: .92rem; }

.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.entry {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-height: 60px;
}
.entry.break { background: var(--break-soft); border-color: transparent; }
.entry-time { font-variant-numeric: tabular-nums; font-weight: 650; }
.entry-what { min-width: 0; }
.entry-what small { margin-top: 2px; }
.entry-len { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { margin-left: 6px; font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }

.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  max-height: 92dvh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 14px;
  box-shadow: 0 -10px 40px rgb(0 0 0 / .25);
}
.sheet h2 { margin: 0; color: var(--text); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 14px; padding: 4px; }
.segmented button { border: 0; background: none; border-radius: 10px; min-height: 44px; font-weight: 600; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgb(0 0 0 / .12); }
.times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.times label, .field { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.times input, .field input, .field select {
  min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px; font-weight: 400; font-size: 1rem;
}
.still { min-height: 52px; display: flex; align-items: center; color: var(--accent); font-weight: 600; }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.secondary-plain { background: var(--bg); color: var(--text); }
.sheet-foot { display: flex; justify-content: space-between; }
.danger { color: var(--bad); }
.history { margin: 0; padding: 0 0 0 18px; display: grid; gap: 8px; }
.history li.old span { text-decoration: line-through; color: var(--muted); }

/* ---------- admin desk ---------- */
.menu-item { display: block; color: inherit; text-decoration: none; }
.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line);
}
.side-brand { font-weight: 750; font-size: 1.1rem; padding: 0 10px; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a { padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 550; }
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; display: grid; gap: 4px; padding: 0 10px; }
.side-foot a { color: var(--muted); text-decoration: none; padding: 8px 0; }
.admin-main { padding: 28px 32px 64px; min-width: 0; display: grid; gap: 18px; align-content: start; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.6rem; flex: 1; }
.page-head .search { width: 260px; margin: 0; min-height: 44px; }
.btn { min-height: 44px; border-radius: 12px; border: 0; padding: 0 18px; font-weight: 650; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.plain { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--stop-soft); color: var(--stop); }

.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.table td small { margin-top: 2px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-block; font-size: .75rem; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); margin: 1px 4px 1px 0; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--break-soft); color: var(--break); }
.pill.off { background: var(--stop-soft); color: var(--stop); }
.bar { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; margin-top: 4px; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.over > span { background: var(--bad); }

.drawer-scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .3); z-index: 40; }
.drawer {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface);
  box-shadow: -10px 0 40px rgb(0 0 0 / .2); display: grid; grid-template-rows: auto 1fr;
}
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; flex: 1; color: var(--text); font-size: 1.2rem; }
.drawer-head .icon { width: 40px; height: 40px; font-size: 1rem; }
.drawer-body { overflow: auto; padding: 18px 20px 32px; display: grid; gap: 14px; align-content: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.f { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; }
.f input, .f select, .f textarea {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; font-weight: 400; font-size: .95rem;
}
.f input[readonly] { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.checklist { display: grid; gap: 2px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }
.box { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.box h3 { margin: 0; font-size: .95rem; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button { width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; }
.days button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .95rem; }
.inline input { width: 84px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 10px; }
.actions-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.list-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list-plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .93rem; }

@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .side-foot { margin: 0; display: flex; }
  .admin-main { padding: 18px 14px 48px; }
  .page-head .search { width: 100%; }
  .table .hide-sm { display: none; }
}

.week-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; }
.week-box-head { display: flex; justify-content: space-between; align-items: center; }
.week-box .week-line { margin: 0; }
.blocking { margin: 4px 0 0; padding-left: 18px; }
.entry:disabled { opacity: 1; cursor: default; }
.page-title { font-size: 1.5rem; margin: 0; }
.abs-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.tabs { min-width: 260px; }
.review-day { gap: 6px; }
.f textarea { padding: 10px 12px; min-height: 64px; resize: vertical; }
.report-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.report-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-filters .f, .content .f { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; }
.report-filters .f input, .report-filters .f select { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 10px; font-weight: 400; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 14px; }
.table.report tbody tr { cursor: default; }
.table.report tfoot td { font-weight: 700; background: var(--bg); border-top: 1px solid var(--line); }
.content .btn { min-height: 44px; border-radius: 12px; border: 0; padding: 0 16px; font-weight: 650; }
.content .btn.primary { background: var(--accent); color: var(--accent-ink); }
.content .btn.plain { background: var(--surface); border: 1px solid var(--line); }
.payroll { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.periods { display: grid; gap: 8px; }
.period { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 14px; display: grid; gap: 2px; }
.period.on { border-color: var(--accent); background: var(--accent-soft); }
.period-main { display: grid; gap: 14px; min-width: 0; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat strong { font-size: 1.6rem; display: block; }
.stat.warn strong { color: var(--break); }
.stat.ok strong { color: var(--accent); }
.code-input { min-height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); padding: 0 10px; width: 160px; }
details.box summary { cursor: pointer; }
@media (max-width: 820px) { .payroll { grid-template-columns: 1fr; } }
.stat-row.four { grid-template-columns: repeat(4, 1fr); }
a.link-card { text-decoration: none; color: inherit; }
a.link-card:hover { border-color: var(--accent); }
.overview { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.dot-inline { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.dot-inline.on_break { background: var(--break); }
.entries-admin { display: grid; gap: 14px; }
@media (max-width: 820px) { .overview, .stat-row.four { grid-template-columns: 1fr 1fr; } }
.provider { display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); }
