:root {
  --bg-sidebar: #1b1815;
  --bg-sidebar-elev: #26221c;
  --sidebar-border: #2f2a22;
  --sidebar-text: #a8a29e;
  --sidebar-text-bright: #f5f5f4;

  --bg-app: #fcf9f2;
  --bg-card: #ffffff;
  --bg-subtle: #fbf5e6;
  --bg-muted: #f7f2e7;
  --border: #ece4d3;
  --border-strong: #dfd4bd;

  --text-main: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #78716c;

  --gold-50: #fefce8;
  --gold-100: #fef9c3;
  --gold-200: #fef08a;
  --gold-400: #facc15;
  --gold-500: #eab308;
  --gold-600: #ca8a04;
  --gold-800: #854d0e;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --amber-800: #92400e;

  --emerald-50: #ecfdf5;
  --emerald-200: #a7f3d0;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --rose-50: #fff1f2;
  --rose-200: #fecdd3;
  --rose-600: #e11d48;
  --rose-700: #be123c;

  --blue-50: #eff6ff;
  --blue-600: #2563eb;
  --indigo-50: #eef2ff;
  --indigo-600: #4f46e5;

  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
  --shadow-md: 0 4px 14px rgba(28, 25, 23, 0.07);
  --shadow-lg: 0 18px 40px rgba(28, 25, 23, 0.18);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

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

html, body {
  min-height: 100%;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 11, 0.55);
  backdrop-filter: blur(2px);
  z-index: 35;
}

.sidebar-backdrop.hidden {
  display: none !important;
}

/* Dark Charcoal Sidebar */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #1d1a16 0%, #161411 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  color: var(--sidebar-text);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--gold-500);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.auth-logo-img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.kop-logo-img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--gold-400);
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  font-weight: 500;
  color: #a8a29e;
}

/* Workspace Selector in Sidebar */
.workspace-box {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--sidebar-border);
}

.workspace-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #78716c;
  margin-bottom: 6px;
}

.workspace-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.workspace-select {
  flex: 1;
  min-width: 0;
  background: var(--bg-sidebar-elev);
  color: var(--sidebar-text-bright);
  border: 1px solid #3c352b;
  border-radius: 8px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.workspace-select:focus {
  border-color: var(--gold-400);
}

.workspace-add-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.12);
  color: var(--gold-400);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.workspace-add-btn:hover {
  background: var(--gold-400);
  color: #1c1917;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #6b655e;
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  color: #b8b2a8;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fafaf9;
}

.nav-item.active {
  background: rgba(250, 204, 21, 0.14);
  border-color: rgba(250, 204, 21, 0.35);
  color: var(--gold-400);
  box-shadow: inset 3px 0 0 var(--gold-400);
}

.nav-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  opacity: 0.9;
}

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.14);
  color: var(--gold-400);
}

.nav-auto-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(250, 204, 21, 0.18);
  color: var(--gold-400);
  border: 1px solid rgba(250, 204, 21, 0.35);
}

.sidebar-footer {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: #171411;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #242019;
  border: 1px solid #352f25;
}

.sidebar-user-info {
  min-width: 0;
  flex: 1;
}

.sidebar-user-email {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10.5px;
  color: #a8a29e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid #443d32;
  background: #2e2920;
  color: #f5f5f4;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background: var(--rose-700);
  border-color: var(--rose-600);
  color: #ffffff;
}

/* Auth Login Gate */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top right, #fef3c7 0%, #fcf9f2 45%, #f5efe2 100%);
}

.auth-gate.hidden,
.app-shell.hidden,
.auth-error.hidden {
  display: none !important;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid var(--amber-200);
  border-radius: 18px;
  padding: 28px 26px 24px;
  box-shadow: 0 20px 50px rgba(120, 80, 10, 0.14);
}

.auth-header {
  text-align: center;
  margin-bottom: 20px;
}

.auth-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.auth-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.auth-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--rose-50);
  border: 1px solid var(--rose-200);
  color: var(--rose-700);
  font-size: 12px;
  font-weight: 600;
}

.auth-hint-box {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #fefce8;
  border: 1px solid #fde68a;
  color: #854d0e;
  font-size: 11.5px;
  line-height: 1.55;
}

.storage-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #a8a29e;
}

.storage-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-400);
  flex-shrink: 0;
}

/* Main Content */
.main-wrap {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 22px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.topbar-left > div {
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
}

.page-title {
  font-size: 17.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  background: var(--emerald-50);
  color: var(--emerald-700);
  border: 1px solid var(--emerald-200);
  cursor: pointer;
}

.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald-600);
}

.status-pill.has-conflict {
  background: var(--rose-50);
  color: var(--rose-700);
  border-color: var(--rose-200);
}

.status-pill.has-conflict .dot {
  background: var(--rose-600);
}

.main-content {
  padding: 18px 22px 40px;
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
  border-radius: 7px;
}

.btn-block {
  width: 100%;
}

.btn-gold, .btn-primary, .btn-amber {
  background: linear-gradient(180deg, #facc15 0%, #eab308 100%);
  color: #1c1917;
  border-color: #eab308;
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.25);
}

.btn-gold:hover, .btn-primary:hover, .btn-amber:hover {
  background: linear-gradient(180deg, #fde047 0%, #facc15 100%);
  transform: translateY(-1px);
}

.btn-emerald {
  background: var(--emerald-600);
  color: #ffffff;
}

.btn-emerald:hover {
  background: var(--emerald-700);
}

.btn-danger {
  background: var(--rose-600);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--rose-700);
}

.btn-danger-outline {
  background: var(--rose-50);
  border-color: var(--rose-200);
  color: var(--rose-700);
}

.btn-danger-outline:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.btn-outline {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--gold-50);
  border-color: var(--gold-500);
  color: var(--text-main);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.icon-btn:hover {
  background: var(--gold-50);
  border-color: var(--gold-500);
}

/* Segmented Master Toolbar (Matches Screenshot) */
.master-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.master-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.master-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: #f5eedf;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.pill-tab {
  padding: 6px 13px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
}

.pill-tab:hover {
  color: var(--text-main);
}

.pill-tab.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.08);
}

/* Cards & Grids */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
}

.card-body {
  padding: 16px 18px;
}

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

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.kpi-card.ok { border-left: 4px solid var(--emerald-600); }
.kpi-card.warn { border-left: 4px solid var(--gold-500); }
.kpi-card.danger { border-left: 4px solid var(--rose-600); }
.kpi-card.info { border-left: 4px solid var(--blue-600); }

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.matrix-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
  align-items: start;
}

/* Toolbar & Filters */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  background: #ffffff;
  padding: 11px 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input, .select, .textarea {
  font-family: inherit;
  font-size: 12.5px;
  padding: 7.5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.18);
}

.mono {
  font-family: var(--font-mono);
}

/* Kop Surat */
.kop-surat {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 3px double var(--text-main);
}

.kop-emblem {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef9c3, #fde047);
  border: 2px solid var(--gold-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 19px;
  color: var(--text-main);
  flex-shrink: 0;
}

.kop-info {
  flex: 1;
  text-align: center;
}

.kop-univ {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.kop-fak {
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.kop-prodi {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.kop-title {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed var(--border-strong);
  font-size: 13.5px;
  font-weight: 800;
  color: var(--gold-800);
}

/* Schedule Class Cards */
.schedule-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.class-schedule-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  break-inside: avoid;
}

.class-card-head {
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border-bottom: 1px solid var(--amber-200);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.class-card-title {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--text-main);
}

.class-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.class-schedule-card table.data-table {
  font-size: 11.5px;
}

.class-schedule-card table.data-table th,
.class-schedule-card table.data-table td {
  padding: 6px 6px;
}

.class-schedule-card table.data-table td:first-child {
  white-space: nowrap;
}

/* Tables (Clean Screenshot Style) */
.table-wrap {
  overflow-x: auto;
  width: 100%;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.data-table th {
  background: #faf6ec;
  color: #926c15;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f4efe3;
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background: #fffdf6;
}

table.data-table tr.row-total td {
  background: var(--gold-50);
  font-weight: 800;
  border-top: 1px solid var(--amber-200);
}

table.data-table tr.row-conflict td {
  background: var(--rose-50);
}

table.data-table tr.row-highlight td {
  background: #fef9c3;
}

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Action pill buttons inside tables */
.tbl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-main);
  transition: all 0.12s ease;
}

.tbl-btn:hover {
  background: var(--gold-50);
  border-color: var(--gold-500);
}

.tbl-btn.danger {
  background: var(--rose-50);
  border-color: var(--rose-200);
  color: var(--rose-700);
}

.tbl-btn.danger:hover {
  background: #ffe4e6;
}

/* Matrix Table */
table.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

table.matrix-table th, table.matrix-table td {
  border: 1px solid var(--border-strong);
  padding: 4px 3px;
  text-align: center;
}

table.matrix-table th {
  background: #fef3c7;
  font-weight: 800;
  color: var(--gold-800);
}

table.matrix-table tr.day-banner td {
  background: #fde047;
  color: #1c1917;
  font-weight: 800;
  text-align: left;
  padding: 6px 8px;
  font-size: 12px;
}

table.matrix-table td.shift-cell {
  background: var(--bg-muted);
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  padding-left: 6px;
  padding-right: 6px;
}

table.matrix-table td.proctor-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
  min-width: 34px;
}

table.matrix-table td.proctor-cell:hover {
  background: var(--gold-100);
}

table.matrix-table td.proctor-cell.conflict {
  background: #fecdd3;
  color: var(--rose-700);
}

table.matrix-table td.proctor-cell.empty {
  color: #cbd5e1;
  font-weight: 400;
}

/* Badges / Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-gold, .badge-amber { background: #fef3c7; color: #92400e; }
.badge-emerald { background: var(--emerald-50); color: var(--emerald-700); }
.badge-rose { background: var(--rose-50); color: var(--rose-700); }
.badge-blue { background: var(--blue-50); color: var(--blue-600); }
.badge-indigo { background: var(--indigo-50); color: var(--indigo-600); }
.badge-gray { background: #f3f4f6; color: #4b5563; }

.code-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: #fef3c7;
  color: #854d0e;
}

.code-chip.conflict {
  background: var(--rose-200);
  color: var(--rose-700);
}

/* Signature block */
.signature-block {
  margin-top: 28px;
  display: flex;
  justify-content: flex-end;
}

.signature-box {
  width: 280px;
  text-align: left;
  font-size: 13px;
}

.signature-space {
  height: 64px;
}

.signature-name {
  font-weight: 800;
  text-decoration: underline;
}

/* Forms & Modals */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 22, 20, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15.5px;
  font-weight: 800;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-muted);
}

/* Conflict List */
.conflict-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--rose-50);
  border: 1px solid var(--rose-200);
  margin-bottom: 8px;
  font-size: 12.5px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: #1c1917;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease;
}

.toast.success { background: var(--emerald-700); }
.toast.error { background: var(--rose-700); }
.toast.warning { background: var(--amber-700); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Kesediaan Pengawas (Availability) */
.avail-info-banner {
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border: 1px solid var(--amber-200);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--gold-800);
}

.avail-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.avail-lec-list {
  max-height: 68vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.avail-lec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-bottom: 1px solid #f3ede0;
  background: #ffffff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.avail-lec-item:hover { background: var(--gold-50); }
.avail-lec-item.active { background: var(--gold-100); border-left: 3px solid var(--gold-500); }

table.avail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

table.avail-table th, table.avail-table td {
  border: 1px solid var(--border-strong);
  padding: 7px 6px;
  text-align: center;
}

table.avail-table th { background: var(--bg-muted); font-weight: 700; }
table.avail-table th.group-reg { background: #eff6ff; color: #1d4ed8; font-size: 11px; }
table.avail-table th.group-kar { background: #eef2ff; color: #4338ca; font-size: 11px; }
table.avail-table th.avail-col-head { cursor: pointer; }
table.avail-table th.avail-col-head:hover { background: var(--gold-50); }
table.avail-table td.avail-day-cell { text-align: left; padding-left: 10px; cursor: pointer; background: #fffdf8; }
table.avail-table td.avail-day-cell:hover { background: var(--gold-50); }

.avail-toggle {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #f9fafb;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}

.avail-toggle:hover { border-color: var(--gold-500); }
.avail-toggle.is-ready { background: #ecfdf5; border-color: #34d399; color: #047857; }

.import-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  background: #fffdf8;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.import-dropzone:hover { border-color: var(--gold-500); background: var(--gold-50); }

.import-preview-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 12.5px;
}

/* Generator Jadwal Otomatis */
.gen-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  margin-bottom: 16px;
}

.gen-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.gen-rules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gen-rule-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fffdf8;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.gen-rule-card:hover {
  border-color: var(--gold-500);
  background: var(--gold-50);
}

.gen-rule-card input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #926c15;
  flex-shrink: 0;
  cursor: pointer;
}

.gen-rule-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}

.gen-rule-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.gen-sem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.gen-summary-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #713f12;
  font-size: 12.5px;
}

.gen-summary-box h3 {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #854d0e;
}

.gen-summary-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gen-exec-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Responsive */
@media (max-width: 1320px) {
  .schedule-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1120px) {
  .two-col-grid, .matrix-layout, .avail-layout, .gen-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: -270px;
    top: 0;
    height: 100vh;
    height: 100dvh;
    width: 260px;
    max-width: 82vw;
    transition: left 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
    flex-shrink: 0;
  }
  .topbar {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .topbar-left {
    width: 100%;
  }
  .page-title {
    font-size: 15.5px;
  }
  .page-subtitle {
    font-size: 11px;
  }
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .topbar-actions .btn,
  .topbar-actions .status-pill {
    font-size: 11.5px;
    padding: 6px 10px;
  }
  .main-content {
    padding: 12px 12px 32px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .master-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .master-bar-left,
  .master-bar-right {
    width: 100%;
  }
  .pill-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .pill-tab {
    flex-shrink: 0;
    padding: 6px 11px;
    font-size: 12px;
  }
  .master-bar-left .input,
  .toolbar .input,
  .toolbar .select {
    width: 100% !important;
    min-width: 0 !important;
  }
  .toolbar {
    padding: 10px 12px;
  }
  .toolbar-group {
    width: 100%;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpi-card {
    padding: 12px 13px;
  }
  .kpi-value {
    font-size: 21px;
  }
  .kop-surat {
    flex-direction: column;
    text-align: center;
    padding: 14px 12px;
    gap: 10px;
  }
  .form-grid,
  .gen-sem-grid {
    grid-template-columns: 1fr;
  }
  .card-header {
    padding: 12px 14px;
  }
  .card-body {
    padding: 12px 14px;
  }
  .auth-gate {
    padding: 14px;
    min-height: 100dvh;
  }
  .auth-card {
    padding: 22px 18px 20px;
    border-radius: 14px;
  }
  .gen-exec-actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}
