/* Client Hub: styled after the Assurancia Groupe Tardif website
   (deep teal-navy, orange accents, warm cream backgrounds, rounded cards, pill buttons). */

:root {
  --navy: #0a3547;
  --navy-soft: #3d6172;
  --orange: #e65300;
  --orange-dark: #c24500;
  --cream: #fcede5;
  --bg: #f7f8f8;
  --white: #ffffff;
  --gold: #ea940b;
  --gold-soft: #fcc56d;
  --teal: #00a9a1;
  --line: rgba(10, 53, 71, 0.12);
  --muted: #5b7482;
  --radius: 18px;
  --shadow: 0 10px 34px rgba(10, 53, 71, 0.07);
  --font: "Poppins", "Century Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: #222; background: var(--bg); }
a { color: var(--orange-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: 76px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--navy); }
.brand:hover { text-decoration: none; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-word { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; color: var(--navy); }
.brand-sub { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--orange); margin-top: 4px; }
.nav { display: flex; gap: 6px; flex: 1; }
.nav a { color: var(--navy); font-weight: 500; padding: 8px 14px; border-radius: 999px; }
.nav a:hover { background: var(--cream); text-decoration: none; }
.nav a.active { background: var(--cream); color: var(--orange-dark); }
.header-right { display: flex; align-items: center; gap: 12px; }
.demo-tag { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--navy-soft); background: var(--cream); padding: 5px 12px; border-radius: 999px; }
.nav-toggle { display: none; }

/* ---------- layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 32px 24px 64px; }
.hero { background: var(--cream); border-radius: var(--radius); padding: 40px 44px; position: relative; overflow: hidden; margin-bottom: 28px; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(230,83,0,.18), rgba(230,83,0,0) 70%); }
.kicker, .hero .kicker, .login-art .kicker { color: var(--orange); font-weight: 500; font-size: 1.05rem; margin-bottom: 8px; }
.hero p { max-width: 640px; color: var(--navy-soft); margin-bottom: 0; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-detail { grid-template-columns: minmax(320px, 5fr) 7fr; align-items: start; }
.grid-kpi { grid-template-columns: repeat(4, 1fr); margin-bottom: 28px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.card + .card { margin-top: 24px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.stack > * + * { margin-top: 24px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 11px 24px; font: 600 .95rem var(--font); cursor: pointer; color: var(--white); background: var(--orange); transition: background .15s, transform .05s; }
.btn:hover { background: var(--orange-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #c9d3d8; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); }
.btn-ghost:hover { background: var(--navy); color: var(--white); }
.btn-small { padding: 7px 16px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---------- badges, avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; letter-spacing: .03em; padding: 3px 11px; border-radius: 999px; background: #e9eef1; color: var(--navy); white-space: nowrap; }
.badge-vip { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #4a2d00; }
.badge-ok { background: rgba(0,169,161,.14); color: #00776f; }
.badge-warn { background: rgba(230,83,0,.12); color: var(--orange-dark); }
.badge-demo { background: var(--navy); color: var(--white); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: var(--white); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; flex: none; }
.avatar.vip { box-shadow: 0 0 0 3px var(--gold-soft); }
.avatar.lg { width: 68px; height: 68px; font-size: 1.3rem; }
.person { display: flex; align-items: center; gap: 12px; }
.person .name { font-weight: 600; color: var(--navy); }

/* ---------- KPI ---------- */
.kpi { padding: 22px 24px; }
.kpi .num { font-size: 2.3rem; font-weight: 700; color: var(--navy); line-height: 1; }
.kpi .label { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.kpi.accent { background: var(--navy); border-color: var(--navy); }
.kpi.accent .num, .kpi.accent .label { color: var(--white); }
.kpi.accent .label { opacity: .8; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.clickable tbody tr { cursor: pointer; }
.table.clickable tbody tr:hover { background: var(--cream); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .85rem; color: var(--navy); margin-bottom: 6px; }
.input, select.input { width: 100%; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 14px; font: 400 .98rem var(--font); background: var(--white); color: #222; }
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(230,83,0,.14); }
.search { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search .input { flex: 1; min-width: 220px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 16px; border-radius: 999px; font-weight: 500; font-size: .88rem; color: var(--navy); background: var(--white); box-shadow: inset 0 0 0 1.5px var(--line); }
.chip:hover { text-decoration: none; background: var(--cream); }
.chip.active { background: var(--navy); color: var(--white); box-shadow: none; }

/* ---------- live calls ---------- */
.live-card { padding: 0; overflow: hidden; margin-bottom: 28px; }
.live-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 26px; border-bottom: 1px solid var(--line); }
.live-card-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.softphone-frame { display: block; width: 100%; height: 600px; border: 0; background: var(--white); }
.live-frame { display: block; width: 100%; height: 250px; border: 0; background: var(--white); }
.live-body { background: var(--white); padding: 0 8px 8px; min-height: 100vh; }
.live-bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px 6px; font-size: .95rem; color: var(--navy); }
.live-dot { width: 11px; height: 11px; border-radius: 50%; background: #c9d3d8; flex: none; }
.live-dot.on { background: var(--teal); box-shadow: 0 0 0 0 rgba(0,169,161,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0,169,161,.55); } 70% { box-shadow: 0 0 0 9px rgba(0,169,161,0); } 100% { box-shadow: 0 0 0 0 rgba(0,169,161,0); } }
.live-table td, .live-table th { padding: 11px 12px; }
.live-table .time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); }
.live-table tr.is-ended { color: var(--muted); }
.live-table tr.is-ended .time { color: var(--muted); font-weight: 500; }
.live-table tr.is-live { background: rgba(0,169,161,.05); }
.live-table tr.is-new { animation: appear 1.6s ease-out; }
@keyframes appear { from { background: rgba(230,83,0,.22); } to { background: rgba(0,169,161,.05); } }
.live-table tbody tr { cursor: pointer; }
.badge-live { background: rgba(0,169,161,.16); color: #00776f; }
.live-table .who { color: var(--navy); margin-right: 6px; }
.live-table .code { font-size: .74rem; word-break: break-all; display: inline-block; max-width: 12rem; }
@media (prefers-reduced-motion: reduce) { .live-dot.on, .live-table tr.is-new { animation: none; } }

/* ---------- forms: rows, danger actions ---------- */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row.three { grid-template-columns: 2fr 1fr 1.2fr; }
.btn-danger { background: #b3261e; }
.btn-danger:hover { background: #8f1d17; }
.danger-zone { border-color: rgba(179, 38, 30, .3); }
.danger-zone h1, .danger-zone h2 { color: #8f1d17; }
@media (max-width: 720px) { .field-row, .field-row.three { grid-template-columns: 1fr; gap: 0; } }

/* ---------- option groups (checkboxes) ---------- */
.call-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
fieldset.options { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 16px 6px; margin: 0 0 18px; }
fieldset.options legend { font-weight: 600; font-size: .85rem; color: var(--navy); padding: 0 8px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; cursor: pointer; line-height: 1.35; }
.option input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--orange); flex: none; }

/* ---------- flash messages ---------- */
.flash { border-radius: 14px; padding: 13px 18px; margin-bottom: 20px; background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--navy); font-weight: 500; }
.flash.success { border-left-color: var(--teal); background: rgba(0,169,161,.08); }
.flash.error { border-left-color: var(--orange); background: rgba(230,83,0,.08); }
.flash.info { border-left-color: var(--gold); background: rgba(234,148,11,.08); }

/* ---------- detail pages ---------- */
.client-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.client-head h1 { margin: 0; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.meta-list dt { color: var(--muted); font-size: .85rem; }
.meta-list dd { margin: 0; font-weight: 500; color: var(--navy); word-break: break-word; }
.team-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.team-row:first-of-type { border-top: 0; padding-top: 0; }
.team-row .role { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--orange-dark); font-weight: 600; }
details.policy { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; background: var(--white); }
details.policy[open] { box-shadow: var(--shadow); }
details.policy summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
details.policy summary::-webkit-details-marker { display: none; }
details.policy summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; color: var(--orange); font-weight: 500; }
details.policy[open] summary::after { content: "–"; }
.policy-body { padding: 0 18px 16px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px var(--cream); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.summary-box { background: var(--cream); border-radius: 14px; padding: 18px 20px; white-space: pre-line; color: var(--navy); }
pre.json { background: #0f2f3d; color: #d6e6ee; border-radius: 14px; padding: 16px; overflow-x: auto; font-size: .8rem; max-height: 360px; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 10px; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; background: #eef2f4; padding: 2px 7px; border-radius: 7px; word-break: break-all; }
.copy-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.copy-row .code { flex: 1; padding: 11px 14px; min-width: 240px; }
.check { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--orange); flex: none; }
.dot.on { background: var(--teal); }

/* ---------- login ---------- */
.field label.show-password { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-weight: 500; font-size: .85rem; color: var(--muted); cursor: pointer; }
.show-password input { width: 16px; height: 16px; accent-color: var(--orange); }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--cream); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::before, .login-art::after { content: ""; position: absolute; border-radius: 50%; }
.login-art::before { width: 520px; height: 520px; right: -200px; bottom: -180px; background: radial-gradient(circle at 35% 35%, rgba(230,83,0,.2), rgba(230,83,0,0) 70%); }
.login-art::after { width: 260px; height: 260px; left: -90px; top: 30%; background: radial-gradient(circle at 40% 40%, rgba(10,53,71,.14), rgba(10,53,71,0) 70%); }
.login-art > * { position: relative; z-index: 1; }
.login-art h1 { font-size: clamp(2rem, 4vw, 3.1rem); max-width: 560px; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--white); }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 1.6rem; }

.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 24px 40px; }

@media (max-width: 1000px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-detail, .grid-2, .grid-3, .grid-bottom, .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 32px; min-height: 260px; }
}
@media (max-width: 720px) {
  .header-inner { height: auto; padding: 12px 18px; flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .container { padding: 20px 16px 48px; }
  .hero { padding: 28px 24px; }
  .grid-kpi { grid-template-columns: 1fr 1fr; gap: 14px; }
  .demo-tag { display: none; }
}

/* Overview: calls on the left, the Zoom softphone in a column on the right, as tall as the two call tables together */
body:has(.console) .container { max-width: none; }
.console { display: grid; grid-template-columns: minmax(0, 1fr) var(--sp-width, 380px); gap: 16px; align-items: stretch; transition: grid-template-columns .2s ease; }
.console:has(.softphone.is-retracted) { grid-template-columns: minmax(0, 1fr) 56px; }
.console-main { min-width: 0; }
.console-main > .card:last-child { margin-bottom: 0; }
.softphone { margin: 0; display: flex; flex-direction: column; min-height: 560px; }
.softphone .live-card-head { padding: 12px 18px; border-bottom: 1px solid var(--line); }
#softphone-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.softphone-frame { flex: 1; width: 100%; height: auto; min-height: 480px; border: 0; background: var(--white); }
/* Retracted: the panel shrinks sideways into a slim tab (the softphone stays loaded inside) */
.softphone.is-incoming { box-shadow: 0 0 0 3px var(--orange, #e65300); }
@media (max-width: 1100px) { .console, .console:has(.softphone.is-retracted) { grid-template-columns: 1fr; } .softphone.is-retracted { width: auto; } }

/* Compact Overview header: title, search and four small tiles on one line */
.topbar { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.topbar-title { margin: 0; font-size: 1.5rem; line-height: 1; }
.topbar-search { flex: 1 1 260px; max-width: 420px; margin: 0; display: flex; gap: 8px; flex-wrap: nowrap; }
.topbar-search .input { margin: 0; min-width: 0; padding: 8px 14px; }
.stats { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.stats a { display: flex; flex-direction: column; align-items: flex-start; min-width: 92px; padding: 6px 14px; border-radius: 10px; background: var(--white); border: 1px solid var(--line); color: var(--navy-soft); font-size: .72rem; line-height: 1.25; text-decoration: none; text-transform: lowercase; }
.stats a:hover { border-color: var(--navy); }
.stats strong { display: block; color: var(--navy); font-size: 1.15rem; line-height: 1.1; }
.stats li:first-child a { background: var(--navy); border-color: var(--navy); color: #fff; }
.stats li:first-child strong { color: #fff; }
.live-card { margin-bottom: 16px; }
.live-card-head { padding: 12px 20px; }
.recent-card { padding: 16px 20px; margin-bottom: 16px; }
.recent-card .card-head { margin-bottom: 8px; }
.table-compact td, .table-compact th { padding-top: 7px; padding-bottom: 7px; }
.console-main > .card:last-child { margin-bottom: 0; }

/* Search lives in the site header on every page */
.header-search { flex: 0 1 300px; margin: 0; }
.header-search .input { width: 100%; margin: 0; padding: 8px 14px; font-size: .88rem; }
@media (max-width: 900px) { .header-search { order: 4; flex: 1 1 100%; } }

/* Overview tiles: centred, one brand colour each */
.topbar { justify-content: center; position: relative; }
.topbar-title { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }
.stats { margin: 0 auto; justify-content: center; gap: 12px; }
.stats a { min-width: 120px; padding: 8px 18px; border: 0; border-radius: 14px; font-size: .74rem; font-weight: 500; box-shadow: 0 4px 14px rgba(10, 53, 71, .10); transition: transform .12s ease, box-shadow .12s ease; }
.stats a:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(10, 53, 71, .16); }
.stats strong { font-size: 1.4rem; font-weight: 700; }
.stats .tile-navy a { background: linear-gradient(135deg, #0a3547, #17566f); color: #cfe3ec; }
.stats .tile-gold a { background: linear-gradient(135deg, #ea940b, #fcc56d); color: #5a3800; }
.stats .tile-teal a { background: linear-gradient(135deg, #00a9a1, #4fd1c9); color: #04403d; }
.stats .tile-orange a { background: linear-gradient(135deg, #e65300, #ff8a3d); color: #fff2e8; }
.stats .tile-navy strong, .stats .tile-orange strong { color: #fff; }
.stats .tile-gold strong { color: #3d2600; }
.stats .tile-teal strong { color: #022e2c; }
@media (max-width: 900px) { .topbar-title { position: static; transform: none; } .stats { margin: 0; } }

/* Overview bar: title + search on the left, tiles centred on the page */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; position: static; }
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar-title { position: static; transform: none; }
.topbar-search { flex: 1 1 200px; max-width: 360px; margin: 0; display: flex; gap: 8px; flex-wrap: nowrap; }
.topbar-search .input { margin: 0; min-width: 0; padding: 8px 14px; }
.stats { margin: 0; }
@media (max-width: 1300px) { .topbar { grid-template-columns: 1fr; } .stats { justify-content: flex-start; } }

/* Customer card under Live calls: appears when an agent answers */
.caller-card { margin-bottom: 16px; border-top: 4px solid var(--teal); }
.caller-card[hidden] { display: none; }
.caller-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.caller-body { padding: 14px 20px 18px; }
.caller-who { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.caller-who .name { font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.caller-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 20px; margin-bottom: 14px; }
.caller-facts dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.caller-facts dd { margin: 0; font-weight: 500; color: var(--navy); overflow-wrap: anywhere; }
.caller-unknown { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--cream); border-radius: 12px; padding: 16px 18px; }
#recent-card.is-minimised #recent-body { display: none; }
#recent-card.is-minimised .card-head { margin-bottom: 0; }

/* Compact customer card */
.caller-body { padding: 10px 18px 12px; }
.caller-who { margin-bottom: 8px; gap: 10px; }
.caller-who .name { font-size: 1.1rem; }
.caller-facts { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px 16px; margin-bottom: 8px; }
.caller-facts dd { font-size: .88rem; }
.caller-sub { font-size: .85rem; margin: 4px 0 2px; }
.caller-body .table td, .caller-body .table th { padding-top: 5px; padding-bottom: 5px; font-size: .85rem; }
.caller-body tr[hidden] { display: none; }
.caller-body > .btn-small { margin-top: 6px; }

/* Agents-ready tile: green when someone is Ready, red when nobody is, grey until Zoom has reported any status */
.stats .tile-agents a { color: #fff; transition: background .3s ease; }
.stats .tile-agents strong { color: #fff; }
.stats .tile-agents.is-ready a { background: linear-gradient(135deg, #0e9f4f, #3ccf7a); }
.stats .tile-agents.is-none a { background: linear-gradient(135deg, #c62828, #ef5350); }
.stats .tile-agents.is-unknown a { background: linear-gradient(135deg, #6b7f8a, #94a7b0); }
.stats .tile-agents.is-none strong { animation: pulse-none 1.6s ease-in-out infinite; }
@keyframes pulse-none { 50% { opacity: .55; } }
/* The signed-in agent: name, status and one-click Ready / Busy */
.agent-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); }
.agent-id { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.agent-id strong { color: var(--navy); font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-btns { display: flex; gap: 6px; }
.agent-btns .btn[disabled] { opacity: .5; cursor: default; }
.agent-btns .btn.is-current { box-shadow: 0 0 0 2px var(--navy); }
.agent-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #9aa9b1; flex: none; vertical-align: middle; }
.agent-dot.is-ready { background: #0e9f4f; box-shadow: 0 0 0 3px rgba(14, 159, 79, .2); }
.agent-dot.is-notready { background: #c62828; }
.agent-dot.is-occupied { background: var(--gold); }


/* The Ready / Not Ready button sits in the Overview bar, above the softphone, so it works even while the panel is retracted */
.topbar-agent { justify-self: end; border: 0; background: transparent; padding: 0; gap: 12px; }
.topbar-agent .agent-id { flex: 0 1 auto; align-items: flex-end; text-align: right; max-width: 220px; }
.agent-toggle { min-width: 110px; color: #fff; border: 0; font-weight: 600; transition: background .2s ease; }
.agent-toggle.is-ready { background: #0e9f4f; }
.agent-toggle.is-ready:hover { background: #0b8040; }
.agent-toggle.is-notready { background: #c62828; }
.agent-toggle.is-notready:hover { background: #a61f1f; }
.agent-toggle.is-occupied { background: var(--gold); color: #3d2600; }
.agent-toggle.is-idle { background: #6b7f8a; }
@media (max-width: 1300px) { .topbar-agent { justify-self: start; } }

/* Sized by the softphone itself (its size buttons send zcc-resize): width and height of the open panel */
.softphone.is-sized:not(.is-retracted) { min-height: 0; align-self: start; }
.softphone.is-mini .live-card-head h2 { display: none; }
.softphone.is-mini .live-card-head { padding: 6px; justify-content: center; }
.softphone.is-mini #softphone-toggle { padding: 2px 8px; }
.softphone.is-sized:not(.is-retracted) .softphone-frame { flex: none; min-height: 0; height: var(--sp-height); }


/* Minimised: only a small tab (the toggle and a vertical label). The softphone stays loaded and hidden behind it. */
.softphone.is-retracted { align-self: start; min-height: 0; width: 56px; }
.softphone.is-retracted #softphone-body { position: absolute; width: 1px; height: 1px; overflow: hidden; visibility: hidden; }
.softphone.is-retracted .live-card-head { flex-direction: column; align-items: center; gap: 14px; padding: 12px 6px 18px; border-bottom: 0; }
.softphone.is-retracted .live-card-head h2 { writing-mode: vertical-rl; font-size: .95rem; white-space: nowrap; margin: 0; }
.softphone.is-retracted #softphone-toggle { order: -1; padding: 4px 10px; }

/* Minimised: the softphone frame itself is hidden and shrunk too, so none of Zoom's controls can show */
.softphone.is-retracted .softphone-frame { visibility: hidden; position: absolute; width: 1px; height: 1px; min-height: 0; }

/* Compact delete button beside the call buttons at the top of a client page */
.btn-danger-ghost { background: transparent; color: #b3261e; border: 1px solid #b3261e; }
.btn-danger-ghost:hover { background: #b3261e; color: #fff; }

/* Profile lists page */
.list-row { border-top: 1px solid var(--line); padding: 10px 0; }
.list-edit { display: flex; gap: 8px; align-items: center; margin: 0; }
.list-edit .input { margin: 0; flex: 1; min-width: 0; padding: 8px 12px; }
.list-edit .code-input { flex: 0 0 120px; text-transform: uppercase; }
.list-delete { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin: 6px 0 0; }
.list-delete .btn[disabled] { opacity: .4; cursor: not-allowed; }

/* Lists: each entry is one line with a Modify button that opens its edit fields */
.list-item { border-top: 1px solid var(--line); }
.list-item summary { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; list-style: none; }
.list-item summary::-webkit-details-marker { display: none; }
.list-item summary strong { flex: 1; color: var(--navy); }
.list-item summary .btn { margin-left: auto; }
.list-item[open] summary .btn { background: var(--navy); color: #fff; }
.list-item .list-row { border-top: 0; padding: 0 0 12px; }
.list-edit select.input { flex: 0 0 130px; }

/* Multi-select dropdown (a closed box that opens a list of checkboxes) */
details.multi { position: relative; }
details.multi summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 12px; background: var(--white); padding: 10px 40px 10px 14px; min-height: 44px; position: relative; display: flex; align-items: center; }
details.multi summary::-webkit-details-marker { display: none; }
details.multi summary::after { content: "▾"; position: absolute; right: 14px; color: var(--muted); }
details.multi[open] summary { border-color: var(--navy); }
.multi-label.is-empty { color: var(--muted); }
.multi-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(10, 53, 71, .15); padding: 6px; max-height: 320px; overflow: auto; }
.multi-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.multi-item:hover { background: var(--bg); }
.multi-item input { width: 18px; height: 18px; accent-color: var(--navy); }

/* Client page: contact details, the team and the call centre profile side by side; policies and history below */
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.grid-bottom { grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr); align-items: start; }
@media (max-width: 1100px) { .grid-3, .grid-bottom { grid-template-columns: 1fr; } }

/* ---- Client page: summary bar, edit-in-place sections on the left, tabs on the right ---- */
.client-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.client-bar .back { font-weight: 500; }
.find-client { display: flex; gap: 8px; margin: 0; flex: 0 1 380px; }
.find-client .input { margin: 0; padding: 8px 14px; min-width: 0; flex: 1; }
.summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 20px; margin-bottom: 16px; }
.summary-id { flex: 1; min-width: 220px; }
.summary-id h1 { margin: 0 0 4px; font-size: 1.5rem; }
.summary-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.summary-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.client-layout { display: grid; grid-template-columns: minmax(330px, 4fr) minmax(0, 8fr); gap: 16px; align-items: start; }
.client-side { display: flex; flex-direction: column; gap: 16px; }
.client-side .card { margin: 0; padding: 14px 18px; }
.client-side .card-head { margin-bottom: 8px; }
.client-side .card-head h2 { font-size: 1.05rem; margin: 0; }
.facts { margin: 0; display: grid; gap: 8px; }
.facts > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.sect.is-editing .view { display: none; }
.sect.is-editing [data-edit] { display: none; }
.sect .edit[hidden] { display: none; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.client-main { padding: 0; overflow: hidden; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; background: var(--bg); }
.tab { border: 0; background: transparent; padding: 14px 16px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--navy); }
.tab[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--orange); }
.tab .count { display: inline-block; min-width: 22px; padding: 1px 7px; margin-left: 6px; border-radius: 999px; background: var(--white); border: 1px solid var(--line); font-size: .75rem; text-align: center; }
.tab-panel { padding: 14px 20px 18px; max-height: calc(100vh - 250px); min-height: 320px; overflow: auto; }
.tab-panel[hidden] { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.audio-row td { padding: 0 8px 8px; border-top: 0; }
.audio-row audio { width: 100%; height: 34px; }
@media (max-width: 1100px) { .client-layout { grid-template-columns: 1fr; } .tab-panel { max-height: none; } }
@media (max-width: 560px) { .facts > div { grid-template-columns: 1fr; gap: 0; } }

/* An element marked hidden stays hidden whatever display its class gives it (the "+ Create new…" fields rely on this) */
[hidden] { display: none !important; }

/* Policy numbers on the summary bar: visible without opening the Policies tab */
.policy-line { margin-top: 6px; }
.policy-chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--navy); font-size: .8rem; text-decoration: none; }
.policy-chip:hover { border-color: var(--navy); }
.policy-chip.is-inactive { opacity: .6; }
.policy-chip .code { font-weight: 700; letter-spacing: .06em; }

.add-policy { margin-bottom: 12px; }
.add-policy summary { display: inline-block; cursor: pointer; list-style: none; }
.add-policy summary::-webkit-details-marker { display: none; }
.add-policy-form { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.policy-delete { margin: 8px 0 0; }

/* Calls from any channel: the identifier (phone number, email address or name) and the channel badge */
.ident { white-space: nowrap; }
.ident-email, .ident-name { white-space: normal; overflow-wrap: anywhere; }
.chan { background: var(--bg); color: var(--navy); border: 1px solid var(--line); font-weight: 600; }
.chan-voice, .chan-voicemail { background: #e8f4f3; border-color: #bfe3df; }
.chan-sms { background: #fdf3e0; border-color: #f4dcae; }
.chan-email { background: #e9eef8; border-color: #c9d6ee; }
.chan-web_chat, .chan-chat, .chan-social { background: #f3ebf8; border-color: #dcc9ea; }

/* Pre-call routing decision */
.decision { border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px; padding: 12px 16px; background: var(--white); }
.decision-route { border-left-color: #0e9f4f; }
.decision-ask_policy_number { border-left-color: var(--gold); }
.decision-fallback { border-left-color: #c62828; }
.decision-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.decision-reason { margin: 6px 0 10px; }
.decision-warning { margin: 4px 0 0; color: #8a5a00; }
.badge-danger { background: #fde8e8; color: #a61f1f; }
.rules-note { background: var(--cream); border-radius: 12px; padding: 12px 16px; font-size: .88rem; }

.routing-panel { margin-bottom: 14px; }
.policy-sect { margin: 6px 0 10px; }
.policy-sect .facts { max-width: 420px; margin-bottom: 8px; }
.policy-centre { display: grid; gap: 10px; max-width: 420px; margin: 6px 0 0; }
.policy-centre .field { margin: 0; }
.policy-centre .input { padding: 8px 12px; background: var(--white); color: #222; }

/* Employees */
.emp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.emp-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 16px; }
.emp-search { max-width: 320px; margin: 0; padding: 9px 16px; }
.emp-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 0; cursor: pointer; font: 600 .84rem var(--font); color: var(--navy); background: #e9eef1; padding: 7px 14px; border-radius: 999px; }
.chip span { margin-left: 4px; font-weight: 500; color: var(--navy-soft); }
.chip:hover { background: #dce5ea; }
.chip.is-on { background: var(--navy); color: var(--white); }
.chip.is-on span { color: var(--gold-soft); }
.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.emp-card { margin: 0; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.emp-card[hidden] { display: none; }
.emp-card.is-inactive { opacity: .62; }
.emp-card header { display: flex; align-items: center; gap: 12px; }
.emp-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.emp-id strong { color: var(--navy); font-size: 1.02rem; overflow-wrap: anywhere; }
.emp-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.emp-contact { margin: 0; display: grid; gap: 4px; font-size: .9rem; }
.emp-contact > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; }
.emp-contact dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 2px; }
.emp-contact dd { margin: 0; overflow-wrap: anywhere; }
.emp-contact .code { word-break: normal; overflow-wrap: anywhere; display: inline-block; }
.role-broker { background: rgba(230,83,0,.14); color: var(--orange-dark); }
.role-sales_manager { background: rgba(10,53,71,.12); color: var(--navy); }
.role-sales_advisor { background: rgba(234,148,11,.18); color: #7a4d00; }
.role-account_manager { background: rgba(0,169,161,.15); color: #00776f; }
.role-customer_service_rep { background: rgba(61,97,114,.16); color: var(--navy-soft); }
.avatar.role-broker, .avatar.role-sales_manager, .avatar.role-sales_advisor, .avatar.role-account_manager, .avatar.role-customer_service_rep { color: inherit; }
.avatar.role-none { background: #c9d3d8; }
