:root {
  --green: #0E5A52; --green-dark: #0A453F; --gold: #E3A33B; --ink: #17201E; --body: #3E4845; --muted: #5B6461;
  --page: #FBFAF7; --band: #F2EEE6; --line: #E6E1D8; --tint: #EEF5F3; --white: #FFFFFF; --red: #A33A2B; --red-tint: #FBEEEB;
  --gold-tint: #FCF3E1; --gold-ink: #7A5410;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--body); font: 16px/1.5 Inter, system-ui, sans-serif; }
h1, h2, h3 { font-family: 'Bricolage Grotesque', Inter, sans-serif; color: var(--ink); margin: 0; line-height: 1.2; }
h1 { font-size: 28px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hide { display: none !important; }

/* shell */
.shell { min-height: 100vh; padding-bottom: 84px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font: 700 22px 'Bricolage Grotesque', sans-serif; color: var(--green); }
.brand span { font: 500 13px Inter, sans-serif; color: var(--muted); margin-left: 8px; }
.who { font-size: 14px; color: var(--muted); }
main { padding: 20px 16px 8px; max-width: 860px; margin: 0 auto; }
.side { display: none; }
.side.open { display: block; position: fixed; inset: 0; z-index: 20; background: var(--white); padding: 20px 16px 100px; overflow: auto; }
.side a, .side button { display: block; width: 100%; text-align: left; padding: 14px 12px; border: 0; background: none; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; }
.side a.on { background: var(--tint); color: var(--green); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--white); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a, .tabs button { flex: 1; min-height: 60px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; padding: 0 2px; }
.tabs .on { color: var(--green); box-shadow: inset 0 3px 0 var(--green); }

/* pieces */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head p { color: var(--muted); font-size: 15px; margin-top: 4px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
button.card { display: block; width: 100%; text-align: left; }
button.card:hover { border-color: var(--green); }
.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.title { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.note { margin-top: 8px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chip { flex: none; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--band); color: var(--body); white-space: nowrap; }
.chip.good { background: var(--tint); color: var(--green); }
.chip.wait { background: var(--gold-tint); color: var(--gold-ink); }
.chip.bad { background: var(--red-tint); color: var(--red); }
.btn { min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--green); background: var(--green); color: var(--white); font-weight: 600; }
.btn:hover { background: var(--green-dark); }
.btn.ghost { background: var(--white); color: var(--green); }
.btn.ghost:hover { background: var(--tint); }
.btn.danger { background: var(--white); color: var(--red); border-color: var(--red); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); font-size: 14px; color: var(--body); }
.filters button.on { background: var(--green); border-color: var(--green); color: var(--white); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tools input, .tools select { flex: 1 1 160px; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #CFC9BD; border-radius: 10px; background: var(--white); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.error { color: var(--red); font-size: 14px; margin-top: 10px; min-height: 20px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat b { display: block; font: 700 22px 'Bricolage Grotesque', sans-serif; color: var(--ink); }
.stat span { font-size: 13px; color: var(--muted); }
.month { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.month b { flex: 1; text-align: center; color: var(--ink); }
.day { font-weight: 600; color: var(--ink); margin: 18px 0 8px; display: flex; justify-content: space-between; }
.thumb { display: inline-block; margin-top: 10px; color: var(--green); font-weight: 600; font-size: 14px; }

/* clock */
.clock { text-align: center; background: var(--green); color: var(--white); border: 0; }
.clock h2 { color: var(--white); }
.clock .time { font: 700 44px 'Bricolage Grotesque', sans-serif; margin: 8px 0; font-variant-numeric: tabular-nums; }
.clock p { color: #D5E6E3; font-size: 14px; }
.clock .btn { background: var(--gold); border-color: var(--gold); color: var(--ink); min-width: 180px; margin-top: 12px; min-height: 54px; font-size: 17px; }
.clock textarea { margin-top: 12px; color: var(--ink); }
.clock .error { color: #FFD9D2; }

/* dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); color: var(--body); }
dialog::backdrop { background: rgba(23, 32, 30, .5); }
dialog form { padding: 20px; }
dialog .btns { justify-content: space-between; margin-top: 20px; }

/* login */
.login { max-width: 400px; margin: 0 auto; padding: 56px 16px; }
.login .brand { font-size: 34px; display: block; margin-bottom: 4px; }
.login .btn { width: 100%; margin-top: 20px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: auto 1fr; padding-bottom: 0; }
  .top { grid-column: 1 / -1; }
  .tabs { display: none; }
  .side, .side.open { display: block; position: sticky; top: 61px; align-self: start; inset: auto; padding: 16px 12px; background: none; height: calc(100vh - 61px); overflow: auto; border-right: 1px solid var(--line); z-index: 1; }
  main { width: 100%; padding: 28px 28px 40px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
