/* ============================================================================
   Decorum — Client Book
   Same room as the website: ink #14110d, house gold #e0bd85, Chequers display,
   Perpetua Titling labels, Spectral body. Editorial luxury, not a SaaS dashboard:
   hairline double bezels, generous air, motion that behaves like the site's.
   ========================================================================= */

@font-face {
  font-family: "Chequers";
  src: url("assets/fonts/chequers-regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Perpetua Titling";
  src: url("assets/fonts/perpetua-titling-mt-light.woff2") format("woff2");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("assets/fonts/spectral-regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #14110d;
  --rail: #100e0a;
  --surface: #1b1712;
  --card: #201a15;
  --card-hi: #251e18;

  --gold: #e0bd85;
  --gold-2: #c9a25f;
  --gold-deep: #9f7239;
  --gold-dim: #7a5c2f;

  --text: #f2e8de;
  --muted: #b3a695;
  --faint: #8a7e72;
  --ghost: #6c6259;

  --line: rgba(224, 189, 133, 0.16);
  --line-soft: rgba(224, 189, 133, 0.08);
  --line-ink: rgba(255, 255, 255, 0.06);

  --ok: #8cc07a;
  --warn: #eec448;
  --bad: #ff8f78;
  --info: #a1c7de;

  --grad-gold: linear-gradient(135deg, #fbce86 0%, #e8c184 28%, #b18547 62%, #9f7239 100%);

  --display: "Chequers", "Times New Roman", serif;
  --label: "Perpetua Titling", Georgia, serif;
  --body: "Spectral", Georgia, "Times New Roman", serif;

  --r: 2px;
  --rail-w: 238px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.32, 0.64, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 520px at 78% -8%, rgba(224, 189, 133, 0.055), transparent 70%),
    radial-gradient(700px 420px at 10% 108%, rgba(224, 189, 133, 0.035), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(224, 189, 133, 0.28); color: #fff; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  margin: 0;
  line-height: 1.12;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(224, 189, 133, 0.14); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(224, 189, 133, 0.26); }

.eyebrow {
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold-2);
  margin: 0;
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100%; }
.shell[hidden] { display: none; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(224, 189, 133, 0.035), transparent 220px), var(--rail);
  border-right: 1px solid var(--line-ink);
  padding: 26px 18px 18px;
}

.rail-top { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.emblem { filter: drop-shadow(0 0 14px rgba(224, 189, 133, 0.18)); }
.wordmark { display: flex; flex-direction: column; gap: 3px; }
.wm-main {
  font-family: var(--display); font-size: 19px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--gold); line-height: 1;
}
.wm-sub {
  font-family: var(--label); font-size: 8.5px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--faint);
}

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.01em;
  border-radius: var(--r);
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.nav a::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 2px; height: 0;
  background: var(--grad-gold);
  transform: translateY(-50%);
  transition: height 0.35s var(--spring);
}
.nav a:hover { color: var(--text); background: rgba(224, 189, 133, 0.05); }
.nav a.on { color: var(--gold); background: rgba(224, 189, 133, 0.07); }
.nav a.on::before { height: 18px; }
.nav em {
  margin-left: auto;
  font-style: normal; font-size: 11px; font-family: var(--body);
  min-width: 18px; text-align: center;
  color: var(--gold);
  background: rgba(224, 189, 133, 0.12);
  border: 1px solid rgba(224, 189, 133, 0.2);
  border-radius: 20px; padding: 0 6px; line-height: 16px;
}
.nav em:empty { display: none; }

.ico {
  width: 16px; height: 16px; flex: none;
  background: currentColor;
  opacity: 0.85;
  mask-size: contain; mask-repeat: no-repeat; mask-position: center;
  -webkit-mask-size: contain; -webkit-mask-repeat: no-repeat; -webkit-mask-position: center;
}
[data-view="dashboard"] .ico { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Cpath d='M3 10.5 12 3l9 7.5'/%3E%3Cpath d='M5 9.5V21h14V9.5'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Cpath d='M3 10.5 12 3l9 7.5'/%3E%3Cpath d='M5 9.5V21h14V9.5'/%3E%3C/svg%3E"); }
[data-view="pipeline"] .ico { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Cpath d='M3 4h18l-7 8v8l-4-2v-6z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Cpath d='M3 4h18l-7 8v8l-4-2v-6z'/%3E%3C/svg%3E"); }
[data-view="inbox"] .ico { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.4A8 8 0 1 1 21 12z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.4A8 8 0 1 1 21 12z'/%3E%3C/svg%3E"); }
[data-view="events"] .ico { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Crect x='3' y='5' width='18' height='16'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Crect x='3' y='5' width='18' height='16'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
[data-view="money"] .ico { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M14.5 9.2A3 3 0 0 0 9.5 10c0 2.4 5 1.6 5 4a2.6 2.6 0 0 1-5 .8M12 6.5v11'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M14.5 9.2A3 3 0 0 0 9.5 10c0 2.4 5 1.6 5 4a2.6 2.6 0 0 1-5 .8M12 6.5v11'/%3E%3C/svg%3E"); }
[data-view="contacts"] .ico { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4 3.6-6.5 8-6.5s8 2.5 8 6.5'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4 3.6-6.5 8-6.5s8 2.5 8 6.5'/%3E%3C/svg%3E"); }
[data-view="settings"] .ico { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.2 5.2l2.1 2.1M16.7 16.7l2.1 2.1M18.8 5.2l-2.1 2.1M7.3 16.7l-2.1 2.1'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.2 5.2l2.1 2.1M16.7 16.7l2.1 2.1M18.8 5.2l-2.1 2.1M7.3 16.7l-2.1 2.1'/%3E%3C/svg%3E"); }

.rail-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-ink); }
.signin { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); transition: background 0.2s var(--ease); }
.signin:hover { background: rgba(224, 189, 133, 0.06); }
.avatar {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(224, 189, 133, 0.12);
  border: 1px solid var(--line);
  font-family: var(--label); font-size: 11px; letter-spacing: 0.08em; color: var(--gold);
}
.who { display: flex; flex-direction: column; min-width: 0; }
.who b { font-weight: 400; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who i { font-style: normal; font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- main ---------- */
.main { min-width: 0; padding: 30px 40px 60px; }

.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line-soft); }
.topbar-copy { min-width: 0; }
.topbar h1 { font-size: 38px; margin-top: 8px; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.today { margin: 0; font-size: 12.5px; color: var(--faint); letter-spacing: 0.03em; white-space: nowrap; }

.btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  padding: 9px 16px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--label);
  border-radius: var(--r);
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--spring), color 0.25s var(--ease);
}
.btn:hover { border-color: rgba(224, 189, 133, 0.4); background: rgba(224, 189, 133, 0.06); }
.btn:active { transform: translateY(1px); }
.btn-gold {
  background: var(--grad-gold);
  border-color: transparent;
  color: #221a11;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 18px -10px rgba(251, 206, 134, 0.8);
}
.btn-gold:hover { filter: brightness(1.05); background: var(--grad-gold); }
.btn-sm { padding: 6px 11px; font-size: 10.5px; }
.btn-quiet { border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--gold); background: rgba(224, 189, 133, 0.05); }
.field-row .btn-quiet { border-color: var(--line-soft); }
.field-row .btn-quiet:hover { border-color: var(--gold-dim); }

.view { padding-top: 26px; }
.view > * { animation: rise 0.5s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: 0.05s; }
.view > *:nth-child(3) { animation-delay: 0.1s; }
.view > *:nth-child(4) { animation-delay: 0.14s; }
.view > *:nth-child(5) { animation-delay: 0.18s; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- cards + bezel ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(224, 189, 133, 0.035), transparent 62%), var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
}
.card::after {
  content: "";
  position: absolute; inset: 4px;
  border: 1px solid rgba(224, 189, 133, 0.07);
  border-radius: 1px;
  pointer-events: none;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 17px; letter-spacing: 0.07em; }
.card-head .more { font-size: 11px; color: var(--faint); letter-spacing: 0.12em; text-transform: uppercase; font-family: var(--label); }
.card-head .more:hover { color: var(--gold); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 18px 20px 16px; }
.kpi .k-label { font-family: var(--label); font-size: 9.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--faint); }
.kpi .k-value { font-family: var(--display); font-size: 34px; line-height: 1.05; margin: 10px 0 6px; color: var(--gold); letter-spacing: 0.02em; }
.kpi .k-value small { font-size: 16px; color: var(--gold-2); letter-spacing: 0.04em; }
.kpi .k-note { font-size: 12px; color: var(--muted); }
.kpi .k-note b { font-weight: 400; color: var(--text); }
.kpi.alert .k-value { color: var(--warn); }

/* ---------- grids ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.grid-2 > .col-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }

/* ---------- rows / lists ---------- */
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 0.2s var(--ease), padding 0.2s var(--ease);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: rgba(224, 189, 133, 0.04); }
.row-main { min-width: 0; flex: 1; }
.row-title { font-size: 14.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row-right { text-align: right; flex: none; }
.row-right .amt { font-family: var(--display); font-size: 15px; color: var(--gold); letter-spacing: 0.03em; }
.row-right .when { font-size: 11.5px; color: var(--faint); }
.due-soon { color: var(--warn) !important; }
.overdue { color: var(--bad) !important; }

.dots { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--gold-2); box-shadow: 0 0 0 3px rgba(224, 189, 133, 0.1); }
.dots.wa { background: #25d366; box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.12); }
.dots.ig { background: linear-gradient(135deg, #f9ce34, #ee2a7b 55%, #6228d7); box-shadow: 0 0 0 3px rgba(238, 42, 123, 0.12); }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--label); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted);
  white-space: nowrap;
}
.pill.new { color: var(--gold); border-color: rgba(224, 189, 133, 0.35); background: rgba(224, 189, 133, 0.07); }
.pill.contacted { color: var(--info); border-color: rgba(161, 199, 222, 0.3); }
.pill.quoted { color: var(--warn); border-color: rgba(238, 196, 72, 0.3); }
.pill.booked, .pill.confirmed, .pill.done { color: var(--ok); border-color: rgba(140, 192, 122, 0.3); }
.pill.lost { color: var(--faint); }
.pill.blocked { color: var(--bad); border-color: rgba(255, 143, 120, 0.35); }

/* ---------- pipeline board ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 10px; align-items: stretch; padding-bottom: 8px; }
.col { background: rgba(255, 255, 255, 0.014); border: 1px solid var(--line-ink); border-radius: var(--r); padding: 12px 10px; min-height: 120px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 10px; }
.col-head span { font-family: var(--label); font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.col-head b { font-weight: 400; font-family: var(--display); font-size: 13px; color: var(--gold-2); }
.col-sum { font-size: 11px; color: var(--faint); margin: -4px 2px 10px; }

.lead {
  display: block; width: 100%; text-align: left;
  background: linear-gradient(180deg, rgba(224, 189, 133, 0.04), transparent 70%), var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 11px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.25s var(--spring), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.lead:hover { transform: translateY(-2px); border-color: rgba(224, 189, 133, 0.34); }
.lead .l-name { font-size: 13.5px; color: var(--text); }
.lead .l-meta { font-size: 11px; color: var(--faint); margin-top: 3px; }
.lead .l-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.lead .l-val { font-family: var(--display); font-size: 12.5px; color: var(--gold-2); letter-spacing: 0.04em; }
.lead .l-date { font-size: 10.5px; color: var(--ghost); }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 320px 1fr; gap: 14px; height: calc(100vh - 190px); }
.thread-list { overflow-y: auto; padding: 6px; }
.thread {
  display: flex; gap: 10px; padding: 12px 12px; border-radius: var(--r); cursor: pointer;
  transition: background 0.2s var(--ease);
}
.thread:hover { background: rgba(224, 189, 133, 0.045); }
.thread.on { background: rgba(224, 189, 133, 0.08); }
.thread .t-main { min-width: 0; flex: 1; }
.thread .t-name { font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.thread .t-name em { font-style: normal; font-size: 10.5px; color: var(--faint); flex: none; }
.thread .t-sub { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.thread.unread .t-name { color: var(--gold); }
.thread .unread-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin-top: 8px; flex: none; }

.convo { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 0; }
.convo-head { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; }
.convo-head h3 { font-size: 15px; text-transform: none; letter-spacing: 0.01em; font-family: var(--body); }
.convo-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 74%; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; position: relative; }
.msg.in { background: var(--surface); border: 1px solid var(--line-soft); border-bottom-left-radius: 2px; align-self: flex-start; }
.msg.out { background: rgba(224, 189, 133, 0.13); border: 1px solid rgba(224, 189, 133, 0.22); border-bottom-right-radius: 2px; align-self: flex-end; }
.msg .stamp { display: block; font-size: 10px; color: var(--ghost); margin-top: 4px; }
.msg.blocked { border-color: rgba(255, 143, 120, 0.4); background: rgba(255, 143, 120, 0.08); }
.composer { border-top: 1px solid var(--line-soft); padding: 12px 16px; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 140px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); font-family: var(--body); font-size: 13.5px; padding: 11px 13px;
}
.composer textarea:focus { outline: none; border-color: rgba(224, 189, 133, 0.45); box-shadow: 0 0 0 3px rgba(224, 189, 133, 0.07); }
.notice { font-size: 11.5px; color: var(--faint); padding: 0 20px 12px; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-family: var(--label); font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--text); font-family: var(--body); font-size: 14px; padding: 10px 12px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: rgba(224, 189, 133, 0.45); box-shadow: 0 0 0 3px rgba(224, 189, 133, 0.07);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  cursor: pointer; border: 1px solid var(--line); background: transparent; border-radius: 20px;
  padding: 5px 12px; font-size: 12px; color: var(--muted);
  transition: all 0.2s var(--ease);
}
.chip:hover { border-color: rgba(224, 189, 133, 0.4); color: var(--text); }
.chip.on { background: rgba(224, 189, 133, 0.14); border-color: rgba(224, 189, 133, 0.45); color: var(--gold); }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.modal-wrap[hidden] { display: none; }
.modal-scrim { position: absolute; inset: 0; background: rgba(8, 6, 4, 0.72); backdrop-filter: blur(3px); animation: fade 0.25s var(--ease); }
.modal {
  position: relative; width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 26px 28px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
  animation: pop 0.35s var(--spring) both;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.modal h2 { font-size: 22px; margin-bottom: 4px; }
.modal .m-sub { font-size: 12.5px; color: var(--faint); margin: 0 0 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }

/* ---------- table ---------- */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-family: var(--label); font-size: 9px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--faint); font-weight: 400;
  padding: 0 10px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 13px 10px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
tr:hover td { background: rgba(224, 189, 133, 0.035); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .amt { font-family: var(--display); color: var(--gold); letter-spacing: 0.03em; }

/* ---------- misc ---------- */
.empty { padding: 34px 10px; text-align: center; color: var(--faint); font-size: 13px; }
.empty b { display: block; font-family: var(--display); font-size: 16px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.06em; }
.section-gap { margin-bottom: 14px; }
.muted { color: var(--faint); }
.small { font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.bar { height: 2px; width: 132px; background: rgba(224, 189, 133, 0.12); border-radius: 3px; overflow: hidden; margin-top: 9px; }
.bar i { display: block; height: 100%; background: var(--grad-gold); transition: width 0.6s var(--ease); }
.split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timeline { position: relative; padding-left: 16px; }
.timeline::before { content: ""; position: absolute; left: 3px; top: 6px; bottom: 6px; width: 1px; background: var(--line-soft); }
.tl-item { position: relative; padding: 7px 0; }
.tl-item::before { content: ""; position: absolute; left: -16px; top: 14px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold-2); opacity: 0.7; }
.tl-body { font-size: 13px; color: var(--muted); }
.tl-at { font-size: 11px; color: var(--ghost); }

/* ---------- gate ---------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.gate[hidden] { display: none; }
.gate-card {
  text-align: center; padding: 48px 42px; max-width: 420px;
  border: 1px solid var(--line); background: linear-gradient(180deg, rgba(224, 189, 133, 0.05), transparent 60%), var(--card);
  border-radius: var(--r); position: relative;
}
.gate-card::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(224, 189, 133, 0.08); pointer-events: none; }
.gate-card img { margin-bottom: 18px; }
.gate-card h1 { font-size: 30px; margin: 10px 0 14px; color: var(--gold); }
.gate-copy { font-size: 13.5px; color: var(--muted); margin: 0 0 26px; }

/* ---------- toasts + loading ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--card-hi); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 18px; font-size: 13px; color: var(--text);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  animation: pop 0.3s var(--spring) both;
}
.toast.bad { border-color: rgba(255, 143, 120, 0.4); color: #ffd9d0; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; background: rgba(20, 17, 13, 0.6); }
.loading[hidden] { display: none; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(224, 189, 133, 0.2); border-top-color: var(--gold); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; letter-spacing: 0.01em; color: var(--gold-2); background: rgba(224, 189, 133, 0.07); padding: 2px 6px; border-radius: 2px; }

[hidden] { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: repeat(6, 200px); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; z-index: 70;
    flex-direction: row; align-items: center; padding: 8px 10px;
    border-right: 0; border-top: 1px solid var(--line-ink);
    background: rgba(16, 14, 10, 0.97); backdrop-filter: blur(12px);
  }
  .rail-top, .rail-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-between; gap: 0; }
  .nav a { flex-direction: column; gap: 4px; padding: 7px 8px; font-size: 9.5px; letter-spacing: 0.06em; flex: 1; text-align: center; }
  .nav a::before { display: none; }
  .nav em { position: absolute; top: 2px; right: 6px; margin: 0; font-size: 9px; line-height: 13px; }
  .main { padding: 20px 16px 96px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 14px; }
  .topbar h1 { font-size: 28px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .thread-list { max-height: 40vh; }
  .convo { height: 60vh; }
  .tbl table { min-width: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- pipeline: one stage at a time ---------- */
.ptabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 2px 10px; margin-bottom: 2px;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.ptabs::-webkit-scrollbar { display: none; }
.ptab {
  flex: 0 0 auto; scroll-snap-align: center;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 999px;
  background: transparent; color: var(--faint); cursor: pointer;
  font-family: var(--label); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.ptab b {
  font-family: var(--body); font-size: 11px; letter-spacing: 0;
  color: var(--ghost); font-weight: 600;
}
.ptab:hover { color: var(--muted); border-color: var(--line); }
.ptab.on { color: var(--gold); border-color: var(--gold-dim); background: rgba(224, 189, 133, 0.07); }
.ptab.on b { color: var(--gold); }

.pstage {
  background: var(--card); border: 1px solid var(--line-ink); border-radius: var(--r);
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.pstage-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 2px 4px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 2px;
}
.pstage-head span {
  font-family: var(--display); font-size: 15px; letter-spacing: 0.09em; color: var(--text);
}
.pstage-head b {
  font-family: var(--body); font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.04em; color: var(--muted);
}

/* ---------- milestone strip ---------- */
.msel { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.msel-b {
  position: relative; padding: 6px 9px; cursor: pointer;
  border: 1px solid var(--line-soft); border-radius: var(--r); background: transparent;
  color: var(--ghost); font-family: var(--label); font-size: 9.5px;
  letter-spacing: 0.09em; text-transform: uppercase;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.msel-b:hover { color: var(--muted); border-color: var(--line); }
.msel-b.done { color: var(--gold-2); border-color: var(--gold-dim); background: rgba(224, 189, 133, 0.06); }
.msel-b.now { color: var(--bg); background: var(--grad-gold); border-color: transparent; font-weight: 600; }
.msel-b.now:hover { color: var(--bg); }

/* ---------- money card ---------- */
.qcard {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); padding: 14px 16px; margin-top: 14px;
}
.qhead {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--label); font-size: 10.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 12px;
}
.qpill {
  font-family: var(--body); font-size: 10px; letter-spacing: 0.06em; text-transform: none;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.qpill.sent { color: var(--info); border-color: rgba(161, 199, 222, 0.35); }
.qpill.accepted { color: var(--ok); border-color: rgba(140, 192, 122, 0.35); }
.qline {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft);
}
.qline:last-of-type { border-bottom: 0; }
.qline span { font-size: 12px; color: var(--muted); letter-spacing: 0.03em; }
.qline b { font-family: var(--body); font-size: 14px; font-weight: 600; color: var(--text); }
.qline em {
  display: block; font-style: normal; font-size: 10.5px;
  color: var(--faint); letter-spacing: 0.04em; margin-top: 1px;
}
.qrow { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }

/* ---------- hand-sent reply ---------- */
.reply { margin-top: 4px; }
.reply textarea {
  width: 100%; resize: vertical; min-height: 92px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 12px; color: var(--text);
  font-family: var(--body); font-size: 13px; line-height: 1.55;
}
.reply textarea:focus { outline: 0; border-color: var(--gold-dim); }

.xlinks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- milestone micro-strip on a pipeline card ---------- */
.mstrip {
  display: flex; align-items: center; gap: 3px;
  margin: 9px 0 2px; height: 3px;
}
.mstrip i {
  display: block; height: 3px; flex: 1 1 0; border-radius: 2px;
  background: var(--line-soft);
}
.mstrip i.on { background: var(--gold-dim); }
.mstrip i.on:last-of-type { background: var(--gold); }
.mstrip .mnow {
  flex: 0 0 auto; margin-left: 6px;
  font-family: var(--label); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58%;
}
