:root {
  --bg: #f5f6f8; --card: #fff; --ink: #14181f; --muted: #5d6675; --line: #e2e5ea; --soft: #eef0f5;
  --brand: #22305a; --on-brand: #fff; --brand-text: #22305a; --accent: #c8102e; --on-accent: #fff;
  --good: #1f7a4d; --warn: #b26a00; --star: #e0a400;
  --radius: 14px; --pad: 16px; --base: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--base); line-height: 1.4; }
a { color: var(--brand-text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

header.top { position: sticky; top: 0; z-index: 5; background: var(--brand); color: var(--on-brand); padding: 12px var(--pad) 0; }
header.top .row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; max-width: 1400px; margin: 0 auto; }
header.top h1 { font-size: 1.15em; margin: 0; letter-spacing: .2px; }
header.top .who { font-size: 13px; opacity: .85; }
header.top .who a { color: var(--on-brand); }
header.top .gsearch { position: relative; order: 3; flex: 1 1 100%; margin-top: 2px; }
@media (min-width: 900px) { header.top .gsearch { order: 2; flex: 1 1 auto; max-width: 560px; margin: 0 16px; } header.top .who { order: 3; } }
header.top .gsearch input { min-height: 42px; border: 0; background: rgba(255,255,255,.95); color: #14181f; }
#gresults { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: min(var(--radius), 12px); box-shadow: 0 8px 24px rgba(0,0,0,.18); overflow: hidden; z-index: 10; }
#gresults a { display: block; padding: 10px 14px; text-decoration: none; color: inherit; border-top: 1px solid var(--line); }
#gresults a:first-child { border-top: 0; }
#gresults a span { display: block; font-size: 13px; color: var(--muted); }
#gresults a.all { font-weight: 700; color: var(--brand-text); }
#gresults .none { padding: 12px 14px; color: var(--muted); }
nav.tabs { display: flex; gap: 2px; margin: 8px auto 0; overflow-x: auto; max-width: 1400px; scrollbar-width: none; }
nav.tabs a { color: var(--on-brand); text-decoration: none; padding: 10px 11px; border-radius: 10px 10px 0 0; font-weight: 600; font-size: 15px; opacity: .8; white-space: nowrap; }
nav.tabs a.on { background: var(--bg); color: var(--brand-text); opacity: 1; }
nav.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; text-align: center; }

main { max-width: 1400px; margin: 0 auto; padding: var(--pad); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin-bottom: 12px; }
h2 { font-size: 1.25em; margin: 4px 0 12px; }
h3 { font-size: 1em; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: min(var(--radius), 12px); border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.danger { color: var(--accent); }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: min(var(--radius), 12px); background: var(--card); color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
input[type=color] { padding: 2px; min-height: 44px; width: 100%; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }

/* The board: boxes she can move, hide and size. Phone: one column. Computer: three (small/medium/wide = 1/2/3). */
.board { display: grid; grid-template-columns: 1fr; gap: 12px; }
.board > .widget { margin: 0; min-width: 0; display: flex; flex-direction: column; }
.board > .widget > .body { min-height: 0; }
.board > .widget.bare { padding: 0; background: none; border: 0; }
@media (min-width: 900px) {
  .board { grid-template-columns: repeat(2, 1fr); }
  .board > .size-medium, .board > .size-wide { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
  .board { grid-template-columns: repeat(3, 1fr); }
  .board > .size-medium { grid-column: span 2; }
  .board > .size-wide { grid-column: 1 / -1; }
}
.board-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }

/* Home is a dashboard: the whole board fits one screen, and each box scrolls inside itself. */
.dash > .widget:not(.bare) { height: 290px; }
.dash > .widget:not(.bare) > .body { flex: 1; overflow-y: auto; }
@media (min-width: 1200px) { .dash > .widget:not(.bare) { height: max(200px, calc((100vh - 300px) / 2)); } }
@media (max-width: 899px) { .dash > .widget:not(.bare) { height: 240px; } }
.board-bar.slim { justify-content: flex-end; margin: -4px 0 6px; }
.dash .rec { padding: 8px 10px; }
.dash .list { gap: 6px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(6, 1fr); gap: 12px; } }
.tile { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; text-decoration: none; color: var(--ink); min-width: 0; }
a.tile:hover { border-color: var(--brand-text); }
.tile .n { font-size: 1.9em; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 12px; color: var(--muted); font-weight: 600; }
@media (max-width: 520px) { .tile .n { font-size: 1.5em; } .tile { padding: 8px 10px; } }
.board-bar h2 { margin: 0; }
.widget h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.widget h3 .more { font-size: 13px; font-weight: 600; }

.arrange { display: flex; flex-direction: column; gap: 8px; }
.arow { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.arow .grip { cursor: grab; font-size: 22px; color: var(--muted); padding: 4px 6px; touch-action: none; user-select: none; }
.arow .t { flex: 1; font-weight: 600; min-width: 0; }
.arow .t small { display: block; font-weight: 400; color: var(--muted); }
.arow.ghost { opacity: .4; }
.arow.off { opacity: .6; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 100%; }
.filters select { flex: 1 1 140px; width: auto; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px; }
.chip.on { background: var(--star); border-color: var(--star); color: #1d1600; }

.list { display: flex; flex-direction: column; gap: 8px; }
.rec { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: inherit; }
.widget .rec { border-color: var(--line); padding: 10px 12px; }
.rec .main { flex: 1; min-width: 0; }
.rec .name { display: block; font-weight: 700; }
.rec .meta { display: block; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec .side { text-align: right; font-size: 13px; flex-shrink: 0; }
.star { font-size: 22px; color: var(--line); background: none; border: 0; padding: 0 2px; line-height: 1; }
.star.on { color: var(--star); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.new { background: #e7efff; color: #1d4ed8; }
.pill.reached_out, .pill.talking { background: #fff4e0; color: var(--warn); }
.pill.zoom_set, .pill.zoom_done, .pill.visit, .pill.offer { background: #e6f5ec; color: var(--good); }
.pill.committed_us { background: var(--good); color: #fff; }
.pill.committed_elsewhere, .pill.not_fit { background: var(--soft); color: var(--muted); }
.quiet { color: var(--accent); font-weight: 700; }

.todo .why { display: block; font-size: 14px; color: var(--muted); }
.todo .icon { font-size: 22px; line-height: 1; width: 28px; text-align: center; flex-shrink: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: 0 0 12px 12px; }
.timeline li.out { border-color: var(--brand); }
.timeline li.in { border-color: var(--good); }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .what { white-space: pre-wrap; }

.thread { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; margin-bottom: 10px; padding: 2px; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; font-size: 15px; }
.bubble.out { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 4px; }
.bubble.in { align-self: flex-start; background: var(--soft); color: var(--ink); border-bottom-left-radius: 4px; }
.bubble small { display: block; opacity: .7; font-size: 11px; margin-top: 2px; }
.notice { background: var(--soft); border-radius: min(var(--radius), 12px); padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }

.mini { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.mini:first-of-type { border-top: 0; }
.seg { display: flex; border: 1px solid var(--line); border-radius: min(var(--radius), 12px); overflow: hidden; }
.seg button { flex: 1; min-height: 44px; border: 0; background: var(--card); color: var(--ink); font-weight: 600; }
.seg button.on { background: var(--brand); color: var(--on-brand); }

.bars .bar { display: grid; grid-template-columns: 9em 1fr 2.5em; gap: 8px; align-items: center; padding: 3px 0; text-decoration: none; color: inherit; font-size: 14px; }
.bars .bar b { text-align: right; font-variant-numeric: tabular-nums; }
.bars .track { height: 12px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.bars .fill { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.wtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.wtable th, .wtable td { padding: 2px 3px; text-align: center; border-bottom: 1px solid var(--line); }
.wtable th:first-child, .wtable td:first-child { text-align: left; font-weight: 700; }
.wtable a { display: block; text-decoration: none; color: inherit; border-radius: 6px; padding: 2px 0; }
.wtable a.has { background: var(--soft); font-weight: 700; color: var(--brand-text); }
.wtable a.zero { color: var(--accent); }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.swatch { border: 2px solid var(--line); border-radius: min(var(--radius), 12px); padding: 0; overflow: hidden; background: var(--card); color: var(--ink); text-align: left; }
.swatch.on { border-color: var(--ink); }
.swatch .chips { display: flex; height: 34px; }
.swatch .chips span { flex: 1; }
.swatch .nm { padding: 6px 10px; font-weight: 600; font-size: 14px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts button { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; }
.opts button.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.addon { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.addon:first-of-type { border-top: 0; }
.addon .t { flex: 1; }
.addon .t b { display: block; }
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; min-height: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 15px; transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(22px); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: var(--soft); color: var(--muted); margin-left: 6px; vertical-align: middle; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 20; max-width: calc(100% - 32px); }
.login { max-width: 380px; margin: 12vh auto 0; padding: var(--pad); }
.err { color: var(--accent); font-weight: 600; margin-top: 8px; }
.empty { text-align: center; padding: 24px 10px; color: var(--muted); }

/* Phones: every tab fits on one row (the paint-palette tab keeps just its icon) */
@media (max-width: 480px) {
  nav.tabs a { padding: 10px 9px; font-size: 14.5px; }
  nav.tabs .wide { display: none; }
}
@media (max-width: 360px) {
  nav.tabs a { padding: 10px 6px; font-size: 13.5px; }
}

/* Touch cards: the ready-written message opens under the card */
.todo-wrap { display: flex; flex-direction: column; gap: 0; }
.todo-wrap > .rec { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
details.ready { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--card); padding: 6px 12px 8px; }
details.ready summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--brand-text); list-style: none; padding: 2px 0; }
details.ready summary::-webkit-details-marker { display: none; }
details.ready[open] summary { margin-bottom: 6px; }
details.ready textarea { width: 100%; min-height: 92px; font: inherit; font-size: 14px; line-height: 1.4; box-sizing: border-box; }
details.ready .btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
details.ready .btns a { margin-left: auto; }
details.ready p { margin: 6px 0 0; }
