:root {
  color-scheme: dark;
  --black: #000;
  --blue: #0a1a4b;
  --silver: #c0c0c0;
  --offwhite: #faf9f5;
  --bg: #040405;
  --surface: #111217;
  --surface-2: #181b24;
  --surface-3: #222631;
  --line: #303540;
  --muted: #a8abb3;
  --green: #64d28a;
  --red: #ff7272;
  --warn: #d8c879;
  --radius: 10px;
  --sidebar: 278px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--offwhite); font-family: var(--font); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { border: 0; }
a { color: inherit; }
svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow: auto; padding: 18px 14px; border-right: 1px solid var(--line); background: var(--black); }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-height: 52px; margin-bottom: 18px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: var(--radius); background: var(--blue); border: 1px solid #293b72; font-size: 22px; font-weight: 900; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { line-height: 1; font-size: 16px; }
.brand-copy span, .muted, small { color: var(--muted); }
.nav-section { display: grid; gap: 4px; margin-bottom: 18px; }
.nav-title { color: var(--silver); font-size: 12px; font-weight: 850; padding: 8px 10px; }
.nav-item { min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.nav-item:hover, .nav-item.active { color: var(--offwhite); background: var(--surface-2); }
.main { min-width: 0; padding: 22px; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -22px -22px 22px; padding: 14px 22px; background: rgba(4,4,5,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.topbar h1, .page-head h2, .detail-head h2, .modal-head h2, h3 { margin: 0; }
.topbar h1 { font-size: clamp(22px,2.4vw,30px); line-height: 1.08; }
.eyebrow, .breadcrumb { display: block; color: var(--silver); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.top-actions, .modal-actions, .inline-actions, .detail-actions, .card-actions, .value-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.row-actions { white-space: nowrap; min-width: max-content; }
.btn, .icon-btn, .link-btn { cursor: pointer; font-weight: 820; }
.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: var(--offwhite); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: #314778; }
.btn.subtle { background: transparent; }
.btn.danger, .link-btn.danger { color: var(--red); }
.btn.mini { min-height: 30px; font-size: 12px; padding: 0 9px; }
.icon-btn { width: 38px; min-height: 38px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: var(--offwhite); text-decoration: none; }
.icon-btn.small { width: 30px; min-height: 30px; }
.icon-btn.tiny { width: 28px; min-height: 28px; }
.icon-btn.disabled { opacity: .45; cursor: not-allowed; }
.menu-btn { display: none; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0; background: transparent; color: var(--offwhite); text-decoration: none; }
.row-actions .link-btn { white-space: nowrap; }
.strong-link { font-size: 14px; font-weight: 900; }
.page, .detail-page { display: grid; gap: 18px; }
.page-head, .detail-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-head.single-action { justify-content: flex-end; }
.detail-head { justify-content: flex-start; }
.detail-actions { margin-left: auto; }
.summary-grid, .record-grid { display: grid; grid-template-columns: repeat(4,minmax(190px,1fr)); gap: 14px; }
.record-grid.compact { grid-template-columns: repeat(3,minmax(180px,1fr)); }
.summary-card, .info-card, .student-top-card, .panel, .modal-card, .contract-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.summary-card, .info-card { min-height: 112px; display: grid; gap: 8px; align-content: start; padding: 16px; }
.summary-card strong { font-size: 28px; line-height: 1.05; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.info-card > span, .summary-head span { color: var(--silver); font-weight: 850; }
.info-card strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 18px; }
.student-top-card { min-height: 128px; display: grid; gap: 10px; align-content: start; padding: 16px; position: relative; overflow: hidden; }
.student-top-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--silver); opacity: .7; }
.student-top-card.ok::before { background: var(--green); }
.student-top-card.warn::before { background: var(--warn); }
.student-top-card.danger::before { background: var(--red); }
.student-card-head { display: flex; align-items: center; gap: 10px; color: var(--silver); font-weight: 850; }
.student-card-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); color: var(--offwhite); }
.student-card-value { min-width: 0; display: grid; gap: 8px; font-size: 18px; font-weight: 900; }
.student-top-card small { color: var(--muted); }
.student-top-card .card-actions { margin-top: 2px; flex-wrap: wrap; }
.student-top-card .pay-cell { width: 100%; }
.student-top-card .progress { width: auto; flex: 1; }
.work-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(360px,.9fr); gap: 14px; align-items: start; }
.panel { overflow: hidden; }
.panel-title, .panel-tools, .table-footer { padding: 14px 16px; }
.panel-title, .panel-tools { border-bottom: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-title h2 { font-size: 16px; }
.panel-title-actions { display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 16px; }
.panel-tools { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.search-box { max-width: 340px; margin-left: auto; }
.search-box input, .field input, .field select, .field textarea, .filter-row select, .filter-grid select { width: 100%; min-height: 40px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: var(--offwhite); outline: none; padding: 0 12px; }
.field textarea { min-height: 132px; padding: 12px; resize: vertical; line-height: 1.45; }
.field.wide-field { grid-column: 1 / -1; }
.filter-row, .filter-grid { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.filter-row label, .filter-grid label { display: grid; gap: 6px; color: var(--silver); font-weight: 800; min-width: 190px; }
.panel-body > .filter-grid, .panel-body > .sub-tabs, .panel-body > .event-tabs { margin-bottom: 18px; }
.filter-grid + .table-wrap, .filter-row + .table-wrap, .sub-tabs + .timeline, .sub-tabs + .event-report { margin-top: 14px; }
.stage-tabs, .sub-tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-tabs button, .sub-tabs button { min-height: 34px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); cursor: pointer; font-weight: 850; }
.stage-tabs button.active, .sub-tabs button.active { color: var(--offwhite); border-color: #314778; background: var(--blue); }
.table-wrap { width: 100%; overflow: auto; border-radius: var(--radius); }
table { width: 100%; min-width: 1040px; border-collapse: separate; border-spacing: 0; }
.table-wrap.mini table { min-width: 860px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
td.row-actions { display: table-cell; text-align: right; vertical-align: middle; white-space: nowrap; }
td.row-actions > .link-btn, td.row-actions > .icon-btn, td.row-actions > .btn { margin-left: 10px; }
th:last-child, td:last-child { text-align: right; }
td > span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
th { color: var(--silver); background: var(--surface-2); font-size: 12px; }
thead th:first-child { border-top-left-radius: var(--radius); }
thead th:last-child { border-top-right-radius: var(--radius); }
tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius); }
.actions-col { width: 190px; min-width: 190px; }
tr:hover td { background: #151720; }
.table-footer { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.pill, .tag { min-height: 24px; display: inline-flex; align-items: center; border-radius: 999px; padding: 0 9px; font-size: 12px; font-weight: 850; border: 1px solid transparent; }
.pill::before, .tag::before { content: ""; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--green); background: rgba(100,210,138,.12); border-color: rgba(100,210,138,.32); }
.pill.warn { color: var(--warn); background: rgba(216,200,121,.12); border-color: rgba(216,200,121,.3); }
.pill.danger { color: var(--red); background: rgba(255,114,114,.12); border-color: rgba(255,114,114,.32); }
.pill.neutral, .tag { color: var(--silver); background: var(--surface-2); border-color: var(--line); }
code { color: var(--silver); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.progress { width: 130px; height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--silver); }
.pay-cell { display: flex; gap: 8px; align-items: center; }
.stack { display: grid; gap: 10px; }
.data-row, .mini-row { display: grid; grid-template-columns: 150px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px; border-radius: var(--radius); background: var(--surface-2); }
.data-row span { color: var(--silver); font-weight: 850; }
.data-row strong, .mini-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.inline-actions span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.contact-cell { justify-content: flex-start; min-width: max-content; }
.icon-btn.whatsapp { color: #64d28a; }
.quick-eye { margin-right: 10px; flex: 0 0 auto; }
.proposal-link svg { flex: 0 0 auto; color: var(--silver); }
.value-actions { justify-content: flex-end; }
.tab-bar { width: max-content; max-width: 100%; margin: 0 auto; display: flex; gap: 4px; padding: 8px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); overflow: auto; }
.tab-bar button { min-height: 38px; padding: 0 14px; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.tab-bar button.active { background: var(--surface-2); color: var(--silver); }
.contract-card { overflow: hidden; margin-bottom: 12px; }
.contract-head { width: 100%; min-height: 52px; display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 14px; background: var(--surface-2); color: var(--offwhite); text-align: left; cursor: pointer; }
.contract-body { display: grid; gap: 14px; padding: 14px; }
.product-grid { display: grid; gap: 6px; }
.product-line { display: grid; grid-template-columns: minmax(0,1fr) 180px 120px; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.product-line.cancelled { background: rgba(255,114,114,.18); }
.proposal-split { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.proposal-split > div { display: grid; gap: 10px; }
.proposal-choice { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.proposal-choice.selected { border-color: #b87310; box-shadow: inset 0 0 0 1px rgba(184,115,16,.35); }
.proposal-choice span { color: var(--silver); font-weight: 850; }
.account-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.drop-zone { min-height: 96px; display: grid; place-items: center; gap: 6px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); margin-bottom: 12px; cursor: pointer; text-align: center; }
.drop-zone input { display: none; }
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 12px; }
.attachment-card { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.attachment-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.file-icon { min-height: 96px; display: grid; place-items: center; border-radius: var(--radius); background: var(--surface-3); color: var(--silver); }
.timeline { display: grid; gap: 10px; }
.timeline div { padding: 12px; border-left: 3px solid var(--silver); background: var(--surface-2); border-radius: var(--radius); display: grid; gap: 4px; }
.event-report { display: grid; gap: 12px; }
.event-report article { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.event-report article > div:not(.event-line-head) { margin-top: 12px; display: grid; grid-template-columns: repeat(4,minmax(150px,1fr)); gap: 10px; }
.event-line-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 0; }
.event-line-head div { display: grid; gap: 4px; }
.event-line-head span { color: var(--muted); }
.event-report details { margin-top: 12px; }
.event-report summary { cursor: pointer; color: var(--silver); font-weight: 850; }
.expense-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 8px; margin-top: 12px; }
.expense-list span { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.checklist-tools { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: end; margin-top: 12px; }
.student-checklist { display: grid; gap: 8px; }
.student-checklist.compact { margin-top: 10px; }
.student-checklist label { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.toggle { width: 44px; height: 24px; border-radius: 999px; background: var(--surface-3); display: inline-flex; align-items: center; padding: 3px; }
.toggle i { width: 18px; height: 18px; border-radius: 50%; background: var(--offwhite); }
.toggle.on { justify-content: flex-end; background: #b87310; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: rgba(0,0,0,.72); }
.modal-card { width: min(560px,100%); max-height: min(88vh,860px); overflow: auto; display: grid; gap: 18px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.42); }
.modal-card.wide { width: min(920px,100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.modal-section { grid-column: 1 / -1; display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.modal-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.modal-section-head span { font-size: .86rem; text-transform: uppercase; letter-spacing: 0; color: var(--silver); font-weight: 950; }
.modal-section-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.modal-section.student-section { background: rgba(10,26,75,.22); }
.modal-section.contact-section { background: rgba(184,115,16,.12); }
.modal-section.address-section { background: rgba(148,163,184,.09); }
.modal-section.guardian-section { background: rgba(34,197,94,.08); }
.modal-section.note-section { background: rgba(239,68,68,.08); }
.field { display: grid; gap: 7px; }
.field span { font-weight: 850; }
.checkbox-field { min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--blue); }
.info-note { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(10,26,75,.28); color: var(--offwhite); }
.negative-value { color: var(--red); }
.empty { padding: 24px; color: var(--muted); text-align: center; }
.empty.slim { padding: 12px; }
.toast-stack { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); box-shadow: 0 18px 44px rgba(0,0,0,.35); }
@media (max-width: 1280px) { .summary-grid, .record-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 1100px) { .work-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(310px,92vw); transform: translateX(-105%); transition: transform .16s ease; z-index: 50; }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 16px; }
  .topbar { margin: -16px -16px 16px; padding: 12px 16px; }
  .menu-btn { display: inline-grid; }
  .summary-grid, .record-grid, .modal-grid, .modal-section-grid, .proposal-split { grid-template-columns: 1fr; }
  .checklist-tools { grid-template-columns: 1fr; }
  .page-head, .detail-head { align-items: flex-start; flex-wrap: wrap; }
  .detail-actions { width: 100%; margin-left: 0; }
}
