/* Foyer: the one stylesheet (F4.1). Every colour lives in the tokens below;
   nothing else in the app writes a hex colour (a test checks). Skins are
   token sets under [data-skin]; v1 ships one, Kozio Digital. */

[data-skin="kozio"] {
  --paper: #F5EFE4;
  --panel: #FFFDF8;
  --panel-2: #FAF5EC;
  --ink: #221F1B;
  --muted: #6E665B;
  --faint: #A39A8C;
  --rule: #E3D9C7;
  --accent: #8C2F28;
  --accent-ink: #FFF8F2;
  --accent-soft: #F4E2DA;
  --ok: #2E6B45;
  --ok-soft: #E1EEDF;
  --warn: #8A5A00;
  --warn-soft: #F6EACB;
  --bad: #A3322F;
  --bad-soft: #F6DEDA;
  --info: #2D5878;
  --info-soft: #DDE8F0;
  /* Charts: one accent and three tints of it (towards the paper). */
  --chart-1: #8C2F28;
  --chart-2: #AC6960;
  --chart-3: #C6998F;
  --chart-4: #DBBFB5;
  /* A neutral fifth series (e.g. "Closed without a fix"), never an accent. */
  --chart-5: #A39B90;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter Tight", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(34, 31, 27, .04), 0 12px 32px -18px rgba(34, 31, 27, .28);
}

/* Self-hosted (OFL; licences next to the files): no font CDN, so a client's
   visitors never reach a third party through Foyer. Latin and Latin Extended
   (Polish, Czech, Hungarian…), each loaded only when a page needs it. The
   server adds each file's content hash to its URL. */
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces.woff2?v=7234ed860a9c") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-ext.woff2?v=a2930b27d13a") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter Tight";
  src: url("/assets/fonts/inter-tight.woff2?v=77fefe8ca19b") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter Tight";
  src: url("/assets/fonts/inter-tight-ext.woff2?v=fd9beddaaec6") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono.woff2?v=18be452724bf") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-ext.woff2?v=79bfdab9ba46") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --faint is for rules and decoration only: as text it fails AA contrast. */

/* Base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 var(--sans);
  color: var(--ink);
  background: var(--paper);
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1.15;
}
h1 { font-size: 30px; margin: 12px 0 16px; }
h2 { font-size: 21px; margin: 24px 0 10px; }
h3 { font-size: 17px; margin: 18px 0 8px; }
a { color: var(--accent); }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }
pre {
  white-space: pre-wrap;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  padding: 8px;
  border-radius: 6px;
}
input, select, textarea, button { font: inherit; }
textarea { width: 100%; }
form { display: inline; }
input, select, textarea {
  max-width: 100%; /* a size=60 field never pushes a phone sideways */
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 4px 6px;
}
button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }

/* Focus and motion (F4.7): a visible ring for keyboard focus, and no
   animation for those who ask for less. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Text for screen readers only (a label the layout already implies). */
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Shell (F4.2): a sticky top bar (house mark, nav with counts, the user
   menu) over one centred column. It wraps at phone width. */
body { max-width: none; padding: 0; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.wordmark { font-family: var(--serif); font-size: 21px; font-style: italic; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; font-size: 13.5px; }
.nav a { padding: 6px 9px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--panel); }
.nav a.on { color: var(--ink); background: var(--panel); box-shadow: inset 0 -2px 0 var(--accent); }
.nav .ct { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; text-align: center; }
.um { position: relative; font-size: 13.5px; }
.um summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.um summary::-webkit-details-marker { display: none; }
.um-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; display: grid; gap: 8px; padding: 12px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.um-menu a { color: var(--ink); }
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font: 600 11px var(--sans); background: var(--rule); color: var(--ink); flex: none; }
.page { max-width: 1100px; margin: 0 auto; padding: 8px 16px 48px; }
@media (max-width: 480px) {
  .um .un { display: none; }
  h1 { font-size: 26px; }
}

/* Components */
table { border-collapse: collapse; width: 100%; margin: 8px 0; }
td, th { border-bottom: 1px solid var(--rule); padding: 6px 8px; text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 13px; }
.tscroll { overflow-x: auto; margin: 8px 0; }
table.t { margin: 0; font-size: 13.5px; }
table.t th { font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; padding: 8px 10px; }
table.t td { padding: 10px; }
table.t tr:last-child td { border-bottom: 0; }
.card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px;
  margin: 10px 0;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.faint { color: var(--muted); }
.err { color: var(--bad); }
.on { font-weight: 600; }
.off { color: var(--muted); }
.steps span { margin-right: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--sans); padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none;
}
.btn.quiet { background: var(--panel); border-color: var(--rule); color: var(--ink); }
.btn.sm { padding: 4px 10px; font-size: 12px; }

/* Status pills: the seven client statuses keep these tones everywhere. */
.pill { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px var(--sans); padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--rule); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.seal {
  display: inline-flex; align-items: center; gap: 6px; font: 600 11px var(--sans); letter-spacing: .04em; color: var(--accent);
  border: 1px dashed var(--accent); border-radius: 999px; padding: 2px 9px 2px 4px;
}
.seal i { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-style: normal; font-size: 10px; }

.fld { display: grid; gap: 4px; margin: 10px 0; max-width: 520px; }
.fld label { font-size: 13px; font-weight: 600; }
.fld input, .fld textarea { width: 100%; padding: 8px 10px; }
.fld.bad input, .fld.bad textarea { border-color: var(--bad); }
.ferr { margin: 0; font-size: 13px; color: var(--bad); }

.empty { border: 1px dashed var(--rule); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--muted); font-family: var(--serif); font-size: 16px; }
.empty p { margin: 0; }
.toast { margin: 12px 0 0; padding: 9px 14px; border-radius: var(--radius); background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: 13.5px; }

/* Atoms */
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.small { font-size: 13px; }
.card > h3:first-child, .card > h4:first-child { margin-top: 0; }
.card.accent { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.av.c { background: var(--accent); color: var(--accent-ink); font-family: var(--serif); font-size: 14px; font-style: italic; }
.bar { height: 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--rule); overflow: hidden; margin: 6px 0; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
dl.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-family: var(--serif); font-size: 18px; text-align: right; }

/* The client's home (F4.3): main column and a side column that drops
   below it on a phone. */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.cols aside .card:first-child { margin-top: 0; }
@media (max-width: 760px) { .cols { grid-template-columns: minmax(0, 1fr); } }
a.need { display: block; color: var(--ink); text-decoration: none; }
a.need:hover { border-color: var(--accent); }
a.need h4 { margin: 8px 0 4px; font-family: var(--serif); font-weight: 500; font-size: 17px; }
a.need p { margin: 0; }
ul.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
ul.people li { display: flex; gap: 10px; align-items: center; line-height: 1.25; }

/* A request (F4.3): progress, the client's words, the conversation, the
   promise as a receipt. */
ol.journey { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 8px 0 18px; padding: 0; }
ol.journey li { position: relative; padding-top: 20px; font-size: 12px; color: var(--muted); }
ol.journey li::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--rule); }
ol.journey li::after { content: ""; position: absolute; top: 1px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--rule); }
ol.journey li.done::before, ol.journey li.done::after { background: var(--accent); border-color: var(--accent); }
ol.journey li.now::before { background: var(--accent); }
ol.journey li.now::after { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
ol.journey li.now { color: var(--ink); font-weight: 600; }
blockquote.words { margin: 0; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--panel); font-family: var(--serif); font-size: 17px; white-space: pre-wrap; }
.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
.msg .who { margin: 0 0 4px; font-size: 12.5px; color: var(--muted); }
.msg .who b { color: var(--ink); }
.msg .body { background: var(--panel-2); border: 1px solid var(--rule); border-radius: 4px 14px 14px 14px; padding: 10px 14px; max-width: 64ch; }
.msg.me .body { background: var(--panel); }
.msg.cg .body { background: var(--accent-soft); border-color: transparent; }
.msg .body p { margin: 0; white-space: pre-wrap; }
.card.promise h4 { font-family: var(--serif); font-weight: 500; font-size: 19px; margin: 6px 0 8px; }
.card.promise .kv { margin: 10px 0; max-width: 360px; }
.decide, .verify { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule); }
.notquite .fld { max-width: none; }

/* The weekly letter. */
article.letter { max-width: 680px; margin: 0 auto; background: var(--panel); padding: 32px 24px; border: 1px solid var(--rule); box-shadow: var(--shadow); }
article.letter p, article.letter li { font-family: var(--serif); font-size: 17px; line-height: 1.6; }
@media (min-width: 760px) { article.letter { padding: 56px 64px; } }

/* The desk (F4.4, F5.2): the threads, and the tray alongside on a wide
   screen (below on a narrow one). */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .desk { grid-template-columns: minmax(0, 1fr); } }
.desk aside .card.tray { padding: 12px; }
.kpi.over .v { color: var(--bad); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.kpi { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }
.kpi .l { margin: 0 0 6px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.kpi .v { margin: 0; font-family: var(--serif); font-size: 30px; line-height: 1; }
.kpi .d { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.card.tray h4 { font-family: var(--serif); font-weight: 500; font-size: 17px; margin: 6px 0; }
.card.tray .basis { color: var(--muted); border-top: 1px dashed var(--rule); padding-top: 8px; }
.card.tray form.sign { display: block; }
details.edit { margin: 8px 0; }
details.edit summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
details.edit form, details.edit .fld { margin: 8px 0; }
.acts { margin: 8px 0; }
p.finding { border-left: 3px solid var(--bad); padding: 6px 10px; background: var(--panel-2); }
.hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.hub a.card { color: var(--ink); text-decoration: none; margin: 0; }
.hub a.card:hover { border-color: var(--accent); }
.hub a.card p { margin: 0; font-size: 13px; }

/* Charts (F5): drawn on the server as SVG, each with its table. */
figure.chart { margin: 8px 0 16px; }
figure.chart svg { display: block; width: 100%; height: auto; }
figure.chart .c1 { fill: var(--chart-1); } figure.chart .c2 { fill: var(--chart-2); }
figure.chart .c3 { fill: var(--chart-3); } figure.chart .c4 { fill: var(--chart-4); }
figure.chart .c5 { fill: var(--chart-5); }
figure.chart .axis { fill: var(--muted); font: 11px var(--sans); }
figure.chart .mark { stroke: var(--ink); stroke-dasharray: 4 3; stroke-width: 1; }
figure.chart .mark-l { fill: var(--ink); font: 10px var(--mono); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin: 4px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend .c1 { background: var(--chart-1); } .legend .c2 { background: var(--chart-2); }
.legend .c3 { background: var(--chart-3); } .legend .c4 { background: var(--chart-4); }
.legend .c5 { background: var(--chart-5); }
details.astable summary { cursor: pointer; font-size: 12.5px; color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; margin: 8px 0 16px; }
.filters label { display: grid; gap: 2px; font-size: 12.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.callout { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; }

/* The board. */
.lanes { display: flex; gap: 10px; overflow-x: auto; }
.lane { min-width: 180px; flex: 1; background: var(--panel-2); border-radius: var(--radius); padding: 8px; }
