:root {
  --ink: #183045;
  --muted: #718092;
  --line: #e6e9ec;
  --paper: #ffffff;
  --canvas: #f5f7f6;
  --green: #14735a;
  --green-dark: #0e5b46;
  --orange: #f27045;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); font-family: Arial, Helvetica, sans-serif; background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.modal-open { overflow: hidden; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px; background: #123149; color: white; }
.brand-mark { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; padding: 0 8px; border: 0; color: inherit; background: transparent; text-align: left; text-decoration: none; }
.brand-mark > span { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; background: var(--orange); font-size: 21px; font-weight: 900; }
.brand-mark strong, .brand-mark small { display: block; }
.brand-mark strong { font-size: 16px; }
.brand-mark small { margin-top: 2px; color: #afc3d0; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 45px; padding: 0 13px; border: 0; border-radius: 11px; color: #b7c9d5; background: transparent; text-align: left; text-decoration: none; font-size: 13px; font-weight: 700; }
.nav-item > span { width: 23px; color: #d5e3e8; font-size: 15px; text-align: center; }
.nav-item.active { color: white; background: rgba(255,255,255,.1); box-shadow: inset 3px 0 var(--orange); }
.sidebar-note { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px; border: 1px solid rgba(255,255,255,.11); border-radius: 13px; background: rgba(255,255,255,.05); }
.note-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; background: #1e8064; }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: 11px; }
.sidebar-note small { margin-top: 3px; color: #b8c9d2; font-size: 10px; }
.logout-form { margin-top: 12px; }
.logout-form button { width: 100%; padding: 10px; border: 0; color: #afc3d0; background: transparent; font-size: 10px; font-weight: 700; }
.logout-form button:hover { color: white; }

.workspace { min-width: 0; padding: 38px clamp(24px, 4vw, 62px) 54px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(25px, 2.5vw, 34px); line-height: 1.15; letter-spacing: -.04em; }
.subtitle { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 0 17px; border: 0; border-radius: 11px; font-size: 12px; font-weight: 800; text-decoration: none; transition: .2s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled, .text-button:disabled, .table-action:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button-primary { color: white; background: var(--green); box-shadow: 0 7px 18px rgba(20,115,90,.18); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: var(--ink); border: 1px solid var(--line); background: white; }
.avatar { display: grid; width: 42px; height: 42px; margin-left: 3px; place-items: center; border-radius: 50%; color: white; background: #f0a43b; font-size: 11px; font-weight: 900; }
.menu-button { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; margin-bottom: 20px; }
.metric-card, .panel { border: 1px solid var(--line); background: var(--paper); box-shadow: 0 8px 28px rgba(26,48,69,.045); }
.metric-card { padding: 19px 20px; border-radius: 15px; }
.metric-heading { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.metric-heading small { font-size: 11px; font-weight: 750; }
.metric-icon { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 8px; font-weight: 900; }
.metric-icon.mint { color: #08765a; background: #dff3eb; }
.metric-icon.blue { color: #2e69a2; background: #e4f0fb; }
.metric-icon.amber { color: #9b6500; background: #fff0ca; }
.metric-icon.coral { color: #b74130; background: #ffe5df; }
.metric-card > strong { display: block; margin-top: 16px; font-size: 25px; letter-spacing: -.035em; }
.metric-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.metric-card p b { color: var(--green); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.panel { border-radius: 16px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; padding: 21px 22px 17px; }
.panel-heading h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.text-button { padding: 4px 0; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 850; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 18px; color: #8a96a2; background: #f8f9f9; font-size: 9px; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
td { padding: 15px 18px; border-top: 1px solid #edf0f1; font-size: 11px; white-space: nowrap; }
.student-cell { display: flex; align-items: center; gap: 10px; }
.student-button { padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
.student-avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; font-size: 9px; font-weight: 900; }
.student-avatar.mint { color: #176650; background: #dff3eb; }
.student-avatar.orange { color: #a34d2d; background: #ffe7da; }
.student-avatar.blue { color: #2a638f; background: #e3eff8; }
.student-avatar.pink { color: #9b4a68; background: #f8e4eb; }
.class-pill { padding: 5px 8px; border-radius: 6px; color: #536474; background: #f0f3f4; font-size: 9px; font-weight: 750; }
.limit-cell { min-width: 92px; }
.limit-cell span { font-size: 10px; }
.progress { width: 80px; height: 4px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: #e7eaeb; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.no-limit { color: #8a96a2; font-size: 10px; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 99px; font-size: 8px; font-weight: 850; }
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.available { color: #137258; background: #e2f4ed; }
.status.blocked { color: #b04934; background: #ffe8e2; }

.side-stack { display: grid; gap: 16px; }
.quick-entry { padding-bottom: 20px; }
.quick-entry > label, .field-row label { display: grid; gap: 7px; color: #526474; font-size: 9px; font-weight: 800; }
.quick-entry > label, .field-row, .quick-entry > .button { margin-left: 22px; margin-right: 22px; }
input, select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #dfe4e6; border-radius: 9px; outline: none; color: var(--ink); background: white; font-size: 11px; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20,115,90,.08); }
.field-row { display: grid; grid-template-columns: .85fr 1.15fr; gap: 9px; margin-top: 13px; }
.money-field { position: relative; }
.money-field span { position: absolute; left: 11px; top: 13px; color: #83909b; font-size: 10px; }
.money-field input { padding-left: 31px; }
.full { width: calc(100% - 44px); margin-top: 16px; }
.close-card { display: grid; grid-template-columns: auto 1fr; gap: 11px; padding: 18px; background: #fffaf1; border-color: #f2e4c9; }
.close-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: #996409; background: #ffe8b3; }
.close-card h3 { margin: 1px 0 5px; font-size: 12px; }
.close-card p { margin: 0; color: #7c715f; font-size: 9px; line-height: 1.55; }
.close-card .text-button { grid-column: 2; justify-self: start; }

.loading-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); background: var(--canvas); }
.loading-logo, .empty-state > span { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 15px; color: white; background: var(--orange); font-size: 25px; font-weight: 900; box-shadow: 0 10px 24px rgba(242,112,69,.22); }
.error-card { max-width: 420px; padding: 28px; border: 1px solid #f0d2cc; border-radius: 16px; background: white; text-align: center; }
.error-card strong { color: var(--ink); }
.error-card p { line-height: 1.55; }
.feedback { display: flex; align-items: center; gap: 9px; margin: -10px 0 22px; padding: 12px 14px; border-radius: 11px; font-size: 11px; font-weight: 750; }
.feedback > span { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; font-weight: 900; }
.feedback button { margin-left: auto; border: 0; color: inherit; background: transparent; font-size: 18px; }
.error-feedback { color: #9a3f31; border: 1px solid #f2cfc8; background: #fff2ef; }
.error-feedback > span { color: white; background: #bf513f; }
.success-feedback { color: #0f654d; border: 1px solid #bfe3d6; background: #e8f6f1; }
.success-feedback > span { color: white; background: var(--green); }

.page-panel { overflow: hidden; }
.page-heading { align-items: center; padding: 24px 26px; }
.page-heading h2 { font-size: 19px; }
.filters { display: grid; grid-template-columns: minmax(220px, 1fr) 180px auto; gap: 10px; padding: 0 26px 20px; }
.cell-subtext { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions form { margin: 0; }
.row-actions button, .table-action { padding: 6px 9px; border: 1px solid #dce2e3; border-radius: 7px; color: var(--green); background: white; font-size: 8px; font-weight: 850; }
.row-actions button:hover, .table-action:hover { border-color: var(--green); background: #f2f9f6; }
.status.billing-sent { color: #8a6507; background: #fff2cd; }
.status.billing-overdue { color: #b04934; background: #ffe8e2; }
.status.billing-paid { color: #137258; background: #e2f4ed; }
.paid-date { color: var(--muted); font-size: 9px; }

.date-field { margin-top: 13px; }
.form-hint { margin: 10px 22px 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.recent-panel { margin-top: 20px; overflow: hidden; }
.recent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid #edf0f1; }
.recent-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 10px; min-width: 0; padding: 15px 18px; border-right: 1px solid #edf0f1; border-bottom: 1px solid #edf0f1; }
.recent-item > div { min-width: 0; }
.recent-item strong, .recent-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item strong { font-size: 10px; }
.recent-item small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.recent-value { text-align: right; }
.recent-item form { margin: 0; }
.recent-item form button { display: grid; width: 23px; height: 23px; place-items: center; border: 0; border-radius: 7px; color: #9aa4ac; background: #f1f3f4; }
.recent-item form button:hover { color: #a64033; background: #ffe8e2; }
.empty-state { display: grid; justify-items: center; gap: 7px; padding: 45px 24px; color: var(--muted); text-align: center; }
.empty-state > span { width: 38px; height: 38px; border-radius: 11px; font-size: 17px; }
.empty-state strong { margin-top: 6px; color: var(--ink); font-size: 12px; }
.empty-state p { max-width: 360px; margin: 0; font-size: 10px; line-height: 1.55; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(10,31,45,.55); backdrop-filter: blur(5px); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 18px; background: white; box-shadow: 0 28px 80px rgba(9,29,42,.28); }
.modal-heading { display: flex; justify-content: space-between; align-items: start; padding: 25px 27px 18px; border-bottom: 1px solid var(--line); }
.modal-heading h2 { margin: 0; font-size: 20px; }
.modal-heading > button { display: grid; width: 31px; height: 31px; place-items: center; border: 0; border-radius: 9px; color: #6f7d88; background: #f0f3f4; font-size: 20px; }
.modal form { display: grid; gap: 15px; padding: 22px 27px 27px; }
.modal label { display: grid; gap: 7px; color: #526474; font-size: 10px; font-weight: 800; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-note { margin: 0; padding: 12px 14px; border-radius: 9px; color: #6f746e; background: #f5f6f2; font-size: 9px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top right, #e2f4ed, transparent 35%), var(--canvas); }
.auth-card { width: min(460px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 24px 70px rgba(24,48,69,.12); }
.auth-logo { display: grid; width: 54px; height: 54px; margin-bottom: 24px; place-items: center; border-radius: 16px; color: white; background: var(--orange); font-size: 25px; font-weight: 900; box-shadow: 0 10px 24px rgba(242,112,69,.22); }
.auth-card h1 { font-size: 30px; }
.auth-intro { margin: 12px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.auth-card .feedback { margin: 0 0 18px; }
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 7px; color: #526474; font-size: 10px; font-weight: 800; }
.auth-form .button { margin-top: 4px; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-footnote { margin: 22px 0 0; color: #8a96a2; font-size: 9px; text-align: center; }
.feedback-hide { opacity: 0; transform: translateY(-5px); transition: .35s ease; }

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr 1fr; }
  .recent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(280px, 84vw); height: 100vh; padding: 24px 18px; transform: translateX(-105%); transition: transform .25s ease; }
  .menu-open .sidebar { transform: translateX(0); box-shadow: 12px 0 40px rgba(8,27,40,.25); }
  .brand-mark { margin-bottom: 28px; }
  .sidebar nav { display: grid; overflow: visible; }
  .nav-item { width: 100%; }
  .sidebar-note { display: none; }
  .workspace { padding: 25px 16px 40px; }
  .topbar { display: grid; grid-template-columns: auto minmax(0,1fr); }
  .menu-button { display: grid; place-items: center; }
  .top-actions { grid-column: 1 / -1; }
  .top-actions { flex-wrap: wrap; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .side-stack { grid-template-columns: 1fr; }
  .recent-grid { grid-template-columns: 1fr; }
  .filters, .modal-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .top-actions .button-secondary { display: none; }
  .auth-card { padding: 28px 22px; }
  .auth-row { grid-template-columns: 1fr; }
}
