/* Shared visual system for every Razor page. Keep page behavior in the existing views and handlers. */
:root {
    color-scheme: light;
    --ink: #17212b;
    --muted: #697586;
    --green: #087f5b;
    --green-dark: #075c43;
    --lime: #12b886;
    --line: #e5eaf0;
    --surface: #ffffff;
    --canvas: #f6f8fa;
    --red: #c92a2a;
    --amber: #b76e00;
    --blue: #1769aa;
    --surface-raised: #ffffff;
    --surface-soft: #f1f5f7;
    --success-soft: #e6fcf5;
    --warning-soft: #fff4dc;
    --danger-soft: #fff0f0;
    --info-soft: #edf5ff;
    --shadow-sm: 0 2px 8px rgb(23 33 43 / 5%);
    --shadow-md: 0 12px 32px rgb(23 33 43 / 8%);
    --focus-ring: 0 0 0 3px rgb(18 184 134 / 20%);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    font-family: Vazir, Tahoma, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e7edf4;
    --muted: #a2afbd;
    --green: #38d39f;
    --green-dark: #0a1514;
    --lime: #58e0b2;
    --line: #2a3542;
    --surface: #171f29;
    --canvas: #0e141b;
    --red: #ff8585;
    --amber: #f3bd58;
    --blue: #7db8ff;
    --surface-raised: #1d2732;
    --surface-soft: #202b36;
    --success-soft: #123c31;
    --warning-soft: #44351a;
    --danger-soft: #442426;
    --info-soft: #1c344c;
    --shadow-sm: 0 2px 8px rgb(0 0 0 / 16%);
    --shadow-md: 0 14px 34px rgb(0 0 0 / 28%);
    --focus-ring: 0 0 0 3px rgb(56 211 159 / 24%);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); font-family: Vazir, Tahoma, sans-serif; line-height: 1.7; }
body, button, input, select, textarea { font-family: Vazir, Tahoma, sans-serif; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
button, input, select, textarea { font-size: inherit; }
button { color: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2, h3 { color: var(--ink); }
::selection { background: rgb(18 184 134 / 22%); }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.skip-link { position: fixed; z-index: 200; top: 10px; right: 10px; transform: translateY(-160%); padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md); }
.skip-link:focus { transform: translateY(0); }

/* Authenticated application shell */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { position: sticky; z-index: 50; top: 0; display: flex; flex: 0 0 272px; flex-direction: column; width: 272px; height: 100vh; height: 100dvh; padding: 18px 14px 14px; overflow: hidden auto; border-left: 1px solid var(--line); background: var(--surface); transition: width .2s ease, flex-basis .2s ease, transform .2s ease; }
.sidebar-brand-row { display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 0 4px 15px; border-bottom: 1px solid var(--line); }
.sidebar-brand { display: flex; flex: 1; align-items: center; min-width: 0; gap: 10px; color: var(--ink); }
.brand-logo { display: block; flex: 0 0 42px; width: 42px; height: 42px; object-fit: contain; }
.sidebar-brand-copy { min-width: 0; }
.sidebar-brand-copy strong, .sidebar-brand-copy small, .brand strong, .brand small { display: block; }
.sidebar-brand-copy strong { font-size: 12px; line-height: 1.7; }
.sidebar-brand-copy small { color: var(--muted); font-size: 10px; }
.sidebar-collapse, .mobile-menu-toggle { display: inline-grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); cursor: pointer; }
.sidebar-collapse:hover, .mobile-menu-toggle:hover { border-color: var(--green); color: var(--green); background: var(--surface-soft); }
.sidebar-collapse i { transition: transform .2s ease; }
.sidebar-user { display: flex; align-items: center; gap: 10px; min-width: 0; margin: 15px 2px 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-soft); }
.sidebar-user-icon { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 11px; background: var(--success-soft); color: var(--green); }
.sidebar-profile-copy { display: grid; min-width: 0; }
.sidebar-profile-copy strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile-copy small { color: var(--muted); font-size: 10px; }
.sidebar-nav { display: grid; align-content: start; gap: 15px; min-height: 0; overflow-y: auto; padding: 3px 0 14px; }
.nav-section { display: grid; gap: 3px; }
.nav-section-title { padding: 0 12px 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.sidebar-link { position: relative; display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 8px 12px; border: 1px solid transparent; border-radius: 11px; color: var(--muted); font-size: 12px; font-weight: 600; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.sidebar-link i { display: grid; flex: 0 0 20px; width: 20px; place-items: center; color: currentColor; font-size: 14px; }
.sidebar-link:hover { background: var(--surface-soft); color: var(--green); }
.sidebar-link.active { border-color: rgb(8 127 91 / 12%); background: var(--success-soft); color: var(--green-dark); font-weight: 800; }
html[data-theme="dark"] .sidebar-link.active { color: var(--green); }
.sidebar-link.active::before { position: absolute; top: 8px; right: 0; bottom: 8px; width: 3px; border-radius: 4px 0 0 4px; background: var(--green); content: ""; }
.sidebar-link-count { display: grid; min-width: 20px; height: 20px; place-items: center; margin-right: auto; padding: 0 5px; border-radius: 20px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; }
.sidebar-bottom { display: grid; gap: 5px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar-logout-form { margin: 0; }
.sidebar-logout, .theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; padding: 8px 11px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.sidebar-logout { width: 100%; justify-content: flex-start; }
.sidebar-logout:hover { border-color: rgb(201 42 42 / 14%); background: var(--danger-soft); color: var(--red); }
.theme-toggle:hover { border-color: var(--line); background: var(--surface-soft); color: var(--green); }
.theme-toggle i { font-size: 13px; }
.sidebar-backdrop { display: none; }
.app-main { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 100vh; }
.app-header { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 72px; padding: 10px clamp(18px, 3vw, 42px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); }
.header-leading, .header-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-menu-toggle { display: none; }
.header-page-context { display: grid; min-width: 0; }
.header-page-context span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.header-page-context strong { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.header-actions .theme-toggle { border-color: var(--line); background: var(--surface); }
.notification-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 42px; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 12px; }
.notification-bell:hover, .notification-bell[aria-current="page"] { border-color: var(--green); color: var(--green); background: var(--success-soft); }
.notification-bell i { font-size: 14px; }
.notification-count { position: absolute; top: -6px; left: -6px; display: grid; min-width: 19px; height: 19px; place-items: center; padding: 0 4px; border: 2px solid var(--surface); border-radius: 20px; background: #d64545; color: #fff; font-size: 9px; font-weight: 800; }
.page-content { width: 100%; max-width: 1600px; margin: 0 auto; padding: 30px clamp(18px, 3vw, 42px) 48px; }
.app-main .page-content { flex: 1 0 auto; }
.site-footer { width: 100%; max-width: none; margin: auto 0 0; padding: 15px 24px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }

/* Guest and authentication pages */
.guest-shell { display: flex; min-height: 100vh; flex-direction: column; }
.guest-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 76px; padding: 12px clamp(18px, 6vw, 76px); border-bottom: 1px solid var(--line); background: var(--surface); }
.guest-brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.guest-brand strong { font-size: 13px; }
.guest-brand small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.guest-content { display: grid; align-content: center; flex: 1; }
.guest-shell .site-footer { margin-top: 0; text-align: center; }
.auth-wrap { width: min(100%, 480px); margin: 15px auto 36px; }
.auth-card { padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-md); }
.auth-card h1 { line-height: 1.65; }

/* Shared page, card, form, and table patterns */
.admin-heading { align-items: flex-start; margin-bottom: 22px; }
.admin-heading h1 { margin: 4px 0 0; color: var(--ink); font-size: clamp(22px, 2vw, 29px); line-height: 1.55; }
.admin-heading .muted { max-width: 780px; margin: 7px 0 0; line-height: 1.9; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 800; }
.muted { color: var(--muted); }
.panel, .metric-card, .quick-link-card, .notification-card, .empty-panel, .managed-event-card, .auth-card, .event-card { border-color: var(--line); background-color: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.panel { border-radius: var(--radius-md); }
.panel h2 { color: var(--ink); }
.disclosure-panel > summary { color: var(--ink); }
.disclosure-panel > summary small { color: var(--muted); }
.disclosure-content { color: var(--ink); }
.sub-disclosure, .nested-panel, .managed-event-teams, .event-roster-requirements, .event-selection-note, .correction-field { border-color: var(--line); background: var(--surface-soft); color: var(--ink); }
.managed-event-teams ul, .event-roster-requirements ul { color: var(--muted); }
.admin-heading .back-link, .back-link { color: var(--muted); }
.section-heading h2 { color: var(--ink); }
.metric-card { border-radius: var(--radius-md); }
.metric-value { color: var(--ink); }
.metric-icon { background: color-mix(in srgb, var(--metric-accent, var(--green)) 14%, var(--surface)); }
.quick-link-card { border-radius: var(--radius-md); color: var(--ink); }
.quick-link-card:hover { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); background: var(--surface-raised); box-shadow: var(--shadow-md); }
.quick-link-icon { background: var(--success-soft); color: var(--green); }
.quick-link-arrow { color: var(--muted); }
.empty-panel, .empty-state, .chat-empty { color: var(--muted); }
.empty-panel { border-radius: var(--radius-md); }

.primary-button, .secondary-button, .link-button { min-height: 40px; border-radius: 10px; font-family: inherit; transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.primary-button { border: 1px solid var(--green); background: var(--green); color: #fff; font-size: 12px; font-weight: 800; box-shadow: 0 3px 8px rgb(8 127 91 / 14%); }
.primary-button:hover { transform: translateY(-1px); background: var(--green-dark); color: #fff; filter: none; }
.secondary-button { border-color: var(--line); background: var(--surface); color: var(--ink); font-size: 12px; }
.secondary-button:hover { border-color: var(--green); background: var(--success-soft); color: var(--green); }
.link-button { color: var(--green); }
.primary-button:disabled, .secondary-button:disabled, button:disabled { cursor: not-allowed; opacity: .58; transform: none; }
.form-stack { gap: 10px; }
.form-stack label:not(.check-row), .form-row label, .archive-filter-row label { color: var(--ink); font-size: 11px; font-weight: 700; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea,
.form-stack input:not([type="checkbox"]):not([type="radio"]), .form-stack select, .form-stack textarea,
.form-row input, .form-row select, .form-row textarea, .archive-filter-row input, .archive-filter-row select {
    min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px;
}
input:not([type="checkbox"]):not([type="radio"]), select, textarea { padding: 9px 12px; }
.form-stack input:not([type="checkbox"]):not([type="radio"]), .form-stack select, .form-stack textarea { padding: 9px 12px; }
.form-row input, .form-row select, .form-row textarea, .archive-filter-row input, .archive-filter-row select { padding: 8px 11px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { border-color: var(--green) !important; outline: 0; box-shadow: var(--focus-ring) !important; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--green); vertical-align: middle; }
input[type="file"] { min-height: 46px; padding: 7px !important; }
textarea { min-height: 88px; resize: vertical; }
.form-row { align-items: start; }
.form-row > div { min-width: 0; }
.compact-form { gap: 8px; }
.compact-form select { min-height: 42px; height: auto; }
.form-actions { flex-wrap: wrap; }
.check-row { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 11px; }
.event-requirement-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 10px; width: 100%; }
.event-requirement-option { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 62px; margin: 0 !important; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; }
.event-requirement-option:hover, .event-requirement-option:focus-within { border-color: var(--green); background: var(--surface-raised); }
.event-requirement-option > input[type="hidden"] { display: none; }
.event-requirement-option > input[type="checkbox"] { flex: 0 0 20px; width: 20px; height: 20px; margin: 0; cursor: pointer; }
.event-requirement-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.event-requirement-copy strong { overflow-wrap: anywhere; font-size: 12px; }
.event-requirement-copy small { color: var(--muted); font-size: 10px; font-weight: 500; }
.event-fee-form { width: 100%; min-width: 0; }
.event-fee-form h2 { margin-bottom: 10px; }
.event-fee-form .check-row { width: fit-content; min-height: 38px; margin: 2px 0 8px; }
.field-label { display: block; margin: 8px 0; color: var(--ink); font-size: 11px; font-weight: 700; }
.event-payment-panel { display: grid; gap: 18px; max-width: 760px; margin-inline: auto; }
.event-payment-panel > .status-pill { justify-self: start; }
.event-payment-amount { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); color: var(--muted); }
.event-payment-amount strong { color: var(--green); font-size: clamp(19px, 3vw, 26px); }
.event-payment-instructions { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.event-payment-instructions h2 { margin: 0 0 8px; font-size: 15px; }
.event-payment-instructions p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.9; }
.event-payment-card-number { width: fit-content; max-width: 100%; margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 18px; font-weight: 800; letter-spacing: .08em; overflow-wrap: anywhere; }
.event-payment-form { gap: 12px; }
.event-payment-review-note { margin: 0; }
.payment-review-list { display: grid; gap: 14px; }
.payment-review-card { display: grid; gap: 15px; margin: 0; }
.payment-review-heading { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.payment-review-heading h2 { margin: 6px 0 0; font-size: 16px; }
.payment-review-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.payment-review-details > div { min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-soft); }
.payment-review-details dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.payment-review-details dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 12px; font-weight: 700; }
.payment-receipt-link { width: fit-content; }
.payment-review-form { gap: 8px; }
.payment-review-form textarea { width: 100%; resize: vertical; }
.payment-review-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.notice { border-color: color-mix(in srgb, var(--green) 20%, var(--line)); background: var(--success-soft); color: var(--green); }
.validation-summary:not(:empty) { border-color: color-mix(in srgb, var(--red) 28%, var(--line)); background: var(--danger-soft); color: var(--red); }
.field-error, .validation-summary { color: var(--red); }

.table-panel { border-color: var(--line); background: var(--surface); }
.table-scroll { max-width: 100%; border-radius: 0 0 var(--radius-md) var(--radius-md); }
table { color: var(--ink); font-size: 12px; }
th, td { border-color: var(--line); }
th { background: var(--surface-soft); color: var(--muted); font-size: 10px; }
td { color: var(--ink); }
.table-scroll tr:hover td { background: var(--surface-soft); }
.table-search { border-color: var(--line); background: var(--surface); color: var(--muted); }
.table-search input { color: var(--ink); }
.table-search:focus-within { border-color: var(--green); box-shadow: var(--focus-ring); }
.row-actions > summary { border-color: var(--line); background: var(--surface); color: var(--green); }
.row-actions[open] > summary { background: var(--success-soft); }
.row-actions form { border-color: var(--line); background: var(--surface-raised); box-shadow: var(--shadow-sm); }
.status-pill { min-height: 25px; border-color: transparent; font-size: 10px; }
.status-approved { border-color: color-mix(in srgb, var(--green) 20%, transparent); background: var(--success-soft); color: var(--green); }
.status-pending { border-color: color-mix(in srgb, var(--amber) 22%, transparent); background: var(--warning-soft); color: var(--amber); }
.status-rejected { border-color: color-mix(in srgb, var(--red) 22%, transparent); background: var(--danger-soft); color: var(--red); }
.status-neutral { border-color: var(--line); background: var(--surface-soft); color: var(--muted); }
.notification-card { border-radius: var(--radius-md); }
.notification-card.is-unread { border-right-color: var(--green); background: var(--success-soft); }
.count-badge { border-color: var(--line); background: var(--success-soft); color: var(--green); }
.compact-form select, .user-create-grid select { border-color: var(--line); background: var(--surface); color: var(--ink); }
.nav-link:hover, .nav-link.active { background: var(--success-soft); color: var(--green); }
.required-document-card { border-color: var(--line); background: var(--surface); color: var(--ink); }
.required-document-card.is-selected { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 13%, transparent); }
.focused-upload-context .event-upload-hint { background: var(--success-soft); color: var(--ink); }
.table-scroll tbody tr { background: var(--surface); }
.table-scroll tbody td { border-bottom-color: var(--line); }
form[aria-busy="true"] [type="submit"] { cursor: progress; opacity: .7; }
.notification-open { color: var(--ink); }
.notification-open:hover { background: var(--surface-soft); }
.metric-grid { margin-bottom: 26px; }
.dashboard-welcome { display: flex; align-items: center; justify-content: space-between; gap: 22px; min-height: 146px; margin: 0 0 24px; padding: clamp(20px, 3vw, 34px); border-right: 4px solid var(--green); }
.dashboard-welcome h1 { margin: 4px 0 2px; font-size: clamp(23px, 2.4vw, 32px); line-height: 1.5; }
.dashboard-welcome .muted { max-width: 780px; margin: 4px 0 0; line-height: 1.9; }
.dashboard-welcome-icon { display: grid; flex: 0 0 70px; width: 70px; height: 70px; place-items: center; border-radius: 22px; background: var(--success-soft); color: var(--green); font-size: 27px; }
.review-decision-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; margin-top: 3px; }
.decision-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; font: inherit; font-size: 10px; font-weight: 800; cursor: pointer; transition: filter .15s ease, transform .15s ease; }
.decision-button:hover { filter: brightness(.96); transform: translateY(-1px); }
.decision-approved { border-color: color-mix(in srgb, var(--green) 24%, var(--line)); background: var(--success-soft); color: var(--green); }
.decision-correction { border-color: color-mix(in srgb, var(--amber) 26%, var(--line)); background: var(--warning-soft); color: var(--amber); }
.decision-rejected { border-color: color-mix(in srgb, var(--red) 24%, var(--line)); background: var(--danger-soft); color: var(--red); }
.managed-event-icon { background: var(--warning-soft); color: var(--amber); }
.event-card > summary { color: var(--ink); }
.event-summary-meta { color: var(--muted); }
.event-actions .nav-link { color: var(--green); }
.archive-filter-panel { background: var(--surface); }
.support-sidebar, .support-chat { min-width: 0; }
.support-thread { border-color: var(--line); background: var(--surface); color: var(--ink); }
.support-thread:hover, .support-thread.selected { border-color: var(--green); background: var(--success-soft); }
.chat-header { border-color: var(--line); }
.chat-message { border: 1px solid var(--line); background: var(--surface-soft); color: var(--ink); }
.chat-message.mine { border-color: color-mix(in srgb, var(--green) 20%, var(--line)); background: var(--success-soft); }
.chat-message.theirs { background: var(--surface-soft); }
.chat-message time { color: var(--muted); }
.chat-compose textarea { min-width: 0; }
.correction-context { border-color: var(--line); background: var(--surface); }
.correction-context-meta { border-color: var(--line); color: var(--ink); }
.correction-field { background: var(--surface-soft); }
.pdp-default { border: 1px solid var(--line); background: var(--surface) !important; color: var(--ink) !important; box-shadow: var(--shadow-md); }
.pdp-default .pdp-header { background: var(--green) !important; color: #fff !important; }
.pdp-default .pdp-footer { background: var(--surface-soft) !important; }

@media (min-width: 761px) {
    .app-shell.sidebar-collapsed .app-sidebar { flex-basis: 82px; width: 82px; padding-right: 10px; padding-left: 10px; }
    .app-shell.sidebar-collapsed .sidebar-brand-row { flex-direction: column; justify-content: center; padding-right: 0; padding-left: 0; }
    .app-shell.sidebar-collapsed .sidebar-brand { flex: 0 0 auto; justify-content: center; }
    .app-shell.sidebar-collapsed .sidebar-brand-copy { display: none; }
    .app-shell.sidebar-collapsed .sidebar-profile-copy, .app-shell.sidebar-collapsed .nav-section-title, .app-shell.sidebar-collapsed .sidebar-link-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
    .app-shell.sidebar-collapsed .sidebar-user { justify-content: center; margin-right: 0; margin-left: 0; padding: 6px; }
    .app-shell.sidebar-collapsed .sidebar-link { justify-content: center; padding: 9px 6px; }
    .app-shell.sidebar-collapsed .sidebar-link i { flex-basis: 24px; width: 24px; font-size: 16px; }
    .app-shell.sidebar-collapsed .sidebar-link-count { position: absolute; top: 2px; left: 3px; min-width: 17px; height: 17px; font-size: 8px; }
    .app-shell.sidebar-collapsed .sidebar-logout { justify-content: center; padding: 9px; }
    .app-shell.sidebar-collapsed .sidebar-collapse i { transform: rotate(180deg); }
}

@media (max-width: 1023px) {
    .app-sidebar { flex-basis: 246px; width: 246px; }
    .page-content { padding-right: 24px; padding-left: 24px; }
}

@media (max-width: 760px) {
    body.drawer-open { overflow: hidden; }
    .app-shell { display: block; }
    .app-sidebar { position: fixed; z-index: 100; top: 0; right: 0; bottom: 0; width: min(86vw, 310px); height: 100dvh; transform: translateX(110%); box-shadow: var(--shadow-md); }
    .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
    .sidebar-collapse { display: none; }
    .sidebar-backdrop:not([hidden]) { position: fixed; z-index: 90; inset: 0; display: block; width: 100%; height: 100%; border: 0; background: rgb(8 15 22 / 48%); }
    .mobile-menu-toggle { display: inline-grid; }
    .app-header { min-height: 62px; padding: 9px 13px; gap: 8px; }
    .header-leading, .header-actions { gap: 8px; }
    .header-page-context span { font-size: 9px; }
    .header-page-context strong { max-width: 43vw; font-size: 11px; }
    .header-theme-toggle { width: 38px; min-width: 38px; padding: 7px; }
    .header-theme-toggle span, .notification-label { display: none; }
    .notification-bell { width: 38px; min-width: 38px; min-height: 38px; padding: 7px; }
    .page-content { padding: 20px 12px 34px; }
    .admin-heading { gap: 12px; margin-bottom: 16px; }
    .admin-heading h1 { font-size: 22px; }
    .admin-heading .muted { font-size: 11px; }
    .panel { margin-bottom: 12px; padding: 15px; border-radius: 14px; }
    .table-panel.disclosure-panel { padding: 0; }
    .table-panel.disclosure-panel > summary { padding: 14px; }
    .table-panel.disclosure-panel > .disclosure-content { padding: 12px; }
    .form-row, .management-grid, .user-create-grid { grid-template-columns: minmax(0, 1fr); }
    .form-row > div { min-width: 0; }
    .form-stack input:not([type="checkbox"]):not([type="radio"]), .form-stack select, .form-stack textarea, .form-row input, .form-row select, .form-row textarea, .archive-filter-row input, .archive-filter-row select { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
    .primary-button, .secondary-button { min-height: 42px; }
    .compact-form .primary-button { align-self: stretch; }
    .form-actions { align-items: stretch; flex-direction: column; }
    .form-actions > * { width: 100%; }
    .table-search { width: 100%; }
    .table-scroll { overflow: visible; }
    .table-scroll table, .table-scroll tbody { display: block; width: 100%; }
    .table-scroll thead { display: none; }
    .table-scroll tbody tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0 0 10px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
    .table-scroll tbody td { display: grid; grid-template-columns: minmax(78px, 30%) minmax(0, 1fr); align-items: start; gap: 9px; width: 100%; min-width: 0; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); white-space: normal; overflow-wrap: anywhere; text-align: right; font-size: 11px; }
    .table-scroll tbody td:last-child { border-bottom: 0; }
    .table-scroll tbody td::before { color: var(--muted); font-size: 9px; font-weight: 800; line-height: 1.8; }
    .table-scroll tbody td.empty-state { display: block; padding: 18px 8px; text-align: center; }
    .table-scroll tbody td.empty-state::before { content: none; }
    .table-scroll tbody td form, .table-scroll tbody td details { min-width: 0; max-width: 100%; }
    .row-actions form { width: 100%; min-width: 0; padding: 10px; }
    .row-actions input, .row-actions select { font-size: 16px; }
    .disclosure-panel > summary { align-items: flex-start; gap: 9px; font-size: 12px; }
    .disclosure-panel > summary small { font-size: 10px; }
    .disclosure-content { padding-top: 13px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 20px; }
    .dashboard-welcome { min-height: 0; margin-bottom: 18px; padding: 19px 16px; }
    .dashboard-welcome-icon { flex-basis: 48px; width: 48px; height: 48px; border-radius: 15px; font-size: 19px; }
    .metric-card { min-height: 88px; padding: 12px; column-gap: 9px; }
    .metric-icon { width: 35px; height: 35px; font-size: 14px; }
    .metric-value { font-size: 20px; }
    .quick-link-grid { grid-template-columns: minmax(0, 1fr); }
    .notification-open { align-items: flex-start; padding: 13px 12px; }
    .notification-open time { font-size: 9px; }
    .support-layout { grid-template-columns: minmax(0, 1fr); }
    .support-sidebar, .support-chat { min-height: 0; }
    .chat-messages { height: min(48vh, 440px); }
    .chat-compose { align-items: stretch; flex-direction: column; }
    .chat-message-input { width: 100%; }
    .chat-compose .primary-button { width: 100%; }
    .event-card > summary { align-items: flex-start; padding: 13px; }
    .event-summary-meta { align-items: flex-end; flex-direction: column; gap: 5px; }
    .event-detail { padding: 0 11px 13px; }
    .event-actions, .managed-event-actions { align-items: stretch; flex-direction: column; }
    .event-actions > *, .managed-event-actions > * { width: 100%; }
    .sub-disclosure { padding: 10px; }
    .archive-filter-panel { padding: 13px; }
    .archive-filter-row { grid-template-columns: minmax(0, 1fr); }
    .focused-upload-heading { align-items: stretch; flex-direction: column; }
    .focused-upload-heading > .secondary-button { width: 100%; }
    .required-document-grid { grid-template-columns: minmax(0, 1fr); }
    .event-payment-amount { align-items: flex-start; flex-direction: column; gap: 7px; padding: 14px; }
    .payment-review-heading { align-items: flex-start; flex-direction: column; }
    .payment-review-details { grid-template-columns: minmax(0, 1fr); }
    .payment-review-actions { align-items: stretch; flex-direction: column; }
    .payment-review-actions > * { width: 100%; }
    .payment-receipt-link { width: 100%; justify-content: center; }
    .required-document-actions { align-items: stretch; flex-direction: column; }
    .required-document-actions > * { width: 100%; justify-content: center; }
    .event-document-action { width: 100%; margin: 0 0 7px; justify-content: center; }
    .auth-card { padding: 22px 18px; }
    .review-decision-actions { grid-template-columns: minmax(0, 1fr); }
    .decision-button { min-height: 44px; font-size: 12px; }
    .guest-header { min-height: 66px; padding: 10px 13px; }
    .guest-brand { min-width: 0; gap: 8px; }
    .guest-brand strong { font-size: 11px; }
    .guest-brand small { font-size: 9px; }
    .guest-brand .brand-logo { width: 38px; height: 38px; flex-basis: 38px; }
    .site-footer { padding: 14px 10px; font-size: 9px; }
}

@media (max-width: 390px) {
    .page-content { padding-right: 9px; padding-left: 9px; }
    .metric-card { grid-template-columns: 1fr; justify-items: start; gap: 5px; }
    .metric-icon { grid-row: auto; }
    .header-page-context span { display: none; }
    .header-page-context strong { max-width: 46vw; }
    .table-scroll tbody tr { padding-right: 9px; padding-left: 9px; }
    .table-scroll tbody td { grid-template-columns: minmax(68px, 28%) minmax(0, 1fr); gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
    .app-sidebar, .app-header, .sidebar-backdrop, .site-footer, .table-search, .form-actions, button, .primary-button, .secondary-button { display: none !important; }
    .app-main, .app-shell, .page-content { display: block; width: 100%; max-width: none; margin: 0; padding: 0; background: white; color: black; }
    .panel, .table-panel { break-inside: avoid; box-shadow: none; }
}

@media (max-width: 760px) {
    .row-actions, .table-scroll tbody td details { width: 100%; min-width: 0; }
    .row-actions[open] { display: block; }
    .row-actions[open] > summary { display: flex; width: 100%; justify-content: space-between; }
    .row-actions form { width: 100%; min-width: 0; margin: 8px 0 0; padding: 10px; }
    .row-actions input, .row-actions select, .row-actions textarea { width: 100%; min-width: 0; }
    .row-actions .secondary-button { width: 100%; }
    .table-scroll tbody td.table-action-cell { grid-template-columns: minmax(0, 1fr); align-content: start; }
}

.document-review-filter { grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.4fr) auto; align-items: end; }
.document-review-filter select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
.document-review-filter [hidden] { display: none !important; }
.document-review-list { display: grid; gap: 16px; }
.document-review-card { display: grid; gap: 14px; min-width: 0; margin: 0; }
.document-review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.document-review-heading h2 { margin: 5px 0 2px; font-size: 16px; }
.document-review-heading .muted { margin: 4px 0 0; overflow-wrap: anywhere; }
.document-inline-preview { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 190px; max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #edf1ee; }
.document-inline-preview iframe { display: block; width: 100%; height: min(65vh, 560px); min-height: 340px; border: 0; background: #fff; }
.document-inline-preview > img { display: block; max-width: 100%; max-height: 500px; object-fit: contain; }
.document-preview-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.document-preview-actions > .muted { flex: 1 1 220px; overflow-wrap: anywhere; }
.document-review-form { padding-top: 14px; border-top: 1px solid var(--line); }
.payment-receipt-preview { display: grid; gap: 10px; min-width: 0; }
.payment-receipt-preview .document-inline-preview { max-width: 900px; }
.receipt-detail-panel { display: grid; gap: 14px; }
.receipt-detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.receipt-detail-meta strong { color: var(--green); font-size: 20px; }
.receipt-detail-meta > .muted { overflow-wrap: anywhere; }
.document-detail-preview { max-height: 76vh; }
.document-image-toolbar { position: sticky; top: 0; z-index: 2; display: flex; flex: 0 0 auto; align-self: flex-start; gap: 6px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.document-image-toolbar button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; min-width: 38px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.document-image-viewport { display: block; flex: 1 1 auto; min-width: 0; padding: 12px; overflow: auto; text-align: center; }
.document-image-viewport img { display: block; width: 100%; max-width: none; height: auto; margin: 0 auto; transform-origin: center; }
.document-field-preview { display: grid; justify-items: start; gap: 7px; min-width: 130px; }
.document-field-preview iframe { width: min(320px, 70vw); height: 240px; border: 1px solid var(--line); border-radius: 9px; }
.document-field-preview img { max-width: min(320px, 70vw); max-height: 260px; border: 1px solid var(--line); border-radius: 9px; object-fit: contain; }
.document-table-preview { display: grid; justify-items: start; gap: 7px; width: min(280px, 64vw); margin-top: 9px; }
.document-table-preview iframe { width: 100%; height: 190px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.document-table-preview img { max-width: 100%; max-height: 230px; border: 1px solid var(--line); border-radius: 9px; object-fit: contain; }
.upload-inline-preview { display: grid; justify-items: start; gap: 7px; max-width: min(640px, 100%); margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.upload-inline-preview[hidden] { display: none !important; }
.upload-preview-name { margin: 0; overflow-wrap: anywhere; }
.upload-inline-preview iframe { width: min(560px, 100%); height: min(55vh, 460px); min-height: 250px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.upload-inline-preview img { display: block; max-width: min(560px, 100%); max-height: 420px; border: 1px solid var(--line); border-radius: 8px; object-fit: contain; }

@media (max-width: 760px) {
    .document-review-filter { grid-template-columns: minmax(0, 1fr); }
    .document-review-heading { flex-direction: column; }
    .document-inline-preview { min-height: 160px; }
    .document-inline-preview iframe { height: 58vh; min-height: 280px; }
    .document-preview-actions > * { max-width: 100%; }
    .document-image-toolbar { flex-wrap: wrap; }
    .document-table-preview { width: min(280px, 76vw); }
    .upload-inline-preview { width: 100%; }
}
