/* PNA staff app. Paper palette from the Mystique site (light), Frontier black/bone (dark).
   Restrained on purpose: text-led, hairline rules, no motion. Fonts are the formatter's IBM Plex files. */

@font-face { font-family: "Plex Sans"; font-weight: 400; src: url(/static/fonts/IBMPlexSans-400.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Plex Sans"; font-weight: 500; src: url(/static/fonts/IBMPlexSans-500.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Plex Sans"; font-weight: 600; src: url(/static/fonts/IBMPlexSans-600.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Plex Condensed"; font-weight: 600; src: url(/static/fonts/IBMPlexSansCondensed-600.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Plex Mono"; font-weight: 400; src: url(/static/fonts/IBMPlexMono-400.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Plex Mono"; font-weight: 500; src: url(/static/fonts/IBMPlexMono-500.woff2) format("woff2"); font-display: swap; }

:root {
  --bg: #F1EEE8;
  --panel: #F8F6F2;
  --ink: #121211;
  --ink-2: #3A3934;
  --dust: #6B675F;
  --rule: #D5D1C8;
  --rule-2: #E3DFD7;
  --accent: #8A7350;
  --accent-ink: #F8F6F2;
  --error: #8A4A3E;
  --ok: #4C6B4A;
  --focus: #A88F5F;
  --sans: "Plex Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --cond: "Plex Condensed", "Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A0A09;
    --panel: #131311;
    --ink: #E4E0D6;
    --ink-2: #B9B5AB;
    --dust: #85807A;
    --rule: #2A2924;
    --rule-2: #1E1D1A;
    --accent: #B9A47E;
    --accent-ink: #0A0A09;
    --error: #E0937C;
    --ok: #9DBA8F;
    --focus: #B9A47E;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--sans); }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--cond); font-weight: 600; letter-spacing: .005em; margin: 0; line-height: 1.15; }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.label { font: 500 11px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dust); }
.muted { color: var(--dust); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- shell ---------- */
.top { border-bottom: 1px solid var(--rule); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1160px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand svg { height: 22px; width: auto; color: var(--ink); }
.brand span { font: 600 11px/1.15 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.nav { display: flex; gap: 20px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav a { text-decoration: none; color: var(--ink-2); font-size: 14px; padding: 17px 0 15px; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.search { flex: none; }
.search input { width: 200px; padding: 6px 10px; font-size: 13px; }
.who { display: flex; align-items: center; gap: 14px; flex: none; font-size: 13px; }
.who form { margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--dust); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }

main.page { max-width: 1160px; margin: 0 auto; padding: 36px 24px 80px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.head .sub { margin-top: 6px; color: var(--dust); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { margin-bottom: 10px; font-size: 13px; color: var(--dust); }
.crumb a { color: var(--dust); }

/* ---------- controls ---------- */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--rule);
  border-radius: 0; padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); }
input[type="file"] { padding: 6px; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--ink); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1 var(--sans); letter-spacing: .01em;
  padding: 9px 14px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  text-decoration: none; cursor: pointer; border-radius: 0; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn.danger { color: var(--error); }
.btn.danger:hover { border-color: var(--error); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink-2); }
.field .err { color: var(--error); font-size: 13px; }
.field .hint { color: var(--dust); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
.stack { display: grid; gap: 16px; }
.inline { display: inline; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type="search"] { width: 260px; }
.filters select { width: auto; }

/* ---------- surfaces ---------- */
.card { background: var(--panel); border: 1px solid var(--rule); padding: 20px; }
.section { margin-top: 36px; }
.section > h2 { margin-bottom: 12px; }
.notice { border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--panel); padding: 14px 16px; margin-bottom: 20px; }
.notice.error { border-left-color: var(--error); }
.notice.ok { border-left-color: var(--ok); }
.copy { display: flex; gap: 8px; margin-top: 10px; }
.copy input { font-family: var(--mono); font-size: 13px; }
.empty { padding: 40px 0; color: var(--dust); text-align: center; border-top: 1px solid var(--rule); }
.pill { display: inline-block; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.pill.on { border-color: var(--accent); color: var(--accent); }
.pill.off { color: var(--dust); }
.tag { display: inline-block; font-size: 12px; color: var(--ink-2); background: var(--rule-2); padding: 2px 7px; margin: 0 4px 4px 0; text-decoration: none; }
a.tag:hover { color: var(--ink); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 500 11px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dust); padding: 0 12px 8px 0; border-bottom: 1px solid var(--rule); }
td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.dim td { color: var(--dust); }
.tablewrap { overflow-x: auto; }
dl.facts { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
dl.facts dt { color: var(--dust); font-size: 13px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- home ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.tile { background: var(--bg); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 20px 20px 18px; text-decoration: none; display: grid; gap: 16px; align-content: space-between; min-height: 116px; }
.tile:hover { background: var(--panel); }
.tile h2 { font-size: 18px; }
/* One muted tint per applet, so tiles are told apart by color as well as shape. */
.tile { --tint: var(--accent); }
.tile[data-applet="tasks"] { --tint: #8A7350; }
.tile[data-applet="crm"] { --tint: #4F6A84; }
.tile[data-applet="budget"] { --tint: #5E7552; }
.tile[data-applet="formatter"] { --tint: #96583F; }
.tile[data-applet="admin"] { --tint: #6B675F; }
.tile-icon { display: grid; place-items: center; width: 46px; height: 46px; color: var(--tint);
  background: color-mix(in srgb, var(--tint) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tint) 35%, transparent); }
.tile:hover .tile-icon { background: color-mix(in srgb, var(--tint) 22%, transparent); }
@media (prefers-color-scheme: dark) {
  .tile[data-applet="tasks"] { --tint: #C9B07F; }
  .tile[data-applet="crm"] { --tint: #8FAAC4; }
  .tile[data-applet="budget"] { --tint: #9DBA8F; }
  .tile[data-applet="formatter"] { --tint: #D99577; }
  .tile[data-applet="admin"] { --tint: #A8A397; }
}
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--rule-2); font-size: 14px; }
.feed time { color: var(--dust); font-size: 13px; min-width: 110px; }

/* ---------- contacts ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border: 1px solid var(--rule); margin-bottom: 28px; }
.kpi { padding: 12px 14px; border-right: 1px solid var(--rule); text-decoration: none; display: grid; gap: 2px; }
.kpi:last-child { border-right: 0; }
.kpi b { font: 600 20px/1.2 var(--cond); font-variant-numeric: tabular-nums; }
.kpi small { color: var(--dust); font-size: 12px; }
a.kpi:hover { background: var(--panel); }
a.kpi[aria-current="true"] { background: var(--panel); box-shadow: inset 0 -2px 0 var(--ink); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 14px 0; border-bottom: 1px solid var(--rule-2); display: grid; gap: 6px; }
.timeline .meta { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--dust); flex-wrap: wrap; }
.timeline .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.logform { display: grid; grid-template-columns: 130px 150px 1fr; gap: 8px; }
.logform textarea { grid-column: 1 / -1; }
.logform .btn { justify-self: start; }

/* ---------- shared bits ---------- */
.neg { color: var(--error); }
.ink { color: var(--ink); }
.bar { height: 4px; background: var(--rule-2); margin: 4px 0 3px; }
.bar i { display: block; height: 100%; background: var(--ink-2); }
.bar.over i { background: var(--error); }
.prose { overflow-wrap: anywhere; }
.prose > * + * { margin-top: .7em; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose pre { background: var(--panel); border: 1px solid var(--rule); padding: 10px 12px; overflow-x: auto; font: 13px/1.5 var(--mono); }
.prose code { background: var(--rule-2); padding: 1px 4px; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 0; padding-left: 12px; border-left: 2px solid var(--rule); color: var(--ink-2); }
.prose table { width: auto; }
.prose h1, .prose h2, .prose h3 { font-size: 17px; margin-top: 1.1em; }
.timeline li.event { padding: 8px 0; display: block; }
.seg { display: inline-flex; }
.seg .btn + .btn { margin-left: -1px; }
.home-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 0 40px; }
.home-cols .feed li { align-items: baseline; }

/* ---------- tasks ---------- */
.tabs { margin-bottom: 20px; }
.st { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--dust); vertical-align: -2px; flex: none; }
.st-backlog { border-style: dashed; }
.st-todo { border-color: var(--ink-2); }
.st-in_progress { border-color: var(--accent); background: conic-gradient(var(--accent) 0 50%, transparent 50% 100%); box-shadow: inset 0 0 0 1.5px var(--bg); }
.st-in_review { border-color: var(--ok); background: conic-gradient(var(--ok) 0 75%, transparent 75% 100%); box-shadow: inset 0 0 0 1.5px var(--bg); }
.st-done { border-color: var(--ink-2); background: var(--ink-2); box-shadow: inset 0 0 0 2.5px var(--bg); }
.st-canceled { border-color: var(--rule); background: linear-gradient(45deg, transparent 45%, var(--dust) 45% 55%, transparent 55%); }
.prio { display: inline-flex; gap: 2px; align-items: flex-end; width: 14px; height: 12px; flex: none; }
.prio i { width: 3px; background: var(--rule); }
.prio i:nth-child(1) { height: 4px; } .prio i:nth-child(2) { height: 8px; } .prio i:nth-child(3) { height: 12px; }
.prio.p2 i, .prio.p3 i:nth-child(-n+2), .prio.p4 i:nth-child(1) { background: var(--ink-2); }
.prio.none i { background: var(--rule-2); }
.prio.urgent { justify-content: center; align-items: center; background: var(--error); color: var(--bg); font: 600 10px/1 var(--mono); width: 13px; height: 13px; }
.av { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--rule-2); color: var(--ink-2); font: 500 10px/1 var(--mono); flex: none; }
.av.none { background: none; border: 1px dashed var(--rule); }
.due { font-size: 12px; color: var(--dust); font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.late { color: var(--error); }
.quickadd { display: flex; align-items: center; border: 1px solid var(--rule); background: var(--panel); margin-bottom: 24px; }
.quickadd .plus { padding: 0 4px 0 12px; color: var(--dust); }
.quickadd input { border: 0; background: none; }
.issues section + section { margin-top: 22px; }
.issues h3.group { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.issues ul { list-style: none; margin: 0; padding: 0; }
.issue-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--rule-2); min-width: 0; }
.issue-row:hover { background: var(--panel); }
.issue-row.fresh { background: var(--panel); box-shadow: inset 2px 0 0 var(--accent); }
.issue-row .id { font-size: 12px; min-width: 42px; }
.issue-row .title { text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-row .title:hover { text-decoration: underline; }
.issue-row .extras { display: flex; align-items: center; gap: 10px; flex: none; }
.issue-row .tag { margin: 0; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--rule-2); padding: 10px; min-height: 240px; border: 1px solid transparent; }
.col.over { border-color: var(--focus); }
.col h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; min-height: 40px; }
.issue-card { background: var(--panel); border: 1px solid var(--rule); padding: 10px; display: grid; gap: 6px; cursor: grab; }
.issue-card.dragging { opacity: .5; }
.issue-card > a { text-decoration: none; }
.issue-card > a:hover { text-decoration: underline; }
.issue-card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.issue-card .tag { margin: 0; }
.props { display: grid; gap: 12px; }
.project-head { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; margin-bottom: 24px; }

/* ---------- budget ---------- */
.sheet table { table-layout: fixed; min-width: 640px; }
.sheet table td, .sheet table th { padding-top: 8px; padding-bottom: 8px; }
.sheet tr.cat td { font: 500 11px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding-top: 18px; border-bottom-color: var(--rule); }
.sheet tr.cat td.num { font: 500 13px/1.3 var(--sans); letter-spacing: 0; text-transform: none; }
.sheet td.line { padding-left: 14px; overflow-wrap: anywhere; }
.sheet tr.total td { font-weight: 600; border-top: 1px solid var(--ink-2); border-bottom: 0; }
.addline { display: grid; grid-template-columns: 1fr 1.6fr 1fr .8fr auto; gap: 8px; margin-top: 10px; }
.sheet-edit td { padding: 4px 8px 4px 0; vertical-align: middle; }
.sheet-edit input, .sheet-edit select { padding: 6px 8px; font-size: 14px; }
.sheet-edit input.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-edit tr.bad td { background: color-mix(in srgb, var(--error) 8%, transparent); }
.sheet-edit .err { display: block; color: var(--error); margin-top: 2px; }
.notice ul { margin: 8px 0 0; padding-left: 1.2em; }

/* ---------- auth (unframed) ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-in { width: min(380px, 100%); display: grid; gap: 28px; }
.auth .brand svg { height: 30px; }
.auth .brand span { font-size: 12px; color: var(--ink-2); }
.auth-card { border-top: 1px solid var(--rule); padding-top: 24px; display: grid; gap: 16px; }
.auth-card .btn { justify-content: center; padding: 12px 16px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--dust); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

@media (max-width: 860px) {
  .cols, .project-head { grid-template-columns: 1fr; }
  .addline { grid-template-columns: 1fr 1fr; }
  .addline .btn { justify-self: start; }
  .search { display: none; }
}
@media (max-width: 640px) {
  .sheet table { min-width: 0; }
  .top-in { padding: 0 16px; gap: 16px; }
  .brand span { display: none; }
  .who .name { display: none; }
  main.page { padding: 24px 16px 64px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  dl.facts { grid-template-columns: 1fr; gap: 2px; }
  dl.facts dd { margin-bottom: 8px; }
  .filters input[type="search"] { width: 100%; }
  .logform { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: none; }
  .issue-row .extras .tag { display: none; }
  .home-cols { grid-template-columns: 1fr; }
}
