/* The Voice Solutions — Number Inbox */
:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --ink: #142033;
  --ink-2: #4a5568;
  --muted: #7b8496;
  --line: #e6e3da;
  --brand: #0e8f7e;
  --brand-ink: #ffffff;
  --brand-soft: #e2f3ef;
  --warn: #d9472b;
  --warn-soft: #fdebe6;
  --ok: #1d8a4f;
  --ok-soft: #e4f4ea;
  --info-soft: #e8eefb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .05), 0 6px 24px rgba(20, 32, 51, .06);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141d;
    --surface: #151d29;
    --surface-2: #1a2331;
    --ink: #e9edf3;
    --ink-2: #b7c0cd;
    --muted: #8590a2;
    --line: #263142;
    --brand: #2bb9a4;
    --brand-ink: #062720;
    --brand-soft: #123a35;
    --warn: #ff7a5c;
    --warn-soft: #3a1f1a;
    --ok: #4fd18b;
    --ok-soft: #15301f;
    --info-soft: #1b2740;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
h1, h2 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
p { margin: .3em 0 .8em; }
.muted { color: var(--muted); }
.tiny { font-size: .82rem; }
.center { text-align: center; }
.warn { color: var(--warn); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; color: var(--muted); margin: 0 0 .3em; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand-mark { width: 34px; height: 34px; color: var(--brand); flex: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-weight: 800; font-size: .98rem; }
.brand-text small { color: var(--muted); font-size: .78rem; font-weight: 600; }

/* Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 .9rem var(--font); padding: 9px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none !important;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--brand); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-block { width: 100%; padding: 12px 16px; font-size: 1rem; }
.btn-tiny { padding: 5px 10px; font-size: .8rem; border-radius: 8px; }
input, select, textarea {
  font: 500 .95rem var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { font-family: var(--mono); font-size: .82rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; }
label input[type=checkbox] { width: auto; }
label.tiny { flex-direction: row; align-items: center; font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* Alerts & tags */
.alert { border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; border: 1px solid transparent; }
.alert-error { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-info { background: var(--info-soft); }
.tag { display: inline-block; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* Auth pages */
.auth-wrap { flex: 1; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 520px; }
.auth-card .brand { margin-bottom: 22px; }
.auth-card h1 { font-size: 1.45rem; }
.checks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 4px; font-size: .9rem; }
.checks .ok { color: var(--ok); }
.checks .bad { color: var(--warn); font-weight: 700; }

/* App shell */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px;
  padding: 12px max(16px, calc((100vw - 1080px) / 2)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 7px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: .9rem; text-decoration: none; }
.topnav a.on, .topnav a:hover { background: var(--surface); color: var(--ink); }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 40px; flex: 1; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--ok); }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.site-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 18px 16px 26px; }

/* Customer hero */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.did-number { font-family: var(--mono); font-size: clamp(1.6rem, 5vw, 2.3rem); font-weight: 600; margin: 0; letter-spacing: -.02em; }
.stats { display: flex; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; min-width: 96px; }
.stat span { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat small { color: var(--muted); font-weight: 600; font-size: .75rem; }
.stat-warn span { color: var(--warn); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tabs a { padding: 8px 16px; border-radius: 9px; color: var(--ink-2); font-weight: 700; font-size: .92rem; text-decoration: none; }
.tabs a em { font-style: normal; font-weight: 600; color: var(--muted); font-size: .8rem; margin-left: 4px; }
.tabs a.on { background: var(--ink); color: var(--bg); }
.tabs a.on em { color: inherit; opacity: .7; }
.search { display: flex; gap: 8px; align-items: center; flex: 1; max-width: 460px; }
.search select { width: auto; }
.search input[type=search] { flex: 1; min-width: 0; }

/* Feed */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.who { font-family: var(--mono); font-weight: 600; display: flex; flex-direction: column; }
.who small { font-family: var(--font); font-weight: 500; font-size: .8rem; }
time { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.sms-body { margin: 8px 0 10px; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; font-size: 1rem; }
.item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { font: 600 .78rem var(--font); background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px; cursor: pointer; }
.chip:hover { border-color: var(--muted); }
.chip.code { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.code b { font-family: var(--mono); letter-spacing: .06em; }
.chip.copied { background: var(--ok); color: #fff; }
.call { display: flex; gap: 14px; align-items: flex-start; }
.call-main { flex: 1; min-width: 0; }
.call-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; font-size: 1.1rem; font-weight: 800; background: var(--surface-2); }
.call-missed { border-left: 3px solid var(--warn); }
.call-missed .call-icon { background: var(--warn-soft); color: var(--warn); }
.call-answered .call-icon { background: var(--ok-soft); color: var(--ok); }
.call .item-actions { margin-top: 6px; }
.badge { font-size: .74rem; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.badge-missed { background: var(--warn-soft); color: var(--warn); }
.badge-answered { background: var(--ok-soft); color: var(--ok); }
.badge-ringing { background: var(--info-soft); color: var(--ink-2); }
.empty { text-align: center; padding: 56px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-icon { font-size: 2rem; opacity: .5; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-weight: 600; }
.new-pill { position: sticky; top: 70px; z-index: 5; text-align: center; margin-bottom: 10px; }
.new-pill a { display: inline-block; background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 99px; font-weight: 700; font-size: .88rem; box-shadow: var(--shadow); }

/* Admin */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.add-form { display: grid; grid-template-columns: 1.2fr 1.5fr .8fr auto; gap: 12px; align-items: end; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.row-off td { opacity: .55; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.actions form { margin: 0; }
.inline-edit { display: flex; gap: 6px; min-width: 190px; }
.inline-edit input { padding: 6px 9px; font-size: .85rem; border-color: transparent; background: transparent; }
.inline-edit input:hover, .inline-edit input:focus { border-color: var(--line); background: var(--surface); }
.inline-edit .btn { visibility: hidden; }
.inline-edit:focus-within .btn { visibility: visible; }
details.more { position: relative; }
details.more summary { list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
.del-form { position: absolute; right: 0; top: 34px; z-index: 3; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 240px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.pin-card { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.pin { font-family: var(--mono); font-size: 2rem; font-weight: 600; letter-spacing: .18em; margin: 0; }
.pin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: start; margin: 8px 0; }
.copy-row input, .copy-row textarea { font-family: var(--mono); font-size: .82rem; background: var(--surface-2); }
.copy-label { font-weight: 700; font-size: .85rem; padding-top: 10px; }
.steps { padding-left: 20px; display: grid; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row-form { display: flex; gap: 8px; margin-bottom: 12px; }

@media (max-width: 760px) {
  .add-form, .grid-2 { grid-template-columns: 1fr; }
  .copy-row { grid-template-columns: 1fr auto; }
  .copy-label { grid-column: 1 / -1; padding: 0; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topnav { order: 3; width: 100%; }
  .brand-text small { display: none; }
  .stats { width: 100%; }
  .stat { flex: 1; min-width: 0; padding: 10px 12px; }
  .search { max-width: none; flex: 1 1 100%; }
  .item-head { flex-direction: column; gap: 2px; }
}
