/* ============================================================
   Cotar+ · Design System
   Paleta: Laranja (#F97316) + Azul Marinho (#0F2C4C)
   Tema claro/escuro via [data-theme]
   ============================================================ */

/* Tamanho padrão de TODO ícone (.ic). Contêineres específicos sobrescrevem. */
svg.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.15em; }
/* Tamanho padrão dos ícones inline (evita SVG "gigante" sem width) */
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg svg { width: 19px; height: 19px; }
.chip svg { width: 15px; height: 15px; flex-shrink: 0; }
.badge svg { width: 12px; height: 12px; flex-shrink: 0; }
.rating svg { width: 13px; height: 13px; flex-shrink: 0; }
.kpi__trend svg { width: 14px; height: 14px; flex-shrink: 0; }
.note-card__foot svg { width: 13px; height: 13px; flex-shrink: 0; }
.summary-row svg, .cov-lbl svg, .breadcrumb svg, .list-row svg,
.tl-item svg, .modal__body svg, .def-list svg { width: 15px; height: 15px; flex-shrink: 0; }

:root {
  /* Brand */
  --brand-orange: #F97316;
  --brand-orange-600: #EA580C;
  --brand-orange-050: #FFF3EA;
  --brand-navy: #0F2C4C;
  --brand-navy-2: #143a63;
  --brand-blue: #2563EB;

  /* Neutral surfaces (light) */
  --bg: #EEF2F6;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #EEF2F7;
  --border: #E1E7EF;
  --border-strong: #CDD7E3;
  --text: #16273D;
  --text-2: #43566E;
  --muted: #6B7C93;

  /* Status */
  --green: #16A34A;   --green-bg: #E7F6ED;
  --amber: #D97706;   --amber-bg: #FDF1DE;
  --red: #DC2626;     --red-bg: #FCEAEA;
  --sky: #0284C7;     --sky-bg: #E4F3FB;
  --violet: #7C3AED;  --violet-bg: #F1EAFD;

  /* Sidebar (always dark navy) */
  --side-bg: #0C2440;
  --side-bg-2: #0a1f38;
  --side-item: #A9BBD1;
  --side-item-hover: #ffffff;
  --side-active-bg: rgba(249,115,22,.14);

  /* Effects */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16,39,61,.06), 0 1px 3px rgba(16,39,61,.04);
  --shadow: 0 4px 16px rgba(16,39,61,.08);
  --shadow-lg: 0 18px 48px rgba(16,39,61,.16);
  --ring: 0 0 0 3px rgba(249,115,22,.22);

  --sidebar-w: 256px;
  --sidebar-w-collapsed: 74px;
  --topbar-h: 64px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0A1421;
  --surface: #111F31;
  --surface-2: #0E1B2B;
  --surface-3: #17293E;
  --border: #21384f;
  --border-strong: #2c4763;
  --text: #E7EEF6;
  --text-2: #B4C4D6;
  --muted: #7E93A9;

  --green-bg: rgba(22,163,74,.16);
  --amber-bg: rgba(217,119,6,.18);
  --red-bg: rgba(220,38,38,.16);
  --sky-bg: rgba(2,132,199,.18);
  --violet-bg: rgba(124,58,237,.18);

  --side-bg: #081120;
  --side-bg-2: #060d19;
  --side-active-bg: rgba(249,115,22,.18);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  color: var(--side-item);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .22s ease;
  z-index: 40;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px;
  height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-logo { flex-shrink: 0; display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; overflow: hidden; white-space: nowrap; }
.brand-text strong { color: #fff; font-size: 18px; letter-spacing: -.3px; }
.brand-text strong span { color: var(--brand-orange); }
.brand-text small { color: #7f95b3; font-size: 11px; margin-top: 1px; }
.sidebar__collapse {
  margin-left: auto; width: 24px; height: 24px; border-radius: 6px;
  color: #7f95b3; display: grid; place-items: center; flex-shrink: 0;
}
.sidebar__collapse:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__collapse::before { content: "«"; font-size: 16px; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.nav-group__label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px;
  color: #607697; padding: 16px 12px 7px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--side-item); font-weight: 500; font-size: 13.5px;
  position: relative; white-space: nowrap; margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--side-item-hover); }
.nav-item.active { background: var(--side-active-bg); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; background: var(--brand-orange); border-radius: 0 4px 4px 0;
}
.nav-item .nav-ic { width: 20px; height: 20px; flex-shrink: 0; display: grid; place-items: center; }
.nav-item .nav-ic svg { width: 19px; height: 19px; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--brand-orange); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}

.sidebar__footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.org-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); background: rgba(255,255,255,.04); }
.org-card__logo { width: 34px; height: 34px; border-radius: 8px; background: var(--brand-orange); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.org-card__info { overflow: hidden; white-space: nowrap; }
.org-card__info strong { display: block; color: #fff; font-size: 13px; }
.org-card__info small { color: #7f95b3; font-size: 11px; }

/* Collapsed sidebar */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span.nav-label,
.sidebar.collapsed .nav-item .nav-badge,
.sidebar.collapsed .nav-group__label,
.sidebar.collapsed .org-card__info { display: none; }
.sidebar.collapsed .sidebar__collapse::before { content: "»"; }
.sidebar.collapsed .nav-item { justify-content: center; }
.sidebar.collapsed .brand-text { }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar__menu { display: none; font-size: 22px; color: var(--text-2); }
.topbar__search {
  flex: 1; max-width: 460px; position: relative;
  display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; height: 40px;
}
.topbar__search:focus-within { border-color: var(--brand-orange); box-shadow: var(--ring); }
.topbar__search input { flex: 1; border: none; background: transparent; outline: none; color: var(--text); }
.topbar__search .ic-search { width: 16px; height: 16px; margin-right: 8px; opacity: .55;
  background: currentColor; -webkit-mask: var(--ic-search) center/contain no-repeat; mask: var(--ic-search) center/contain no-repeat; }
.topbar__search kbd { background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 7px; font-size: 12px; color: var(--muted); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--brand-orange); color: #fff;
  padding: 0 15px; height: 40px; border-radius: 10px;
  font-weight: 600; font-size: 13.5px; transition: background .15s, transform .05s;
  box-shadow: 0 2px 8px rgba(249,115,22,.28);
}
.icon-btn:hover { background: var(--brand-orange-600); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn .plus { font-size: 18px; font-weight: 400; line-height: 1; }
.icon-btn--ghost {
  background: var(--surface-2); color: var(--text-2); box-shadow: none;
  border: 1px solid var(--border); width: 40px; padding: 0; justify-content: center;
  position: relative;
}
.icon-btn--ghost:hover { background: var(--surface-3); color: var(--text); }
#btnTheme::before { content: "🌙"; font-size: 16px; }
[data-theme="dark"] #btnTheme::before { content: "☀️"; }
.bell::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--ic-bell) center/contain no-repeat; mask: var(--ic-bell) center/contain no-repeat; }
.notif-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-orange); border: 2px solid var(--surface); }

/* Indicador de ambiente (dev/prod) no topo */
.env-badge { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 13px; border-radius: 10px; font-size: 11.5px; font-weight: 800; letter-spacing: .5px; white-space: nowrap; border: 1px solid; transition: all .15s; }
.env-badge .env-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.env-badge.dev { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, var(--border)); background: var(--amber-bg); }
.env-badge.prod { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); background: var(--red-bg); }
.env-badge.prod .env-dot { animation: pulse 1.3s infinite; }
@media (max-width: 1100px) { .env-badge .env-label { display: none; } .env-badge { padding: 0 12px; } }

/* Escolha de ambiente nas configurações */
.env-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .env-choice { grid-template-columns: 1fr; } }
.env-opt { text-align: left; padding: 16px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); transition: all .15s; }
.env-opt:hover { border-color: var(--border-strong); }
.env-opt.active { border-color: var(--brand-orange); background: var(--brand-orange-050); }
[data-theme="dark"] .env-opt.active { background: rgba(249,115,22,.1); }
.env-opt-top { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.env-opt-top strong { font-size: 14.5px; }
.env-opt .env-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.env-opt p { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

/* indicadores de sistema (ambiente + base) só p/ admin */
:root:not([data-role="admin"]) #envBadge,
:root:not([data-role="admin"]) #apiStatus { display: none !important; }

.api-status { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: all .15s; }
.api-status:hover { border-color: var(--border-strong); }
.api-status .st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.api-status.on { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.api-status.on .st-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); animation: pulse 1.6s infinite; }
.api-status.off { color: var(--red); }
.api-status.off .st-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.api-status.checking { color: var(--amber); }
.api-status.checking .st-dot { background: var(--amber); animation: pulse 1s infinite; }
@media (max-width: 1000px) { .api-status .st-label { display: none; } .api-status { padding: 0 12px; } }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: 10px; cursor: pointer; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.user-chip__info { line-height: 1.15; }
.user-chip__info strong { display: block; font-size: 13px; }
.user-chip__info small { color: var(--muted); font-size: 11.5px; }

/* ---------- Content ---------- */
.content { padding: 24px 26px 60px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; letter-spacing: -.4px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.breadcrumb a:hover { color: var(--brand-orange); }
.breadcrumb .sep { opacity: .5; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; transition: all .15s; white-space: nowrap; }
.btn-primary { background: var(--brand-orange); color: #fff; box-shadow: 0 2px 8px rgba(249,115,22,.28); }
.btn-primary:hover { background: var(--brand-orange-600); }
.btn-navy { background: var(--brand-navy); color: #fff; }
.btn-navy:hover { background: var(--brand-navy-2); }
.btn-ghost { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-soft { background: var(--brand-orange-050); color: var(--brand-orange-600); }
[data-theme="dark"] .btn-soft { background: rgba(249,115,22,.14); color: var(--brand-orange); }
.btn-soft:hover { filter: brightness(.97); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card__head h3 { font-size: 15px; }
.card__head .card__sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card__body { padding: 18px; }
.card__body.tight { padding: 0; }

/* Grid helpers */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 1100px) { .grid-4, .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- KPI ---------- */
.kpi { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; }
.kpi__icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; }
.kpi__icon svg { width: 21px; height: 21px; }
.kpi__label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -.6px; }
.kpi__trend { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.kpi__trend.up { color: var(--green); }
.kpi__trend.down { color: var(--red); }
.tint-orange { background: var(--brand-orange-050); color: var(--brand-orange-600); }
[data-theme="dark"] .tint-orange { background: rgba(249,115,22,.15); color: var(--brand-orange); }
.tint-navy { background: rgba(15,44,76,.09); color: var(--brand-navy); }
[data-theme="dark"] .tint-navy { background: rgba(37,99,235,.18); color: #7fa8ff; }
.tint-green { background: var(--green-bg); color: var(--green); }
.tint-sky { background: var(--sky-bg); color: var(--sky); }
.tint-violet { background: var(--violet-bg); color: var(--violet); }
.tint-amber { background: var(--amber-bg); color: var(--amber); }

/* KPI sparkline */
.kpi__spark { margin-top: 2px; }
.spark { display: block; opacity: .9; }

/* Funil de cotações */
.funnel { display: flex; flex-direction: column; gap: 15px; }
.funnel-row { display: grid; grid-template-columns: 108px 1fr 30px; align-items: center; gap: 14px; }
.funnel-row .fl-lbl { font-size: 12.5px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.fl-tag { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.funnel-track { height: 24px; border-radius: 7px; background: var(--surface-3); overflow: hidden; }
.funnel-track > span { display: block; height: 100%; border-radius: 7px; transition: width .5s ease; min-width: 6px; }
.funnel-row .fl-val { font-weight: 700; font-size: 14px; text-align: right; }

/* Tarefas do dia */
.task-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--surface-2); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.task-row .t-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.task-row .t-main { flex: 1; min-width: 0; }
.task-row .t-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-row .t-sub { font-size: 11.5px; color: var(--muted); }
.task-row .t-when { font-size: 11.5px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--green { background: var(--green-bg); color: var(--green); }
.badge--amber { background: var(--amber-bg); color: var(--amber); }
.badge--red { background: var(--red-bg); color: var(--red); }
.badge--sky { background: var(--sky-bg); color: var(--sky); }
.badge--violet { background: var(--violet-bg); color: var(--violet); }
.badge--gray { background: var(--surface-3); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; padding: 11px 16px; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-muted { color: var(--muted); font-size: 12.5px; }
.avatar-cell { display: flex; align-items: center; gap: 10px; }
.avatar-sm { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 11.5px; color: #fff; flex-shrink: 0; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search-inline { position: relative; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; height: 40px; padding: 0 12px; min-width: 220px; }
.search-inline input { border: none; background: transparent; outline: none; flex: 1; color: var(--text); }
.search-inline .ic-search { width: 15px; height: 15px; margin-right: 8px; opacity: .5; background: currentColor; -webkit-mask: var(--ic-search) center/contain no-repeat; mask: var(--ic-search) center/contain no-repeat; }
.select, .field-input, .field-select, textarea.field-input {
  height: 40px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 0 12px; outline: none; transition: border .15s, box-shadow .15s;
}
select.select, select.field-select { padding-right: 30px; appearance: none; background-image: var(--ic-chevron-bg); background-repeat: no-repeat; background-position: right 11px center; background-size: 14px; }
.field-input:focus, .field-select:focus, .select:focus, textarea.field-input:focus { border-color: var(--brand-orange); box-shadow: var(--ring); }
textarea.field-input { height: auto; padding: 10px 12px; resize: vertical; min-height: 84px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3,1fr); }
@media (max-width: 720px){ .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.col-span-2 { grid-column: span 2; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field label .req { color: var(--brand-orange); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field-input, .field-select { width: 100%; }

/* ---------- Wizard / stepper ---------- */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 26px; }
.step { display: flex; align-items: center; gap: 10px; flex: 1; }
.step__num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-3); color: var(--muted); border: 2px solid var(--border); flex-shrink: 0; }
.step__label { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.step__line { flex: 1; height: 2px; background: var(--border); margin: 0 12px; }
.step.done .step__num { background: var(--green); color: #fff; border-color: var(--green); }
.step.active .step__num { background: var(--brand-orange); color: #fff; border-color: var(--brand-orange); box-shadow: var(--ring); }
.step.active .step__label, .step.done .step__label { color: var(--text); }
@media (max-width: 720px){ .step__label { display:none; } }

/* Form section title */
.form-sec { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 14px; font-weight: 700; }

/* Checklist (especialidades) */
.check-list { max-height: 230px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--surface-2); display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; }
@media (max-width: 720px){ .check-list { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; font-size: 12.5px; cursor: pointer; }
.check-row:hover { background: var(--surface-3); }
.check-row input { width: 15px; height: 15px; accent-color: var(--brand-orange); flex-shrink: 0; }

/* Origem badge no card de seguradora */
.insurer-card__head .badge { font-size: 10px; padding: 2px 7px; }

/* Chatbot de cotação */
.bot-fab { position: fixed; bottom: 24px; right: 24px; z-index: 150; width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-orange), #fb923c); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 26px rgba(249,115,22,.45); transition: transform .18s ease; }
.bot-fab:hover { transform: scale(1.06); }
.bot-fab.active { transform: scale(.9); opacity: .85; }
.bot-fab svg { width: 30px; height: 30px; }
.bot-fab__pulse { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 0 rgba(249,115,22,.5); animation: botpulse 2.2s infinite; }
@keyframes botpulse { 70%,100% { box-shadow: 0 0 0 16px rgba(249,115,22,0); } }

.bot-panel { position: fixed; bottom: 96px; right: 24px; z-index: 150; width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 130px); background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; pointer-events: none; transform: translateY(16px) scale(.98); transform-origin: bottom right; transition: opacity .2s, transform .2s; }
.bot-panel.show { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.bot-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; background: var(--brand-navy); color: #fff; }
.bot-head__id { display: flex; align-items: center; gap: 10px; }
.bot-avatar { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 20px; }
.bot-head strong { font-size: 14px; display: block; } .bot-head small { font-size: 11px; color: #9fb4d1; }
.bot-close { color: #9fb4d1; font-size: 24px; width: 30px; height: 30px; border-radius: 8px; }
.bot-close:hover { background: rgba(255,255,255,.1); color: #fff; }
.bot-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.bot-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.bot-msg.bot { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; align-self: flex-start; }
.bot-msg.me { background: var(--brand-orange); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.bot-chips { display: flex; flex-wrap: wrap; gap: 7px; align-self: flex-start; max-width: 92%; }
.bot-chip { background: var(--surface); border: 1.5px solid var(--brand-orange); color: var(--brand-orange-600); padding: 7px 12px; border-radius: 18px; font-size: 12.5px; font-weight: 600; transition: all .12s; }
.bot-chip:hover { background: var(--brand-orange); color: #fff; }
[data-theme="dark"] .bot-chip { color: var(--brand-orange); }
.bot-typing { display: inline-flex; gap: 3px; }
.bot-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: botblink 1.2s infinite; }
.bot-typing i:nth-child(2) { animation-delay: .2s; } .bot-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes botblink { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }
.bot-result { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.bot-result.best { }
.bot-result__i { flex: 1; min-width: 0; } .bot-result__i strong { font-size: 13px; display: block; } .bot-result__i small { font-size: 11.5px; color: var(--muted); }
.bot-result__p { font-weight: 700; font-size: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.bot-input { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--border); background: var(--surface); }
.bot-input input { flex: 1; border: 1px solid var(--border); background: var(--surface-2); border-radius: 20px; padding: 0 14px; height: 40px; outline: none; color: var(--text); }
.bot-input input:focus { border-color: var(--brand-orange); }
.bot-input button { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-orange); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.bot-input button svg { width: 18px; height: 18px; }
@media (max-width: 500px) { .bot-panel { right: 8px; left: 8px; bottom: 88px; width: auto; } .bot-fab { bottom: 16px; right: 16px; } }

/* Documentação */
.doc-toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.doc-toc a { padding: 6px 13px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.doc-toc a:hover { border-color: var(--brand-orange); color: var(--brand-orange-600); }
.doc-sec { margin-bottom: 18px; scroll-margin-top: 80px; }
.doc-p { font-size: 13.5px; line-height: 1.65; color: var(--text-2); }
.doc-p strong { color: var(--text); }
.doc-list { margin: 0; padding-left: 20px; }
.doc-list li { font-size: 13.5px; line-height: 1.7; color: var(--text-2); }
.doc-list li strong { color: var(--text); }
.doc-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.doc-card h4 { font-size: 14px; margin: 10px 0 5px; }
.doc-card p { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.doc-card-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-orange-050); color: var(--brand-orange-600); }
[data-theme="dark"] .doc-card-ic { background: rgba(249,115,22,.14); color: var(--brand-orange); }
.doc-card-ic svg { width: 20px; height: 20px; }
code { background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--brand-orange-600); }
[data-theme="dark"] code { color: #fbbf77; }

/* Diagrama de arquitetura */
.arch-flow { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; }
.arch-col { display: flex; flex-direction: column; gap: 12px; }
.arch-node { flex: 1; min-width: 150px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.arch-node.sm { padding: 12px; min-width: 190px; }
.arch-node strong { font-size: 13.5px; }
.arch-node small { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.arch-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 6px; }
.arch-ic svg { width: 21px; height: 21px; }
.arch-arrow { display: flex; align-items: center; font-size: 22px; color: var(--muted); }
@media (max-width: 760px) { .arch-arrow { transform: rotate(90deg); } .arch-flow { flex-direction: column; } }

/* Passos da documentação */
.doc-steps { display: flex; flex-direction: column; gap: 12px; }
.doc-step { display: flex; gap: 14px; align-items: flex-start; }
.doc-step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-orange); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.doc-step strong { font-size: 14px; }
.doc-step p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* Tag de simulação (modo desenvolvimento) */
.sim-badge { font-size: 9.5px; padding: 1px 6px; letter-spacing: .3px; vertical-align: middle; }
.sim-badge--lg { font-size: 11px; padding: 3px 9px; margin-left: 8px; vertical-align: middle; }

/* Compartilhar cotação */
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-btn { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 600; font-size: 13.5px; color: var(--text); transition: all .15s; cursor: pointer; }
.share-btn:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.share-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.share-btn.wa { color: #0f8a6f; } .share-btn.wa svg { color: #25D366; }
.share-btn.mail svg { color: var(--brand-blue); }
.share-btn.copy svg { color: var(--brand-orange); }
.share-btn.pdf svg, .share-btn.print svg { color: var(--red); }
@media (max-width: 600px) { .share-grid { grid-template-columns: 1fr; } }

/* Skeleton loading (cotação ao vivo) */
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
.skel-logo { width: 42px; height: 42px; border-radius: 9px; margin-bottom: 12px; }
.skel-line { height: 12px; margin-bottom: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sky); margin: 0 3px; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.insurer-card__foot a.pdf-link { font-size: 11.5px; color: var(--sky); align-self: center; }

/* Barra de ação flutuante do wizard (não precisa rolar) */
.wiz-floatbar {
  position: fixed; bottom: 22px; right: 26px; left: auto;
  transform: translateY(26px); z-index: 60;
  display: flex; align-items: center; gap: 18px; padding: 11px 13px 11px 20px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; max-width: min(92vw, 620px);
}
.wiz-floatbar.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.wiz-floatbar__info { font-size: 13px; color: var(--text-2); }
.wiz-floatbar__info .check-ic { margin-right: 4px; }
@media (max-width: 700px) {
  .wiz-floatbar { left: 12px; right: 12px; justify-content: space-between; padding-left: 16px; }
  .wiz-floatbar__info { display: none; }
}
/* respiro no fim do conteúdo do wizard p/ a barra não cobrir */
#wizBody { padding-bottom: 40px; }

/* Tela de login */
.login-screen { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1100px 560px at 18% -10%, #1a4574, transparent), linear-gradient(135deg, #0f2c4c 0%, #081a30 100%); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 34px 32px; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.login-brand strong { font-size: 22px; color: var(--text); letter-spacing: -.3px; }
.login-brand strong span { color: var(--brand-orange); }
.login-card h1 { font-size: 21px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 15px; }
.login-error { color: var(--red); font-size: 12.5px; min-height: 17px; margin-bottom: 8px; font-weight: 500; }
.login-foot { text-align: center; margin-top: 18px; font-size: 11.5px; color: var(--muted); }
.login-card.shake { animation: shake .4s; }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 30%,70% { transform: translateX(4px); } 50% { transform: translateX(-7px); } }

/* Product picker */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }
.product-tile { position: relative; text-align: left; padding: 18px; border-radius: var(--radius); border: 1.5px solid var(--border); background: var(--surface); transition: all .15s; }
.product-tile:hover { border-color: var(--brand-orange); transform: translateY(-2px); box-shadow: var(--shadow); }
.product-tile.selected { border-color: var(--brand-orange); background: var(--brand-orange-050); }
[data-theme="dark"] .product-tile.selected { background: rgba(249,115,22,.1); }
.product-tile .pt-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; }
.product-tile .pt-ic svg { width: 24px; height: 24px; }
.product-tile h4 { font-size: 14.5px; margin-bottom: 3px; }
.product-tile p { font-size: 12px; color: var(--muted); line-height: 1.4; }
.product-tile .pt-check { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-orange); color: #fff; display: none; place-items: center; font-size: 13px; }
.product-tile.selected .pt-check { display: grid; }

/* Quote result cards (comparativo seguradoras) */
.quote-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.insurer-card { border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: all .15s; display: flex; flex-direction: column; }
.insurer-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.insurer-card.best { border-color: var(--brand-orange); }
.insurer-card__ribbon { background: var(--brand-orange); color: #fff; font-size: 11px; font-weight: 700; text-align: center; padding: 4px; letter-spacing: .4px; }
.insurer-card__head { display: flex; align-items: center; gap: 11px; padding: 16px 16px 12px; }
.insurer-logo { width: 42px; height: 42px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; overflow: hidden; }
.insurer-logo.has-img { background: #fff; border: 1px solid var(--border); padding: 4px; }
.insurer-logo.has-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.insurer-logo--lg { width: 48px; height: 48px; }
.insurer-logo.logo-mini { width: 26px; height: 26px; border-radius: 6px; font-size: 9px; }
.insurer-logo.logo-mini.has-img { padding: 2px; }
.seg-cell { display: inline-flex; align-items: center; gap: 8px; }
.insurer-card__head strong { font-size: 14.5px; display: block; }
.insurer-card__head .rating { font-size: 12px; color: var(--amber); }
.insurer-card__price { padding: 4px 16px 14px; }
.insurer-card__price .lbl { font-size: 11.5px; color: var(--muted); }
.insurer-card__price .val { font-size: 25px; font-weight: 700; letter-spacing: -.5px; }
.insurer-card__price .val small { font-size: 13px; font-weight: 500; color: var(--muted); }
.insurer-card__price .installments { font-size: 12px; color: var(--brand-orange-600); font-weight: 600; }
.insurer-card__cov { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 7px; border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 13px; }
.cov-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.cov-row .cov-lbl { color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.cov-row .cov-val { font-weight: 600; }
.check-ic { color: var(--green); font-weight: 700; }
.insurer-card__foot { margin-top: auto; padding: 12px 16px 16px; display: flex; gap: 8px; }

/* ---------- Detail / summary lists ---------- */
.def-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.def-list > div { background: var(--surface); padding: 12px 14px; }
.def-list dt { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.def-list dd { font-size: 13.5px; font-weight: 600; }
@media (max-width:600px){ .def-list { grid-template-columns: 1fr; } }

.summary-list { display: flex; flex-direction: column; }
.summary-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.summary-row:last-child { border-bottom: none; }
.summary-row .lbl { color: var(--muted); }
.summary-row.total { font-size: 16px; font-weight: 700; border-top: 2px solid var(--border); padding-top: 12px; margin-top: 4px; }
.summary-row.total .amt { color: var(--brand-orange-600); }

/* ---------- Notes / anotações ---------- */
.note-cols { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; align-items: start; }
@media (max-width: 980px){ .note-cols { grid-template-columns: 1fr; } }
.note-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.note-col__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; font-weight: 700; font-size: 13px; }
.note-col__head .count { background: var(--surface-3); color: var(--muted); border-radius: 20px; padding: 1px 9px; font-size: 11.5px; }
.note-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 13px; margin-bottom: 10px; box-shadow: var(--shadow-sm); cursor: grab; }
.note-card:hover { box-shadow: var(--shadow); }
.note-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.note-card h5 { font-size: 13.5px; margin-bottom: 5px; }
.note-card p { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.note-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 11.5px; color: var(--muted); }

/* Seletor de cor do cartão (kanban) */
.note-cores { display: flex; gap: 9px; flex-wrap: wrap; }
.note-swatch { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--border); background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 14px; transition: transform .1s; }
.note-swatch:hover { transform: scale(1.1); }
.note-swatch.active { outline: 2px solid var(--text); outline-offset: 2px; }

/* Timeline (annotations feed) */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content:""; position:absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -26px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-orange); display: grid; place-items: center; }
.tl-dot::after { content:""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-orange); }
.tl-item h5 { font-size: 13px; }
.tl-item .tl-meta { font-size: 11.5px; color: var(--muted); margin: 2px 0 6px; }
.tl-item p { font-size: 12.5px; color: var(--text-2); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(8,17,32,.55); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; animation: pop .18s ease; }
.modal.lg { max-width: 760px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal__head h3 { font-size: 17px; }
.modal__close { width: 32px; height: 32px; border-radius: 8px; color: var(--muted); font-size: 20px; display: grid; place-items: center; }
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 22px; overflow-y: auto; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand-orange); border-radius: 10px; padding: 13px 16px; box-shadow: var(--shadow-lg); min-width: 280px; animation: slideIn .2s ease; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast__ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; flex-shrink: 0; background: var(--brand-orange); }
.toast.success .toast__ic { background: var(--green); }
.toast.error .toast__ic { background: var(--red); }
.toast strong { font-size: 13.5px; display: block; }
.toast small { font-size: 12px; color: var(--muted); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .empty-ic { font-size: 40px; margin-bottom: 10px; opacity: .6; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-0{margin-bottom:0;}
.flex { display: flex; } .items-center { align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.text-muted { color: var(--muted); } .text-right { text-align: right; }
.progress { height: 8px; background: var(--surface-3); border-radius: 20px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-orange); border-radius: 20px; }
.mini-bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 10px; }
.mini-bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mini-bars .bar { width: 70%; max-width: 34px; background: linear-gradient(180deg, var(--brand-orange), #fb923c); border-radius: 6px 6px 0 0; transition: height .4s; }
.mini-bars .bar.alt { background: linear-gradient(180deg, var(--brand-navy), #24558c); }
.mini-bars .bar-lbl { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.list-plain { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-weight: 600; font-size: 13.5px; }
.list-row .lr-sub { font-size: 12px; color: var(--muted); }

/* ===== Navegação inferior mobile (estilo app) ===== */
.mobile-nav { display: none; }
.mobile-sheet, .mobile-sheet-bd { display: none; }
@media (max-width: 900px) {
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 62px; z-index: 90;
    background: var(--surface); border-top: 1px solid var(--border);
    align-items: center; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(16,39,61,.06);
  }
  .mnav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; color: var(--muted); height: 100%; justify-content: center; }
  .mnav-item.active { color: var(--brand-orange); }
  .mnav-item svg { width: 22px; height: 22px; }
  .mnav-fab { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%; background: var(--brand-orange); color: #fff; display: grid; place-items: center; margin-top: -20px; box-shadow: 0 6px 16px rgba(249,115,22,.45); }
  .mnav-fab svg { width: 26px; height: 26px; }

  .mobile-sheet { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 96; background: var(--surface);
    border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); transform: translateY(105%); transition: transform .26s ease;
    padding: 10px 14px calc(74px + env(safe-area-inset-bottom)); }
  .mobile-sheet.show { transform: translateY(0); }
  .mobile-sheet-bd { display: block; position: fixed; inset: 0; z-index: 95; background: rgba(8,17,32,.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .mobile-sheet-bd.show { opacity: 1; pointer-events: auto; }
  .msheet-handle { width: 42px; height: 4px; border-radius: 3px; background: var(--border-strong); margin: 4px auto 14px; }
  .msheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .msheet-item { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 13px 4px; border-radius: 13px; font-size: 10.5px; font-weight: 600; color: var(--text-2); text-align: center; }
  .msheet-item:active { background: var(--surface-2); }
  .msheet-item .msheet-ic { width: 44px; height: 44px; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; }
  .msheet-item .msheet-ic svg { width: 22px; height: 22px; color: var(--text-2); }
  .msheet-sep { height: 1px; background: var(--border); margin: 12px 0; }

  /* Esconde a sidebar/hamburger no mobile — navegação vira a barra inferior */
  .sidebar { display: none !important; }
  .topbar__menu { display: none !important; }
  .content { padding: 18px 16px 84px; }
  /* Enxuga a topbar no mobile: nova cotação vira o "+" da barra inferior; tema/sair/env/api vão pra folha "Mais" */
  #btnTheme, #btnLogout, #envBadge, #apiStatus, #btnNotif, #btnNewQuote { display: none !important; }
  /* Chatbot acima da barra inferior */
  .bot-fab { bottom: 78px; right: 16px; }
  .bot-panel { bottom: 150px; }
  .wiz-floatbar { bottom: 74px; }
}

/* ===== Correções de responsividade (mobile) ===== */
/* trava o overflow horizontal (causa da "margem grande à direita") */
@media (max-width: 900px) {
  html, body { overflow-x: hidden; width: 100%; max-width: 100%; }
  #app, .main, .content { max-width: 100%; min-width: 0; width: 100%; }
  .card, .toolbar, .grid, .page-head { max-width: 100%; }
  .table-wrap { max-width: 100%; }
  code { word-break: break-word; }
  img, svg { max-width: 100%; }
}
@media (max-width: 820px) {
  /* grids com colunas fixas via style inline (dashboard, detalhes) viram 1 coluna */
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .grid { gap: 14px !important; }
  /* cabeçalho da página: ações quebram linha e não estouram */
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 19px; }
  .page-head > .flex { flex-wrap: wrap; }
  .page-head .btn, .page-head .seg { flex: 0 1 auto; }
  #periodSeg { display: none; } /* seletor de período some no mobile */
  /* toolbars e chips quebram linha */
  .toolbar { gap: 8px; }
  .search-inline { min-width: 0; flex: 1 1 100%; }
  /* KPIs em 1 coluna no celular estreito */
}
@media (max-width: 480px) {
  .grid-kpi { grid-template-columns: 1fr !important; }
  .kpi__value { font-size: 23px; }
  .stepper .step__label { display: none; }
  .content { padding: 16px 12px 84px; }
}

/* Mobile */
.backdrop { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .topbar__menu { display: block; }
  .topbar__search { max-width: none; }
  .user-chip__info { display: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .icon-btn#btnNewQuote span:not(.plus) { display: none; }
}

/* Icon mask sources (inline data uris) */
:root {
  --ic-search: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
  --ic-bell: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/><path d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/></svg>");
}
[data-theme="light"] { --ic-chevron-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7C93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); }
[data-theme="dark"] { --ic-chevron-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237E93A9' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); }

/* Descoberta de formulários das seguradoras */
.desc-seg{border:1px solid var(--border);border-radius:10px;margin-bottom:8px;overflow:hidden}
.desc-seg__head{display:flex;align-items:center;gap:8px;padding:10px 14px;cursor:pointer;background:var(--surface-2);flex-wrap:wrap}
.desc-seg__head:hover{background:var(--surface-3)}
.desc-seg__head .spacer{flex:1}
.desc-seg__body{display:none;padding:6px 14px 12px;border-top:1px solid var(--border)}
.desc-seg.open .desc-seg__body{display:block}
.desc-grp{font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);margin:12px 0 4px;font-weight:700}
.desc-field{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border-bottom:1px dashed var(--border);font-size:12.5px;flex-wrap:wrap}
.desc-field:last-child{border-bottom:none}
.desc-field__label{flex:1;min-width:200px}
.desc-field__meta{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.desc-field__meta code{font-size:11px;background:var(--surface-2);padding:1px 5px;border-radius:4px}

/* Fatores de preço por seguradora (card do comparativo) */
.pf-box{padding:8px 12px;border-top:1px dashed var(--border)}
.pf-box .pf-lbl{font-size:10.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.03em}
.pf-chips{display:flex;flex-wrap:wrap;gap:5px;margin-top:6px}
.pf-chip{font-size:10.5px;padding:2px 7px;border-radius:20px;background:var(--surface-2);color:var(--muted);border:1px solid var(--border)}
.pf-chip.on{background:var(--sky-bg);color:var(--brand-navy);border-color:transparent}
.pf-chip.on b{font-weight:700}

/* Documentação — payload por seguradora */
.pl-grid{display:grid;gap:14px}
.pl-card{border:1px solid var(--border);border-radius:10px;padding:12px 14px;background:var(--surface-2)}
.pl-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:8px}
.pl-pre{margin:0;padding:12px;background:var(--bg);border:1px solid var(--border);border-radius:8px;overflow-x:auto;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;line-height:1.5;white-space:pre;color:var(--muted)}

/* Documentação — "como" (endpoint/auth) do payload */
.pl-como{font-size:11.5px;color:var(--muted);margin-bottom:2px;word-break:break-word}
.pl-verb{display:inline-block;font-size:9px;font-weight:700;letter-spacing:.04em;padding:1px 6px;border-radius:4px;background:var(--surface-3);color:var(--muted);margin-right:6px}
