/* BiA Agentes — sistema visual do painel.
   Tokens em :root (tema claro) e [data-theme=dark] / prefers-color-scheme (escuro). */

:root {
  --side: #f7f5f0; --side-2: #ffffff; --side-line: #e4dfd7; --side-text: #3a362f; --side-muted: #7a746a; --side-active: var(--accent-soft);
  --bg: #f4f2ee; --surface: #ffffff; --surface-2: #fbfaf8; --line: #e4dfd7; --line-strong: #cfc8bd;
  --ink: #1b1a18; --muted: #5b5750; --faint: #807a71;
  --accent: #c2410c; --accent-hover: #a8380a; --accent-soft: #fcebdf; --accent-ink: #8a2e07;
  --ok: #1c6b45; --ok-soft: #e2f3ea; --warn: #8a4b00; --warn-soft: #fdf0dc; --danger: #a11d1d; --danger-soft: #fbe3e3;
  --info: #1e5a8a; --info-soft: #e3eef8; --bia-soft: #fff4ec; --team-soft: #e8f2fb;
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100;
  --radius: 16px; --radius-sm: 12px; --shadow: 0 1px 2px rgb(27 26 24 / 5%), 0 6px 20px rgb(27 26 24 / 5%);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  --focus: 0 0 0 3px #fff, 0 0 0 5px var(--accent);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --side: #16181b; --side-2: #1a1d20; --side-line: #2e3237; --side-text: #f1efeb; --side-muted: #b3ada4; --side-active: var(--accent-soft);
    --bg: #111315; --surface: #1a1d20; --surface-2: #202428; --line: #2e3237; --line-strong: #3d434a;
    --ink: #f1efeb; --muted: #b3ada4; --faint: #948e85;
    --accent: #f08a4b; --accent-hover: #f5a06b; --accent-soft: #3a2518; --accent-ink: #ffc9a6;
    --ok: #74d6a0; --ok-soft: #173327; --warn: #f5c16c; --warn-soft: #3a2c13; --danger: #ff9b9b; --danger-soft: #3d1a1a;
    --info: #8cc4f2; --info-soft: #172b3d; --bia-soft: #2b2119; --team-soft: #182a39;
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
    --focus: 0 0 0 3px #111315, 0 0 0 5px var(--accent);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --side: #16181b; --side-2: #1a1d20; --side-line: #2e3237; --side-text: #f1efeb; --side-muted: #b3ada4; --side-active: var(--accent-soft);
  --bg: #111315; --surface: #1a1d20; --surface-2: #202428; --line: #2e3237; --line-strong: #3d434a;
  --ink: #f1efeb; --muted: #b3ada4; --faint: #948e85;
  --accent: #f08a4b; --accent-hover: #f5a06b; --accent-soft: #3a2518; --accent-ink: #ffc9a6;
  --ok: #74d6a0; --ok-soft: #173327; --warn: #f5c16c; --warn-soft: #3a2c13; --danger: #ff9b9b; --danger-soft: #3d1a1a;
  --info: #8cc4f2; --info-soft: #172b3d; --bia-soft: #2b2119; --team-soft: #182a39;
  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  --focus: 0 0 0 3px #111315, 0 0 0 5px var(--accent);
  color-scheme: dark;
}

/* Alto contraste — cores, bordas e textos mais fortes (data-contrast="high", em Personalizar). */
:root[data-contrast="high"] {
  --side: #ffffff; --side-2: #ffffff; --side-line: #726b5e; --side-text: #000000; --side-muted: #2e2b26; --side-active: var(--accent-soft);
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f2f1ee; --line: #726b5e; --line-strong: #3a362f;
  --ink: #000000; --muted: #2e2b26; --faint: #45413a;
  --accent: #9c3705; --accent-hover: #7c2c04; --accent-soft: #fbe0cf; --accent-ink: #5c2603;
  --ok: #0c4a2e; --ok-soft: #d3ecdd; --warn: #5c3200; --warn-soft: #fbe6c2; --danger: #6e1010; --danger-soft: #f8d3d3;
  --info: #0d3f66; --info-soft: #d3e6f5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-contrast="high"] {
    --side: #000000; --side-2: #000000; --side-line: #8a9198; --side-text: #ffffff; --side-muted: #e2ded6; --side-active: var(--accent-soft);
    --bg: #000000; --surface: #000000; --surface-2: #121212; --line: #8a9198; --line-strong: #c3c9ce;
    --ink: #ffffff; --muted: #e2ded6; --faint: #c7c1b7;
    --accent: #ffab6e; --accent-hover: #ffbd8c; --accent-soft: #4a2c15; --accent-ink: #ffd2ac;
    --ok: #9df0c0; --ok-soft: #0f3322; --warn: #ffd699; --warn-soft: #4a3210; --danger: #ffb3b3; --danger-soft: #4a1616;
    --info: #b7ddfa; --info-soft: #143148;
  }
}
:root[data-theme="dark"][data-contrast="high"] {
  --side: #000000; --side-2: #000000; --side-line: #8a9198; --side-text: #ffffff; --side-muted: #e2ded6; --side-active: var(--accent-soft);
  --bg: #000000; --surface: #000000; --surface-2: #121212; --line: #8a9198; --line-strong: #c3c9ce;
  --ink: #ffffff; --muted: #e2ded6; --faint: #c7c1b7;
  --accent: #ffab6e; --accent-hover: #ffbd8c; --accent-soft: #4a2c15; --accent-ink: #ffd2ac;
  --ok: #9df0c0; --ok-soft: #0f3322; --warn: #ffd699; --warn-soft: #4a3210; --danger: #ffb3b3; --danger-soft: #4a1616;
  --info: #b7ddfa; --info-soft: #143148;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.5 var(--font); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 800; }
p { margin: 0; }
a { color: var(--accent); font-weight: 700; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; }
.icon { flex-shrink: 0; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ------------------------------------------------------------------ Estrutura */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 20px; max-width: 1480px; width: 100%; margin: 0 auto; }
.content:focus { outline: none; }

/* Menu lateral */
.sidebar { width: 264px; flex-shrink: 0; background: var(--side); color: var(--side-text); position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; z-index: 40; }
.sidebar-inner { display: flex; flex-direction: column; min-height: 100%; padding: 18px 14px; gap: 2px; }
.sidebar-top { display: flex; justify-content: flex-end; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font: 700 18px var(--display); }
.brand-text { display: flex; flex-direction: column; flex: 1; }
.brand-text strong { color: var(--ink); font: 700 19px/1.1 var(--display); }
.brand-text span { color: var(--side-muted); font-size: 12px; }
.brand-light .brand-text strong { color: var(--ink); }
.brand-light .brand-text span { color: var(--muted); }
.icon-button.sidebar-close { display: none; color: var(--side-text); }
.tenant { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 10px; border: 1px solid var(--side-line); border-radius: 12px; background: var(--side-2); }
.tenant-logo { width: 42px; height: 42px; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.tenant-logo img { width: 36px; height: auto; }
.brand-logo-preview { width: 88px; height: 88px; flex: 0 0 88px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; color: #20252a; font: 800 38px var(--display); }
.brand-logo-preview img { max-width: 76px; max-height: 76px; width: auto; height: auto; object-fit: contain; }
.tenant-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tenant-text strong { color: var(--ink); font-size: 14px; }
.tenant-text span { color: var(--side-muted); font-size: 12px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { padding: 16px 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--side-text); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.nav-link:hover { background: var(--side-active); color: var(--ink); }
.nav-link.is-active { background: var(--side-active); color: var(--accent-ink); font-weight: 800; box-shadow: inset 3px 0 0 var(--accent); }
.nav-label { flex: 1; }
.soon { padding: 2px 7px; border-radius: 99px; border: 1px solid var(--side-line); color: var(--side-muted); font-size: 11px; font-weight: 700; }
.nav-spacer { flex: 1; min-height: 16px; }
.sidebar-footer { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin-top: 14px; padding: 16px 10px 4px; border-top: 1px solid var(--side-line); }
.sidebar-footer .brand-mark { margin-bottom: 2px; }
.sidebar-footer strong { color: var(--ink); font: 700 15px/1.2 var(--display); }
.sidebar-footer > span:not(.nav-version) { color: var(--side-muted); font-size: 11px; }
.nav-version { padding: 0 12px 8px; color: var(--side-muted); font-size: 11px; text-align: center; }
.dot { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; }
.dot-on { background: #3ddc84; }
.dot-off { background: #8b929b; }
.dot-idle { background: #f5c16c; }
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 45%); z-index: 35; }

/* Topo */
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 32px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font: 700 26px/1.15 var(--display); }
.topbar-title p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.icon-button.menu-button { display: none; }
.topbar-search { width: 320px; }
.search-field { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); }
.search-field:focus-within { box-shadow: var(--focus); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: inherit; color: var(--ink); }
.icon-button { width: 44px; height: 44px; flex-shrink: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-button:hover { border-color: var(--line-strong); color: var(--ink); }
.topbar-alert { position: relative; }
.topbar-alert.has-alerts { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.topbar-alert-count { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px; background: var(--danger); color: white; font: 800 11px var(--font); }
.topbar-alert-count[hidden] { display: none; }
.sound-toggle.is-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.contrast-toggle.is-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.accent-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.accent-picker input[type="color"] { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); cursor: pointer; }
.accent-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.accent-picker input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.accent-saved { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-weight: 700; }
.accent-saved svg { width: 14px; height: 14px; }
.theme-light { display: none; }
[data-theme="dark"] .theme-dark { display: none; }
[data-theme="dark"] .theme-light { display: block; }
@media (prefers-color-scheme: dark) { [data-theme="auto"] .theme-dark { display: none; } [data-theme="auto"] .theme-light { display: block; } }
.bot-toggle-form { margin: 0; }
.bot-toggle { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 10px; border-radius: 99px; font: 800 14px var(--font); cursor: pointer; white-space: nowrap; }
.bot-toggle.is-on { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.bot-toggle.is-off { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.switch { width: 38px; height: 22px; border-radius: 99px; display: flex; align-items: center; padding: 0 3px; }
.switch span { width: 16px; height: 16px; border-radius: 99px; background: #fff; }
.is-on .switch { background: var(--ok); justify-content: flex-end; }
.is-off .switch { background: #9a9389; justify-content: flex-start; }

/* Menu inferior (celular) */
.bottom-nav { display: none; }

/* --------------------------------------------------------------- Componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-inner { box-shadow: none; background: var(--surface-2); }
.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head > div { min-width: 0; flex: 1 1 240px; display: flex; flex-direction: column; gap: 3px; }
.card-head p { font-size: 13.5px; }
.card-head.padded { padding: 16px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.card-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.grid { display: grid; gap: 20px; }
.grid-2-1 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.wrap { gap: 6px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spaced { margin-top: 12px; }
.time { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); font: 800 14px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.button:hover { border-color: var(--ink); color: var(--ink); }
.button-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .button-primary, :root:not([data-theme="light"]) .button-primary { color: #fff; }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.button-dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.button-dark:hover { opacity: .9; color: var(--bg); }
.button-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.button-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.button-block { width: 100%; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 800; white-space: nowrap; text-decoration: none; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; text-align: center; }
.avatar { width: 40px; height: 40px; flex-shrink: 0; border-radius: 99px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-weight: 800; }
.avatar-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 800; min-width: 0; }
.field.inline { flex-direction: row; align-items: center; }
input[type="text"], input[type="search"], input[type="password"], input[type="time"], input[type="url"], input[type="email"], input[type="tel"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); font: 500 15px var(--font);
}
input[type="number"] { font-variant-numeric: tabular-nums; }
.search-field input[type="search"] { min-height: 0; padding: 0; border: 0; background: transparent; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--focus); }
input[type="file"] { font: 600 14px var(--font); color: var(--muted); max-width: 100%; }
.code-area { min-height: 60vh; font: 500 14px/1.55 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.code-block { max-height: 320px; overflow: auto; margin: 10px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font: 500 13px/1.55 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.reveal-field { display: flex; gap: 8px; align-items: center; }
.reveal-field input { flex: 1; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.check span { display: flex; flex-direction: column; gap: 2px; }
.check small { color: var(--muted); font-size: 13px; font-weight: 500; }
.check.compact { padding: 8px 10px; background: transparent; border: 0; align-items: center; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.inline-form input { width: 150px; }
.form-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.setup-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
.setup-address-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .75fr); gap: 12px; }
.setup-street { grid-column: span 2; }
.setup-notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.setup-hours { min-width: 550px; }
.setup-hours .check.compact { padding: 4px 2px; white-space: nowrap; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segment { min-width: 76px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2); color: var(--ink); font: 800 14.5px var(--font); cursor: pointer; }
.segment:hover { border-color: var(--ink); }
.segment.is-selected { background: var(--accent); border-color: var(--accent); color: #fff; }

.disclosure { border-top: 1px solid var(--line); padding-top: 12px; }
.disclosure > summary { cursor: pointer; font-weight: 800; color: var(--muted); min-height: 32px; display: flex; align-items: center; gap: 6px; }
.disclosure[open] > summary { margin-bottom: 10px; }
.disclosure > .button { margin-top: 10px; }

.facts { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.facts > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.facts dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; font-weight: 800; text-align: right; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; font-weight: 700; }
.kpi strong { font: 700 32px/1.1 var(--display); }
.kpi-note { color: var(--muted); font-size: 13px; }

.notice { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); text-decoration: none; font-weight: 600; }
.notice span { flex: 1; }
.notice:hover { color: var(--warn); filter: brightness(.98); }
.notice-soft { background: var(--accent-soft); color: var(--accent-ink); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list > li + li { border-top: 1px solid var(--line); }
.list.compact > li { padding: 10px 0; }
.list.compact .row { justify-content: space-between; }
.queue-item { display: flex; gap: 14px; padding: 16px 0; }
.queue-item:first-child { padding-top: 0; }
.queue-item.is-late .time { color: var(--warn); }
.queue-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.queue-body p { color: var(--muted); }
.queue-body .reason { color: var(--ink); font-weight: 600; }
.conv-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; text-decoration: none; color: var(--ink); }
.conv-row:hover strong { color: var(--accent); }
.conv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-text span { color: var(--muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.more-link { font-size: 14px; padding: 12px 0 0; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.empty strong { color: var(--ink); }
.plain-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.summary { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.summary span { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--accent-ink); }
.quote { padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.unanswered-card { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.unanswered-card .quote { color: var(--ink); overflow-wrap: anywhere; }
.unanswered-card .inline-form { margin-top: auto; }
.notice-urgent { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.knowledge-item { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 14px 0; }
.knowledge-item p { color: var(--muted); margin-top: 4px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-weight: 700; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 800; }
.agent-head { flex-direction: row; align-items: center; gap: 16px; }
.agent-mark { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.agent-head h2 { font: 700 24px var(--display); }
.hero-soon { flex-direction: row; align-items: flex-start; gap: 18px; max-width: 900px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table.setup-hours thead th { padding: 7px 6px; }
.table.setup-hours tbody th, .table.setup-hours tbody td { padding: 3px 6px; }
.table.setup-hours input[type="time"] { min-width: 110px; min-height: 44px; padding: 5px 8px; }
.table thead th { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table-numbers td { font-variant-numeric: tabular-nums; }
.hours-table input[type="time"] { max-width: 180px; }
.client-link { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.client-link:hover strong { color: var(--accent); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1; }
.toolbar .search-field { min-width: 220px; flex: 1; max-width: 360px; }
.toolbar select { width: auto; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; }
.segments { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.segment-card { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.segment-card span { font-size: 13.5px; font-weight: 800; color: var(--muted); }
.segment-card strong { font: 700 30px/1.1 var(--display); }
.segment-card small { font-size: 12.5px; color: var(--muted); }
.segment-card:hover { border-color: var(--ink); color: var(--ink); }
.segment-card.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.segment-card.is-active span, .segment-card.is-active small { color: var(--bg); opacity: .85; }

.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.photo-card span { font-size: 13.5px; font-weight: 800; }
.photo-card form .button { width: 100%; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; }
.checklist small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.check-icon { width: 32px; height: 32px; border-radius: 99px; display: grid; place-items: center; flex-shrink: 0; }
.check-icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.check-icon.is-warn { background: var(--warn-soft); color: var(--warn); }

.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-weight: 700; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

.sticky-actions { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 35%); display: flex; justify-content: flex-end; }

/* Calendário de folgas */
.calendar { max-width: 420px; display: flex; flex-direction: column; gap: 10px; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; }
.calendar-head strong { text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-weekday { text-align: center; font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.calendar-day { min-height: 44px; border: 1px solid transparent; border-radius: 10px; background: var(--surface-2); color: var(--ink); font: 700 14px var(--font); cursor: pointer; }
.calendar-day:hover { border-color: var(--accent); }
.calendar-day.is-outside { background: transparent; color: var(--faint); }
.calendar-day.is-today { border-color: var(--accent); }
.calendar-day.is-selected { background: var(--accent); color: #fff; }
.calendar-day:disabled { opacity: .4; cursor: not-allowed; }
.calendar-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.calendar-chips button { border: 0; background: var(--accent-soft); color: var(--accent-ink); border-radius: 99px; padding: 4px 10px; font: 800 12.5px var(--font); cursor: pointer; }
.js .noscript-field { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- Conversas */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; min-height: calc(100vh - 170px); box-shadow: var(--shadow); }
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; max-height: calc(100vh - 170px); }
.inbox-search { padding: 14px 14px 8px; }
.filters { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 14px 12px; border-bottom: 1px solid var(--line); scrollbar-width: none; cursor: grab; }
.filters.is-dragging, .segmented.is-dragging { cursor: grabbing; user-select: none; scroll-snap-type: none; }
.filter { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13px; }
.filter span { color: var(--muted); font-weight: 600; }
.filter.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter.is-active span { color: var(--bg); opacity: .8; }
.inbox-items { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.inbox-items .empty { margin: 14px; }
.inbox-item { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 500; }
.inbox-item:hover { background: var(--surface-2); color: var(--ink); }
.inbox-item.is-active { background: var(--bia-soft); box-shadow: inset 3px 0 0 var(--accent); }
.inbox-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.inbox-text .preview { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-list .more-link { padding: 12px 14px; border-top: 1px solid var(--line); }
.inbox-thread { display: flex; flex-direction: column; min-width: 0; background: var(--bg); max-height: calc(100vh - 170px); }
.inbox-empty { justify-content: center; padding: 24px; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.thread-back { display: none; }
.thread-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.thread-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.thread-actions form { margin: 0; }
.thread { list-style: none; margin: 0; padding: 20px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1; }
.day-sep { text-align: center; }
.day-sep span { display: inline-block; padding: 3px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 800; }
.bubble { max-width: min(560px, 85%); padding: 10px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.bubble p { overflow-wrap: anywhere; }
.bubble-who { font-size: 12px; font-weight: 800; color: var(--muted); }
.bubble-client { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble-bia { align-self: flex-end; background: var(--bia-soft); border-bottom-right-radius: 4px; }
.bubble-team { align-self: flex-end; background: var(--team-soft); border-bottom-right-radius: 4px; }
.bubble-team .bubble-who { color: var(--info); }
.bubble-extras { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.attachment { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.wa-button { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--info); font-size: 13px; font-weight: 800; }
.thread-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px; }
.inbox-client { border-left: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: calc(100vh - 170px); }
.client-head { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); text-align: center; }
.chat-demo { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; background: var(--bg); }

/* ------------------------------------------------------------------ Login */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font: 700 26px var(--display); }
.auth-card .brand { padding: 0 0 8px; }
.auth-link { text-align: center; font-size: 13.5px; font-weight: 700; }
.auth-link a { color: var(--accent); }
.auth-code { text-align: center; font: 800 26px/1 var(--display); letter-spacing: 4px; }

/* ------------------------------------------------------------- Responsivo */
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto auto; }
  .inbox-list { grid-row: 1 / span 2; max-height: none; }
  .inbox-thread { max-height: 70vh; }
  .inbox-client { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); max-height: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .inbox-client .client-head { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .topbar-search { display: none; }
  .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
  .setup-grid { grid-template-columns: minmax(0, 1fr); }
  .segments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 0 40px rgb(0 0 0 / 35%); }
  .sidebar.is-open { transform: none; }
  .icon-button.sidebar-close { display: inline-grid; background: transparent; border-color: var(--side-line); }
  .icon-button.menu-button { display: inline-grid; }
  .topbar { padding: 12px 20px; }
  .content { padding: 20px; }
}
@media (max-width: 760px) {
  body { font-size: 15px; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar-title h1 { font-size: 20px; }
  .topbar-title p { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .icon-button.menu-button { display: none; }
  .bot-toggle { padding: 0 10px 0 8px; font-size: 0; gap: 0; }
  .bot-toggle .switch { font-size: 14px; }
  .content { padding: 14px; gap: 14px; }
  .card { padding: 16px; border-radius: 14px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi strong { font-size: 26px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .setup-grid, .setup-notes-grid { grid-template-columns: minmax(0, 1fr); }
  .setup-address-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-street { grid-column: span 2; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; cursor: grab; }
  .segment { flex-shrink: 0; }
  .queue-item { flex-direction: column; gap: 10px; }
  .queue-item .avatar { display: none; }
  .inline-form { flex-wrap: wrap; }
  .inline-form input { width: 100%; }
  .actions .button, .actions .inline-form, .actions .inline-form .button { flex: 1 1 auto; }
  .table-clients th:nth-child(4), .table-clients td:nth-child(4), .table-clients th:nth-child(6), .table-clients td:nth-child(6) { display: none; }
  .agent-head, .hero-soon { flex-direction: column; align-items: flex-start; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 4px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .bottom-nav a, .bottom-nav button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border: 0; background: transparent; color: var(--muted); font: 800 11.5px var(--font); text-decoration: none; cursor: pointer; }
  .bottom-nav .is-active { color: var(--accent); }
  .tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; }
  .inbox { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; min-height: calc(100dvh - 170px); border-radius: 14px; }
  .inbox-list { grid-row: auto; }
  .inbox-client { grid-column: auto; grid-template-columns: minmax(0, 1fr); }
  .inbox:not(.has-selection) .inbox-client { display: none; }
  .inbox-thread { max-height: none; }
  .inbox-list, .inbox-thread { max-height: none; }
  .inbox.has-selection .inbox-list { display: none; }
  .inbox:not(.has-selection) .inbox-thread { display: none; }
  .thread-back { display: inline-grid; }
  .thread-head { flex-wrap: wrap; }
  .thread-actions { width: 100%; justify-content: stretch; }
  .thread-actions > * { flex: 1; }
  .thread-actions .button { width: 100%; }
  .thread { padding: 14px; }
  .bubble { max-width: 92%; }
  body.has-selection .topbar { display: none; }
  body.has-selection .content { padding: 0; }
  body.has-selection .inbox { border: 0; border-radius: 0; min-height: calc(100dvh - 68px); }
  .sticky-actions { position: static; background: none; padding: 16px 0 0; }
  .sticky-actions .button { width: 100%; }
}
@media (max-width: 420px) {
  .segments { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi strong { font-size: 22px; }
}
@media print {
  .sidebar, .topbar, .bottom-nav { display: none !important; }
}

/* Gráficos simples (Relatórios): funil de vendas, pizza por tipo de uso e horários de
   pico — tudo em HTML/CSS puro (conic-gradient, clip-path), sem biblioteca externa. */
.funnel { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; }
.funnel-stage { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.funnel-shape { height: 56px; background: var(--funnel-fill, var(--accent)); clip-path: polygon(var(--funnel-top, 0%) 0, calc(100% - var(--funnel-top, 0%)) 0, calc(100% - var(--funnel-bottom, 0%)) 100%, var(--funnel-bottom, 0%) 100%); transition: clip-path .3s ease, width .3s ease; }
.funnel-stage-label { display: flex; align-items: baseline; gap: 6px; font-size: 13.5px; font-weight: 800; }
.funnel-stage-label strong { font-size: 15px; }
.funnel-stage-note { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 8px; }

.piechart-wrap { display: flex; align-items: center; gap: 24px; padding: 18px; flex-wrap: wrap; }
.piechart { width: 140px; height: 140px; border-radius: 99%; background: var(--pie-gradient, conic-gradient(var(--line) 0 100%)); flex-shrink: 0; }
.piechart-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 180px; }
.piechart-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.piechart-swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.piechart-item strong { font-weight: 800; }
.piechart-item span.muted { margin-left: auto; font-weight: 700; }

.hourchart { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); align-items: end; gap: 3px; height: 130px; padding: 18px 18px 0; }
.hourchart-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.hourchart-fill { width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); }
.hourchart-axis { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; padding: 6px 18px 18px; font-size: 10px; color: var(--muted); font-weight: 700; text-align: center; }
.weekchart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: end; gap: 10px; height: 110px; padding: 18px; }
.weekchart-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.weekchart-fill { width: 100%; min-height: 2px; border-radius: 6px 6px 0 0; background: var(--accent); }
.weekchart-label { font-size: 11.5px; color: var(--muted); font-weight: 800; text-align: center; padding: 0 18px 18px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) {
  .hourchart, .hourchart-axis { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .hourchart .hourchart-bar:nth-child(even), .hourchart-axis span:nth-child(even) { display: none; }
}
