:root {
  --sky: #E9EFF3;
  --panel: #FFFFFF;
  --ink: #16233B;
  --steel: #5E6E7E;
  --line: #CCD7DF;
  --tag: #E8471C;
  --tag-ink: #FFFFFF;
  --amber: #B07A00;
  --green: #2E7D5B;
  --radius-s: 6px;
  --radius-m: 12px;
  --nav-h: 64px;
  --font: 'Golos Text', system-ui, sans-serif;
  --display: 'Unbounded', 'Golos Text', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--sky);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--ink); color: var(--sky);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 14px;
  display: flex; align-items: baseline; gap: 12px;
}
.wordmark { font: 700 20px/1 var(--display); letter-spacing: -0.01em; }
.top h1 { font: 500 15px/1.2 var(--font); margin: 0; opacity: .75; }
.top .spacer { flex: 1; }
.top .who { font-size: 13px; opacity: .75; }

main { max-width: 720px; margin: 0 auto; padding: 20px 16px 32px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--panel); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; font-size: 11.5px; color: var(--steel); position: relative;
}
.nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; background: var(--tag); border-radius: 0 0 3px 3px;
}

@media (min-width: 900px) {
  .shell { padding-bottom: 0; padding-left: 200px; }
  .nav {
    top: 0; bottom: 0; right: auto; width: 200px; height: auto;
    grid-template-columns: 1fr; grid-auto-rows: 52px; align-content: start;
    padding-top: 84px; border-top: 0; border-right: 1px solid var(--line);
  }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding-left: 24px; font-size: 15px; }
  .nav a[aria-current="page"]::before { top: 10px; bottom: 10px; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .top { padding-left: 24px; }
}

/* ---------- the tag: remove-before-flight style highlight ---------- */
.tag {
  position: relative; display: block; text-decoration: none;
  background: var(--tag); color: var(--tag-ink);
  border-radius: 4px 14px 14px 4px;
  padding: 16px 18px 16px 52px; margin-bottom: 24px;
}
.tag::before { /* grommet */
  content: ''; position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border-radius: 50%; background: var(--sky); box-shadow: 0 0 0 3px rgba(255,255,255,.55);
}
.tag .tag-kicker { font-size: 13px; opacity: .9; }
.tag .tag-title { font: 700 19px/1.25 var(--display); margin: 2px 0 4px; }
.tag .tag-meta { font-size: 14px; }
.tag .tag-btn {
  margin-top: 10px; display: inline-block; background: var(--tag-ink); color: var(--tag);
  font-weight: 600; border-radius: var(--radius-s); padding: 6px 12px; border: 0; cursor: pointer; text-decoration: none;
}

/* ---------- content ---------- */
h2 { font: 700 18px/1.3 var(--display); margin: 28px 0 10px; }
h2:first-child { margin-top: 0; }
.muted { color: var(--steel); }
.small { font-size: 14px; }

.list { list-style: none; margin: 0; padding: 0; background: var(--panel); border-radius: var(--radius-m); border: 1px solid var(--line); }
.list > li { padding: 14px 16px; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item-title { font-weight: 600; margin: 0 0 2px; }
.item-body { margin: 4px 0 0; white-space: pre-wrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 0; }
.pin { color: var(--tag); font-weight: 600; font-size: 13px; }

.empty { padding: 22px 16px; color: var(--steel); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius-m); }

/* status pill */
.status { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; background: var(--panel); cursor: pointer; white-space: nowrap; }
.status[data-s="todo"] { color: var(--steel); }
.status[data-s="doing"] { color: var(--amber); border-color: currentColor; }
.status[data-s="done"] { color: var(--green); border-color: currentColor; }
.status:disabled { cursor: default; }
.overdue { color: var(--tag); font-weight: 600; }

/* segmented filter */
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--steel); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sky); }

/* forms */
details.compose { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 18px; }
details.compose > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; }
details.compose > summary::-webkit-details-marker { display: none; }
details.compose > summary::before { content: '+'; display: inline-block; width: 1.2em; color: var(--tag); font-weight: 700; }
details.compose[open] > summary::before { content: '–'; }
details.compose form { padding: 0 16px 16px; }
form .field { display: block; margin-bottom: 12px; }
form .field > span { display: block; font-size: 14px; color: var(--steel); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff;
}
textarea { min-height: 88px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 15px; }
.btn { text-decoration: none; display: inline-block; border: 0; border-radius: var(--radius-s); padding: 10px 16px; font-weight: 600; cursor: pointer; background: var(--ink); color: var(--sky); }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--tag); border: 1px solid var(--line); }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--steel); text-decoration: underline; cursor: pointer; font-size: 14px; }

/* auth */
.auth { max-width: 380px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) 20px 40px; }
.auth .wordmark-big { font: 700 44px/1 var(--display); letter-spacing: -0.02em; margin: 0 0 8px; }
.auth p.lead { color: var(--steel); margin: 0 0 28px; }
.auth .switch { margin-top: 16px; font-size: 14px; color: var(--steel); }
.auth .tag { margin-top: 28px; }

/* files */
.file-size { font-size: 13px; color: var(--steel); white-space: nowrap; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  transform: translate(-50%, 20px); opacity: 0; transition: opacity .2s, transform .2s;
  background: var(--ink); color: var(--sky); padding: 10px 16px; border-radius: var(--radius-s); font-size: 14px; z-index: 20; max-width: 90vw;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { #toast { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
