:root {
  --bg: #0b1220;
  --sidebar: #0e1728;
  --card: #ffffff;
  --muted: #64748b;
  --text: #0f172a;
  --line: #e2e8f0;
  --green: #c9a227;
  --green-dark: #9a7b16;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  background: #eef1f6;
  color: var(--text);
}

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #0b1220 0%, #132033 100%);
  color: #d7deea;
  padding: 22px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--green); color: #1a1403;
  display: grid; place-items: center; font-weight: 800;
}
.brand h1 { font-size: 16px; margin: 0; color: #fff; }
.brand p { margin: 2px 0 0; font-size: 11px; color: #93a0b8; }

.nav a {
  display: flex; align-items: center; gap: 10px;
  color: #c5d0e0; text-decoration: none;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; margin-bottom: 4px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(201, 162, 39, .18); color: #fff; font-weight: 600; }
.sidebar-out { margin-top: auto; padding: 16px 10px 4px; }

.main { flex: 1; padding: 28px 32px 48px; max-width: 1200px; }
.page-title { margin: 0 0 6px; font-size: 26px; }
.page-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.2fr .8fr; }
@media (max-width: 980px) {
  .app { display: block; }
  .sidebar { width: auto; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid #e6eaf0;
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
.stat { font-size: 28px; font-weight: 800; margin: 4px 0; }
.stat-label { color: var(--muted); font-size: 13px; }

.btn {
  border: 0; border-radius: 10px; padding: 10px 14px;
  font-weight: 700; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.btn-green { background: var(--green); color: #1a1403; }
.btn-dark { background: #0f172a; color: #fff; }
.btn-ghost { background: #f1f5f9; color: #0f172a; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-warn { background: #fef3c7; color: #92400e; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
input[type=text], input[type=number], input[type=datetime-local], input[type=time], input[type=color],
input[type=password], input[type=search], input[type=email], input[type=tel], input[type=date],
select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); font: inherit; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff;
}
.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flashes li {
  background: #f8f1d8; color: #5c4a12; padding: 10px 12px;
  border-radius: 10px; margin-bottom: 8px; font-size: 14px;
}

.qr-box {
  min-height: 240px; display: grid; place-items: center;
  background: #f8fafc; border-radius: 12px; border: 1px dashed #cbd5e1;
}
.qr-box img { max-width: 240px; border-radius: 8px; }
.status-ok { color: #15803d; font-weight: 800; }
.status-wait { color: #b45309; font-weight: 800; }
.status-off { color: var(--muted); font-weight: 800; }
.status-err { color: var(--danger); font-weight: 800; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: end; }
.toolbar .field { min-width: 180px; flex: 1; }
.inline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.menu-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.mode-row {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin: 12px 0;
}
.mode-row .switch { margin: 0; }
.pick { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pick-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 10px; background: #f8fafc; border-bottom: 1px solid var(--line);
}
.pick-bar input[type=search] { flex: 1; min-width: 160px; margin: 0; }
.pick-list { max-height: 280px; overflow: auto; }
.pick-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 12px; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 14px;
}
.pick-item:hover { background: #f8f4e6; }
.pick-item input { margin-top: 4px; width: auto; }
.pick-item .badge { margin-left: 6px; }
.onda {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin: 12px 0; background: #f8fafc;
}
.onda h3 { margin: 0 0 10px; font-size: 14px; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #0b1220 0%, #1a2740 100%);
}
.login-card {
  width: min(420px, calc(100% - 32px));
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.login-card-wide { width: min(520px, calc(100% - 32px)); }
.login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
@media (max-width: 560px) {
  .login-grid { grid-template-columns: 1fr; }
}
.login-card .brand h1 { color: #0b1220; }
.login-card .brand p { color: #64748b; }
.login-note { color: #64748b; font-size: 13px; margin: 14px 0 0; }
.login-switch { margin: 16px 0 0; font-size: 14px; }
.login-switch a { color: #9a7b16; font-weight: 700; }
.otp-input {
  letter-spacing: .35em;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
}
