
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600..800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --text: #172033;
  --muted: #8490a3;
  --border: #e9edf4;
  --background: #f6f8fc;
  --white: #ffffff;
  --shadow: 0 5px 22px rgba(26, 43, 77, .045);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--background);
  color: var(--text);
  font-size: 14px;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
}

/* SIDEBAR */
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  padding: 28px 17px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  margin-bottom: 43px;
  color: var(--text);
  text-decoration: none;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -1px;
}

.brand > span > span {
  color: var(--primary);
}

.brand-logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-size: 21px;
  font-weight: 800;
  box-shadow: 0 5px 13px rgba(37, 99, 235, .24);
}

.sidebar-label {
  color: #a0a9b8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.3px;
  padding: 0 12px;
  margin-bottom: 13px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 47px;
  padding: 0 13px;
  border-radius: 10px;
  color: #68758a;
  text-decoration: none;
  font-weight: 600;
  transition: background .22s ease, color .22s ease, transform .22s ease;
}

.nav-link:hover {
  background: #f3f6fc;
  color: var(--primary);
  transform: translateX(3px);
}

.nav-link.active {
  background: var(--blue-soft);
  color: var(--primary);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 5px 5px 0;
  background: var(--primary);
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 21px;
  line-height: 1;
}

.sidebar-bottom {
  margin-top: auto;
}

.profile-area {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  margin-top: 23px;
  padding: 18px 4px 0;
}

.profile-avatar {
  width: 37px;
  height: 37px;
  flex: 0 0 37px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--primary);
  font-weight: 800;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.profile-info strong {
  font-size: 12px;
}

.profile-info span {
  font-size: 10px;
  color: var(--muted);
}

.profile-menu-btn {
  border: 0;
  background: transparent;
  color: #7d899b;
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 19px;
}

.profile-menu-btn:hover {
  background: var(--background);
}

.profile-dropdown {
  display: none;
  position: absolute;
  right: 0;
  bottom: 48px;
  min-width: 145px;
  padding: 6px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 30;
}

.profile-dropdown.show {
  display: block;
  animation: dropdownIn .18s ease both;
}

.profile-dropdown button {
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 10px;
  background: transparent;
  text-align: left;
  color: var(--text);
}

.profile-dropdown button:hover {
  background: var(--blue-soft);
  color: var(--primary);
}

/* MAIN */
.main-area {
  min-width: 0;
  padding: 0 34px;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 105px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  gap: 20px;
}

.eyebrow {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-bottom: 7px;
}

.topbar h1 {
  font-size: 24px;
  letter-spacing: -.8px;
  font-weight: 800;
}

.date-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: white;
  border: 1px solid var(--border);
  color: #68758a;
  border-radius: 9px;
  padding: 10px 13px;
  font-size: 11px;
  font-weight: 600;
}

.page-container {
  width: 100%;
  max-width: 1450px;
  margin: 0 auto;
  padding: 29px 0 35px;
  flex: 1;
}

.page-section {
  display: none;
  animation: pageIn .3s ease both;
}

.page-section.active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}

.page-heading h2 {
  font-size: 18px;
  letter-spacing: -.45px;
  margin-bottom: 6px;
}

.page-heading p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* DASHBOARD CARDS */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.stat-card {
  min-width: 0;
  min-height: 165px;
  padding: 23px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(26, 43, 77, .09);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #718096;
  font-size: 12px;
  font-weight: 600;
}

.stat-icon {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 20px;
  font-weight: 700;
}

.stat-icon.blue {
  color: var(--primary);
  background: var(--blue-soft);
}

.stat-icon.green {
  color: var(--green);
  background: var(--green-soft);
}

.stat-icon.red {
  color: var(--red);
  background: var(--red-soft);
}

.stat-card h2 {
  margin-top: 20px;
  font-size: clamp(19px, 2vw, 27px);
  letter-spacing: -.9px;
  overflow-wrap: anywhere;
}

.stat-card.balance h2 {
  color: var(--primary);
}

.stat-card.income h2 {
  color: var(--green);
}

.stat-card.expense h2 {
  color: var(--red);
}

.stat-card p {
  margin-top: 8px;
  color: #9aa4b2;
  font-size: 11px;
}

/* PANELS */
.content-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.panel-heading h3 {
  font-size: 14px;
  font-weight: 750;
  margin-bottom: 6px;
}

.panel-heading p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.heading-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  color: var(--primary);
  background: var(--blue-soft);
  font-size: 20px;
}

/* FORMS */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 17px;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: #566277;
}

input, select {
  width: 100%;
  min-width: 0;
  height: 43px;
  padding: 0 12px;
  border: 1px solid #e4e9f1;
  border-radius: 9px;
  background: white;
  color: var(--text);
  outline: none;
  font-size: 12px;
  transition: border .2s ease, box-shadow .2s ease;
}

input::placeholder {
  color: #aab3c0;
}

input:focus, select:focus {
  border-color: #82aaf9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.primary-btn, .secondary-btn, .danger-btn {
  min-height: 42px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.primary-btn {
  color: white;
  background: var(--primary);
  box-shadow: 0 4px 10px rgba(37, 99, 235, .16);
}

.primary-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 7px 15px rgba(37, 99, 235, .23);
  transform: translateY(-2px);
}

.primary-btn:active, .secondary-btn:active, .danger-btn:active {
  transform: scale(.97);
}

#transaction-form .primary-btn {
  width: 100%;
  margin-top: 3px;
}

.secondary-btn {
  background: var(--blue-soft);
  color: var(--primary);
}

.secondary-btn:hover {
  background: #dbeafe;
  transform: translateY(-2px);
}

.danger-btn {
  background: var(--red-soft);
  color: var(--red);
}

.danger-btn:hover {
  background: #fee2e2;
  transform: translateY(-2px);
}

/* TRANSACTION LIST */
.toolbar {
  display: flex;
  gap: 9px;
  margin-bottom: 13px;
}

.toolbar input {
  flex: 1;
}

.toolbar select {
  width: 135px;
}

.transaction-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #f0f2f6;
  border-radius: 12px;
  animation: itemIn .25s ease both;
}

.transaction-item.income {
  background: linear-gradient(100deg, #f1fbf5, #dff5e8);
  border-color: #c3ead3;
}

.transaction-item.expense {
  background: linear-gradient(100deg, #fff5f5, #fde3e3);
  border-color: #f7c6c6;
}

.transaction-item .transaction-symbol {
  background: #fff;
  box-shadow: 0 2px 6px rgba(26, 43, 77, .07);
}

.transaction-item .delete-btn {
  background: #fff;
}

.transaction-info {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.transaction-symbol {
  flex: 0 0 35px;
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
}

.transaction-symbol.income {
  color: var(--green);
  background: var(--green-soft);
}

.transaction-symbol.expense {
  color: var(--red);
  background: var(--red-soft);
}

.transaction-description {
  min-width: 0;
}

.transaction-description strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 11px;
  margin-bottom: 5px;
}

.transaction-description span {
  color: var(--muted);
  font-size: 10px;
}

.transaction-right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.transaction-amount {
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
}

.transaction-amount.income {
  color: var(--green);
}

.transaction-amount.expense {
  color: var(--red);
}

.delete-btn {
  border: 0;
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 10px;
  font-weight: 700;
  transition: .2s ease;
}

.delete-btn:hover {
  background: #fee2e2;
  transform: translateY(-2px);
}

.empty-state {
  text-align: center;
  padding: 30px 12px;
  color: #a1aab8;
  font-size: 12px;
}

/* STUDENTS */
.student-add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

.student-add-form input {
  flex: 1;
}

.student-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 110px;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f7f9fc;
  color: #8490a3;
  font-size: 10px;
  font-weight: 700;
}

.student-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 110px;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-bottom: 1px solid #f0f2f6;
  animation: itemIn .25s ease both;
}

.student-name-cell {
  min-width: 0;
  font-size: 11px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 20px;
  padding: 6px 9px;
  font-size: 9px;
  font-weight: 750;
}

.status-pill.paid {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.unpaid {
  background: var(--red-soft);
  color: var(--red);
}

.student-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.student-actions button {
  border: 0;
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 9px;
  font-weight: 700;
  transition: .2s ease;
}

.payment-btn {
  color: var(--primary);
  background: var(--blue-soft);
}

.payment-btn:hover {
  background: #dbeafe;
}

.student-delete-btn {
  color: var(--red);
  background: var(--red-soft);
}

.student-delete-btn:hover {
  background: #fee2e2;
}

/* REPORT */
.report-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 19px;
}

.report-card {
  min-width: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 17px;
  box-shadow: var(--shadow);
}

.report-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 12px;
}

.report-card strong {
  font-size: clamp(14px, 1.6vw, 20px);
  overflow-wrap: anywhere;
  color: var(--primary);
}

.chart-panel {
  margin-bottom: 19px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #758198;
  font-size: 10px;
}

.chart-legend i {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

.chart-wrap {
  height: 270px;
  width: 100%;
  position: relative;
}

#finance-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.period-select {
  width: 155px;
}

/* SETTINGS */
.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 17px 0;
  border-bottom: 1px solid #f0f2f6;
}

.settings-item strong {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
}

.settings-item p {
  color: var(--muted);
  font-size: 10px;
}

.settings-value {
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

/* FOOTER */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 17px 0;
  text-align: center;
  color: #a1aab8;
  font-size: 10px;
}

.app-footer span {
  padding: 0 5px;
}

/* TOAST */
.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 100;
  max-width: calc(100vw - 40px);
  padding: 13px 18px;
  color: white;
  background: #172033;
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, .16);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: .25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* SKELETON SHIMMER */
.skeleton-loading .stat-card h2,
.skeleton-loading .stat-card p {
  color: transparent;
  border-radius: 5px;
  background: linear-gradient(90deg, #edf1f7 25%, #f8fafc 50%, #edf1f7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

.skeleton-loading .stat-card h2 {
  width: 70%;
  height: 27px;
}

.skeleton-loading .stat-card p {
  width: 48%;
  height: 11px;
}

/* ANIMATIONS */
@keyframes shimmer {
  to { background-position: -200% 0; }
}

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

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

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(5px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* RESPONSIVE */
@media (max-width: 1050px) {
  .app {
    grid-template-columns: 215px minmax(0, 1fr);
  }

  .main-area {
    padding: 0 23px;
  }

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

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

@media (max-width: 760px) {
  .app {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    min-height: auto;
    padding: 14px 15px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    margin-bottom: 15px;
    font-size: 20px;
  }

  .brand-logo {
    width: 33px;
    height: 33px;
  }

  .sidebar-label,
  .sidebar-bottom {
    display: none;
  }

  .sidebar-menu {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 39px;
    padding: 0 11px;
    gap: 7px;
    font-size: 10px;
  }

  .nav-link:hover {
    transform: none;
  }

  .nav-link.active::before {
    display: none;
  }

  .nav-icon {
    font-size: 16px;
    width: auto;
  }

  .main-area {
    padding: 0 16px;
  }

  .topbar {
    min-height: 82px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .date-chip {
    font-size: 9px;
    padding: 8px;
  }

  .page-container {
    padding-top: 23px;
  }

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

  .stat-card {
    min-height: 140px;
    padding: 19px;
  }

  .stat-card h2 {
    margin-top: 14px;
  }

  .student-table-head,
  .student-row {
    grid-template-columns: minmax(0, 1fr) 95px;
  }

  .student-table-head span:last-child {
    display: none;
  }

  .student-actions {
    grid-column: 1 / -1;
  }

  .student-row {
    row-gap: 8px;
  }

  .student-actions button {
    padding: 8px 10px;
  }

  .chart-wrap {
    height: 220px;
  }
}

@media (max-width: 480px) {
  .topbar-right {
    display: none;
  }

  .page-heading {
    align-items: flex-start;
  }

  .page-heading h2 {
    font-size: 16px;
  }

  .panel {
    padding: 16px;
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar select,
  .period-select {
    width: 100%;
  }

  .report-stats {
    gap: 9px;
  }

  .report-card {
    padding: 13px;
  }

  .report-card span {
    font-size: 9px;
  }

  .student-add-form {
    flex-direction: column;
  }

  .student-add-form .primary-btn {
    width: 100%;
  }

  .settings-item {
    align-items: flex-start;
  }

  .settings-actions {
    flex-direction: column;
  }

  .settings-actions button {
    width: 100%;
  }

  .toast {
    right: 15px;
    bottom: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =============== LOGO KASKU =============== */
/* ---------- LOGO ---------- */
.brand-logo {
  width: 42px;
  height: 42px;
  padding: 0;
  background: none;
  border-radius: 14px;
  box-shadow: none;
  overflow: visible;
  filter: drop-shadow(0 8px 14px rgba(59, 130, 246, .38));
  transition: transform .3s ease, filter .3s ease;
}

.brand:hover .brand-logo {
  transform: rotate(-4deg) scale(1.06);
  filter: drop-shadow(0 10px 18px rgba(99, 102, 241, .5));
}

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

/* =============== v2.1 =============== */
[hidden] { display: none !important; }
textarea { font: inherit; }

/* FONT */
.brand, .topbar h1, .page-heading h2, .panel-heading h3,
.stat-card h2, .report-card strong, .condition-label {
  font-family: var(--font-display);
}

.brand { letter-spacing: -.5px; }
.topbar h1 { letter-spacing: -.4px; }
.page-heading h2 { letter-spacing: -.2px; }
.stat-card h2 { letter-spacing: -.4px; font-weight: 800; }
.panel-heading h3 { font-weight: 700; }

/* KARTU DASHBOARD BERWARNA */
.stat-card.balance {
  background: linear-gradient(150deg, #f7faff 0%, #dbe8ff 100%);
  border-color: #c7dafc;
}

.stat-card.income {
  background: linear-gradient(150deg, #f5fdf8 0%, #d3f4e0 100%);
  border-color: #b9ecd0;
}

.stat-card.expense {
  background: linear-gradient(150deg, #fff7f7 0%, #fbd6d6 100%);
  border-color: #f6bcbc;
}

.stat-card .stat-icon {
  background: #fff;
  box-shadow: 0 2px 8px rgba(26, 43, 77, .08);
}

.stat-card .stat-top { color: #4f5d73; }
.stat-card p { color: #6b7a90; }

/* KARTU LAPORAN BERWARNA */
.report-stats .report-card:nth-child(1) {
  background: linear-gradient(150deg, #f5fdf8, #d3f4e0);
  border-color: #b9ecd0;
}
.report-stats .report-card:nth-child(1) strong { color: var(--green); }

.report-stats .report-card:nth-child(2) {
  background: linear-gradient(150deg, #fff7f7, #fbd6d6);
  border-color: #f6bcbc;
}
.report-stats .report-card:nth-child(2) strong { color: var(--red); }

.report-stats .report-card:nth-child(3) {
  background: linear-gradient(150deg, #f7faff, #dbe8ff);
  border-color: #c7dafc;
}

/* KOTAK KONDISI KEUANGAN KELAS */
.condition-box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.condition-body {
  min-width: 0;
  flex: 1;
}

.condition-label {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.condition-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.condition-text.is-empty { color: #a1aab8; }

.condition-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.condition-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 11px 12px;
  border: 1px solid #e4e9f1;
  border-radius: 9px;
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border .2s ease, box-shadow .2s ease;
}

.condition-form textarea:focus {
  border-color: #82aaf9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.condition-actions {
  display: flex;
  gap: 8px;
}

.condition-edit { flex: 0 0 auto; }

@media (max-width: 480px) {
  .condition-box { flex-direction: column; }
  .condition-edit { width: 100%; }
}

/* =============== v2.3 LOGIN & PERAN =============== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background:
    radial-gradient(70% 60% at 12% 8%, #dbe8ff 0%, transparent 62%),
    radial-gradient(60% 55% at 92% 96%, #e8e2ff 0%, transparent 62%),
    var(--background);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 30px 28px 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(26, 43, 77, .10);
  animation: pageIn .35s ease both;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 22px;
  text-align: center;
}

.login-brand .brand-logo {
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.6px;
}

.login-brand h1 span { color: var(--primary); }

.login-brand p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: #f1f4f9;
  border-radius: 11px;
}

.login-tab {
  border: 0;
  border-radius: 8px;
  padding: 10px 8px;
  background: transparent;
  color: #68758a;
  font-size: 12px;
  font-weight: 700;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.login-tab:hover { color: var(--primary); }

.login-tab.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(26, 43, 77, .12);
}

.login-error {
  min-height: 18px;
  margin: -4px 0 12px;
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

#login-form .primary-btn {
  width: 100%;
  min-height: 44px;
  font-size: 12px;
}

#login-form .primary-btn:disabled {
  opacity: .65;
  cursor: wait;
  transform: none;
}

.login-hint {
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.role-chip {
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.role-chip.user {
  background: #f1f4f9;
  color: #68758a;
}

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

.logout-chip {
  min-height: 37px;
  padding: 0 14px;
}

/* tampilan khusus User (siswa): hanya melihat */
body.role-user .admin-only { display: none !important; }
body.role-user .content-grid { grid-template-columns: 1fr; }
body.role-user .student-table-head,
body.role-user .student-row {
  grid-template-columns: minmax(0, 1fr) 130px;
}

@media (max-width: 480px) {
  .topbar-right { display: flex; }
  .date-chip { display: none; }
  .role-chip { padding: 8px 10px; }
}

/* =====================================================
   KASKU v3.0 — TAMBAHAN
   (navigasi HP, dashboard, iuran, modal, teks lebih besar,
    status sinkron, loading, cetak)
===================================================== */
:root {
  --muted: #5f6b7e;
}

body { font-size: 15px; }

/* ---------- KETERBACAAN: teks lebih besar dan lebih gelap ---------- */
.sidebar-label { color: #6b7688; font-size: 11px; }
.nav-link { font-size: 14.5px; }
.profile-info strong { font-size: 13.5px; }
.profile-info span { font-size: 12px; }
.eyebrow { font-size: 11px; }
.topbar h1 { font-size: 26px; }
.date-chip { font-size: 12.5px; }
.page-heading h2 { font-size: 20px; }
.page-heading p { font-size: 13.5px; }
.stat-top { font-size: 13.5px; }
.stat-card h2 { font-size: clamp(22px, 2.2vw, 30px); }
.stat-card p { font-size: 12.5px; color: #5f6b7e; }
.panel-heading h3 { font-size: 16px; }
.panel-heading p { font-size: 12.5px; }
.form-group label { font-size: 13px; color: #465268; }
input, select { font-size: 14px; height: 46px; }
input::placeholder { color: #7d889a; }
.primary-btn, .secondary-btn, .danger-btn { font-size: 13px; min-height: 44px; }
.transaction-description strong { font-size: 14px; }
.transaction-description span { font-size: 12px; }
.transaction-amount { font-size: 14px; }
.delete-btn { font-size: 12px; padding: 8px 11px; }
.empty-state { font-size: 13.5px; color: #66728a; }
.student-table-head { font-size: 12px; color: #5f6b7e; }
.student-name-cell { font-size: 14px; }
.status-pill { font-size: 11.5px; padding: 6px 11px; }
.student-actions button { font-size: 12px; padding: 8px 11px; }
.report-card span { font-size: 12px; }
.report-card strong { font-size: clamp(17px, 1.8vw, 23px); }
.chart-legend { font-size: 12px; }
.settings-item strong { font-size: 14px; }
.settings-item p { font-size: 12.5px; }
.settings-value { font-size: 12.5px; }
.app-footer { font-size: 12px; color: #6b7688; }
.toast { font-size: 14px; z-index: 300; }
.toast.error { background: #b42318; }
.condition-label { font-size: 13.5px; }
.condition-text { font-size: 15px; }
.role-chip { font-size: 12.5px; }
.login-brand p, .login-hint { font-size: 12.5px; }
.login-tab { font-size: 13px; }
.login-error { font-size: 12.5px; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ---------- STATUS SINKRON ---------- */
.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--white);
  color: #465268;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.sync-chip[data-state="ok"] .sync-dot { background: var(--green); }
.sync-chip[data-state="busy"] .sync-dot { background: var(--primary); animation: pulse 1s infinite ease-in-out; }
.sync-chip[data-state="error"] { color: #b42318; border-color: #f6bcbc; background: #fff7f7; cursor: pointer; }
.sync-chip[data-state="error"] .sync-dot { background: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}

/* ---------- DASHBOARD ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 20px;
  margin: 20px 0;
}

.chart-small { height: 190px; }

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e6edf8;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #34d399, #16a34a);
  transition: width .5s ease;
}

.iuran-line {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.6;
}

.iuran-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.text-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.text-link:hover { text-decoration: underline; }
.recent-panel .text-link { margin-top: 0; }

/* ---------- IURAN ---------- */
.iuran-panel { margin-bottom: 20px; }

.iuran-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.iuran-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.iuran-help {
  grid-column: 1 / -1;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

#edit-note { margin-top: 0; }

/* ---------- DAFTAR ---------- */
.transaction-item { flex-wrap: wrap; }
.transaction-right { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

.edit-btn {
  border: 0;
  border-radius: 7px;
  padding: 8px 11px;
  color: var(--primary);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  transition: .2s ease;
}

.edit-btn:hover { background: #dbeafe; transform: translateY(-2px); }

.toolbar select { width: 160px; }

@media (min-width: 761px) {
  .student-table-head,
  .student-row { grid-template-columns: minmax(0, 1fr) 120px 200px; }
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.report-note {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.report-note:empty { display: none; }

/* ---------- RIWAYAT PERUBAHAN ---------- */
.log-panel { margin-top: 20px; }

.log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.log-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f2f6;
}

.log-item:last-child { border-bottom: 0; }
.log-item strong { font-size: 14px; }
.log-item .log-detail { color: #465268; font-size: 13px; overflow-wrap: anywhere; }
.log-item .log-meta { color: var(--muted); font-size: 12px; }

/* ---------- MODAL ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: rgba(23, 32, 51, .45);
  animation: fadeIn .18s ease both;
}

.modal-card {
  width: 100%;
  max-width: 430px;
  padding: 24px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
  animation: dropdownIn .2s ease both;
}

.modal-card h3 {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 19px;
}

.modal-card > p {
  margin-bottom: 20px;
  color: #465268;
  font-size: 14px;
  line-height: 1.7;
}

.modal-card .form-group:first-of-type { margin-top: 14px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-btn.danger-solid {
  background: var(--red);
  box-shadow: 0 4px 10px rgba(220, 38, 38, .2);
}

.primary-btn.danger-solid:hover { background: #b91c1c; }

body.modal-open { overflow: hidden; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- LOADING (skeleton) ---------- */
.skeleton-row {
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(90deg, #edf1f7 25%, #f8fafc 50%, #edf1f7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

.student-list .skeleton-row { margin-bottom: 9px; }

/* ---------- NAVIGASI BAWAH (HP) ---------- */
.bottom-nav { display: none; }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .app { display: block; }
  .main-area { padding: 0 16px 100px; }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px rgba(26, 43, 77, .06);
  }

  .bnav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 2px;
    border-radius: 10px;
    color: #5f6b7e;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
  }

  .bnav-link span:first-child { font-size: 21px; line-height: 1; }
  .bnav-link.active { background: var(--blue-soft); color: var(--primary); }

  .toast { left: 15px; right: 15px; bottom: 92px; max-width: none; }

  input, select, textarea { font-size: 16px; }
  .topbar h1 { font-size: 22px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .iuran-form { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  .toolbar select { width: 100%; }
  .page-heading { flex-wrap: wrap; }
  .heading-actions { width: 100%; }
  .heading-actions .period-select { flex: 1 1 100%; width: 100%; }
  .heading-actions button { flex: 1; }
  .sync-chip { padding: 8px 10px; }
}

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

@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; padding: 12px 0; }
  .topbar-right { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
}

/* ---------- CETAK / PDF ---------- */
.print-header { display: none; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .sidebar, .bottom-nav, .topbar, .app-footer, .toast, .login-screen,
  .modal, .heading-actions, .admin-only, .sync-chip, .condition-box { display: none !important; }
  .app { display: block !important; }
  .main-area { padding: 0 !important; }
  .page-container { max-width: none; padding: 0; }
  .page-section { display: none !important; animation: none; }
  .page-section.active { display: block !important; }
  .print-header {
    display: block;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #172033;
    color: #172033;
    font-size: 12px;
    line-height: 1.6;
  }
  .print-header strong { display: block; margin-bottom: 4px; font-family: var(--font-display); font-size: 20px; }
  .panel, .report-card { box-shadow: none !important; break-inside: avoid; }
  .report-card, .transaction-item, .stat-card {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---------- v3: kolom nama & kategori bebas ---------- */
.optional { color: var(--muted); font-weight: 500; }
.form-group select + input { margin-top: 2px; }
select:disabled, input:disabled { background: #f3f6fb; color: #66728a; cursor: not-allowed; }
