/* Thoth Desk — Freshdesk Mint / Dew Complete Workspace Theme */
/* IBM Plex is self-hosted (SIL OFL 1.1). See docs/design/CRM_UI_DIRECTION.md. */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+20AC;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+20AC;
}
@font-face {
  font-family: "IBM Plex Sans TC";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexSansTC-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans SC";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexSansSC-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF;
}

:root {
  --font-latin: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-tc: "IBM Plex Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-sc: "IBM Plex Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", ui-monospace, monospace;
  --font: var(--font-tc);
  --focus: #005fcc;
  --focus-offset: 2px;
  --bg: #ebeef0; --surface: #ffffff; --surface-2: #f5f7f9; --ink: #183247; --muted: #475867; --line: #cfd7df;
  --accent: #183247; --accent-ink: #ffffff; --accent-soft: #e5f2fd;
  --brand-mint: #19a974; --brand-blue: #2c5cc5;
  --ok: #198754; --warn: #c27c0e; --danger: #d92d20;
  --sidebar: #12344d; --sidebar-hover: #1b4666; --sidebar-active: #24577d; --sidebar-ink: #ffffff; --sidebar-muted: #9fb3c4;
  --note-bg: #fffbeb; --note-border: #f59e0b;
  --radius-s: 4px; --radius: 6px; --radius-l: 8px;
  --shadow-1: 0 1px 2px rgba(18,52,77,.06); --shadow-2: 0 4px 12px rgba(18,52,77,.10); --shadow: var(--shadow-1);
  --header-h: 52px; --ease: cubic-bezier(.2,.8,.2,1);
  --text: var(--ink); --card: var(--surface); --border: var(--line); --sans: var(--font); --serif: var(--font);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720; --surface: #17222d; --surface-2: #1f2d3b; --ink: #eef2f6; --muted: #94a3b8; --line: #2b3b4c;
    --accent: #38bdf8; --accent-ink: #0b1520; --accent-soft: #162c42; --brand-mint: #2dd4bf; --brand-blue: #60a5fa;
    --sidebar: #0b1926; --sidebar-hover: #13283c; --sidebar-active: #1b3854; --sidebar-ink: #f8fafc; --sidebar-muted: #7c93a8;
    --note-bg: #292111; --note-border: #d97706;
    --shadow-1: 0 1px 2px rgba(0,0,0,.45); --shadow-2: 0 6px 18px rgba(0,0,0,.5);
  }
}

html[data-theme="dark"] {
  --bg: #0f1720; --surface: #17222d; --surface-2: #1f2d3b; --ink: #eef2f6; --muted: #94a3b8; --line: #2b3b4c;
  --accent: #38bdf8; --accent-ink: #0b1520; --accent-soft: #162c42; --brand-mint: #2dd4bf; --brand-blue: #60a5fa;
  --sidebar: #0b1926; --sidebar-hover: #13283c; --sidebar-active: #1b3854; --sidebar-ink: #f8fafc; --sidebar-muted: #7c93a8;
  --note-bg: #292111; --note-border: #d97706;
  --shadow-1: 0 1px 2px rgba(0,0,0,.45); --shadow-2: 0 6px 18px rgba(0,0,0,.5);
}

html[data-theme="light"] {
  --bg: #ebeef0; --surface: #ffffff; --surface-2: #f5f7f9; --ink: #183247; --muted: #475867; --line: #cfd7df;
  --accent: #183247; --accent-ink: #ffffff; --accent-soft: #e5f2fd; --brand-mint: #19a974; --brand-blue: #2c5cc5;
  --sidebar: #12344d; --sidebar-hover: #1b4666; --sidebar-active: #24577d; --sidebar-ink: #ffffff; --sidebar-muted: #9fb3c4;
  --note-bg: #fffbeb; --note-border: #f59e0b;
  --shadow-1: 0 1px 2px rgba(18,52,77,.06); --shadow-2: 0 4px 12px rgba(18,52,77,.10);
}

html[lang="en"] { --font: var(--font-latin); }
html[lang="zh-CN"] { --font: var(--font-sc); }
html[lang="zh-HK"], html:not([lang]) { --font: var(--font-tc); }
html, body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 22px; -webkit-font-smoothing: antialiased; overflow-wrap: anywhere; }
h1, h2, h3, h4 { font-family: var(--font); letter-spacing: -0.01em; color: var(--ink); font-weight: 600; }
code, kbd, samp, .mono, #anChart { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
* { transition-timing-function: var(--ease); scrollbar-width: thin; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: var(--focus-offset); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (prefers-contrast: more) {
  :root { --line: #6b7c8c; --muted: #243746; --focus: #003e88; }
  html[data-theme="dark"] { --line: #9fb3c4; --muted: #d5e2ec; --focus: #cfe3ff; }
}
.skip-link {
  position: absolute; left: 8px; top: 8px; z-index: 80;
  padding: 8px 12px; background: var(--surface); color: var(--ink);
  border: 2px solid var(--focus); border-radius: var(--radius);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

/* Surfaces & Beige Removal */
#app, .workspace, .panes, #login { background: var(--bg); color: var(--ink); }
.list, .pane, .desk-col, .login-card, .access-modal-panel, .drawer-panel, .modal-panel,
.comp-card, .wf-card, .deal-card, .dash-kpi, .dash-trend-wrap, .dash-table-wrap, .dash-drawer,
.ref-list, .ref-detail, .col, table, #mktPreview { background: var(--surface); color: var(--ink); }
.item:hover, .item.active, .msg.in, .ref-bubble.in { background: var(--surface-2); color: var(--ink); }
.item.active { box-shadow: inset 3px 0 0 var(--brand-blue); }
.msg.out, .ref-bubble.out { background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--brand-blue) 25%, var(--line)); }
.msg.out .who { color: var(--brand-blue); }

/* Unified Top Header */
#app { grid-template-columns: 216px 1fr; grid-template-rows: var(--header-h) minmax(0, 1fr); }
.app-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-1); grid-column: 1 / -1;
}
.app-header-left, .app-header-right { display: flex; align-items: center; gap: 8px; }
.app-header-center { display: flex; align-items: center; min-width: 0; padding-left: 8px; }
.app-wordmark { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; cursor: pointer; }
.app-wordmark::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--brand-mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-mint) 20%, transparent); }
.app-search { max-width: 440px; width: 100%; height: 34px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px; color: var(--ink); font-size: 13px; }
.app-search:focus { background: var(--surface); border-color: var(--brand-blue); }
.app-header #agentIdentity { color: var(--ink); font-weight: 500; font-size: 12.5px; padding: 4px 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; }
.app-header #agentIdentity:hover { border-color: var(--brand-blue); }
.app-header .nav-toggle { position: static; }
.app-header #localeSelect, .app-header #themeSwitch { width: auto; margin: 0; max-width: 132px; height: 32px; min-height: 32px; padding: 2px 8px; font-size: 12.5px; }
#app > .workspace { height: auto; min-height: 0; }
@media (max-width: 700px) { .app-header-center { display: none; } }

/* Dark Slate Left Navigation Rail + SVG Icons */
.sidebar { background: var(--sidebar); border-right: 1px solid rgba(255,255,255,.08); width: 216px; padding: 12px 10px 16px; color: var(--sidebar-ink); }
.nav-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); margin: 14px 10px 5px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
#app nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; border-radius: var(--radius); text-align: left;
  color: #dce6ef; background: transparent; border: 0; padding: 0 11px; font-size: 13px; font-weight: 500; cursor: pointer; box-shadow: none; filter: none;
}
#app nav button:hover { background: var(--sidebar-hover); color: #fff; }
#app nav button.active { background: var(--sidebar-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-mint); }
#app nav button::before { content: ""; width: 16px; height: 16px; flex-shrink: 0; background-color: currentColor; opacity: .85; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
#app nav button.active::before { opacity: 1; background-color: var(--brand-mint); }
#btnHome::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M3 9.5L12 3l9 6.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1V9.5z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M3 9.5L12 3l9 6.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1V9.5z'/%3E%3C/svg%3E"); }
#btnInbox::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E"); }
#btnChat::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E"); }
#btnContacts::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
#btnCompanies::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='4' y='2' width='16' height='20' rx='2'/%3E%3Cpath d='M9 22v-4h6v4M8 6h.01M16 6h.01M8 10h.01M16 10h.01M8 14h.01M16 14h.01'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='4' y='2' width='16' height='20' rx='2'/%3E%3Cpath d='M9 22v-4h6v4M8 6h.01M16 6h.01M8 10h.01M16 10h.01M8 14h.01M16 14h.01'/%3E%3C/svg%3E"); }
#btnPipeline::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='3' width='5' height='18' rx='1'/%3E%3Crect x='10' y='3' width='5' height='13' rx='1'/%3E%3Crect x='17' y='3' width='5' height='16' rx='1'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='3' width='5' height='18' rx='1'/%3E%3Crect x='10' y='3' width='5' height='13' rx='1'/%3E%3Crect x='17' y='3' width='5' height='16' rx='1'/%3E%3C/svg%3E"); }
#btnForecast::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpolyline points='22 7 13.5 15.5 8.5 10.5 2 17'/%3E%3Cpolyline points='16 7 22 7 22 13'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpolyline points='22 7 13.5 15.5 8.5 10.5 2 17'/%3E%3Cpolyline points='16 7 22 7 22 13'/%3E%3C/svg%3E"); }
#btnSequences::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpolyline points='17 1 21 5 17 9'/%3E%3Cpath d='M3 11V9a4 4 0 0 1 4-4h14'/%3E%3Cpolyline points='7 23 3 19 7 15'/%3E%3Cpath d='M21 13v2a4 4 0 0 1-4 4H3'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpolyline points='17 1 21 5 17 9'/%3E%3Cpath d='M3 11V9a4 4 0 0 1 4-4h14'/%3E%3Cpolyline points='7 23 3 19 7 15'/%3E%3Cpath d='M21 13v2a4 4 0 0 1-4 4H3'/%3E%3C/svg%3E"); }
#btnProducts::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'/%3E%3Cpolyline points='3.27 6.96 12 12.01 20.73 6.96'/%3E%3Cline x1='12' y1='22.08' x2='12' y2='12'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'/%3E%3Cpolyline points='3.27 6.96 12 12.01 20.73 6.96'/%3E%3Cline x1='12' y1='22.08' x2='12' y2='12'/%3E%3C/svg%3E"); }
#btnReferrals::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M16 3h5v5M4 20L21 3M21 16v5h-5M15 15l6 6M4 4l5 5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M16 3h5v5M4 20L21 3M21 16v5h-5M15 15l6 6M4 4l5 5'/%3E%3C/svg%3E"); }
#btnWaTemplates::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3C/svg%3E"); }
#btnCampaigns::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z'/%3E%3C/svg%3E"); }
#btnForms::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cline x1='7' y1='9' x2='17' y2='9'/%3E%3Cline x1='7' y1='13' x2='13' y2='13'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cline x1='7' y1='9' x2='17' y2='9'/%3E%3Cline x1='7' y1='13' x2='13' y2='13'/%3E%3C/svg%3E"); }
#btnMeetings::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); }
#btnEmail::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpolyline points='22 6 12 13 2 6'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpolyline points='22 6 12 13 2 6'/%3E%3C/svg%3E"); }
#btnMkt::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E"); }
#btnDashboard::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='9'/%3E%3Crect x='14' y='3' width='7' height='5'/%3E%3Crect x='14' y='12' width='7' height='9'/%3E%3Crect x='3' y='16' width='7' height='5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='9'/%3E%3Crect x='14' y='3' width='7' height='5'/%3E%3Crect x='14' y='12' width='7' height='9'/%3E%3Crect x='3' y='16' width='7' height='5'/%3E%3C/svg%3E"); }
#btnAnalytics::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cline x1='18' y1='20' x2='18' y2='10'/%3E%3Cline x1='12' y1='20' x2='12' y2='4'/%3E%3Cline x1='6' y1='20' x2='6' y2='14'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cline x1='18' y1='20' x2='18' y2='10'/%3E%3Cline x1='12' y1='20' x2='12' y2='4'/%3E%3Cline x1='6' y1='20' x2='6' y2='14'/%3E%3C/svg%3E"); }
#btnAdmin::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E"); }
.app-header .nav-collapse { height: 32px; width: 32px; padding: 0; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; font-size: 17px; line-height: 1; box-shadow: none; filter: none; }
body.nav-collapsed .sidebar { width: 0; overflow: hidden; padding: 0; border: none; }
body.nav-collapsed #app { grid-template-columns: 0 1fr; }
@media (max-width: 700px) {
  body.nav-collapsed .sidebar { width: min(260px, 84vw); overflow: auto; padding: 16px 12px; border-right: 1px solid var(--line); }
  body.nav-collapsed #app { grid-template-columns: 1fr; }
  .app-header .nav-collapse { display: none; }
}

/* Buttons, Inputs, Checkboxes & Badges */
#app button, #login button { height: 34px; border-radius: var(--radius); padding: 0 12px; font-size: 13px; font-weight: 600; box-sizing: border-box; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
#app button:hover, #login button:hover { background: var(--surface-2); border-color: #b4c0cc; }
#app button.primary, #login button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#app button.primary:hover, #login button.primary:hover { filter: brightness(1.12); }
#app button.danger, #login button.danger { color: var(--danger); background: var(--surface); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
#app input, #app select, #app textarea, #login input, #login select, #login textarea { border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); padding: 7px 10px; min-height: 34px; font-size: 13px; box-sizing: border-box; color: var(--ink); }
#app input[type="checkbox"], #app input[type="radio"], #login input[type="checkbox"], #login input[type="radio"] { width: 16px; height: 16px; min-height: 16px; padding: 0; margin: 0; vertical-align: middle; accent-color: var(--brand-blue); }
#app input:focus-visible, #app select:focus-visible, #app textarea:focus-visible { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue) 18%, transparent); }

#app .badge, #login .badge { display: inline-flex; align-items: center; border-radius: 4px; font-size: 11px; padding: 2px 7px; font-weight: 600; text-transform: uppercase; border: 1px solid transparent; background: var(--surface-2); color: var(--ink); }
#app .badge.pending_agent { background: #fee4e2; color: #b42318; border-color: #fecdca; }
#app .badge.assigned { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
#app .badge.waiting_customer { background: #fef3c7; color: #92400e; border-color: #fde68a; }
#app .badge.closed { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

/* Cards, Sub-Tabs & Tables */
.comp-card, .wf-card, .dash-kpi, .dash-trend-wrap, .access-modal-panel, .drawer-panel, .modal-panel { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-1); border: 1px solid var(--line); padding: 16px 18px; }
.wf-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
#app .wf-tabs button { height: 32px; border-radius: var(--radius); background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
#app .wf-tabs button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .05em; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
tbody tr:hover { background: var(--surface-2); }
.table-wrap, .dash-table-wrap, .ui-datatable { overflow: auto; border-radius: var(--radius-l); border: 1px solid var(--line); background: var(--surface); margin-bottom: 16px; }

/* Page Header & Container */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.page-header h1 { font-size: 20px; font-weight: 700; margin: 0; color: var(--ink); }
.page-header p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page { max-width: 1600px; margin: 0 auto; padding: 0 20px 36px; height: calc(100vh - var(--header-h)); overflow-y: auto; box-sizing: border-box; }

/* Live Home Dashboard & KPI Strip */
.fd-home-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 0 14px; }
.fd-home-bar h1 { font-size: 20px; font-weight: 700; margin: 0; }
.fd-home-bar p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.fd-quick-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.fd-kpi-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (max-width: 960px) { .fd-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#app .fd-kpi-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 8px; height: auto; min-height: 84px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-1); text-align: left; }
#app .fd-kpi-card:hover { border-color: var(--brand-blue); box-shadow: var(--shadow-2); }
#app .fd-kpi-card.status-red { border-top-color: var(--danger); }
#app .fd-kpi-card.status-blue { border-top-color: var(--brand-blue); }
#app .fd-kpi-card.status-amber { border-top-color: var(--warn); }
#app .fd-kpi-card.status-green { border-top-color: var(--brand-mint); }
#app .fd-kpi-card.status-slate { border-top-color: #64748b; }
.fd-kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fd-kpi-num { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.fd-home-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-1); overflow: hidden; }
.fd-home-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.fd-home-panel-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.fd-home-queue .table-wrap { border: 0; border-radius: 0; margin: 0; }

/* 3-Column Tickets Inbox */
#deskInboxView > .page-header { display: none; }
#deskInboxView.desk-inbox { grid-template-columns: 220px minmax(340px, .95fr) minmax(420px, 1.35fr); grid-template-rows: 1fr; height: calc(100vh - var(--header-h)); max-width: 100%; width: 100%; margin: 0; padding: 0; background: var(--bg); }
.desk-views, #deskPaneViews { background: var(--surface-2); border-right: 1px solid var(--line); }
.desk-view-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 8px 12px; border: 0; border-radius: var(--radius); margin: 1px 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 500; height: auto; box-shadow: none; }
.desk-view-btn:hover { background: rgba(24,50,71,.06); }
.desk-view-btn.active { background: var(--accent-soft); color: var(--brand-blue); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand-blue); }
.desk-view-count { margin-left: auto; background: var(--surface); border: 1px solid var(--line); color: var(--muted); border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; }
.desk-view-btn.active .desk-view-count { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.desk-sound-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.desk-row-active { background: var(--accent-soft) !important; }
.desk-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.desk-actions button { height: 30px; padding: 0 10px; font-size: 12px; }
.desk-actions select { width: auto; max-width: 170px; min-height: 30px; height: 30px; padding: 2px 8px; font-size: 12px; }
.desk-actions .danger { margin-left: auto; }
#deskPaneTicket { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.desk-ticket-main { display: grid; grid-template-columns: minmax(0, 1fr) 280px; flex: 1; min-height: 0; }
.desk-ticket-main > div:first-child { display: flex; flex-direction: column; min-height: 0; }
#deskThread, #chatThread { flex: 1; min-height: 280px; overflow-y: auto; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.desk-bubble { margin: 0; max-width: 88%; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; border-radius: var(--radius-l); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow-wrap: anywhere; }
.desk-bubble.in { background: var(--surface); color: var(--ink); border-left: 3px solid var(--brand-mint); align-self: flex-start; }
.desk-bubble.out { background: #f0f7ff; color: var(--ink); border-color: #c2dffb; border-right: 3px solid var(--brand-blue); margin-left: auto; align-self: flex-end; }
html[data-theme="dark"] .desk-bubble.out { background: #162c42; border-color: #25486b; }
.desk-bubble.note { background: var(--note-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--note-border) 45%, var(--line)); border-left: 4px solid var(--note-border); max-width: 94%; align-self: stretch; }
.desk-bubble.system { background: transparent; border: 0; box-shadow: none; color: var(--muted); font-size: 11.5px; text-align: center; max-width: 100%; margin: 2px auto; }
.desk-bubble .who { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.desk-bubble.out .who { color: var(--brand-blue); }
.desk-compose { position: sticky; bottom: 0; z-index: 2; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
body.keyboard-open .desk-compose { bottom: 0; padding-bottom: 10px; }
body.keyboard-open #app nav.tabbar { display: none; }
body.keyboard-open .workspace { padding-bottom: 0; }
.desk-compose textarea { max-height: 9.5em; overflow-y: auto; }
.desk-compose-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.desk-compose-tabs button { height: 28px; padding: 0 12px; font-size: 12px; background: var(--surface-2); color: var(--muted); }
.desk-compose-tabs button.active#deskTabReply { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.desk-compose-tabs button.active#deskTabNote { background: var(--note-bg); color: #92400e; border-color: var(--note-border); }
#deskComposeBody { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
#deskComposeBody textarea { flex: 1 1 200px; min-width: 0; resize: vertical; min-height: 48px; }
#deskComposeBody > button.primary { margin-left: auto; }
.desk-side { background: var(--surface); border-left: 1px solid var(--line); padding: 14px 16px; overflow-y: auto; font-size: 12.5px; }
.desk-side h4 { margin: 14px 0 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.desk-props-update { width: 100%; margin-top: 6px; }
.wa-workspace { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; padding: 8px 14px 0; }
.desk-line-label { margin: 0; font-family: "IBM Plex Mono", Consolas, monospace; font-size: 12px; font-weight: 600; color: var(--ink); }
.wa-conflict { margin: 0; color: var(--warn, #8A4B00); font-size: 12.5px; }
.wa-send-state { margin: 0; font-size: 12px; color: var(--muted); }
.wa-billing-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 12.5px; }
.wa-forbidden, .wa-empty, .wa-closed { padding: 12px 14px; color: var(--muted); font-size: 13px; }
.wa-note { border-left: 4px solid var(--note-border, #8A4B00); }

/* CRM, Pipeline, Admin Portal & Dashboard Cards */
.contacts-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); min-height: calc(100vh - 150px); height: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.contacts-layout .list { background: var(--surface-2); border-right: 1px solid var(--line); }
.contacts-layout .contact-detail { background: var(--surface); padding: 20px 24px; display: flex; flex-direction: column; }
#chatView .contact-detail { padding: 0; }
#chatView .contact-detail > .row { padding: 12px 16px; margin: 0; max-width: none; background: var(--surface); border-top: 1px solid var(--line); }
.board { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 16px; height: calc(100vh - 140px); align-items: stretch; }
.col { min-width: 268px; max-width: 300px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-l); display: flex; flex-direction: column; box-shadow: var(--shadow-1); }
.col-h { padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-l) var(--radius-l) 0 0; font-weight: 700; font-size: 13px; }
.deal-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand-blue); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.deal-card:hover { border-color: var(--brand-blue); box-shadow: var(--shadow-2); }

.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.home-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand-mint); border-radius: var(--radius-l); box-shadow: var(--shadow-1); padding: 16px; min-height: 88px; height: auto; width: 100%; cursor: pointer; }
.home-tile:hover { border-color: var(--brand-blue); box-shadow: var(--shadow-2); background: var(--surface); }
.home-tile-name { font-size: 14.5px; font-weight: 700; color: var(--ink); }

.dash-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
#app .dash-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; height: auto; padding: 14px 16px; text-align: left; border: 1px solid var(--line); border-top-width: 3px; border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); }
#app .dash-kpi.status-green { border-top-color: var(--brand-mint); }
#app .dash-kpi.status-amber { border-top-color: var(--warn); }
#app .dash-kpi.status-red { border-top-color: var(--danger); }
#app .dash-kpi.status-grey { border-top-color: var(--muted); }
.dash-kpi-value { font-size: 28px; font-weight: 700; line-height: 1.1; }

/* Setup Banner & Login Screen */
#setupBanner .setup-banner { background: var(--note-bg); color: var(--ink); border-bottom: 1px solid color-mix(in srgb, var(--note-border) 40%, var(--line)); }
#setupBanner .setup-banner-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; padding: 0 16px; }
#setupBanner .setup-banner-summary, #setupBanner .setup-banner-toggle { font-size: 13px; font-weight: 600; color: #92400e; background: transparent; border: 0; }
#setupBanner .setup-banner-body { display: none; padding: 0 16px 10px; }
#setupBanner .setup-banner.open .setup-banner-body { display: block; }

#login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #12344d 0%, #183247 55%, #1e4b6b 100%); padding: 24px; grid-template-columns: none; }
#login .login-card { width: min(400px, 100%); background: transparent; padding: 0; display: flex; flex-direction: column; gap: 14px; }
#login .login-card .stack { width: 100%; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand-mint); border-radius: var(--radius-l); box-shadow: 0 12px 32px rgba(0,0,0,.25); padding: 28px 26px; }
#login .login-wordmark { font-size: 22px; font-weight: 700; text-align: center; margin: 0 0 6px; color: var(--ink); }
#login .login-subtitle { margin: 0 0 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
#login input, #login select:not(.login-locale) { min-height: 40px; height: 40px; }
#login button.primary { width: 100%; height: 40px; margin-top: 16px; background: #12344d; border-color: #12344d; color: #fff; }
#login .login-locale { width: 100%; max-width: 400px; min-height: 34px; margin: 0 auto; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff; text-align: center; }

/* Responsive & Mobile */
#app nav.tabbar { display: none; }
@media (max-width: 1280px) { .desk-ticket-main { grid-template-columns: minmax(0, 1fr); } .desk-side { border-left: 0; border-top: 1px solid var(--line); } }
@media (min-width: 901px) {
  #deskInboxView.has-ticket .desk-list-table-host th[data-col="priority"], #deskInboxView.has-ticket .desk-list-table-host td[data-col="priority"],
  #deskInboxView.has-ticket .desk-list-table-host th[data-col="group"], #deskInboxView.has-ticket .desk-list-table-host td[data-col="group"],
  #deskInboxView.has-ticket .desk-list-table-host th[data-col="agent"], #deskInboxView.has-ticket .desk-list-table-host td[data-col="agent"],
  #deskInboxView.has-ticket .desk-list-table-host th[data-col="updated"], #deskInboxView.has-ticket .desk-list-table-host td[data-col="updated"] { display: none; }
}
@media (max-width: 900px) {
  #deskInboxView.desk-inbox, .contacts-layout { grid-template-columns: minmax(0, 1fr); }
  .wa-workspace { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 375px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .app-header { gap: 6px; padding: 0 8px; }
  .app-header #localeSelect, .app-header #themeSwitch { max-width: 92px; }
}
@media (min-width: 1440px) {
  .page { max-width: 1440px; }
  .desk-line-label { font-size: 13px; }
}
@media (max-width: 700px) {
  #app nav.tabbar { display: flex; flex-direction: row; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(54px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; }
  #app nav.tabbar button { flex: 1; height: 54px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 12px; text-align: center; }
  #app nav.tabbar button.active { color: var(--brand-blue); font-weight: 700; }
  .workspace { padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px)); }
  .desk-compose { bottom: calc(54px + env(safe-area-inset-bottom, 0px)); }
  .app-header #agentIdentity { display: none; }
  .sidebar-phone-chrome { display: flex; flex-direction: column; gap: 10px; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
  .sidebar-phone-chrome:empty { display: none; border: 0; margin: 0; padding: 0; }
}
@media (min-width: 701px) { .sidebar-phone-chrome { display: none; } }

/* Global WhatsApp API Outage Warning Banner */
#waOutageBanner .wa-outage-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: #fef2f2; color: #991b1b; border-bottom: 2px solid #dc2626;
  font-size: 13px; font-weight: 600;
}
html[data-theme="dark"] #waOutageBanner .wa-outage-banner {
  background: rgba(220, 38, 38, 0.22); color: #fecaca; border-bottom-color: #ef4444;
}
#waOutageBanner .wa-outage-actions { display: flex; gap: 8px; flex-shrink: 0; }
#waOutageBanner .wa-outage-actions button {
  height: 28px; min-height: 28px; padding: 0 10px; font-size: 12px;
  background: #ffffff; color: #991b1b; border: 1px solid #fca5a5;
}

/* === Part C: 2-Column Form Grids, Integrations Grid, Compact Ticket Switcher & Modal Polish === */
.fd-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-bottom: 12px;
}
.fd-form-grid > .fd-field { margin-bottom: 0; }
.fd-form-grid > .fd-span-full { grid-column: 1 / -1; }
@media (max-width: 760px) { .fd-form-grid { grid-template-columns: 1fr; } }

/* Full-width Settings & 2-Column Integrations Grid */
#settingsView .comp-card, #integrationsView #webhookUrlsBox { max-width: 960px !important; }
#integrationRows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
  margin: 14px 0 20px;
}
#integrationRows > div {
  margin: 0 !important;
  max-width: none !important;
  background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-l) !important;
  padding: 14px 16px !important;
  box-shadow: var(--shadow-1);
}
@media (max-width: 520px) { #integrationRows { grid-template-columns: 1fr; } }

/* Quick View Selector & Compact Ticket Cards in Open-Ticket Mode */
.desk-quick-view-sel { display: none; width: auto; max-width: 140px; height: 32px; min-height: 32px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
#deskInboxView.has-ticket .desk-quick-view-sel { display: inline-block; }
#deskInboxView.has-ticket .desk-sound-toggle { display: none; }
#deskInboxView.has-ticket .desk-list-table-host { padding: 0; }

.fd-compact-list { display: flex; flex-direction: column; }
.desk-ticket-row {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  height: 68px; max-height: 68px; padding: 0 12px; box-sizing: border-box;
  border-bottom: 1px solid var(--line); background: var(--surface); cursor: pointer; position: relative; overflow: hidden;
}
.desk-ticket-row:hover { background: var(--surface-2); }
.desk-ticket-row.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--brand-blue); }
.desk-ticket-row.is-new { box-shadow: inset 3px 0 0 var(--danger); }
.desk-ticket-row.active.is-new { box-shadow: inset 3px 0 0 var(--brand-blue); }
.desk-avatar { width: 34px; height: 34px; border-radius: 6px; background: #e2e8f0; color: #183247; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.desk-ticket-mid { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.desk-ticket-title { font-weight: 600; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-ticket-preview { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-ticket-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.desk-ticket-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.desk-unread-dot { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }

/* Clean Modals & Drawers */
.modal-panel h3, .access-modal-panel h3, .drawer-panel h2 {
  margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 16px;
}

@media (max-width: 980px) {
  .app-header .nav-collapse { display: none; }
  .app-header .nav-toggle { display: inline-flex; align-items: center; position: static; }
  #app.nav-open .workspace::before { background: rgba(15, 23, 32, 0.42); }
}
