:root {
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --ink: #15171C;
  --muted: #5B616E;
  --line: #E2E4E9;
  --line-strong: #D5D8DE;
  --blue: #1F4FD1;
  --blue-soft: #EEF2FD;
  --amber: #8A4B00;
  --amber-soft: #FFF1DD;
  --amber-bar: #E08A2E;
  --gray-bar: #C9CDD4;
  --green: #3DDC84;
  --danger: #B42318;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--blue); }
a:hover { color: #163A9C; }
h1, h2, .display { font-family: "Space Grotesk", Inter, system-ui, sans-serif; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; margin: 0; }
h2 { font-size: 18px; margin: 0; font-family: Inter, system-ui, sans-serif; font-weight: 700; letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.blue { color: var(--blue); }
.amber { color: var(--amber); }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.phone { max-width: 520px; margin: 0 auto; padding: 20px 16px 104px; display: flex; flex-direction: column; gap: 14px; }
.wide { max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .main { flex: 999 1 560px; min-width: 0; }
.split > .side { flex: 1 1 300px; min-width: 0; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.card.border { border: 1px solid var(--line); }
.card.active { border: 2px solid var(--blue); }
.card.dashed { background: transparent; border: 1px dashed #A9AEB8; }
.shift { background: var(--ink); color: #fff; border-radius: 18px; padding: 16px; }
.shift .muted { color: #B8BDC7; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--green); display: inline-block; }
.dot.off { background: #8A8F99; }
.timer { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.timer.big { font-size: 44px; line-height: 1.1; }
.timer.mid { font-size: 32px; line-height: 1.1; }
.stat { background: var(--card); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat b { font-size: 17px; }
.tile { background: var(--card); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.tile b { font-family: "Space Grotesk", sans-serif; font-size: 30px; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink); font: 600 14px Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer;
}
.btn:hover { color: var(--ink); background: #F8F9FA; }
.btn.lg { min-height: 52px; font-size: 16px; font-weight: 700; border-radius: 12px; }
.btn.xl { min-height: 56px; font-size: 16px; font-weight: 700; border-radius: 14px; width: 100%; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #163A9C; color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #2A2D34; color: #fff; }
.btn.pause { background: var(--amber-soft); border-color: var(--amber-soft); color: var(--amber); }
.btn.ghost-light { background: transparent; border-color: #3A3E47; color: #fff; }
.btn.ghost-light:hover { background: #24272E; color: #fff; }
.btn.danger { color: var(--danger); border-color: #F1C9C5; }
.btn.danger:hover { background: #FDECEA; color: var(--danger); }
.btn.round { width: 44px; padding: 0; border-radius: 22px; }
.btn.block { width: 100%; }
form.inline { display: inline; margin: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #8FA9EE; outline-offset: 2px; }

/* Forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff;
  padding: 10px 12px; font: 16px Inter, system-ui, sans-serif; color: var(--ink);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.4; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--bg); border-radius: 12px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { min-height: 44px; border-radius: 9px; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.segmented input:checked + label { background: #fff; color: var(--blue); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.segmented input:focus-visible + label { outline: 3px solid #8FA9EE; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line-strong); background: #fff; font: 600 14px Inter, sans-serif; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.new-badge { display: none; font-size: 13px; font-weight: 600; color: var(--blue); }
.new-badge.show { display: block; }
.notice { background: var(--amber-soft); color: #6B3A00; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.flash { background: #FDECEA; color: var(--danger); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.summary { background: var(--bg); border-radius: 12px; padding: 12px 14px; }

/* Admin time corrections */
.edit-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; padding-top: 10px; border-top: 1px solid var(--line); }
.edit-times { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; flex: 1 1 520px; }
.edit-times label.field { flex: 1 1 190px; }
.edit-times .dur { min-width: 70px; align-self: center; }
.edit-delete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; }

/* Bars */
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--bg); }
.bar span { display: block; }
.b-blue { background: var(--blue); }
.b-amber { background: var(--amber-bar); }
.b-gray { background: var(--gray-bar); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* Log */
.entry { background: var(--card); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.entry.running { border: 2px solid var(--blue); }
.entry .when { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); gap: 8px; }
.entry .what { font-size: 15px; font-weight: 700; }

/* Tables */
.table-box { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); }
td { padding: 12px 8px; border-bottom: 1px solid #F0F1F4; vertical-align: top; }
td.r, th.r { text-align: right; }
tr.group td { background: #FAFAFB; font-weight: 700; }
tr.total td { font-weight: 700; border-bottom: 0; }
td.indent { padding-left: 24px; }

/* Navigation */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(68px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: center; z-index: 10;
}
.tabbar a { flex: 0 1 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
.tabbar a.on { color: var(--blue); font-weight: 600; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1280px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topbar nav a { padding: 10px 12px; border-radius: 10px; color: #3D424C; font-weight: 500; font-size: 14px; text-decoration: none; }
.topbar nav a.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 17px; color: var(--ink); text-decoration: none; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; border: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Sign in */
.login { min-height: 100vh; min-height: 100dvh; max-width: 440px; margin: 0 auto; padding: 48px 24px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.login h1 { font-size: 40px; line-height: 1.05; letter-spacing: -0.02em; }
