:root {
  --bg: #f7f3ec; --card: #ffffff; --ink: #1d1a16; --muted: #6f675d; --line: #e6dfd3;
  --accent: #c8402b; --accent-soft: #fbe7e2; --ok: #2f7a4f; --ok-soft: #e3f2e8; --warn: #9a6500; --warn-soft: #fff1d6;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --tabh: 58px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16130f; --card: #221e19; --ink: #f2ede6; --muted: #a59c90; --line: #353029;
    --accent: #ff6a50; --accent-soft: #3a1f19; --ok: #6cc28f; --ok-soft: #1c3226; --warn: #f0b24a; --warn-soft: #3a2e17;
    --shadow: none; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 12px); }
a { color: var(--accent); }
button { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); display: inline-block; }
.pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; color: var(--muted); }
.pill.ok::before, .pill.off::before, .pill.wait::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.pill.ok::before { background: var(--ok); } .pill.off::before { background: var(--muted); } .pill.wait::before { background: var(--warn); }
.banner { margin: 10px 16px 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.banner a { color: inherit; font-weight: 600; }

main { padding: 0 16px; }
.view { padding-top: 14px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 22px 2px 8px; font-weight: 600; }
.h-day { margin: 4px 2px 12px; }
.h-day .d { font-size: 22px; font-weight: 700; }
.h-day .t { color: var(--muted); }

.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); padding: 14px 16px; margin-bottom: 10px; }
.card.hero { border: 2px solid var(--accent); }
.label { font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); display: flex; justify-content: space-between; gap: 8px; }
.label .cd { color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 13px; }
.when { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.title { font-size: 19px; font-weight: 700; margin: 2px 0 4px; line-height: 1.25; }
.hero .title { font-size: 23px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 2px 7px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); vertical-align: 3px; margin-left: 6px; }
.notes { white-space: pre-wrap; margin: 6px 0 0; }
.loc { color: var(--muted); font-size: 14px; margin-top: 6px; }
.by { color: var(--muted); font-size: 12px; margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 9px 13px; font-size: 15px; font-weight: 600;
  text-decoration: none; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }

.tl { list-style: none; margin: 0; padding: 0; }
.tl li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; box-shadow: var(--shadow); }
.tl .rowhead { display: grid; grid-template-columns: 74px 1fr; gap: 8px; padding: 12px 14px; cursor: pointer; width: 100%; text-align: left; background: none; border: 0; }
.tl .tm { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); font-size: 15px; padding-top: 1px; }
.tl .tt { font-weight: 600; }
.tl .sub { color: var(--muted); font-size: 13.5px; margin-top: 1px; }
.tl .detail { padding: 0 14px 14px 96px; }
.tl li.past { opacity: .55; }
.tl li.current { border: 2px solid var(--accent); opacity: 1; }
.tl li.current .tm { color: var(--accent); }
.tl .tag { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .6px; margin-left: 6px; }
@media (max-width: 380px) { .tl .detail { padding-left: 14px; } }

.chips { position: sticky; top: calc(env(safe-area-inset-top) + 49px); z-index: 4; display: flex; gap: 6px; overflow-x: auto; padding: 4px 16px 10px; margin: 0 -16px;
  background: var(--bg); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 6px 10px; text-align: center; min-width: 54px; cursor: pointer; }
.chip .w { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; display: block; }
.chip .n { font-size: 17px; font-weight: 700; display: block; }
.chip.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.sel .w { color: #ffe1db; }
.chip.today:not(.sel) { border-color: var(--accent); }
.add { width: 100%; margin-top: 4px; justify-content: center; border-style: dashed; background: transparent; color: var(--muted); }

.mini { list-style: none; padding: 0; margin: 0; }
.mini li { display: flex; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.mini li:last-child { border-bottom: 0; }
.mini .tm { width: 66px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.big { font-size: 34px; font-weight: 800; line-height: 1.1; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; height: var(--tabh); border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
.tabs .ico { font-size: 19px; line-height: 1; }
.tabs button.active { color: var(--accent); }

dialog { border: 0; padding: 0; width: 100%; max-width: 640px; max-height: 92vh; margin: auto auto 0; border-radius: 18px 18px 0 0; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { padding: 0 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet-head { position: sticky; top: 0; background: var(--card); display: flex; justify-content: space-between; align-items: center; padding: 14px 0 10px; border-bottom: 1px solid var(--line); z-index: 1; }
.link { background: none; border: 0; color: var(--accent); font-size: 16px; padding: 4px; cursor: pointer; }
.link.strong { font-weight: 700; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label small { font-weight: 400; }
input, select, textarea { font: 16px/1.4 inherit; font-family: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: 100%; }
textarea { resize: vertical; }
.check { flex-direction: row; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); }
.check input { width: auto; }
.row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.danger { background: none; border: 1px solid var(--line); color: var(--accent); border-radius: 10px; padding: 11px; font-weight: 600; margin-top: 6px; }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
