/* ZipLyne client portal. Tokens match the website's editorial set (src/styles/editorial.css). */
@font-face {
  font-family: 'HL Instrument';
  src: url('/assets/InstrumentSans-latin.woff2') format('woff2');
  font-display: swap;
  font-weight: 100 900;
}

:root {
  --bg: #ffffff;
  --bg-2: #f5f2ee;
  --bg-3: #e9e6e2;
  --fg: #0d0b0a;
  --fg-2: #55524e;
  --line: #d9d5d0;
  --accent: #ff5a1f;
  --accent-text: #ae3d0c;
  --accent-soft: #ffe4d8;
  --good: #1d6b3a;
  --good-soft: #e3f2e8;
  --bad: #a3231a;
  --bad-soft: #fbe3e0;
  --radius: clamp(12px, 1.4vw, 20px);
  --radius-sm: 8px;
  --control: 44px;
  --gutter: clamp(16px, 4vw, 40px);
  --sans: 'HL Instrument', 'Instrument Sans', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg-2);
  color: var(--fg);
  font: 400 16px/1.5 var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(28px, 4vw, 44px); }
h2 { font-size: 20px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-2); margin-top: 16px; }
a { color: inherit; }
p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Header ─────────────────────────────────────────────── */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 16px; padding: 12px var(--gutter); min-height: 60px; }
.brand { display: inline-flex; flex: none; }
.brand img { display: block; height: 26px; width: auto; }
.client-name { font-weight: 600; padding-left: 16px; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; flex: none; }
.tabs { display: flex; gap: 4px; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: thin; }
.tab {
  flex: none; display: inline-flex; align-items: center; min-height: var(--control); padding: 0 14px;
  text-decoration: none; color: var(--fg-2); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg); border-bottom-color: var(--accent); }

/* ── Page ───────────────────────────────────────────────── */
.page { max-width: 1180px; margin: 0 auto; padding: 32px var(--gutter) 64px; display: grid; gap: 20px; }
.hero { display: grid; gap: 8px; }
.lede { font-size: 18px; color: var(--fg-2); }
.muted { color: var(--fg-2); }
.small { font-size: 13px; }
.as-of { color: var(--fg-2); font-size: 13px; }
.empty { color: var(--fg-2); padding: 8px 0; }
.notice { background: var(--accent-soft); color: var(--accent-text); padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.error { color: var(--bad); font-weight: 500; }
.body-text { margin-top: 6px; white-space: pre-line; }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.4vw, 24px); display: grid; gap: 12px; align-content: start; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ── KPIs ───────────────────────────────────────────────── */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; align-content: start; }
.kpi-label { color: var(--fg-2); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: clamp(26px, 3vw, 34px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-detail { color: var(--fg-2); font-size: 13px; }

/* ── Controls ───────────────────────────────────────────── */
.button, .chip, .link { font: inherit; cursor: pointer; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--control); padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--fg); background: var(--bg); color: var(--fg); font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
.button:hover { background: var(--bg-2); }
.button.primary { background: var(--fg); color: var(--bg); }
.button.primary:hover { background: #2a2826; }
.button.chosen { outline: 3px solid var(--accent); outline-offset: 2px; }
.button.danger { border-color: var(--bad); color: var(--bad); }
.link { background: none; border: 0; padding: 10px 0; color: var(--fg); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); white-space: nowrap; }
.link:hover { text-decoration-color: var(--fg); }
.chip { min-height: var(--control); padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip.danger { color: var(--bad); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

label { font-size: 13px; font-weight: 600; color: var(--fg-2); }
input, select, textarea {
  font: inherit; width: 100%; min-height: var(--control); padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--fg);
}
textarea { resize: vertical; }
.stack { display: grid; gap: 10px; }
.field { display: grid; gap: 6px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; }
.editor { border-top: 1px solid var(--line); padding-top: 12px; }
.editor summary { cursor: pointer; font-weight: 600; min-height: var(--control); display: flex; align-items: center; }
.editor > * + * { margin-top: 14px; }
.danger-zone { display: flex; justify-content: flex-end; }

/* ── Pills ──────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; width: max-content; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-open { background: var(--bg-3); color: var(--fg); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }

/* ── Lists and tables ───────────────────────────────────── */
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.plain a { font-weight: 600; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed time { color: var(--fg-2); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .feed li { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 13px; color: var(--fg-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }

.requests { list-style: none; margin: 0; padding: 0; display: grid; }
.requests li { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.requests li:first-child { border-top: 0; }
.req-number { color: var(--fg-2); font-variant-numeric: tabular-nums; }
.req-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--fg-2); font-size: 14px; }

/* ── Chart ──────────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: clamp(6px, 1.4vw, 16px); height: 220px; overflow-x: auto; padding-top: 8px; }
.bar { flex: 1 0 36px; height: 100%; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 6px; }
.bar-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-fill { align-self: end; width: 100%; max-width: 56px; background: var(--accent); border-radius: 6px 6px 2px 2px; }
.bar-label { font-size: 13px; color: var(--fg-2); }

/* ── Projects ───────────────────────────────────────────── */
.scope-summary { display: grid; gap: 10px; }
.scope-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 18px; }
.progress { height: 10px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.scope-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; color: var(--fg-2); font-size: 14px; }
.staff-note { font-size: 13px; color: var(--accent-text); background: var(--accent-soft); padding: 6px 10px; border-radius: var(--radius-sm); width: max-content; max-width: 100%; }
.facts { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; }
.facts dt { font-size: 13px; color: var(--fg-2); }
.facts dd { margin: 0; font-weight: 600; }
.milestones { list-style: none; margin: 0; padding: 0; display: grid; }
.milestones li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ms-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--fg-2); }
.ms-doing .ms-dot { border-color: var(--accent); background: var(--accent-soft); }
.ms-done .ms-dot { border-color: var(--accent); background: var(--accent); }
.ms-done .ms-title { color: var(--fg-2); }
.ms-state { font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.ms-actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.ms-actions form { display: contents; }

/* ── Ideas ──────────────────────────────────────────────── */
.ideas { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.idea-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg-3); }
.idea-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.price { font-size: 20px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.respond { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.respond-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.responses { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* ── Sign in ────────────────────────────────────────────── */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin-card { width: min(100%, 420px); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; display: grid; gap: 18px; }
.signin-card img { height: 30px; width: auto; }
.signin-card h1 { font-size: 28px; }
.client-card h2 { font-size: 22px; }

@media (max-width: 520px) {
  .top-row { gap: 10px; }
  .client-name { padding-left: 10px; }
  .page { padding-top: 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-label { white-space: normal; }
}
@media (prefers-reduced-motion: no-preference) {
  .progress span { transition: width 0.4s ease; }
}
