:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --dark: #0f172a;
  --slate: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --green: #059669;
  --green-soft: #dcfce7;
  --orange: #ea580c;
  --orange-soft: #ffedd5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --radius: 14px;
  --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--dark);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* TOP NAVBAR */
.topbar {
  background: var(--dark);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 12px;
  color: #94a3b8;
  display: block;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chip {
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.chip-token {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* LAYOUT */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 66px);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: #f8fafc;
  color: var(--primary);
}

.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.main-content {
  padding: 24px 28px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* CARDS & STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--dark);
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--dark);
}

/* BUTTONS & INPUTS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-green {
  background: var(--green);
  color: #fff;
}

.btn-orange {
  background: var(--orange);
  color: #fff;
}

.btn-red {
  background: var(--red);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border-color: #cbd5e1;
  color: var(--slate);
}
.btn-outline:hover {
  background: #f8fafc;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 8px;
}

.input, select, textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--dark);
  background: #fff;
}

.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 5px;
}

/* TABLES */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: var(--slate);
  font-weight: 700;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--dark);
}

tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-working { background: var(--primary-soft); color: var(--primary); }
.badge-finished { background: var(--green-soft); color: var(--green); }
.badge-locked { background: var(--red-soft); color: var(--red); }
.badge-idle { background: #f1f5f9; color: var(--muted); }

/* PRINT ADMINISTRATION DOCUMENTS (A4 SMAN 3 BURU) */
.print-sheet {
  background: #fff;
  color: #000;
  padding: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  margin-top: 16px;
}

.kop-surat {
  text-align: center;
  border-bottom: 3px double #000;
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.kop-surat h4 { font-size: 14px; font-weight: 700; text-transform: uppercase; }
.kop-surat h2 { font-size: 19px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.03em; }
.kop-surat p { font-size: 12px; }

.print-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.print-card-item {
  border: 1.5px solid #000;
  padding: 12px;
  border-radius: 6px;
  page-break-inside: avoid;
  font-size: 12px;
}

.print-card-head {
  text-align: center;
  border-bottom: 1px solid #000;
  padding-bottom: 6px;
  margin-bottom: 8px;
  font-weight: 800;
  font-size: 12px;
}

.desk-card-item {
  border: 2px solid #000;
  padding: 18px;
  text-align: center;
  page-break-inside: avoid;
}
.desk-card-item .seat-no {
  font-size: 14px;
  font-weight: 800;
  background: #000;
  color: #fff;
  display: inline-block;
  padding: 3px 12px;
  margin-bottom: 6px;
}
.desk-card-item .exam-no {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin: 6px 0;
}
.desk-card-item .st-name {
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
}

@media print {
  body { background: #fff !important; }
  .no-print, .topbar, .sidebar { display: none !important; }
  .app-shell { display: block !important; }
  .main-content { padding: 0 !important; max-width: 100% !important; }
  .print-sheet { border: none !important; padding: 0 !important; margin: 0 !important; }
}
