:root {
  color-scheme: light;
  --bg: #0f172a;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0ea5a5;
  --brand-d: #0b7d7d;
  --accent: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --soft: #f8fafc;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: #eef2f7;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: linear-gradient(90deg, var(--brand-d), var(--brand));
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar .logo { font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.topbar .logo span { opacity: .85; font-weight: 500; }
.topbar nav { display: flex; gap: 6px; margin-left: auto; }
.topbar nav a {
  color: #fff; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.topbar nav a:hover, .topbar nav a.active { background: rgba(255,255,255,.18); text-decoration: none; }

/* ===== Layout com menu lateral ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0; background: linear-gradient(180deg, #0b7d7d, #0f172a);
  color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-logo { padding: 20px 20px 14px; font-weight: 800; font-size: 19px; letter-spacing: .3px; }
.side-logo span { display: block; opacity: .8; font-weight: 500; font-size: 13px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; padding: 8px 12px; flex: 1; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; color: #e8f5f5; padding: 11px 13px; border-radius: 10px;
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; border: none; background: none; text-align: left;
}
.side-nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.side-nav a.active { background: rgba(255,255,255,.20); }
.side-nav a .ico { width: 20px; text-align: center; font-size: 16px; }
.side-nav a .navbadge { margin-left: auto; background: #dc2626; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.side-nav .sep { height: 1px; background: rgba(255,255,255,.15); margin: 8px 6px; }
.side-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; }
.side-user a { color: #cbeeee; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-head {
  display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.main-head h1 { font-size: 18px; margin: 0; }
.main-head .btn { margin-left: auto; }
.hamb { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink); }
.content { padding: 22px 24px; max-width: 1180px; width: 100%; }
.view[hidden] { display: none; }
.backdrop { display: none; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .hamb { display: block; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
}

.wrap { max-width: 1180px; margin: 24px auto; padding: 0 20px; }
h1 { font-size: 22px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.card .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.card .v { font-size: 26px; font-weight: 800; margin-top: 6px; }
.card .v.small { font-size: 20px; }
.card.brand { border-color: var(--brand); }
.card .v.ok { color: var(--ok); } .card .v.warn { color: var(--warn); } .card .v.bad { color: var(--bad); }

.section { margin-top: 28px; }
.section h2 { font-size: 16px; margin: 0 0 12px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--soft); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfdff; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.gray { background: #eef2f7; color: #475569; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.amber { background: #fef3c7; color: #b45309; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 14px;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.banner { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 18px; }
.banner.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.banner.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* form */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 600; color: #334155; }
input, select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; font-family: inherit;
  background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.plan-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan {
  border: 2px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; text-align: center; background: #fff;
}
.plan:hover { border-color: var(--brand); }
.plan.sel { border-color: var(--brand); background: #f0fdfa; }
.plan .nome { font-weight: 800; }
.plan .preco { font-size: 20px; font-weight: 800; color: var(--brand-d); margin: 4px 0; }
.plan .vidas { font-size: 12px; color: var(--muted); }

.dep-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 12px; background: var(--soft); }
.dep-card .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }

.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: 16px; max-width: 560px; width: 100%; padding: 24px; max-height: 90vh; overflow: auto; }

@media (max-width: 720px) {
  .form-grid, .plan-pick { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
}
