/* Digital Dreamer — brand-aligned styles (Inter typography) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Caveat:wght@400;500;600;700&display=swap');

:root {
  --coral: #EA5691;
  --coral-hover: #d94680;
  --coral-soft: #FFC9DE;
  --pastel-pink: #FFBFBA;
  --pastel-yellow: #FFFDBA;
  --pastel-green: #BAFFC9;
  --pastel-blue: #BADFFF;
  --pastel-purple: #D2B4DE;
  --indigo: #5A3EDC;
  --indigo-soft: #DCD3FF;
  --mint: #AFF8DB;
  --sky: #ACE7FF;
  --peach: #FFCFC9;
  --lavender: #ECD4FF;
  --bg: #FAF7FF;
  --surface: #FFFFFF;
  --surface-2: #F4EFFC;
  --border: #EAE3F4;
  --border-strong: #D8CCF0;
  --text: #2A1F4E;
  --text-dim: #786B9E;
  --text-soft: #9D90C2;
  --accent: var(--coral);
  --accent-hover: var(--coral-hover);
  --success: #4FC58A;
  --warning: #F2B056;
  --danger: #E96B7F;
  --info: #6EB5FF;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 6px rgba(90, 62, 220, 0.06);
  --shadow: 0 6px 20px rgba(90, 62, 220, 0.08);
  --shadow-lg: 0 14px 40px rgba(90, 62, 220, 0.12);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(234, 86, 145, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(174, 231, 255, 0.18) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 0 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.sidebar .brand {
  padding: 0 18px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  text-align: center;
}
.sidebar .brand img {
  width: 100%;
  max-width: 210px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.sidebar .brand .tag {
  font-size: 9.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
  font-weight: 600;
  opacity: 0.7;
}
.nav { list-style: none; padding: 0; margin: 0; }
.nav li a {
  display: block;
  padding: 11px 24px;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.18s ease;
}
.nav li a:hover { background: var(--surface-2); color: var(--text); }
.nav li a.active {
  color: var(--coral);
  border-left-color: var(--coral);
  background: linear-gradient(90deg, var(--coral-soft) 0%, transparent 80%);
  font-weight: 600;
}
.nav .nav-section {
  padding: 18px 24px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-soft);
  font-weight: 600;
}

.main { flex: 1; padding: 36px 44px; overflow-x: auto; }
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 28px;
}
.page-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.page-header .actions { display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 18px; }
.grid.cols-5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card h3 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  font-weight: 600;
}
.kpi {
  font-size: 30px;
  font-weight: 700;
  margin: 4px 0;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: -0.8px;
}
.kpi-sub { font-size: 12px; color: var(--text-dim); font-weight: 500; }

.grid.cols-4 .card:nth-child(4n+1) { background: linear-gradient(135deg, #FFF 60%, var(--coral-soft)); }
.grid.cols-4 .card:nth-child(4n+2) { background: linear-gradient(135deg, #FFF 60%, var(--pastel-yellow)); }
.grid.cols-4 .card:nth-child(4n+3) { background: linear-gradient(135deg, #FFF 60%, var(--pastel-blue)); }
.grid.cols-4 .card:nth-child(4n+4) { background: linear-gradient(135deg, #FFF 60%, var(--mint)); }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 14px 18px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.empty-state {
  padding: 48px;
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
}
.empty-state a { color: var(--coral); text-decoration: none; font-weight: 600; }
.empty-state a:hover { text-decoration: underline; }

/* ---------- Buttons (unified pill style) ---------- */
.btn, .btn-select {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.1px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  line-height: 1;
}
.btn:hover, .btn-select:hover {
  border-color: var(--coral);
  color: var(--coral);
}
.btn:active { transform: translateY(0); }
/* Primary CTA — filled coral */
.btn.primary, .btn.cta {
  background: var(--coral);
  color: white;
  border-color: var(--coral);
  box-shadow: 0 4px 12px rgba(234, 86, 145, 0.25);
}
.btn.primary:hover, .btn.cta:hover {
  background: var(--coral-hover);
  border-color: var(--coral-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(234, 86, 145, 0.32);
}
/* Legacy: default .btn without .secondary used to mean primary — keep that working
   by treating a bare .btn that's NOT .secondary/.ghost/.danger as primary CTA. */
.btn:not(.secondary):not(.ghost):not(.danger):not(.primary):not(.cta):not(.sm) {
  background: var(--coral);
  color: white;
  border-color: var(--coral);
  box-shadow: 0 4px 12px rgba(234, 86, 145, 0.25);
}
.btn:not(.secondary):not(.ghost):not(.danger):not(.primary):not(.cta):not(.sm):hover {
  background: var(--coral-hover);
  border-color: var(--coral-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(234, 86, 145, 0.32);
}
.btn.secondary { /* explicit secondary — same as base unified style */ }
.btn.danger {
  background: var(--danger); color: white; border-color: var(--danger);
  box-shadow: 0 4px 12px rgba(233,107,127,0.25);
}
.btn.danger:hover { background: #d65566; border-color: #d65566; color: white; }
.btn.sm {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  border-width: 1px;
  box-shadow: none;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
  box-shadow: none;
}
.btn.ghost:hover { color: var(--coral); background: var(--coral-soft); border-color: transparent; }

/* Select styled to match button pill in action bars */
.btn-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 36px 0 16px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%23786B9E' d='M2 4l4 4 4-4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-transform: capitalize;
}

/* ---------- Forms ---------- */
.form-row { display: flex; gap: 12px; margin-bottom: 14px; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
input, select, textarea {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(234, 86, 145, 0.12);
}
textarea { resize: vertical; min-height: 80px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}
.badge.green { background: var(--pastel-green); color: #1d7a3e; border-color: #a3edb6; }
.badge.yellow { background: var(--pastel-yellow); color: #8a6d12; border-color: #efe9a0; }
.badge.red { background: var(--coral-soft); color: #b73561; border-color: #ffb1cd; }
.badge.blue { background: var(--pastel-blue); color: #2b5e94; border-color: #9fcaf2; }
.badge.gray { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }
.badge.purple { background: var(--lavender); color: #6534a4; border-color: #d4b3f0; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(42, 31, 78, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h3 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.modal .modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px;
  padding-top: 18px; border-top: 1px solid var(--border);
}

/* ---------- Misc ---------- */
.row { display: flex; gap: 16px; align-items: center; }
.row.between { justify-content: space-between; }
.mono {
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--indigo);
}
.muted { color: var(--text-dim); }
.text-right { text-align: right; }
.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin: 28px 0 14px;
  font-weight: 600;
}
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.progress {
  background: var(--surface-2);
  height: 8px;
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--coral) 0%, #f08eb4 100%);
  transition: width 0.3s;
  border-radius: var(--radius-pill);
}

a { color: var(--coral); }
a:hover { color: var(--coral-hover); }

.hero-banner {
  background: linear-gradient(135deg, var(--coral) 0%, #B28DFF 100%);
  color: white;
  padding: 28px;
  border-radius: var(--radius);
  margin-bottom: 28px;
  border: none !important;
  box-shadow: var(--shadow);
}
.hero-banner h2, .hero-banner .kpi { color: white; }
.hero-banner .kpi-sub, .hero-banner .muted { color: rgba(255,255,255,0.85); }

.invoice-doc {
  max-width: 820px;
  margin: 0 auto;
}
/* Clean capture state for direct PDF export (html2pdf) — no card chrome */
.invoice-doc.pdf-export {
  box-shadow: none !important;
  border: none !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Compact payment block on invoice */
.pay-block {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.5;
}
.pay-block .pay-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  font-weight: 700;
  margin: 0 0 10px;
}
.pay-block .pay-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.pay-block .pay-cols > div > .pay-label {
  font-weight: 700;
  color: var(--text);
  font-size: 11px;
  margin-bottom: 3px;
}
.pay-block .pay-cols .mono { font-size: 11px; }
.pay-block .pay-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
  color: var(--text-dim);
  font-style: italic;
  font-size: 11px;
}

/* Upcoming payments mini-schedule */
.upcoming-sched {
  margin-top: 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--coral-soft) 0%, var(--lavender) 100%);
  border-radius: var(--radius-sm);
}
.upcoming-sched .pay-title { color: var(--text); }
.upcoming-sched .sched-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.5);
}
.upcoming-sched .sched-row:last-child { border-bottom: none; }
.upcoming-sched .sched-row .sched-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.upcoming-sched .sched-row.current .sched-marker { background: var(--coral); color: white; }
.upcoming-sched .sched-row.paid .sched-marker { background: var(--success); color: white; }
.upcoming-sched .sched-row.pending .sched-marker { background: white; color: var(--text-dim); border: 1.5px solid var(--border-strong); }
.upcoming-sched .sched-row .sched-label { flex: 1; font-weight: 500; }
.upcoming-sched .sched-row.current .sched-label { font-weight: 700; }
.upcoming-sched .sched-row .sched-meta { color: var(--text-dim); font-size: 11px; }
.upcoming-sched .sched-row .sched-amt { font-weight: 700; min-width: 90px; text-align: right; }

@page { size: letter; margin: 0.75in; }

@media print {
  .sidebar, .page-header, .no-print, .btn, .btn-select { display: none !important; }
  body { background: white !important; background-image: none !important; }
  .main { padding: 0 !important; }
  .card, .invoice-doc { box-shadow: none !important; border: none !important; padding: 0 !important; }
  .invoice-doc table { page-break-inside: avoid; }
}

/* ---------- Tile cards (clickable dashboard tiles) ---------- */
.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--coral);
}
.tile:hover .tile-arrow { transform: translateX(4px); color: var(--coral); }
.tile .tile-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.tile .tile-head h3 { margin: 0; }
.tile .tile-arrow {
  font-size: 16px;
  color: var(--text-soft);
  transition: transform 0.15s ease, color 0.15s ease;
}
.tile .tile-kpi {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin: 2px 0 4px;
}
.tile .tile-body { margin-top: 4px; }
/* Override default card background gradient for tiles in a cols-3 grid */
.grid.cols-3 .tile { background: var(--surface) !important; }
/* One-screen project dashboard tiles */
.proj-tile { display: flex; flex-direction: column; min-height: 128px; }
.proj-tile-ic { font-size: 22px; line-height: 1; }
.proj-tile-kpi { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; margin-top: 8px; line-height: 1; }
/* Inline client picker — searchable + create-in-place */
.client-picker{position:relative}
.cp-field{display:flex;align-items:center;gap:4px;border:1px solid var(--border);border-radius:10px;background:var(--surface);padding:0 6px 0 12px;height:40px;transition:border-color .15s,box-shadow .15s}
.cp-field:focus-within{border-color:var(--indigo,#5A3EDC);box-shadow:0 0 0 3px rgba(90,62,220,.12)}
.cp-input{flex:1;border:0;background:none;outline:none;font:inherit;font-size:14px;color:var(--text);height:38px}
.cp-x{border:0;background:none;color:var(--text-dim);font-size:18px;line-height:1;cursor:pointer;padding:2px 6px;border-radius:6px;opacity:0;transition:opacity .12s,background .12s}
.client-picker.has-value .cp-x{opacity:1}
.cp-x:hover{background:var(--surface-2,#F2EEFB);color:var(--text)}
.cp-menu{position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:60;background:var(--surface,#fff);border:1px solid var(--border,#EAE3F4);border-radius:12px;box-shadow:0 12px 34px rgba(34,26,61,.14);padding:6px;max-height:280px;overflow:auto;display:none}
.cp-menu.open{display:block}
.cp-opt{padding:9px 12px;border-radius:8px;font-size:14px;color:var(--text);cursor:pointer;display:flex;align-items:baseline;gap:8px}
.cp-opt:hover{background:var(--surface-2,#F2EEFB)}
.cp-sub{font-size:12px;color:var(--text-dim)}
.cp-empty{padding:10px 12px;font-size:13px;color:var(--text-dim)}
.cp-create{padding:10px 12px;border-radius:8px;font-size:14px;font-weight:600;color:var(--indigo,#5A3EDC);cursor:pointer;margin-top:4px;border-top:1px solid var(--border)}
.cp-create:hover{background:var(--indigo-soft,#EEE9FC)}
/* Publish status pill (engagement page) */
.pubctl{display:inline-flex;align-items:center;gap:8px}
.pub-pill{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:700;padding:5px 11px;border-radius:999px;white-space:nowrap}
.pub-pill.dirty{background:var(--amber-soft,#FBEEDD);color:#9A6316}
.pub-pill.clean{background:var(--green-soft,#E4F5EC);color:#1E7A4B}

/* PROPOSAL COVER */
.proposal-cover {
  position: relative;
  min-height: 980px;
  padding: 48px 56px 48px;
  display: flex;
  flex-direction: column;
  margin-bottom: 28px;
}
.proposal-cover .cover-logo img {
  width: 96px;
  height: auto;
}
.proposal-cover .cover-body {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 60px;
  align-items: flex-start;
  margin-top: 360px;
}
.proposal-cover .cover-title {
  font-family: var(--font-display);
  color: var(--text);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.05;
}
.proposal-cover .cover-title-prefix {
  font-size: 44px;
}
.proposal-cover .cover-title-code {
  font-size: 56px;
  color: var(--coral);
}
.proposal-cover .cover-title-kind {
  font-size: 44px;
  margin-top: 28px;
}
.proposal-cover .cover-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  font-size: 13px;
  line-height: 1.55;
}
.proposal-cover .cover-col-label {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 4px;
}
.proposal-cover .cover-col-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}
.proposal-cover .cover-col-line {
  color: var(--text);
}
.proposal-cover .cover-col-line.muted {
  color: var(--text-dim);
}
.proposal-cover .cover-client-logo {
  margin-top: 14px;
  max-width: 180px;
}
.proposal-cover .cover-client-logo img {
  max-width: 100%;
  max-height: 90px;
  height: auto;
  object-fit: contain;
  display: block;
}

@media print {
  .proposal-cover {
    page-break-after: always;
    min-height: 0;
    padding: 0;
    margin: 0;
    box-shadow: none !important;
    border: none !important;
  }
  .proposal-cover .cover-body { margin-top: 36vh; }
  .proposal-body {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin-top: 0;
    width: auto !important;
    max-width: 100% !important;
    min-height: 0 !important;
  }
}

/* Proposal cover fills its printed page within the standard page margins.
   Sized to the printable area (not the full sheet) so the browser doesn't
   shrink the whole document, and tall enough to fill top-to-bottom. */
@media print {
  .proposal-cover.style-indigo {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 9.3in !important;
    height: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
    padding: 0.55in 0.6in !important;
    page-break-after: always;
  }
}

/* Portal: compact project tiles (so phase 1 alone clearly shows as a tile) */
.project-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 400px));
  gap: 16px;
  margin-bottom: 12px;
}
.project-tile {
  display: flex;
  flex-direction: column;
}

/* Proposal print headings */
.prop-heading {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

/* Portal: tile click-to-reveal */
.project-tile {
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  border: 1.5px solid var(--border);
}
.project-tile:hover {
  border-color: var(--coral);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.project-tile.selected {
  border-color: var(--coral);
  background: linear-gradient(135deg, #FFF 60%, var(--coral-soft));
  box-shadow: var(--shadow);
}
.project-tile .tile-reveal-hint {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--coral);
  text-align: center;
}
.project-tile.selected .tile-reveal-hint { color: var(--text); }

/* ---------- Proposal Cover · Option B (Indigo Authority) ---------- */
.proposal-cover.style-indigo {
  background: #2A1F4E !important;
  color: white;
  min-height: 920px;
  padding: 48px 56px !important;
  display: flex;
  flex-direction: column;
  page-break-after: always;
  border: none !important;
  border-radius: var(--radius) !important;
}
.proposal-cover.style-indigo .cover-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.proposal-cover.style-indigo .cover-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}
.proposal-cover.style-indigo .cover-logo-badge {
  width: 72px;
  height: 72px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  flex-shrink: 0;
}
.proposal-cover.style-indigo .cover-logo-badge img {
  width: 100%;
  height: auto;
  display: block;
}
.proposal-cover.style-indigo .cover-brand-text {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 700;
  color: white;
}
.proposal-cover.style-indigo .cover-brand-tag {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  margin-top: 4px;
  max-width: 320px;
  line-height: 1.4;
}
.proposal-cover.style-indigo .cover-top-right {
  text-align: right;
  color: rgba(255,255,255,0.8);
  font-size: 11px;
}
.proposal-cover.style-indigo .cover-issued {
  font-size: 11px;
  letter-spacing: 0.5px;
}
.proposal-cover.style-indigo .cover-issued-label {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 10px;
  color: #EA5691;
  margin-right: 4px;
}
.proposal-cover.style-indigo .cover-number {
  font-size: 13px;
  color: white;
  font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.proposal-cover.style-indigo .cover-hero {
  margin-top: auto;
  padding-top: 100px;
}
.proposal-cover.style-indigo .cover-kicker {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: 800;
  color: #EA5691;
  margin-bottom: 14px;
}
.proposal-cover.style-indigo .cover-title-big {
  font-family: var(--font-display);
  font-size: 68px;
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -2.5px;
  color: white;
  margin-bottom: 24px;
}
.proposal-cover.style-indigo .cover-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.proposal-cover.style-indigo .cover-code-chip {
  display: inline-block;
  background: #EA5691;
  color: white;
  padding: 7px 14px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  font-variant-numeric: tabular-nums;
}
.proposal-cover.style-indigo .cover-meta-chip {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.3px;
}
.proposal-cover.style-indigo .cover-foot {
  margin-top: auto;
  padding-top: 28px;
  border-top: 1px solid rgba(255,255,255,0.2);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.proposal-cover.style-indigo .cover-col-label {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 800;
  color: #EA5691;
  margin-bottom: 10px;
}
.proposal-cover.style-indigo .cover-col-name {
  font-size: 17px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.proposal-cover.style-indigo .cover-col-line {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin-bottom: 2px;
  line-height: 1.5;
}
.proposal-cover.style-indigo .cover-client-badge {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  background: white;
  border-radius: 8px;
  padding: 10px 14px;
}
.proposal-cover.style-indigo .cover-client-badge img {
  max-height: 40px;
  max-width: 160px;
  height: auto;
  width: auto;
  display: block;
}

@media print {
  .proposal-cover.style-indigo {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}


/* ---------- Sign pad modal ---------- */
.sign-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sign-tab {
  padding: 10px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  background: transparent;
  border-radius: 0;
  margin-bottom: -1px;
}
.sign-tab.active { color: var(--coral); border-bottom-color: var(--coral); }

.sign-canvas-wrap, .sign-typed-wrap {
  background: var(--surface-2);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  position: relative;
  height: 160px;
  overflow: hidden;
}
.sign-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  display: block;
  touch-action: none;
}
.sign-canvas-baseline {
  position: absolute;
  left: 24px; right: 24px; bottom: 38px;
  height: 1px;
  background: var(--border-strong);
  pointer-events: none;
}
.sign-canvas-x {
  position: absolute;
  left: 24px; bottom: 42px;
  font-size: 18px;
  color: var(--text-dim);
  pointer-events: none;
  font-family: var(--font-body);
}
.sign-typed-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: 'Caveat', cursive;
  font-size: 56px;
  color: var(--text);
  line-height: 1;
  padding: 0 24px;
}
.sign-typed-preview.empty { color: var(--text-soft); font-style: italic; font-size: 16px; font-family: var(--font-body); }

.sign-pad-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.sign-consent {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

/* Signed-state display in editor */
.signed-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--pastel-green) 0%, #d8f4e0 100%);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.signed-banner-img {
  width: 120px;
  height: 50px;
  background: white;
  border-radius: 6px;
  border: 1px solid #a3edb6;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.signed-banner-img img { max-width: 100%; max-height: 100%; }
.signed-banner-meta { flex: 1; font-size: 13px; }
.signed-banner-meta .mono { font-size: 11px; }

/* Printed signature in Acceptance */
.printed-sig {
  display: flex;
  align-items: flex-end;
  min-height: 44px;
  padding: 2px 0;
}
.printed-sig img { max-height: 44px; max-width: 260px; }
.printed-envelope {
  margin-top: 16px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'SF Mono', Consolas, monospace;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  letter-spacing: 0.5px;
}

/* ---------- Proposal preview rendered at 8.5x11 letter ---------- */
.invoice-doc.proposal-body {
  width: 816px;
  min-height: 1056px;
  max-width: 100%;
  margin: 0 auto;
  padding: 56px 64px !important;
  background: white;
  box-shadow: 0 4px 24px rgba(42, 31, 78, 0.12);
  border: none !important;
}
.proposal-cover.style-indigo {
  width: 816px;
  min-height: 1056px;
  max-width: 100%;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(42, 31, 78, 0.18);
}

/* ---------- Digitally Sign zone ---------- */
.sign-zone {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  margin-top: 18px;
  padding: 24px 28px;
  background: linear-gradient(135deg, var(--coral-soft) 0%, var(--lavender) 100%);
  border: 2px dashed var(--coral);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.sign-zone:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(234, 86, 145, 0.20);
  background: linear-gradient(135deg, #ffd5e6 0%, #f1ddff 100%);
}
.sign-zone:active { transform: translateY(0); }
.sign-zone-icon {
  width: 48px;
  height: 48px;
  background: var(--coral);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.sign-zone-text { flex: 1; }
.sign-zone-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.sign-zone-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.sign-zone-cta {
  background: var(--coral);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(234, 86, 145, 0.3);
}

/* Signed block (replaces signature grid when signed) */
.signed-block {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 18px;
  padding: 20px 24px;
  background: var(--pastel-green);
  border: 1px solid #a3edb6;
  border-radius: var(--radius);
}
.signed-block-sig {
  flex-shrink: 0;
  background: white;
  border-radius: 8px;
  padding: 8px 14px;
  border: 1px solid #a3edb6;
}
.signed-block-sig img {
  max-height: 60px;
  max-width: 220px;
  display: block;
}
.signed-block-meta { flex: 1; }

/* ========== Portal document groups ========== */
.doc-group { margin-top: 14px; }
.doc-group:first-child { margin-top: 6px; }
.doc-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* ========== Portal proposal tile & stepper ========== */
.prop-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.prop-portal-tile { padding: 20px 22px; }

.prop-stepper {
  display: flex;
  align-items: flex-start;
  margin: 20px 0 18px;
}
.prop-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 72px;
}
.prop-step-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface);
  flex-shrink: 0;
}
.prop-step.done .prop-step-dot  { background: #22c55e; border-color: #22c55e; color: #fff; }
.prop-step.active .prop-step-dot { background: var(--coral); border-color: var(--coral); color: #fff; }

.prop-step-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
}
.prop-step.done .prop-step-label  { color: var(--text); }
.prop-step.active .prop-step-label { color: var(--coral); }

.prop-step-date {
  display: block;
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  margin-top: 1px;
}
.prop-step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 15px 8px 0;
}
.prop-step-line.done { background: #22c55e; }

.prop-accepted-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: #15803d;
  font-weight: 600;
}
.prop-view-project {
  font-size: 12px;
  font-weight: 600;
  color: #15803d;
  text-decoration: none;
  white-space: nowrap;
  margin-left: 12px;
  opacity: 0.8;
}
.prop-view-project:hover { opacity: 1; text-decoration: underline; }

/* ========== Unsigned acceptance — signature action row ========== */
.sig-action-block {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.sig-action-alt {
  font-size: 13px;
  color: var(--text-dim);
}

.only-print { display: none; }
@media print {
  .sign-zone, .no-print { display: none !important; }
  .only-print { display: block !important; }
  .invoice-doc.proposal-body,
  .proposal-cover.style-indigo {
    width: auto !important;
    min-height: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* =====================================================================
   Phase 1 — Engagement Hub
   ===================================================================== */

/* Stage rail: Proposal → Project → Dashboard */
.stage-rail { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 22px; }
.stage-seg {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  text-decoration: none; transition: all .15s ease;
}
.stage-seg .stage-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-dim);
  font-size: 11px; font-weight: 700;
}
a.stage-seg.done { border-color: var(--border-strong); color: var(--text); }
a.stage-seg.done:hover { border-color: var(--coral); color: var(--coral); box-shadow: var(--shadow-sm); }
a.stage-seg.done:hover .stage-step { background: var(--coral-soft); color: var(--coral-hover); }
.stage-seg.active {
  background: linear-gradient(135deg, var(--coral) 0%, var(--indigo) 135%);
  border-color: transparent; color: #fff; box-shadow: var(--shadow);
}
.stage-seg.active .stage-step { background: rgba(255,255,255,.28); color: #fff; }
.stage-seg.todo { opacity: .5; cursor: default; }
.stage-arrow { color: var(--text-soft); font-weight: 700; padding: 0 2px; }

/* Engagement tile (home board) */
.eng-tile { display: flex; flex-direction: column; gap: 0; }
.eng-tile .eng-stat-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-dim); margin-bottom: 3px; font-weight: 600;
}
.eng-tile .eng-stat-val { font-weight: 700; font-size: 13px; }
.eng-stats-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  padding: 12px 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); margin-bottom: 12px;
}

/* Client-facing Dashboard */
.dash-hero {
  background: linear-gradient(135deg, var(--coral-soft) 0%, var(--lavender) 100%);
  border: none; border-radius: var(--radius); padding: 26px 28px; margin-bottom: 22px;
}
.dash-hero .dash-pct { font-size: 44px; font-weight: 800; line-height: 1; color: var(--text); }
.dash-progress { height: 12px; border-radius: var(--radius-pill); background: rgba(255,255,255,.55); overflow: hidden; }
.dash-progress > div { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--coral), var(--indigo)); }
.dash-timeline { list-style: none; margin: 0; padding: 0; }
.dash-timeline li {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.dash-timeline li:last-child { border-bottom: none; }
.dash-dot {
  flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%;
  margin-top: 3px; border: 2px solid var(--border-strong); background: var(--surface);
}
.dash-dot.done { background: var(--success); border-color: var(--success); }
.dash-dot.active { background: var(--coral); border-color: var(--coral); box-shadow: 0 0 0 4px var(--coral-soft); }
.dash-footer { margin-top: 26px; text-align: center; font-size: 12px; color: var(--text-soft); }

/* Phase 2 — actionable convert segment + deal lifecycle */
button.stage-seg { font: inherit; cursor: pointer; }
.stage-seg.convert {
  border-color: var(--coral); border-style: dashed;
  background: var(--coral-soft); color: var(--coral-hover);
}
.stage-seg.convert:hover { background: var(--coral); color: #fff; border-style: solid; box-shadow: var(--shadow-sm); }
.stage-seg.convert .stage-step { background: var(--coral); color: #fff; }

.lifecycle { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; margin-top: 6px; }
.life-step { font-weight: 600; color: var(--text-soft); }
.life-step.done { color: var(--text-dim); }
.life-step.current { color: var(--coral); font-weight: 700; }
.life-step.hold { color: var(--warning); font-weight: 700; }
.life-step.lost { color: var(--danger); font-weight: 700; }
.life-sep { color: var(--text-soft); }

/* Convert-to-project CTA card */
.convert-cta {
  background: linear-gradient(135deg, var(--coral-soft) 0%, var(--lavender) 100%);
  border: none; border-radius: var(--radius); padding: 26px 28px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.convert-cta h3 { margin: 0 0 4px; font-size: 17px; }

/* Phase 5 — files repository dropzone */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 24px; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone.dragover { border-color: var(--coral); background: var(--coral-soft); }
.dropzone .dz-inner { pointer-events: none; }

/* Phase 6 — breadcrumb + subtle motion polish */
.crumb { font-size: 12px; margin-bottom: 2px; }
.crumb a { color: var(--text-dim); text-decoration: none; transition: color .15s; }
.crumb a:hover { color: var(--coral); }
.card { transition: box-shadow .18s ease, transform .18s ease; }
.tile { transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }

/* ============================================================
   Design polish layer — Phase 2 (pass 1)
   Layered on top: refines depth, focus, and feedback app-wide
   without changing any existing layout. Shared admin + portal.
   ============================================================ */
:root{
  --shadow-sm: 0 1px 2px rgba(42,31,78,.04), 0 2px 8px rgba(42,31,78,.05);
  --shadow:    0 2px 6px rgba(42,31,78,.05), 0 12px 30px rgba(42,31,78,.08);
  --shadow-lg: 0 8px 24px rgba(42,31,78,.10), 0 24px 60px rgba(42,31,78,.12);
  --ring:      0 0 0 3px rgba(90,62,220,.16);
}
.btn, a, input, select, textarea, .badge {
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease;
}
.btn:active { transform: translateY(1px); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--indigo); box-shadow: var(--ring);
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
h1, h2, h3 { letter-spacing: -0.021em; }
::selection { background: var(--indigo-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* Sleek client project tiles — portal "Your Projects" */
.proj-card{display:flex;flex-direction:column;gap:14px;padding:20px}
.proj-card-top{display:flex;justify-content:space-between;align-items:flex-start;gap:14px}
.proj-card-title{font-size:16px;font-weight:700;line-height:1.3;letter-spacing:-.01em;color:var(--text)}
.proj-card-phase{margin-top:8px}
.donut{position:relative;width:66px;height:66px;flex:none}
.donut-ring{width:100%;height:100%;border-radius:50%;
  background:conic-gradient(var(--coral) calc(var(--pct,0)*1%), var(--surface-2) 0);
  -webkit-mask:radial-gradient(farthest-side,transparent 68%,#000 69%);
          mask:radial-gradient(farthest-side,transparent 68%,#000 69%);}
.donut-hole{position:absolute;inset:0;display:grid;place-items:center;font-weight:800;font-size:15px;letter-spacing:-.03em;color:var(--text)}
.proj-card-next{background:var(--surface-2);border-radius:12px;padding:11px 13px}
.pcn-label{font-size:10px;text-transform:uppercase;letter-spacing:.12em;font-weight:700;color:var(--text-soft);margin-bottom:3px}
.pcn-body{font-size:13px;color:var(--text);line-height:1.45}
.proj-card-foot{display:flex;justify-content:flex-end;margin-top:auto}
