/* TalkTool for Five9 — the calling workspace. Loaded after app.css (which the Five9 panel
   also uses) and scoped to body.ws, so the panel's look is untouched.
   Brand roles follow the TalkTool for RingCentral workspace. Flat: no images, no imports. */
body.ws {
  --canvas: #f5f8fc; --surface: #fff; --subtle: #f8fafc; --hover: #eef3f9; --selected: #e6edf7;
  --text: #14243b; --muted-text: #53647a; --border: #dce4ee; --control-border: #8796aa;
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: #edf3ff; --accent-line: #bcd0fb; --accent-ink: #1d4ed8; --on-accent: #fff;
  --success: #047857; --success-soft: #ecfdf5; --success-line: #a7e3c6;
  --warning: #92400e; --warning-soft: #fffbeb; --warning-line: #fde68a;
  --error: #b91c1c; --error-soft: #fef2f2; --error-line: #fecaca;
  --focus: #2563eb;
  /* the names app.css uses, so everything it styles follows the same palette */
  --fg: var(--text); --muted: var(--muted-text); --line: var(--border); --bg: var(--canvas); --card: var(--surface); --soft: var(--subtle);
  --ok: var(--success); --warn: var(--warning); --bad: var(--error); --notice-bg: var(--warning-soft); --notice-line: var(--warning-line);
  --radius: 12px;
  background: var(--canvas); color: var(--text);
  font: 14px/20px Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  body.ws {
    --canvas: #171819; --surface: #1d1f21; --subtle: #242629; --hover: #2e3135; --selected: #2e3135;
    --text: #f1f2f3; --muted-text: #a6adb7; --border: #34383e; --control-border: #5b6470;
    --accent: #3b82f6; --accent-hover: #60a5fa; --accent-soft: #1c2a44; --accent-line: #2f4675; --accent-ink: #93c5fd; --on-accent: #fff;
    --success: #34d399; --success-soft: #12261f; --success-line: #1f4a3a;
    --warning: #fbbf24; --warning-soft: #2a2212; --warning-line: #4d3d16;
    --error: #f87171; --error-soft: #2b1717; --error-line: #5a2626;
    --focus: #60a5fa;
  }
}

/* ---- controls */
.ws button, .ws select, .ws input { border-color: var(--control-border); background: var(--surface); color: var(--text); border-radius: 8px; }
.ws button { min-height: 36px; padding: 0 14px; font-weight: 500; }
.ws select, .ws input[type="tel"], .ws input[type="text"] { min-height: 40px; padding: 0 10px; }
.ws input[type="checkbox"], .ws input[type="radio"] { min-height: 0; accent-color: var(--accent); }
.ws button:hover:not(:disabled) { background: var(--hover); }
.ws button:focus-visible, .ws select:focus-visible, .ws input:focus-visible, .ws summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ws button:disabled { color: var(--muted-text); background: var(--surface); border-color: var(--border); opacity: .55; }
.ws button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ws button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.ws button.primary:disabled { background: var(--accent); border-color: var(--accent); color: var(--on-accent); opacity: .45; }
.ws button.danger:not(:disabled) { color: var(--error); border-color: var(--error-line); }
.ws button.destructive { background: var(--error); border-color: var(--error); color: #fff; }
.ws button.destructive:disabled { background: var(--error); border-color: var(--error); color: #fff; opacity: .4; }
.ws button.link { min-height: 0; border: 0; background: none; color: var(--muted-text); padding: 4px 0; }
.ws button[aria-pressed="true"] { background: var(--selected); border-color: var(--accent); }

/* ---- top bar */
.ws .topbar { min-height: 52px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ws .topbar .brand { font-weight: 600; font-size: 15px; }
.ws .spacer { flex: 1; }
.ws .pill { font-size: 13px; line-height: 18px; padding: 3px 10px; border-radius: 999px; background: var(--subtle); border: 1px solid var(--border); color: var(--muted-text); }
.ws .pill.ok { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.ws .pill.warn { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.ws .pill.bad { background: var(--error-soft); border-color: var(--error-line); color: var(--error); }
.ws .pill:empty { display: none; }
.ws .seg { display: inline-flex; border: 1px solid var(--control-border); border-radius: 8px; overflow: hidden; }
.ws .seg button { min-height: 32px; border: 0; border-radius: 0; padding: 0 12px; color: var(--muted-text); }
.ws .seg button + button { border-left: 1px solid var(--control-border); }
.ws .seg #btn-ready[aria-pressed="true"] { background: var(--success-soft); color: var(--success); font-weight: 600; }
.ws .seg #btn-notready[aria-pressed="true"] { background: var(--warning-soft); color: var(--warning); font-weight: 600; }

/* ---- page */
.ws .page { max-width: 1280px; padding: 20px 24px 40px; }
.ws .page > .card { max-width: 520px; margin-left: auto; margin-right: auto; }
.ws h1 { font-size: 22px; line-height: 28px; font-weight: 600; }
.ws h2 { font-size: 15px; line-height: 22px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 10px; }
.ws .card { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.ws .why { font-size: 13px; line-height: 18px; }
.ws .small { font-size: 13px; line-height: 18px; }

.ws .next { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.ws .next .grow { flex: 1; min-width: 240px; }
.ws .next .label { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .04em; }
.ws .next p { margin: 2px 0 0; font-size: 15px; line-height: 22px; }
.ws .next .tick { flex-basis: 100%; }

.ws .grid { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; grid-template-areas: "left conv right"; gap: 16px; align-items: start; }
.ws .col-left { grid-area: left; min-width: 0; } .ws .col-right { grid-area: right; min-width: 0; } .ws .conversation { grid-area: conv; }
.ws .below { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }

/* ---- call card */
.ws .routing { background: var(--subtle); border-radius: 8px; }
.ws .notice { border-radius: 8px; color: var(--text); }
.ws .pairing { border-color: var(--control-border); border-radius: 12px; }
.ws .callbox { display: grid; gap: 10px; padding: 12px; margin: 8px 0; border: 1px solid var(--border); border-radius: 10px; background: var(--subtle); }
.ws .callbox .line { display: flex; align-items: baseline; gap: 8px; }
.ws .callbox .who { font-size: 15px; line-height: 22px; font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ws .callbox .timer { font-variant-numeric: tabular-nums; color: var(--muted-text); font-size: 13px; }
.ws .callbox[data-state="TALKING"] { border-color: var(--success-line); background: var(--success-soft); }
.ws .callbox[data-state="ON_HOLD"], .ws .callbox[data-state="WRAP_UP"] { border-color: var(--warning-line); background: var(--warning-soft); }
.ws .callbox[data-state="OFFERED"], .ws .callbox[data-state="RINGING_ON_OUR_SIDE"] { border-color: var(--accent-line); background: var(--accent-soft); }
.ws .callbox .control-row { margin: 0; }
.ws .callbox select { flex: 1 1 140px; min-width: 0; min-height: 36px; }
.ws .step::before { border-color: var(--control-border); }
.ws .step.current::before { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ws .step.done::before { color: var(--success); border-color: var(--success-line); background: var(--success-soft); }
.ws .confirm-box { border-color: var(--error-line); background: var(--error-soft); border-radius: 8px; }
.ws .keypad-display { border-color: var(--border); min-height: 36px; }

/* ---- dialer */
.ws #outbound-number { width: 100%; min-height: 44px; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: .02em; flex: none; }
.ws #outbound-number::placeholder { color: var(--muted-text); font-size: 15px; letter-spacing: 0; }
.ws .dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.ws .dialpad button { min-height: 40px; padding: 0; font-size: 16px; font-variant-numeric: tabular-nums; border-color: var(--border); background: var(--subtle); }
.ws .field { display: grid; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--muted-text); }
.ws .field select { width: 100%; color: var(--text); }

/* ---- conversation */
.ws .conversation { min-height: 420px; display: flex; flex-direction: column; padding: 0; }
.ws .conversation > header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ws .conversation > header h2 { margin: 0; flex: 1; }
.ws .captions { flex: 1; max-height: 62vh; margin: 0; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.ws .captions:empty::before { content: "What you and the caller say will appear here, with the translation, once translation is on."; color: var(--muted-text); margin: auto; max-width: 320px; text-align: center; padding: 48px 0; }
.ws .turn { max-width: 78%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--subtle); align-self: flex-start; }
.ws .turn[data-side="0"] { align-self: flex-end; background: var(--accent-soft); border-color: var(--accent-line); }
.ws .turn .who { font-size: 12px; line-height: 16px; font-weight: 600; text-transform: none; letter-spacing: 0; margin-bottom: 2px; }
.ws .turn p { margin: 0; font-size: 15px; line-height: 22px; }
.ws .turn .original { font-size: 13px; line-height: 18px; }

/* ---- translation + side cards */
.ws .field-grid { grid-template-columns: 1fr; gap: 10px; }
.ws .field-grid label { font-size: 13px; }
.ws .tick { align-items: flex-start; line-height: 18px; margin: 10px 0 2px; }
.ws .tick input { margin-top: 1px; flex: none; }
.ws .numbers .label { min-width: 0; flex: 1 1 150px; }
.ws .numbers .row-line { font-size: 13px; }
.ws .rule { height: 1px; background: var(--border); margin: 12px 0; }
.ws .history th { color: var(--muted-text); }
.ws .log { background: #14181d; color: #e4e7eb; border-radius: 8px; }

@media (max-width: 1180px) {
  .ws .grid { grid-template-columns: 340px minmax(0, 1fr); grid-template-areas: "left conv" "right conv"; }
}
@media (max-width: 880px) {
  .ws .topbar { padding: 8px 16px; }
  .ws .page { padding: 16px; }
  .ws .grid { grid-template-columns: 1fr; grid-template-areas: "left" "right" "conv"; }
  .ws .below { grid-template-columns: 1fr; }
  .ws button, .ws .seg button { min-height: 44px; }
  .ws .dialpad button { min-height: 48px; }
  .ws .turn { max-width: 92%; }
}
@media (prefers-reduced-motion: no-preference) { .ws button { transition: background-color .14s ease, border-color .14s ease; } }
