:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --text: #1d1f1c;
  --muted: #646a63;
  --line: #dddcd5;
  --accent: #1f5c45;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe8;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --bad: #a3322a;
  --off: #eef0f6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141614; --surface: #1c1f1c; --surface-2: #242824; --text: #e8eae6; --muted: #9aa198;
    --line: #333833; --accent: #5fb38d; --accent-ink: #0d1a14; --accent-soft: #1f3329;
    --warn: #e6b45c; --warn-soft: #33290f; --bad: #ef8a80; --off: #202434;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface);
}
header.top h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
header.top .sub { color: var(--muted); font-size: 13px; }
main { max-width: 1340px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 20px; }
@media (min-width: 960px) { main { grid-template-columns: 340px minmax(0,1fr); align-items: start; } .wide { grid-column: 1 / -1; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; font-weight: 600; }
.step { padding: 14px 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; padding-top: 0; }
.step h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
.step h3 .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; margin-right: 6px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
input, select, button { font: inherit; color: inherit; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=month], input[type=time], select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-height: 38px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.row > div { min-width: 0; }
input { min-width: 0; }
.drop {
  display: block; border: 1.5px dashed var(--line); border-radius: 8px; padding: 16px; text-align: center;
  cursor: pointer; background: var(--surface-2); color: var(--muted); font-size: 14px;
}
.drop.has { border-style: solid; border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.drop input { display: none; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
details summary { cursor: pointer; font-size: 14px; font-weight: 600; }
button.primary {
  width: 100%; padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; cursor: pointer; margin-top: 6px;
}
button.primary:disabled { opacity: .5; cursor: default; }
button.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
button.ghost:hover { background: var(--surface-2); }
.msg { font-size: 13.5px; padding: 10px 12px; border-radius: 8px; margin-top: 10px; }
.msg.err { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.ok { background: var(--accent-soft); color: var(--accent); }
.empty { color: var(--muted); padding: 40px 10px; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 18px; white-space: nowrap; font-weight: 600; margin-top: 2px; }
.stat.total { background: var(--accent); color: var(--accent-ink); }
.stat.total .k { color: inherit; opacity: .85; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.actions .spacer { flex: 1; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--muted); position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tr.off td { background: var(--off); }
tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.edited td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
td input[type=time] { width: 124px; min-height: 30px; padding: 3px 6px; }
td select { width: auto; min-height: 30px; padding: 3px 6px; }
td.notes { white-space: normal; min-width: 200px; color: var(--muted); font-size: 12.5px; }
td.notes .f { color: var(--warn); }
td.notes details summary { font-weight: 400; font-size: 12.5px; color: var(--muted); }
td.notes ul { margin: 4px 0 0; padding-left: 16px; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--surface-2); margin-right: 4px; }
.tag.IN { background: var(--accent-soft); color: var(--accent); }
.tag.OUT { background: var(--warn-soft); color: var(--warn); }
tfoot td { font-weight: 600; background: var(--surface-2); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 360px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
