:root {
  --bg: #f7f8fa; --surface: #ffffff; --surface-2: #f1f3f7;
  --border: #e4e7ec; --border-strong: #d0d5dd;
  --text: #101828; --text-muted: #667085; --text-subtle: #98a2b3;
  --primary: #4f46e5; --primary-hover: #4338ca; --primary-soft: #eef2ff;
  --success: #12b76a; --success-soft: #d1fadf;
  --warning: #f79009; --warning-soft: #fef0c7;
  --danger: #f04438; --danger-soft: #fee4e2;
  --info: #2e90fa; --info-soft: #d1e9ff;
  --neutral-soft: #f2f4f7;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow-md: 0 4px 8px -2px rgba(16,24,40,.08), 0 2px 4px -2px rgba(16,24,40,.04);
  --shadow-lg: 0 12px 24px -4px rgba(16,24,40,.12), 0 4px 8px -2px rgba(16,24,40,.06);
  --radius-sm: 6px; --radius: 8px; --radius-lg: 12px;
  --sidebar-w: 240px; --topbar-h: 56px; --drawer-w: 440px;
}
[data-theme="dark"] {
  --bg: #0f1117; --surface: #161b27; --surface-2: #1e2535;
  --border: #2a3147; --border-strong: #374060;
  --text: #e8ecf4; --text-muted: #8892b0; --text-subtle: #4a5680;
  --primary-soft: #1e1b4b;
  --success-soft: #0a2118; --warning-soft: #2a1a00; --danger-soft: #2a0d0d; --info-soft: #0d1e38;
  --neutral-soft: #1a2030;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 4px 8px -2px rgba(0,0,0,.55), 0 2px 4px -2px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 24px -4px rgba(0,0,0,.65), 0 4px 8px -2px rgba(0,0,0,.45);
}
.theme-transitioning * { transition: background-color .18s ease, color .18s ease, border-color .18s ease !important; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg); overflow: hidden;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; }
.sidebar { grid-row: 1/3; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.topbar { grid-column: 2; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; }
.topbar h1 { font-size: 18px; margin: 0; }
.canvas { grid-column: 2; overflow: auto; padding: 20px 24px; }

.brand {
  background: linear-gradient(160deg, #1e1b3a 0%, #0d0a20 100%);
  border-bottom: 1px solid rgba(79,70,229,.25);
  padding: 20px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.brand img { width: 128px; height: 58px; object-fit: contain; display: block; }
.brand-label { font-size: 9px; color: rgba(255,255,255,.42); text-transform: uppercase; letter-spacing: .16em; font-weight: 700; }
.nav { padding: 12px 8px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; user-select: none; font-weight: 500; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; }
.user-name { font-weight: 600; }
.user-role { color: var(--text-muted); text-transform: uppercase; font-size: 10px; letter-spacing: .06em; font-weight: 600; margin-top: 2px; }

.topbar-actions { margin-left: auto; }
.btn { padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.loading, .empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }

.module-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.module-title { font-size: 22px; font-weight: 700; margin: 0; }
.module-sub { color: var(--text-muted); font-size: 13px; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; padding: 10px 14px; font-weight: 600; font-size: 12px; color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .04em; }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--surface-2); }
.pri { font-weight: 600; }
.sec { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.text-muted { color: var(--text-muted); }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; margin: 6px 0 4px; }

.drawer-overlay { position: fixed; inset: 0; background: rgba(16,24,40,.4); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: var(--drawer-w); max-width: 100%; background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .25s ease; z-index: 51; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
.drawer-eyebrow { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.drawer-title { font-size: 18px; font-weight: 700; margin: 4px 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); }
.icon-btn:hover { background: var(--surface-2); }

.field { margin-bottom: 14px; }
.field-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-bottom: 4px; display: block; }
.input, .select, .textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.lic-check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer; }
.lic-check.over-seat { opacity: .55; cursor: not-allowed; }
.lic-check-name { font-weight: 600; font-size: 13px; }
.lic-check-meta { font-size: 11px; color: var(--text-muted); }

.toast-zone { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1d2939; color: white; padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13px; pointer-events: auto; animation: toastIn .2s ease; }
.toast.toast-error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.theme-btn {
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; line-height: 1;
  flex-shrink: 0;
}
.theme-btn:hover { background: var(--border); }
