/* Colors live here. Change these to rebrand the whole app. */
:root {
  /* Hummingbird Insurance brand: logo blue #1D70DF and charcoal #2F2F2F */
  --paper: #F4F7FB; --surface: #FFFFFF; --ink: #2F2F2F; --muted: #5F6B7A;
  --line: #D7DFEA; --accent: #1D70DF; --accent-ink: #FFFFFF; --ruby: #1659B3;
  --lead: #B7791F; --client: #2F7D4F; --danger: #B3261E; --soft: #E8F0FC;
  --radius: 6px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F1520; --surface: #161E2B; --ink: #E8EDF4; --muted: #9AA7B8;
    --line: #263244; --accent: #7FB2F5; --accent-ink: #0B1530; --ruby: #7FB2F5;
    --lead: #E0A84B; --client: #5FBF85; --danger: #F07A72; --soft: #1C2A3E;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 2px 8px 18px; }
.brand a { display: block; line-height: 0; }
.brand img { width: 100%; max-width: 184px; height: auto; display: block; }
.brand .product { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  padding-left: 2px; line-height: 1.2; }
.logo-dark { display: none !important; }
@media (prefers-color-scheme: dark) { .logo-light { display: none !important; } .logo-dark { display: block !important; } }
.nav-label { font-size: 12px; color: var(--muted); padding: 14px 10px 4px; font-weight: 600; }
.role { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px;
  background: var(--soft); color: var(--accent); margin-left: 4px; }
.side a { color: var(--ink); padding: 8px 10px; border-radius: var(--radius); }
.side a:hover { background: var(--soft); text-decoration: none; }
.side a.on { background: var(--soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side .who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); }
main { padding: 28px 36px 60px; max-width: 1180px; width: 100%; min-width: 0; }  /* min-width: wide tables scroll inside, not the page */
h1 { font-size: 26px; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: 17px; margin: 0 0 12px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 22px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: var(--radius);
  font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.convert { background: var(--client); border-color: var(--client); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.inline { display: inline; }

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; }
textarea { min-height: 110px; resize: vertical; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.fields .wide { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters input { max-width: 300px; } .filters select { max-width: 180px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line); padding: 8px 10px; }
td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px;
  border-radius: 99px; background: var(--soft); color: var(--muted); }
.pill.new, .pill.contacted, .pill.qualified { color: var(--lead); }
.pill.converted, .pill.active, .pill.sent { color: var(--client); }
.pill.lost, .pill.failed, .pill.inactive { color: var(--danger); }
.pill.sending { color: var(--accent); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px;
  border: 1px solid var(--line); background: var(--surface); }
.flash.success { border-left: 4px solid var(--client); }
.flash.error { border-left: 4px solid var(--danger); }

/* The pipeline: one segmented bar showing where every lead sits. */
.pipeline { display: flex; height: 44px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); margin: 6px 0 10px; }
.pipeline div { display: flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 700; font-size: 14px; min-width: 0; }
.seg-new { background: #D9A441; } .seg-contacted { background: #C48A2C; }
.seg-qualified { background: #9C6B1A; } .seg-converted { background: var(--client); }
.seg-lost { background: #8C97A0; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 18px;
  border-top: 1px solid var(--line); padding-top: 16px; }
.stats div { padding-right: 12px; }
.stats b { display: block; font-size: 24px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }

.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.keybox { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--soft);
  padding: 10px 12px; border-radius: var(--radius); word-break: break-all; margin: 8px 0; }
.preview { border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px;
  white-space: pre-wrap; background: var(--paper); }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .panel { width: 100%; max-width: 380px; }
.auth .brand { padding: 0 0 10px; align-items: center; }
.auth .brand img { max-width: 260px; }
.auth .brand .product { padding: 0; }
.auth form > div { margin-bottom: 14px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .who { display: none; } .brand { width: 100%; padding-bottom: 8px; } .brand img { max-width: 150px; }
  main { padding: 20px 16px; }
  .grid2, .grid3, .fields { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 14px; }
}
.sync-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 16px; flex-wrap: wrap; }

.hint { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.profile-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.contact-line { color: var(--muted); font-size: 14px; margin-top: 4px; }
.contact-line span + span::before { content: "|"; margin: 0 8px; color: var(--line); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-color: var(--ruby); }
.date-chip { display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: var(--radius); background: var(--soft); flex: none; line-height: 1.1; }
.date-chip b { font-size: 17px; } .date-chip span { font-size: 11px; color: var(--muted); font-weight: 600; }
.appt-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.appt-row:last-child { border-bottom: 0; }
.appt-row .grow { flex: 1; min-width: 0; }
.gcal { font-size: 12px; color: var(--client); font-weight: 600; }
.gcal.off { color: var(--muted); font-weight: 400; }
.pill.draft { color: var(--muted); } .pill.accepted, .pill.completed { color: var(--client); }
.pill.declined, .pill.expired, .pill.cancelled { color: var(--danger); } .pill.scheduled { color: var(--accent); }
.items td { padding: 6px 6px; } .items input { padding: 6px 8px; }
.items .desc { min-width: 260px; } .items .qty { width: 90px; } .items .price { width: 130px; }
.items .amt { width: 120px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { margin-left: auto; width: 100%; max-width: 340px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 1px solid var(--ink); margin-top: 4px; padding-top: 9px; font-weight: 700; font-size: 18px; }
.totals input { width: 110px; text-align: right; padding: 4px 8px; }
.field-row { display: grid; grid-template-columns: 1fr 120px 90px auto; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.field-row:last-child { border-bottom: 0; }
.field-row.off { opacity: .55; }
.mini-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.check-list { display: grid; gap: 8px; }
@media (max-width: 820px) { .field-row { grid-template-columns: 1fr auto; } .field-row .hide-sm { display: none; } }

.google-btn { width: 100%; justify-content: center; padding: 10px 14px; }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.service-list { display: grid; gap: 8px; margin: 12px 0; }
.service { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.service .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.service.on .dot { background: var(--client); }
.service.on > span:last-child { color: var(--client); font-weight: 600; }
.google-prompt { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  border-left: 4px solid var(--accent); }
.setup-steps summary { cursor: pointer; font-weight: 600; }
.setup-steps ol { padding-left: 20px; margin: 10px 0 0; display: grid; gap: 6px; max-width: 75ch; }

.client-table td, .client-table th { white-space: nowrap; }
.client-table td.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }
.dup-group tr:last-child td { border-bottom: 2px solid var(--muted); }

/* ---------- Email campaigns ---------- */
.campaign-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 20px; align-items: start; }
.campaign-preview { position: sticky; top: 16px; }
.campaign-preview .preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#preview-frame, .preview-frame-static { width: 100%; height: 72vh; min-height: 480px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; display: block; }
.preview-frame-static { border: 0; border-radius: 0; }
@media (max-width: 1100px) { .campaign-layout { grid-template-columns: 1fr; } .campaign-preview { position: static; } }
.filters-box { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.filters-box summary { cursor: pointer; font-weight: 600; }
.check-scroll { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; display: grid; gap: 4px; background: var(--surface); }
.check-scroll label[hidden] { display: none; }
.filter-search { margin-bottom: 6px; }
.audience-count { margin-top: 14px; padding: 10px 12px; background: var(--soft); border-radius: var(--radius); }
.audience-count .note { color: var(--lead); margin-top: 4px; }
.subhead { font-size: 15px; margin: 22px 0 8px; }
.style-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.style-grid input[type=color] { height: 38px; padding: 3px; }
.attachment-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.attachment-list li { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.attachment-list li span:first-child { flex: 1; overflow-wrap: anywhere; }
.file-btn { cursor: pointer; }
.placeholder-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.chip { font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.error-text { color: var(--danger); }

/* Editor: the writing area looks like the email (white), the toolbar follows the app theme */
.editor-shell .email-toolbar.ql-toolbar { border-color: var(--line); border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface); }
.editor-shell .ql-container { border-color: var(--line); border-radius: 0 0 var(--radius) var(--radius);
  background: #fff; color: #1C2528; font-family: Arial, sans-serif; font-size: 15px; }
.editor-shell .ql-editor { min-height: inherit; line-height: 1.6; }
.editor-shell .ql-editor img { max-width: 100%; }
.email-toolbar .ql-picker.ql-font { width: 150px; }
.email-toolbar .ql-picker.ql-size { width: 74px; }
.email-toolbar .ql-picker.ql-lineheight, .email-toolbar .ql-picker.ql-letterspacing { width: 84px; }
.email-toolbar .ql-picker.ql-font .ql-picker-label[data-value]::before,
.email-toolbar .ql-picker.ql-font .ql-picker-item[data-value]::before,
.email-toolbar .ql-picker.ql-size .ql-picker-label[data-value]::before,
.email-toolbar .ql-picker.ql-size .ql-picker-item[data-value]::before { content: attr(data-value); }
.email-toolbar .ql-picker.ql-font .ql-picker-label:not([data-value])::before,
.email-toolbar .ql-picker.ql-font .ql-picker-item:not([data-value])::before { content: "Font"; }
.email-toolbar .ql-picker.ql-size .ql-picker-label:not([data-value])::before,
.email-toolbar .ql-picker.ql-size .ql-picker-item:not([data-value])::before { content: "Size"; }
.email-toolbar .ql-picker.ql-lineheight .ql-picker-label::before { content: "Line " attr(data-value); }
.email-toolbar .ql-picker.ql-lineheight .ql-picker-label:not([data-value])::before { content: "Line"; }
.email-toolbar .ql-picker.ql-lineheight .ql-picker-item[data-value]::before { content: attr(data-value); }
.email-toolbar .ql-picker.ql-lineheight .ql-picker-item:not([data-value])::before { content: "Normal"; }
.email-toolbar .ql-picker.ql-letterspacing .ql-picker-label::before { content: "Aa " attr(data-value); }
.email-toolbar .ql-picker.ql-letterspacing .ql-picker-label:not([data-value])::before { content: "Spacing"; }
.email-toolbar .ql-picker.ql-letterspacing .ql-picker-item[data-value]::before { content: attr(data-value); }
.email-toolbar .ql-picker.ql-letterspacing .ql-picker-item:not([data-value])::before { content: "Normal"; }
@media (prefers-color-scheme: dark) {
  .email-toolbar .ql-stroke { stroke: var(--ink); }
  .email-toolbar .ql-fill { fill: var(--ink); }
  .email-toolbar .ql-picker { color: var(--ink); }
  .email-toolbar .ql-picker-options { background: var(--surface); }
}
.idle-banner { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000;
  display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--radius);
  background: var(--ink); color: var(--paper); box-shadow: 0 4px 18px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.qr-box { background: #fff; padding: 10px; border-radius: var(--radius); display: inline-block; border: 1px solid var(--line); }
.code-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 160px)); gap: 8px 24px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; margin: 12px 0; }
.code-input { font-size: 22px; letter-spacing: 6px; text-align: center; max-width: 220px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.log-table td { vertical-align: top; }
.retention-row { display: grid; grid-template-columns: 1fr 120px 150px; gap: 14px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.retention-row:last-child { border-bottom: 0; }
@media (max-width: 820px) { .retention-row { grid-template-columns: 1fr; } }
.plan-table td { vertical-align: top; }
.people select, .people input { padding: 6px 8px; }
.metal { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--soft); white-space: nowrap; }
.metal-bronze, .metal-expanded_bronze { color: #8A5A2B; } .metal-silver { color: #5E6B70; }
.metal-gold { color: #9C7A0E; } .metal-platinum { color: #3F5A6B; } .metal-catastrophic { color: var(--danger); }
.rel-select { min-width: 190px; }
.chip-logo { border-color: var(--accent); color: var(--accent); font-weight: 600; }
/* Client documents */
.drop-zone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; margin-top: 14px;
  background: var(--paper); transition: border-color .15s, background .15s; }
.drop-zone.over { border-color: var(--accent); background: var(--soft); }
.drop-zone p { margin: 0 0 4px; }
.file-link { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; display: inline; }
.upload-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.upload-list li { display: grid; grid-template-columns: minmax(0, 1fr) 140px minmax(90px, auto); gap: 10px; align-items: center; }
.upload-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-list progress { width: 100%; accent-color: var(--accent); }
.state.ok { color: var(--client); font-weight: 600; }
.doc-table td { vertical-align: top; }
.doc-edit summary { list-style: none; } .doc-edit summary::-webkit-details-marker { display: none; }
.doc-edit[open] { flex-basis: 100%; }
.doc-edit-form { margin-top: 8px; width: 100%; min-width: 240px; display: grid; gap: 8px; padding: 12px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.doc-edit-form label { font-weight: 600; font-size: 12px; display: grid; gap: 3px; }

/* Dashboard news */
.news-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 24px; }
.news-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.news-list a { font-weight: 600; color: var(--ink); line-height: 1.35; }
.news-list a:hover { color: var(--accent); }
.news-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.news-source { color: var(--accent); font-weight: 600; }
.news-summary { font-size: 13px; color: var(--muted); margin: 4px 0 0; line-height: 1.45; }
.news-foot { margin-top: 10px; }
.skeleton { display: block; height: 12px; border-radius: 4px; background: var(--soft); margin: 4px 0; animation: pulse 1.2s ease-in-out infinite; }
.skeleton.short { width: 55%; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
