:root {
  --bg: #f3f4f6; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-weak: #ccfbf1; --accent-weaker: #f0fdfa;
  --good: #15803d; --good-weak: #dcfce7; --warn: #b45309; --warn-weak: #fef3c7;
  --bad: #b91c1c; --bad-weak: #fee2e2; --track: #e5e7eb;
  --radius: 18px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14; --card: #141a22; --text: #e5e7eb; --muted: #94a3b8; --line: #243041;
    --accent: #2dd4bf; --accent-ink: #042f2e; --accent-weak: #134e4a; --accent-weaker: #0f2a2a;
    --good: #4ade80; --good-weak: #14532d; --warn: #fbbf24; --warn-weak: #422006;
    --bad: #f87171; --bad-weak: #450a0a; --track: #243041; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

main { max-width: 560px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px calc(96px + var(--safe-b)); }
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }

/* ---------- header / day nav ---------- */
.dayhead { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.dayhead .title { flex: 1; min-width: 0; }
.dayhead h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.dayhead .sub { color: var(--muted); font-size: 15px; }
.navbtn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: 22px; line-height: 1; display: grid; place-items: center;
}
.pill {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-weight: 600; font-size: 14px;
}
.pill.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 .right { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.hero .label { color: var(--muted); font-weight: 600; font-size: 15px; }
.hero .big { font-size: 48px; font-weight: 750; letter-spacing: -.02em; line-height: 1.05; margin: 2px 0 6px; }
.hero .status { font-weight: 600; font-size: 15px; }
.status.good { color: var(--good); } .status.over { color: var(--accent); } .status.left { color: var(--text); }
.bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; margin: 10px 0 12px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.bar.done > i { background: var(--good); }
.est { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border-radius: 12px; background: var(--accent-weaker); margin-bottom: 12px; }
.est b { font-size: 20px; }

.times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tcell {
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; background: transparent; text-align: center;
  min-height: 64px; display: flex; flex-direction: column; justify-content: center;
}
.tcell .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.tcell .v { font-size: 19px; font-weight: 650; margin-top: 2px; }
.tcell .v.empty { color: var(--muted); font-weight: 500; }
.tcell.live { border-color: var(--accent); background: var(--accent-weaker); }

/* ---------- buttons ---------- */
.actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-bottom: 14px; }
.actions.one { grid-template-columns: 1fr; }
.btn {
  height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  font-weight: 650; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 40px; border-radius: 12px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn:active, .navbtn:active, .pill:active, .tcell:active { transform: scale(.98); }
.linkbtn { background: none; border: 0; padding: 6px 0; color: var(--accent); font-weight: 600; }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; margin-bottom: 10px; background: var(--warn-weak); color: var(--text); border: 1px solid transparent; }
.banner .t { flex: 1; font-size: 15px; }
.banner.bad { background: var(--bad-weak); }
.note-line { font-size: 14px; color: var(--muted); margin: -4px 0 14px; text-align: center; }

/* ---------- week strip / list ---------- */
.weekstrip { display: block; width: 100%; text-align: left; background: var(--card); }
.weekstrip .row1 { display: flex; justify-content: space-between; align-items: baseline; }
.weekstrip b { font-size: 20px; }

.daylist { padding: 4px 0; }
.dayrow {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px;
  width: 100%; padding: 12px 16px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left;
}
.dayrow:first-child { border-top: 0; }
.dayrow .dn { font-weight: 700; } .dayrow .dd { font-size: 13px; color: var(--muted); }
.dayrow .span { font-size: 15px; } .dayrow .tot { font-weight: 700; font-size: 17px; text-align: right; }
.dayrow.today .dn { color: var(--accent); }
.dayrow.weekend { opacity: .75; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--track); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tag.bad { background: var(--bad-weak); color: var(--bad); }
.tag.pto { background: var(--accent-weak); color: var(--accent); }
.tag.live { background: var(--good-weak); color: var(--good); }

/* ---------- projects ---------- */
.prow { display: grid; grid-template-columns: 1fr 92px 40px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.prow:first-of-type { border-top: 0; }
.prow select, .field input, .field select, .field textarea, .prow input {
  width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; min-width: 0;
}
.prow select { padding-right: 4px; text-overflow: ellipsis; }
.prow input { text-align: center; font-weight: 600; }
.restbtn { height: 44px; border-radius: 12px; border: 1px dashed var(--accent); background: var(--accent-weaker); color: var(--accent); font-weight: 650; font-size: 14px; padding: 0 6px; }
.restbtn.fixed { border-style: solid; border-color: var(--line); background: var(--bg); color: var(--muted); }
.xbtn { width: 40px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 22px; }
.prow .restinfo { font-size: 12px; color: var(--muted); grid-column: 1 / -1; margin-top: -4px; }
.auto { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-weaker); }
.auto .n { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auto .m { font-weight: 700; white-space: nowrap; }
.warn { color: var(--warn); font-size: 14px; margin-top: 8px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 8px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { height: 40px; border: 0; border-radius: 9px; background: none; font-weight: 600; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--accent); }
.offrow { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

textarea { resize: vertical; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field textarea { height: auto; min-height: 72px; padding: 10px 12px; }
.field input[readonly] { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- settings ---------- */
.srow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.srow:first-of-type { border-top: 0; }
.srow .lbl { flex: 1; min-width: 0; }
.srow .lbl small { display: block; color: var(--muted); font-size: 13px; }
.srow input.inl, .srow select.inl { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 10px; max-width: 55%; }
.srow input.inl { width: 92px; text-align: center; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--track); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(20px); }
.plist .pitem { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }
.plist .pitem:first-child { border-top: 0; }
.plist .pitem .nm { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 6px 0; font-weight: 550; }
.plist .pitem.arch .nm { color: var(--muted); text-decoration: line-through; }
.icon { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; }
.addrow { display: flex; gap: 8px; margin-top: 10px; }
.addrow input { flex: 1; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; min-width: 0; }
.urlbox { display: flex; gap: 8px; margin-top: 10px; }
.urlbox input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 10px; font-size: 13px; }
.user { padding: 10px 0; border-top: 1px solid var(--line); }
.user:first-child { border-top: 0; }
.user .top { display: flex; justify-content: space-between; gap: 8px; }
.user .btns { display: flex; gap: 8px; margin-top: 8px; }

/* ---------- report ---------- */
.tablewrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
table.ts { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.ts th, .ts td { padding: 9px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.ts th { font-size: 12px; color: var(--muted); font-weight: 700; }
.ts th:first-child, .ts td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); max-width: 150px; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.ts td.z { color: var(--muted); opacity: .5; }
.ts tr.total td { font-weight: 750; border-bottom: 0; }
.ts tr.special td:first-child { color: var(--muted); font-style: italic; }
.ts td.tot, .ts th.tot { font-weight: 700; }
.ts.inout td { color: var(--muted); font-size: 13px; }
.btnrow { display: flex; gap: 10px; margin-top: 12px; }
.btnrow .btn { flex: 1; }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--card); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); animation: up .2s ease; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 14px; font-size: 19px; }
.sheet .big-input { width: 100%; height: 60px; font-size: 28px; font-weight: 650; text-align: center; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); }
.sheet .btnrow { margin-top: 14px; }
.sheet .err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 8px; }

/* ---------- auth ---------- */
.auth { max-width: 400px; margin: 10vh auto 0; }
.auth .logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 auto 14px; }
.auth h1 { text-align: center; font-size: 26px; margin: 0 0 6px; }
.auth p.lead { text-align: center; color: var(--muted); margin: 0 0 20px; }
.auth .err { color: var(--bad); min-height: 22px; font-size: 15px; margin: 4px 0 8px; }

/* ---------- tabs + toast ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b));
}
.tabs button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent); }
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(80px + var(--safe-b)); z-index: 40; max-width: 536px; margin: 0 auto;
  background: #0f172a; color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: 15px;
}
.toast .t { flex: 1; }
.toast button { background: none; border: 0; color: #5eead4; font-weight: 700; padding: 4px 6px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 0; }

.seg.two { grid-template-columns: repeat(2, 1fr); width: 128px; text-transform: none; letter-spacing: 0; }
.seg.two button { height: 30px; font-size: 13px; }
.offscreen { position: fixed; left: -9999px; top: 0; }
details summary { cursor: pointer; padding: 6px 0; }
a.btn { text-decoration: none; color: inherit; }
.btnrow .btn.wide { flex: 2; }
.icon:disabled { opacity: .3; }
