:root {
  --ink: #172033;
  --muted: #6b7280;
  --line: #dbe3ee;
  --bg: #edf2f7;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --brand: #355c7d;
  --brand-strong: #213955;
  --accent: #00a6a6;
  --accent-soft: #e6f7f6;
  --warm: #f9735b;
  --warm-soft: #fff0ec;
  --green: #0f8a5f;
  --amber: #b45309;
  --red: #d14343;
  --radius: 8px;
  --shadow: 0 18px 42px rgba(23, 32, 51, 0.12);
  --shadow-soft: 0 8px 24px rgba(23, 32, 51, 0.08);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, #e9f1f6 0%, #f4f7fb 48%, #edf4f1 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(53, 92, 125, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(53, 92, 125, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
}

a { color: var(--brand); }

.app {
  width: 100%;
  max-width: 1180px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  padding: 0 14px 104px;
}

.content { padding: 6px 0 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  margin: 0 -14px 18px;
  padding: 18px 18px 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  border-bottom: 1px solid rgba(219, 227, 238, 0.9);
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
  backdrop-filter: blur(18px);
}

.toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #087f7f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: 22px;
  line-height: 1.1;
  margin: 8px 0 5px;
  letter-spacing: 0;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(53, 92, 125, 0.22);
  cursor: pointer;
}

.hero {
  position: relative;
  padding: 20px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(53, 92, 125, 0.96), rgba(22, 121, 120, 0.9)),
    #355c7d;
  color: #ffffff;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.26);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--warm), #fbbf24, var(--accent));
}

.hero h2 {
  margin: 0 0 9px;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.hero p {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.65;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.stat {
  background: rgba(255, 255, 255, 0.14);
  padding: 14px 10px;
  border-radius: var(--radius);
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.stat b {
  display: block;
  font-size: 24px;
  color: #ffffff;
}

.stat span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
}

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

.section-head h2,
.section-head h3 {
  font-size: 17px;
  margin: 0;
  letter-spacing: 0;
}

.section-head a,
.text-link {
  font-size: 13px;
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.home-actions .btn {
  width: 100%;
  min-height: 56px;
  padding: 14px;
  justify-content: flex-start;
  border-left: 4px solid var(--accent);
}

.home-actions .btn:nth-child(3n + 2) { border-left-color: var(--warm); }
.home-actions .btn:nth-child(3n + 3) { border-left-color: var(--brand); }

.card,
.form-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(219, 227, 238, 0.94);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}

.card-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.datebox {
  min-width: 58px;
  text-align: center;
  padding: 10px 8px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: #087f7f;
  border: 1px solid rgba(0, 166, 166, 0.18);
}

.datebox b {
  display: block;
  font-size: 22px;
}

.datebox span {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.card h3,
.card h2 {
  font-size: 16px;
  margin: 0 0 8px;
  letter-spacing: 0;
}

.card p {
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
  color: var(--muted);
}

.meta,
.schedule-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef3f8;
  color: #475569;
}

.pill.green {
  background: #e8f7ef;
  color: #047857;
}

.pill.amber {
  background: #fff4db;
  color: #a15c07;
}

.chip {
  background: var(--accent-soft);
  color: #087f7f;
}

.finance-hero { margin-bottom: 18px; }

.finance-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 24px;
}

.finance-create { margin-bottom: 18px; }

.finance-create > summary {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  list-style: none;
}

.finance-create > summary::-webkit-details-marker { display: none; }
.finance-create > summary span { color: var(--muted); font-size: 12px; }

.finance-card {
  border-left: 4px solid var(--accent);
}

.finance-card.history { border-left-color: var(--brand); }
.finance-card.overdue { border-left-color: var(--amber); background: #fffdf7; }

.finance-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.finance-card-head strong {
  white-space: nowrap;
  color: var(--brand);
  font-size: 16px;
}

.finance-note {
  margin-top: 14px !important;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.payment-action {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.payment-action > summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 900;
  font-size: 13px;
}

.payment-action form { margin-top: 8px; }

.proof-link {
  display: inline-flex;
  margin-top: 14px;
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.finance-plan form,
.inline-form { margin: 0; }

.finance-plan .btn {
  width: auto;
  padding: 9px 12px;
  font-size: 12px;
}

.button-link {
  border: 0;
  background: transparent;
  padding: 12px 0 0;
  cursor: pointer;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(219, 227, 238, 0.94);
  box-shadow: 0 -12px 30px rgba(23, 32, 51, 0.08);
}

.bottom-nav a {
  min-width: 0;
  text-align: center;
  text-decoration: none;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  padding: 8px 4px;
  border-radius: var(--radius);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.bottom-nav .icon {
  display: block;
  font-size: 19px;
  margin-bottom: 4px;
}

.bottom-nav a.active {
  color: var(--brand-strong);
  background: var(--accent-soft);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin: 16px 0 8px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.44);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: #ffffff;
  font: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(0, 166, 166, 0.58);
  box-shadow: 0 0 0 4px rgba(0, 166, 166, 0.12);
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.btn {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 13px 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #ffffff;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 14px 26px rgba(53, 92, 125, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(53, 92, 125, 0.22);
}

.btn.secondary {
  width: auto;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid rgba(219, 227, 238, 0.96);
  box-shadow: 0 7px 18px rgba(23, 32, 51, 0.08);
}

.btn.secondary.icon { padding: 11px 14px; }

.btn.danger {
  background: var(--warm-soft);
  color: #b42318;
  border: 1px solid rgba(249, 115, 91, 0.24);
  box-shadow: none;
}

.btn.danger:hover,
.btn.secondary:hover { filter: brightness(0.98); }

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

.flash {
  padding: 13px 15px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  background: #e8f7ef;
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.16);
}

.flash.error {
  background: #fff0ec;
  color: #b42318;
  border-color: rgba(249, 115, 91, 0.22);
}

.login {
  min-height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 16px 40px;
}

.brandmark {
  width: 68px;
  height: 68px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 31px;
  box-shadow: 0 18px 40px rgba(53, 92, 125, 0.24);
  margin-bottom: 20px;
}

.login h1 {
  font-size: 30px;
  margin: 0 0 10px;
  letter-spacing: 0;
}

.login > p {
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.8;
}

.help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.help a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 800;
}

.profile {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.photo {
  width: 84px;
  height: 84px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 28px;
  border: 1px solid rgba(0, 166, 166, 0.16);
}

.profile h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.profile p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: #ffffff;
  border: 1px solid rgba(219, 227, 238, 0.96);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.list-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(23, 32, 51, 0.12);
}

.student-summary { display: grid; gap: 12px; }

.student-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.student-title strong { font-size: 15px; }
.student-title .pill { font-size: 10px; }
.student-subtitle small { color: var(--muted); }

.student-info {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.student-info .item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.student-info .item strong { color: var(--ink); }

.student-contact {
  font-size: 13px;
  color: var(--brand);
  font-weight: 800;
}

.student-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.student-action .btn.secondary {
  width: auto;
  padding: 10px 14px;
}

.section-note {
  font-size: 13px;
  color: var(--muted);
  margin: -6px 0 14px;
  line-height: 1.7;
}

.empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
}

.empty .icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.tabs a {
  white-space: nowrap;
  text-decoration: none;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid rgba(219, 227, 238, 0.96);
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tabs a.active {
  background: var(--brand);
  color: #ffffff;
  border-color: transparent;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 12px 8px;
  border-bottom: 1px solid rgba(219, 227, 238, 0.96);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-weight: 800;
}

.admin-table tr:hover { background: rgba(0, 166, 166, 0.05); }

.schedule-day {
  border: 1px solid rgba(219, 227, 238, 0.96);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: #ffffff;
}

.schedule-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.schedule-day-head strong {
  display: block;
  font-size: 15px;
}

.schedule-day-head span {
  font-size: 12px;
  color: var(--muted);
}

.schedule-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid rgba(219, 227, 238, 0.96);
}

.schedule-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.schedule-marker {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 7px;
  flex-shrink: 0;
}

.schedule-item-title {
  font-weight: 800;
  font-size: 14px;
}

.schedule-item p {
  margin: 6px 0 0;
  font-size: 12px;
}

.schedule-empty {
  padding: 8px 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-pill-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.schedule-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid rgba(219, 227, 238, 0.96);
}

.schedule-list-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

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

.admin-actions form {
  display: inline-flex;
  margin: 0;
}

.admin-actions .btn {
  width: auto;
  padding: 10px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.admin-actions .btn.secondary { background: #f8fafc; }
.admin-actions .btn.danger { background: #fff0ec; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 860px) {
  body { padding: 22px; }

  .app {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 0;
    min-height: calc(100vh - 44px);
    padding: 0;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(219, 227, 238, 0.82);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .topbar {
    grid-column: 2;
    position: sticky;
    margin: 0;
    border-left: 1px solid rgba(219, 227, 238, 0.82);
  }

  .content {
    grid-column: 2;
    padding: 24px;
    min-width: 0;
  }

  .bottom-nav {
    position: sticky;
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: stretch;
    left: auto;
    bottom: auto;
    transform: none;
    width: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    padding: 86px 14px 18px;
    border-top: 0;
    border-right: 1px solid rgba(219, 227, 238, 0.88);
    box-shadow: none;
    background: rgba(247, 250, 252, 0.88);
  }

  .bottom-nav::before {
    content: "Ruang Kelas 1C";
    position: absolute;
    top: 24px;
    left: 18px;
    right: 18px;
    color: var(--brand-strong);
    font-size: 17px;
    font-weight: 900;
  }

  .bottom-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    width: 100%;
    font-size: 13px;
    padding: 12px;
  }

  .bottom-nav .icon {
    margin: 0;
    width: 28px;
    font-size: 18px;
    text-align: center;
  }

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

  .stats {
    max-width: 640px;
  }
}

@media (min-width: 1080px) {
  .content {
    padding: 28px 32px;
  }

  .home-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 16px 14px 14px;
  }

  .hero,
  .card,
  .form-card,
  .list-item {
    padding: 15px;
  }

  .hero h2 {
    font-size: 23px;
  }

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

  .home-actions {
    grid-template-columns: 1fr;
  }

  .finance-card-head,
  .schedule-list-item,
  .list-item {
    grid-template-columns: 1fr;
  }

  .finance-card-head,
  .schedule-list-item {
    flex-direction: column;
    align-items: stretch;
  }

  .finance-card-head strong {
    white-space: normal;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

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

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

  .admin-actions .btn,
  .admin-actions form {
    width: 100%;
  }

  .admin-actions .btn {
    justify-content: center;
  }
}

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

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

  .bottom-nav a {
    font-size: 9px;
  }
}
