/* ============================================================
   Sistem PjBL SMK - Production UI
   Tema: sekolah modern, profesional, responsif
   ============================================================ */

:root {
  --primary: #0f3d5e;
  --primary-dark: #0a2a43;
  --primary-soft: #e8f2f7;
  --primary-glow: rgba(15, 61, 94, .14);
  --secondary: #2f7d59;
  --secondary-dark: #236241;
  --secondary-soft: #e9f7ef;
  --accent: #c47a1b;
  --accent-soft: #fff3df;
  --danger: #c2413a;
  --danger-soft: #fff0ef;
  --warning: #b7791f;
  --warning-soft: #fff8e7;
  --info: #256f9c;
  --info-soft: #e9f5fb;
  --violet: #6d5aa8;
  --violet-bg: #f1eefb;
  --success: #247a4d;
  --success-bg: #e9f7ef;
  --success-border: #bfe3cd;
  --warning-bg: #fff8e7;
  --warning-border: #f2d8a7;
  --danger-bg: #fff0ef;
  --danger-border: #edc3c0;
  --info-bg: #e9f5fb;
  --info-border: #b8dced;
  --brand: var(--primary);
  --brand-dark: var(--primary-dark);
  --brand-light: var(--primary-soft);
  --brand-glow: var(--primary-glow);

  --bg: #f5f7fa;
  --light: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #edf2f7;
  --border: #dfe7ef;
  --border-dark: #cbd5df;
  --text: #16202a;
  --text-2: #344256;
  --text-3: #607084;
  --text-4: #8695a6;

  --sidebar-bg: #122434;
  --sidebar-bg-2: #0d1b28;
  --sidebar-text: #c6d1dd;
  --sidebar-title: #ffffff;
  --sidebar-muted: #89a0b5;
  --sidebar-hover: rgba(255, 255, 255, .08);
  --sidebar-active: rgba(91, 154, 190, .18);
  --sidebar-border: rgba(255, 255, 255, .1);
  --sidebar-w: 268px;
  --header-h: 68px;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 8px;
  --shadow-xs: 0 1px 2px rgba(18, 36, 52, .05);
  --shadow-sm: 0 1px 3px rgba(18, 36, 52, .08);
  --shadow-md: 0 8px 24px rgba(18, 36, 52, .1);
  --shadow-lg: 0 20px 45px rgba(18, 36, 52, .18);
  --transition: all .18s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

img, svg {
  max-width: 100%;
  display: block;
}

.icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }
small { font-size: .78rem; }

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(232, 242, 247, .7), rgba(245, 247, 250, 0) 240px),
    var(--bg);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  border-right: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-lg);
  transition: transform .24s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .2);
  border-radius: 999px;
}

.sidebar-brand {
  padding: 22px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

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

.brand-logo,
.school-mark {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, #1c6f9e, #2f7d59);
  font-size: .86rem;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(15, 61, 94, .28);
}

.brand-logo .icon,
.school-mark .icon {
  width: 24px;
  height: 24px;
}

.brand-logo img,
.school-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.brand-text h2 {
  color: var(--sidebar-title);
  font-size: .95rem;
}

.brand-text p {
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: .73rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.avatar {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: #2f7d59;
  font-size: .85rem;
  font-weight: 800;
  object-fit: cover;
}

img.avatar {
  display: block;
}

.user-info { min-width: 0; }
.user-name {
  color: var(--sidebar-title);
  font-size: .84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: .72rem;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
}

.nav-section-title {
  padding: 14px 10px 7px;
  color: var(--sidebar-muted);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.nav-item + .nav-item {
  margin-top: 4px;
}

.nav-item a,
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: .87rem;
  font-weight: 650;
  transition: var(--transition);
}

.nav-item a:hover,
.sidebar-footer a:hover {
  color: #fff;
  background: var(--sidebar-hover);
  text-decoration: none;
}

.nav-item a.active {
  color: #fff;
  background: var(--sidebar-active);
  box-shadow: inset 3px 0 0 #6bb6d8;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 7px;
  color: #e7f1f7;
  background: rgba(255, 255, 255, .08);
  font-size: .66rem;
  font-weight: 800;
}

.nav-icon .icon {
  width: 16px;
  height: 16px;
}

.sidebar-footer {
  padding: 14px 12px 18px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer a {
  color: #ffd0cc;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  background: rgba(7, 18, 29, .52);
}

.sidebar-overlay.show {
  display: block;
}

.main-content {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: margin-left .24s ease;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

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

.page-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--text-4);
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb a {
  color: var(--text-3);
  font-weight: 700;
}

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

.notification-menu {
  position: relative;
}

.notification-trigger {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  background: var(--surface);
  transition: var(--transition);
}

.notification-trigger:hover,
.notification-menu.open .notification-trigger {
  color: var(--primary);
  border-color: var(--border-dark);
  background: var(--surface-2);
}

.notification-icon .icon {
  width: 18px;
  height: 18px;
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--danger);
}

.notification-dot.is-muted {
  display: none;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: 300px;
  max-height: calc(100vh - var(--header-h) - 24px);
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  scrollbar-width: thin;
}

.notification-menu.open .notification-dropdown {
  display: block;
}

.notification-dropdown-head {
  display: grid;
  gap: 2px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}

.notification-dropdown-head strong {
  color: var(--text);
  font-size: .86rem;
}

.notification-dropdown-head span,
.notification-empty {
  color: var(--text-4);
  font-size: .76rem;
  font-weight: 700;
}

.notification-empty {
  padding: 18px 14px;
  line-height: 1.45;
}

.notification-preview {
  display: grid;
  gap: 3px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  text-decoration: none !important;
}

.notification-preview:hover {
  color: var(--text);
  background: var(--surface-2);
}

.notification-preview.is-unread {
  background: #f2f8fb;
}

.notification-preview strong {
  color: var(--text);
  font-size: .8rem;
}

.notification-preview span {
  color: var(--text-3);
  font-size: .74rem;
  line-height: 1.35;
}

.notification-list {
  display: grid;
}

.notification-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none !important;
}

.notification-row:last-child {
  border-bottom: 0;
}

.notification-row:hover {
  background: var(--surface-2);
}

.notification-row.is-unread {
  background: #f2f8fb;
}

.notification-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
}

.notification-row.is-unread .notification-row-dot {
  background: var(--primary);
}

.notification-row-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.notification-row-body strong {
  font-size: .9rem;
  color: var(--text);
}

.notification-row-body span {
  color: var(--text-3);
  font-size: .82rem;
}

.notification-row-body small {
  color: var(--text-4);
  font-weight: 700;
}

.topbar-date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
  background: var(--surface-2);
  font-size: .78rem;
  font-weight: 700;
}

.topbar-date-icon .icon {
  width: 15px;
  height: 15px;
}

.account-menu {
  position: relative;
}

.account-trigger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
}

.account-trigger:hover,
.account-menu.open .account-trigger {
  border-color: var(--border-dark);
  background: var(--surface-2);
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: .72rem;
}

.account-summary {
  min-width: 0;
  display: grid;
  line-height: 1.15;
  text-align: left;
}

.account-name {
  max-width: 148px;
  overflow: hidden;
  color: var(--text);
  font-size: .8rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-role {
  color: var(--text-4);
  font-size: .68rem;
  font-weight: 750;
}

.account-caret {
  color: var(--text-3);
  transition: var(--transition);
}

.account-caret .icon {
  width: 15px;
  height: 15px;
}

.account-menu.open .account-caret {
  transform: rotate(180deg);
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: 232px;
  display: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.account-menu.open .account-dropdown {
  display: block;
}

.account-dropdown-head {
  display: grid;
  gap: 2px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}

.account-dropdown-head strong {
  overflow: hidden;
  color: var(--text);
  font-size: .84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dropdown-head span {
  color: var(--text-4);
  font-size: .74rem;
  font-weight: 700;
}

.account-dropdown-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 14px;
  color: var(--text-2);
  font-size: .84rem;
  font-weight: 800;
}

.account-dropdown-link:hover {
  color: var(--primary);
  background: var(--primary-soft);
  text-decoration: none;
}

.account-dropdown-link-danger {
  color: var(--danger);
}

.account-dropdown-link-danger:hover {
  color: #9f332e;
  background: var(--danger-soft);
}

.account-dropdown-link .icon {
  width: 17px;
  height: 17px;
}

.page-content {
  flex: 1;
  width: 100%;
  max-width: none;
  padding: 28px;
  animation: fadeSlideUp .22s ease both;
}

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

/* Header and dashboard */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header:has(> a.btn-outline.btn-sm) {
  align-items: center;
  justify-content: flex-start;
}

.page-header:has(> a.btn-outline.btn-sm) > a.btn-outline.btn-sm {
  order: -1;
}

.page-header h2 {
  font-size: 1.15rem;
}

.page-header p {
  color: var(--text-3);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

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

.stat-card {
  position: relative;
  min-height: 124px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-dark);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  font-size: .72rem;
  font-weight: 850;
}

.stat-icon .icon {
  width: 24px;
  height: 24px;
}

.stat-icon-blue { color: var(--primary); background: var(--primary-soft); }
.stat-icon-green { color: var(--secondary-dark); background: var(--secondary-soft); }
.stat-icon-yellow { color: var(--warning); background: var(--warning-soft); }
.stat-icon-red { color: var(--danger); background: var(--danger-soft); }
.stat-icon-cyan { color: var(--info); background: var(--info-soft); }
.stat-icon-purple { color: var(--violet); background: var(--violet-bg); }

.stat-value {
  color: var(--text);
  font-size: 1.85rem;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-label {
  margin-top: 7px;
  color: var(--text-3);
  font-size: .82rem;
  font-weight: 700;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  margin-top: 9px;
  color: var(--text-4);
  font-size: .74rem;
  font-weight: 700;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Cards */
.card,
.action-card,
.progres-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card {
  overflow: hidden;
}

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

.card-header h3 {
  font-size: .96rem;
}

.card-body {
  padding: 18px;
}

.card-footer {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.action-card {
  display: flex;
  flex-direction: column;
  min-height: 176px;
  padding: 18px;
  color: var(--text);
  transition: var(--transition);
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-dark);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.action-card .action-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--primary);
  background: var(--primary-soft);
  font-size: .7rem;
  font-weight: 850;
}

.action-card .action-icon .icon {
  width: 20px;
  height: 20px;
}

.action-card h4 {
  margin-top: 12px;
}

.action-card p {
  margin-top: 7px;
  color: var(--text-3);
  font-size: .84rem;
}

/* Tables */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

thead th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  background: var(--surface-2);
  font-size: .72rem;
  font-weight: 850;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  letter-spacing: 0;
}

tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfdff;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge-success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.badge-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.badge-info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.badge-secondary { color: var(--text-3); background: var(--surface-3); border-color: var(--border); }
.badge-primary { color: var(--primary); background: var(--primary-soft); border-color: #c4dce8; }
.badge-violet { color: var(--violet); background: var(--violet-bg); border-color: #d9d2ef; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none !important;
  transition: var(--transition);
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: .68;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-sm { min-height: 34px; padding: 7px 13px; font-size: .78rem; }
.btn-xs { min-height: 30px; padding: 6px 10px; font-size: .73rem; }
.btn-lg { min-height: 44px; padding: 11px 20px; font-size: .9rem; }

.btn-primary { color: #fff; background: var(--primary); }
.btn-primary:hover { color: #fff; background: var(--primary-dark); }
.btn-success { color: #fff; background: var(--secondary); }
.btn-success:hover { color: #fff; background: var(--secondary-dark); }
.btn-warning { color: #fff; background: var(--accent); }
.btn-warning:hover { color: #fff; background: #a96112; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-danger:hover { color: #fff; background: #9f332e; }
.btn-secondary { color: #fff; background: #4a5968; }
.btn-secondary:hover { color: #fff; background: #334150; }
.btn-info { color: #fff; background: var(--info); }
.btn-info:hover { color: #fff; background: #1e5d83; }
.btn-outline {
  color: var(--text-2);
  background: var(--surface);
  border-color: var(--border-dark);
}
.btn-outline:hover {
  color: var(--text);
  background: var(--surface-2);
}
.btn-outline-primary {
  color: var(--primary);
  background: var(--surface);
  border-color: #b7d3e2;
}
.btn-outline-primary:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
}
.btn:focus-visible,
.form-control:focus-visible {
  outline: 3px solid var(--primary-glow);
  outline-offset: 2px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-2);
  font-size: .83rem;
  font-weight: 800;
}

.form-label .req {
  margin-left: 3px;
  color: var(--danger);
}

.form-control {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  font-size: .84rem;
  transition: var(--transition);
}

.form-control:focus {
  border-color: #78aeca;
  outline: 0;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-control:disabled {
  color: var(--text-4);
  background: var(--surface-3);
  cursor: not-allowed;
}

.form-control::placeholder {
  color: var(--text-4);
}

textarea.form-control {
  min-height: 112px;
  resize: vertical;
}

select.form-control {
  padding-right: 36px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='%23607084'%3E%3Cpath d='M5.3 7.8a1 1 0 0 1 1.4 0L10 11.1l3.3-3.3a1 1 0 1 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-text {
  margin-top: 6px;
  color: var(--text-4);
  font-size: .76rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.form-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.form-actions .btn-outline { order: 1; }
.form-actions .btn:not(.btn-outline) { order: 2; }

.message-actions {
  justify-content: flex-end;
  border-top: 0;
  padding-top: 6px;
}

.action-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 300px;
}

.action-list .btn {
  min-width: 68px;
  justify-content: center;
}

.matrix-card .card-header {
  align-items: flex-start;
}

.matrix-card .card-header p {
  margin-top: 4px;
}

.matrix-editor {
  display: grid;
  gap: 12px;
}

.matrix-row {
  display: grid;
  grid-template-columns: 34px minmax(160px, 1.1fr) minmax(240px, 1.7fr) 110px 100px auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.matrix-row-number {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 800;
  font-size: .8rem;
}

.matrix-field {
  min-width: 0;
}

.matrix-field textarea {
  min-height: 74px;
  resize: vertical;
}

.matrix-row-action {
  padding-top: 26px;
}

.matrix-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
}

.matrix-total strong {
  color: var(--primary);
  font-size: 1rem;
}

.profile-edit-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.profile-edit-photo,
.school-edit-logo {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.profile-edit-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  font-size: 1.4rem;
  font-weight: 850;
}

.school-edit-logo {
  border-radius: var(--radius);
  object-fit: contain;
  padding: 8px;
}

.school-edit-logo-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.school-edit-logo-empty .icon {
  width: 34px;
  height: 34px;
}

.profile-page-shell,
.settings-page-shell {
  width: min(100%, 980px);
  margin: 0 auto;
}

.profile-hero,
.school-identity-card {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 20px;
}

.profile-hero-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--surface-2);
}

.profile-hero-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  font-size: 2rem;
  font-weight: 850;
}

.profile-hero-body,
.school-identity-body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.profile-hero-name,
.school-identity-name {
  color: var(--text);
  font-size: 1.18rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.profile-hero-meta,
.school-identity-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: start;
}

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

.info-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.info-item-full {
  grid-column: 1 / -1;
}

.info-label {
  margin-bottom: 4px;
  color: var(--text-4);
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.info-value {
  color: var(--text);
  font-size: .88rem;
  font-weight: 750;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.check-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
}

.check-option:hover {
  border-color: var(--border-dark);
  background: var(--surface-2);
}

.check-option input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.check-option span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.check-option strong {
  color: var(--text);
  font-size: .84rem;
}

.check-option small {
  color: var(--text-4);
  font-size: .74rem;
  line-height: 1.35;
}

/* Alerts */
.alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: .84rem;
  font-weight: 650;
  animation: slideDown .2s ease both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: var(--text-3);
  font-size: .78rem;
  line-height: 1;
}

.alert-success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.alert-error,
.alert-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.alert-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.alert-info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.alert-success .alert-icon { background: var(--success); }
.alert-error .alert-icon,
.alert-danger .alert-icon { background: var(--danger); }
.alert-warning .alert-icon { background: var(--warning); }
.alert-info .alert-icon { background: var(--info); }

/* Filters */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar form {
  display: flex !important;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap !important;
  width: 100%;
}

.filter-bar .form-control {
  max-width: 100%;
}

.filter-bar select.form-control {
  min-width: 170px;
}

.search-input {
  display: flex;
  align-items: stretch;
  width: min(100%, 560px);
  flex: 1 1 480px;
  overflow: hidden;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: var(--transition);
}

.search-input:focus-within {
  border-color: #78aeca;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-input input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 9px 12px;
  color: var(--text);
  background: transparent;
  font-size: .84rem;
}

.search-input button {
  min-width: 42px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

/* Modals */
body.modal-open {
  overflow: hidden;
}

.app-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 18, 29, .58);
}

.app-modal-overlay.show {
  display: flex;
}

.app-modal-dialog {
  width: min(100%, 920px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.app-modal-dialog.app-modal-confirm {
  width: min(100%, 430px);
}

.app-modal-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.app-modal-title {
  color: var(--text);
  font-size: .98rem;
  font-weight: 850;
}

.app-modal-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.app-modal-close:hover {
  color: var(--text);
  background: var(--surface-3);
}

.app-modal-close .icon {
  width: 17px;
  height: 17px;
}

.app-modal-frame {
  width: 100%;
  min-height: 560px;
  flex: 1;
  border: 0;
  background: var(--surface);
}

.app-modal-body {
  padding: 18px;
  color: var(--text-2);
  font-size: .9rem;
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 18px 18px;
}

.layout-embed {
  min-height: auto;
  background: var(--surface);
}

.layout-embed .page-content-embed {
  max-width: none;
  padding: 18px;
  animation: none;
}

.layout-embed .page-header {
  display: none;
}

.layout-embed .card {
  max-width: none !important;
  box-shadow: none;
}

.layout-embed .card:first-of-type {
  margin-top: 0;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15, 61, 94, .9), rgba(47, 125, 89, .88)),
    linear-gradient(180deg, #0d2232, #17384e);
}

.login-shell {
  width: min(100%, 1040px);
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-compact-shell {
  width: min(100%, 860px);
  min-height: 520px;
  grid-template-columns: .9fr 1.1fr;
}

.login-identity {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(18, 36, 52, .45), rgba(18, 36, 52, .78)),
    linear-gradient(135deg, #12334b, #205b62 55%, #2f7d59);
}

.login-identity .school-mark {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: none;
}

.eyebrow {
  color: inherit;
  opacity: .76;
  font-size: .76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.login-identity .eyebrow {
  margin-top: 26px;
}

.login-identity h1 {
  max-width: 520px;
  margin-top: 8px;
  color: #fff;
  font-size: 2.3rem;
}

.login-copy {
  max-width: 560px;
  margin-top: 14px;
  color: rgba(255, 255, 255, .86);
  font-size: .98rem;
}

.login-points {
  display: grid;
  gap: 12px;
  margin-top: 34px;
}

.login-points div {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .08);
}

.login-points span {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: #12334b;
  background: #fff;
  font-size: .75rem;
  font-weight: 850;
}

.login-points strong {
  color: #fff;
  font-size: .88rem;
}

.login-points small {
  margin-top: 2px;
  color: rgba(255, 255, 255, .76);
  line-height: 1.45;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 44px;
  background: var(--surface);
}

.login-form-header {
  margin-bottom: 28px;
}

.login-form-header .eyebrow {
  color: var(--primary);
  opacity: 1;
}

.login-form-header h2 {
  margin-top: 6px;
  font-size: 1.45rem;
}

.login-form-header p {
  margin-top: 8px;
  color: var(--text-3);
  font-size: .9rem;
}

.auth-form .form-control {
  min-height: 46px;
}

.btn-login {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.login-assurance {
  display: grid;
  gap: 3px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--info-border);
  border-radius: var(--radius);
  color: var(--info);
  background: var(--info-bg);
  font-size: .82rem;
}

.login-assurance span {
  color: #33657d;
}

.login-form-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-4);
  font-size: .78rem;
  text-align: center;
}

/* Chat and detail surfaces */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 76%;
  padding: 11px 13px;
  border-radius: var(--radius);
  font-size: .84rem;
  line-height: 1.55;
}

.chat-bubble.sent {
  margin-left: auto;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #c4dce8;
}

.chat-bubble.received {
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.chat-bubble .bubble-name {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 850;
}

.chat-bubble .bubble-time {
  margin-top: 6px;
  color: var(--text-4);
  font-size: .68rem;
  text-align: right;
}

.progres-item {
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.progres-item:hover {
  border-color: var(--border-dark);
  box-shadow: var(--shadow-sm);
}

.progres-date {
  color: var(--text-4);
  font-size: .74rem;
  font-weight: 800;
}

.feedback-box {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
  background: var(--success-bg);
}

.feedback-box .feedback-label {
  margin-bottom: 4px;
  color: var(--success);
  font-size: .72rem;
  font-weight: 850;
}

.nilai-besar {
  color: var(--primary);
  font-size: 3rem;
  font-weight: 850;
  line-height: 1;
}

.nilai-label {
  color: var(--text-3);
  font-size: .78rem;
}

.nilai-table tbody td:first-child {
  font-weight: 750;
}

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

.empty-state .empty-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border-radius: var(--radius);
  color: var(--primary);
  background: var(--primary-soft);
  font-size: .75rem;
  font-weight: 850;
}

.empty-state .empty-icon:empty {
  display: none;
}

.empty-state h4 {
  margin-bottom: 4px;
  color: var(--text-3);
  font-size: .92rem;
}

.empty-state p {
  font-size: .84rem;
}

/* Utilities */
.divider { height: 1px; margin: 20px 0; background: var(--border); }
.text-muted { color: var(--text-4); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.fw-bold { font-weight: 800; }
.fw-semibold { font-weight: 700; }
.fs-sm { font-size: .82rem; }
.fs-xs { font-size: .74rem; }

.hamburger {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.hamburger:hover {
  background: var(--surface-3);
}

.hamburger span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: var(--transition);
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (min-width: 821px) {
  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-collapsed .main-content {
    margin-left: 0;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 252px;
  }

  .page-content {
    padding: 22px;
  }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .topbar {
    min-height: 62px;
    padding: 0 16px;
  }

  .topbar-date,
  .account-summary {
    display: none;
  }

  .topbar-right {
    gap: 8px;
  }

  .account-trigger {
    min-height: 38px;
    padding: 3px 7px 3px 4px;
  }

  .page-content {
    padding: 16px;
  }

  .app-modal-overlay {
    align-items: stretch;
    padding: 10px;
  }

  .app-modal-dialog {
    width: 100%;
    max-height: calc(100vh - 20px);
  }

  .app-modal-frame {
    min-height: 0;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .login-page {
    align-items: flex-start;
    padding: 16px;
  }

  .login-shell {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .login-identity {
    padding: 34px 28px;
  }

  .login-identity h1 {
    font-size: 1.8rem;
  }

  .login-points {
    display: none;
  }

  .login-panel {
    padding: 34px 28px;
  }
}

@media (max-width: 560px) {
  :root {
    --header-h: 58px;
    --sidebar-w: 244px;
  }

  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.18rem; }
  h3 { font-size: 1rem; }

  .topbar {
    padding: 0 12px;
  }

  .breadcrumb {
    display: none;
  }

  .account-dropdown {
    right: -4px;
    width: min(88vw, 232px);
  }

  .notification-dropdown {
    right: -52px;
    width: min(92vw, 300px);
  }

  .page-content {
    padding: 12px;
  }

  .filter-bar form,
  .search-input {
    width: 100%;
  }

  .search-input {
    flex-basis: 100%;
  }

  .page-header {
    align-items: stretch;
  }

  .stat-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    min-height: 112px;
    padding: 16px;
  }

  .card-header,
  .card-body {
    padding: 14px;
  }

  .profile-hero,
  .school-identity-card {
    align-items: flex-start;
    padding: 16px;
  }

  .profile-hero-avatar {
    width: 72px;
    height: 72px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn,
  .page-header > .btn,
  .btn-login {
    width: 100%;
  }

  .action-list {
    max-width: none;
  }

  .matrix-row {
    grid-template-columns: 32px 1fr;
  }

  .matrix-field,
  .matrix-row-action {
    grid-column: 1 / -1;
  }

  .matrix-row-action {
    padding-top: 0;
  }

  table {
    min-width: 720px;
    font-size: .8rem;
  }

  .login-page {
    padding: 10px;
  }

  .login-identity,
  .login-panel {
    padding: 26px 20px;
  }

  .login-copy {
    font-size: .9rem;
  }

  .chat-bubble {
    max-width: 92%;
  }
}
