:root {
  --ink: #14161A;
  --ground: #F5F6F8;
  --surface: #FFFFFF;
  --accent: #1F5FD1;
  --ok: #1E7B4F;
  --warn: #B5530B;
  --muted: #5A6170;
  --line: #E2E5EA;
  --accent-soft: #E8EFFC;
  --ok-soft: #E5F3EC;
  --warn-soft: #FBEEE3;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }

.top {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; white-space: nowrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500;
}
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
.badge { background: var(--warn); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; line-height: 18px; }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; background: var(--warn-soft); color: var(--warn); border: 1px solid #F0D3BB; }
.notice.info { background: var(--accent-soft); color: var(--accent); border-color: #C9D8F5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.warn { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--ground); color: var(--muted); margin: 2px 4px 2px 0; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.weekend td { color: var(--muted); }
.table-wrap { overflow-x: auto; }
.shift-link { background: none; border: 0; padding: 4px 0; min-height: 32px; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.shift-link.void { color: var(--muted); text-decoration: line-through; }

label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox] { width: 22px; min-height: 22px; height: 22px; vertical-align: middle; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); font-size: 15px; }

.login { max-width: 360px; margin: 10vh auto; }
.login h1 { margin-bottom: 16px; }
.error { color: var(--warn); margin-top: 8px; min-height: 20px; }

.list-item { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--line); margin-right: 6px; }
.status-dot.on { background: var(--ok); }
.status-dot.away { background: var(--warn); }
.status-dot.done { background: var(--accent); }

.history { font-size: 13px; border-left: 2px solid var(--line); padding-left: 10px; margin-top: 8px; }
.history div { margin-bottom: 6px; }

#map { height: 420px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 12px; }
.caps { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }

.modal { position: fixed; inset: 0; background: rgba(20, 22, 26, .45); z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal-card { background: var(--surface); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 520px; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 6px 16px; gap: 4px 12px; }
  .tabs { order: 3; flex-basis: 100%; }
  main { padding: 14px 16px 60px; }
  h1 { font-size: 20px; }
  #map { height: 340px; }
  .hide-sm { display: none; }
}
