:root {
  --navy: #0b1d3a;
  --navy-2: #10264a;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --sky: #e8f1ff;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #16a34a;
  --orange: #f59e0b;
  --purple: #7c3aed;
  --red: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
  --radius: 18px;
  --sidebar: 268px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
svg { width: 20px; height: 20px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, var(--navy) 0%, #08152b 100%);
  color: #dbe7ff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: #fff;
  padding: 8px 10px 22px;
}
.brand img { width: 42px; height: 42px; }
.brand strong { display: block; letter-spacing: .04em; font-size: 13px; }
.brand small { color: #93c5fd; font-size: 11px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #c7d7f5;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 12px;
}
.sidebar nav a.active,
.sidebar nav a:hover { background: #1d4ed8; color: #fff; }
.sidebar-tag { margin-top: auto; color: #7f97bc; font-size: 12px; padding: 16px 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar p { margin: 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 14px; position: relative; }
.bell, .menu-btn, .icon-btn {
  border: 0;
  background: #f1f5f9;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
}
.bell { position: relative; }
.bell .dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  background: #ef4444; border-radius: 50%;
}
.notes-pop {
  display: none; position: absolute; right: 120px; top: 48px; width: 260px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 14px;
}
.notes-pop.open { display: block; }
.admin-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.admin-chip a { color: var(--blue); text-decoration: none; font-size: 13px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue);
  color: #fff; display: grid; place-items: center; font-weight: 700;
}

.content { padding: 28px; flex: 1; }
.page-head, .panel-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 18px;
}
h1 { margin: 0 0 6px; font-size: 28px; }
h2 { margin: 0 0 8px; font-size: 20px; }
p { color: var(--muted); }

.hero {
  background: linear-gradient(135deg, #eaf3ff, #d7e7ff);
  border-radius: 24px;
  padding: 32px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 22px;
}
.hero h1 { font-size: 34px; }
.hero-art { position: relative; height: 160px; }
.device {
  position: absolute; background: #0b1d3a; border-radius: 14px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, .18);
  display: grid; place-items: center;
}
.device span {
  width: 46%; height: 46%; border-radius: 12px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}
.device.desk { width: 170px; height: 110px; right: 70px; top: 18px; }
.device.tab { width: 86px; height: 112px; right: 18px; top: 28px; }
.device.phone { width: 46px; height: 86px; right: 150px; top: 58px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stats article {
  background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}
.stats b { display: block; font-size: 26px; }
.stats .warn b { color: var(--orange); }

.panel {
  background: #fff; border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); margin-bottom: 22px;
}
.player-list { display: grid; gap: 12px; }
.player-row {
  display: grid; grid-template-columns: 1.4fr .6fr .7fr auto;
  gap: 12px; align-items: center; padding: 12px; border-radius: 14px;
  border: 1px solid var(--line);
}
.who { display: flex; gap: 12px; align-items: center; }
.who small, .muted, small { color: var(--muted); display: block; }
.app-icon {
  width: 42px; height: 42px; border-radius: 12px; color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #e2e8f0; color: #334155; width: max-content;
}
.pill.active, .pill.info { background: #dcfce7; color: #166534; }
.pill.maintenance, .pill.warning, .pill.paused { background: #ffedd5; color: #9a3412; }
.pill.locked, .pill.urgent { background: #fee2e2; color: #991b1b; }
.row-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; padding: 10px 16px; text-decoration: none;
  background: #e2e8f0; color: var(--text); cursor: pointer; font-weight: 650;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.ghost { background: #fff; border: 1px solid var(--line); }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.quick h2 { margin-bottom: 12px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.qcard {
  background: #fff; border-radius: 18px; min-height: 120px; padding: 18px;
  box-shadow: var(--shadow); text-decoration: none; display: flex;
  flex-direction: column; justify-content: space-between; font-weight: 700;
}
.qcard svg { width: 28px; height: 28px; }
.qcard.blue { color: var(--blue); }
.qcard.green { color: var(--green); }
.qcard.purple { color: var(--purple); }
.qcard.orange { color: var(--orange); }

.rescue-banner {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  background: #fff7ed; border: 1px solid #fdba74; border-radius: 16px; padding: 16px 18px;
}
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.err { background: #fee2e2; color: #991b1b; }
.form-panel label, .panel label { display: grid; gap: 6px; font-weight: 650; margin-bottom: 12px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid-2 .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.token-box, .mono, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.token-box { background: #f8fafc; border-radius: 12px; padding: 14px; margin-top: 16px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.empty { color: var(--muted); padding: 12px 0; }
.stack { display: grid; gap: 12px; }
.note-card {
  display: flex; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
}
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { min-width: 140px; }
.steps { color: var(--muted); padding-left: 18px; }
.audit { padding-left: 18px; color: var(--muted); }
.site-foot {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 18px 28px; color: var(--muted); font-size: 13px;
}
.site-foot a { margin-left: 12px; color: var(--muted); text-decoration: none; }
.menu-btn { display: none; }
.prose li { margin: 8px 0; }

.login-body {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(circle at top, #1e3a8a, #0b1d3a 55%);
}
.pin-card {
  width: min(420px, calc(100% - 32px)); background: #fff; border-radius: 24px;
  padding: 28px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.pin-card img { width: 56px; height: 56px; }
.pin-card h1 { letter-spacing: .08em; font-size: 22px; }
.pin-card #pin { position: absolute; opacity: 0; pointer-events: none; }
.pin-dots { display: flex; justify-content: center; gap: 10px; margin: 18px 0; }
.pin-dots i {
  width: 12px; height: 12px; border-radius: 50%; background: #dbe3ef;
}
.pin-dots[data-count="1"] i:nth-child(-n+1),
.pin-dots[data-count="2"] i:nth-child(-n+2),
.pin-dots[data-count="3"] i:nth-child(-n+3),
.pin-dots[data-count="4"] i:nth-child(-n+4),
.pin-dots[data-count="5"] i:nth-child(-n+5),
.pin-dots[data-count="6"] i:nth-child(-n+6) { background: var(--blue); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 16px; }
.pin-pad button {
  height: 56px; border: 0; border-radius: 14px; background: #f1f5f9; font-size: 20px; cursor: pointer;
}

@media (max-width: 980px) {
  .sidebar { position: fixed; left: -100%; z-index: 20; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .menu-btn { display: inline-grid; place-items: center; }
  .hero, .stats, .quick-grid, .player-row, .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .site-foot { flex-direction: column; padding: 16px; }
}
