:root {
  --app-sidebar-width: 300px;
  --app-sidebar-mini-width: 78px;
  
  /* Claude Style Colors */
  --app-bg: #F8F7F5; /* Warm off-white */
  --app-surface: #FFFFFF;
  --app-border: #E5E3E0;
  --app-text: #2D2D2D; /* Charcoal/Off-black */
  --app-text-muted: #73716E;
  
  --accent: #24201E; /* Dark charcoal/black for primary actions */
  --accent-light: #EFECE6;
  --danger-light: #FCE8E6;
  --success-light: #E6F4EA;
  --warning-light: #FEF7E0;
  --info-light: #E8F0FE;

  --radius: 12px; /* Slightly softer corners */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.02);
  
  --bs-body-bg: #F8F7F5;
  --bs-body-color: #2D2D2D;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--app-text);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #D3D1CD transparent;
}

*::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #c9d2e6;
  border-radius: 0;
}

*::-webkit-scrollbar-thumb:hover {
  background: #aebad3;
}

*::-webkit-scrollbar-button,
*::-webkit-scrollbar-corner {
  width: 0;
  height: 0;
  display: none;
  background: transparent;
}

.sidebar-open .sidebar {
  transform: translateX(0);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1030;
  background: rgba(15, 23, 42, 0.35);
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sidebar-open .sidebar-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

body.sidebar-open {
  overflow: hidden;
}

body.app-layout {
  min-height: 100vh;
  background: var(--app-bg); /* Clean flat background */
}

/* Layout */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1035;
  width: min(88vw, var(--app-sidebar-width));
  height: 100vh;
  transform: translateX(-100%);
  background: var(--app-bg); /* Sidebar blends with background */
  border-right: 1px solid var(--app-border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px;
  padding: 0 !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--app-border) !important;
  background: var(--app-surface) !important;
  color: var(--app-text-muted) !important;
  box-shadow: var(--shadow-sm);
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
}

.menu-toggle-btn:hover,
.menu-toggle-btn:focus {
  background: var(--app-bg) !important;
  border-color: #D3D1CD !important;
  color: var(--app-text) !important;
}

.sidebar-desktop-toggle-icon {
  display: block;
}

.mini-sidebar-tooltip {
  position: fixed;
  z-index: 1070;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  opacity: 0;
  padding: 0.38rem 0.58rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.35);
}

.mini-sidebar-tooltip::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  width: 9px;
  height: 9px;
  transform: translateY(-50%) rotate(45deg);
  background: rgba(15, 23, 42, 0.94);
  border-radius: 2px;
}

.mini-sidebar-tooltip.show {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.sidebar-header {
  padding: 1.05rem 1.1rem;
  border-bottom: 1px solid var(--app-border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--app-text);
  text-decoration: none;
  font-family: "Merriweather", "Georgia", serif; /* Elegant serif for logo */
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  transition: all 0.3s ease;
}

.sidebar-logo-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-school {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--app-text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-text-muted);
  margin: 0.75rem 0 0.35rem;
  padding: 0 0.45rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--app-text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  padding: 6px 8px 6px 12px;
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
  transition: all 0.2s ease;
}

.nav-link svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  stroke-width: 1.5;
}

.nav-link:hover {
  background: #EAE6DF;
  color: var(--app-text);
}

.nav-link.active {
  background: var(--app-surface);
  color: var(--app-text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--app-border);
}

.sidebar-footer {
  padding: 0.95rem;
  border-top: 1px solid var(--app-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 991.98px) {
  .sidebar {
    overflow-y: auto;
  }

  .sidebar-nav {
    flex: 0 0 auto;
    overflow-y: visible;
  }

  .sidebar-footer {
    margin-top: 0;
  }
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.user-avatar {
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--app-text);
  color: var(--app-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 700;
}

.user-role {
  font-size: 0.74rem;
  color: var(--app-text-muted);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid var(--app-border);
  color: var(--app-text);
  background: var(--app-surface);
  padding: 6px;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: #F4EAE9;
  color: #B23B4E;
  border-color: #E6C8CB;
}

.main {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.page-header {
  background: var(--app-bg);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: 4.5rem;
}

.page-title {
  margin: 0;
  font-family: "Merriweather", "Georgia", serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--app-text);
  letter-spacing: -0.01em;
}

.page-content {
  padding: 0 1.5rem 1.5rem 1.5rem;
  flex: 1;
  min-height: 0;
  background: var(--app-bg);
}

/* Forms and tables */
.form-group {
  margin-bottom: 0.85rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.89rem;
  font-weight: 700;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  border: 1px solid #dce1ec;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  background: var(--app-surface);
  color: var(--app-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  border-radius: 4px;
  margin-right: -2px;
  padding: 2px;
  transition: background 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background: rgba(65, 84, 241, 0.08);
}

select,
.form-select {
  border-radius: var(--radius);
  padding-right: 2.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235c6f91' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 0.68rem center;
  background-size: 10px 6px;
  background-repeat: no-repeat;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: #D3D1CD;
  box-shadow: 0 0 0 0.15rem rgba(0, 0, 0, 0.05);
}

/* Locked fields: tampil jelas sebagai non-interaktif */
input[readonly],
input:disabled,
select:disabled,
textarea[readonly],
textarea:disabled {
  background: #e2e8f0 !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
  border-style: dashed;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

select:disabled,
.form-select:disabled {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237f93b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input[readonly]:focus,
input:disabled:focus,
select:disabled:focus,
textarea[readonly]:focus,
textarea:disabled:focus {
  border-color: #cbd5e1 !important;
  box-shadow: none !important;
}

select:disabled {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: none !important;
  padding-right: 0.62rem !important;
}

.form-select:disabled {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: none !important;
  padding-right: 0.62rem !important;
}

.locked-input {
  background: #e2e8f0 !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
  border-style: dashed;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.form-row,
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: #f6f9ff;
  border-bottom: 1px solid var(--app-border);
  padding: 0.6rem 0.75rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
}

.table-sort-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  transition: color 0.18s ease;
}

.table-sort-trigger:hover {
  color: #4154f1;
}

.table-sort-label {
  text-align: left;
}

.table-sort-arrows {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  color: #c6cfdf;
  opacity: 0.52;
  flex-shrink: 0;
  transform: translateY(-0.5px);
  transition: opacity 0.18s ease, color 0.18s ease;
}

.table-sort-arrows .single {
  width: 10px;
  height: 10px;
  display: block;
  transition: transform 0.18s ease;
}

.table-sort-arrows .single path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-sort-trigger[data-direction='asc'] .table-sort-arrows {
  color: #4154f1;
  opacity: 1;
}

.table-sort-trigger[data-direction='asc'] .table-sort-arrows .single {
  transform: rotate(0deg);
}

.table-sort-trigger[data-direction='desc'] .table-sort-arrows {
  color: #4154f1;
  opacity: 1;
}

.table-sort-trigger[data-direction='desc'] .table-sort-arrows .single {
  transform: rotate(180deg);
}

tbody td {
  border-bottom: 1px solid #eef2f7;
  padding: 0.62rem 0.75rem;
}

tbody tr:hover {
  background: #f9fbff;
}

/* User actions container: transparent for cleaner look */
.user-actions-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

@media (max-width: 768px) {
  .user-actions-container {
    gap: 4px;
    padding: 3px 5px;
    flex-wrap: nowrap;
  }

  .user-actions-container .btn.btn-sm {
    padding-left: 0.72rem !important;
    padding-right: 0.72rem !important;
  }
}

/* Cards and stats */
.card {
  border-radius: var(--radius);
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  padding: 1rem 1.25rem;
}

.card-title {
  font-size: 1.08rem;
  font-weight: 700;
}

.card-body {
  padding: 1rem;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: #fff;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.95rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-icon.amber {
  background: #fff7d1;
}

.stat-icon.blue {
  background: #edf2ff;
}

.stat-icon.green {
  background: #ecfbf3;
}

.stat-icon.red {
  background: #fff1f3;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  margin-top: 0.2rem;
  color: var(--app-text-muted);
  font-size: 0.92rem;
}

@media (max-width: 576px) {
  .stat-card {
    padding: 0.75rem 0.6rem;
    gap: 0.5rem;
  }

  .stat-icon {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 1.1rem;
    border-radius: var(--radius);
  }

  .stat-value {
    font-size: 1.45rem;
  }

  .stat-label {
    font-size: 0.78rem;
    margin-top: 0.1rem;
  }
}

/* Alerts, badges, empty state */
.alert {
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.alert-success {
  border-color: #d1f0df;
  background: #f0fbf5;
  color: #127b42;
}

.alert-danger {
  border-color: #ffd8de;
  background: #fff3f5;
  color: #b4234f;
}

/* ---- Flash notifications in centered modal ---- */
.flash-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.flash-modal-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.68rem 0.78rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.flash-modal-icon {
  flex: 0 0 auto;
  margin-top: 1px;
}

.flash-success {
  background: #f0fbf5;
  color: #127b42;
  border: 1px solid #d1f0df;
}

.flash-danger {
  background: #fff3f5;
  color: #b4234f;
  border: 1px solid #ffd8de;
}

.flash-warning {
  background: #fff9ec;
  color: #9a5800;
  border: 1px solid #ffe1ad;
}

.flash-info {
  background: #eef6ff;
  color: #1e4f95;
  border: 1px solid #cfe1fb;
}

.badge {
  border-radius: var(--radius);
  padding: 0.26rem 0.64rem;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-amber {
  background: #fff8e6;
  color: #9a5600;
  border-color: #f4e0ab;
}

.badge-blue {
  background: #eef4ff;
  color: #1e56d9;
  border-color: #d7e3ff;
}

.badge-green {
  background: #eefbf3;
  color: #146f3a;
  border-color: #cdeed8;
}

.badge-red {
  background: #fff0f3;
  color: #a71826;
  border-color: #f4cbd4;
}

.badge-purple {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.badge-gray {
  background: #f3f5f8;
  color: #556273;
  border-color: #dbe2ea;
}

.badge-BB {
  background: #fff0f3;
  color: #a71826;
  border-color: #f4cbd4;
}

.badge-MB {
  background: #fff8e6;
  color: #9a5600;
  border-color: #f4e0ab;
}

.badge-BSH {
  background: #eef4ff;
  color: #1e56d9;
  border-color: #d7e3ff;
}

.badge-SB {
  background: #eefbf3;
  color: #146f3a;
  border-color: #cdeed8;
}

.empty-state {
  padding: 1.7rem 1rem;
  text-align: center;
  color: var(--app-text-muted);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.45rem;
}

.empty-state-title {
  color: var(--app-text);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

/* Modal — override Bootstrap's .modal { display:none; position:fixed; width/height:100% } */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1060;
  background: rgba(15, 23, 42, 0.35);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

/* Selector lebih spesifik agar mengalahkan Bootstrap */
.modal-overlay .modal {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: min(100%, 560px) !important;
  height: auto !important;
  max-height: 90vh;
  display: block !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  outline: none;
  z-index: auto !important;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--app-border);
  box-shadow: var(--shadow-md);
}

.modal-overlay .modal-header,
.modal-overlay .modal-footer {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--app-border);
  border-radius: 0;
}

.modal-overlay .modal-header {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
}

.modal-overlay .modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.modal-overlay .modal-body {
  padding: 1rem;
}

.modal-overlay .modal-footer {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  display: flex !important;
  gap: 0.85rem;
  justify-content: flex-end;
  padding: 0.25rem 1.25rem 1.5rem;
}

.modal-overlay .modal-footer .btn {
  border-radius: var(--radius) !important;
  padding: 0.32rem 1.4rem !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1.2;
}

.modal-overlay .modal-footer .btn-primary {
  background-color: #4154f1 !important;
  border-color: #4154f1 !important;
  box-shadow: 0 4px 12px rgba(65, 84, 241, 0.2) !important;
}

.modal-overlay .modal-footer .btn-primary:hover {
  background-color: #2e3ed1 !important;
  border-color: #2e3ed1 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(65, 84, 241, 0.3) !important;
}

.modal-overlay .modal-footer .btn-ghost,
.modal-overlay .modal-footer .btn-outline-secondary {
  background-color: #f6f9ff !important;
  color: #4154f1 !important;
  border: 1px solid #d7deea !important;
}

.modal-overlay .modal-footer .btn-ghost:hover,
.modal-overlay .modal-footer .btn-outline-secondary:hover {
  background-color: #f0f4ff !important;
  border-color: #c7d4f6 !important;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  color: #64748b;
}

.modal-close:hover {
  color: #0f172a;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: #899bbd;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.search-wrapper .search-icon svg {
  width: 100%;
  height: 100%;
}

.search-wrapper input {
  padding-left: 32px !important;
}

/* Filters and utilities */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;

  width: fit-content;
  max-width: 100%;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  width: auto;
  min-width: 32px;
}

.filter-bar>input,
.filter-bar>select,
.filter-bar>.btn,
.filter-bar>a.btn,
.filter-bar>.search-wrapper {
  min-height: 30px;
}

.filter-bar>input,
.filter-bar>select,
.filter-bar>.search-wrapper input {
  border-radius: var(--radius);
}

.filter-bar .search-wrapper input,
.filter-bar>select {
  height: 34px;
  padding: 0 0.78rem !important;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid #d8e1f0;
  border-radius: var(--radius);
  background-color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  color: #334155;
  transition: all 0.2s;
}

.filter-bar .search-wrapper input {
  padding-left: 2.1rem !important;
}

.filter-bar>select {
  padding-right: 2.1rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235c6f91' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 0.75rem center;
  background-size: 10px 6px;
  background-repeat: no-repeat;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

.filter-bar .search-wrapper input:focus,
.filter-bar>select:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-bar>select:disabled {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237f93b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.filter-bar>input[type="text"]:focus,
.filter-bar>input[type="search"]:focus,
.filter-bar>input[type="number"]:focus,
.filter-bar>select:focus {
  border-color: #9db5ff;
  box-shadow: 0 0 0 0.18rem rgba(65, 84, 241, 0.11);
}

.filter-bar>input[readonly],
.filter-bar>input:disabled,
.filter-bar>select:disabled,
.filter-bar>.locked-input {
  background: #eef4ff !important;
  color: #49658b !important;
  border: 1px solid #d7e3ff !important;
  border-style: solid !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.filter-bar>.btn,
.filter-bar>a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding-inline: 0.9rem;
  font-size: 0.78rem;
  line-height: 1;
}

.filter-bar>.btn.btn-primary,
.filter-bar>a.btn.btn-primary {
  min-height: 30px;
  border-radius: var(--radius);
  box-shadow: 0 3px 8px rgba(47, 68, 221, 0.16);
}

.filter-bar>input[name="q"],
.filter-bar>input[placeholder*="Cari"],
.filter-bar>input[placeholder*="cari"] {
  min-width: 190px;
}

.auto-submit-loading {
  position: absolute;
  inset: 0;
  z-index: 10000;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.auto-submit-loading.show {
  opacity: 1;
  pointer-events: auto;
}

.auto-submit-loading-box {
  position: sticky;
  top: 50vh;
  width: max-content;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #c7ddff;
  color: #123a8f;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 1rem 1.5rem;
  box-shadow: 0 10px 30px rgba(1, 41, 112, 0.1);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transform: translateY(-50%) scale(0.95);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.auto-submit-loading.show .auto-submit-loading-box {
  transform: translateY(-50%) scale(1);
}

.auto-submit-spinner {
  width: 0.78rem;
  height: 0.78rem;
  border-radius: 50%;
  border: 2px solid #9abefd;
  border-top-color: #265ad8;
  animation: autoSubmitSpin 0.7s linear infinite;
}

@keyframes autoSubmitSpin {
  to {
    transform: rotate(360deg);
  }
}

.nilai-input {
  width: 74px;
  text-align: center;
}

.divider {
  height: 1px;
  background: var(--app-border);
  margin: 1rem 0;
}

.flex {
  display: flex;
  align-items: center;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 1px;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.mb-3 {
  margin-bottom: 0.75rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-5 {
  margin-bottom: 1.25rem;
}

.text-sm {
  font-size: 0.83rem;
}

.text-muted {
  color: var(--app-text-muted);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.w-full {
  width: 100%;
}

.btn {
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.82rem;
  /* padding: 5px; */
  /* line-height: 1.1; */
  box-shadow: 0 4px 10px rgba(37, 62, 122, 0.08);
  /* border: 1px solid transparent; */
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 14px rgba(37, 62, 122, 0.12);
  filter: saturate(1.03);
}

.btn-sm {
  font-size: 0.76rem;
  padding: 0.24rem 0.58rem;
  min-height: 28px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background: #403A36 !important;
  border-color: #403A36 !important;
}

.btn-secondary {
  background: var(--app-surface);
  color: var(--app-text);
  border-color: var(--app-border);
}

.btn-secondary:hover {
  background: #F4F3F1;
  color: var(--app-text);
  border-color: #D3D1CD;
}

.btn-ghost {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #d8e0ee;
  color: #475569;
}

.btn-ghost:hover {
  background: #f6f9ff;
}

.btn-danger {
  background: linear-gradient(180deg, #ffffff 0%, #fff7f9 100%);
  color: #c92b4b;
  border-color: #f1c8d2;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
  background: linear-gradient(180deg, #fff5f8 0%, #ffedf1 100%) !important;
  color: #a71d3c !important;
  border-color: #ebb7c3 !important;
}

/* Modal Footer Custom Pill Style */
.modal-footer {
  border-top: none !important;
  padding: 0 1.5rem 1.5rem !important;
  display: flex !important;
  justify-content: flex-end !important;
  background: transparent !important;
}

/* Wrapper inside modal footer (simulated via footer itself or CSS magic) */
/* Since we want a pill container around buttons, we can style the footer itself if we constrain it */
.modal-footer {
  display: flex !important;
  justify-content: flex-end !important;
}

/* Let's try a different approach: style the footer as a flex container that holds the 'pill' */
/* But since we can't change HTML easily, we'll make the footer behave like the pill container for its children */
.modal-footer {
  display: inline-flex !important;
  float: right;
  /* Fallback */
  width: auto !important;
  margin: 0 1.5rem 1.5rem auto !important;
  padding: 4px 6px !important;
  background: #fff !important;
  border: 1px solid #dbe3fb !important;
  border-radius: var(--radius) !important;
  gap: 5px !important;
  box-shadow: 0 4px 12px rgba(37, 62, 122, 0.08) !important;
}

.modal-content {
  overflow: hidden;
}

.modal-footer .btn {
  margin: 0 !important;
  border-radius: var(--radius) !important;
  padding: 0 15px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  height: 30px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent !important;
}

.modal-footer .btn-secondary,
.modal-footer .btn-ghost {
  background: #fff !important;
  color: #3b5bdb !important;
  border-color: #dbe3fb !important;
}

.modal-footer .btn-secondary:hover,
.modal-footer .btn-ghost:hover {
  background: #f0f4ff !important;
  border-color: #c7d4f6 !important;
}

.modal-footer .btn-primary {
  background: linear-gradient(135deg, #4154f1 0%, #2a3eb1 100%) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 10px rgba(65, 84, 241, 0.2) !important;
}

.modal-footer .btn-danger {
  background: #fff !important;
  color: #d63031 !important;
  border-color: #fab1a0 !important;
}

.modal-footer .btn-danger:hover {
  background: #fff5f5 !important;
  border-color: #ff7675 !important;
}

/* Pengguna: samakan ukuran tombol aksi agar konsisten di semua layar */
.user-actions-cell {
  white-space: nowrap;
}

.user-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.user-action-form {
  margin: 0;
  display: inline-flex;
}

.user-action-btn {
  min-width: 88px;
  height: 36px;
  padding: 0 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--app-bg);
}

.login-card {
  width: min(100%, 420px);
  border-radius: var(--radius);
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  box-shadow: var(--shadow-sm);
  padding: 2rem 1.75rem;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.2rem;
}

.login-logo-icon {
  width: 3.3rem;
  height: 3.3rem;
  border-radius: var(--radius);
  margin: 0 auto 0.65rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
}

.login-title {
  font-family: "Merriweather", "Georgia", serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--app-text);
  letter-spacing: -0.01em;
}

.login-subtitle {
  margin-top: 0.2rem;
  color: var(--app-text-muted);
  font-size: 0.83rem;
}

/* Raport preview */
.raport-page {
  background: #fff;
  border: 1px solid #eef1f8;
  border-radius: var(--radius);
  max-width: 780px;
  margin: 0 auto;
  padding: 1.6rem;
}

.raport-header {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  border-bottom: 3px double #475569;
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
}

.raport-school-name {
  font-size: 1rem;
  font-weight: 700;
}

.raport-school-sub {
  font-size: 0.75rem;
  color: #64748b;
}

.raport-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 0.95rem 0 0.85rem;
  text-transform: uppercase;
}

.raport-info-table,
.raport-nilai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.raport-info-table td {
  padding: 0.14rem 0;
  vertical-align: top;
}

.raport-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #f1f5f9;
  padding: 0.32rem 0.55rem;
  margin-top: 0.8rem;
}

.raport-nilai-table th,
.raport-nilai-table td {
  border: 1px solid #b8c1cc;
  padding: 0.3rem 0.45rem;
}

.raport-nilai-table td.center {
  text-align: center;
}

@media (min-width: 768px) {
  .page-header {
    padding: 1rem 1.4rem;
  }

  .page-content {
    padding: 1.25rem 1.4rem;
  }

  .grid-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  body.app-layout {
    display: grid;
    grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar {
    position: sticky;
    top: 0;
    left: auto;
    width: var(--app-sidebar-width);
    height: 100vh;
    height: 100dvh;
    transform: none;
    z-index: 1025;
  }

  .sidebar-backdrop,
  #sidebarToggle {
    display: none !important;
  }

  body.app-layout.sidebar-collapsed {
    grid-template-columns: var(--app-sidebar-mini-width) minmax(0, 1fr);
  }

  body.app-layout.sidebar-collapsed .sidebar {
    width: var(--app-sidebar-mini-width);
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  body.app-layout.sidebar-collapsed .sidebar-desktop-toggle-icon {
    transform: rotate(180deg);
  }

  body.app-layout.sidebar-collapsed .sidebar-header {
    padding: 0.9rem 0.5rem;
  }

  body.app-layout.sidebar-collapsed .sidebar-logo {
    justify-content: center;
    gap: 0;
    font-size: 0;
  }

  body.app-layout.sidebar-collapsed .sidebar-school,
  body.app-layout.sidebar-collapsed .nav-section-title,
  body.app-layout.sidebar-collapsed .user-info > div:last-child {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
    margin-bottom: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, max-height 0.2s ease;
  }

  body.app-layout.sidebar-collapsed .sidebar-nav {
    padding: 0.65rem 0.45rem;
  }

  body.app-layout.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0.58rem;
    font-size: 0;
    line-height: 0;
  }

  body.app-layout.sidebar-collapsed .nav-link svg {
    width: 1rem;
    height: 1rem;
    margin: 0;
  }

  body.app-layout.sidebar-collapsed .sidebar-footer {
    padding: 0.75rem 0.45rem;
  }

  body.app-layout.sidebar-collapsed .user-info {
    justify-content: center;
    margin-bottom: 0.55rem;
    gap: 0;
    width: 100%;
  }

  body.app-layout.sidebar-collapsed .btn-logout {
    padding: 0.5rem;
    font-size: 0;
    line-height: 0;
    gap: 0;
  }

  body.app-layout.sidebar-collapsed .btn-logout svg {
    width: 15px;
    height: 15px;
  }

  .main {
    margin-left: 0;
    width: auto;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .page-header {
    padding: 1.1rem 1.75rem;
  }

  .page-content {
    padding: 1.35rem 1.75rem;
    overflow: auto;
  }

  .grid-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  .sidebar {
    overflow-y: auto;
  }

  .sidebar-nav {
    flex: 0 0 auto;
    overflow-y: visible;
  }

  .sidebar-footer {
    margin-top: 0;
  }
}

@media (hover: none) and (pointer: coarse) {
  .sidebar {
    overflow-y: auto;
  }

  .sidebar-nav {
    flex: 0 0 auto;
    overflow-y: visible;
  }

  .sidebar-footer {
    margin-top: 0;
  }
}

@media print {

  .sidebar,
  .sidebar-backdrop,
  .page-header,
  .no-print {
    display: none !important;
  }

  .main {
    margin-left: 0 !important;
  }

  .page-content {
    padding: 0 !important;
  }

  .raport-page {
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: 100% !important;
  }
}

/* Pill Style Buttons (Badge-like) */
.btn-pill-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.26rem 0.85rem;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: var(--radius);
  background-color: #eef4ff;
  color: #1e56d9;
  border: 1px solid #d7e3ff;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

.btn-pill-edit:hover {
  background-color: #dbeafe;
  color: #1c49b1;
  border-color: #acc7ff;
}

.btn-pill-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.26rem 0.85rem;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: var(--radius);
  background-color: #fff0f3;
  color: #a71826;
  border: 1px solid #f4cbd4;
  transition: all 0.2s;
  cursor: pointer;
  border-style: solid;
  text-decoration: none;
  line-height: 1;
}

.btn-pill-danger:hover {
  background-color: #ffe4e9;
  color: #8b1420;
  border-color: #eeabb9;
}

.btn-pill-gray {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.26rem 0.85rem;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: var(--radius);
  background-color: #f3f5f8;
  color: #556273;
  border: 1px solid #dbe2ea;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

.btn-pill-gray:hover {
  background-color: #e9ecf1;
  color: #334155;
  border-color: #cbd5e1;
}

.action-gap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Custom CSV file upload zone in modals */
.file-upload-zone {
  border: 2px dashed #cbd5e1 !important;
  border-radius: var(--radius) !important;
  padding: 1.5rem !important;
  text-align: center;
  background: #f8fafc !important;
  cursor: pointer;
  transition: all 0.2s ease !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.file-upload-zone:hover {
  border-color: #4154f1 !important;
  background: #f0f4ff !important;
}

.file-upload-zone:hover .upload-icon {
  transform: translateY(-2px);
  color: #2f44dd !important;
}

.file-upload-zone .upload-icon {
  transition: transform 0.2s ease, color 0.2s ease;
}