/* Visual inspirado no AdminJS: barra superior branca, menu lateral claro, azul #4268F6, fundo #F6F7FB */
:root {
  --bg: #f6f7fb; --surface: #fff; --surface-2: #f6f7fb; --text: #1c1c38; --text-2: #454655; --muted: #898a9a;
  --border: #dddfe8; --primary: #4268f6; --primary-d: #3040d6; --primary-soft: #f0f3ff; --primary-mid: #c0cbfa;
  --ok: #2a9d7f; --ok-soft: #e3f6f0; --warn: #c97a0a; --warn-soft: #fff1dc;
  --bad: #e0304f; --bad-soft: #ffe6eb;
  --shadow: 0 4px 8px rgba(28,28,56,.06); --shadow-lg: 0 15px 40px rgba(28,28,56,.2);
  --radius: 4px; --top-h: 64px; --side-w: 260px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 Roboto, "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 400; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.hidden { display: none !important; }

/* Marca */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.2px; }
.logo { width: 32px; height: 32px; border-radius: 4px; background: var(--primary); display: grid; place-items: center; color: #fff; font-weight: 700; }

/* Login (split como no AdminJS) */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); box-shadow: var(--shadow-lg); padding: 40px; border-top: 4px solid var(--primary); }
.login-card h1 { font-size: 24px; margin: 28px 0 4px; }

/* Formulários */
label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 16px 0 6px; }
input, select, textarea { width: 100%; padding: 9px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; text-transform: none; font-size: 14px; letter-spacing: 0; margin-top: 18px; cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius);
  border: 1px solid var(--primary); background: transparent; color: var(--primary); cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { background: var(--primary-soft); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); color: #fff; }
.btn.danger.solid:hover { background: #c01e3c; }
.btn.sm { padding: 3px 10px; font-size: 12.5px; }
.btn.text { border-color: transparent; }
.btn.block { width: 100%; margin-top: 24px; padding: 11px; }
.btn:disabled { opacity: .6; cursor: wait; }
.error { color: var(--bad); background: var(--bad-soft); border-left: 3px solid var(--bad); padding: 8px 12px; margin-top: 16px; font-size: 13px; }

/* Barra superior */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top-h); z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; }
.topbar .menu-btn { display: none; border: 0; background: none; cursor: pointer; padding: 6px; color: var(--text-2); }
.topbar .spacer { flex: 1; }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 6px 8px; border-radius: var(--radius); }
.user-btn:hover { background: var(--bg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 500; }
.user-info { text-align: left; line-height: 1.25; }
.user-info small { display: block; color: var(--muted); font-size: 12px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--border); z-index: 40; }
.dropdown button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 16px; cursor: pointer; }
.dropdown button:hover { background: var(--primary-soft); color: var(--primary); }

/* Menu lateral */
.shell { padding-top: var(--top-h); min-height: 100vh; }
.side { position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--side-w); background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 0; overflow-y: auto; z-index: 20; }
.side h4 { margin: 0 24px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.nav { display: flex; flex-direction: column; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 24px; color: var(--text-2); text-decoration: none; border-left: 4px solid transparent; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); border-left-color: var(--primary); }
.nav svg { width: 18px; height: 18px; flex: none; }
.main { margin-left: var(--side-w); padding: 32px 40px 48px; min-width: 0; }

/* Cabeçalho de página */
.crumb { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.crumb b { font-weight: 400; color: var(--text-2); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 28px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tools input { width: 260px; }

/* Cards / KPIs */
.grid { display: grid; gap: 24px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 24px; }
.card { background: var(--surface); box-shadow: var(--shadow); }
.card.pad { padding: 24px; }
.card h3 { font-size: 16px; margin-bottom: 16px; font-weight: 500; }
.kpi { padding: 20px 24px; border-top: 3px solid var(--primary); }
.kpi:nth-child(2) { border-top-color: #38a4dd; } .kpi:nth-child(3) { border-top-color: #70c9b0; } .kpi:nth-child(4) { border-top-color: #ffa32c; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 32px; font-weight: 300; margin-top: 4px; }
.kpi .hint { color: var(--muted); font-size: 12.5px; }
.cols { grid-template-columns: 2fr 1fr; margin-bottom: 24px; }

/* Tabela */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500;
  padding: 14px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--bg); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--primary-soft); }
td.actions { text-align: right; white-space: nowrap; }
.empty { padding: 48px; text-align: center; color: var(--muted); }

/* Badges / barras */
.badge { display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 999px; font-size: 12px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary-mid); display: inline-block; }
.dot.on { background: #70c9b0; box-shadow: 0 0 0 3px var(--ok-soft); }
.bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: var(--primary); transition: width .4s; }
.bar.warn > i { background: #ffa32c; } .bar.bad > i { background: #ff4567; }
.keybox { display: inline-flex; align-items: center; gap: 6px; }
.keybox button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 4px; border-radius: 4px; }
.keybox button:hover { color: var(--primary); background: var(--primary-soft); }

/* Gráfico */
.chart { width: 100%; height: 190px; display: block; }
.chart .axis { stroke: var(--bg); stroke-width: 1.5; } .chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bg); }
.list-item:last-child { border: 0; }

/* Cartões de licença (cliente) */
.lic-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin-bottom: 24px; }
.lic-card .top { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 12px; }
.lic-card .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; font-size: 13px; }
.lic-card .meta span { color: var(--muted); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

/* Modal / toast */
.overlay { position: fixed; inset: 0; background: rgba(28,28,56,.5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; overflow-y: auto; }
.modal { background: var(--surface); width: 100%; max-width: 520px; padding: 28px; box-shadow: var(--shadow-lg); max-height: 100%; overflow-y: auto; animation: pop .18s; border-top: 4px solid var(--primary); }
.modal h2 { font-size: 20px; margin-bottom: 4px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
#toasts { position: fixed; right: 24px; top: 80px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: var(--surface); border-left: 4px solid #70c9b0; color: var(--text); padding: 12px 18px; box-shadow: var(--shadow-lg); animation: pop .2s; }
.toast.err { border-left-color: #ff4567; }
@keyframes fade { from { opacity: 0 } } @keyframes pop { from { opacity: 0; transform: translateY(-6px) } }

@media (max-width: 900px) {
  .topbar { padding: 0 12px; }
  .topbar .menu-btn { display: block; }
  .user-info { display: none; }
  .side { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .main { margin-left: 0; padding: 24px 16px; }
  .cols { grid-template-columns: 1fr; }
  .tools input { width: 100%; }
  .row2 { grid-template-columns: 1fr; }
}
