/* ═══════════════════════════════════════════════════════════════════
   OMS CRM — design system
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f3f6;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --muted: #667085;
  --faint: #98a2b3;

  /* Marca OmeuStand: --brand para fundos, --primary (mais escuro) para texto e links */
  --brand: #00D85B;
  --brand-600: #00c251;
  --on-brand: #ffffff;
  --primary: #00843a;
  --primary-600: #006b2f;
  --primary-50: #e8fbf0;
  --primary-100: #c6f4d9;
  --on-primary: #ffffff;

  --success: #079455;  --success-bg: #ecfdf3;  --success-bd: #abefc6;
  --warning: #b54708;  --warning-bg: #fffaeb;  --warning-bd: #fedf89;
  --danger:  #d92d20;  --danger-bg:  #fef3f2;  --danger-bd:  #fecdca;
  --info:    #0e7090;  --info-bg:    #ecfdff;  --info-bd:    #a5f0fc;
  --violet:  #6938ef;  --violet-bg:  #f4f3ff;

  --sidebar-bg: #0b1220;
  --sidebar-text: #aab4c5;
  --sidebar-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 64px;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 12px 32px -8px rgba(16,24,40,.18), 0 4px 8px -4px rgba(16,24,40,.06);
  --ring: 0 0 0 4px rgba(0,216,91,.22);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c111d;
  --surface: #121826;
  --surface-2: #161d2d;
  --surface-3: #1d2638;
  --border: #253047;
  --border-strong: #33405b;
  --text: #eef2f8;
  --text-2: #c2cad8;
  --muted: #94a0b4;
  --faint: #6b778c;

  --brand: #00D85B;
  --brand-600: #2fe37a;
  --on-brand: #ffffff;
  --primary: #33e07c;
  --primary-600: #5ee899;
  --primary-50: rgba(0,216,91,.12);
  --primary-100: rgba(0,216,91,.24);
  --on-primary: #ffffff;

  --success: #47cd89;  --success-bg: rgba(71,205,137,.12);  --success-bd: rgba(71,205,137,.3);
  --warning: #fdb022;  --warning-bg: rgba(253,176,34,.12);  --warning-bd: rgba(253,176,34,.3);
  --danger:  #f97066;  --danger-bg:  rgba(249,112,102,.12); --danger-bd:  rgba(249,112,102,.3);
  --info:    #22ccee;  --info-bg:    rgba(34,204,238,.12);  --info-bd:    rgba(34,204,238,.3);
  --violet:  #9b8afb;  --violet-bg:  rgba(155,138,251,.12);

  --sidebar-bg: #090d17;
  --shadow-lg: 0 12px 32px -8px rgba(0,0,0,.55);
  --ring: 0 0 0 4px rgba(0,216,91,.28);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code, kbd, pre { font-family: var(--mono); font-size: .85em; }
code { background: var(--surface-3); padding: .1em .35em; border-radius: 4px; }
::selection { background: var(--primary-100); }
[hidden] { display: none !important; }

/* Ícones da fonte 4al */
[class^="icon-"], [class*=" icon-"] { display: inline-block; font-size: 1.05em; vertical-align: -.12em; }

/* ── Shell ─────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; transition: width .2s ease, transform .25s ease;
}
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand:hover { color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #00D85B, #00a847); color: #ffffff; font-size: 18px; flex: none; }
.brand-text small { font-weight: 500; color: #8fa0bd; margin-left: 2px; }
.ibtn.sidebar-close { display: none; color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 24px; scrollbar-width: thin; scrollbar-color: #26314a transparent; }
/* Títulos das secções do menu (Comercial, Portal, …): verde da marca, com traço à esquerda e linha divisória */
.nav-section { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #33e07c; padding: 22px 10px 8px; white-space: nowrap; }
.nav-section::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: #00D85B; flex: none; }
.nav-section::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.12); }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 8px;
  color: var(--sidebar-text); font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer;
  white-space: nowrap; list-style: none; text-align: left;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { color: var(--sidebar-active); background: rgba(0,216,91,.14); }
.nav-link.active .nav-icon { color: #00D85B; }
.nav-icon { font-size: 18px; width: 20px; text-align: center; flex: none; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-caret { font-size: 13px; transition: transform .2s; opacity: .7; }
.nav-group[open] > summary .nav-caret { transform: rotate(180deg); }
.nav-children { padding: 2px 0 6px 42px; display: flex; flex-direction: column; gap: 1px; }
.nav-sublink { padding: 6px 10px; border-radius: 6px; color: #8a97ad; font-size: 13.5px; white-space: nowrap; position: relative; }
.nav-sublink:hover { color: #fff; background: var(--sidebar-hover); }
.nav-sublink.active { color: #fff; font-weight: 600; }
.nav-sublink.active::before { content: ""; position: absolute; left: -14px; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: #00D85B; transform: translateY(-50%); }
.sidebar-foot { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin .2s ease; display: flex; flex-direction: column; }
.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
.sidebar-collapsed .nav-label, .sidebar-collapsed .nav-caret, .sidebar-collapsed .nav-section,
.sidebar-collapsed .brand-text, .sidebar-collapsed .nav-children { display: none; }
.sidebar-collapsed .nav-link { justify-content: center; padding: 10px; }
.sidebar-collapsed .collapse-toggle .nav-icon { transform: rotate(180deg); }
.sidebar-collapsed .sidebar-brand { padding: 0; justify-content: center; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
/* .menu-toggle (☰) fica visível em todos os ecrãs: no computador recolhe o menu, no telemóvel abre-o */
.flex-1 { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.global-search { position: relative; flex: 1; max-width: 520px; }
.global-search input {
  width: 100%; height: 40px; padding: 0 44px 0 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
.global-search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.gs-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.gs-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.gs-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 420px; overflow: auto; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.gs-item:hover, .gs-item.focus { background: var(--surface-3); color: var(--text); }
.gs-item small { color: var(--muted); display: block; }
.gs-empty { padding: 14px; color: var(--muted); text-align: center; }
kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; color: var(--muted); background: var(--surface-2); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 0; background: none; color: var(--text); cursor: pointer; font: inherit; text-align: left; }
.user-chip:hover { background: var(--surface-3); }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip-text small { color: var(--muted); font-size: 12px; }
[data-theme="dark"] .theme-dark-icon, [data-theme="light"] .theme-light-icon { display: none; }

.content { padding: 28px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ── Cabeçalho de página ───────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }

/* ── Botões ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); background: var(--danger); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); background: var(--success); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-soft { background: var(--primary-50); border-color: transparent; color: var(--primary); box-shadow: none; }
.btn-soft:hover { background: var(--primary-100); color: var(--primary); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; gap: 5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.ibtn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0;
  background: transparent; color: var(--text-2); cursor: pointer; font-size: 17px; flex: none;
}
.ibtn:hover { background: var(--surface-3); color: var(--text); }
.ibtn-sm { width: 30px; height: 30px; font-size: 15px; border-radius: 7px; }
.ibtn.danger:hover { color: var(--danger); background: var(--danger-bg); }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 9px 9px 0; }
.btn-group .btn.active { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); z-index: 1; }

/* ── Cartões ───────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card + .card { margin-top: 20px; }
.grid > .card + .card, .stack > .card + .card { margin-top: 0; }
.card-flush .card-body { padding: 0; }

/* ── KPIs ──────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow-sm); position: relative; }
a.kpi { color: inherit; }
a.kpi:hover { border-color: var(--primary-100); }
.kpi-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; flex: none; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.kpi-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi.active { border-color: var(--brand); box-shadow: var(--ring); }

.tone-blue   { background: var(--primary-50); color: var(--primary); }
.tone-green  { background: var(--success-bg); color: var(--success); }
.tone-amber  { background: var(--warning-bg); color: var(--warning); }
.tone-red    { background: var(--danger-bg);  color: var(--danger); }
.tone-cyan   { background: var(--info-bg);    color: var(--info); }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-slate  { background: var(--surface-3);  color: var(--text-2); }

/* ── Grelhas ───────────────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 360px; }
.grid-side-main { grid-template-columns: 300px minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.gap-sm { gap: 6px; } .gap-lg { gap: 24px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.text-right { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.text-danger { color: var(--danger) !important; } .text-success { color: var(--success) !important; } .text-warning { color: var(--warning) !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: block; }

/* ── Tabelas ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.row-danger td { background: var(--danger-bg); }
.table tr.row-muted td { opacity: .6; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table .col-check { width: 36px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-compact td { padding: 7px 12px; }
.table-compact th { padding: 8px 12px; }
.sort-link { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.sort-link.active { color: var(--text); }
.sort-ind { font-size: 9px; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main .title { font-weight: 600; color: var(--text); display: block; }
.cell-main .title:hover { color: var(--primary); }
.cell-main .sub { color: var(--muted); font-size: 12.5px; display: block; }
.thumb { width: 44px; height: 44px; border-radius: 9px; object-fit: contain; background: var(--surface-3); border: 1px solid var(--border); flex: none; }
.thumb-lg { width: 72px; height: 54px; object-fit: cover; }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 34px; color: var(--faint); margin-bottom: 8px; display: block; }
.empty h3 { color: var(--text); margin-bottom: 4px; }

/* Inline edit */
.inline-input { width: 100%; min-width: 80px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
.inline-input:hover { border-color: var(--border); background: var(--surface); }
.inline-input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: var(--ring); }
.inline-input.saving { border-color: var(--warning); }
.inline-input.saved { border-color: var(--success); background: var(--success-bg); }
.inline-input.error { border-color: var(--danger); background: var(--danger-bg); }

/* ── Toolbar / filtros ─────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .search .input { padding-left: 34px; }
.toolbar .search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.toolbar .input, .toolbar .select { height: 36px; }
.toolbar .select { width: auto; min-width: 150px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 12px; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; font-family: inherit; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--brand); }
.tab .count { background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.tab.active .count { background: var(--primary-50); color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12.5px; color: var(--text-2); }
.chip a { color: inherit; }

/* ── Paginação ─────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pages { display: flex; gap: 4px; }
.page-link { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--text-2); font-weight: 500; border: 1px solid transparent; }
.page-link:hover { background: var(--surface-3); color: var(--text); }
.page-link.active { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); font-weight: 700; }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-blue    { background: #eff4ff; color: #1d4ed8; border-color: #dbe6fe; }
[data-theme="dark"] .badge-blue { background: rgba(91,141,239,.14); color: #8fb3f5; border-color: rgba(91,141,239,.3); }
.badge-green   { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.badge-amber   { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.badge-red     { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-bd); }
.badge-cyan    { background: var(--info-bg);    color: var(--info);    border-color: var(--info-bd); }
.badge-violet  { background: var(--violet-bg);  color: var(--violet); }
.stars { color: #f5a524; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--border-strong); }

/* ── Avatares ──────────────────────────────────────────────────────── */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

/* ── Formulários ───────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.label .req { color: var(--danger); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 360px; tab-size: 2; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select[multiple] { height: auto; padding: 6px; background-image: none; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input:disabled, .select:disabled, .textarea:disabled, .input[readonly] { background: var(--surface-3); color: var(--muted); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input-group { display: flex; }
.input-group .input { border-radius: 9px 0 0 9px; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 9px 9px 0; background: var(--surface-2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.input-group .addon-left { border-radius: 9px 0 0 9px; border-left: 1px solid var(--border-strong); border-right: 0; }
.input-group .addon-left + .input { border-radius: 0 9px 9px 0; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; flex: none; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch input:disabled + .track { opacity: .5; }
.form-section { padding: 22px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section-title { font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.form-section-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 20px; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border); margin: 24px -28px -28px; padding: 14px 28px; display: flex; justify-content: flex-end; gap: 10px; }
.pw-meter { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.counter { font-size: 12px; color: var(--muted); text-align: right; }
.counter.over { color: var(--danger); font-weight: 600; }

/* ── Alertas ───────────────────────────────────────────────────────── */
.alert { padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 13.5px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert i { margin-top: 2px; }
.alert-success { background: var(--success-bg); border-color: var(--success-bd); color: var(--success); }
.alert-error, .alert-danger { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning); }
.alert-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info); }
.alert p:last-child { margin: 0; }
.alert .alert-body { color: var(--text); }

/* ── Dropdown ──────────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; }
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-right { left: auto; right: 0; }
.dropdown-up { top: auto; bottom: calc(100% + 6px); }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; white-space: nowrap; }
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item.text-danger:hover { background: var(--danger-bg); }
.dropdown-item i { color: var(--muted); width: 16px; text-align: center; }
.dropdown-item.text-danger i { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-header { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal { border: 0; padding: 0; background: transparent; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: visible; color: var(--text); }
.modal::backdrop { background: rgba(10,15,25,.55); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-box { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 560px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--border); }
.modal-sm { width: 420px; }
.modal-lg { width: 820px; }
.modal-xl { width: 1140px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; overflow-y: auto; min-height: 0; }
/* Conteúdo carregado por AJAX vem dentro de um invólucro (div/form): tem de herdar a coluna flex para o corpo fazer scroll */
.modal-box > :is(div, form):not(.modal-head):not(.modal-body):not(.modal-foot) { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-title { margin: 0 0 6px; }
.confirm-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--danger-bg); color: var(--danger); font-size: 22px; margin-bottom: 14px; }
.confirm-icon.tone-blue { background: var(--primary-50); color: var(--primary); }
.confirm-typed { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }

/* ── Toasts ────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow-lg); font-weight: 500; animation: toast-in .25s ease-out; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast.hide { opacity: 0; transform: translateX(20px); transition: all .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Listas / definições ───────────────────────────────────────────── */
.dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.rank { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); flex: none; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; background: var(--brand); }
.progress .p-green { background: var(--success); } .progress .p-red { background: var(--danger); } .progress .p-amber { background: var(--warning); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--surface); background: var(--brand); box-shadow: 0 0 0 1px var(--border); }
.timeline .meta { font-size: 12px; color: var(--muted); }

/* Cartões de viatura (grelha) */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; padding: 16px; }
.vcard { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.vcard-img { aspect-ratio: 4 / 3; background: var(--surface-3) center / cover no-repeat; position: relative; }
.vcard-img .badge { position: absolute; top: 8px; left: 8px; }
.vcard-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.vcard-title { font-weight: 650; line-height: 1.3; }
.vcard-price { font-weight: 700; font-size: 16px; }
.vcard-foot { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Permissões */
.perm-group { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.perm-group + .perm-group { margin-top: 14px; }
.perm-group-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 650; }
.perm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.perm-row:last-child { border-bottom: 0; }
.perm-row .key { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.tri { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.tri label { position: relative; }
.tri input { position: absolute; opacity: 0; }
.tri span { display: block; padding: 5px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); border-left: 1px solid var(--border); }
.tri label:first-child span { border-left: 0; }
.tri input:checked + span { background: var(--surface-3); color: var(--text); }
.tri input[value="grant"]:checked + span { background: var(--success-bg); color: var(--success); }
.tri input[value="deny"]:checked + span { background: var(--danger-bg); color: var(--danger); }
.tri input:focus-visible + span { box-shadow: inset var(--ring); }
.perm-effective { font-size: 12px; }

/* Editor HTML + pré-visualização */
.editor-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; min-height: 560px; }
.editor-split .pane { display: flex; flex-direction: column; min-width: 0; }
.editor-split .pane + .pane { border-left: 1px solid var(--border); }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.preview-frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: 520px; }
.preview-frame.mobile { max-width: 390px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.editor-split .textarea.code { border: 0; border-radius: 0; flex: 1; min-height: 520px; box-shadow: none; }
.cke_chrome { border-color: var(--border-strong) !important; border-radius: 9px; overflow: hidden; box-shadow: none !important; }

/* Gráficos */
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 360px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Media library */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.media-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit; }
.media-item:hover { border-color: var(--brand); box-shadow: var(--ring); }
.media-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface-3); }
.media-item div { padding: 6px 8px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 24px; text-align: center; color: var(--muted); }
.dropzone.over { border-color: var(--brand); background: var(--primary-50); }

/* Sortable */
.sortable-handle { cursor: grab; color: var(--faint); }
tr.dragging td { opacity: .5; background: var(--primary-50); }

/* ── Autenticação ──────────────────────────────────────────────────── */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: radial-gradient(1200px 600px at -10% -10%, #0d5c32 0%, transparent 60%), linear-gradient(160deg, #0b1220 0%, #111c35 100%); color: #cbd5e1; display: flex; align-items: center; justify-content: center; padding: 48px; }
/* Marca no ecrã de entrada: quadrado verde com o símbolo + «OmeuStand» */
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.auth-mark { width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; background: linear-gradient(135deg, #00D85B, #00a847); color: #fff; font-size: 46px; box-shadow: 0 12px 32px rgba(0, 216, 91, .28); }
.auth-word { font-size: 40px; font-weight: 800; letter-spacing: -.03em; color: #fff; line-height: 1; }
.auth-word b { color: #00D85B; font-weight: 800; }
.auth-tag { font-size: 12px; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: #7f8ea8; padding-left: .32em; }
.auth-brand-sm { display: none; flex-direction: row; gap: 10px; margin-bottom: 28px; }
.auth-brand-sm .auth-mark { width: 40px; height: 40px; border-radius: 11px; font-size: 22px; box-shadow: none; }
.auth-brand-sm .auth-word { font-size: 24px; color: var(--text); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-foot { color: var(--faint); font-size: 12px; margin-top: 32px; }
.otp-input { letter-spacing: .5em; text-align: center; font-size: 22px; font-weight: 700; height: 52px; font-family: var(--mono); }

/* ── Responsivo ────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10,15,25,.5); }
  .main, .sidebar-collapsed .main { margin-left: 0; }
  .menu-toggle, .ibtn.sidebar-close { display: inline-grid; }
  .sidebar-collapsed .nav-label, .sidebar-collapsed .brand-text { display: initial; }
  .sidebar-collapsed .nav-section { display: flex; }
  .sidebar-foot { display: none; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side-main { grid-template-columns: minmax(0, 1fr); }
  .editor-split { grid-template-columns: minmax(0, 1fr); }
  .editor-split .pane + .pane { border-left: 0; border-top: 1px solid var(--border); }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .auth-brand-sm { display: flex; }
}
@media (max-width: 720px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .user-chip-text, .gs-kbd { display: none; }
  .grid-2, .grid-3, .grid-4, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; flex-direction: column; gap: 8px; }
  .kpi-value { font-size: 21px; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
  .sticky-actions { margin: 20px -16px -16px; padding: 12px 16px; }
  .toolbar .search { max-width: none; }
  .page-head h1 { font-size: 1.3rem; }
}
@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .pagination, .col-actions { display: none !important; }
  .main { margin: 0 !important; }
  .card { box-shadow: none; }
}

/* ═══ Otimização mobile ════════════════════════════════════════════
   .table-stack: em ecrãs pequenos cada linha passa a cartão; cada <td>
   mostra o rótulo indicado em data-label. Colunas com .hide-mobile somem. */
@media (max-width: 720px) {
  html { font-size: 15px; }
  body { font-size: 15px; }
  .input, .select, .textarea, .global-search input { font-size: 16px; } /* evita zoom no iOS */
  .btn { height: 42px; }
  .btn-sm { height: 36px; }
  .ibtn { width: 40px; height: 40px; }
  .ibtn-sm { width: 36px; height: 36px; }
  .hide-mobile { display: none !important; }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > .dropdown { flex: 1; }
  .page-actions > .dropdown > .btn { width: 100%; }
  .card-head, .card-body { padding: 14px 16px; }
  .toolbar { padding: 12px; }
  .toolbar .select, .toolbar .input, .toolbar .search { flex: 1 1 100%; min-width: 0; max-width: none; }
  .toolbar .btn { flex: 1; }
  .tabs { padding: 0 8px; }

  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { border-bottom: 1px solid var(--border); padding: 12px 14px; position: relative; }
  .table-stack tbody tr:hover td { background: transparent; }
  .table-stack td { border: 0; padding: 4px 0; display: grid; grid-template-columns: minmax(96px, auto) minmax(0, 1fr); column-gap: 12px; text-align: right; align-items: start; }
  .table-stack td[data-label] > * { grid-column: 2; justify-self: end; }
  .table-stack td[data-label]::before { grid-column: 1; grid-row: 1 / span 6; }
  .table-stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 500; text-align: left; flex: none; }
  .table-stack td.cell-primary { display: block; text-align: left; padding: 0 44px 6px 0; }
  .table-stack td.cell-primary::before { display: none; }
  .table-stack td.col-actions { position: absolute; top: 8px; right: 8px; width: auto; padding: 0; display: flex; gap: 2px; }
  .table-stack td:not([data-label]) { display: block; }
  .table-stack td.col-check { position: absolute; top: 12px; left: 14px; width: auto; }
  .table-stack tr:has(td.col-check) td.cell-primary { padding-left: 30px; }
  .table-stack .num { text-align: right; }

  .modal { max-width: 100vw; max-height: 100vh; margin: auto 0 0; width: 100%; }
  .modal-box, .modal-sm, .modal-lg, .modal-xl { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal-foot { border-radius: 0; }
  .modal-foot .btn { flex: 1; }
  .dropdown-menu { min-width: 200px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
  .perm-row { grid-template-columns: minmax(0, 1fr); }
  .editor-split { min-height: 0; }
  .preview-frame { min-height: 420px; }
  .chart-box { height: 240px; }
  .pagination { justify-content: center; }
  .pagination > .muted { width: 100%; text-align: center; }
}
@media (max-width: 340px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .vgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) {
  .inline-input { border-color: var(--border); background: var(--surface); }
}

.note-grid { grid-template-columns: 160px minmax(0, 1fr) 170px auto; align-items: end; }
@media (max-width: 900px) { .note-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .note-grid > .field:nth-child(2) { grid-column: 1 / -1; } }

/* Opções marcáveis em formato "chip" (filtros) */
.chip-check { cursor: pointer; border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s; user-select: none; }
.chip-check:hover { border-color: var(--border-strong); }
.chip-check input { accent-color: var(--brand); margin: 0; }
.chip-check:has(input:checked) { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); font-weight: 600; }
.chip-check:has(input:disabled) { opacity: .5; cursor: not-allowed; }
@media (max-width: 720px) { .chip-check { padding: 6px 12px; font-size: 14px; } }

/* Variáveis no texto do SMS ({stand}, {nome}, {dominio}) */
mark.sms-var { background: var(--brand); color: #fff; border-radius: 4px; padding: 0 4px; font-weight: 600; }
