:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ec;
  --brand: #b91c1c;
  --brand-dark: #7f1d1d;
  --accent: #0f766e;
  --warn: #a16207;
  --danger: #b91c1c;
  --ok: #166534;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100%; }
a { color: inherit; }
.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: #111827; color: #fff; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; }
.brand img { width: 34px; height: 34px; }
.topbar nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar a, .link-button { min-height: 40px; display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: #fff; background: transparent; border: 0; font: inherit; cursor: pointer; }
.topbar a:hover, .link-button:hover { background: rgba(255,255,255,.12); }
.menu-button { display: none; }
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.sidebar a { min-height: 42px; display: flex; align-items: center; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.sidebar a:hover { background: #f1f5f9; }
.main { padding: 28px; max-width: 1280px; width: 100%; }
.public-main { padding: 36px 24px; max-width: 1180px; margin: 0 auto; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: center; min-height: calc(100vh - 132px); }
.hero-visual { min-height: 420px; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, #111827, #7f1d1d 60%, #0f766e); display: grid; place-items: center; color: #fff; padding: 32px; }
.hero-visual .panel-preview { width: min(420px, 100%); background: rgba(255,255,255,.95); color: var(--ink); border-radius: 8px; padding: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
h1 { font-size: clamp(2rem, 4vw, 4.8rem); line-height: 1; margin: 0 0 16px; letter-spacing: 0; }
h2 { font-size: 1.45rem; margin: 0 0 14px; }
h3 { font-size: 1.05rem; margin: 0 0 10px; }
p { color: var(--muted); line-height: 1.6; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
.kpi { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.kpi strong { font-size: 2rem; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0; }
.button, button.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; padding: 9px 14px; background: var(--brand); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.button.secondary { background: #334155; }
.button.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.status { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 8px; border-radius: 999px; font-size: .82rem; font-weight: 700; border: 1px solid transparent; }
.status.ok { color: var(--ok); background: #dcfce7; border-color: #bbf7d0; }
.status.warn { color: var(--warn); background: #fef3c7; border-color: #fde68a; }
.status.danger, .status.critical { color: var(--danger); background: #fee2e2; border-color: #fecaca; }
.status.info { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; color: var(--muted); background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
form.stack, .stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: .92rem; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; min-height: 42px; padding: 9px 11px; font: inherit; background: #fff; color: var(--ink); }
textarea { min-height: 96px; resize: vertical; }
.alert { padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; border: 1px solid var(--line); background: #f1f5f9; }
.alert.error { background: #fee2e2; border-color: #fecaca; color: #7f1d1d; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 18px; align-items: start; }
.footer { padding: 22px 24px; color: var(--muted); border-top: 1px solid var(--line); background: #fff; }
.qr { max-width: 340px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 12px; }
.empty { padding: 28px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 8px; background: #fff; }

@media (max-width: 860px) {
  .menu-button { display: inline-flex; }
  .topbar { padding: 10px 14px; }
  .topbar nav { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .shell.nav-open .sidebar { display: flex; }
  .main { padding: 18px; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-visual { min-height: 300px; }
  .split { grid-template-columns: 1fr; }
}
