/* Client onboarding portal — dark theme: black/red identity matching the main site */
:root {
  --bg: #0a0a0a;
  --bg-soft: #111111;
  --bg-card: #141414;
  --ink: #f5f5f5;
  --ink-soft: #d4d4d4;
  --muted: #a3a3a3;
  --line: rgba(255,255,255,.1);
  --line-dark: #f5f5f5;
  --accent: #e8262e;
  --accent-ink: #ffffff;
  --accent-dark: #b91c22;
  --danger: #ff5a5a;
  --ok: #4ade80;
  --warn: #fbbf24;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Inter", -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  background-image: radial-gradient(60% 40% at 50% 0%, rgba(232,38,46,.07), transparent);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--ink); }
.wrap { width: min(1120px, 92vw); margin: 0 auto; }

/* App shell: sidebar + main */
.app { display: flex; min-height: 100vh; }
/* p-header kept for the pre-auth pages (login + start) */
.p-header { background: #101010; color: #fff; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.p-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.p-nav { display: flex; align-items: center; gap: 6px; }
.p-nav a { color: #e8e8e8; text-decoration: none; font-size: 14px; padding: 8px 14px; border-radius: 8px; }
.p-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.brand-sub { font-size: 11px; color: #bdbdbd; letter-spacing: 1.5px; text-transform: uppercase; }
.sidebar {
  width: 266px; flex: none;
  background: #101010; color: #fff;
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand { padding: 22px 20px 18px; }
.snav { flex: 1; overflow-y: auto; padding: 6px 12px; display: flex; flex-direction: column; gap: 3px; }
.snav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 10px;
  color: #bdbdbd; text-decoration: none; font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.snav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.snav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.snav a.active { background: var(--accent); color: #fff; font-weight: 700; }
.snav a.active svg { opacity: 1; }
.snav .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: #777; padding: 14px 13px 6px; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-foot .linklike {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 13px; border-radius: 10px; background: transparent; border: 0; cursor: pointer;
  color: #bdbdbd; font-size: 14.5px; font-weight: 500; font-family: var(--font); text-align: left;
}
.sidebar-foot .linklike:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-foot .linklike svg { width: 19px; height: 19px; }
.main { flex: 1; min-width: 0; margin-left: 266px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: none; align-items: center; gap: 12px;
  background: #101010; color: #fff; padding: 12px 16px;
  position: sticky; top: 0; z-index: 55;
}
.topbar .brand-name { font-size: 14px; }
#menuBtn {
  background: rgba(255,255,255,.1); border: 0; color: #fff; border-radius: 8px;
  width: 38px; height: 38px; font-size: 18px; cursor: pointer; line-height: 1;
}
.scrim {
  display: none; position: fixed; inset: 0; z-index: 59;
  background: rgba(0,0,0,.45);
}
body.nav-open .scrim { display: block; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; }
  body.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .topbar { display: flex; }
}

/* Page head — more professional rhythm */
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.02em; margin: 0 0 6px; }
.page-head p { color: var(--muted); margin: 0; font-size: 15px; }

/* Main */
.p-main { flex: 1; padding: 36px 0 64px; }
.p-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0; color: var(--muted); font-size: 13px; background: var(--bg-soft);
}
.p-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Cards */
.card {
  background: rgba(255,255,255,.03);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.3px; }
.card .lede { color: var(--muted); margin: 0 0 20px; font-size: 14.5px; }

/* Forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: var(--font);
  border: 1.5px solid var(--line); border-radius: 10px; background: #1a1a1a; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,38,46,.18);
}
.input::placeholder, .textarea::placeholder { color: #777; }
.textarea { min-height: 110px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink);
  border: 1.5px solid var(--accent); border-radius: 10px;
  padding: 12px 22px; font-size: 15px; font-weight: 600; font-family: var(--font);
  cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .15s, background .15s;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); box-shadow: 0 6px 18px rgba(232,38,46,.35); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
/* Global button loading feedback: rotating spinner on any clicked .btn */
.btn.loading { pointer-events: none; }
.btn.loading::after {
  content: ""; display: inline-block; width: 13px; height: 13px; margin-left: 9px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: btnSpin .7s linear infinite; vertical-align: -1px;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.loading::after { animation-duration: 2.4s; } }
/* Real brand logo in the portal header (replaces the "UM" text mark) */
.brand-logo { height: 40px; width: 40px; border-radius: 50%; object-fit: cover; flex: none; }
/* Read receipts under your own chat messages */
.msg .seen { font-size: 11px; margin-top: 5px; opacity: .6; }
.msg .seen.read { opacity: 1; color: #1a9e4b; font-weight: 700; }
/* Chat day dividers */
.day-div { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; }
.day-div::before, .day-div::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day-div span {
  font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1px; background: var(--bg-soft); border: 1px solid var(--line);
  padding: 3px 12px; border-radius: 99px;
}
.msg .tm { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* Global top loading bar — shows on every API call */
#topLoader {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 9999;
  background: var(--accent); opacity: 0; pointer-events: none;
  box-shadow: 0 0 8px rgba(232,38,46,.5);
}
#topLoader.on { opacity: 1; }
#topLoader.done { opacity: 0; transition: width .25s ease, opacity .3s ease .1s !important; }
@media (prefers-reduced-motion: reduce) {
  #topLoader { transition: none !important; }
}

/* Branded invoice paper */
.inv-paper { padding: 34px; }
.inv-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 3px solid var(--ink); margin-bottom: 22px; }
.inv-brand { display: flex; gap: 14px; align-items: center; }
.inv-logo { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; }
.inv-co { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.inv-co-sub { font-size: 12.5px; color: var(--muted); }
.inv-contact { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.inv-title-block { text-align: right; }
.inv-title { font-size: 30px; font-weight: 800; letter-spacing: 3px; }
.inv-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 6px; }
.inv-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); font-weight: 700; margin-bottom: 3px; }
.inv-foot { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }

/* Professional contract signatures */
.contract-paper, .inv-paper {
  background: #fff; color: #111;
  --ink: #111111; --ink-soft: #3a3a3a; --muted: #6f6f6f;
  --line: #e9e9ea; --bg-soft: #f7f7f8; --bg-card: #ffffff;
  border: 1px solid #e9e9ea; border-radius: 12px; padding: 38px;
  box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
.contract-paper h1, .contract-paper h2 { letter-spacing: -0.01em; }
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 44px; padding-top: 26px; border-top: 2px solid var(--ink); }
@media (max-width: 640px) { .sig-grid { grid-template-columns: 1fr; } }
.sig-block .sig-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.sig-name { font-family: 'Segoe Script', 'Brush Script MT', 'Snell Roundhand', cursive; font-size: 34px; margin: 6px 0 2px; }
.sig-line { border-bottom: 1.5px solid var(--ink); padding-bottom: 6px; margin-bottom: 8px; min-height: 46px; }
.sig-meta { font-size: 13px; color: var(--muted); }
.co-stamp { width: 130px; height: 130px; margin: 4px 0 8px; }

@media print {
  .no-print, .sidebar, .topbar, .scrim, .p-footer, #topLoader { display: none !important; }
  .main { margin-left: 0 !important; }
  body { background: #fff !important; color: #111 !important; background-image: none !important; }
  .card, .contract-paper, .inv-paper {
    box-shadow: none !important; border: 1px solid #ddd !important;
    background: #fff !important; color: #111 !important; backdrop-filter: none !important;
  }
  .card *, .contract-paper *, .inv-paper * { color: #111 !important; border-color: #ddd !important; }
  .btn, .pill { background: #fff !important; color: #111 !important; border: 1px solid #111 !important; }
  .p-main { padding: 0; }
  .wrap { width: 100%; max-width: none; }
}
.btn-ghost { background: rgba(255,255,255,.05); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,.1); box-shadow: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 8px; }

/* Auth pages */
.auth-shell { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.auth-card { width: min(440px, 94vw); }
.auth-card .step { display: none; }
.auth-card .step.on { display: block; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.code-input {
  font-size: 30px !important; letter-spacing: 12px; text-align: center;
  font-weight: 700; padding: 14px 10px 14px 22px !important;
}
.form-err {
  display: none; background: rgba(255,90,90,.1); border: 1px solid rgba(255,90,90,.35); color: #ff8a8a;
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px;
}
.form-err.show { display: block; }
.form-ok {
  display: none; background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.35); color: #4ade80;
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px;
}
.form-ok.show { display: block; }
.resend-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13.5px; }
.link { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: underline; font-size: inherit; font-family: var(--font); }
.link:disabled { opacity: .5; cursor: not-allowed; }

/* Dashboard bits (Phase 0 shell) */
.page-head { margin-bottom: 26px; }
.page-head h1 { margin: 0 0 4px; font-size: 30px; letter-spacing: -0.6px; }
.page-head p { margin: 0; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-card { padding: 18px; }
.stat-card .num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.stat-card .lbl { color: var(--muted); font-size: 13px; margin-top: 6px; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
.stat { text-align: left; }
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 4px 12px; border-radius: 999px; background: var(--accent); color: #fff;
}
.pill.soft { background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line); }
.pill.ok { background: rgba(74,222,128,.12); color: #4ade80; }
.pill.warn { background: rgba(251,191,36,.12); color: #fbbf24; }
.pill.bad { background: rgba(255,90,90,.12); color: #ff8a8a; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #111; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--ink); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .page-head h1 { font-size: 24px; }
  .p-nav a span.lbl, .p-nav button.linklike span.lbl { display: none; }
}

/* ============================================================
   DESIGN SYSTEM v2 — audit fixes (14 Oct 2026)
   Canonical components live here. Page-level <style> blocks
   must not redefine these.
   ============================================================ */

/* ---- Type scale (single source of truth) ---- */
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.02em; margin: 0 0 10px; font-weight: 800; font-family: var(--font-display); }
h1 { font-size: clamp(26px, 3.4vw, 34px); }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.page-head { margin-bottom: 26px; }
.page-head h1 { margin: 0 0 6px; }
.page-head p { color: var(--muted); margin: 0; font-size: 15px; }
.card h2 { margin: 0 0 6px; }
/* Tabular figures for money, stats, dates */
.tabular, .stat-card .num, .stat .num, .inv-total, .tbl td { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.mt { margin-top: 18px; }

/* ---- Helper text + hint (global, not .field-scoped) ---- */
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.draft-note { font-size: 12.5px; color: var(--muted); }

/* ---- Generic label/value rows (used by dashboard, project, help, admin) ---- */
.review-row {
  display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.review-row:last-child { border-bottom: 0; }
.review-row > span:first-child, .review-row .k { color: var(--muted); font-weight: 600; font-size: 13px; }
.review-row .v { white-space: pre-wrap; word-break: break-word; }
@media (max-width: 640px) { .review-row { grid-template-columns: 1fr; gap: 2px; } }

/* ---- Project request rows (dashboard) ---- */
.req-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit; transition: background .15s;
}
.req-row:last-child { border-bottom: 0; }
.req-row:hover { background: rgba(255,255,255,.03); }
.req-row:hover .req-title { color: var(--accent); }
.req-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.req-meta { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.req-row .pill { flex: none; }

/* ---- Unified chat bubbles (canonical — replaces 3 page-level copies) ---- */
.chat-box { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; font-size: 14.5px; line-height: 1.55; background: var(--bg-soft); border: 1px solid var(--line); overflow-wrap: break-word; }
.msg.mine { align-self: flex-end; background: var(--accent); color: #fff; border-color: var(--accent); }
.msg img.att { max-width: 240px; border-radius: 8px; display: block; margin-top: 6px; cursor: zoom-in; }
.msg .tm { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.msg.mine .tm { color: rgba(255,255,255,.65); }
.msg .seen { font-size: 11px; margin-top: 5px; opacity: .75; }
.msg .seen.read { opacity: 1; color: #4ade80; font-weight: 700; }
.msg .who { font-size: 12px; font-weight: 700; margin-bottom: 4px; opacity: .8; }

/* ---- Unified timeline ---- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 8px 0; }
.tl-item::before { content: ""; position: absolute; left: -25px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: #0a0a0a; border: 2px solid var(--muted); }
.tl-item.done::before { background: var(--accent); border-color: var(--accent); }
.tl-item.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(232,38,46,.22); }
.tl-item .dt { font-size: 12.5px; color: var(--muted); }

/* ---- Unified progress bar ---- */
.prog { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.prog > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }

/* ---- Unified stat cards ---- */
.stat-card { padding: 18px; }
.stat-card .num, .stat .num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.stat-card .lbl, .stat .lbl { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---- Service picker cards (canonical — was start.html-only) ---- */
.track-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 640px) { .track-grid { grid-template-columns: 1fr; } }
.track-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: #1a1a1a; color: var(--ink); border: 1.5px solid var(--line); border-radius: 12px; padding: 16px;
  font-family: var(--font); transition: border-color .15s, box-shadow .15s, transform .12s;
}
.track-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.track-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.track-card b { display: block; font-size: 16px; margin-bottom: 4px; }
.track-card small { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.track-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,38,46,.18); }

/* ---- Keyboard focus (was missing everywhere) ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.snav a:focus-visible, .sidebar-foot .linklike:focus-visible { outline-color: #fff; }
.opt-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Responsive tables ---- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { min-width: 560px; }

/* ---- Sidebar contrast + token cleanup ---- */
.snav .nav-label { color: #a8a8a8; }
.sidebar, .topbar, .p-header { background: #101010; }
.nav-bdg { background: var(--accent); color: #fff; }
.snav a.active .nav-bdg { background: #fff; color: var(--accent); }

/* ---- Pills: single attention voice, no forced shout ---- */
.pill { letter-spacing: .3px; text-transform: none; font-size: 12.5px; }
.pill.soft { border: 0; padding: 5px 12px; }

/* ---- Top loader visible on dark pre-auth header ---- */
#topLoader { box-shadow: 0 0 0 1px rgba(255,255,255,.85), 0 0 8px rgba(0,0,0,.3); }

/* ---- Auth: single card width, no dead override ---- */
.auth-card { width: min(440px, 94vw); max-width: none; }
.auth-shell { min-height: 60vh; }

/* ---- Print: keep document structure ---- */
@media print {
  .card, .contract-paper, .inv-paper { border: 1px solid #ddd; }
  .inv-head { border-bottom: 3px solid #111; }
  .tbl th { border-bottom: 2px solid #111; }
}

/* ---- Invoice: responsive meta, tighter totals, mono bank details ---- */
.inv-total { line-height: 1.9; }
@media (max-width: 640px) {
  .inv-meta-grid { grid-template-columns: 1fr; }
  .inv-paper { padding: 22px; }
  .contract-paper { padding: 22px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
.bank-box .mono, .bank-box { font-variant-numeric: tabular-nums; }
.inv-title { letter-spacing: 1.5px; }

/* ---- Contract readability ---- */
.contract-paper .body-html { max-width: 72ch; }
.contract-paper h1 { font-size: 28px; }
.contract-paper h2 { font-size: 20px; }

/* ---- Section rhythm ---- */
.sec-head { margin: 22px 0 12px; font-size: 18px; }

/* ---- Password show/hide ---- */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 64px; }
.pw-show {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 6px 8px; font-family: var(--font);
}
.pw-show:hover { color: var(--ink); }

/* ---- Severity-differentiated alert cards ---- */
.alert-card { border-left: 4px solid var(--ink); }
.alert-card.danger { border-left-color: var(--danger); }

/* ---- Clickable stat cards ---- */
a.stat-card { text-decoration: none; color: inherit; display: block; transition: transform .15s ease, box-shadow .15s ease; }
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
a.act-item { text-decoration: none; color: inherit; }

/* ---- Sticky contract sign bar ---- */
.sign-sticky {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(20,20,20,.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.sign-sticky b { font-size: 14.5px; }
.sign-sticky .btn { flex: none; }

/* ---- Review media remove button ---- */
.media-item { position: relative; display: inline-block; }
.media-item .rm {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.75); color: #fff; border: 0; cursor: pointer; font-size: 15px; line-height: 1;
}

/* ---- Keyboard-accessible file attach ---- */
.attach-label { position: relative; overflow: hidden; }
.attach-label input[type="file"].visually-hidden {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 100px;
}
.attach-label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================
   Motion layer — subtle entrance animations + branded loaders
   ============================================================ */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes logoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.82); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Page entrance: heads and cards rise in with a soft stagger */
.page-head { animation: riseIn .45s cubic-bezier(.22,.8,.32,1) both; }
.p-main .card { animation: riseIn .5s cubic-bezier(.22,.8,.32,1) both; }
.p-main .card:nth-child(2) { animation-delay: .06s; }
.p-main .card:nth-child(3) { animation-delay: .12s; }
.p-main .card:nth-child(4) { animation-delay: .18s; }
.p-main .card:nth-child(5) { animation-delay: .24s; }
.auth-card .card { animation: riseIn .5s cubic-bezier(.22,.8,.32,1) both; }

/* Sidebar link press feedback */
.snav a, .sidebar-foot .linklike { transition: background .15s, color .15s, transform .12s; }
.snav a:active, .sidebar-foot .linklike:active { transform: scale(.98); }

/* Branded button loader: dotted-sphere logo pulses instead of a generic spinner */
.btn.loading::after {
  content: ""; display: inline-block; width: 18px; height: 18px; margin-left: 9px;
  background: url(/assets/img/logo-light.png) center/contain no-repeat;
  border: 0; animation: logoPulse 1s ease-in-out infinite; vertical-align: -4px;
}
.btn-ghost.loading::after, .btn-ghost.loading::after {
  background-image: url(/assets/img/logo.png);
}

/* Branded inline loader for "Loading…" states */
.brand-loader {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 14px; padding: 40px 20px; justify-content: center;
}
.brand-loader::before {
  content: ""; width: 24px; height: 24px; flex: none;
  background: url(/assets/img/logo.png) center/contain no-repeat;
  animation: logoPulse 1s ease-in-out infinite;
}
.brand-loader.sm { padding: 12px; font-size: 13px; }
.brand-loader.sm::before { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .page-head, .p-main .card, .auth-card .card { animation: none; }
  .btn.loading::after, .brand-loader::before { animation-duration: 2.5s; }
}
