/* =====================================================================
 *  Space TV — Painel (admin e revenda)
 *  CSS próprio, sem CDN. Tema escuro por padrão, claro opcional
 *  (botão no topo; a escolha fica no localStorage).
 *  Mesmo ritmo do painel do hotel: cartões arejados, campos de 44 px,
 *  grade com espaço de 20 px e conteúdo ocupando a largura toda.
 * ===================================================================== */

:root {
  /* Tema escuro = mesmas cores dos apps Space TV (fundo quase preto, cartões azul-noite, destaque dourado) */
  --bg: #0a0a0f;
  --bg-elev: #141420;
  --surface: #161622;
  --surface-2: #1e1e2e;
  --campo: #10101a;
  --border: #2e3148;
  --border-soft: #23263a;
  --text: #f0f0f0;
  --text-2: #c4c4d2;
  --muted: #8b8ca3;
  --accent: #ffb347;
  --accent-2: #f59e2b;
  --accent-soft: rgba(255, 179, 71, .14);
  --grad: linear-gradient(135deg, #ffd34d 0%, #ffb347 55%, #ff9f2e 100%);
  --grad-forte: linear-gradient(135deg, #ffc93a 0%, #ffa531 55%, #f58f1f 100%);
  --sombra-cor: 0 12px 24px -14px rgba(255, 170, 60, .75);
  --on-accent: #1b1305;
  --ok: #4cd38b;
  --ok-soft: rgba(76, 211, 139, .13);
  --warn: #ff8a3d;
  --warn-soft: rgba(255, 138, 61, .13);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .13);
  --info: #00d4d4;
  --info-soft: rgba(0, 212, 212, .12);
  --sombra-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px -6px rgba(0, 0, 0, .5);
  --shadow: 0 18px 40px rgba(0, 0, 0, .55);
  --radius: 18px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --sidebar-w: 260px;
  --sb-bg: #141420;
  --sb-borda: var(--border-soft);
  --pad: 32px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f8f7f4;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8f6f1;
  --campo: #ffffff;
  --border: #dcd5c9;
  --border-soft: #ece6dc;
  --sb-bg: #fbf4e8;
  --sb-borda: #f0e2c9;
  --text: #16203a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #b86e00;
  --accent-2: #9a5b00;
  --accent-soft: rgba(255, 170, 50, .17);
  --grad: linear-gradient(135deg, #ffd34d 0%, #ffb347 55%, #ff9f2e 100%);
  --grad-forte: linear-gradient(135deg, #ffc93a 0%, #ffa531 55%, #f58f1f 100%);
  --sombra-cor: 0 12px 24px -14px rgba(230, 145, 30, .7);
  --on-accent: #1b1305;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #c2410c;
  --warn-soft: #fff4e0;
  --danger: #c62828;
  --danger-soft: #fdeceb;
  --info: #5b45d6;
  --info-soft: #efeafe;
  --sombra-1: 0 1px 2px rgba(15, 40, 70, .03), 0 4px 14px -6px rgba(15, 40, 70, .08);
  --shadow: 0 18px 40px rgba(15, 23, 42, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.ico { width: 1.1em; height: 1.1em; vertical-align: -.18em; flex: none; }
code, .mono { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); border: 1px solid var(--border-soft); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 23px; font-weight: 750; letter-spacing: -.02em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 22px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Estrutura ─────────────────────────────────────────────────────── */
/* Menu no estilo do SpaceGestor: painel arredondado, grupos que abrem e fecham, recolhível só com ícones. */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  margin: 10px 0 10px 10px; height: calc(100vh - 20px); border-radius: 20px;
  background: var(--sb-bg); border: 1px solid var(--sb-borda); box-shadow: var(--sombra-1);
  display: flex; flex-direction: column; position: sticky; top: 10px; overflow: hidden;
  transition: width .2s ease, flex-basis .2s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 14px 14px 18px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: var(--grad); box-shadow: var(--sombra-cor);
  display: grid; place-items: center; color: var(--on-accent); font-weight: 800; font-size: 16px;
}
.brand-txt { flex: 1; min-width: 0; }
.brand-name { font-weight: 750; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.recolher-btn {
  flex: none; width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.recolher-btn:hover { background: var(--surface-2); color: var(--text); }
.recolher-btn .ico { width: 19px; height: 19px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 42px;
  padding: 9px 12px; border-radius: 11px; cursor: pointer; list-style: none;
  color: var(--text-2); font-weight: 550; font-size: 14.5px; user-select: none;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--text); text-decoration: none; }
.nav-link.ativo { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 650; }
.nav-link.grupo-ativo { color: var(--text); font-weight: 650; }
.nav-link .ico { width: 20px; height: 20px; flex: none; opacity: .9; }
.nav-txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seta { width: 8px; height: 8px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(-45deg); opacity: .55; flex: none; transition: transform .15s; margin-right: 4px; }
.nav-grupo[open] > summary .seta { transform: rotate(45deg); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 8px 32px; }
.nav-sub a { padding: 8px 12px; border-radius: 9px; color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-sub a:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--text); text-decoration: none; }
.nav-sub a.ativo { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 650; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; margin: 0 12px; padding: 14px 4px; border-top: 1px solid var(--border-soft); }
.avatar { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 750; }
.foot-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.foot-txt strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-txt span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-acoes { display: flex; gap: 2px; }
.foot-acoes a { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.foot-acoes a:hover { background: var(--surface-2); color: var(--text); }

/* Menu recolhido: só os ícones (no computador) */
@media (min-width: 1025px) {
  .menu-recolhido .sidebar { width: 76px; flex-basis: 76px; }
  .menu-recolhido .brand { flex-direction: column; padding: 16px 0 10px; gap: 10px; }
  .menu-recolhido .brand-txt, .menu-recolhido .nav-txt, .menu-recolhido .seta,
  .menu-recolhido .nav-sub, .menu-recolhido .foot-txt, .menu-recolhido .foot-acoes a:not(:last-child) { display: none; }
  .menu-recolhido .recolher-btn svg { transform: scaleX(-1); }
  .menu-recolhido .nav { padding: 6px 12px; align-items: center; }
  .menu-recolhido .nav-link { justify-content: center; width: 48px; padding: 9px 0; }
  .menu-recolhido .nav-link.grupo-ativo { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
  .menu-recolhido .sidebar-foot { flex-direction: column; margin: 0 10px; padding: 12px 0; }
  .menu-recolhido .menu-btn { display: inline-flex; }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; min-height: 72px;
  margin: 10px 10px 0 16px; padding: 12px 18px 12px 14px;
  background: color-mix(in srgb, var(--sb-bg) 92%, transparent);
  border: 1px solid var(--sb-borda); border-radius: 20px; box-shadow: var(--sombra-1);
  backdrop-filter: saturate(1.3) blur(10px); -webkit-backdrop-filter: saturate(1.3) blur(10px);
  position: sticky; top: 10px; z-index: 20;
}
.topbar .titulo { flex: 1; min-width: 0; }
.topbar .titulo h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .titulo .muted { margin-top: 3px; }
.topbar .acoes { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; }
.conteudo { padding: 22px 10px 48px 16px; width: 100%; flex: 1; }

/* ── Cartões e grades ──────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 24px 26px; margin-bottom: 22px;
  box-shadow: var(--sombra-1);
}
.card > p, .card > .ajuda { color: var(--text-2); }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.card-head h2 { flex: 1; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 20px 24px 0; margin-bottom: 16px; }
.card.flush > .vazio { padding: 48px 24px; }
.grid { display: grid; gap: 22px; }
.grid > .card, .grid > div > .card:last-child { margin-bottom: 0; }
.grid + .card, .grid + .grid, .card + .grid { margin-top: 0; }
.grid { margin-bottom: 22px; }
form .grid, .card .grid { margin-bottom: 0; gap: 0 24px; }
.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)); }
.conteudo > .grid { align-items: start; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Indicadores (dashboard) */
.stat {
  --tom: var(--muted); --tom-soft: var(--surface-2);
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--sombra-1); position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.stat::before {
  content: ""; position: absolute; right: 18px; top: 18px; width: 36px; height: 36px;
  border-radius: 12px; background: var(--tom-soft);
}
.stat::after {
  content: ""; position: absolute; right: 31px; top: 31px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--tom);
}
a.stat:hover { border-color: color-mix(in srgb, var(--tom) 40%, var(--border-soft)); transform: translateY(-1px); }
.stat.ok { --tom: var(--ok); --tom-soft: var(--ok-soft); }
.stat.warn { --tom: var(--warn); --tom-soft: var(--warn-soft); }
.stat.danger { --tom: var(--danger); --tom-soft: var(--danger-soft); }
.stat.accent { --tom: var(--accent); --tom-soft: var(--accent-soft); }
.stat-label { padding-right: 46px; }
@media (max-width: 600px) {
  .stat { padding: 16px 16px; }
  .stat::before { right: 12px; top: 12px; width: 26px; height: 26px; border-radius: 9px; }
  .stat::after { right: 21px; top: 21px; width: 8px; height: 8px; }
  .stat-label { padding-right: 30px; }
}
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-valor { font-size: 30px; font-weight: 750; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.stat.ok .stat-valor { color: var(--ok); }
.stat.warn .stat-valor { color: var(--warn); }
.stat.danger .stat-valor { color: var(--danger); }
.stat.accent .stat-valor { color: var(--accent); }

/* Barras horizontais simples (dashboard) */
.barras { display: flex; flex-direction: column; gap: 14px; }
.barra-linha { display: grid; grid-template-columns: minmax(100px, 180px) 1fr 52px; gap: 14px; align-items: center; font-size: 14px; }
.barra-trilho { height: 9px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.barra-valor { height: 100%; background: var(--grad); border-radius: 99px; }

/* ── Tabelas ───────────────────────────────────────────────────────── */
.tabela-wrap { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; }
.tabela th, .tabela td { padding: 15px 18px; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tabela th { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); white-space: nowrap; padding-top: 13px; padding-bottom: 13px; }
.tabela td { font-size: 14.5px; }
.tabela tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela td .muted.small, .tabela td > .small { display: block; margin-top: 3px; }
.tabela td .selo + .muted.small { display: inline; margin-left: 6px; }
.tabela .acoes-col, .tabela td[style*="text-align:right"] { text-align: right; white-space: nowrap; }
.tabela td > form, .tabela td > .btn, .tabela td > a.btn { margin-left: 6px; }
.tabela td > form:first-child, .tabela td > .btn:first-child, .tabela td > a.btn:first-child { margin-left: 0; }
.tabela a.linha-link { color: var(--text); font-weight: 650; }
.vazio { padding: 44px 20px; text-align: center; color: var(--muted); }
.vazio .ico { width: 40px; height: 40px; opacity: .45; margin-bottom: 10px; }

/* ── Formulários ───────────────────────────────────────────────────── */
.campo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.campo > label, .rotulo { font-weight: 650; font-size: 13.5px; color: var(--text-2); }
.ajuda { display: block; font-size: 13px; line-height: 1.5; color: var(--muted); margin-top: 2px; }
.card > .ajuda, form > .ajuda { margin: -6px 0 18px; }
.campo .erro-campo { font-size: 13px; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=date], input[type=datetime-local], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 46px; background: var(--campo); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; font: inherit; font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--muted)); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 54px; height: 46px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--campo); cursor: pointer; }
input[type=file] { font: inherit; color: var(--text-2); }
.check {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
  margin-bottom: 14px; padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--border-soft); line-height: 1.45;
}
.check:hover { border-color: var(--border); }
.check input { margin: 2px 0 0; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.check > span { min-width: 0; }
.check .muted.small, .check .small { display: inline-block; margin-top: 3px; }
.campo .check { margin-bottom: 0; }
/* Várias opções marcáveis num mesmo campo: lado a lado, sem ocupar a tela inteira */
.campo:has(> .check) { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.campo:has(> .check) > .rotulo, .campo:has(> .check) > .ajuda, .campo:has(> .check) > label:not(.check) { grid-column: 1 / -1; }
.check + .ajuda { margin: -6px 0 18px; }
.form-acoes { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.card > .form-acoes:last-child, form > .form-acoes:last-child { margin-top: 12px; }
.input-grupo { display: flex; gap: 10px; }
.input-grupo > input { flex: 1; }

/* ── Botões ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 650; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
  transition: background .15s, border-color .15s, box-shadow .15s, filter .15s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primario { background: var(--grad); border-color: transparent; color: var(--on-accent); box-shadow: var(--sombra-cor); }
.btn-primario:hover { background: var(--grad-forte); border-color: transparent; color: var(--on-accent); }
.btn-perigo { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-perigo:hover { border-color: var(--danger); }
.btn-fantasma { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-fantasma:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 13px; }
.btn-icone { min-height: 40px; min-width: 40px; padding: 8px; }
form.inline { display: inline; }

/* ── Selos ─────────────────────────────────────────────────────────── */
.selo {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 650;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; line-height: 1.5;
}
.selo::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.selo + .selo { margin-left: 4px; }
.selo.ok { background: var(--ok-soft); color: var(--ok); }
.selo.warn { background: var(--warn-soft); color: var(--warn); }
.selo.danger { background: var(--danger-soft); color: var(--danger); }
.selo.info { background: var(--info-soft); color: var(--info); }
.selo.accent { background: var(--accent-soft); color: var(--accent); }
.selo.simples::before { display: none; }

/* ── Avisos (flash) ────────────────────────────────────────────────── */
.alerta {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 18px; border-radius: var(--radius-md); margin-bottom: 22px;
  border: 1px solid transparent; background: var(--surface-2); line-height: 1.5;
}
.alerta.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alerta.erro { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alerta.aviso { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alerta.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.alerta ul { margin: 6px 0 0; padding-left: 20px; }

/* ── Filtros e paginação ───────────────────────────────────────────── */
.filtros { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.filtros input[type=search] { flex: 1 1 280px; max-width: 420px; }
.filtros select { width: auto; flex: 0 1 auto; min-width: 170px; }
.paginacao { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 16px 24px; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.paginacao .paginas { display: flex; gap: 6px; flex-wrap: wrap; }
.paginacao a, .paginacao span.atual {
  min-width: 38px; height: 38px; padding: 0 12px; display: inline-grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border-soft); color: var(--text-2); font-weight: 650; font-size: 13.5px;
}
.paginacao a:hover { border-color: var(--accent); text-decoration: none; }
.paginacao span.atual { background: var(--grad); border-color: transparent; color: var(--on-accent); }

/* ── Abas ──────────────────────────────────────────────────────────── */
.abas { display: flex; gap: 6px; border-bottom: 1px solid var(--border-soft); margin-bottom: 24px; overflow-x: auto; scrollbar-width: thin; }
.abas a {
  padding: 12px 16px; color: var(--muted); font-weight: 650; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
}
.abas a:hover { color: var(--text); text-decoration: none; }
.abas a.ativo { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Lista de definições (detalhes) ────────────────────────────────── */
.defs { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 14px 22px; margin: 0; align-items: baseline; }
.defs dt { color: var(--muted); font-size: 13.5px; }
.defs dd { margin: 0; word-break: break-word; }
.defs dd form { margin-top: 10px; }

/* ── Diálogo de confirmação ────────────────────────────────────────── */
dialog.modal {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 26px;
  background: var(--surface); color: var(--text); width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog.modal::backdrop { background: rgba(5, 8, 15, .65); }
dialog.modal h2 { margin-bottom: 10px; }
dialog.modal .form-acoes { justify-content: flex-end; margin-top: 22px; }

/* ── Login ─────────────────────────────────────────────────────────── */
.login-pagina { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.login-caixa { width: min(420px, 100%); }
.login-caixa .card { padding: 34px 32px; }
.login-caixa .brand { justify-content: center; padding: 0 0 20px; }
.login-caixa .brand-logo { width: 52px; height: 52px; border-radius: 15px; font-size: 22px; }
.login-caixa h1 { text-align: center; margin-bottom: 6px; }
.login-caixa .sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.login-caixa .btn { width: 100%; min-height: 48px; }

/* ── Banner superior (plano vencendo etc.) ─────────────────────────── */
.faixa { margin: 10px 10px 0 16px; padding: 11px 18px; border-radius: 14px; font-size: 13.5px; font-weight: 600; background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
@media (max-width: 1024px) { .faixa { margin: 8px 8px 0; } }
.faixa.danger { background: var(--danger-soft); color: var(--danger); }

/* ── Copiar ────────────────────────────────────────────────────────── */
.copiavel { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.copiavel button { min-height: 0; padding: 3px 9px; font-size: 12px; }

/* ── Notificações (sino, lista e aviso flutuante) ──────────────────── */
.sino { position: relative; }
.sino-btn { position: relative; }
.sino-conta {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--bg);
}
.sino-conta[hidden] { display: none; }
.sino-caixa {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(400px, calc(100vw - 24px)); z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.sino-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.sino-topo form { margin: 0; }
.sino-caixa .notif-lista { max-height: 420px; overflow-y: auto; }
.sino-rodape { display: block; text-align: center; padding: 12px; font-weight: 650; font-size: 13.5px; border-top: 1px solid var(--border-soft); }
.notif-lista { display: flex; flex-direction: column; }
.notif-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; color: var(--text);
  border-bottom: 1px solid var(--border-soft); text-decoration: none;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.nova { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.notif-ponto { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--accent); }
.notif-ponto.tipo-vencida, .notif-ponto.tipo-plano { background: var(--danger); }
.notif-ponto.tipo-vence, .notif-ponto.tipo-reauth { background: var(--warn); }
.notif-ponto.tipo-login, .notif-ponto.tipo-aparelho_novo { background: var(--ok); }
.notif-ponto.tipo-revenda_nova { background: var(--info); }
.notif-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-txt strong { font-size: 14px; font-weight: 650; }
.notif-txt span { font-size: 13px; color: var(--muted); }
.notif-quando { font-size: 12px; color: var(--muted); white-space: nowrap; margin-top: 2px; }
.grid-notif { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text);
  text-decoration: none; animation: toast-entra .25s ease;
}
.toast:hover { text-decoration: none; border-color: var(--accent); }
.toast .fechar { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
@keyframes toast-entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Responsivo ────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  :root { --pad: 26px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  :root { --pad: 18px; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-110%);
    transition: transform .22s ease; box-shadow: var(--shadow); width: min(300px, 86vw);
    margin: 0; height: 100vh; border-radius: 0 20px 20px 0;
  }
  .recolher-btn { display: none; }
  body.menu-aberto .sidebar { transform: none; }
  body.menu-aberto .veu { display: block; }
  .veu { display: none; position: fixed; inset: 0; background: rgba(5, 8, 15, .6); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar { min-height: 60px; margin: 8px 8px 0; padding: 8px 12px 8px 8px; gap: 10px; border-radius: 16px; top: 8px; }
  .conteudo { padding: 16px 8px 40px; }
}
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-notif { grid-template-columns: 1fr; }
  .sino-caixa { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; }
  .card { padding: 20px 18px; margin-bottom: 18px; }
  .card.flush .card-head { padding: 18px 18px 0; }
  .grid { gap: 18px; margin-bottom: 18px; }
  form .grid, .card .grid { gap: 0 18px; }
  .defs { grid-template-columns: 1fr; gap: 2px 0; }
  .defs dd { margin-bottom: 12px; }
  .filtros input[type=search] { flex: 1 1 100%; max-width: none; }
  .filtros select { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .filtros .btn { flex: 1 1 100%; }

  /* Tabelas viram cartões empilhados */
  table.tabela.responsiva thead { display: none; }
  table.tabela.responsiva, .tabela.responsiva tbody, .tabela.responsiva tr, .tabela.responsiva td { display: block; width: 100%; }
  .tabela.responsiva tr { padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
  .tabela.responsiva tr:last-child { border-bottom: 0; }
  .tabela.responsiva td { border: 0; padding: 6px 0; display: flex; flex-wrap: wrap; gap: 4px 8px; justify-content: flex-end; align-items: center; text-align: right; }
  .tabela.responsiva td::before { content: attr(data-rotulo); color: var(--muted); font-size: 12.5px; font-weight: 600; flex: none; text-align: left; margin-right: auto; padding-right: 10px; }
  .tabela.responsiva td .muted.small { margin-top: 0; }
  .tabela.responsiva td:not([data-rotulo])::before { content: none; }
  .tabela.responsiva td.acoes-col, .tabela.responsiva td[style*="text-align:right"] { justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
  .tabela.responsiva td.acoes-col::before { display: none; }
  .tabela.responsiva td > form, .tabela.responsiva td > .btn { margin-left: 0; }
}
@media (max-width: 560px) {
  h1 { font-size: 19px; }
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 16px; }
  .stat-valor { font-size: 25px; }
  .topbar .acoes .btn span { display: none; }
  .topbar .acoes .btn { padding: 8px 10px; }
  .form-acoes .btn { flex: 1 1 auto; }
  .card-head > .btn, .card-head > form { width: 100%; }
  .card-head > form .btn { width: 100%; }
  .paginacao { padding: 14px 16px; }
}
