:root {
  --bg: #f6f2ed; --card: #ffffff; --ink: #1a1411; --muted: #7a6f68; --line: #e8e1da;
  --accent: #c8693a; --accent-soft: #f7e6dc; --ice: #5fc1d6; --ice-soft: #e2f4f8;
  --ok: #2f9e5b; --ok-soft: #e1f3e8; --warn: #c98a12; --warn-soft: #fbf0d8; --bad: #c8463a; --bad-soft: #f8e1de;
  --radius: 16px; --shadow: 0 1px 2px rgba(26,20,17,.06), 0 4px 16px rgba(26,20,17,.05);
  --tabs-h: 64px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14100e; --card: #1f1916; --ink: #f3ece6; --muted: #a59990; --line: #332a25;
    --accent: #e08452; --accent-soft: #3a261b; --ice: #6fd0e4; --ice-soft: #17323a;
    --ok: #4fc27d; --ok-soft: #173525; --warn: #e3a93a; --warn-soft: #3a2d12; --bad: #ec6b5e; --bad-soft: #3d1d19;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; min-height: 100vh; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 10; background: var(--ink); color: #fff; padding-top: env(safe-area-inset-top); }
@media (prefers-color-scheme: dark) { .top { background: #0d0a09; border-bottom: 1px solid var(--line); } }
.top__in { max-width: 720px; margin: 0 auto; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; }
.brand__mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, #e7a072, var(--accent)); position: relative; }
.brand__mark::after { content: ""; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--ice); border: 2px solid var(--ink); }
.icon-btn { background: transparent; border: 0; color: inherit; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:active { background: rgba(255,255,255,.12); }
.icon-btn.is-spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.view { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); outline: none; }
.view--login { padding-bottom: 32px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; }
.tabs a { flex: 1; max-width: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
.tabs svg { width: 24px; height: 24px; }
.tabs a.is-active { color: var(--accent); }

h1 { font-size: 24px; line-height: 1.2; margin: 4px 0 2px; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; font-weight: 700; }
.sub { color: var(--muted); margin: 0 0 14px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 16px; margin-bottom: 12px; }
.card--link { display: block; color: inherit; text-decoration: none; }
.card--link:active { transform: scale(.99); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card__title { font-weight: 700; font-size: 16px; }
.card__meta { color: var(--muted); font-size: 13px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--line); color: var(--ink); }
.chip--report { background: var(--ice-soft); color: var(--ink); }
.chip--plan { background: var(--accent-soft); color: var(--ink); }
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }
.chip--bad { background: var(--bad-soft); color: var(--bad); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 520px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.kpi__v { font-size: 22px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi--accent .kpi__v { color: var(--accent); }
.kpi--warn .kpi__v { color: var(--warn); }

.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(96px, 38%) 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.bar__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__track { height: 10px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 99px; background: var(--accent); min-width: 2px; }
.bar__n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list__t { font-weight: 600; }
.list__d { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: pre-line; }
.list__a { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box { flex: 0 0 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; margin-top: 1px; transition: .15s; }
.check input:checked + .check__box { background: var(--ok); border-color: var(--ok); }
.check input:checked + .check__box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + .check__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check.is-done .list__t { text-decoration: line-through; color: var(--muted); }

.progress { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; margin: 6px 0 2px; }
.progress__fill { height: 100%; background: var(--ok); border-radius: 99px; transition: width .2s; }

.seg { display: flex; gap: 6px; margin: 4px 0 12px; overflow-x: auto; }
.seg button { border: 1px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: 99px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.day { font-size: 13px; font-weight: 700; color: var(--muted); margin: 16px 4px 6px; }
.row { display: flex; align-items: center; gap: 12px; }
.row__main { flex: 1; min-width: 0; }
.row__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { color: var(--muted); font-size: 13px; }
.chev { color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .6; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 14px; font-size: 16px; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login { max-width: 380px; margin: 9vh auto 0; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }

.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card), var(--line), var(--card)); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; margin: 0 0 6px -4px; padding: 6px 4px; }
.quote { background: var(--bg); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; padding: 8px 10px; font-size: 13px; margin-top: 6px; white-space: pre-line; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.tabs a { font-size: 11px; }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 140px; margin: 6px 0 8px; }
.chart__col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.chart__bar { width: 100%; max-width: 14px; background: var(--accent); border-radius: 4px 4px 1px 1px; opacity: .85; }
.chart__bar.is-today { background: var(--ice); opacity: 1; }
.chart__lbl { font-size: 10px; color: var(--muted); height: 14px; line-height: 14px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.field select, .field textarea { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 12px 14px; font: inherit; font-size: 16px; }
.field select { height: 48px; padding: 0 12px; }
.field textarea { resize: vertical; min-height: 110px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.icon-btn:disabled { opacity: .3; }

.token { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.field input[type=time], .field input[type=date] { height: 48px; }
.grid2 > * { min-width: 0; }
.field input, .field select, .field textarea { min-width: 0; max-width: 100%; }
.seg--wrap { flex-wrap: wrap; overflow: visible; }
.seg--wrap button { min-width: 44px; }
.check { position: relative; }
.check input { left: 0; top: 0; width: 1px; height: 1px; margin: 0; }

.rules { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.rules li::before { content: "○ "; }
.rules li.is-ok { color: var(--ok); }
.rules li.is-ok::before { content: "✓ "; }
