/* ==========================================================================
   Line — calling console

   Concept: a call is two voices over time, and one of them is a machine.
   Time and two tracks organise everything here. Agent audio reads amber and
   sits above the axis; the caller reads teal and sits below it.

   Palette is drawn from telephone exchange equipment: petrol navy panels and
   the amber of a line-active indicator lamp.
   ========================================================================== */

:root {
  /* Ink and paper */
  /* Neutral + accent tokens match the landing page exactly, so the console and
     the front page read as one system. */
  --ink:        #101812;   /* warm near-black text (landing --ink) */
  --ink-2:      #4C5852;   /* secondary text */
  --ink-3:      #8A958F;   /* captions, meta */
  --paper:      #F6F7F5;   /* page — same off-white as the landing */
  --card:       #FFFFFF;
  --card-2:     #ECEFEA;   /* inset wells — distinct from the page */
  --edge:       #D3D9D0;   /* card + control borders, clearly visible on the page */
  --edge-soft:  #E2E6E0;   /* internal dividers */

  /* Signal */
  --amber:      #C97A1E;   /* line active, agent track, primary action */
  --amber-lift: #E8931F;
  --amber-wash: #FBF0E1;
  --teal:       #2C86A6;   /* caller track, secondary (landing --teal) */
  --teal-wash:  #E1EEF3;
  --brick:      #A8422C;   /* failure */
  --brick-wash: #F7E7E3;
  --moss:       #4A6B45;   /* healthy */
  --moss-wash:  #E8EFE6;

  /* Type */
  --display: "Familjen Grotesk", "Helvetica Neue", Helvetica, sans-serif;
  --body:    "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* The signal panels — line bar, ribbon, toast, sign-in — are dark in BOTH
     themes, so they need a colour that does NOT flip. --ink cannot be used for
     their background: it flips to light in dark mode and made them white. */
  --panel:   #0F1B24;

  /* Frame */
  --line-h:  56px;
  --rail-w:  196px;
  --radius:  14px;
  --radius-lg: 18px;
  --shadow:  0 1px 2px rgba(15, 27, 36, .06), 0 12px 30px -12px rgba(15, 27, 36, .26);
  --shadow-lift: 0 3px 6px rgba(15, 27, 36, .07), 0 26px 50px -20px rgba(15, 27, 36, .36);
  --ease:    .18s cubic-bezier(.4, 0, .2, 1);
}

/* Dark palette — unchanged from before. Applied two ways: explicitly when the
   user picks dark from the toggle, or automatically when the OS asks for dark
   AND the user hasn't chosen (`:not([data-theme])`). The header script stamps
   data-theme on <html> before first paint, so switching never flashes. */
:root[data-theme="dark"] {
  --ink:       #E7EDF1;
  --ink-2:     #A9BAC4;
  --ink-3:     #7E919C;
  --paper:     #0B141B;
  --card:      #121F28;
  --card-2:    #0E1A22;
  --edge:      #23343E;
  --edge-soft: #1B2A33;
  --amber-wash: #2A1F10;
  --teal-wash:  #10242E;
  --brick-wash: #2A1512;
  --moss-wash:  #17231A;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.5), 0 18px 40px -18px rgba(0,0,0,.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --ink:       #E7EDF1;
    --ink-2:     #A9BAC4;
    --ink-3:     #7E919C;
    --paper:     #0B141B;
    --card:      #121F28;
    --card-2:    #0E1A22;
    --edge:      #23343E;
    --edge-soft: #1B2A33;
    --amber-wash: #2A1F10;
    --teal-wash:  #10242E;
    --brick-wash: #2A1512;
    --moss-wash:  #17231A;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lift: 0 2px 4px rgba(0,0,0,.5), 0 18px 40px -18px rgba(0,0,0,.7);
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* The browser's own [hidden] rule is a bare attribute selector, so any class
   that sets `display` outranks it and the element stays visible. That is why the
   Mute button and the connecting dots showed while the call was idle. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; margin: 0; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--edge);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Navigation links show the current page with .on, so they need no focus ring. */
.rail a:focus-visible, .mark:focus-visible { outline: none; }

/* --------------------------------------------------------------------------
   Line status bar
   -------------------------------------------------------------------------- */

.line {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--line-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  /* Frosted glass bar, like the landing page header. Theme-aware via --paper;
     the background is translucent so the blur behind it is visible. */
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
          backdrop-filter: blur(16px) saturate(1.6);
  color: var(--ink);
  border-bottom: 1px solid var(--edge);
}

.mark {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
  flex: none;
  cursor: pointer;
}

/* Four bars at unequal heights — a waveform frozen mid-syllable. */
.mark-bars { display: flex; align-items: center; gap: 2.5px; height: 18px; }
.mark-bars i { width: 3px; border-radius: 2px; background: var(--amber); display: block; }
.mark-bars i:nth-child(1) { height: 7px; }
.mark-bars i:nth-child(2) { height: 16px; }
.mark-bars i:nth-child(3) { height: 11px; background: #4E8CA8; }
.mark-bars i:nth-child(4) { height: 5px;  background: #4E8CA8; }

.mark-word {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.02em;
}

.line-readout {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  min-width: 0;
}

.readout {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}
.readout strong { color: var(--ink); font-weight: 700; }

.line-readout .rule { width: 1px; height: 16px; background: var(--edge); flex: none; }

/* The lamp pulses in real UK ring cadence: 400ms on, 200ms off, 400ms on,
   then a two-second rest. Steady amber whenever a call is connected. */
.lamp {
  width: 9px; height: 9px; border-radius: 50%;
  background: #3A4C57;
  flex: none;
}
.lamp[data-live="ringing"] {
  background: var(--amber-lift);
  animation: ring-cadence 3s steps(1, end) infinite;
}
.lamp[data-live="live"] {
  background: var(--amber-lift);
  box-shadow: 0 0 0 3px rgba(232, 147, 31, .22);
}

@keyframes ring-cadence {
  0%,  13.33% { opacity: 1; }
  13.34%, 20% { opacity: .2; }
  20.01%, 33.33% { opacity: 1; }
  33.34%, 100%   { opacity: .2; }
}

.icon-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
}

/* Theme toggle — lives in the dark line bar, so it's styled light-on-dark and
   always visible. */
.line-ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  background: var(--card-2);
  border: 1px solid var(--edge);
  color: var(--ink-2);
  border-radius: 9px;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.line-ctl:hover { background: var(--card); color: var(--ink); border-color: var(--ink-3); }
.line-ctl svg { width: 17px; height: 17px; }
/* Show the sun in dark mode (click → go light) and the moon in light mode. */
.line-ctl .i-sun  { display: none; }
.line-ctl .i-moon { display: block; }
:root[data-theme="dark"] .line-ctl .i-sun  { display: block; }
:root[data-theme="dark"] .line-ctl .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .line-ctl .i-sun  { display: block; }
  :root:not([data-theme]) .line-ctl .i-moon { display: none; }
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.shell { display: flex; align-items: flex-start; }

.rail {
  position: sticky;
  top: var(--line-h);
  width: var(--rail-w);
  flex: none;
  height: calc(100vh - var(--line-h));
  padding: 22px 12px;
  /* Separated from the content by depth, not colour: a crisp divider plus a
     soft shadow cast toward the main area, so the sidebar reads as its own
     layer while staying the same background. */
  border-right: 1px solid var(--edge);
  box-shadow: 8px 0 20px -14px rgba(15, 27, 36, .35);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rail a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.rail a:hover { background: var(--card-2); color: var(--ink); transform: translateX(2px); }
.rail a.on {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--amber-lift), var(--shadow);
}
.rail a.on:hover { transform: none; }

.stage {
  flex: 1;
  min-width: 0;
  padding: 30px 34px 72px;
  max-width: 1180px;
}

.stage-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--edge-soft);
}

.stage-titles h1 { font-size: clamp(27px, 3.2vw, 34px); letter-spacing: -.025em; }
.stage-titles p  { margin: 6px 0 0; color: var(--ink-3); font-size: 14px; max-width: 62ch; }
.stage-actions   { display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Type utilities
   -------------------------------------------------------------------------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Phone numbers, timecodes, durations and money are all mono: they need to
   align down a column and be read digit by digit. */
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.muted { color: var(--ink-3); }

/* Money columns on the Credits ledger. The base `table.data th` rule is more
   specific than a bare .ta-r, so header + cell alignment are set explicitly. */
.ta-r { text-align: right; }
table.data th.ta-r, table.data td.ta-r { text-align: right; }
.amt-up { color: var(--moss); }
.amt-dn { color: var(--brick); }

/* Profile */
.profile-id { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--edge-soft); }
.profile-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--amber-wash); color: var(--amber-2);
  font-family: var(--display); font-weight: 700; font-size: 22px;
}
.profile-email { font-weight: 600; font-size: 16px; }
.proprows { display: grid; gap: 0; }
.proprow { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--edge-soft); }
.proprow:last-child { border-bottom: 0; }

/* Table pagination footer. */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-top: 1px solid var(--edge-soft); font-size: 13px; flex-wrap: wrap; }
.pager-btns { display: flex; gap: 8px; }

/* Toggle switch (auto top-up). */
.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; font-size: 14.5px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 40px; height: 23px; border-radius: 999px; background: var(--edge); position: relative; transition: background var(--ease); flex: none; }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--ease); }
.switch input:checked + .switch-track { background: var(--amber-lift); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(17px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--amber-wash); }
.ar-fields { transition: opacity var(--ease); }

/* Credit top-up pack buttons. */
.topup-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.topup-btn { font-family: var(--mono); font-weight: 700; font-size: 16px; padding: 12px 22px; min-width: 96px; }
.topup-btn:hover { border-color: var(--amber); color: var(--amber); }
.topup-custom { font-weight: 600; padding: 12px 18px; border-style: dashed; color: var(--ink-2); }
.topup-custom:hover { border-color: var(--amber); color: var(--amber); border-style: solid; }

/* --------------------------------------------------------------------------
   Cards and grids
   -------------------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow var(--ease), border-color var(--ease), transform var(--ease);
}
/* Cards that stand on their own (a metric, a grid tile) lift a touch on hover,
   the way the landing's feature cards do. Cards used as static containers can
   opt out with .is-flat. */
.grid > .card:hover, .figure.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card.is-flat:hover { transform: none; box-shadow: var(--shadow); }

/* --------------------------------------------------------------------------
   Entrance motion — when a view mounts into #view its content rises into place,
   cards and tiles staggered, so navigating feels alive rather than a hard cut.
   The whole view fades; grid/stack tiles rise with a short cascade.
   -------------------------------------------------------------------------- */
@keyframes app-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes app-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

#view > * { animation: app-fade .28s ease both; }
#view .stack > *, #view .grid > * { animation: app-rise .44s cubic-bezier(.4, 0, .2, 1) both; }
#view .stack > *:nth-child(2), #view .grid > *:nth-child(2) { animation-delay: .045s; }
#view .stack > *:nth-child(3), #view .grid > *:nth-child(3) { animation-delay: .09s; }
#view .stack > *:nth-child(4), #view .grid > *:nth-child(4) { animation-delay: .135s; }
#view .stack > *:nth-child(5), #view .grid > *:nth-child(5) { animation-delay: .18s; }
#view .stack > *:nth-child(n+6), #view .grid > *:nth-child(n+6) { animation-delay: .22s; }

@media (prefers-reduced-motion: reduce) {
  #view > *, #view .stack > *, #view .grid > * { animation: none; }
}

.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--edge-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stack { display: grid; gap: 20px; }

/* Readouts on the overview — the figure leads, the label follows. */
.figure { padding: 16px 18px; }
.figure-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--ink);
}
.figure-value.is-amber { color: var(--amber); }
.figure-label { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }

/* --------------------------------------------------------------------------
   Overview hero — the line itself.

   A calling console should open with the thing it is: a live line. This is a
   dark exchange panel that states the line's status in big display type, with
   the ring-cadence lamp and a signal waveform rising from its floor. It carries
   the page's whole visual weight so everything below can stay quiet.
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(201,122,30,.16), transparent 55%),
    var(--panel);
  border-radius: 14px;
  padding: 30px 30px 0;
  color: #EEF3F6;
  min-height: 232px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px -26px rgba(0,0,0,.7);
}

.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #6E828E;
}

.hero-lamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8FA1AC;
}
.hero-lamp b { width: 10px; height: 10px; border-radius: 50%; background: #3A4C57; display: block; }
.hero-lamp[data-live="live"] b {
  background: var(--amber-lift);
  box-shadow: 0 0 0 4px rgba(232,147,31,.22), 0 0 16px 2px rgba(232,147,31,.5);
}
.hero-lamp[data-live="live"] { color: var(--amber-lift); }

.hero-state {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -.035em;
  font-size: clamp(32px, 5.2vw, 54px);
  line-height: 1.0;
  margin-top: 20px;
  color: #F4F8FA;
}
.hero-state em { font-style: normal; color: var(--amber-lift); }
.hero-state.is-quiet { color: #C9D6DE; }

.hero-sub {
  color: #90A2AD;
  font-size: 14.5px;
  margin-top: 12px;
  max-width: 54ch;
}
.hero-sub b { color: #D6E0E6; font-weight: 600; }

/* The signal: bars rising from the floor of the panel, a wave travelling left
   to right. It idles gently and quickens when a call is on the line. */
.hero-wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 60px;
  margin-top: auto;
  padding-top: 22px;
}
.hero-wave i {
  flex: 1 1 0;
  min-width: 0;
  height: 34%;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, rgba(120,150,165,.08), rgba(150,175,188,.42));
  transform-origin: bottom;
  animation: wave 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.05s);
}
.hero-wave.is-live i {
  background: linear-gradient(to top, rgba(232,147,31,.22), var(--amber-lift));
  animation-duration: 1.15s;
}
@keyframes wave {
  0%, 100% { transform: scaleY(.4);  opacity: .55; }
  50%      { transform: scaleY(1);   opacity: .95; }
}

/* The quiet stat strip under the hero — mono, understated, one line. */
.linestrip {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  padding: 15px 20px;
}
.linestrip > div { font-size: 13.5px; color: var(--ink-3); }
.linestrip b {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-right: 6px;
}

/* --------------------------------------------------------------------------
   The call ribbon — the signature element.
   Two tracks against a shared time axis. Agent above, caller below,
   barge-ins marked where the caller cut in.
   -------------------------------------------------------------------------- */

.ribbon {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px 18px 12px;
  overflow: hidden;
}

.ribbon-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.ribbon-head .eyebrow { color: #7E919C; }
.ribbon-legend { display: flex; gap: 14px; font-family: var(--mono); font-size: 10.5px; color: #A9BAC4; }
.ribbon-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ribbon-legend i { width: 8px; height: 8px; border-radius: 2px; display: block; }
.ribbon-legend .k-agent  { background: var(--amber-lift); }
.ribbon-legend .k-caller { background: #4E8CA8; }
.ribbon-legend .k-cut    { background: #C7503A; }

.ribbon-plot { position: relative; height: 74px; }

/* The centre line is the time axis; both tracks grow away from it. */
.ribbon-axis {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: rgba(255,255,255,.16);
}

.ribbon-track { position: absolute; left: 0; right: 0; display: flex; align-items: flex-end; gap: 2px; }
.ribbon-track.up   { bottom: 50%; }
.ribbon-track.down { top: 50%; align-items: flex-start; }

.ribbon-track i {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 1.5px;
  display: block;
  background: var(--amber-lift);
}
.ribbon-track.down i { background: #4E8CA8; }

/* A barge-in: the moment the caller talked over the agent. */
.ribbon-cut {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: #C7503A;
  opacity: .85;
}
.ribbon-cut::after {
  content: "";
  position: absolute;
  top: -1px; left: -2px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #C7503A;
}

.ribbon-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 10px;
  color: #6B7C86;
}

/* Compact single-line version used in call rows. */
.ribbon-mini { display: flex; align-items: center; gap: 1.5px; height: 22px; width: 108px; }
.ribbon-mini i { flex: 1 1 0; border-radius: 1px; background: var(--edge); display: block; }
.ribbon-mini i.a { background: var(--amber); }
.ribbon-mini i.c { background: var(--teal); }

/* --------------------------------------------------------------------------
   Transcript — timecoded, because the sequence is the information
   -------------------------------------------------------------------------- */

.turns { display: grid; gap: 2px; }

.turn {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 9px 10px;
  border-radius: 7px;
  align-items: baseline;
}
.turn:hover { background: var(--card-2); }

.turn-time {
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  padding-top: 2px;
}

.turn-who {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.turn.is-agent  .turn-who { color: var(--amber); }
.turn.is-caller .turn-who { color: var(--teal); }
.turn-text { color: var(--ink); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left;
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--edge-soft);
  white-space: nowrap;
}
table.data td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--edge-soft);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background var(--ease); }
table.data tbody tr.is-clickable { cursor: pointer; }
table.data tbody tr.is-clickable:hover { background: var(--card-2); box-shadow: inset 2px 0 0 var(--amber); }

/* --------------------------------------------------------------------------
   Tags
   -------------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--card-2);
  color: var(--ink-2);
  border: 1px solid var(--edge-soft);
  white-space: nowrap;
}
.tag.is-live    { background: var(--amber-wash); color: var(--amber); border-color: transparent; }
.tag.is-ok      { background: var(--moss-wash);  color: var(--moss);  border-color: transparent; }
.tag.is-bad     { background: var(--brick-wash); color: var(--brick); border-color: transparent; }
.tag.is-caller  { background: var(--teal-wash);  color: var(--teal);  border-color: transparent; }
.tag.is-warn    { background: var(--amber-wash); color: var(--amber-2); border-color: transparent; }

/* Clickable relationship badge in the Contacts table */
button.rel-badge {
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
button.rel-badge svg { opacity: .55; margin-left: 1px; }
button.rel-badge:hover { filter: brightness(.97); transform: translateY(-1px); }
button.rel-badge:hover svg { opacity: .9; }
button.rel-badge:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Relationship detail modal */
.rel-who { margin-bottom: 14px; }
.rel-who-name { font-size: 17px; font-weight: 650; color: var(--ink); }
.rel-who-num { font-family: var(--mono); font-size: 13px; margin-top: 2px; }
.rel-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13px; }
.rel-summary {
  margin: 0 0 12px;
  color: var(--ink);
  line-height: 1.6;
  font-size: 14.5px;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid var(--edge-soft);
  border-radius: 10px;
}
.rel-note { margin: 0; font-size: 13px; line-height: 1.5; }

/* Admin panel: segmented control + user-management modal */
.seg {
  display: inline-flex;
  background: var(--card-2);
  border: 1px solid var(--edge-soft);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.on {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-soft, 0 1px 3px rgba(0,0,0,.08));
}
.admin-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
  margin: 14px 0 4px;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid var(--edge-soft);
  border-radius: 10px;
}
.admin-kv > div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.admin-kv span { color: var(--ink-3); }
.admin-kv b { color: var(--ink); font-weight: 600; }
.admin-act { margin-top: 18px; }
.admin-act-title { font-size: 13px; font-weight: 650; color: var(--ink); margin-bottom: 8px; }
.admin-act-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
/* Inside an inline action row the field's own bottom margin would drop the input
   below the button; zero it so input and button share a baseline. */
.admin-act-row .field { margin-bottom: 0; }

/* Inline user-management form (replaces the table, not a popup) */
.manage-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.manage-status { display: flex; gap: 6px; flex-wrap: wrap; }
.manage-head h2 { font-size: 19px; font-weight: 650; color: var(--ink); margin: 0 0 2px; }
.manage-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--edge-soft);
}
.manage-balance {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px;
  background: var(--card-2);
  border: 1px solid var(--edge-soft);
  border-radius: 10px;
}
.manage-balance .figure-value { font-size: 30px; }
.manage-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.manage-danger .admin-act-title { color: var(--brick); }

/* "Get a number" chat wizard */
.buychat { display: flex; flex-direction: column; gap: 12px; }
.bchat-bot {
  align-self: flex-start;
  max-width: 90%;
  background: var(--card-2);
  border: 1px solid var(--edge-soft);
  border-radius: 4px 14px 14px 14px;
  padding: 12px 15px;
  font-size: 14px;
  line-height: 1.55;
}
.bchat-bot p { margin: 0 0 8px; }
.bchat-bot p:last-child { margin-bottom: 0; }
.bchat-you {
  align-self: flex-end;
  background: var(--teal-wash);
  color: var(--teal);
  border-radius: 14px 4px 14px 14px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
}
.bchat-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.bchat-controls .select { min-width: 200px; }
.bchat-summary {
  display: grid; gap: 8px;
  margin: 4px 0 10px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--edge-soft);
  border-radius: 10px;
}
.bchat-summary > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.bchat-summary span { color: var(--ink-3); }
.bchat-summary b { color: var(--ink); font-weight: 600; text-align: right; }

/* Campaign "From contacts" picker */
.camp-contacts {
  max-height: 240px; overflow-y: auto;
  border: 1px solid var(--edge-soft); border-radius: 10px; padding: 6px;
  background: var(--card);
}
.camp-contact {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.camp-contact:hover { background: var(--card-2); }
.camp-contact input { width: 16px; height: 16px; flex-shrink: 0; }
.camp-contact .num { font-family: var(--mono); font-size: 12.5px; }

/* Call recording player on the call detail */
.call-recording { padding: 14px 20px 0; }
.call-recording-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.call-recording-row audio { flex: 1; min-width: 240px; }
.call-recording-row .btn { flex-shrink: 0; }

/* Owned-number row with cancel / release actions */
.callerid-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.callerid-row + .callerid-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--edge-soft); }
.callerid-acts { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 17px;
  border-radius: 9px;
  border: 1px solid var(--edge);
  background: var(--card);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--ease), background var(--ease),
              box-shadow var(--ease), transform var(--ease);
}
.btn:hover { border-color: var(--ink-3); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

.btn.is-primary {
  background: var(--amber-lift);
  border-color: var(--amber-lift);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(232,147,31,.6);
}
.btn.is-primary:hover {
  filter: brightness(1.05);
  border-color: var(--amber-lift);
  box-shadow: 0 12px 26px -8px rgba(232,147,31,.72);
}

.btn.is-danger { color: var(--brick); border-color: var(--brick-wash); }
.btn.is-danger:hover { border-color: var(--brick); box-shadow: none; }

.btn.is-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.is-quiet:hover { background: var(--card-2); color: var(--ink); box-shadow: none; }

.btn.is-small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* A round call button. The one place the interface raises its voice. */
.btn-call {
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 0;
  background: var(--amber);
  color: #fff;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px -8px rgba(201, 122, 30, .8);
}
.btn-call:hover:not(:disabled) { background: var(--amber-lift); }
.btn-call:disabled { background: var(--ink-3); box-shadow: none; cursor: not-allowed; }
.btn-call.is-hangup { background: var(--brick); box-shadow: 0 8px 22px -8px rgba(168, 66, 44, .8); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { display: block; margin-bottom: 16px; }
.field > .label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink);
}
.field > .hint { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  transition: border-color var(--ease), box-shadow var(--ease);
}
/* Native selects render the OS arrow, which never matches the rest of the
   interface. Draw our own chevron instead and keep the control identical to a
   text input. The chevron is an inline SVG whose stroke can't be currentColor,
   so it is restated for dark mode. */
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9.5l6 6 6-6' stroke='%236B7C86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}
.select::-ms-expand { display: none; }

/* Option lists are drawn by the OS; setting these keeps them legible on the
   platforms that do honour them rather than flashing white in dark mode. */
.select option { background: var(--card); color: var(--ink); }

:root[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9.5l6 6 6-6' stroke='%237E919C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9.5l6 6 6-6' stroke='%237E919C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* The chevron nudges in on hover and focus, so the control feels responsive. */
.select:hover, .select:focus { background-position: right 10px center; }

/* --------------------------------------------------------------------------
   Combobox — a select we can actually style, and search.

   A native <select>'s open list is drawn by the OS, so CSS cannot reach it, and
   its type-ahead waits on a timer before jumping. This replaces both: the list
   is ours, and typing filters it as you go.
   -------------------------------------------------------------------------- */

.combo { position: relative; }

.combo-input { cursor: pointer; padding-right: 38px; }
.combo-input:focus { cursor: text; }
.combo.is-open .combo-input { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); }

/* A generous hit area around the arrow, so it is easy to press. The chevron
   itself is drawn on the ::before so the target can be bigger than the mark. */
.combo-caret {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.combo-caret::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg);
  transition: transform var(--ease), margin-top var(--ease), border-color var(--ease);
}
.combo-caret:hover::before { border-color: var(--ink); }
.combo.is-open .combo-caret::before { transform: rotate(225deg); margin-top: 3px; }

.combo-list {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 244px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
}

.combo-option {
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.combo-option:hover,
.combo-option.is-active { background: var(--card-2); }
.combo-option[aria-selected="true"] { font-weight: 600; }
.combo-option[aria-selected="true"]::after {
  content: "";
  width: 6px; height: 10px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
  flex: none;
  margin-bottom: 3px;
}
.combo-empty {
  padding: 12px 11px;
  font-size: 13.5px;
  color: var(--ink-3);
  text-align: center;
}

/* When Chrome autofills a field it paints its own pale background, and
   background-color can't override it — the browser wins. A large inset shadow
   is the way to cover it, and -webkit-text-fill-color restores the text colour.
   The absurd transition delay stops the flash before the shadow takes hold. */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.combo-input:-webkit-autofill,
.select:-webkit-autofill,
.textarea:-webkit-autofill,
.codebox-input:-webkit-autofill,
.gate .input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 100px var(--card) inset;
  box-shadow: 0 0 0 100px var(--card) inset;
  caret-color: var(--ink);
  transition: background-color 100000s ease-in-out 0s;
}

.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--amber);
  outline: none;
  box-shadow: 0 0 0 3px var(--amber-wash);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input.is-tel { font-family: var(--mono); letter-spacing: .04em; }

/* A field that carries a badge inside it, on the right. */
.field-wrap { position: relative; display: block; }
.field-wrap .input { padding-right: 108px; }

.tag-verified {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--moss-wash);
  color: var(--moss);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}
.tag-verified svg { width: 12px; height: 12px; }

/* Dark mode's moss is tuned for a wash behind dark text; lift it so the tick
   still reads against the darker field. */
:root[data-theme="dark"] .tag-verified { color: #7FB27A; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tag-verified { color: #7FB27A; }
}

/* The caller-ID number, shown large — it's the headline of the Numbers tab. */
.callerid { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.callerid-num {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--ink);
}
.callerid-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--amber); }

/* Segmented control — used for the number binding mode, where the two options
   are genuinely exclusive. */
.segmented { display: inline-flex; padding: 3px; background: var(--card-2); border-radius: 9px; border: 1px solid var(--edge-soft); }
.segmented button {
  padding: 7px 14px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* --------------------------------------------------------------------------
   Empty and unbuilt states.
   An empty screen is an invitation to act; an unbuilt one says plainly
   what has to exist before it can work.
   -------------------------------------------------------------------------- */

.empty {
  padding: 44px 24px;
  text-align: center;
}
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { margin: 0 auto 16px; color: var(--ink-3); max-width: 46ch; font-size: 14px; }

/* Status messages, not boxes. These only appear while something is happening, so
   they read as a line of text with a coloured rule rather than a filled panel. */
.notice {
  display: flex;
  gap: 12px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--teal);
  font-size: 14px;
  color: var(--ink-2);
  background: none;
}
.notice.is-warn { border-left-color: var(--amber); }
.notice.is-bad  { border-left-color: var(--brick); }
.notice strong { color: var(--ink); }
.notice code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Call UI — the in-browser test, as an open call screen (not a boxed control).
   Big avatar, name, status, a centred waveform and round Mute / End buttons.
   -------------------------------------------------------------------------- */

.callcard { position: relative; }

.callcard-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--edge-soft);
}
.callcard-pick-label {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  white-space: nowrap;
}
.callcard-pick .select { flex: 1; padding: 7px 34px 7px 10px; font-size: 13.5px; background-position: right 10px center; }

.callui {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 34px 24px 32px;
}

.callui-avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 42px;
  letter-spacing: .02em;
  background: linear-gradient(158deg, #4E8CA8, #295F79);
  box-shadow: 0 16px 36px -14px rgba(41,95,121,.7);
  position: relative;
  transition: background var(--ease), box-shadow var(--ease);
}
.callui-avatar svg { width: 46px; height: 46px; }
.callui.is-live .callui-avatar {
  background: linear-gradient(158deg, var(--amber-lift), var(--amber));
  box-shadow: 0 16px 36px -14px rgba(201,122,30,.7);
}
.callui.is-live .callui-avatar::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(232,147,31,.55);
  animation: callring 1.9s ease-out infinite;
}
@keyframes callring {
  0%   { transform: scale(1);    opacity: .8; }
  100% { transform: scale(1.28); opacity: 0; }
}

.callui-name {
  margin-top: 22px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -.02em;
  color: var(--ink);
}
.callui-status { margin-top: 7px; font-size: 15px; color: var(--teal); }
.callui.is-live .callui-status { color: var(--amber); }

.callui-dots { display: flex; gap: 5px; height: 8px; margin-top: 12px; }
.callui-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3);
  animation: calldot 1.4s infinite ease-in-out;
}
.callui-dots i:nth-child(2) { animation-delay: .18s; }
.callui-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes calldot {
  0%, 65%, 100% { opacity: .25; transform: translateY(0); }
  32%           { opacity: 1;   transform: translateY(-4px); }
}

/* Symmetric waveform, centred on the midline like a real call app. */
.callui-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 66px;
  width: 100%;
  margin-top: 28px;
}
.callui-wave i {
  width: 3px;
  height: 4px;
  border-radius: 3px;
  background: var(--edge);
  opacity: .5;                       /* a calm baseline at rest, not a dotted line */
  transition: height .09s ease, background var(--ease), opacity var(--ease);
}
.callui-wave i.on { background: var(--amber); opacity: 1; }

/* While connected but nobody is speaking, the line breathes rather than sitting
   dead — it reads as an open line waiting for you. */
.callui.is-live .callui-wave i {
  opacity: .85;
  animation: waveidle 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -0.045s);
}
.callui.is-live .callui-wave i.on { animation: none; }
@keyframes waveidle {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(2.2); }
}

.callui-actions {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 46px;
  margin-top: 34px;
}
.roundbtn-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.roundbtn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--card-2);
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--ease), background var(--ease), box-shadow var(--ease), color var(--ease);
}
.roundbtn svg { width: 24px; height: 24px; }
.roundbtn:hover:not(:disabled) { transform: translateY(-2px); }
.roundbtn:active:not(:disabled) { transform: none; }
.roundbtn:disabled { opacity: .5; cursor: not-allowed; }
.roundbtn.is-call {
  background: linear-gradient(180deg, var(--amber-lift), var(--amber));
  color: #fff; border-color: transparent;
  box-shadow: 0 10px 24px -8px rgba(201,122,30,.8);
}
.roundbtn.is-end {
  background: linear-gradient(180deg, #C2523A, var(--brick));
  color: #fff; border-color: transparent;
  box-shadow: 0 10px 24px -8px rgba(168,66,44,.8);
}
.roundbtn.is-muted { background: var(--amber-wash); color: var(--amber); border-color: transparent; }
.roundbtn-label { font-size: 13px; font-weight: 500; color: var(--ink-3); }

.callui-log {
  max-height: 360px;
  overflow-y: auto;
  padding: 0 16px 16px;
  /* thin, subtle scrollbar instead of the chunky default */
  scrollbar-width: thin;
  scrollbar-color: var(--edge) transparent;
}
.callui-log:empty { display: none; }
.callui-log { scroll-behavior: smooth; }
/* Each new turn slides up and fades in like a chat message. */
.callui-log .turn { animation: turn-in .3s cubic-bezier(.34, 1.2, .64, 1) both; }
@keyframes turn-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .callui-log .turn { animation: none; } }
.callui-log::-webkit-scrollbar { width: 8px; }
.callui-log::-webkit-scrollbar-track { background: transparent; }
.callui-log::-webkit-scrollbar-thumb {
  background: var(--edge);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.callui-log::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }

/* Shared thin scrollbar for the app's scroll panels, so none of them fall back
   to the chunky default. */
.turns, .chat, .ob-list, .combo-list, .table-wrap, .card-body {
  scrollbar-width: thin;
  scrollbar-color: var(--edge) transparent;
}
.turns::-webkit-scrollbar, .chat::-webkit-scrollbar, .ob-list::-webkit-scrollbar,
.combo-list::-webkit-scrollbar, .table-wrap::-webkit-scrollbar {
  width: 8px; height: 8px;
}
.turns::-webkit-scrollbar-thumb, .chat::-webkit-scrollbar-thumb, .ob-list::-webkit-scrollbar-thumb,
.combo-list::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb {
  background: var(--edge);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.turns::-webkit-scrollbar-track, .chat::-webkit-scrollbar-track, .ob-list::-webkit-scrollbar-track,
.combo-list::-webkit-scrollbar-track, .table-wrap::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------------------------
   Code entry — verifying a number by the code read out over the phone
   -------------------------------------------------------------------------- */

.codebox {
  margin-top: 18px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--amber);
}

.codebox-head { display: flex; align-items: flex-start; gap: 12px; }
.codebox-head strong { display: block; font-size: 14.5px; color: var(--ink); }
.codebox-head span { display: block; font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }

/* A small ringing indicator, on the same cadence as the line lamp. */
.codebox-ring {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--amber);
  flex: none;
  margin-top: 5px;
  animation: ring-cadence 3s steps(1, end) infinite;
}

.codebox-input {
  display: block;
  width: 100%;
  max-width: 240px;
  margin: 16px 0 0;
  padding: 14px 10px;
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: .38em;
  text-indent: .38em;          /* keeps the tracked text visually centred */
  text-align: center;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.codebox-input::placeholder { color: var(--ink-3); font-weight: 400; letter-spacing: .3em; }
.codebox-input:focus {
  border-color: var(--amber);
  outline: none;
  box-shadow: 0 0 0 3px var(--amber-wash);
}

.codebox-error {
  margin-top: 10px;
  font-size: 13px;
  color: var(--brick);
}

.codebox-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 27, .5);
  backdrop-filter: blur(6px) saturate(1.1);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  z-index: 60;
  overflow-y: auto;
}

.modal {
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  box-shadow: 0 24px 60px -20px rgba(15, 27, 36, .5);
  overflow: hidden;
}
.modal.is-wide { max-width: 900px; }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--edge-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--edge-soft);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--card-2);
}

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--edge-soft); padding: 0 20px; }
.tabs button {
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-bottom: 2px solid transparent;
  font-family: var(--body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--amber); }

pre.raw {
  margin: 0;
  padding: 14px;
  background: var(--panel);
  color: #C6D4DC;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

#toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
  justify-items: end;
}

/* A toast is a dark signal panel in BOTH themes, so its colours are fixed rather
   than drawn from --ink, which flips to light in dark mode and turned the toast
   into a white box with white, unreadable text. */
.toast {
  background: var(--panel);
  color: #E7EDF1;
  padding: 11px 15px;
  border-radius: 9px;
  font-size: 13.5px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.10);   /* lifts it off a dark page */
  max-width: 380px;
  border-left: 2px solid var(--amber);
}
.toast.is-bad { border-left-color: var(--brick); }
.toast.is-ok  { border-left-color: var(--moss); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .icon-btn { display: inline-flex; }
  .shell { display: block; }
  .hero { padding: 22px 20px 0; min-height: 190px; }
  .hero-wave { height: 44px; }
  .linestrip { gap: 18px; }
  .rail {
    position: fixed;
    top: var(--line-h);
    left: 0;
    width: 100%;
    height: auto;
    background: var(--card);
    border-right: 0;
    border-bottom: 1px solid var(--edge-soft);
    z-index: 30;
    display: none;
    box-shadow: var(--shadow);
  }
  .rail.is-open { display: flex; }
  .stage { padding: 22px 18px 60px; }
  .stage-titles h1 { font-size: 24px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .line-readout .rule:first-of-type { display: none; }
  #readout-health { display: none; }
  .turn { grid-template-columns: 44px 1fr; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .lamp[data-live="ringing"] { opacity: 1; }
  /* Waveform holds a calm resting shape rather than freezing mid-animation. */
  .hero-wave i { transform: scaleY(.5) !important; opacity: .85 !important; }
}

/* --------------------------------------------------------------------------
   Sign in

   A dark screen, because nothing is connected yet: the lamp is out and the
   line is quiet. The console proper is light; arriving there should feel like
   the room coming up.
   -------------------------------------------------------------------------- */

body.is-signed-out .line,
body.is-signed-out .shell { display: none; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--paper);
  overflow-y: auto;
}

/* Left: brand panel — always the dark petrol navy, like the app header. */
.gate-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 15% 0%, #16303E 0%, transparent 55%),
    var(--panel);
  color: #E7EDF1;
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
}
.gate-brand::after {   /* faint amber wash bottom-left, like a lit lamp */
  content: "";
  position: absolute;
  left: -20%; bottom: -30%;
  width: 70%; height: 70%;
  background: radial-gradient(circle, rgba(201,122,30,.18), transparent 60%);
  pointer-events: none;
}
.gate-mark {
  display: flex; align-items: center; gap: 10px;
  color: #E7EDF1;
}
.gate-mark .mark-word { font-size: 22px; }
.gate-brand-mid { margin-top: auto; margin-bottom: auto; position: relative; z-index: 1; }
.gate-tagline {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0 0 26px;
}
.gate-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.gate-points li {
  position: relative;
  padding-left: 26px;
  color: #A9BAC4;
  font-size: 14.5px;
}
.gate-points li::before {
  content: "";
  position: absolute; left: 0; top: 7px;
  width: 14px; height: 8px;
  border-left: 2px solid var(--amber-lift);
  border-bottom: 2px solid var(--amber-lift);
  transform: rotate(-45deg);
  border-radius: 50%;
}
.gate-brand-foot {
  position: relative; z-index: 1;
  color: #6E828D; font-size: 12.5px;
  font-family: var(--mono);
}

/* A quiet animated waveform sitting above the footer. */
.gate-wave { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin: 0 0 26px; opacity: .5; }
.gate-wave i {
  width: 3px; border-radius: 2px; flex: none;
  background: linear-gradient(var(--amber-lift), #2C6B87);
  animation: gate-bounce 1.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.08s);
  height: 30%;
}
@keyframes gate-bounce { 0%, 100% { height: 20%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .gate-wave i { animation: none; } }

/* Right: the sign-in card — theme-aware. */
.gate-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.gate-card { width: 100%; max-width: 360px; }
.gate h1 { font-size: 27px; margin-bottom: 6px; color: var(--ink); }
.gate p.gate-lead { color: var(--ink-3); font-size: 14.5px; margin: 0 0 26px; }
.gate .btn.is-primary { width: 100%; padding: 12px; margin-top: 4px; font-size: 15px; }

/* Password field with a show/hide eye. */
.gate-pw { position: relative; display: block; }
.gate-pw .input { padding-right: 44px; width: 100%; }
.gate-pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-3); border-radius: 8px;
}
.gate-pw-toggle:hover { color: var(--ink); }
.gate-pw-toggle svg { width: 19px; height: 19px; }
.gate-pw-toggle.is-on { color: var(--amber); }

.gate-error {
  background: var(--brick-wash);
  border-left: 2px solid var(--brick);
  color: var(--brick);
  padding: 10px 13px;
  border-radius: 7px;
  font-size: 13.5px;
  margin-bottom: 18px;
}
.gate-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--ink-3);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.gate-or::before, .gate-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--edge-soft);
}
.gate-google { display: flex; justify-content: center; }
/* Google renders its own button in an iframe; just centre it. */
.gate-google > div { margin: 0 auto; }

.gate-switch {
  margin: 18px 0 0;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}
.gate-switch a { color: var(--amber); font-weight: 600; text-decoration: none; }
.gate-switch a:hover { text-decoration: underline; }

.gate-note {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--edge-soft);
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.6;
}

/* On a phone the brand panel would eat the screen; drop it and keep the card. */
@media (max-width: 720px) {
  .gate { grid-template-columns: 1fr; }
  .gate-brand { display: none; }
}
.gate-note code {
  font-family: var(--mono);
  font-size: 12px;
  color: #C6D4DC;
  background: rgba(255,255,255,.07);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 4px;
}

/* Signed-in identity in the line bar */
.whoami {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 4px;
}
.whoami-email {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whoami button {
  background: var(--card);
  border: 1px solid var(--edge);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--body);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), color var(--ease);
}
.whoami button:hover { background: var(--brick-wash); border-color: var(--brick); color: var(--brick); }

@media (max-width: 760px) {
  .whoami-email { display: none; }
}

/* A styled file picker — the native "Choose file" control looks out of place.
   The real input is invisible on top of a drop-zone label. */
.filepick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1.5px dashed var(--edge);
  border-radius: 10px;
  background: var(--card-2);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}
.filepick:hover { border-color: var(--ink-3); }
.filepick.has-file { border-style: solid; border-color: var(--moss); }
.filepick input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.filepick-icon {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--edge-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3);
}
.filepick.has-file .filepick-icon { color: var(--moss); border-color: transparent; background: var(--moss-wash); }
.filepick-icon svg { width: 18px; height: 18px; }
.filepick-text { min-width: 0; }
.filepick-text strong { display: block; font-size: 14px; color: var(--ink); }
.filepick-text span { display: block; font-size: 12.5px; color: var(--ink-3); }

/* Number fields: the native spinners are ugly and rarely wanted here. */
.input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Campaign progress bar */
.progbar {
  height: 7px;
  border-radius: 4px;
  background: var(--edge-soft);
  overflow: hidden;
}
.progbar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  border-radius: 4px;
  transition: width var(--ease);
}

/* Read-only summary of the chosen agent's own settings, shown in the campaign
   form. Purely informational - it never edits the agent. */
.agentdef {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--edge-soft);
}
/* When shown between form fields (Test a call), give it room below too. */
#call-agent-defaults:not(:empty) { display: block; margin-bottom: 18px; }
.agentdef-head {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
  margin-bottom: 8px;
}
.agentdef-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 3px 0;
  font-size: 13.5px;
}
.agentdef-row span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding-top: 2px;
}
.agentdef-row div { color: var(--ink-2); }
.agentdef-foot {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   Dashboard — KPI tiles, activity chart, live status
   -------------------------------------------------------------------------- */

.kpi { padding: 18px 20px; }
.kpi-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--ink);
}
.kpi-value.is-amber { color: var(--amber); }
.kpi-label { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.kpi-note { margin-top: 2px; font-size: 12px; color: var(--ink-3); }

/* Two-thirds chart, one-third status. */
.dash-split { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .dash-split { grid-template-columns: 1fr; } }

/* Bar chart of calls per day. */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 150px;
}
.chart-col {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  border-radius: 4px;
}
.chart-col:hover { background: var(--card-2); }
.chart-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(to top, var(--teal), var(--amber));
  transition: height var(--ease);
}
.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}

/* Two-track activity chart: outbound (amber) grows up from the centre axis, the
   agent's track; inbound (teal) grows down, the caller's track. */
/* SVG call-activity chart — explicit pixel heights, always renders. */
.chart-svg { display: block; width: 100%; height: 168px; }

.chart2 {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 168px;
}
.chart2-axis {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--edge);
  pointer-events: none;
}
.chart2 .chart-col {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 3px;
  transition: background var(--ease);
}
.chart2 .chart-col:hover { background: var(--card-2); }
/* Explicit 50% height (not flex:1) so the bars' percentage heights resolve —
   a flex item gives its children no definite height to size against. */
.chart-up, .chart-dn { height: 50%; display: flex; min-height: 0; }
.chart-up { align-items: flex-end; }              /* bar bottom sits on the axis, grows up */
.chart-dn { align-items: flex-start; }            /* bar top sits on the axis, grows down */
.chart-up > span, .chart-dn > span {
  width: 100%;
  min-height: 2px;
  display: block;
}
.chart-up > span {
  background: linear-gradient(to top, var(--amber), var(--amber-lift));
  border-radius: 2px;
}
.chart-dn > span {
  background: linear-gradient(to bottom, var(--teal), #3f88a6);
  border-radius: 2px;
}

.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-legend .dot-out { background: var(--amber); }
.chart-legend .dot-in { background: var(--teal); }

/* Live status panel rows. */
.statline { display: flex; align-items: center; gap: 11px; padding-bottom: 14px; margin-bottom: 6px; border-bottom: 1px solid var(--edge-soft); }
.lamp2 { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: none; }
.lamp2.on { background: var(--amber-lift); box-shadow: 0 0 0 3px rgba(232,147,31,.22); }

.statrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--edge-soft);
  text-decoration: none;
  color: var(--ink-2);
  font-size: 14px;
  transition: color var(--ease);
}
.statrow:last-child { border-bottom: 0; }
.statrow:hover { color: var(--ink); }
.statrow .num { color: var(--ink); font-weight: 600; }

/* SMS chat thread */
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding: 4px; }
.chat-msg { display: flex; }
.chat-msg.is-out { justify-content: flex-end; }
.chat-bubble {
  max-width: 76%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}
.chat-msg.is-in .chat-bubble { background: var(--card-2); color: var(--ink); border-bottom-left-radius: 0; }
.chat-msg.is-out .chat-bubble { background: var(--amber); color: #fff; border-bottom-right-radius: 0; }

/* Full-page conversation view: fixed header + composer, only the middle scrolls. */
.thread {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 420px;
  padding: 0;
  overflow: hidden;
}
.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--edge-soft);
  flex: none;
}
.thread-who { display: flex; align-items: center; gap: 10px; }
.thread-avatar {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--ink-3);
  font-size: 12px; font-weight: 600;
  letter-spacing: .5px;
}
.thread-num { font-weight: 600; font-size: 15px; }
.thread-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.thread-empty { margin: auto; text-align: center; max-width: 320px; }
.thread-compose {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--edge-soft);
  flex: none;
}
.thread-compose .input { flex: 1; }

/* Action buttons packed into a table row's last cell. */
.rowacts { white-space: nowrap; text-align: right; }
.rowacts .btn + .btn { margin-left: 6px; }

/* Phone-style dial box. */
.dialer { max-width: 360px; margin: 0 auto; }
.dialer-display {
  position: relative;
  text-align: center;
  padding: 10px 0 4px;
  margin-bottom: 18px;
}
.dialer-number {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 1px;
  text-align: center;
  padding: 6px 0;
}
.dialer-number:focus { outline: none; }
.dialer-number::placeholder { color: var(--ink-3); }
.dialer-name { display: block; min-height: 18px; color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }
.dialer-status { display: inline-block; margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.dialer-status.is-ringing { color: var(--amber); }
.dialer-status.is-live { color: var(--moss); }
.dialer-status.is-bad { color: var(--brick); }
.dialer-verified { position: static; display: inline-flex; margin-top: 6px; }

.dialer-agent { max-width: 300px; margin: 0 auto 18px; }

.dialpad {
  display: grid;
  grid-template-columns: repeat(3, 62px);
  justify-content: center;
  gap: 12px 18px;
  margin: 0 auto 8px;
}
.dialkey {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--edge-soft);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform .06s ease;
}
.dialkey:hover { background: var(--edge); border-color: var(--ink-3); }
.dialkey:active { transform: scale(.94); }
.dialkey-d { font-family: var(--mono); font-size: 20px; font-weight: 600; line-height: 1; }
.dialkey-s { font-size: 8.5px; font-weight: 600; letter-spacing: .12em; color: var(--ink-3); }
.dialkey.is-back { color: var(--ink-3); }
.dialkey.is-back svg { width: 22px; height: 22px; }

.dialer-call {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 18px auto 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #22B14C;          /* vibrant call-green */
  color: #fff;
  font-size: 0;                 /* icon only, keeps the "Call" text for screen readers */
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(34, 177, 76, .55);
  transition: filter var(--ease), transform .06s ease, opacity var(--ease);
}
.dialer-call:hover { filter: brightness(1.1); }
.dialer-call:active { transform: scale(.94); }
.dialer-call svg { width: 26px; height: 26px; }
.dialer-call .dc-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dialer-call:disabled { opacity: .6; cursor: default; }
.dialer-call.is-dialling { background: var(--amber); box-shadow: 0 6px 18px -6px rgba(201, 122, 30, .7); }

/* End-call state: red, hangup icon. */
.dialer-call .dc-end { display: none; }
.dialer-call.is-end { background: var(--brick); box-shadow: 0 6px 18px -6px rgba(168, 66, 44, .7); }
.dialer-call.is-end .dc-call { display: none; }
.dialer-call.is-end .dc-end { display: block; }

/* Outbound dialer: the contacts list beside the dial box. */
.ob-list { display: flex; flex-direction: column; gap: 4px; max-height: 460px; overflow-y: auto; }
.ob-contact {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  padding: 9px 10px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--ink); cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.ob-contact:hover { background: var(--card-2); }
.ob-contact.is-on { background: var(--card-2); border-color: var(--edge); }
/* Neutral keyboard focus (not the global amber ring) so a tapped contact never
   flashes an orange boundary. */
.ob-contact:focus-visible { outline: 2px solid var(--edge); outline-offset: 2px; }
.ob-avatar {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--card-2); color: var(--ink-3);
  overflow: hidden;
}
.ob-avatar svg { width: 34px; height: 34px; display: block; }
.ob-who { display: flex; flex-direction: column; min-width: 0; }
.ob-name { font-weight: 600; font-size: 14px; }
.ob-num { font-size: 12.5px; color: var(--ink-3); }

/* Verdict pills at the top of a call summary (Interested / Positive / Score …). */
.pillrow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
}
.pill.is-good    { background: var(--moss-wash);  color: var(--moss);  border-color: var(--moss); }
.pill.is-bad     { background: var(--brick-wash); color: var(--brick); border-color: var(--brick); }
.pill.is-warn    { background: var(--amber-wash); color: var(--amber); border-color: var(--amber); }
.pill.is-neutral { background: var(--card-2);     color: var(--ink-2); border-color: var(--edge); }

/* Section heading inside a panel (e.g. above the call transcript). */
.section-h {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}

/* Copy-to-clipboard rows in the agent integration panel. */
.copyrow { display: flex; gap: 8px; align-items: stretch; }
.copyrow .input { flex: 1; }
.copyrow .btn { flex: none; align-self: center; }
.input.mono { font-family: var(--mono); font-size: 13px; }
pre.code {
  flex: 1;
  margin: 0;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid var(--edge-soft);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre;
}
