/* Card grid style (docs/DECISIONS.md #7). Colors live here as tokens. */
:root {
  --page: #f3f4f8;
  --surface: #ffffff;
  --border: #e3e5ee;
  --border-dashed: #c9ccd8;
  --text: #1b1d2a;
  --muted: #6a6e80;
  --faint: #9a9eaf;
  --accent: #534ab7;
  --functionality: #534ab7;
  --aesthetic: #1d9e75;
  --track: #e3e5ee;
  --pill-bg: #e6f1fb;
  --pill-text: #0c447c;
  --danger: #a32d2d;
  --warning: #854f0b;
  --radius: 10px;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); }
a { color: var(--accent); }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 0; }
button, select, input {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--border-dashed); border-radius: 6px; padding: 0.3rem 0.7rem;
}
button { cursor: pointer; }
button:hover { border-color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header { background: var(--surface); border-bottom: 1px solid var(--border); }
header > div, main { max-width: 72rem; margin: 0 auto; padding: 0.75rem 1rem; }
header > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
header nav { display: flex; gap: 1.25rem; align-items: center; }
header nav a { color: var(--muted); text-decoration: none; }
header nav a.brand { color: var(--text); font-weight: 600; }
header form { display: flex; gap: 0.5rem; align-items: center; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.toolbar form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.toolbar label { display: flex; gap: 0.4rem; align-items: center; color: var(--muted); font-size: 0.9rem; }
.flash { padding: 0.5rem 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.error { color: var(--danger); }
.muted { color: var(--muted); }

/* Project cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.75rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; min-width: 0;
}
.card.unrated { background: transparent; border-style: dashed; border-color: var(--border-dashed); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.card-head h2 { font-size: 1rem; overflow-wrap: anywhere; }
.card-head h2 a { color: inherit; text-decoration: none; }
.card-head h2 a:hover { text-decoration: underline; }
.desc { margin: -0.3rem 0 0; color: var(--muted); font-size: 0.85rem; }
.pill { background: var(--pill-bg); color: var(--pill-text); border-radius: 5px; padding: 0.05rem 0.4rem; font-size: 0.75rem; white-space: nowrap; }
.no-tag { color: var(--faint); font-size: 0.75rem; white-space: nowrap; }
.tag { font-size: 0.75rem; padding: 0 0.35rem; border: 1px solid var(--border-dashed); border-radius: 4px; color: var(--muted); margin-left: 0.35rem; font-weight: 400; }
.ratings { display: grid; gap: 0.45rem; }
.rating-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }
.bar { height: 5px; background: var(--track); border-radius: 3px; margin-top: 0.2rem; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; }
.bar.functionality > span { background: var(--functionality); }
.bar.aesthetic > span { background: var(--aesthetic); }
.unrated-note { color: var(--faint); font-size: 0.8rem; }
.card-foot { margin-top: auto; font-size: 0.75rem; color: var(--muted); display: grid; gap: 0.1rem; }
.overdue { color: var(--danger); }
.never { color: var(--warning); }
.empty { background: var(--surface); border: 1px dashed var(--border-dashed); border-radius: var(--radius); padding: 2rem; text-align: center; }

/* Tables (Settings) */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
th, td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 0.85rem; }
td small { display: block; color: var(--muted); }

.login { max-width: 20rem; margin: 15vh auto 0; display: grid; gap: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.login label { display: grid; gap: 0.25rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 40rem) { table { display: block; overflow-x: auto; } }

/* Project page */
.back { margin: 0 0 0.75rem; font-size: 0.9rem; }
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--text); }
.project-head { margin-bottom: 0.75rem; gap: 1rem; }
.project-head h1 { margin: 0; }
.project-head .desc { margin: 0.3rem 0 0; font-size: 0.95rem; }
.project-title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 1.5rem; }
.review-form { display: flex; gap: 0.5rem; align-items: center; align-self: flex-start; flex-wrap: wrap; }
.review-form input { width: 14rem; max-width: 100%; }
.facts { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin: 0; }
.facts dt { font-size: 0.75rem; color: var(--muted); }
.facts dd { margin: 0.1rem 0 0; font-size: 0.9rem; }
.project-layout { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 0.75rem; align-items: start; }
.project-layout aside, .project-main { display: grid; gap: 0.75rem; min-width: 0; }
@media (max-width: 52rem) { .project-layout { grid-template-columns: minmax(0, 1fr); } }
.card h3 { font-size: 0.85rem; font-weight: 600; margin: 0.4rem 0 0; color: var(--muted); }
details > summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
details > summary h2 { display: inline; color: var(--text); }
.rating-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-top: 0.6rem; }
.rating-form label { display: grid; gap: 0.2rem; font-size: 0.8rem; color: var(--muted); }
.rating-form .wide { flex-basis: 100%; }
.rating-form .wide input { width: 100%; }
.hint { font-size: 0.75rem; color: var(--faint); margin: 0.5rem 0 0; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; font-size: 0.85rem; }
.history .rejected { opacity: 0.6; text-decoration: line-through; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.timeline li { border-left: 2px solid var(--border); padding-left: 0.8rem; }
.timeline p { margin: 0.25rem 0 0; }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; font-size: 0.75rem; color: var(--muted); }
.actor { font-weight: 600; color: var(--text); }
.tests { border-radius: 4px; padding: 0 0.35rem; border: 1px solid var(--border-dashed); }
.tests-passed { color: var(--aesthetic); border-color: currentColor; }
.tests-failed { color: var(--danger); border-color: currentColor; }
.commits { font-family: ui-monospace, monospace; font-size: 0.75rem; }
.markdown { font-size: 0.9rem; overflow-wrap: anywhere; }
.markdown h1 { font-size: 1.15rem; } .markdown h2 { font-size: 1rem; } .markdown h3 { font-size: 0.95rem; color: var(--text); }
.markdown pre { background: var(--page); padding: 0.6rem; border-radius: 6px; overflow-x: auto; }
.markdown code { font-size: 0.85em; }
.markdown img { max-width: 100%; }
.markdown ul, .markdown ol { padding-left: 1.3rem; }
.markdown > h1:first-child { display: none; }
.markdown li.task { list-style: none; margin-left: -1.3rem; }
.markdown li.task .check { display: inline-block; width: 1.3rem; color: var(--faint); }
.markdown li.task.done { color: var(--muted); }
.markdown li.task.done .check { color: var(--aesthetic); }

/* Brand, icons and letter tiles */
.icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }
a > .icon:first-child, button > .icon:first-child, h2 > .icon:first-child,
dt > .icon:first-child, span > .icon:first-child { margin-right: 0.35em; }
a > .icon:last-child:not(:first-child) { margin-left: 0.3em; width: 0.85em; height: 0.85em; opacity: 0.7; }
h2 > .icon:first-child { color: var(--accent); }
button, .button { display: inline-flex; align-items: center; }
.button { color: var(--text); background: var(--surface); border: 1px solid var(--border-dashed); border-radius: 6px; padding: 0.35rem 0.8rem; text-decoration: none; }
.button:hover { border-color: var(--muted); }

header nav a { display: inline-flex; align-items: center; }
header nav a.brand { margin-right: 0.5rem; }
.brand-mark { display: inline-flex; align-items: center; gap: 0.6rem; }
.brand-mark img { display: block; border-radius: 9px; }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.brand-name span { font-weight: 400; color: var(--accent); }
.brand-sub { font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin-top: 0.15rem; }
.user { color: var(--muted); }
.login-brand { display: flex; justify-content: center; margin: 0 0 0.5rem; }
.login-brand img { width: 44px; height: 44px; }

.tile {
  display: inline-grid; place-items: center; flex: none;
  width: 2.1rem; height: 2.1rem; border-radius: 8px;
  font-weight: 700; font-size: 1rem; line-height: 1;
}
.tile-sm { width: 1.5rem; height: 1.5rem; border-radius: 6px; font-size: 0.75rem; margin-right: 0.5rem; vertical-align: middle; }
.tile-lg { width: 3rem; height: 3rem; border-radius: 11px; font-size: 1.4rem; }
.tile-0 { background: #eeedfe; color: #3c3489; }
.tile-1 { background: #e1f5ee; color: #085041; }
.tile-2 { background: #faece7; color: #712b13; }
.tile-3 { background: #e6f1fb; color: #0c447c; }
.tile-4 { background: #faeeda; color: #633806; }
.tile-5 { background: #fbeaf0; color: #72243e; }
.card-head { align-items: center; }
.card-head h2 { flex: 1; min-width: 0; }
.card-foot span { display: inline-flex; align-items: center; }
.project-name { display: flex; gap: 0.9rem; align-items: center; }
.facts dt { display: inline-flex; align-items: center; }
.toolbar h2 { display: inline-flex; align-items: center; }
.toolbar > a { display: inline-flex; align-items: center; }
.back a { display: inline-flex; align-items: center; }

/* Proposals and tokens */
.badge { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem; margin-left: 0.35rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 600; }
.proposal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.proposal { flex-direction: row; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.proposal-body { flex: 1; min-width: 12rem; }
.proposal-body p { margin: 0; }
.proposal-title { font-size: 1rem; }
.proposal-title a { color: var(--text); font-weight: 600; text-decoration: none; }
.reason { margin-top: 0.3rem !important; font-size: 0.9rem; }
.decision { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.history .decision { margin-top: 0.35rem; }
button.approve { color: var(--aesthetic); border-color: currentColor; }
button.reject { color: var(--danger); }
.settings-section { margin-top: 2rem; }
.settings-section > h2 { display: flex; align-items: center; margin-bottom: 0.4rem; }
.token-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin: 1rem 0; }
.token-form label { display: grid; gap: 0.2rem; font-size: 0.8rem; color: var(--muted); }
.token-form .error { flex-basis: 100%; margin: 0; }
.new-token { background: var(--pill-bg); color: var(--pill-text); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 1rem 0; }
.new-token p { margin: 0 0 0.5rem; }
.token-value { width: 100%; font-family: ui-monospace, monospace; font-size: 0.85rem; }
tr.revoked td { color: var(--faint); }
