:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --border: #d9e1ec;
  --text: #233044;
  --muted: #6b7a90;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --sidebar: #0f172a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
small { color: var(--muted); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar a {
  color: rgba(255,255,255,0.92);
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar a:hover {
  background: rgba(255,255,255,0.12);
  transform: translateX(2px);
}

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

.brand-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255,255,255,0.96);
  padding: 6px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.content {
  padding: 28px;
}

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

.topbar h1 {
  margin: 0 0 6px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

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

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: #d1fae5;
  color: #065f46;
  font-weight: 700;
  text-transform: capitalize;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.cards-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

.grid {
  display: grid;
  gap: 18px;
}

.two-column {
  grid-template-columns: 1.1fr 0.9fr;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.stat-card strong {
  font-size: 28px;
}

.stat-card.warning strong { color: var(--warning); }
.stat-card.danger strong { color: var(--danger); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head.wrap,
.actions-inline,
.inline-form,
.table-actions,
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.section-head h2,
.section-head h3 {
  margin: 0;
}

.muted-text {
  margin: 6px 0 0;
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table.compact th,
.table.compact td {
  padding: 10px 8px;
}

.badge {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.paid,
.badge.verified,
.badge.active {
  background: #dcfce7;
  color: #166534;
}

.badge.partial,
.badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.badge.overdue,
.badge.rejected,
.badge.inactive {
  background: #fee2e2;
  color: #991b1b;
}

.badge.unpaid {
  background: #e2e8f0;
  color: #334155;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.btn.small {
  padding: 7px 10px;
  font-size: 12px;
}

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

.btn-primary:hover { background: var(--primary-dark); }

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

.btn-light {
  background: #eef2ff;
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.stack-form {
  display: grid;
  gap: 14px;
}

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

.full-span { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font: inherit;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.checkbox-row input {
  width: auto;
}

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
}

.flash-success {
  background: #dcfce7;
  color: #166534;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.82), rgba(15, 118, 110, 0.74)),
    url('/assets/school-bg.jpg') center center / cover no-repeat;
}

.login-layout {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 24px;
  align-items: stretch;
}

.login-hero-panel {
  border-radius: 28px;
  padding: 32px;
  min-height: 640px;
  display: flex;
  align-items: end;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.16), rgba(15, 23, 42, 0.62));
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.login-hero-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(15,23,42,0.25));
  pointer-events: none;
}

.login-hero-content {
  position: relative;
  z-index: 1;
  max-width: 620px;
  color: #fff;
}

.login-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.24);
  margin-bottom: 18px;
}

.login-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

.login-chip.light {
  background: #ecfeff;
  color: #0f766e;
}

.login-hero-content h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
}

.login-hero-content p {
  margin: 0 0 22px;
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  line-height: 1.7;
}

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

.login-feature-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.12);
}

.login-feature-item strong {
  display: block;
  margin-bottom: 8px;
}

.login-feature-item span {
  display: block;
  color: rgba(255,255,255,0.88);
  font-size: 14px;
  line-height: 1.5;
}

.auth-card {
  width: min(560px, 100%);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 28px;
  border: 1px solid rgba(217, 225, 236, 0.9);
  padding: 32px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
}

.login-form-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-form-heading h2 {
  margin: 0 0 8px;
  font-size: 32px;
}

.login-form-heading p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.demo-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.demo-box strong {
  display: block;
  margin-bottom: 12px;
}

.demo-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.demo-box li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.demo-box li span {
  font-weight: 700;
}

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

.info-grid > div {
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-space { margin-top: 18px; }
.notification-list {
  display: grid;
  gap: 12px;
}

.notification-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}

.receipt-body {
  background: #fff;
  padding: 30px;
}

.receipt-card {
  max-width: 840px;
  margin: 0 auto;
  border: 1px solid #111827;
  padding: 30px;
}

.receipt-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.receipt-footer {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-top: 30px;
}

@media (max-width: 1024px) {
  .cards-grid,
  .two-column,
  .two-col-form,
  .info-grid,
  .app-shell,
  .login-layout,
  .login-feature-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .login-hero-panel {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .content,
  .auth-shell {
    padding: 16px;
  }

  .card,
  .auth-card,
  .login-hero-panel {
    padding: 20px;
    border-radius: 20px;
  }

  .topbar {
    align-items: flex-start;
  }

  .login-form-heading h2 {
    font-size: 28px;
  }

  .demo-box li {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media print {
  .btn,
  .sidebar,
  .topbar { display: none !important; }
  body.receipt-body { padding: 0; }
  .receipt-card { border: none; }
}

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

.import-card {
  padding: 0;
  border: 1px solid var(--border);
  box-shadow: none;
}

.import-card .section-head,
.import-card form,
.import-card .info-note {
  padding-left: 20px;
  padding-right: 20px;
}

.import-card .section-head {
  padding-top: 20px;
}

.import-card form {
  padding-bottom: 20px;
}

.info-note {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  line-height: 1.6;
}

.info-note code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 6px;
}

.payment-channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.payment-channel-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-channel-card.highlight {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 16px 30px rgba(15, 118, 110, 0.08);
}

.payment-channel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.payment-channel-destination {
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
}

.qris-image {
  width: 100%;
  max-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}

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

@media (max-width: 1024px) {
  .payment-channel-grid,
  .import-grid {
    grid-template-columns: 1fr;
  }
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.detail-side-grid {
  align-items: start;
}

.gateway-card {
  border-color: rgba(15, 118, 110, 0.22);
}

.gateway-meta-grid,
.gateway-checkout-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.gateway-meta-grid div,
.gateway-checkout-summary div {
  display: grid;
  gap: 6px;
}

.gateway-meta-grid strong,
.gateway-checkout-summary strong {
  font-size: 13px;
  color: var(--muted);
}

.gateway-checkout-box {
  padding: 16px;
  border: 1px dashed rgba(15, 118, 110, 0.3);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.9), rgba(255, 255, 255, 1));
}

.gateway-action-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.success-note {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.warning-note {
  background: #fffbeb;
  border-color: #fde68a;
}

.channel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.channel-list li {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.compact-list li strong {
  font-size: 14px;
}

@media (max-width: 1024px) {
  .detail-side-grid,
  .gateway-meta-grid,
  .gateway-checkout-summary {
    grid-template-columns: 1fr;
  }
}


.compact-toggle-grid {
  align-items: center;
}

.top-align-checkbox {
  align-items: flex-start;
  padding-top: 30px;
}

.top-align-checkbox input {
  margin-top: 2px;
}

.qr-preview-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.uploaded-qr-preview {
  width: 100%;
  max-width: 260px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px;
}

.compact-info-grid {
  gap: 10px;
}

.compact-info-grid > div {
  min-height: 88px;
  justify-content: space-between;
}

.notification-item small {
  display: block;
  margin-top: 10px;
}

.login-help-box {
  margin-top: 20px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(240, 253, 250, 0.9);
  color: var(--text);
}

.login-help-box p {
  margin: 8px 0 0;
  color: var(--muted);
}

.table-students code {
  font-size: 11px;
  word-break: break-all;
}

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

.student-va-card {
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #f8fffd 0%, #ffffff 100%);
  display: grid;
  gap: 10px;
}

.student-va-card.compact {
  gap: 8px;
}

.compact-card-head h3 {
  margin: 0;
}

.va-number-display {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0f172a;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.4px;
  width: fit-content;
}
