:root {
  /* superfícies (4 elevações) */
  --s0: #0a0f1c; --s1: #0f1626; --s2: #151f33; --s3: #1b2740;
  --border: #1e2a44; --border-strong: #2b3a5c;
  /* marca (índigo) — identidade do produto */
  --brand: #6366f1; --brand-2: #818cf8; --brand-3: #4f46e5; --brand-fg: #ffffff;
  --brand-soft: rgba(99,102,241,.14); --ring: rgba(99,102,241,.30);
  /* semânticas */
  --success: #25d366; --success-soft: #0e2a1c;
  --warn: #f0b429; --warn-soft: #2a2310;
  --danger: #ef4444; --danger-soft: #2a1116;
  --orange: #fb923c;
  /* texto (contraste AA — --subtle clareado p/ passar 4.5:1 em placeholders) */
  --fg: #e8eef7; --muted: #9fb4d0; --subtle: #8294b0;
  /* raio / sombra / motion */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --sh-md: 0 1px 2px rgba(0,0,0,.28), 0 4px 12px -6px rgba(0,0,0,.32);
  --sh-lg: 0 10px 30px -12px rgba(0,0,0,.5), 0 2px 6px -4px rgba(0,0,0,.34);
  --ease: cubic-bezier(.16,1,.3,1); --dur: 180ms;
  --glow: inset 0 1px 0 rgba(255,255,255,.03);
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--fg);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11' 1; font-variant-numeric: tabular-nums;
  background: radial-gradient(1200px 720px at 50% -20%, #101a2e, var(--s0)) fixed;
}
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .82rem; }
.err { color: var(--danger); margin-top: .5rem; min-height: 1rem; font-size: .88rem; }
.num { font-variant-numeric: tabular-nums; }

/* tipografia explícita */
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: .2rem 0; }
h2 { font-size: 1.2rem; font-weight: 600; margin: .2rem 0; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .2rem; }

/* topbar */
.topbar { display: flex; align-items: center; gap: 1.2rem; padding: .8rem 1.4rem; border-bottom: 1px solid var(--border); background: #0c1322; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.12rem; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--brand-3)); box-shadow: 0 2px 6px -2px rgba(79,70,229,.32); }
.brand b { color: var(--brand-2); font-weight: 600; }
.tabs { display: flex; gap: .3rem; margin-left: auto; }
.tabs button { background: transparent; border: 0; color: var(--muted); padding: .5rem .9rem; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-size: .92rem; transition: background var(--dur), color var(--dur); }
.tabs button:hover { color: var(--fg); }
.tabs button.active { background: var(--brand-soft); color: var(--brand-2); }

/* botões */
button { font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; border: 0; border-radius: var(--r-sm); padding: .55rem 1rem; background: var(--brand); color: var(--brand-fg); transition: filter var(--dur), background var(--dur), transform var(--dur); }
button:hover { filter: brightness(1.08); }
button:active { transform: scale(.98); }
button.success { background: var(--success); color: #062b16; }
button.ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); }
button.ghost:hover { background: var(--s2); color: var(--fg); filter: none; }
button.danger { background: var(--danger); color: #fff; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: var(--r-sm); }

/* inputs */
input, select, textarea { width: 100%; background: var(--s0); border: 1px solid var(--border); color: var(--fg); border-radius: var(--r-sm); padding: .6rem .7rem; font: inherit; margin: .35rem 0; transition: border-color var(--dur), box-shadow var(--dur); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--subtle); }
textarea { resize: vertical; }

/* layout */
main { max-width: 860px; margin: 1.6rem auto; padding: 0 1.2rem; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }

/* cartões / itens */
.card { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.6rem; max-width: 420px; margin: 3rem auto; box-shadow: var(--sh-md), var(--glow); }
.list { display: flex; flex-direction: column; gap: .6rem; margin-top: .8rem; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--s1); border: 1px solid var(--border); border-radius: var(--r-md); padding: .85rem 1rem; box-shadow: var(--glow); transition: border-color var(--dur), transform var(--dur); }
.item:hover { border-color: var(--border-strong); }
.row-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.row-actions button { padding: .42rem .8rem; font-size: .85rem; }
.inline { display: flex; gap: .5rem; align-items: center; } .inline input { margin: 0; } .inline button { white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.chk { display: flex; gap: .5rem; align-items: center; color: var(--muted); font-size: .9rem; margin: .5rem 0; }
.chk input { width: auto; margin: 0; }

/* estados: vazio / erro */
.empty, .error-state { color: var(--muted); padding: 2rem 1.5rem; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--r-md); }
.error-state p { margin: .2rem 0 1rem; }
.empty b { color: var(--fg); }

/* skeleton */
.skel-item { pointer-events: none; }
.skel { background: linear-gradient(100deg, var(--s2) 30%, var(--s3) 50%, var(--s2) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 6px; }
.skel-line { height: 13px; } .skel-sub { height: 10px; margin-top: 8px; } .skel-pill { height: 22px; width: 88px; border-radius: 999px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* badges de status */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .16rem .6rem; border-radius: 999px; background: var(--s2); border: 1px solid var(--border); color: var(--muted); font-size: .76rem; font-weight: 500; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.s-open { color: var(--success); border-color: #1f7a47; background: var(--success-soft); }
.badge.s-open::before { animation: pulse 2s ease-in-out infinite; }
.badge.s-qr, .badge.s-connecting { color: var(--warn); border-color: #6b551a; background: var(--warn-soft); }
.badge.s-unstable { color: var(--orange); border-color: #7a4a1a; background: #2a1c10; }
.badge.s-banned, .badge.s-logged_out { color: var(--danger); border-color: #7a2230; background: var(--danger-soft); }
.badge.s-disconnected { color: var(--muted); border-color: var(--border-strong); }
/* status de campanha */
.badge.c-running { color: var(--success); border-color: #1f7a47; background: var(--success-soft); }
.badge.c-running::before { animation: pulse 2s ease-in-out infinite; }
.badge.c-done { color: var(--brand-2); border-color: #3a3f9e; background: var(--brand-soft); }
.badge.c-scheduled { color: var(--brand-2); border-color: #3a3f9e; background: var(--brand-soft); }
.badge.c-canceled { color: var(--danger); border-color: #7a2230; background: var(--danger-soft); }
.badge.c-paused_quota, .badge.c-paused_session, .badge.c-paused_window, .badge.c-paused_health { color: var(--warn); border-color: #6b551a; background: var(--warn-soft); }
.badge.c-draft { color: var(--muted); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(37,211,102,.5); } 50% { box-shadow: 0 0 0 4px rgba(37,211,102,0); } }

/* modal / dialog */
.modal { position: fixed; inset: 0; background: rgba(3,8,18,.72); display: grid; place-items: center; padding: 1rem; z-index: 50; animation: fade var(--dur) var(--ease); }
.modal-box, .dialog-box { background: var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 1.6rem; width: 100%; position: relative; box-shadow: var(--sh-lg), var(--glow); animation: pop var(--dur) var(--ease); }
.modal-box { max-width: 440px; } .dialog-box { max-width: 380px; }
.x { position: absolute; top: .6rem; right: .8rem; background: transparent; color: var(--muted); font-size: 1.4rem; padding: 0; line-height: 1; }
.x:hover { color: var(--fg); filter: none; }
.dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.4rem; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* QR */
#qr-box { text-align: center; min-height: 240px; display: grid; place-items: center; color: var(--muted); }
.qr { width: 240px; height: 240px; background: #fff; border-radius: 10px; padding: 8px; }
.ok-big { color: var(--success); font-size: 1.3rem; font-weight: 700; }

/* toasts */
#toasts { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .55rem; max-width: 92vw; }
.toast { display: flex; align-items: flex-start; gap: .6rem; background: var(--s3); border: 1px solid var(--border-strong); border-left-width: 3px; border-radius: var(--r-md); padding: .7rem .9rem; min-width: 260px; max-width: 360px; box-shadow: var(--sh-lg); font-size: .9rem; animation: toastin var(--dur) var(--ease); }
.toast.out { animation: toastout var(--dur) var(--ease) forwards; }
.toast .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .35rem; flex-shrink: 0; }
.toast.ok { border-left-color: var(--success); } .toast.ok .dot { background: var(--success); }
.toast.warn { border-left-color: var(--warn); } .toast.warn .dot { background: var(--warn); }
.toast.err { border-left-color: var(--danger); } .toast.err .dot { background: var(--danger); }
.toast.info { border-left-color: var(--brand); } .toast.info .dot { background: var(--brand-2); }
@keyframes toastin { from { opacity: 0; transform: translateX(16px); } }
@keyframes toastout { to { opacity: 0; transform: translateX(16px); } }

/* ---------- home / dashboard ---------- */
.live-pill { display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; color: var(--success); background: var(--success-soft); border: 1px solid #1f7a47; padding: .2rem .6rem; border-radius: 999px; font-weight: 500; }
.live-pill .pt { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin: 1rem 0 1.3rem; }
.kpi { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r-md); padding: .9rem 1rem; box-shadow: var(--glow); }
.kpi-label { font-size: .78rem; color: var(--muted); margin-bottom: .4rem; }
.kpi-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.kpi-value small { font-size: .9rem; color: var(--subtle); font-weight: 500; }
.kpi-sub { font-size: .76rem; margin-top: .4rem; color: var(--muted); }
.kpi-sub.up { color: var(--success); } .kpi-sub.warn { color: var(--warn); }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card-block { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.1rem 1.2rem; box-shadow: var(--glow); }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.block-head h3 { margin: 0; }
.link-btn { background: transparent; border: 0; color: var(--brand-2); font-size: .82rem; font-weight: 500; padding: .2rem .3rem; }
.link-btn:hover { filter: none; text-decoration: underline; }

.chip-card { display: flex; align-items: center; gap: .9rem; padding: .7rem 0; border-top: 1px solid var(--border); }
.chip-card:first-child { border-top: 0; }
.gauge-wrap { position: relative; width: 66px; height: 66px; flex-shrink: 0; }
.gauge-wrap .gauge-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.gauge-wrap .gauge-num b { font-size: 1rem; font-weight: 700; }
.gauge-wrap .gauge-num s { font-size: .62rem; color: var(--muted); text-decoration: none; }
.chip-meta { min-width: 0; flex: 1; }
.chip-name { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.warmup-steps { display: flex; align-items: center; gap: 0; margin-top: .5rem; }
.warmup-steps .d { width: 9px; height: 9px; border-radius: 50%; background: var(--s3); border: 1px solid var(--border-strong); flex-shrink: 0; }
.warmup-steps .d.done { background: var(--brand); border-color: var(--brand); }
.warmup-steps .d.cur { background: var(--success); border-color: var(--success); width: 12px; height: 12px; box-shadow: 0 0 0 3px rgba(37,211,102,.18); }
.warmup-steps .ln { width: 12px; height: 2px; background: var(--border-strong); flex-shrink: 0; }
.warmup-steps .ln.done { background: var(--brand); }

.camp-row { padding: .75rem 0; border-top: 1px solid var(--border); }
.camp-row:first-child { border-top: 0; }
.camp-top { display: flex; align-items: center; gap: .5rem; justify-content: space-between; margin-bottom: .5rem; }
.camp-top b { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: flex; height: 8px; border-radius: 5px; overflow: hidden; background: var(--s2); margin-bottom: .4rem; }
.seg i { height: 100%; }
.seg .g { background: var(--success); } .seg .r { background: var(--danger); } .seg .o { background: var(--orange); } .seg .k { background: var(--subtle); }

/* ---------- seletor de chip ---------- */
.chip-picker { display: flex; gap: .4rem; overflow-x: auto; margin: .1rem 0 1.1rem; padding-bottom: .2rem; scrollbar-width: thin; }
.chip-picker:empty { display: none; }
.cp { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; background: var(--s1); border: 1px solid var(--border); color: var(--muted); font-weight: 500; font-size: .84rem; padding: .4rem .8rem; border-radius: 999px; flex-shrink: 0; }
.cp:hover { filter: none; border-color: var(--border-strong); color: var(--fg); }
.cp.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-2); }
.cp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ---------- gráficos ---------- */
.charts-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 1rem; margin-top: 1rem; }
.chart-legend { font-size: .72rem; color: var(--muted); display: inline-flex; align-items: center; gap: .5rem; }
.lg { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: -1px; margin-right: 2px; }
.lg.g { background: var(--success); } .lg.r { background: var(--danger); } .lg.o { background: var(--orange); } .lg.k { background: var(--subtle); }
.donut-wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: .35rem; font-size: .82rem; color: var(--muted); }
.donut-legend b { color: var(--fg); }
.ax { fill: var(--subtle); font-size: 9px; }
.donut-c { fill: var(--fg); font-size: 21px; font-weight: 700; }
.donut-s { fill: var(--muted); font-size: 9px; }

/* ---------- wizard ---------- */
.wiz-bar { display: flex; gap: .45rem; align-items: center; margin: .5rem 0 .2rem; }
.wiz-step { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 600; background: var(--s2); color: var(--muted); border: 1px solid var(--border); }
.wiz-step.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.wiz-step.done { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand); }
.wiz-title { margin-bottom: .7rem; }
.wz-body { min-height: 130px; }
.wz-foot { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1.1rem; }
.wz-foot button { min-width: 92px; }
.wz-tools { display: flex; gap: .4rem; margin: .35rem 0; flex-wrap: wrap; }
.chip-btn { background: var(--s2); border: 1px solid var(--border-strong); color: var(--brand-2); font-size: .78rem; padding: .3rem .65rem; border-radius: 999px; }
.chip-btn:hover { filter: none; background: var(--s3); }
.wz-emojis { display: inline-flex; gap: .1rem; flex-wrap: wrap; margin-left: .2rem; }
.emoji-btn { background: transparent; border: 0; font-size: 1.15rem; padding: .12rem .22rem; line-height: 1; border-radius: 6px; }
.emoji-btn:hover { background: var(--s2); filter: none; }
.wz-attach { display: flex; align-items: center; gap: .6rem; margin: .5rem 0 .2rem; flex-wrap: wrap; }
.attach-btn { display: inline-flex; align-items: center; gap: .4rem; background: var(--s2); border: 1px solid var(--border-strong); color: var(--fg); font-size: .84rem; font-weight: 500; padding: .4rem .8rem; border-radius: var(--r-sm); cursor: pointer; }
.attach-btn:hover { background: var(--s3); }
.media-chip { display: inline-flex; align-items: center; gap: .5rem; background: var(--s2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .35rem .5rem; margin: .4rem 0 .2rem; max-width: 100%; }
.media-chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: #fff; }
.media-ic { font-size: 1.3rem; } .media-nm { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.media-x { background: transparent; border: 0; color: var(--muted); font-size: 1.15rem; padding: 0 .2rem; line-height: 1; }
.media-x:hover { color: var(--danger); filter: none; }
.wz-count { font-size: .74rem; color: var(--subtle); text-align: right; }
.rec-panel { display: flex; align-items: center; gap: .6rem; background: var(--s2); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: .5rem .7rem; margin: .4rem 0 .2rem; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex-shrink: 0; animation: recblink 1s ease-in-out infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-panel .chip-btn { margin-left: auto; }
@keyframes recblink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.wa-preview { background: #0b141a; border-radius: 10px; padding: .9rem; display: flex; }
.wa-bubble { background: #005c4b; color: #e9ffe9; padding: .5rem .7rem; border-radius: 9px 9px 9px 2px; max-width: 88%; font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(0,0,0,.22); }
.wz-valid { margin-top: .6rem; } .ok-txt { color: var(--success); }
.wz-chips { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.wz-chip { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; }
.wz-chip.sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.wz-chip.off { opacity: .5; cursor: not-allowed; }
.wz-chip input { width: auto; margin: 0; }
.wz-warn { color: var(--warn); font-size: .8rem; margin-top: .6rem; }
.wz-warn:empty { display: none; }
.wz-review { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .6rem; }
.wz-rev { display: flex; justify-content: space-between; padding: .5rem .75rem; background: var(--s2); border-radius: var(--r-sm); font-size: .9rem; }
.wz-sched { margin: .1rem 0 .4rem; }
.wz-test { display: flex; gap: .5rem; align-items: center; margin: .2rem 0 .6rem; }
.wz-test input { margin: 0; }
.wz-test button { white-space: nowrap; flex-shrink: 0; }
.wz-existing { background: var(--s2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .6rem .8rem; margin-bottom: .7rem; font-size: .88rem; }

/* ---------- listas de contatos ---------- */
.li-file { margin: .5rem 0; }
.li-preview { margin: .4rem 0; } .li-preview:empty { display: none; }
.li-stats { font-size: .92rem; margin-bottom: .2rem; }
.wz-lists { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .8rem; max-height: 190px; overflow-y: auto; }
.wz-listopt { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; background: var(--s2); border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; }
.wz-listopt:hover { border-color: var(--border-strong); }
.wz-listopt input { width: auto; margin: 0; flex-shrink: 0; }
.wz-listnm { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- detalhe da campanha ---------- */
.camp-row.clickable { cursor: pointer; border-radius: var(--r-sm); transition: background var(--dur); }
.camp-row.clickable:hover { background: var(--s2); }
.cd-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .3rem 0 .9rem; }
.cd-pause { color: var(--warn); font-size: .82rem; }
.cd-main { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.cd-stats { flex: 1; min-width: 180px; }
.cnt { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin-top: .7rem; font-size: .84rem; color: var(--muted); }
.cnt b { color: var(--fg); }
.cdot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.cdot.g { background: var(--success); } .cdot.r { background: var(--danger); } .cdot.o { background: var(--orange); } .cdot.k { background: var(--subtle); }
.cd-content { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .7rem; }
.cd-media { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cd-media-img { max-width: 180px; max-height: 180px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover; }
.cd-audio { height: 38px; max-width: 260px; flex: 1; min-width: 180px; }
.cd-log { max-height: 210px; overflow-y: auto; margin-top: .2rem; }
.cd-line { display: flex; align-items: center; gap: .5rem; font-size: .82rem; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.cd-ph { font-variant-numeric: tabular-nums; } .cd-ev { color: var(--muted); } .cd-ts { margin-left: auto; font-size: .76rem; }

/* ---------- responsivo: bottom-nav no mobile ---------- */
@media (max-width: 720px) {
  .home-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { gap: .6rem; padding: .7rem 1rem; }
  main { margin: 1rem auto 4.5rem; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; gap: 0; justify-content: space-around; background: #0c1322; border-top: 1px solid var(--border); padding: .4rem .2rem calc(.4rem + env(safe-area-inset-bottom)); z-index: 30; }
  .tabs button { flex: 1; padding: .55rem .3rem; font-size: .8rem; border-radius: var(--r-sm); }
  .item { flex-direction: column; align-items: stretch; }
  .row-actions { justify-content: flex-end; }
  .row-actions button { flex: 1; }
  .kpis { grid-template-columns: 1fr 1fr; }
  #toasts { left: 1rem; right: 1rem; top: .6rem; } .toast { max-width: none; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box, .dialog-box { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(1.6rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
