:root {
  --ink: #1d2320;
  --ink-2: #5b6660;
  --line: #e3e6e2;
  --bg: #f6f7f5;
  --card: #ffffff;
  --brand: #22302a;
  --accent: #a3236e;
  --olive: #6f7d3c;
  --green: #2f7a4a;
  --amber: #b7791f;
  --red: #b42318;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--ink); background: var(--bg); }
a { color: inherit; }
a.link, .card a.link { color: var(--accent); text-decoration: none; }
a.link:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* layout */
.shell { display: flex; min-height: 100vh; background: linear-gradient(to right, var(--brand) 220px, var(--bg) 220px); }
.side { width: 220px; background: var(--brand); color: #e9ece8; padding: 18px 12px; position: sticky; top: 0;
  height: 100vh; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; text-decoration: none; }
.brand img { height: 40px; }
.brand b { font-size: 15px; letter-spacing: .02em; }
.brand span { display: block; font-size: 11px; opacity: .7; }
.side nav a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: #d8ddd6; }
.side nav a:hover, .side nav a.on { background: rgba(255,255,255,.1); color: #fff; }
.side .foot { position: absolute; bottom: 16px; left: 12px; right: 12px; font-size: 12px; }
.side .foot a { color: #b9c0b7; text-decoration: none; display: block; padding: 4px 10px; }
.main { flex: 1; min-width: 0; padding: 20px 28px 80px; }
.topbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.topbar form { flex: 1; position: relative; }
.search { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 15px; }
.search-results { position: absolute; top: 42px; left: 0; right: 0; z-index: 20; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card.flush { padding: 0; }
.card.alert { border-left: 4px solid var(--red); }
.card.warn { border-left: 4px solid var(--amber); }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; padding: 8px 10px; border: 1px solid #cfd5cf; border-radius: 8px;
  font: inherit; background: #fff; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.form-row .help { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.errorlist { color: var(--red); margin: 4px 0 0; padding-left: 16px; font-size: 13px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.inline-form > * { flex: 1; min-width: 140px; }

/* lists */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .title { font-weight: 600; text-decoration: none; }
.rows .sub { font-size: 13px; color: var(--ink-2); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; padding: 8px 12px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
.empty { color: var(--ink-2); font-size: 14px; padding: 6px 0; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #eef0ec; color: var(--ink-2); white-space: nowrap; }
.badge.green { background: #e3f2e8; color: var(--green); }
.badge.amber { background: #fcf0dc; color: var(--amber); }
.badge.red { background: #fde8e6; color: var(--red); }
.badge.accent { background: #f7e4ef; color: var(--accent); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--green); }
.dot.amber { background: var(--amber); } .dot.red { background: var(--red); }
.stat { font-size: 28px; font-weight: 700; line-height: 1.1; }

/* stage track */
.track { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 4px; }
.track span { flex: 1; min-width: 70px; font-size: 11.5px; padding: 6px 6px; border-radius: 6px; background: #eef0ec;
  color: var(--ink-2); text-align: center; }
.track span.done { background: #dfe7d6; color: var(--olive); }
.track span.now { background: var(--brand); color: #fff; font-weight: 600; }

/* board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { min-width: 220px; flex: 1; background: #eef0ec; border-radius: var(--radius); padding: 10px; }
.col h4 { margin: 0 0 8px; font-size: 13px; display: flex; justify-content: space-between; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px;
  display: block; text-decoration: none; }
.tile b { display: block; font-size: 14px; }

.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.messages li { padding: 10px 14px; border-radius: 8px; background: #e3f2e8; color: var(--green); margin-bottom: 6px; }
.messages li.error { background: #fde8e6; color: var(--red); }
.checkline { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.checkline.done span { text-decoration: line-through; color: var(--ink-2); }
.checkline button { all: unset; cursor: pointer; width: 18px; height: 18px; border: 1.5px solid #9aa59c; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.checkline.done button { background: var(--olive); border-color: var(--olive); color: #fff; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.fab { display: none; }

/* phone */
.mobilebar { display: none; }
@media (max-width: 820px) {
  .side { display: none; }
  .shell { background: var(--bg); }
  .main { padding: 12px 14px 90px; }
  .g2, .g3, .g-main { grid-template-columns: 1fr; }
  .mobilebar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--brand); z-index: 30;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mobilebar a { color: #d8ddd6; text-decoration: none; font-size: 11px; text-align: center; padding: 4px 6px; }
  .mobilebar a.on { color: #fff; font-weight: 600; }
  .mobilebar a i { display: block; font-style: normal; font-size: 18px; line-height: 1.2; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .mobile-brand img { height: 30px; }
  table.t.stack thead { display: none; }
  table.t.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.t.stack td { display: block; border: 0; padding: 2px 12px; }
  h1 { font-size: 20px; }
}
@media (min-width: 821px) { .mobile-brand { display: none; } }
