/* Wandr Assist — consola, direção "A · Claro e calmo" (P5, escolhida a 25/11/2026).
 * Tema claro por omissão; escuro com <html data-theme="dark">.
 * Estados sempre com rótulo e cor (nunca só cor). Sem verde do WhatsApp. */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap");

:root {
    --ground: #F7F7F5;
    --surface: #FFFFFF;
    --surface-2: #F1F1EC;
    --line: #E6E6E1;
    --line-soft: #EFEFEA;
    --ink: #16181D;
    --muted: #5F636C;
    --accent: #2F5BEA;
    --accent-ink: #1E3FB0;
    --accent-soft: #E8EEFD;
    --on-accent: #FFFFFF;
    --ok: #17663A;
    --ok-soft: #E7F4EC;
    --ok-dot: #1F8A4C;
    --warn: #9A4A0B;
    --warn-soft: #FDEEE3;
    --critical: #B3261E;
    --critical-soft: #FCE8E6;
    --neutral: #4A4E57;
    --neutral-soft: #EEEEEA;
    --bubble-customer: #FFFFFF;
    --bubble-bot: #E8EEFD;
    --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Space Grotesk", Inter, system-ui, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --r-input: 8px;
    --r-card: 14px;
    --r-pill: 999px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --ground: #111317;
    --surface: #181B21;
    --surface-2: #20242C;
    --line: #2A2F39;
    --line-soft: #242833;
    --ink: #ECEDEF;
    --muted: #A2A7B2;
    --accent: #7D9BFF;
    --accent-ink: #A9BCFF;
    --accent-soft: #1F2A4D;
    --on-accent: #0D1120;
    --ok: #7FDCA5;
    --ok-soft: #173325;
    --ok-dot: #4CC584;
    --warn: #FFB27A;
    --warn-soft: #3A2616;
    --critical: #FF9A92;
    --critical-soft: #3B1C1A;
    --neutral: #C3C7D0;
    --neutral-soft: #262A33;
    --bubble-customer: #20242C;
    --bubble-bot: #1F2A4D;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.5 var(--font); }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
.num, table, time, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ marca */
.brand { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-word { font: 600 20px var(--font-display); letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.brand-dot, .brand-mark { display: none; }

/* ------------------------------------------------------------ estrutura */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
.layout { flex: 1; display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 20px 96px; display: flex; flex-direction: column; gap: 24px; }
.bottom-nav { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 56px; padding: 8px 0; font-size: 12px; color: var(--muted); text-decoration: none; }
.bottom-nav a.is-active { color: var(--accent); font-weight: 600; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }

@media (min-width: 900px) {
    .bottom-nav { display: none; }
    .sidebar { display: flex; flex-direction: column; gap: 4px; width: 232px; flex: none; padding: 20px 12px; border-right: 1px solid var(--line); background: var(--surface); position: sticky; top: 65px; height: calc(100dvh - 65px); }
    .main { padding: 32px 32px 48px; }
}
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-section { margin: 16px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.who { font-size: 13px; }
.who .label { display: block; }

/* ------------------------------------------------------------ cabeçalho de página */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eyebrow { font-size: 13px; color: var(--muted); }
.h-title { font: 600 30px/1.15 var(--font-display); letter-spacing: -0.02em; }
.h-section { font-size: 16px; font-weight: 600; }
.h-section .count { color: var(--muted); font-weight: 500; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }

/* ------------------------------------------------------------ pills de estado */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.pill-plain::before { display: none; }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-critical { background: var(--critical-soft); color: var(--critical); }
.tone-info { background: var(--accent-soft); color: var(--accent-ink); }
.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }
.badge { display: inline-flex; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; background: var(--neutral-soft); color: var(--neutral); }
.badge-teal { background: var(--ok-soft); color: var(--ok); }
.badge-amber { background: var(--warn-soft); color: var(--warn); }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ------------------------------------------------------------ cartões */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.card-pad, .card.pad { padding: 16px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } .kpis .kpi:last-child:nth-child(odd) { grid-column: auto; } }
.kpi { padding: 16px; }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { margin-top: 6px; font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi .sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px; }
.stat-value { display: block; margin-top: 6px; font-size: 28px; font-weight: 600; }
.stat-value.is-amber { color: var(--warn); }

/* ------------------------------------------------------------ listas */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-card { overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; color: var(--ink); text-decoration: none; }
.list-card .row + .row, .list-card .row-wrap + .row-wrap { border-top: 1px solid var(--line-soft); }
a.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font-size: 12px; color: var(--muted); }
.row-wrap { display: flex; align-items: stretch; }
.row-wrap .row { flex: 1; }
.row-action { display: flex; align-items: center; padding: 0 12px; border-left: 1px solid var(--line-soft); }
.chev { flex: none; color: var(--muted); }
.empty { padding: 24px 16px; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 14px var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link { border: 0; background: none; padding: 0 4px; min-height: 44px; color: var(--muted); font: 500 13px var(--font); cursor: pointer; }
.btn-link:hover { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------ formulários */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-narrow { max-width: 560px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .label, .label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-input); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 400 15px var(--font); }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--critical); }
.field .error, .error { color: var(--critical); font-size: 13px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.group { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
fieldset.group legend { padding: 0 4px; font-size: 14px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); font-size: 14px; cursor: pointer; }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.chip input { accent-color: var(--accent); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; font-size: 14px; cursor: pointer; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.sticky-save { position: sticky; bottom: 72px; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
@media (min-width: 900px) { .sticky-save { bottom: 16px; } }

/* ------------------------------------------------------------ alertas */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--critical-soft); color: var(--critical); }
.alert-info { background: var(--accent-soft); color: var(--accent-ink); }
.notice { padding: 10px 16px; font-size: 13px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }

/* ------------------------------------------------------------ separadores */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.tabs a.is-active { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.filters a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.filters a.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* ------------------------------------------------------------ conversas */
.convo { display: grid; gap: 16px; }
@media (min-width: 900px) { .convo { grid-template-columns: 320px minmax(0, 1fr); } }
.convo.has-open .convo-list { display: none; }
@media (min-width: 900px) { .convo.has-open .convo-list { display: flex; } }
.thread { display: flex; flex-direction: column; overflow: hidden; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.bubbles { display: flex; flex-direction: column; gap: 12px; padding: 16px; margin: 0; list-style: none; }
.bubble-row { display: flex; flex-direction: column; align-items: flex-start; }
.bubble-row.out { align-items: flex-end; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 18px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bubble-customer); border: 1px solid var(--line); }
.bubble-row.out .bubble { background: var(--bubble-bot); border-color: transparent; }
.bubble-row.human .bubble { background: var(--surface); border: 1px solid var(--accent); }
.bubble-row.system .bubble { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.bubble-meta { margin-top: 4px; font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------ tabelas (admin) */
.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
@media (max-width: 700px) { .hide-sm { display: none; } }

/* ------------------------------------------------------------ login */
.auth-body { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-wrap { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.auth-card { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------------------------------------ restos do MVP (páginas de administração) */
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.section-gap { margin-top: 8px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; }
.link-sm { font-size: 13px; }
.activity, .steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* ------------------------------------------------------------ conhecimento e pedidos */
details.row-wrap { display: block; }
details.row-wrap > summary { list-style: none; cursor: pointer; }
details.row-wrap > summary::-webkit-details-marker { display: none; }
details.row-wrap[open] > summary { background: var(--surface-2); }
.row-wrap.lead { flex-wrap: wrap; }
.row-wrap.lead .row-action { gap: 8px; }
@media (max-width: 899px) {
  .row-wrap.lead .row { flex-basis: 100%; }
  .row-wrap.lead .row-action { flex-basis: 100%; padding: 0 16px 12px; border-left: 0; }
}
.select-sm { min-height: 36px; padding: 0 8px; border-radius: var(--r-input); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 400 14px var(--font); }
.convo-list { display: flex; flex-direction: column; }
.convo-list .row[aria-current="true"] { background: var(--accent-soft); }

/* ------------------------------------------------------------ espaçamento (sem style= inline: CSP) */
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
