:root {
  --teal-900: #0b4f4a;
  --teal-700: #0f766e;
  --teal-100: #d7f0ed;
  --red-700: #b4232c;
  --red-100: #fee2e2;
  --blue-700: #1d4ed8;
  --blue-100: #dbeafe;
  --amber-700: #a16207;
  --amber-100: #fef3c7;
  --violet-700: #6d28d9;
  --violet-100: #ede9fe;
  --green-700: #15803d;
  --green-100: #dcfce7;
  --ink: #17211f;
  --muted: #62706c;
  --line: #d7dedb;
  --surface: #ffffff;
  --canvas: #f4f7f6;
  --shadow: 0 12px 34px rgba(20, 46, 42, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #cbd5d1; border-radius: 6px; padding: 10px 12px; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(15, 118, 110, .18); border-color: var(--teal-700); }
label { display: grid; gap: 6px; font-size: .86rem; font-weight: 750; color: #34433f; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.9rem, 5vw, 2.65rem); letter-spacing: 0; }
h2 { font-size: 1.35rem; letter-spacing: 0; }
h3 { font-size: 1rem; letter-spacing: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 5px; color: var(--red-700); font-size: .78rem; font-weight: 850; text-transform: uppercase; }
.loading-screen { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; color: var(--ink); background: #eef3f1; }
.loading-stage { width: min(390px, 100%); display: grid; justify-items: center; gap: 16px; padding: 28px 24px; text-align: center; opacity: 1; transform: translateY(0) scale(1); transition: opacity .2s ease, transform .2s ease; }
.loading-screen.is-leaving .loading-stage { opacity: 0; transform: translateY(-5px) scale(.98); }
.loading-logo { width: 150px; height: 110px; object-fit: contain; animation: loading-logo-pulse 1.6s ease-in-out infinite; }
.loading-cards { height: 58px; display: flex; align-items: flex-end; justify-content: center; gap: 10px; }
.loading-cards span { width: 50px; height: 38px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 6px; color: #fff; background: var(--teal-700); box-shadow: 0 5px 12px rgba(8, 70, 64, .18); font-size: .83rem; font-weight: 900; animation: loading-card-hop 1.15s ease-in-out infinite; }
.loading-cards span:nth-child(2) { color: var(--teal-900); background: var(--amber-100); animation-delay: .14s; }
.loading-cards span:nth-child(3) { background: var(--red-700); animation-delay: .28s; }
.loading-text { min-height: 24px; margin: 0; color: var(--teal-900); font-size: 1rem; font-weight: 850; }
.loading-track { width: min(250px, 78vw); height: 6px; overflow: hidden; border-radius: 3px; background: #d7e2df; }
.loading-track span { width: 42%; height: 100%; display: block; border-radius: inherit; background: var(--teal-700); animation: loading-track-run 1.2s ease-in-out infinite; }
body.is-loading { overflow: hidden; }
@keyframes loading-logo-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes loading-card-hop { 0%, 100% { transform: translateY(0) rotate(0); } 42% { transform: translateY(-16px) rotate(-3deg); } 62% { transform: translateY(-13px) rotate(3deg); } }
@keyframes loading-track-run { 0% { transform: translateX(-110%); } 50% { transform: translateX(70%); } 100% { transform: translateX(245%); } }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef3f1; }
.login-panel { width: min(440px, 100%); display: grid; justify-items: center; gap: 22px; padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.98); box-shadow: var(--shadow); text-align: center; }
.login-panel > div, .login-panel form, .login-panel details { width: 100%; }
.login-panel form, .login-panel details { text-align: left; }
.login-logo { width: 180px; height: 132px; object-fit: contain; }
.login-intro { display: grid; justify-items: center; gap: 14px; }
.login-enter-button { min-height: 52px; font-size: 1rem; }
.login-form-head { display: flex; align-items: center; gap: 12px; color: var(--teal-900); }
.login-form-head strong { font-size: .98rem; }
.form-stack { display: grid; gap: 16px; }
.password-field { display: grid; grid-template-columns: 1fr 48px; align-items: stretch; }
.password-field input { border-radius: 6px 0 0 6px; }
.password-field .icon-button { border: 1px solid #cbd5d1; border-left: 0; border-radius: 0 6px 6px 0; }
.demo-hint { padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.demo-hint summary { font-weight: 800; color: var(--teal-900); }
.demo-hint p { margin: 8px 0 0; }
code { padding: 2px 5px; border-radius: 4px; background: #eef2f1; }

.app-shell { min-height: 100vh; }
.app-header { position: sticky; top: 0; z-index: 20; min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 9px; padding-right: max(18px, env(safe-area-inset-right)); padding-bottom: 9px; padding-left: max(18px, env(safe-area-inset-left)); color: #fff; background: var(--teal-700); box-shadow: 0 2px 10px rgba(0,0,0,.13); }
.brand-lockup { display: flex; align-items: center; min-width: 0; gap: 12px; overflow: hidden; }
.brand-lockup > div { min-width: 0; overflow: hidden; }
.brand-lockup strong, .brand-lockup span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-lockup strong { font-size: 1.05rem; }
.brand-lockup span { color: #d5f4ef; font-size: .78rem; }
.brand-logo { width: 54px; height: 46px; padding: 2px; object-fit: contain; background: #fff; border-radius: 4px; }
.header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
button.mobile-menu-button { display: none; }
.icon-button, .compact-button, .primary-button, .secondary-button, .danger-button { min-height: 42px; border: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; }
.icon-button { width: 42px; padding: 0; background: #eef2f1; color: var(--ink); }
.icon-button svg, .compact-button svg, .primary-button svg, .secondary-button svg, .nav-button svg { width: 19px; height: 19px; stroke-width: 2.2; }
.header-icon { position: relative; color: #fff; background: transparent; }
.compact-button { padding: 0 12px; background: rgba(255,255,255,.14); color: #fff; }
.primary-button { padding: 10px 16px; color: #fff; background: var(--teal-700); }
.primary-button:hover { background: var(--teal-900); }
.secondary-button { padding: 10px 16px; color: var(--teal-900); background: var(--teal-100); }
.secondary-button, .primary-button { text-decoration: none; }
.danger-button { padding: 10px 16px; color: var(--red-700); background: var(--red-100); }
.full { width: 100%; }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--red-700); font-size: .68rem; }

.app-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 70px); }
.side-nav { position: sticky; top: 70px; align-self: start; height: calc(100vh - 70px); padding: 22px 14px; border-right: 1px solid var(--line); background: #fff; }
.nav-button { width: 100%; min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 6px; color: #45534f; background: transparent; font-weight: 760; text-align: left; }
.nav-button:hover { background: #f0f5f3; }
.nav-button.active { color: var(--teal-900); background: var(--teal-100); }
.view-root { min-width: 0; padding: 28px clamp(18px, 4vw, 48px) 70px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-head h1 { font-size: 1.75rem; margin-bottom: 4px; }
.page-head p { margin: 0; color: var(--muted); }
.section-band { margin: 0 0 22px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.section-head h2, .section-head p { margin: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 12px; margin-bottom: 22px; }
.summary-tile { min-height: 112px; display: grid; align-content: space-between; padding: 16px; border: 1px solid var(--line); border-left: 5px solid var(--teal-700); border-radius: 7px; background: #fff; }
.summary-tile.red { border-left-color: var(--red-700); }
.summary-tile.blue { border-left-color: var(--blue-700); }
.summary-tile.amber { border-left-color: var(--amber-700); }
.summary-tile span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.summary-tile strong { min-width: 0; font-size: 1.7rem; overflow-wrap: anywhere; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid > *, .form-grid input, .form-grid select, .form-grid textarea { min-width: 0; max-width: 100%; }
.span-2 { grid-column: 1 / -1; }
.toolbar { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.toolbar > label { min-width: 180px; flex: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid #c9d5d1; border-radius: 17px; color: #33423f; background: #fff; font-size: .83rem; font-weight: 760; }
.chip.selected { color: var(--teal-900); border-color: #8bc8c1; background: var(--teal-100); }
.chip button { border: 0; padding: 0; color: inherit; background: transparent; font-weight: 900; }
.result-list, .member-list, .group-list, .notification-list, .timeline { display: grid; gap: 9px; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 14px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.list-row h3 { margin: 0 0 4px; }
.list-row p { margin: 0; color: var(--muted); font-size: .84rem; }
.list-row .row-actions { display: flex; align-items: center; gap: 7px; }
.group-active-control { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; font-weight: 800; }
.group-active-control > span:first-child { min-width: 48px; text-align: right; }
.group-row-actions { flex-wrap: wrap; justify-content: flex-end; }
.notification-row .secondary-button { white-space: nowrap; }
.switch-control { position: relative; width: 48px; height: 28px; display: inline-flex; flex: 0 0 auto; }
.switch-control input { position: absolute; width: 1px; min-height: 1px; opacity: 0; }
.switch-control > span { width: 48px; height: 28px; display: block; border-radius: 14px; background: #b9c4c0; transition: background .18s ease; }
.switch-control > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.28); transition: transform .18s ease; }
.switch-control input:checked + span { background: var(--green-700); }
.switch-control input:checked + span::after { transform: translateX(20px); }
.switch-control input:focus-visible + span { outline: 3px solid rgba(15, 118, 110, .25); outline-offset: 2px; }
.switch-control input:disabled + span { cursor: wait; opacity: .55; }
.inactive-group { background: #f6f7f7; }
.group-inactive-note { margin-top: 7px !important; color: var(--red-700) !important; font-weight: 750; }
.status { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 8px; border-radius: 14px; font-size: .75rem; font-weight: 850; }
.status.active, .status.paid { color: var(--green-700); background: var(--green-100); }
.status.passive, .status.pending, .status.approved { color: var(--amber-700); background: var(--amber-100); }
.status.exited, .status.late, .status.returned, .status.received { color: var(--red-700); background: var(--red-100); }
.status.trial, .status.submitted { color: var(--blue-700); background: var(--blue-100); }
.status.forwarded { color: var(--green-700); background: var(--green-100); }
.status.none { color: var(--violet-700); background: var(--violet-100); }
.empty { padding: 24px; border: 1px dashed #bcc8c4; border-radius: 7px; color: var(--muted); text-align: center; }
.calendar-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.calendar-table { width: 100%; border-collapse: collapse; }
.calendar-table th, .calendar-table td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.calendar-table th { color: var(--muted); font-size: .76rem; text-transform: uppercase; }
.calendar-table tr.next-calendar-event > td { background: #fff3b0; border-top: 2px solid #d39b00; border-bottom-color: #d39b00; }
.calendar-table tr.next-calendar-event > td:first-child { box-shadow: inset 4px 0 0 #d39b00; }
.bottom-nav { display: none; }
.modal { width: min(520px, calc(100vw - 28px)); max-height: min(84vh, 760px); overflow: auto; padding: 20px; border: 0; border-radius: 8px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.wide-modal { width: min(680px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(8, 25, 23, .52); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.option-list { display: grid; gap: 9px; }
.option-button { width: 100%; display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; text-align: left; }
.option-button.active { border-color: var(--teal-700); background: var(--teal-100); }
.option-button svg { width: 22px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: min(92vw, 520px); padding: 11px 16px; border-radius: 6px; color: #fff; background: #162724; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.callout { padding: 13px 14px; border-left: 4px solid var(--blue-700); background: var(--blue-100); color: #183e90; }
.checkline { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.checkline input { width: 20px; min-height: 20px; }
.quick-add { display: grid; gap: 9px; margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); background: #f8faf9; }
.quick-add small { color: var(--muted); }
.attendance-save-bar { position: sticky; bottom: 10px; z-index: 5; box-shadow: var(--shadow); }
.family-suggestion { display: grid; gap: 10px; padding: 13px; border-left: 4px solid var(--amber-700); background: var(--amber-100); }
.card-pill { display: inline-flex; padding: 6px 9px; border-radius: 14px; font-size: .78rem; font-weight: 850; }
.card-pill.free { color: var(--green-700); background: var(--green-100); }
.card-pill.used { color: var(--amber-700); background: var(--amber-100); }
.number-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 5px; }
.number-grid span { display: grid; place-items: center; min-height: 32px; border-radius: 4px; font-size: .78rem; font-weight: 800; }
.number-grid.free span { color: var(--green-700); background: var(--green-100); }
.number-grid.used span { color: var(--amber-700); background: var(--amber-100); }
.rank-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; align-items: center; min-height: 38px; padding: 7px 9px; border-bottom: 1px solid var(--line); }
.family-rank-row { grid-template-columns: minmax(0, 1fr) auto; }
.family-rank-row span { min-width: 0; overflow-wrap: anywhere; }
.family-rank-row b { white-space: nowrap; }
.field-help, .dialog-hint { color: var(--muted); font-size: .78rem; font-weight: 500; }
.dialog-hint { margin: 8px 0 14px; }
.family-link-results { margin-top: 10px; }
.family-link-selection, .family-overview { display: grid; gap: 10px; margin-top: 18px; }
.family-link-actions { margin-top: 14px; }
.family-row p { overflow-wrap: anywhere; }
.workflow-card { min-width: 0; display: grid; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.workflow-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.workflow-head > div { min-width: 0; }
.workflow-head h3, .workflow-head p { margin: 0 0 4px; }
.workflow-head p { overflow-wrap: anywhere; }
.settlement-actions { justify-content: flex-start; flex-wrap: wrap; }
.settlement-actions button:disabled { cursor: not-allowed; opacity: .62; }
.settlement-lock-note { max-width: 62ch; margin-top: 8px !important; color: var(--muted); font-size: .84rem; }
.correction-note { margin-top: 8px !important; padding: 8px; color: var(--red-700) !important; background: var(--red-100); }
.status-legend { display: flex; flex-wrap: wrap; gap: 7px; }
.member-editor { border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.member-editor summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 14px; cursor: pointer; list-style: none; }
.member-editor summary::-webkit-details-marker { display: none; }
.member-editor summary strong, .member-editor summary small { display: block; }
.member-editor summary small { margin-top: 4px; color: var(--muted); }
.summary-actions { display: flex; align-items: center; gap: 7px; }
.small-button { min-height: 32px; padding: 6px 10px; font-size: .76rem; }
.member-edit-form { padding: 15px; border-top: 1px solid var(--line); }
.role-fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; border: 1px solid var(--line); }
.role-fieldset legend { padding: 0 6px; font-weight: 800; }
.group-assignment-fieldset { padding: 14px; border: 1px solid var(--line); }
.group-assignment-fieldset legend { padding: 0 6px; font-weight: 800; }
.group-assignment-fieldset > p { margin: 0 0 10px; }
.group-assignment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: 240px; overflow: auto; }
.dialog-actions .reset-action { margin-right: auto; }
.billing-fieldset { padding: 14px; border: 1px solid var(--line); }
.billing-fieldset legend { padding: 0 6px; font-weight: 800; }
.ocr-import { display: grid; gap: 12px; padding: 14px; border: 1px solid #9ecdc7; border-left: 4px solid var(--teal-700); border-radius: 6px; background: #f5fbfa; }
.ocr-import h3, .ocr-import p { margin: 0; }
.ocr-import > div:first-child p { margin-top: 4px; color: var(--muted); font-size: .82rem; }
.ocr-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.source-file-list { display: grid; gap: 7px; }
.source-file-list > div { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.source-file-list > div > span { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 3px 8px; }
.source-file-list svg { grid-row: 1 / 3; }
.source-file-list strong, .source-file-list small { min-width: 0; overflow-wrap: anywhere; }
.source-file-list small { color: var(--muted); }
.ocr-progress { width: 100%; height: 10px; accent-color: var(--teal-700); }
.ocr-result { padding: 11px 12px; border: 1px solid #acd6b9; border-radius: 6px; background: var(--green-100); }
.ocr-result p { margin: 4px 0 0; font-size: .82rem; }
.ocr-result details { margin-top: 9px; }
.ocr-result summary { cursor: pointer; font-size: .78rem; font-weight: 800; }
.ocr-result pre { max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .7rem; }
label.ocr-filled { color: var(--green-700); }
label.ocr-filled input, label.ocr-filled select { border-color: #65a97c; background: #f2fff6; }
.group-assignment-grid label.ocr-filled { padding: 5px; border-radius: 4px; background: var(--green-100); }
.application-document-card { border-left: 4px solid var(--teal-700); }
.application-file-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 8px; }
.application-file-list.compact { margin-top: 10px; }
.application-file-link { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #f8faf9; text-decoration: none; }
.application-file-link:hover { border-color: var(--teal-700); background: #eef8f6; }
.application-file-link strong, .application-file-link small { display: block; overflow-wrap: anywhere; }
.application-file-link small { margin-top: 3px; color: var(--muted); font-size: .74rem; }
.paper-status-control { display: grid; grid-template-columns: minmax(0, 180px) minmax(160px, 260px); align-items: center; gap: 10px; width: min(100%, 470px); font-weight: 800; }
.review-confirmation { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid #9ecdc7; border-radius: 6px; color: var(--teal-900); background: #eef8f6; font-size: .84rem; }
.review-confirmation svg { flex: 0 0 auto; }
.member-file-records { display: grid; gap: 10px; }
.member-file-records > article { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf9; }
.member-file-records small { display: block; margin-top: 3px; color: var(--muted); }
.dashboard-link { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; text-align: left; }
.dashboard-link > svg { width: 27px; color: var(--teal-700); }
.dashboard-link span, .dashboard-link strong, .dashboard-link small { min-width: 0; display: block; }
.dashboard-link small { margin-top: 4px; color: var(--muted); }
.compact-summary { margin: 14px 0; }
.compact-summary .summary-tile { min-height: 90px; }
.official-report-readiness .callout a { color: inherit; font-weight: 850; }
.annual-report-filter label { max-width: 260px; }
.warning-callout { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; border-left: 4px solid var(--amber-700); color: #714407; background: var(--amber-100); font-size: .84rem; font-weight: 700; }
.warning-callout svg { width: 18px; flex: 0 0 auto; }
.history-panel { border-top: 1px solid var(--line); padding-top: 10px; }
.history-panel summary { display: flex; align-items: center; gap: 7px; color: var(--teal-900); font-size: .82rem; font-weight: 800; cursor: pointer; }
.history-panel summary svg { width: 17px; }
.history-list { display: grid; gap: 8px; margin-top: 10px; }
.history-list > div { padding-left: 11px; border-left: 2px solid var(--line); color: var(--muted); font-size: .78rem; }
.history-list strong { color: var(--ink); }
.finance-table-wrap { margin-top: 16px; }
.finance-table { min-width: 980px; }
.finance-table small { color: var(--muted); }
.iban-cell { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; }
.finance-people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.finance-person-card { min-width: 0; display: grid; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.finance-person-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.finance-person-head h3, .finance-person-head p { margin: 0 0 4px; }
.finance-person-head p { color: var(--muted); font-size: .82rem; }
.data-list { display: grid; gap: 0; margin: 0; }
.data-list > div { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.data-list dt { color: var(--muted); font-size: .78rem; font-weight: 700; }
.data-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.finance-person-card .row-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.finance-person-card button:disabled, .finance-table button:disabled { cursor: not-allowed; opacity: .5; }
.signature-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .7fr); gap: 18px; align-items: start; }
.signature-preview { min-height: 150px; display: grid; place-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); background: #fff; }
.signature-preview img { width: min(100%, 440px); max-height: 130px; object-fit: contain; }
.signature-preview small { color: var(--muted); }
.download-list, .document-upload-list { display: grid; gap: 9px; }
.download-row, .document-upload-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.download-row > div:first-child { min-width: 0; display: flex; align-items: center; gap: 11px; }
.download-row > div:first-child > svg { width: 23px; flex: 0 0 auto; color: var(--teal-700); }
.download-row strong, .download-row small, .document-upload-row strong, .document-upload-row span { display: block; }
.download-row small, .document-upload-row span { margin-top: 3px; color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
.file-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px; border-radius: 6px; color: var(--teal-900); background: var(--teal-100); cursor: pointer; }
.file-button input { position: absolute; width: 1px; min-height: 1px; opacity: 0; pointer-events: none; }
.file-button svg { width: 18px; }
.social-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.social-link { min-width: 0; display: grid; grid-template-columns: 22px minmax(0, 1fr) 18px; align-items: center; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fff; text-decoration: none; font-weight: 800; }
.social-link svg { width: 19px; }
.folder-tree { display: grid; gap: 10px; }
.folder-node { border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.folder-node summary { display: flex; align-items: center; gap: 9px; padding: 11px 12px; cursor: pointer; }
.folder-node summary svg { width: 19px; color: var(--amber-700); }
.year-folder { margin: 0 10px 10px; background: #f8faf9; }
.folder-files { display: grid; padding: 0 11px 10px; }
.folder-files article { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.folder-files article > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.folder-files strong, .folder-files small { display: block; }
.folder-files small { color: var(--muted); overflow-wrap: anywhere; }
.payment-dialog { width: min(440px, calc(100vw - 28px)); }
.payment-qr { width: 276px; min-height: 276px; display: grid; place-items: center; margin: 0 auto 18px; padding: 10px; border: 1px solid var(--line); background: #fff; }
.payment-qr img, .payment-qr canvas { max-width: 100%; height: auto !important; }

@media (max-width: 920px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
  .finance-people-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1340px) {
  .finance-table-wrap { overflow: visible; }
  .finance-table { min-width: 0; border-collapse: separate; }
  .finance-table thead { display: none; }
  .finance-table, .finance-table tbody, .finance-table tr, .finance-table td { display: block; width: 100%; }
  .finance-table tbody { display: grid; gap: 10px; }
  .finance-table tr { padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
  .finance-table td { min-width: 0; display: grid; grid-template-columns: minmax(130px, .55fr) minmax(0, 1.45fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .finance-table td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
  .finance-table td:last-child { border-bottom: 0; }
  .finance-table td[colspan] { display: block; border-bottom: 0; color: var(--muted); text-align: center; }
  .finance-table td[colspan]::before { display: none; }
  .finance-table td .icon-button { justify-self: start; }
}

@media (max-width: 720px) {
  input, select, textarea { font-size: 16px; }
  .app-header { min-height: calc(66px + env(safe-area-inset-top)); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding-top: max(8px, env(safe-area-inset-top)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: 8px; padding-left: max(10px, env(safe-area-inset-left)); }
  button.mobile-menu-button { position: fixed; z-index: 31; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: 52px; min-height: 52px; display: inline-flex; color: #fff; background: var(--teal-700); border-radius: 50%; box-shadow: 0 8px 24px rgba(8, 51, 47, .3); }
  .brand-lockup { gap: 8px; }
  .brand-logo { flex: 0 0 auto; width: 44px; height: 38px; }
  .brand-lockup strong { font-size: .92rem; }
  .brand-lockup span { font-size: .68rem; }
  .header-actions { gap: 2px; }
  .header-actions .icon-button, .header-actions .compact-button { width: 38px; min-height: 38px; padding: 0; }
  .compact-button span { display: none; }
  .app-layout { display: block; min-height: calc(100vh - 72px); }
  .side-nav { display: none; }
  .view-root { padding: 20px 14px calc(88px + env(safe-area-inset-bottom)); }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head .primary-button { width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .summary-tile { min-height: 98px; padding: 12px; }
  .summary-tile strong { font-size: 1.4rem; }
  .section-band { padding: 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .role-fieldset { grid-template-columns: 1fr; }
  .group-assignment-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .list-row { grid-template-columns: 1fr; }
  .list-row .row-actions { justify-content: flex-end; }
  .calendar-table { min-width: 660px; }
  .mobile-card-table-wrap { overflow: visible; }
  .mobile-card-table { min-width: 0; border-collapse: separate; }
  .mobile-card-table thead { display: none; }
  .mobile-card-table, .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display: block; width: 100%; }
  .mobile-card-table tbody { display: grid; gap: 10px; }
  .mobile-card-table tr { padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
  .mobile-card-table td { min-width: 0; display: grid; grid-template-columns: minmax(92px, .75fr) minmax(0, 1.25fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .mobile-card-table td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
  .mobile-card-table td:last-child { border-bottom: 0; }
  .mobile-card-table td[colspan] { display: block; border-bottom: 0; color: var(--muted); text-align: center; }
  .mobile-card-table td[colspan]::before { display: none; }
  .finance-table td .icon-button { justify-self: start; }
  .mobile-nav-dialog { position: fixed; top: auto; right: max(10px, env(safe-area-inset-right)); bottom: calc(76px + env(safe-area-inset-bottom)); left: auto; width: min(350px, calc(100vw - 20px)); max-height: calc(100vh - 96px - env(safe-area-inset-bottom)); margin: 0; }
  .login-shell { align-items: start; padding: max(22px, env(safe-area-inset-top)) 14px; }
  .login-panel { padding: 22px; }
  .login-logo { width: 158px; height: 116px; }
  .loading-stage { padding: 18px 10px; }
  .loading-logo { width: 132px; height: 98px; }
  .modal { padding: 17px; }
  .workflow-head, .member-editor summary { grid-template-columns: 1fr; flex-direction: column; }
  .summary-actions { justify-content: space-between; }
  .settlement-actions > * { width: 100%; }
  .family-link-actions > * { width: 100%; }
  .family-rank-row { grid-template-columns: minmax(0, 1fr) auto; }
  .file-meta { display: none; }
  .attendance-save-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .signature-panel { grid-template-columns: 1fr; }
  .social-links { grid-template-columns: 1fr; }
  .download-row, .document-upload-row { align-items: stretch; flex-direction: column; }
  .download-row .row-actions, .document-upload-row > button, .document-upload-row .file-button { width: 100%; }
  .download-row .row-actions > * { flex: 1; }
  .finance-person-head, .finance-person-card .row-actions { align-items: stretch; flex-direction: column; }
  .finance-person-card .row-actions button { width: 100%; }
  .folder-files article { align-items: flex-start; flex-direction: column; }
  .folder-files article > span:last-child { width: 100%; justify-content: flex-end; }
  .data-list > div { grid-template-columns: 1fr; gap: 3px; }
  .group-active-control { justify-content: flex-end; }
  .group-row-actions { justify-content: space-between !important; }
  .notification-row .secondary-button { width: 100%; }
  .ocr-actions > * { width: 100%; }
  .paper-status-control { grid-template-columns: 1fr; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-logo, .loading-cards span, .loading-track span { animation-duration: 2.6s; animation-timing-function: linear; }
  .loading-cards span { transform: none; }
}

@media (max-width: 430px) {
  .brand-lockup > div { max-width: 72px; }
  .header-actions .icon-button, .header-actions .compact-button { width: 31px; min-height: 34px; }
  .header-actions svg { width: 17px; height: 17px; }
}

@media (max-width: 360px) {
  .app-header { gap: 4px; padding-right: max(7px, env(safe-area-inset-right)); padding-left: max(7px, env(safe-area-inset-left)); }
  .brand-lockup { gap: 6px; }
  .brand-logo { width: 40px; height: 36px; }
  .brand-lockup strong { font-size: .84rem; }
  .brand-lockup span { font-size: .62rem; }
  .header-actions { gap: 0; }
  .brand-lockup > div { max-width: 60px; }
  .header-actions .icon-button, .header-actions .compact-button { width: 29px; min-height: 34px; }
  .view-root { padding-right: 10px; padding-left: 10px; }
  .section-band { padding: 12px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .mobile-card-table td { grid-template-columns: minmax(82px, .7fr) minmax(0, 1.3fr); gap: 8px; }
  .finance-table td { grid-template-columns: minmax(82px, .7fr) minmax(0, 1.3fr); gap: 8px; }
}

@media print {
  .app-header, .side-nav, .bottom-nav, .mobile-menu-button, .page-head button, .no-print { display: none !important; }
  .app-layout { display: block; }
  .view-root { padding: 0; }
  .section-band { border: 0; padding: 0; }
  body { background: #fff; }
}
