/* =====================================================================
   Design system - shared by dashboard, approval page and customer portal
   Matches the email theme: warm stone page, white cards, navy ink + safety orange
   ===================================================================== */
:root {
  --bg: #f1ede6;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --surface-3: #f3efe8;
  --stroke: #ece6db;
  --stroke-hi: #d9d1c3;
  --navy: #14213d;
  --navy-2: #1d2d52;
  --ink: #14213d;
  --ink-2: #4a5368;
  --ink-3: #8a92a6;
  --text: #2a3142;
  --amber: #e8892b;
  --amber-2: #d97a1c;
  --amber-soft: #fff6ec;
  --amber-line: #f6d9b8;
  --blue: #3b6fd4;
  --mint: #1f9d63;
  --rose: #d64555;
  --violet: #6c4fd1;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(20,33,61,.08);
  --shadow-hi: 0 12px 32px rgba(20,33,61,.12);
  --hero-x: clamp(20px, 4vw, 40px);
  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-doc: "Source Serif 4", "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  font: 15px/1.55 var(--font-body); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); margin: 0; letter-spacing: -.02em; line-height: 1.12; color: var(--ink); }
h1 { font-size: clamp(1.7rem, 2.6vw, 2.35rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 .8em; }
a { color: var(--blue); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: .84rem; }
.mono { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 8px; }
::selection { background: #fbe0c2; }

/* ---------- background: warm paper + faint blueprint grid ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  radial-gradient(1100px 600px at 90% -10%, rgba(232,137,43,.10), transparent 60%),
  radial-gradient(900px 600px at -5% 110%, rgba(20,33,61,.07), transparent 60%), var(--bg); }
.aurora i { position: absolute; inset: 0; background-image:
  linear-gradient(rgba(20,33,61,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(20,33,61,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 78%); }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- card surface (class name kept from the old glass theme) ---------- */
.glass { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: var(--shadow); }
.glass.flat { box-shadow: none; background: var(--surface-2); }
.pad { padding: 22px 24px; }
.pad-sm { padding: 14px 16px; }

/* ---------- app shell: navy sidebar, like the email header ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 22px; padding: 22px; max-width: 1560px; margin: 0 auto; min-height: 100vh; }
.side { position: sticky; top: 22px; align-self: start; height: calc(100vh - 44px); display: flex; flex-direction: column; padding: 20px 14px;
  background: var(--navy); border-color: var(--navy); box-shadow: var(--shadow-hi); overflow: hidden; }
.side::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--amber); }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #1a1208; flex: none;
  background: var(--amber); box-shadow: 0 6px 16px rgba(232,137,43,.32); }
.brand b { font-family: var(--font-head); font-size: 1.02rem; display: block; line-height: 1.1; }
.side .brand b { color: #ffffff; }
.brand span { font-size: .74rem; color: var(--ink-3); }
.side .brand span { color: #9aa5c0; }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: #c3cadb; text-decoration: none; font-weight: 550; border: 1px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.07); color: #ffffff; }
.nav a.on { background: rgba(255,255,255,.11); color: #ffffff; box-shadow: inset 3px 0 0 var(--amber); }
.nav .count { margin-left: auto; background: var(--amber); color: #1a1208; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.side-foot { margin-top: auto; padding: 12px; display: grid; gap: 8px; }
.flag { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--ink-3); }
.side .flag { color: #9aa5c0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(31,157,99,.18); flex: none; }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(232,137,43,.22); }
.main { min-width: 0; padding-bottom: 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 4px 22px; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 62ch; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- sidebar open / collapse: click the logo (desktop only; phones get the top bar below) ---------- */
.shell { transition: grid-template-columns .22s ease; }
.side .brand-mark { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.side .brand-mark:hover { transform: scale(1.05); box-shadow: 0 8px 20px rgba(232,137,43,.42); }
.side .brand-mark:active { transform: scale(.97); }
@media (min-width: 881px) {
  .side-collapsed .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .side-collapsed .side { padding: 20px 10px; }
  .side-collapsed .brand { justify-content: center; padding: 4px 0 22px; }
  .side-collapsed .brand > div:not(.brand-mark), .side-collapsed .nav .t, .side-collapsed .side-foot { display: none; }
  .side-collapsed .nav a { justify-content: center; padding: 12px 0; position: relative; }
  .side-collapsed .nav .count { position: absolute; top: 4px; right: 6px; margin: 0; padding: 0 5px; font-size: .64rem; line-height: 1.5; }
}
@media (prefers-reduced-motion: reduce) { .shell, .side .brand-mark { transition: none; } }

/* ---------- buttons / inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 17px; border-radius: 10px; border: 1px solid var(--stroke-hi);
  background: var(--surface); color: var(--ink); font: 600 .92rem var(--font-body); cursor: pointer; text-decoration: none;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); border-color: #c9bfae; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--amber); color: #1a1208; border-color: var(--amber); box-shadow: 0 6px 16px rgba(232,137,43,.28); }
.btn.primary:hover { background: var(--amber-2); border-color: var(--amber-2); }
.btn.good { background: var(--mint); border-color: var(--mint); color: #ffffff; }
.btn.good:hover { background: #1a8655; border-color: #1a8655; }
.btn.danger { background: var(--surface); border-color: #f0c2c8; color: #b4233a; }
.btn.danger:hover { background: #fdeeef; border-color: #e7a3ad; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(20,33,61,.05); color: var(--ink); }
.btn.sm { padding: 7px 12px; font-size: .84rem; border-radius: 9px; }
.btn.block { width: 100%; }

label.field { display: grid; gap: 6px; font-size: .84rem; color: var(--ink-2); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid #ddd6ca; background: var(--surface); color: var(--ink);
  font: 500 .95rem var(--font-body); transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: #a3a9b8; }
.input:hover { border-color: #cbc1b0; }
.input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232,137,43,.18); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
textarea.input.code { font: 500 .84rem/1.55 ui-monospace, "SF Mono", Consolas, monospace; min-height: 460px; background: var(--surface-2); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--amber); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span2 { grid-column: 1 / -1; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 99px; font-size: .78rem; font-weight: 650; border: 1px solid var(--stroke); background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.pill.company { color: #a3560f; background: var(--amber-soft); border-color: var(--amber-line); }
.pill.customer { color: #2c4c8f; background: #edf2fc; border-color: #cbd8f3; }
.pill.done { color: #17754a; background: #e8f6ef; border-color: #bfe5d2; }
.pill.bad { color: #b4233a; background: #fdeeef; border-color: #f3c5cc; }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; position: relative; overflow: hidden; }
.stat b { display: block; font: 700 2rem/1 var(--font-head); letter-spacing: -.03em; margin-bottom: 6px; color: var(--ink); }
.stat span { color: var(--ink-2); font-size: .85rem; }
.stat.hot { border-color: var(--amber-line); }
.stat.hot::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--amber); }
.stat.hot b { color: var(--amber-2); }

/* ---------- pipeline board (the signature element) ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.lane { padding: 14px 12px 12px; min-height: 260px; }
.lane-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 12px; }
.lane-head h3 { font-size: .92rem; color: var(--ink); font-weight: 700; }
.lane-head .n { font-size: .78rem; font-weight: 700; color: var(--ink-2); background: var(--surface-3); border-radius: 99px; padding: 1px 9px; }
.lane-body { display: grid; gap: 10px; }
.pcard { display: block; text-decoration: none; color: inherit; padding: 13px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--stroke);
  transition: transform .15s, background .15s, border-color .15s, box-shadow .15s; cursor: pointer; }
.pcard:hover { background: var(--surface); border-color: var(--stroke-hi); box-shadow: var(--shadow); transform: translateY(-2px); }
.pcard b { display: block; font-weight: 700; color: var(--ink); }
.pcard .code { font-size: .74rem; color: var(--ink-3); }
.pcard .lbl { margin: 8px 0 10px; font-size: .84rem; color: var(--ink-2); }
.pcard.you { background: var(--amber-soft); border-color: var(--amber-line); box-shadow: inset 4px 0 0 var(--amber); }
.pcard.you:hover { background: #fff1e0; }
.empty { padding: 26px 12px; text-align: center; color: var(--ink-3); font-size: .86rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: start; }

/* ---------- lists / feed ---------- */
.list { display: grid; }
.li { display: flex; gap: 12px; align-items: center; padding: 12px 6px; border-top: 1px solid var(--stroke); text-decoration: none; color: inherit; }
.li:first-child { border-top: 0; }
a.li:hover { background: var(--surface-2); border-radius: 12px; }
.ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--amber-soft); border: 1px solid var(--amber-line); flex: none; color: var(--amber-2); }
.ico.blue { color: var(--blue); background: #edf2fc; border-color: #cbd8f3; }
.ico.mint { color: var(--mint); background: #e8f6ef; border-color: #bfe5d2; }
.ico.rose { color: var(--rose); background: #fdeeef; border-color: #f3c5cc; }
.ico.violet { color: var(--violet); background: #f1edfc; border-color: #d8cff5; }
.feed .li { align-items: flex-start; padding: 10px 4px; }
.feed .li b { font-weight: 600; }
.time { color: var(--ink-3); font-size: .76rem; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .74rem; color: var(--ink-3); font-weight: 700; padding: 8px 10px; text-transform: uppercase; letter-spacing: .06em; }
.tbl td { padding: 11px 10px; border-top: 1px solid var(--stroke); }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }

/* ---------- stepper: done = orange tick, now = navy, upcoming = grey (as in the emails) ---------- */
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; position: relative; }
.step { text-align: center; position: relative; padding-top: 2px; }
.step .bub { width: 34px; height: 34px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  background: #e6e8ee; border: 2px solid #e6e8ee; color: #8a92a6; position: relative; z-index: 1; }
.step::before { content: ""; position: absolute; top: 19px; left: -50%; width: 100%; height: 2px; background: #e3ddd2; }
.step:first-child::before { display: none; }
.step.done::before, .step.now::before { background: var(--amber); }
.step.done .bub { background: var(--amber); border-color: var(--amber); color: #ffffff; }
.step.now .bub { background: var(--navy); border-color: var(--navy); color: #ffffff; box-shadow: 0 0 0 5px rgba(20,33,61,.12); }
.step span { font-size: .8rem; color: #9aa1b2; font-weight: 600; }
.step.done span { color: var(--ink-2); }
.step.now span { color: var(--ink); font-weight: 700; }

/* ---------- document paper ---------- */
.paper { background: #fffdf9; color: #1b2234; border-radius: 14px; padding: clamp(22px, 4vw, 46px); font: 400 .98rem/1.7 var(--font-doc);
  border: 1px solid var(--stroke); box-shadow: inset 0 1px 0 #ffffff, 0 2px 8px rgba(20,33,61,.05); max-height: 72vh; overflow: auto; }
.paper h1 { font: 700 1.45rem/1.25 var(--font-doc); text-align: center; margin: 0 0 1.2rem; letter-spacing: 0; color: #0f1626; }
.paper h2 { font: 700 1.08rem/1.3 var(--font-doc); margin: 1.6rem 0 .5rem; letter-spacing: 0; color: #0f1626; }
.paper p { margin: 0 0 .7em; text-align: justify; hyphens: auto; }
.paper table { width: 100%; border-collapse: collapse; margin: .6rem 0 1rem; font-size: .93rem; }
.paper th, .paper td { border: 1px solid #ddd6ca; padding: 7px 10px; text-align: left; vertical-align: top; }
.paper th { background: var(--surface-3); }
.paper mark, .paper .gap { background: #ffe3b8; padding: 0 3px; border-radius: 3px; }

/* ---------- tabs ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--stroke); }
.tabs button { padding: 8px 15px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font: 600 .88rem var(--font-body); cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(20,33,61,.12); }

/* ---------- diff ---------- */
.diff { font: .8rem/1.55 ui-monospace, Consolas, monospace; border-radius: 12px; overflow: auto; max-height: 360px; background: var(--surface-2); border: 1px solid var(--stroke); padding: 8px 0; }
.diff div { padding: 1px 14px; white-space: pre-wrap; word-break: break-word; }
.d-add { background: #e3f5ec; color: #145c3b; } .d-add::before { content: "+ "; }
.d-del { background: #fdeaec; color: #9b2335; text-decoration: line-through; text-decoration-color: rgba(155,35,53,.45); } .d-del::before { content: "- "; }
.d-ctx { color: var(--ink-3); } .d-hunk { color: var(--ink-3); text-align: center; }

/* ---------- notices: the email call-out style ---------- */
.note { display: flex; gap: 12px; padding: 13px 15px; border-radius: 10px; background: var(--amber-soft); border: 1px solid var(--amber-line); border-left: 4px solid var(--amber); color: #7a4a12; font-size: .9rem; margin-bottom: 14px; }
.note.blue { background: #eef3fc; border-color: #cbd8f3; border-left-color: var(--blue); color: #284a85; }
.note.good { background: #eaf7f0; border-color: #c3e6d4; border-left-color: var(--mint); color: #17603f; }
.note.bad { background: #fdeef0; border-color: #f3c5cc; border-left-color: var(--rose); color: #9b2335; }
.note b { color: inherit; }
.note svg { flex: none; margin-top: 2px; }
.note > div { min-width: 0; }
.callout { padding: 18px 20px; border-radius: 14px; background: var(--amber-soft); border: 1px solid var(--amber-line); border-left: 4px solid var(--amber); }
.callout h3 { margin-bottom: 4px; }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(20,33,61,.42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); overflow: auto; }
.modal { width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 26px; animation: pop .22s ease-out; box-shadow: 0 24px 60px rgba(20,33,61,.25); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 10px; }
.toast { padding: 13px 18px; border-radius: 12px; max-width: 380px; font-weight: 550; animation: pop .22s ease-out; background: var(--navy); color: #ffffff; border-left: 4px solid var(--amber); box-shadow: var(--shadow-hi); }
.toast.ok { border-left-color: #3ccf8e; } .toast.err { border-left-color: #ff6b7d; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(20,33,61,.18); border-top-color: var(--amber); animation: rot .7s linear infinite; display: inline-block; }
.btn.primary .spin { border-color: rgba(26,18,8,.25); border-top-color: #1a1208; }
@keyframes rot { to { transform: rotate(360deg); } }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(100deg, #ebe6dd 30%, #f6f3ee 50%, #ebe6dd 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- public pages (approval / portal) ---------- */
.public { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.public.narrow { max-width: 820px; }
.topline { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.topline b { color: var(--ink); }

/* hero = the email's navy banner with the orange stripe underneath */
.hero { padding: 30px var(--hero-x) 28px; margin-bottom: 20px; background: var(--navy); border: 0; border-bottom: 4px solid var(--amber); overflow: hidden; color: #e6eaf3; box-shadow: var(--shadow-hi); }
.hero h1 { margin-bottom: 8px; color: #ffffff; }
.hero .muted { color: #c3cadb; }
.hero .faint { color: #9aa5c0; }
.hero .pill { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.18); color: #e6eaf3; }
.hero .ico.mint { background: rgba(60,207,142,.16); border-color: rgba(60,207,142,.4); color: #3ccf8e; }
.hero .btn:not(.primary) { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); color: #ffffff; }
.hero .btn:not(.primary):hover { background: rgba(255,255,255,.14); }
/* a stepper inside the hero sits on a light band below the stripe, exactly like the email */
.hero:has(.stepper) { border-bottom: 0; padding-bottom: 0; }
.hero .stepper { margin: 0 calc(-1 * var(--hero-x)); padding: 24px var(--hero-x) 22px; background: var(--surface-2); border-top: 4px solid var(--amber); }

.center-card { max-width: 480px; margin: 18vh auto 0; padding: 36px; text-align: center; border-top: 4px solid var(--amber); }
.sticky { position: sticky; top: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-weight: 600; color: var(--ink); word-break: break-word; }
.sep { height: 1px; background: var(--stroke); margin: 18px 0; border: 0; }
.amount { font: 700 clamp(1.9rem, 8vw, 2.6rem)/1.05 var(--font-head); letter-spacing: -.03em; color: var(--ink); }
.drop { border: 1.5px dashed var(--stroke-hi); border-radius: 12px; padding: 18px; text-align: center; color: var(--ink-2); cursor: pointer; background: var(--surface-2); }
.drop:hover { background: var(--amber-soft); border-color: var(--amber); }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--stroke); color: var(--ink-2); font-size: .8rem; margin: 4px 6px 0 0; }

@media (max-width: 1100px) { .two-col { grid-template-columns: minmax(0, 1fr); } .sticky { position: static; } }
@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 8px; }
  .brand { padding: 0 8px 0 4px; } .brand span { display: none; }
  .side::after { display: none; }
  .nav { grid-auto-flow: column; overflow-x: auto; } .nav a span.t { display: none; } .nav a { padding: 10px 12px; }
  .nav a.on { box-shadow: inset 0 -3px 0 var(--amber); }
  .side-foot { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stepper .step span { font-size: .68rem; }
}

/* find & replace bar above text editors */
.fr { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.fr .input { flex: 1 1 160px; padding: 8px 11px; font-size: .86rem; }
.fr .hint { font-size: .78rem; color: var(--ink-3); flex-basis: 100%; }
.board { grid-template-columns: repeat(5, minmax(190px, 1fr)); }

/* "See all" under capped lanes / lists, and the filter bar on list pages */
.lane { display: flex; flex-direction: column; }
.lane-body { flex: 1; align-content: start; }
.btn.more { margin-top: 10px; color: var(--ink-2); font-weight: 600; text-decoration: none; border: 1px dashed var(--stroke-hi); background: transparent; }
.btn.more:hover { color: var(--amber-2); border-style: solid; border-color: var(--amber-line); background: var(--amber-soft); }
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 14px; }
.filters select.input { cursor: pointer; }
.filters select.input option { background: #ffffff; color: var(--ink); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card-grid .empty { grid-column: 1 / -1; }
@media (max-width: 880px) { .filters { grid-template-columns: 1fr; } }

/* ---------- document library: group + document cards ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }   /* 3 group cards per row */
@media (max-width: 1100px) { .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .lib-grid { grid-template-columns: 1fr; } }
.lib-grid.docs { margin-top: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lib-card { --tone: var(--amber-2); --tone-bg: var(--amber-soft); --tone-line: var(--amber-line);
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--stroke); box-shadow: var(--shadow); color: inherit; text-decoration: none;
  overflow: hidden; transition: transform .16s, box-shadow .16s, border-color .16s; font: inherit; text-align: left; }
.lib-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--tone); }
.lib-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); border-color: var(--tone-line); }
.lib-card h3 { font-size: 1.12rem; line-height: 1.25; }
.lib-card p { color: var(--ink-2); font-size: .9rem; margin: 0; flex: 1; }
.lib-top { display: flex; align-items: center; justify-content: space-between; }
.lib-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--tone-bg); color: var(--tone); border: 1px solid var(--tone-line); }
.lib-ico.big { width: 52px; height: 52px; border-radius: 14px; }
.lib-num { font: 700 1.5rem/1 var(--font-head); color: var(--stroke-hi); letter-spacing: -.02em; }
.lib-docs { list-style: none; margin: 4px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--stroke); display: grid; gap: 7px; }
.lib-docs li { display: flex; gap: 8px; align-items: center; font-size: .86rem; color: var(--ink); }
.lib-docs li svg { color: var(--tone); flex: none; }
.lib-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--stroke); margin-top: 4px; }
.lib-foot > * { white-space: nowrap; }
.lib-open { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .86rem; color: var(--tone); }
.lib-card.doc:hover .lib-open svg { transform: translateX(3px); }
.lib-open svg { transition: transform .16s; }
.lib-card.add { align-items: center; justify-content: center; text-align: center; cursor: pointer; min-height: 200px;
  background: var(--surface-2); border: 1.5px dashed var(--stroke-hi); box-shadow: none; }
.lib-card.add::before { display: none; }
.lib-card.add:hover { background: var(--amber-soft); border-color: var(--amber); }
.lib-card.add b { color: var(--ink); }
/* tones per group (NDA amber, construction blue, subcontractor violet, vendor green, consultancy rose) */
.tone-blue { --tone: var(--blue); --tone-bg: #edf2fc; --tone-line: #cbd8f3; }
.tone-violet { --tone: var(--violet); --tone-bg: #f1edfc; --tone-line: #d8cff5; }
.tone-mint { --tone: var(--mint); --tone-bg: #e8f6ef; --tone-line: #bfe5d2; }
.tone-rose { --tone: var(--rose); --tone-bg: #fdeeef; --tone-line: #f3c5cc; }
.tone-amber { --tone: var(--amber-2); --tone-bg: var(--amber-soft); --tone-line: var(--amber-line); }
.lib-ico.tone-blue, .lib-ico.tone-violet, .lib-ico.tone-mint, .lib-ico.tone-rose, .lib-ico.tone-amber { background: var(--tone-bg); color: var(--tone); border-color: var(--tone-line); }

/* pipeline group filter + document tag on project cards */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip-btn { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--stroke-hi); background: var(--surface); color: var(--ink-2);
  font: 600 .84rem var(--font-body); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chip-btn:hover { color: var(--ink); border-color: #c9bfae; }
.chip-btn.on { background: var(--navy); border-color: var(--navy); color: #ffffff; }
.doc-tag { display: block; margin-top: 6px; font-size: .74rem; font-weight: 650; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.doc-pill { text-decoration: none; color: var(--ink); background: var(--surface); }
.pill.doc-pill:hover { border-color: var(--amber); }

/* new-document wizard */
.modal.wide { width: min(880px, 100%); }
.np-step { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; font: 700 .95rem var(--font-head); color: var(--ink); }
.np-step:first-of-type { margin-top: 4px; }
.np-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font: 700 .78rem var(--font-body); }
.np-groups { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
/* colours come from the .tone-* class every group button carries */
.np-group { display: grid; justify-items: center; gap: 8px; padding: 12px 8px; border-radius: 12px; border: 1px solid var(--stroke);
  background: var(--surface); cursor: pointer; font: 650 .82rem var(--font-body); color: var(--ink-2); text-align: center; transition: border-color .15s, background .15s; }
.np-group .lib-ico { width: 36px; height: 36px; border-radius: 10px; }
.np-group:hover { border-color: var(--tone-line); }
.np-group.on { border-color: var(--tone); background: var(--tone-bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--tone); }
.np-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.np-doc { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--stroke); background: var(--surface-2);
  text-align: left; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, background .15s; }
.np-doc b { color: var(--ink); font-size: .9rem; }
.np-doc span { color: var(--ink-2); font-size: .8rem; line-height: 1.4; }
.np-doc:hover { border-color: var(--stroke-hi); background: var(--surface); }
.np-doc.on { border-color: var(--amber); background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber); }
@media (max-width: 720px) { .np-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- sign-in page ---------- */
.login-wrap { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: 18px; padding: 32px 16px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand b { display: block; font: 700 1.15rem/1.1 var(--font-head); color: var(--ink); }
.login-brand span { font-size: .78rem; color: var(--ink-3); }
.login-card { width: min(420px, 100%); padding: 32px; border-top: 4px solid var(--amber); }
.login-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.login-card form { display: grid; gap: 14px; margin-top: 18px; }
.login-card .btn.block { margin-top: 4px; padding: 12px; }
.login-foot { max-width: 420px; text-align: center; margin: 0; }

/* password field with a show / hide eye button */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 46px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer;
  transition: color .15s, background .15s; }
.pw-eye:hover { color: var(--ink); background: var(--surface-3); }
.pw-eye[aria-pressed="true"] { color: var(--amber-2); }
input::-ms-reveal, input::-ms-clear { display: none; }   /* Edge's own reveal button would double up */

/* forgot password */
.forgot-row { display: flex; justify-content: flex-end; margin-top: -6px; }
.forgot-row a, .reset-links a, .link-btn { color: var(--amber-2); font-weight: 600; font-size: .86rem; text-decoration: none; }
.forgot-row a:hover, .reset-links a:hover, .link-btn:hover { text-decoration: underline; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--font-body); }
.reset-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--stroke); }
.reset-links form { display: contents; }
.reset-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 18px; padding: 0; counter-reset: s; }
.reset-steps li { flex: 1; counter-increment: s; font-size: .74rem; font-weight: 700; color: var(--ink-3); padding-top: 8px; border-top: 3px solid var(--stroke); }
.reset-steps li::before { content: counter(s) ". "; }
.reset-steps li.done { color: var(--ink-2); border-top-color: var(--amber); }
.reset-steps li.now { color: var(--ink); border-top-color: var(--navy); }
.code-input { font: 700 1.4rem/1 ui-monospace, Consolas, monospace; letter-spacing: .5em; text-align: center; padding: 14px; }

/* ---------- signed-in user (sidebar footer) ---------- */
.side-foot .me { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.me-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: rgba(255,255,255,.12); color: #ffffff; font: 700 .78rem var(--font-body); letter-spacing: .03em; }
.me-who { min-width: 0; }
.me-who b { display: block; color: #ffffff; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-who span { font-size: .74rem; color: #9aa5c0; }
.me-actions { display: flex; gap: 6px; }
.me-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 8px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,.14); background: transparent; color: #c3cadb; font: 600 .76rem var(--font-body); cursor: pointer; }
.me-btn:hover { background: rgba(255,255,255,.08); color: #ffffff; }
.time .by { color: var(--ink-2); font-weight: 650; }

/* ---------- Admin panel ---------- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { position: relative; width: 52px; height: 30px; border-radius: 99px; background: #d9d1c3; transition: background .18s; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 2px 6px rgba(20,33,61,.25); transition: transform .18s; }
.switch input:checked + .slider { background: var(--mint); }
.switch input:checked + .slider::after { transform: translateX(22px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--amber); outline-offset: 3px; }
.switch-label { font-weight: 700; color: var(--ink); min-width: 26px; }
.input.sm-input { padding: 6px 10px; font-size: .84rem; width: auto; }
.tbl tr.inactive td { opacity: .55; }
.tbl td .row .btn { white-space: nowrap; }
.decided { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; }

/* ---------- scrollbars ----------
   Hidden everywhere (scrolling with wheel, touch and keyboard still works), except inside documents:
   the document preview (.paper), the text editor (textarea.code) and change diffs get a slim modern bar. */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

.paper, textarea.input.code, .diff { scrollbar-width: auto; scrollbar-color: auto; }   /* opt back in for WebKit styling */
.paper::-webkit-scrollbar, textarea.input.code::-webkit-scrollbar, .diff::-webkit-scrollbar { display: block; width: 12px; height: 12px; }
.paper::-webkit-scrollbar-track, textarea.input.code::-webkit-scrollbar-track, .diff::-webkit-scrollbar-track { background: transparent; margin: 8px; }
.paper::-webkit-scrollbar-thumb, textarea.input.code::-webkit-scrollbar-thumb, .diff::-webkit-scrollbar-thumb {
  background: #d9d1c3; border-radius: 99px; border: 4px solid transparent; background-clip: padding-box; min-height: 40px; }
.paper:hover::-webkit-scrollbar-thumb, textarea.input.code:hover::-webkit-scrollbar-thumb, .diff:hover::-webkit-scrollbar-thumb { background-color: #c4b8a3; }
.paper::-webkit-scrollbar-thumb:hover, textarea.input.code::-webkit-scrollbar-thumb:hover, .diff::-webkit-scrollbar-thumb:hover { background-color: var(--amber); }
.paper::-webkit-scrollbar-thumb:active, textarea.input.code::-webkit-scrollbar-thumb:active, .diff::-webkit-scrollbar-thumb:active { background-color: var(--amber-2); }
.paper::-webkit-scrollbar-button, textarea.input.code::-webkit-scrollbar-button, .diff::-webkit-scrollbar-button,
.paper::-webkit-scrollbar-corner, textarea.input.code::-webkit-scrollbar-corner, .diff::-webkit-scrollbar-corner { display: none; background: transparent; }
/* Firefox has no ::-webkit-scrollbar; give it the thin themed bar instead */
@supports not selector(::-webkit-scrollbar) {
  .paper, textarea.input.code, .diff { scrollbar-width: thin; scrollbar-color: #c4b8a3 transparent; }
}

/* ---------- phones only (max 720px): layout fixes, laptop and tablet untouched ---------- */
@media (max-width: 720px) {
  /* one column, and let it shrink: documents and their tables scroll inside the document box */
  .two-col { grid-template-columns: minmax(0, 1fr) !important; }   /* also beats the editor's inline 2 columns */
  .two-col > * { min-width: 0; }
  .paper p { text-align: left; hyphens: manual; }                    /* justified text leaves gaps on a phone */

  /* wide tables (Admin users, Email log) scroll sideways inside their card, with a slim visible bar */
  table.tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: auto; scrollbar-color: auto; padding-bottom: 6px; }
  table.tbl th, table.tbl td { white-space: nowrap; }
  table.tbl::-webkit-scrollbar { display: block; height: 8px; }
  table.tbl::-webkit-scrollbar-track { background: transparent; }
  table.tbl::-webkit-scrollbar-thumb { background: #d9d1c3; border-radius: 99px; }

  /* approval page: "Signed in as ..." gets its own line instead of being squeezed */
  .topline { flex-wrap: wrap; row-gap: 8px; }
  .topline > .faint.small { order: 3; flex-basis: 100%; }
}
@supports not selector(::-webkit-scrollbar) {
  @media (max-width: 720px) { table.tbl { scrollbar-width: thin; scrollbar-color: #c4b8a3 transparent; } }
}
