/* ══════════════════════════════════════════════════════════════════════════
   Nolea CRM — Brand Stylesheet
   Designer: Dais  |  Applied: 2026-03-15
   Brand: Nolea Champagne — ivory/burgundy/gold, editorial, minimal
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=Great+Vibes&family=Josefin+Sans:wght@100;200;300;400&family=Lora:ital,wght@0,400;0,500;1,400;1,500&display=swap');

/* ── Brand Tokens ── */
:root {
  /* Colors */
  --burgundy:     #4D0026;
  --burgundy-dark:#3a001c;
  --wine:         #850035;
  --ivory:        #F5EFE3;
  --ivory-warm:   #EDE5D4;
  --ivory-deep:   #E3D9C6;
  --gold:         #C4973A;
  --gold-light:   #D4A94A;
  --near-black:   #1A0F08;
  --muted:        #7a6a5a;
  --border-color: #D4C8B0;

  /* Functional aliases */
  --bg:           var(--ivory);
  --surface:      var(--ivory-warm);
  --surface-2:    var(--ivory-deep);
  --border:       var(--border-color);
  --text:         var(--near-black);
  --text-muted:   var(--muted);
  --accent:       var(--burgundy);
  --accent-hover: var(--burgundy-dark);
  --danger:       #a0291e;
  --success:      #1a5c36;
  --warning:      #8a5500;
  --warning-light:#f5ecd8;
  --brand-primary:   var(--burgundy);
  --brand-secondary: var(--ivory);
  --brand-accent:    var(--gold);
  --brand-near-black:var(--near-black);

  /* Typography */
  --font-serif:   'Cormorant Garamond', Georgia, serif;
  --font-heading: 'Lora', 'Cormorant Garamond', Georgia, serif;
  --font-script:  'Great Vibes', cursive;
  --font-sans:    'Josefin Sans', sans-serif;
  --font-brand:   var(--font-serif);

  /* Layout */
  --nav-height:    64px;
  --header-height: 56px;
  --radius:        4px;
  --radius-lg:     6px;
  --shadow:        0 1px 4px rgba(77,0,38,.07);
  --shadow-md:     0 4px 16px rgba(77,0,38,.12);
}

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  font-style: italic;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
#app { display: flex; flex-direction: column; height: 100%; }

/* ── Header ── */
header {
  height: var(--header-height);
  background: var(--burgundy);
  border-bottom: 1px solid rgba(196,151,58,.3);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

header h1 {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--ivory);
}

header .header-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

header .header-right button {
  background: none;
  border: none;
  color: rgba(245,239,227,0.65);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  min-height: 44px;
  min-width: 44px;
  transition: color .15s;
}

header .header-right button:hover { color: var(--ivory); }

/* ── Tab content ── */
.tab-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + 20px);
  background: var(--bg);
}

.tab-panel { display: none; padding: 20px 16px; }
.tab-panel.active { display: block; }
#tab-pipeline.tab-panel { padding: 12px 0; overflow: hidden; }

/* ── Bottom Nav ── */
nav.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: var(--nav-height);
  background: var(--ivory);
  border-top: 1px solid var(--gold);
  display: flex;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 44px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn.active { color: var(--burgundy); font-weight: 700; }
.nav-btn.active svg path,
.nav-btn.active svg circle,
.nav-btn.active svg rect,
.nav-btn.active svg polyline,
.nav-btn.active svg line { stroke: var(--burgundy); }
.nav-btn svg { width: 22px; height: 22px; stroke-width: 1.75; }

/* ── Auth Screen ── */
#auth-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ivory);
  z-index: 100;
}

.auth-card {
  width: min(380px, 92vw);
  padding: 40px 36px;
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  background: var(--ivory);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.auth-logo {
  margin-bottom: 4px;
  line-height: 1;
}

.auth-logo img {
  height: 180px;
  width: auto;
}

.auth-tagline {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 32px;
}

.auth-card form {
  text-align: left;
}

.auth-card h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
  margin-bottom: 6px;
}

.auth-card p {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-style: italic;
  background: var(--ivory);
  color: var(--near-black);
  transition: border-color .2s;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: background .15s, opacity .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--burgundy);
  color: var(--ivory);
  border: 1px solid transparent;
}
.btn-primary:hover { background: var(--burgundy-dark); }

.btn-secondary {
  background: transparent;
  color: var(--burgundy);
  border: 1px solid var(--gold);
}
.btn-secondary:hover { background: var(--ivory-warm); }

.btn-danger { background: var(--danger); color: var(--ivory); }
.btn-success { background: var(--success); color: var(--ivory); }

.btn-sm { padding: 6px 14px; font-size: 9px; min-height: 36px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--ivory);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card:active { background: var(--ivory-warm); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-vip         { background: rgba(196,151,58,.15); color: var(--burgundy); border: 1px solid rgba(196,151,58,.4); }
.badge-active      { background: rgba(26,91,54,.1);  color: #1a5c36; border: 1px solid rgba(26,91,54,.25); }
.badge-prospect    { background: rgba(77,0,38,.08);  color: var(--burgundy); border: 1px solid rgba(77,0,38,.2); }
.badge-dormant     { background: rgba(160,41,30,.1); color: var(--danger); border: 1px solid rgba(160,41,30,.25); }
.badge-cold        { background: var(--ivory-deep);  color: var(--muted); border: 1px solid var(--border-color); }

.badge-lead            { background: rgba(77,0,38,.08);  color: var(--burgundy); border: 1px solid rgba(77,0,38,.2); }
.badge-conversation    { background: rgba(196,151,58,.12); color: #7a5020; border: 1px solid rgba(196,151,58,.3); }
.badge-proposal_sent   { background: rgba(196,151,58,.15); color: #7a5020; border: 1px solid rgba(196,151,58,.4); }
.badge-confirmed       { background: rgba(26,91,54,.1);  color: #1a5c36; border: 1px solid rgba(26,91,54,.25); }
.badge-delivered       { background: rgba(26,91,54,.1);  color: #1a5c36; border: 1px solid rgba(26,91,54,.25); }
.badge-followup        { background: var(--ivory-deep);  color: var(--muted); border: 1px solid var(--border-color); }

.badge-corporate_vip      { background: rgba(196,151,58,.15); color: var(--burgundy); border: 1px solid rgba(196,151,58,.4); }
.badge-corporate_standard { background: rgba(77,0,38,.08);   color: var(--burgundy); border: 1px solid rgba(77,0,38,.2); }
.badge-hnw_private        { background: rgba(133,0,53,.1);   color: var(--wine);    border: 1px solid rgba(133,0,53,.25); }
.badge-private            { background: var(--ivory-warm);   color: var(--muted);   border: 1px solid var(--border-color); }
.badge-partnership        { background: rgba(26,91,54,.1);   color: #1a5c36;        border: 1px solid rgba(26,91,54,.25); }
.badge-supplier           { background: var(--ivory-deep);   color: var(--muted);   border: 1px solid var(--border-color); }

/* ── Segment badges ── */
.badge-seg-none              { background: var(--ivory-deep);          color: var(--muted);    border: 1px solid var(--border-color); }
.badge-seg-corporate_vip     { background: rgba(196,151,58,.18);       color: var(--burgundy); border: 1px solid rgba(196,151,58,.5); font-weight:600; }
.badge-seg-corporate_standard{ background: rgba(77,0,38,.08);          color: var(--burgundy); border: 1px solid rgba(77,0,38,.2); }
.badge-seg-private           { background: var(--ivory-warm);          color: var(--muted);    border: 1px solid var(--border-color); }
.badge-seg-cold              { background: rgba(120,130,160,.1);       color: #4a5068;         border: 1px solid rgba(120,130,160,.3); }
.badge-seg-vendor            { background: rgba(26,91,54,.1);          color: #1a5c36;         border: 1px solid rgba(26,91,54,.25); }

/* ── Segment select inline ── */
.segment-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.segment-select-wrap label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.segment-select-wrap select {
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 3px 22px 3px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--ivory-warm);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a6a5a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: border-color .15s;
}
.segment-select-wrap select:focus {
  outline: none;
  border-color: var(--burgundy);
}

/* ── Search / Filters ── */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.search-bar input { flex: 1; }

.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 18px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 2px;
  border: 1px solid var(--border-color);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s, border-color .15s;
}

.chip.active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: var(--ivory);
}

/* ── Sort bar ── */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.sort-label {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.sort-btn {
  padding: 4px 12px;
  border-radius: 2px;
  border: 1px solid var(--border-color);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.sort-btn.active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: var(--ivory);
}

/* ── Section titles ── */
.section-title {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--gold);
  margin-bottom: 12px;
  margin-top: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(196,151,58,.25);
}
.section-title:first-child { margin-top: 0; }

/* ── Stat row ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--ivory-warm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
}

.stat-box .stat-num {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
  line-height: 1;
}

.stat-box .stat-label {
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-top: 5px;
  text-transform: uppercase;
}

.stat-overdue .stat-num { color: var(--danger); }
.stat-today   .stat-num { color: var(--wine); }

/* ── Task items ── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.task-item:last-child { border-bottom: none; }

.task-check {
  width: 22px; height: 22px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.task-check:active { background: var(--success); border-color: var(--success); }

.task-body { flex: 1; min-width: 0; }
.task-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  font-size: 14px;
  color: var(--near-black);
}
.task-meta  {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1px;
  color: var(--muted);
  margin-top: 3px;
}
.task-actions { display: flex; gap: 6px; margin-top: 8px; }

.overdue .task-meta { color: var(--danger); }

/* ── Pipeline ── */
.pipeline-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}
.pipeline-cols {
  display: flex;
  gap: 12px;
  min-width: max-content;
  padding-bottom: 8px;
}
.pipeline-col { width: 220px; flex-shrink: 0; }

.pipeline-col-header {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--burgundy);
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--ivory-warm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  border-top: 2px solid var(--gold);
}

.pipeline-card {
  background: var(--ivory);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .15s;
}
.pipeline-card:active { background: var(--ivory-warm); }
.pipeline-card .name {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  font-size: 14px;
  color: var(--near-black);
}
.pipeline-card .event {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .8px;
  color: var(--muted);
  margin-top: 3px;
}
.pipeline-card .amount {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
  margin-top: 6px;
}
.pipeline-card .days {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .8px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Kanban board ── */
.kanban-board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  /* full-bleed horizontally past tab padding */
  margin-left: -16px;
  margin-right: -16px;
  padding-left: 16px;
  padding-right: 16px;
}
.kanban-board::-webkit-scrollbar { height: 4px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.kanban-col {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.kanban-col-header {
  background: var(--ivory);
  border: 1px solid var(--border-color);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 10px 8px;
  margin-bottom: 0;
}
.kanban-col-title {
  display: block;
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--near-black);
}
.kanban-col-count {
  display: inline-block;
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
}
.kanban-col-total {
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
  margin-top: 2px;
}

.kanban-col-body {
  flex: 1;
  background: var(--ivory-warm, #f5f0e8);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
}

.kanban-empty {
  color: var(--muted);
  font-size: 18px;
  text-align: center;
  padding: 16px 0;
  opacity: .4;
}

.kanban-card {
  background: var(--ivory);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 8px 8px 6px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s;
}
.kanban-card:active { box-shadow: none; background: var(--ivory-warm); }

.kanban-card-name {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 500;
  font-style: italic;
  color: var(--near-black);
  line-height: 1.3;
  word-break: break-word;
}
.kanban-card-company {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .6px;
  color: var(--muted);
  margin-top: 2px;
  word-break: break-word;
}
.kanban-card-meta {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
  text-transform: capitalize;
}
.kanban-card-date {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}
.kanban-no-date {
  color: #c0392b;
  font-weight: 600;
}
.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.kanban-card-amount {
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
}
.kanban-card-days {
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .5px;
  color: var(--muted);
  background: transparent;
  padding: 1px 4px;
  border-radius: 2px;
}
.kanban-card-days.days-stall {
  color: #7a5020;
  background: rgba(196,151,58,.15);
}
.kanban-card-days.days-critical {
  color: var(--danger);
  background: rgba(160,41,30,.1);
}

/* stall-badge kept for legacy refs */
.stall-badge {
  background: rgba(196,151,58,.15);
  color: #7a5020;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .8px;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid rgba(196,151,58,.3);
}
.stall-badge.critical {
  background: rgba(160,41,30,.1);
  color: var(--danger);
  border-color: rgba(160,41,30,.3);
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,15,8,.55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--ivory);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 2px solid var(--gold);
  padding: 24px 20px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Contact detail ── */
.contact-detail-header { margin-bottom: 20px; }
.contact-detail-header h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
}
.contact-detail-header .sub {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

.detail-section { margin-top: 24px; }
.detail-section h3 {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 500;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--gold);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(196,151,58,.25);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-item label {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.info-item span {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  font-style: italic;
  color: var(--near-black);
  display: block;
  margin-top: 3px;
}

/* ── Back button ── */
#detail-panel { display: none; }
#detail-panel.active { display: block; }

.back-btn {
  background: none;
  border: none;
  color: rgba(245,239,227,0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0;
  transition: color .15s;
}
.back-btn:hover { color: var(--ivory); }

/* ── Interaction list ── */
.interaction-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.interaction-item:last-child { border-bottom: none; }

.interaction-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ivory-warm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.interaction-body { flex: 1; min-width: 0; }
.interaction-subject {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  font-size: 14px;
  color: var(--near-black);
}
.interaction-meta {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: .8px;
  color: var(--muted);
  margin-top: 3px;
}
.interaction-summary {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  font-style: italic;
  color: var(--muted);
  margin-top: 5px;
}

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--burgundy);
  color: var(--ivory);
  border: 2px solid rgba(196,151,58,.4);
  font-size: 26px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.fab:active { background: var(--burgundy-dark); }

/* ── Revenue tag ── */
.revenue-tag {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
}

/* ── Action row ── */
.action-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.action-row .btn { flex: 1; min-width: 120px; }

/* ── Checklist ── */
.checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.checklist-date {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 400;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.completing { opacity: .35; transition: opacity .3s; }

.checklist-item::before,
.checklist-item::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.checklist-item::before { left: 0; background: var(--ivory-deep); }
.checklist-item::after  { right: 0; background: rgba(160,41,30,.08); }
.checklist-item.swipe-right-hint::before { opacity: 1; }
.checklist-item.swipe-left-hint::after  { opacity: 1; }

.checklist-check {
  width: 24px; height: 24px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
  z-index: 1;
}
.checklist-check:active,
.checklist-check.done {
  background: var(--success);
  border-color: var(--success);
}

.checklist-body { flex: 1; min-width: 0; z-index: 1; }
.checklist-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  font-size: 15px;
  color: var(--near-black);
  line-height: 1.35;
}
.checklist-contact {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1px;
  color: var(--muted);
  margin-top: 4px;
}
.checklist-snooze-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.snooze-pill {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
  border: 1px solid var(--border-color);
  background: transparent;
  cursor: pointer;
  min-height: 28px;
  color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}
.snooze-pill:active { background: var(--ivory-warm); }

.checklist-empty {
  text-align: center;
  padding: 60px 24px 40px;
}
.checklist-empty-emoji { font-size: 40px; margin-bottom: 14px; }
.checklist-empty-text {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 500;
  font-style: italic;
  color: var(--muted);
}

/* ── Draft cards ── */
.draft-card {
  background: var(--ivory);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.draft-card-contact {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
  margin-bottom: 2px;
}
.draft-card-template {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.draft-card-subject {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  font-style: italic;
  color: var(--near-black);
  margin-bottom: 4px;
}
.draft-card-date {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 14px;
}
.draft-card-preview {
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--text-muted, #666);
  line-height: 1.5;
  margin-bottom: 8px;
  white-space: pre-line;
  max-height: 80px;
  overflow: hidden;
}
.draft-card-actions { display: flex; gap: 8px; }

.draft-send-btn {
  flex: 1;
  padding: 10px 16px;
  background: var(--burgundy);
  color: var(--ivory);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.draft-send-btn:active { background: var(--burgundy-dark); }
.draft-send-btn:disabled { opacity: .45; cursor: not-allowed; }

.draft-dismiss-btn {
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.draft-dismiss-btn:active { background: var(--ivory-warm); }

.drafts-empty {
  text-align: center;
  padding: 60px 24px 40px;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 500;
  font-style: italic;
  color: var(--muted);
}

/* ── Email thread accordion ── */
.email-thread-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.email-thread-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--ivory);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.email-thread-header:active { background: var(--ivory-warm); }
.email-thread-dir {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--muted);
}
.email-thread-meta { flex: 1; min-width: 0; }
.email-thread-subject {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  font-size: 14px;
  color: var(--near-black);
  line-height: 1.35;
}
.email-thread-from {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: .5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-thread-date {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: .5px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.email-thread-chevron {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .2s;
  margin-top: 2px;
}
.email-thread-item.open .email-thread-chevron { transform: rotate(90deg); }
.email-thread-body {
  display: none;
  padding: 0 14px 14px;
  background: var(--ivory-warm);
  border-top: 1px solid var(--border-color);
}
.email-thread-item.open .email-thread-body { display: block; }
.email-thread-body-text {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  font-style: italic;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 12px;
}
.email-thread-load-more {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--burgundy);
  cursor: pointer;
  text-align: center;
  padding: 10px 0 0;
}
.email-threads-empty {
  font-family: var(--font-serif);
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  padding: 8px 0;
}

/* ── Checklist draft toggle ── */
.checklist-draft-toggle {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--burgundy);
  cursor: pointer;
  margin-top: 6px;
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
}
.checklist-draft-body {
  display: none;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--ivory-warm);
  border-left: 2px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  font-style: italic;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.checklist-draft-body.open { display: block; }

/* ── Event log ── */
.event-log-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}
.event-log-item:last-child { border-bottom: none; }
.event-log-type {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  text-transform: capitalize;
  color: var(--near-black);
}
.event-log-meta {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: .8px;
  color: var(--muted);
  margin-top: 3px;
}
.event-log-amount {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
  color: var(--burgundy);
  flex-shrink: 0;
  margin-left: 12px;
}

/* ── Task creation bottom sheet ── */
#task-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,15,8,.5);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
#task-sheet-overlay.hidden { display: none; }

#task-sheet {
  background: var(--ivory);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 2px solid var(--gold);
  padding: 20px;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#task-sheet .sheet-handle {
  width: 36px; height: 3px;
  background: var(--border-color);
  border-radius: 2px;
  margin: 0 auto 18px;
}

/* ── Empty state ── */
.empty {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 500;
  font-style: italic;
  color: var(--muted);
  padding: 48px 20px;
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--near-black);
  color: var(--ivory);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  z-index: 200;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ── Spinner ── */
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border-color);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 48px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ── */
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.mt-8     { margin-top: 8px; }
.mt-16    { margin-top: 16px; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 13px; }
.text-right { text-align: right; }
.fw-500     { font-weight: 600; }
.fw-600     { font-weight: 600; }
.hidden     { display: none !important; }
.truncate   { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Fas 2: Checklist Draft Actions ── */
.checklist-draft-actions {
  margin-top: 10px;
}
.checklist-draft-actions .btn {
  font-size: 11px;
  padding: 6px 12px;
}

/* ── Fas 2: Snooze/Dismiss Pills ── */
.snooze-pill.dismiss {
  background: rgba(160, 41, 30, 0.08);
  color: var(--danger);
}
.snooze-pill.dismiss:hover {
  background: rgba(160, 41, 30, 0.15);
}

/* ── Proposal Status Badges ── */
.proposal-status-sent { color: #ffa726; }
.proposal-status-accepted { color: #66bb6a; }
.proposal-status-declined { color: #ef5350; }
.proposal-status-pending { color: #90a4ae; }
