/* ════════════════════════════════════════════════════════════════════════
   site.css — layout do shell e telas-base (auth, página, player).
   ════════════════════════════════════════════════════════════════════════ */

/* ════════ APP SHELL (sidebar + main) ════════ */
.app-shell { display: flex; min-height: 100dvh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: 252px; height: 100dvh; flex: none;
  display: flex; flex-direction: column;
  padding: var(--space-4);
  background: var(--bg); border-right: 1px solid var(--border-subtle);
}
.sidebar__brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-5); color: var(--text); }
.sidebar__logo { width: 32px; height: 32px; }
.sidebar__name { font-size: var(--text-lg); font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.sidebar__footer { flex: none; }
.sidebar__sec { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-subtle); padding: var(--space-3) var(--space-3) var(--space-1); }
.sidebar__nav .sidebar__sec:first-child { padding-top: 0; }
.sidebar__footer { border-top: 1px solid var(--border-subtle); padding-top: var(--space-2); margin-top: var(--space-2); }
.sidebar__item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--fw-medium);
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}
.sidebar__item .icon { width: 20px; height: 20px; flex: none; }
.sidebar__item:hover { background: var(--bg-muted); color: var(--text); }
.sidebar__item.is-active { background: var(--primary); color: var(--primary-text); }

/* ---- tabela de notificações ---- */
.nt-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.nt-table th { text-align: center; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-muted); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.nt-table th:first-child { text-align: left; }
.nt-table td { padding: var(--space-3); border-bottom: 1px solid var(--border-subtle); text-align: center; }
.nt-table td:first-child { text-align: left; }
.nt-table tr:last-child td { border-bottom: 0; }
.nt-chk { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* ---- gateway: toggle ---- */
.gw-toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle); cursor: pointer; font-weight: var(--fw-medium); }
.gw-toggle input { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }

/* ---- integrações (cards pixel/tag) ---- */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.int-card { display: flex; flex-direction: column; }
.int-card__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-3); }
.int-badge { align-self: flex-start; }

/* ---- tooltip de ajuda (i) ---- */
.hint { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: var(--bg-muted); color: var(--text-muted); font-size: 10px; font-weight: 700; font-style: normal; cursor: help; margin-left: 5px; vertical-align: middle; text-transform: none; letter-spacing: 0; }
.hint::after { content: attr(data-tip); position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 240px; background: var(--bg-inverted); color: var(--text-inverted); font-size: 11.5px; font-weight: 400; line-height: 1.4; padding: 8px 11px; border-radius: 8px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 50; white-space: normal; text-align: left; text-transform: none; letter-spacing: 0; }
.hint:hover::after { opacity: 1; }

/* grade de permissões (página de usuários) */
.perm-box { margin-top: var(--space-4); border-top: 1px solid var(--border-subtle); padding-top: var(--space-4); }
.perm-box__head { font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--space-3); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-4); }
.perm-grp__t { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: var(--space-2); }
.perm-item { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: var(--text-sm); cursor: pointer; }
.perm-item input { margin-top: 2px; flex: none; }
.perm-item input:disabled + span { opacity: .6; }
.pf-block { margin-top: var(--space-3); }
.pf-label { display: block; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 2px; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* carregamento (spinner) */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: var(--space-8); color: var(--text-secondary); font-size: var(--text-sm); }
.loading::before { content: ""; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* skeleton (placeholder pulsante) */
.skeleton { position: relative; overflow: hidden; background: var(--bg-muted); border-radius: var(--radius-md); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.sk-card { height: 112px; }

/* editor de preços (canvas) */
.pr-grid { display: grid; grid-template-columns: 320px 1fr; gap: var(--space-5); align-items: start; }
.pr-itemrow { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; margin-bottom: 8px; }
.pr-val { text-align: right; }
.pr-preview canvas { width: 100%; height: auto; border-radius: var(--radius-md); box-shadow: var(--shadow-md); display: block; }
@media (max-width: 760px) { .pr-grid { grid-template-columns: 1fr; } }

/* ---- KPIs clicáveis (drill-down) ---- */
.kpi-hero--click { cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease); }
.kpi-hero--click:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-hero--click.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }
.fin-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--text-sm); }
.fin-row:last-of-type { border-bottom: 0; }
.fin-neg { color: var(--danger); }

/* ---- shell Master (ADG) ---- */
.sidebar__badge { align-self: flex-start; margin: -8px 0 var(--space-4) var(--space-3); padding: 2px 10px; border-radius: var(--radius-full); background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.appbar__opind { display: inline-flex; align-items: center; gap: 8px; margin-left: var(--space-3); padding: 5px 12px; border-radius: var(--radius-full); background: var(--warning-bg); color: var(--warning); font-size: 12.5px; font-weight: 600; }
.opind__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.opind__exit { margin-left: 4px; font-size: 12px; font-weight: 700; color: var(--primary); text-decoration: underline; }
@media (max-width: 639px) { .appbar__opind { display: none; } }

/* ---------- appbar (header) ---------- */
.appbar {
  position: sticky; top: 0; z-index: var(--z-dropdown);
  display: flex; align-items: center; gap: var(--space-2);
  height: 60px; padding: 0 var(--space-5);
  background: var(--bg); border-bottom: 1px solid var(--border-subtle);
}
.appbar__icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-full); color: var(--text); cursor: pointer; transition: color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease); }
.appbar__icon:hover { background: var(--bg-muted); color: var(--primary); }
.appbar__icon:active { transform: scale(0.94); }
.appbar__icon .icon { width: 20px; height: 20px; }
.appbar__spacer { flex: 1; }
.appbar__brand-mobile { display: none; align-items: center; gap: var(--space-2); color: var(--text); font-weight: var(--fw-bold); }
.appbar__logo { width: 24px; height: 24px; }
.appbar [data-action="sidebar"] { display: none; }
.app-backdrop { display: none; }

/* ---------- mobile: sidebar vira drawer ---------- */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: var(--z-modal);
    transform: translateX(-100%); transition: transform var(--duration) var(--ease-out);
    box-shadow: var(--shadow-2xl);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .app-backdrop { position: fixed; inset: 0; z-index: calc(var(--z-modal) - 1); background: rgba(0,0,0,.5); }
  body.sidebar-open .app-backdrop { display: block; }
  .appbar [data-action="sidebar"] { display: inline-flex; }
  .appbar__brand-mobile { display: flex; }
}

/* ---------- container de página ---------- */
.page {
  width: 100%; max-width: 1200px; margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}

/* ════════ DASHBOARD ════════ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-8); }
.kpi { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5); }
.kpi__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius-lg); background: var(--bg-muted); color: var(--text-secondary); flex: none; }
.kpi__icon .icon { width: 24px; height: 24px; }
.kpi__icon--ok { background: var(--success-bg); color: var(--success); }
.kpi__icon--off { background: var(--danger-bg); color: var(--danger); }
.kpi__num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-3xl); font-weight: var(--fw-semibold); line-height: 1; letter-spacing: var(--tracking-tight); }
.kpi__label { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }

.dash-section-title { display: flex; align-items: center; justify-content: space-between; margin: var(--space-8) 0 var(--space-4); }
.dash-section-title h2 { font-size: var(--text-xl); }

.tv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-4); }
.tv-tile { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.tv-tile__top { display: flex; align-items: center; justify-content: space-between; }
.tv-tile__name { font-weight: var(--fw-semibold); display: flex; align-items: center; gap: var(--space-2); }
.tv-tile__meta { font-size: var(--text-xs); color: var(--text-muted); }

/* ---------- grid de cards (dashboard) ---------- */
.grid-cards {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.painel__hint {
  margin-top: var(--space-8); padding: var(--space-4);
  font-size: var(--text-sm); color: var(--text-secondary);
  background: var(--bg-subtle); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

/* ---------- auth (login) ---------- */
.auth {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: var(--space-4);
  background: var(--bg-subtle);
}
.auth__card { width: min(420px, 100%); padding: var(--space-8); }
.auth__brand { text-align: center; margin-bottom: var(--space-6); }
.auth__logo { width: 48px; height: 48px; margin: 0 auto var(--space-4); }
.auth__title { font-size: var(--text-2xl); }
.auth__subtitle { margin-top: var(--space-1); color: var(--text-secondary); font-size: var(--text-sm); }
.auth__form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth__submit { margin-top: var(--space-2); }
.auth__forgot { align-self: center; }

/* ---------- player (kiosk TV) ---------- */
.player {
  display: flex; align-items: center; justify-content: center;
  width: 100vw; height: 100dvh; background: #000; color: #fff;
}
.player__pairing { text-align: center; }
.player__hint { font-size: var(--text-2xl); font-weight: var(--fw-semibold); }
.player__hint--muted { margin-top: var(--space-2); font-size: var(--text-base); font-weight: var(--fw-regular); color: var(--neutral-400); }

/* ---------- listas ---------- */
.list { display: flex; flex-direction: column; gap: var(--space-3); }
.list__row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); }
.list__main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list__main strong { display: flex; align-items: center; gap: var(--space-2); }
.list__sub { font-size: var(--text-xs); color: var(--text-muted); }
.list__actions { display: flex; gap: var(--space-2); flex: none; }
.empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }

/* ---------- formulários em linha / grid ---------- */
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4); margin-bottom: var(--space-6); }
.form-row .field { flex: 1; min-width: 160px; }
.form-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; margin-bottom: var(--space-6); }
.field--full { grid-column: 1 / -1; }
.dias { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.dia { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); }
.pl-order { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-full); background: var(--bg-muted); font-size: var(--text-xs); font-weight: var(--fw-semibold); flex: none; }

/* ---------- upload ---------- */
.upload { display: flex; flex-direction: column; gap: var(--space-4); margin-bottom: var(--space-6); align-items: flex-start; }
.upload__progress { width: 100%; display: flex; flex-direction: column; gap: var(--space-2); }
.upload__item { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.upload__item > span { flex: none; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload__bar { flex: 1; height: 8px; background: var(--bg-muted); border-radius: var(--radius-full); overflow: hidden; }
.upload__fill { height: 100%; width: 0; background: var(--primary); transition: width .2s var(--ease); }

/* ---------- grid de mídia ---------- */
.media-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.media-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); }
.media-card__thumb { position: relative; aspect-ratio: 16/9; border-radius: var(--radius-md); overflow: hidden; background: var(--bg-muted); }
.media-card__thumb img, .media-card__thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-card__badge { position: absolute; top: var(--space-2); right: var(--space-2); padding: 2px var(--space-2); font-size: var(--text-xs); color: #fff; background: rgba(0,0,0,.6); border-radius: var(--radius-full); }
.media-card__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.media-card__info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }

/* ---------- monitor (dashboard) ---------- */
.monitor { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-8); }
.stat { padding: var(--space-5); text-align: center; }
.stat__num { font-size: var(--text-4xl); font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); }
.stat__num--ok { color: var(--success); }
.stat__num--off { color: var(--danger); }
.stat__label { font-size: var(--text-sm); color: var(--text-secondary); }

/* ---------- player ---------- */
.player__media { width: 100vw; height: 100dvh; object-fit: contain; background: #000; }
.player__code { font-family: var(--font-mono); font-size: clamp(48px, 12vw, 120px); font-weight: var(--fw-bold); letter-spacing: var(--tracking-widest); color: #fff; margin: var(--space-6) 0; }

/* ---------- master: banner de operação + seções ---------- */
.op-banner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-6); font-size: var(--text-sm); }
.op-banner--warn { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.op-banner a { text-decoration: underline; }
.ad-h { margin: var(--space-8) 0 var(--space-3); font-size: var(--text-lg); }
.is-active-cliente { border-color: var(--primary); box-shadow: 0 0 0 2px var(--info-bg); }

/* ---------- erro de página ---------- */
.page-error { text-align: center; padding: var(--space-16) var(--space-4); color: var(--text-secondary); }

/* ---------- editor de mídia ---------- */
.seg-row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.editor { display: grid; grid-template-columns: 1fr 340px; gap: var(--space-6); align-items: start; }
.editor__stage { background: var(--bg-muted); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-3); position: sticky; top: 76px; }
.editor__stage canvas { width: 100%; height: auto; display: block; border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.editor__panel { display: flex; flex-direction: column; gap: var(--space-4); }
.editor__actions { display: flex; gap: var(--space-3); justify-content: flex-end; margin-top: var(--space-2); }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } .editor__stage { position: static; } }

/* ---------- calendário de programação ---------- */
.ag-toolbar { display: flex; justify-content: flex-end; margin: var(--space-6) 0 var(--space-3); }
.ag-tabs { display: inline-flex; background: var(--bg-muted); border-radius: var(--radius-lg); padding: 3px; gap: 3px; }
.ag-tab { padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary); }
.ag-tab.is-active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }

.cal { display: grid; grid-template-columns: 56px repeat(7, 1fr); padding: 0; overflow: hidden; }
.cal__corner { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border-subtle); }
.cal__dh { text-align: center; padding: var(--space-3) 0; font-size: var(--text-sm); font-weight: var(--fw-semibold); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border-subtle); }
.cal__axis { position: relative; border-right: 1px solid var(--border-subtle); }
.cal__hr { height: 28px; position: relative; }
.cal__hr span { position: absolute; top: -8px; right: 6px; font-size: 10px; font-family: var(--font-mono); color: var(--text-subtle); }
.cal__day { position: relative; border-left: 1px solid var(--border-subtle);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, var(--border-subtle) 27px, var(--border-subtle) 28px); }
.cal__ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; overflow: hidden; color: #fff;
  box-shadow: var(--shadow-sm); cursor: default; }
.cal__ev b { display: block; font-size: 11px; font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__ev span { font-size: 9.5px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal__ev.is-off { opacity: .4; }
.cal__note { margin-top: var(--space-3); font-size: var(--text-xs); color: var(--text-muted); }
.cal__chip { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 2px; }
@media (max-width: 700px) { .cal { font-size: 11px; } .cal__dh { font-size: var(--text-xs); } }

/* ---------- campanhas ---------- */
.camp-medias { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-2); max-height: 240px; overflow: auto; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle); }
.camp-pick { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); }
.camp-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-formactions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: var(--space-3); }

/* ---------- relatórios ---------- */
.rp-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.rp-table th { text-align: left; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-muted); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.rp-table td { padding: var(--space-3); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.rp-table tr:last-child td { border-bottom: 0; }
.rp-bar { display: inline-block; width: 120px; height: 8px; background: var(--bg-muted); border-radius: var(--radius-full); overflow: hidden; vertical-align: middle; margin-right: var(--space-2); }
.rp-bar span { display: block; height: 100%; background: var(--primary); border-radius: var(--radius-full); }

/* ---------- cobranças (admin) ---------- */
.cob-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.cob-row:last-child { border-bottom: 0; }
.cob-row__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cob-row__main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* telas por tipo de conteúdo (dashboard) */
.tipo-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; font-size: var(--text-sm); }
.tipo-row__lab { width: 110px; flex: none; color: var(--text-secondary); }
.tipo-row .rp-bar { flex: 1; width: auto; }
.tipo-row b { width: 42px; text-align: right; }

/* ════════════════════════════════════════════════════════════════════════
   DASHBOARD PULSE — "Centro de Operações"
   ════════════════════════════════════════════════════════════════════════ */
.page--wide { max-width: 1440px; }

.dash { display: grid; gap: var(--space-5); }
.dash__kpis { display: grid; gap: var(--space-4); grid-template-columns: repeat(4, 1fr); }
.dash__row { display: grid; gap: var(--space-4); }
.dash__row--2 { grid-template-columns: 1.7fr 1fr; }
.dash__row--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) {
  .dash__kpis { grid-template-columns: repeat(2, 1fr); }
  .dash__row--2, .dash__row--3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .dash__kpis { grid-template-columns: 1fr; } }

/* ---------- lapidação mobile ---------- */
@media (max-width: 639px) {
  .page { padding: var(--space-5) var(--space-4) var(--space-10); }
  /* linhas de lista empilham: título em cima, selects e ações largura cheia */
  .list__row { flex-wrap: wrap; align-items: stretch; }
  .list__row .field { width: 100% !important; min-width: 0 !important; flex: 1 1 100% !important; }
  .list__row .field__input { width: 100%; }
  .list__actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .list__actions .btn { flex: 1 1 auto; }
  /* tabelas largas rolam na horizontal */
  .card > table { display: block; overflow-x: auto; white-space: nowrap; }
  /* botões de formulário não estouram */
  .cp-formactions { flex-wrap: wrap; }
  .cp-formactions .btn { flex: 1 1 auto; }
}

/* ---- KPI hero ---- */
.kpi-hero { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); }
.kpi-hero__head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-secondary); }
.kpi-hero__num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-5xl); font-weight: var(--fw-semibold); line-height: 1; letter-spacing: var(--tracking-tight); color: var(--text); margin-top: var(--space-1); }
.kpi-hero__foot { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm); color: var(--text-muted); }
.kpi-hero__live { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--text-secondary); }

/* sparkline — placeholder honesto (sem histórico ainda) */
.spark { position: relative; height: 38px; margin-top: var(--space-1); display: grid; place-items: center; border-radius: var(--radius-md); overflow: hidden; }
.spark::before { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; border-top: 2px dashed var(--border-strong); opacity: .55; }
.spark__soon { position: relative; font-size: 10px; text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-subtle); background: var(--bg); padding: 1px var(--space-2); border-radius: var(--radius-full); }
.spark--data::before { display: none; }
.spark--data .sparksvg { width: 100%; height: 38px; }

/* gráfico de atividade (área) */
.chart { width: 100%; height: 200px; display: block; }
.chart__cap { margin-top: var(--space-2); font-size: var(--text-xs); color: var(--text-muted); }

/* ---- painel interno (título + ação) ---- */
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.panel__title { font-size: var(--text-base); font-weight: var(--fw-semibold); }
.panel__link { font-size: var(--text-sm); color: var(--primary); }
.panel__link:hover { text-decoration: underline; }

/* ---- donut (status real das telas) ---- */
.donut-wrap { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; }
.donut { position: relative; width: 140px; height: 140px; flex: none; }
.donut__svg { width: 140px; height: 140px; }
.donut__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut__num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-2xl); font-weight: var(--fw-semibold); line-height: 1; }
.donut__cap { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.legend { display: flex; flex-direction: column; gap: var(--space-3); flex: 1; min-width: 140px; }
.legend__item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.legend__item .status-dot { width: 10px; height: 10px; }
.legend__val { margin-left: auto; font-family: var(--font-mono); color: var(--text-secondary); }
.legend__item--soon { color: var(--text-subtle); }

/* ---- alertas ---- */
.alerts { display: flex; flex-direction: column; }
.alert { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.alert:last-child { border-bottom: 0; }
.alert__icon { width: 38px; height: 38px; border-radius: var(--radius-md); display: grid; place-items: center; flex: none; }
.alert__icon .icon { width: 18px; height: 18px; }
.alert__icon--danger { background: var(--danger-bg); color: var(--danger); }
.alert__icon--warning { background: var(--warning-bg); color: var(--warning); }
.alert__icon--info { background: var(--info-bg); color: var(--info); }
.alert__icon--success { background: var(--success-bg); color: var(--success); }
.alert__body { flex: 1; min-width: 0; }
.alert__title { font-size: var(--text-sm); font-weight: var(--fw-medium); }
.alert__sub { font-size: var(--text-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert__time { font-size: var(--text-xs); color: var(--text-subtle); flex: none; }

/* ---- placeholder "em breve" (widgets sem dado ainda) ---- */
.soon { display: grid; place-items: center; align-content: center; gap: var(--space-2); min-height: 220px; padding: var(--space-6); text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--bg-subtle) 50%, transparent); }
.soon .icon { width: 30px; height: 30px; color: var(--text-subtle); }
.soon__t { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-secondary); }
.soon__d { font-size: var(--text-xs); color: var(--text-muted); max-width: 300px; }
.soon__tag { font-size: 10px; text-transform: uppercase; letter-spacing: var(--tracking-wide); padding: 2px var(--space-2); border-radius: var(--radius-full); background: var(--bg-muted); color: var(--text-muted); }

/* ════════ sidebar: status "Central de Operações" ════════ */
.sidebar__status { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--bg-muted); }
.sidebar__status .icon { width: 20px; height: 20px; color: var(--accent); flex: none; }
.sidebar__status b { display: block; font-size: var(--text-sm); font-weight: var(--fw-semibold); }
.sidebar__status small { font-size: var(--text-xs); color: var(--success); display: inline-flex; align-items: center; gap: 4px; }

/* ════════ appbar: busca + sino + avatar ════════ */
.appbar__search { display: inline-flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-3); min-width: 240px; color: var(--text-muted); background: var(--bg-muted); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); font-size: var(--text-sm); }
.appbar__search .icon { width: 16px; height: 16px; }
.appbar__bell { position: relative; overflow: visible; }
.appbar__bell .icon { position: relative; z-index: 1; }
.appbar__bell::after {
  content: attr(data-count); display: none; position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
  font-size: 10px; font-weight: 700; line-height: 14px; text-align: center;
  color: #fff; border-radius: 999px; background: var(--danger);
  border: 2px solid var(--bg); transform: translate(50%, -50%);
  pointer-events: none; z-index: 2;
}
.appbar__bell.has-unread::after { display: block; }

/* painel de notificações */
.notif-panel { position: fixed; top: 64px; right: var(--space-4); z-index: var(--z-dropdown); width: min(380px, calc(100vw - 24px)); max-height: 70vh; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); overflow: hidden; }
.notif-panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.notif-panel__list { overflow-y: auto; }
.notif-item { display: flex; gap: var(--space-3); width: 100%; text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); background: none; }
.notif-item:hover { background: var(--bg-muted); }
.notif-item__dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 6px; flex: none; }
.notif-item.is-unread .notif-item__dot { background: var(--primary); }
.notif-item.is-unread { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.notif-item__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-item__body b { font-size: var(--text-sm); }
.notif-item__body span { font-size: var(--text-xs); color: var(--text-secondary); }
.notif-item__body small { font-size: 10px; color: var(--text-subtle); margin-top: 2px; }
.user-chip { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); border-radius: var(--radius-lg); color: var(--text); }
.user-chip:hover { background: var(--bg-muted); }
.user-chip__avatar { width: 38px; height: 38px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--primary); color: #fff; font-size: var(--text-sm); font-weight: var(--fw-semibold); flex: none; font-family: var(--font-sans); }
.user-chip__info { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.user-chip__name { font-size: var(--text-sm); font-weight: var(--fw-medium); }
.user-chip__role { font-size: var(--text-xs); color: var(--text-muted); }
@media (max-width: 760px) { .appbar__search, .user-chip__info { display: none; } }
