:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #1f2421;
  --muted: #6b716d;
  --line: #e4e1d9;
  --accent: #2f7d57;
  --accent-soft: #e2f1e8;
  --bad: #c8463d;
  --bad-soft: #fbe7e5;
  --good: #2f8a55;
  --neutral: #9aa0a6;
  --chip: #efece5;
  --radius: 14px;
  --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: #141716;
    --card: #1d2120;
    --text: #e8ebe9;
    --muted: #9aa29d;
    --line: #2c322f;
    --accent: #5cbf8a;
    --accent-soft: #1f3a2c;
    --bad: #ef7b72;
    --bad-soft: #3a2220;
    --good: #5cbf8a;
    --neutral: #7c8480;
    --chip: #262b29;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 19px; margin: 0; font-weight: 650; }
.net { margin-left: auto; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); }
main { max-width: 640px; margin: 0 auto; padding: 14px 16px; }
.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: 16px; margin: 0 0 10px; }
label.lbl { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 6px; }
textarea, input[type=text], input[type=datetime-local], select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 76px; resize: vertical; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 600;
  background: var(--accent); color: #fff; min-height: 46px;
}
.btn.wide { width: 100%; margin-top: 16px; }
.btn.ghost { background: var(--chip); color: var(--text); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--chip); border-radius: 99px;
  padding: 7px 12px; font-size: 14px; min-height: 36px;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }
.chip.add { border-style: dashed; background: transparent; }
.score { margin-top: 12px; }
.score .name { font-size: 14px; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.score .row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.score .row button {
  border: 1px solid var(--line); background: var(--bg); border-radius: 10px; min-height: 44px; font-weight: 600;
}
.score .row button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.day { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item .t { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 44px; padding-top: 1px; }
.item .d { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item .acts { display: flex; gap: 4px; }
.icon-btn { border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; font-size: 16px; min-width: 36px; min-height: 36px; }
.icon-btn:hover { background: var(--chip); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.block h3 { font-size: 15px; margin: 4px 0 8px; }
.eff { padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.eff:first-of-type { border-top: 0; }
.eff b { font-weight: 650; }
.eff small { color: var(--muted); display: block; }
.tag { font-size: 12px; border-radius: 99px; padding: 1px 8px; margin-left: 6px; background: var(--chip); color: var(--muted); }
.tag.strong { background: var(--accent-soft); color: var(--accent); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--text); font-size: 12px; }
.chart .axis { stroke: var(--muted); }
.chart .bad { fill: var(--bad); }
.chart .good { fill: var(--good); }
.chart .neu { fill: var(--neutral); }
.disc { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 20px 0; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  border: 0; background: transparent; padding: 8px 2px 9px; font-size: 11px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px;
}
.tabs button span { font-size: 20px; line-height: 1.1; filter: grayscale(1); opacity: .7; }
.tabs button.on { color: var(--accent); font-weight: 600; }
.tabs button.on span { filter: none; opacity: 1; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 10;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
dialog {
  border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100% - 24px));
  background: var(--card); color: var(--text);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 16px; max-height: 85vh; overflow: auto; }
.dlg-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.login { text-align: center; padding-top: 6vh; }
.login .logo { font-size: 56px; }
.login h2 { font-size: 22px; margin: 10px 0 6px; }
.login p { color: var(--muted); margin: 0 auto 18px; max-width: 380px; }
.code { font-size: 34px; letter-spacing: .25em; font-weight: 700; font-variant-numeric: tabular-nums; margin: 10px 0; }
a { color: var(--accent); }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; }
@media (min-width: 700px) {
  .tabs { left: 50%; transform: translateX(-50%); width: 640px; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; }
}
