:root {
  /* ONE PRODUCT. The workspace stays light, but the accents are the brand's:
     near-black chrome and amber instead of navy and purple. Amber-600 rather
     than the marketing gold because #facc15 text on white fails contrast. */
  --primary: #0b0b0d;
  --accent:  #b45309;
  --gold:    #f5b942;
  --success: #16a34a;
  --warn:    #d97706;
  --danger:  #dc2626;
  --bg:      #f4f3f0;
  --card:    #ffffff;
  --border:  #e4e2dc;
  --text:    #1e293b;
  --muted:   #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
       background: var(--bg); color: var(--text); font-size: 15px; }

/* ── Auth ─────────────────────────────────────────────────────────────────── */
/* ONE BRAND. The sign-in screen was navy-and-white while the marketing site
   it follows is black-and-gold - a customer paid on one design and landed on
   another. Scoped to #login-screen only: the authenticated dashboard's own
   look is deliberately left alone. */
#login-screen { min-height: 100vh; display: flex; align-items: center;
                justify-content: center; padding: 24px;
                background: radial-gradient(1200px 600px at 50% -10%, #16161f 0%, #0b0b10 55%, #08080c 100%); }
.login-card { background: rgba(18,18,26,.94); border: 1px solid rgba(250,204,21,.20);
              border-radius: 16px; padding: 34px 28px; width: 100%; max-width: 380px;
              box-shadow: 0 18px 60px rgba(0,0,0,.6); }
.login-card .brandmark { font-size: 15px; font-weight: 800; letter-spacing: .16em;
              color: #facc15; text-transform: uppercase; margin-bottom: 16px; }
.login-card h1 { font-size: 23px; font-weight: 800; margin-bottom: 5px; color: #fff;
              letter-spacing: -.01em; }
.login-card p  { color: #9a9aa6; font-size: 13px; margin-bottom: 24px; }
.login-card .field label { color: #b9b9c4; }
.login-card input { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14);
              color: #fff; }
.login-card input:focus { border-color: rgba(250,204,21,.55); outline: none; }
.login-card .btn-primary { background: #facc15; color: #10101a; font-weight: 800;
              border: none; }
.login-card .btn-primary:hover { background: #ffd93d; }
.field { margin-bottom: 16px; }
.field label  { display: block; font-size: 12px; font-weight: 600;
                text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.field input  { width: 100%; padding: 11px 14px; border: 1px solid var(--border);
                border-radius: 8px; font-size: 15px; }
.field input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.error-msg  { color: var(--danger); font-size: 13px; margin-bottom: 12px; }
.login-link { display: block; text-align: center; margin-top: 18px;
              font-size: 13px; color: var(--accent); text-decoration: none; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
#app { display: none; }
.topbar { background: var(--primary); color: white; padding: 14px 20px;
          display: flex; align-items: center; justify-content: space-between;
          position: sticky; top: 0; z-index: 50; }
.topbar h1 { font-size: 13px; font-weight: 800; letter-spacing: .12em; color: var(--gold); text-transform: uppercase; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.biz-status { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.biz-active   { background: #bbf7d0; color: #15803d; }
.biz-paused   { background: #fef3c7; color: #92400e; }
.biz-error    { background: #fee2e2; color: #991b1b; }

.tabs { display: flex; background: white; border-bottom: 2px solid var(--border); }
.tab  { flex: 1; padding: 13px 8px; text-align: center; font-size: 13px;
        font-weight: 500; color: var(--muted); cursor: pointer;
        border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--accent); border-color: var(--accent); font-weight: 700; }

.content { padding: 16px; max-width: 760px; margin: 0 auto; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: white; border-radius: 12px; padding: 16px;
        margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.07);
        cursor: pointer; transition: box-shadow .15s; }
.card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.card-name  { font-weight: 600; font-size: 15px; }
.card-meta  { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px;
         font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-new       { background: #e0f2fe; color: #0369a1; }
.badge-booked    { background: #dcfce7; color: #15803d; }
.badge-completed { background: #f1f5f9; color: #475569; }
.badge-emergency { background: #fee2e2; color: #991b1b; }
.badge-urgent    { background: #fef3c7; color: #92400e; }
.badge-active    { background: #e0f2fe; color: #0369a1; }
.badge-paused    { background: #f1f5f9; color: #475569; }
.badge-disconnected { background: #fee2e2; color: #991b1b; }
.badge-connected    { background: #dcfce7; color: #15803d; }
.badge-error        { background: #fee2e2; color: #991b1b; }

/* ── Dispatch board ──────────────────────────────────────────────────────── */
.dispatch-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.dispatch-col   { flex: 0 0 240px; }
.dispatch-col-head { font-size: 12px; font-weight: 700; text-transform: uppercase;
                     letter-spacing: .04em; color: var(--muted); margin-bottom: 10px;
                     display: flex; justify-content: space-between; align-items: center; }
.dispatch-col-count { background: var(--border); color: var(--muted); border-radius: 999px;
                       padding: 1px 8px; font-size: 11px; font-weight: 700; }
.dispatch-card  { background: white; border-radius: 10px; padding: 12px;
                   margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.dispatch-card-name { font-weight: 600; font-size: 14px; }
.dispatch-card-meta { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.dispatch-card select { width: 100%; margin-top: 8px; padding: 5px 8px; font-size: 12px;
                         border: 1px solid var(--border); border-radius: 6px; background: white; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer;
       font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--accent); color: white; }
.btn-danger  { background: var(--danger);  color: white; }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-sm      { padding: 6px 12px; font-size: 13px; }
.btn + .btn  { margin-left: 8px; }

/* ── Conversation thread ─────────────────────────────────────────────────── */
#conv-view { display: none; }
.conv-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.back-btn    { font-size: 20px; cursor: pointer; color: var(--accent); padding: 4px 8px; }
.messages    { display: flex; flex-direction: column; gap: 10px; padding-bottom: 80px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; }
.msg-user       { align-self: flex-end; background: #dbeafe; border-bottom-right-radius: 4px; }
.msg-assistant  { align-self: flex-start; background: #f0fdf4; border-bottom-left-radius: 4px; }
.msg-contractor { align-self: flex-start; background: #faf5ff; border: 1px solid #e9d5ff; border-bottom-left-radius: 4px; }
.msg-role       { font-size: 10px; font-weight: 700; text-transform: uppercase;
                  letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; }

.reply-bar  { position: fixed; bottom: 0; left: 0; right: 0; background: white;
              border-top: 1px solid var(--border); padding: 12px 16px; display: none;
              gap: 10px; align-items: center; }
.reply-bar.show { display: flex; }
.reply-input { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border);
               border-radius: 22px; font-size: 14px; font-family: inherit; }
.reply-input:focus { outline: none; border-color: var(--accent); }
.reply-send  { padding: 10px 18px; background: var(--accent); color: white;
               border: none; border-radius: 22px; font-weight: 700; cursor: pointer; }

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings-group { background: white; border-radius: 12px; padding: 20px;
                  margin-bottom: 16px; }
.settings-group h3 { font-size: 14px; font-weight: 700; text-transform: uppercase;
                     letter-spacing: .05em; color: var(--muted); margin-bottom: 14px; }
.setting-row { display: flex; justify-content: space-between; align-items: center;
               padding: 10px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; font-weight: 500; }
.setting-val   { font-size: 13px; color: var(--muted); }

/* ── Banner ──────────────────────────────────────────────────────────────── */
.banner { background: #fee2e2; border: 1px solid #fca5a5; border-radius: 8px;
          padding: 12px 16px; margin-bottom: 16px; font-size: 14px;
          display: flex; justify-content: space-between; align-items: center; }
.banner strong { color: var(--danger); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty { text-align: center; color: var(--muted); padding: 48px 0; font-size: 14px; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid #e2e8f0;
           border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Paywall ─────────────────────────────────────────────────────────────── */
#paywall-screen {
  min-height: 100vh;
  background: var(--primary);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  text-align: center;
}
.paywall-plans {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 820px;
  text-align: left;
}
@media (max-width: 700px) { .paywall-plans { grid-template-columns: 1fr; } }

/* ── PHONE (390px): no horizontal page scroll, ever ─────────────────────────
   Measured before the fix: the document rendered 543px wide in a 390px
   viewport. Causes: eight flex:1 tabs that cannot shrink below their text,
   and wide tables. Tabs now scroll in their own row, tables scroll in their
   own box, and the page itself never does. */
@media (max-width: 600px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  .topbar { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  .topbar h1 { font-size: 11px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; padding: 12px 13px; white-space: nowrap; }
  .pane { padding: 12px; }
  table { display: block; overflow-x: auto; max-width: 100%; }
  .card, .setting-row { max-width: 100%; overflow-wrap: anywhere; }
}


/* ── Approved client design: today strip, pills, big lead actions ─────────── */
.biz-status.biz-active { background: #16a34a; color: #fff; font-weight: 700;
  border-radius: 999px; padding: 3px 12px; font-size: 11px; text-transform: uppercase; }
/* RING_FIRST_V1: "Your business number" card */
.num-card { background: linear-gradient(160deg, #0b0b0d 0%, #1c1a17 100%); color: #e8e6e1; border: 1px solid #2a2724;
            box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.num-card.is-verified { border-color: #15803d; box-shadow: 0 0 0 2px rgba(21,128,61,.35), 0 10px 30px rgba(0,0,0,.18); }
.num-card .num-eyebrow { font-size: 10px; letter-spacing: .14em; color: #f5b942; font-weight: 800; }
.num-card .num-big { font-size: 28px; font-weight: 800; letter-spacing: .02em; margin: 6px 0 8px; color: #fff; font-variant-numeric: tabular-nums; }
.num-card .card-meta { color: #cfcbc3; }
.num-card .num-copy b { color: #fff; }
.num-card .num-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.num-card .num-actions .btn { flex: 1 1 140px; }
.num-card .btn-outline { color: #fff; border-color: rgba(255,255,255,.35); }
.num-card .num-switch { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: #e8e6e1; }
.num-card .num-switch input { width: 20px; height: 20px; accent-color: #f5b942; }
/* KEEP_MY_NUMBER_V1: the wizard (one step per screen) and the tracker */
.port-modal { position: fixed; inset: 0; z-index: 10000; background: rgba(11,11,13,.72); display: flex; align-items: flex-end; justify-content: center; }
.port-sheet { background: #fff; color: var(--text); width: 100%; max-width: 480px; max-height: 94vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 18px 22px; box-shadow: 0 -10px 40px rgba(0,0,0,.35); }
.port-head { display: flex; justify-content: space-between; align-items: center; }
.port-x { background: transparent; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); }
.port-title { font-size: 22px; font-weight: 800; margin: 8px 0 4px; line-height: 1.2; }
.port-help { margin: 0 0 10px; }
.port-input { display: block; width: 100%; box-sizing: border-box; padding: 12px 12px; margin: 8px 0; border: 1.5px solid var(--border); border-radius: 10px; font-size: 17px; }
.port-check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 15px; }
.port-check input { width: 22px; height: 22px; accent-color: #b45309; }
.port-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; margin: 10px 0; }
.port-ok { color: #15803d; font-weight: 800; margin: 8px 0; }
.port-bad { color: #b91c1c; font-weight: 700; margin: 8px 0; line-height: 1.5; }
.port-next { width: 100%; margin-top: 10px; font-size: 16px; padding: 14px; }
.port-photo { display: flex; align-items: center; justify-content: center; border: 2px dashed #b45309; border-radius: 12px; padding: 18px; font-weight: 800; color: #b45309; cursor: pointer; margin: 8px 0; }
.port-photo input { display: none; }
.port-fields { display: grid; gap: 8px; margin: 10px 0; }
.port-field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.port-field input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 16px; }
.port-loa { background: #0b0b0d; color: #e8e6e1; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; }
.port-sig { width: 100%; height: 160px; background: #fff; border: 2px solid #111; border-radius: 12px; touch-action: none; margin-top: 10px; }
.port-summary { display: grid; gap: 6px; font-size: 15px; margin: 8px 0; }
.port-tracker { margin-top: 10px; }
.port-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.port-chip { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); color: #8d897f; }
.port-chip.on { background: #f5b942; color: #111; border-color: #f5b942; }
.port-status { color: #fff; font-weight: 700; font-size: 14px; margin: 4px 0; }
.port-live { background: #ecfdf5; color: #14532d; border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.num-card .num-today { margin-top: 8px; color: #cfcbc3; }
.num-card .door-line { margin: 8px 0 0; color: #cfcbc3; font-size: 12.5px; line-height: 1.5; }
.num-card .door-line-new { color: #e8e6e1; }
.num-card .num-today b { color: #fff; }
/* RING_FIRST_V1 Part 4: who took the call, at the top of a thread */
.call-outcome { font-size: 13px; font-weight: 700; padding: 8px 12px; border-radius: 10px; margin: 0 0 10px; }
.call-outcome.is-owner { background: #ecfdf5; color: #15803d; border: 1px solid #bbf7d0; }
.call-outcome.is-awol  { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.today-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 12px 16px 0; }
.today-cell { background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; text-align: center; }
.today-cell .tn { font-size: 22px; font-weight: 800; }
.today-cell .tk { font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; margin-top: 2px; }
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.pill-emergency { background: #dc2626; color: #fff; }
.pill-new { background: var(--gold); color: #1a1508; }
.pill-other { background: #e4e2dc; color: #57534e; }
.lead-actions { display: flex; gap: 8px; margin-top: 10px; }
.lead-actions a, .lead-actions button { flex: 1; min-height: 44px; display: flex;
  align-items: center; justify-content: center; border-radius: 12px; font-size: 14px;
  font-weight: 700; text-decoration: none; cursor: pointer; border: none; }
.act-call { background: var(--gold); color: #1a1508; }
.act-thread { background: #fff; color: var(--text); border: 1px solid var(--border) !important; }
