* { box-sizing: border-box; }
body { margin: 0; padding: 20px; background: linear-gradient(135deg, #667eea, #764ba2); color: #1f2937; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
main { max-width: 1200px; margin: auto; background: white; border-radius: 14px; padding: 24px; }
h1, h2, h3 { line-height: 1.2; }
h1 { margin-top: 0; }
section { border-top: 1px solid #d1d5db; padding-top: 20px; margin-top: 24px; }
label { display: block; font-weight: 600; margin: 12px 0; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; padding: 10px; border: 1px solid #6b7280; border-radius: 6px; margin-top: 5px; }
textarea { min-height: 100px; }
input[type=checkbox] { width: 20px; height: 20px; vertical-align: middle; margin-right: 8px; }
button, .button { display: inline-block; padding: 10px 16px; background: #4338ca; border: none; border-radius: 6px; color: white; cursor: pointer; text-decoration: none; margin: 4px 8px 4px 0; }
button.secondary { background: #374151; }
button:disabled { opacity: .6; cursor: not-allowed; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
a { color: #3730a3; overflow-wrap: anywhere; }
fieldset { border: 1px solid #d1d5db; border-radius: 8px; padding: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.notice { padding: 12px; background: #fffbeb; border: 1px solid #d97706; border-radius: 6px; }
.error { color: #991b1b; background: #fef2f2; border: 1px solid #b91c1c; padding: 12px; border-radius: 6px; }
.success { color: #14532d; background: #f0fdf4; padding: 12px; border: 1px solid #15803d; }
.muted { color: #4b5563; }
.card { border: 1px solid #d1d5db; border-radius: 8px; padding: 16px; margin: 12px 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid #d1d5db; vertical-align: top; }
.policy { white-space: pre-wrap; max-height: 280px; overflow: auto; }
.banner { max-width: 100%; max-height: 240px; object-fit: contain; }
.logo { max-width: 180px; max-height: 120px; object-fit: contain; }
dl { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
dd { margin: 0; font-weight: 600; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) { body { padding: 8px; } main { padding: 16px; } .grid { grid-template-columns: 1fr; } h1 { font-size: 1.7rem; } }
@media print { body { background: white; padding: 0; } main { padding: 0; } button, nav { display: none; } }

/* Keep the management workspace separate from public registration styling. */
.management-page {
    background: #f3f5f9;
    color: #223047;
    padding: 32px;
    font-size: 15px;
}
.management-page main { max-width: 1440px; background: transparent; padding: 0; border-radius: 0; }
.module-page main { background: #fff; padding: 28px; border: 1px solid #e0e6ef; border-radius: 12px; }
.module-page section { margin-top: 20px; }
.module-page label { margin-top: 12px; }
.management-page [hidden] { display: none !important; }
.management-page h1 { font-size: 1.85rem; letter-spacing: -.035em; margin: 6px 0 10px; }
.management-page h2 { font-size: 1.35rem; letter-spacing: -.02em; margin: 0 0 18px; }
.module-page h2 { margin-top: 28px; }
.management-page h3 { font-size: 1.1rem; margin: 12px 0; }
.management-page p { margin: 8px 0 16px; }
.management-page .muted { color: #64748b; }
.management-page .eyebrow { color: #52627d; font-size: .72rem; font-weight: 750; letter-spacing: .13em; margin: 0; }
.management-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 26px; }
.account-nav { text-align: right; flex-shrink: 0; }
.management-page button, .management-page .button {
    background: #3549b5; border: 1px solid transparent; border-radius: 8px;
    font-size: .9rem; font-weight: 650; padding: 10px 16px; min-height: 42px;
    transition: background .15s, box-shadow .15s;
}
.management-page button:hover:not(:disabled), .management-page .button:hover { background: #283a96; }
.management-page button.secondary { background: #fff; border-color: #d7dfeb; color: #334155; }
.management-page button.secondary:hover:not(:disabled) { background: #eef2f8; }
.management-page a { color: #3549b5; }
.management-page a.button { color: #fff; }
.management-page section { margin: 0; padding: 26px; border: 1px solid #e0e6ef; border-radius: 12px; background: #fff; }
.management-page main > section + section { margin-top: 22px; }
.management-page label { color: #475569; font-weight: 600; font-size: .87rem; margin: 0; }
.management-page input:not([type=checkbox]), .management-page select, .management-page textarea {
    padding: 11px 12px; border-color: #cbd5e1; background: #fff; color: #172337; border-radius: 8px; margin: 7px 0 16px;
}
.management-page input:read-only { background: #f1f5f9; color: #64748b; }
.management-page textarea { min-height: 120px; resize: vertical; }
.management-page input[type=checkbox] { accent-color: #3549b5; }
.management-page fieldset { border-color: #e0e6ef; padding: 20px; margin: 0 0 22px; border-radius: 10px; }
.management-page legend { font-weight: 700; color: #24334b; padding: 0 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; }
.management-page details { border: 1px solid #e0e6ef; border-radius: 8px; padding: 14px 18px; margin: 16px 0; }
.management-page summary { cursor: pointer; font-weight: 650; color: #3549b5; }
.management-page details[open] > summary { margin-bottom: 18px; }
.management-page .card { border-color: #e0e6ef; padding: 20px; border-radius: 10px; margin: 14px 0; }
.event-grid, .module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.management-page .event-card { margin: 0; display: flex; flex-direction: column; align-items: flex-start; }
.event-card button { margin-top: auto; }
.event-list > label { max-width: 480px; }
.event-workspace { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 22px; align-items: start; }
.event-heading { grid-column: 1 / -1; padding: 22px 26px; border: 1px solid #e0e6ef; border-radius: 12px; background: #fff; }
.event-heading h2 { margin: 6px 0 10px; font-size: 1.6rem; }
.event-heading p:last-child { margin-bottom: 0; }
.workspace-nav { position: sticky; top: 22px; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid #e0e6ef; border-radius: 12px; background: #fff; }
.management-page .workspace-nav button { text-align: left; background: transparent; color: #52627d; margin: 0; width: 100%; }
.management-page .workspace-nav button:hover { background: #f1f4fa; }
.management-page .workspace-nav button.active { background: #eaf0ff; color: #2b409c; box-shadow: inset 3px 0 #3549b5; }
.workspace-content { min-width: 0; }
.class-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 14px; align-items: start; }
.management-page .class-card { margin: 0; padding: 16px; }
.class-card .form-grid { grid-template-columns: 1fr; gap: 0; }
.class-card p { font-size: .83rem; }
.class-card button { padding: 7px 10px; font-size: .8rem; min-height: 34px; }
.class-card details { padding: 10px; }
.info-help { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #64748b; border-radius: 50%; width: 19px; height: 19px; font-size: .75rem; margin-left: 6px; cursor: help; color: #3549b5; }
.upload-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.upload-row label { flex: 1 1 260px; }
.management-page .upload-row button { margin: 7px 0 16px; white-space: nowrap; }
.event-url { display: block; margin: 6px 0 16px; padding: 10px 12px; background: #f1f5fd; border-radius: 6px; font-family: ui-monospace, monospace; font-size: .85rem; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.metric-card { padding: 16px; border-radius: 9px; border: 1px solid #e0e6ef; background: #f7f9fc; }
.metric-card span { display: block; font-size: .8rem; color: #64748b; }
.metric-card strong { display: block; font-size: 1.5rem; margin-top: 6px; letter-spacing: -.03em; }
.ledger-group { margin: 24px 0; }
.module-page .workspace-content > section > section { padding: 16px; border-radius: 8px; margin: 14px 0; }
.module-page .workspace-content > section > form { max-width: 760px; margin: 18px 0; }
.module-page .workspace-content > section > section > form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.module-page .workspace-content > section > section > form > p { grid-column: 1 / -1; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 8px 0 26px; }
.stat-card { background: #f7f9fc; border: 1px solid #e5eaf2; border-radius: 10px; padding: 18px; }
.stat-card span { display: block; color: #64748b; font-size: .8rem; }
.stat-card strong { display: block; font-size: 1.8rem; letter-spacing: -.04em; margin-top: 6px; }
.management-page .module-card { padding: 22px; border: 1px solid #dfe6f1; border-radius: 10px; text-decoration: none; color: #223047; display: flex; flex-direction: column; gap: 10px; }
.management-page .module-card:hover { border-color: #8ea0dc; background: #f8faff; }
.module-card strong { font-size: 1rem; }
.module-card span { color: #64748b; font-size: .88rem; }
.module-card .module-action { color: #3549b5; font-weight: 650; margin-top: auto; }
.management-page .notice { border-color: #dce5f5; background: #f1f5fd; color: #465a80; padding: 15px 18px; margin-top: 22px; }
.management-page .success, .management-page .error { padding: 14px 18px; border-radius: 8px; }
.status-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; background: #edf1f7; color: #52627d; font-size: .75rem; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.status-badge[data-status=published], .status-badge[data-status=paid], .status-badge[data-status=registered] { background: #e5f5ed; color: #216746; }
.status-badge[data-status=pending_payment] { background: #fff3dd; color: #855919; }
.status-badge[data-status=cancelled] { background: #fbeaec; color: #9c3e4d; }
.registration-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 0 16px; margin-bottom: 16px; }
.registration-filters button { justify-self: start; }
.management-page table { font-size: .85rem; }
.management-page th { color: #52627d; font-weight: 650; background: #f6f8fc; font-size: .78rem; padding: 14px 12px; }
.management-page td { border-color: #e5eaf2; padding: 16px 12px; }
.management-page tbody tr:hover { background: #fafbfe; }
.table-secondary { display: block; color: #64748b; font-size: .75rem; margin-top: 5px; }
.management-page td details { min-width: 220px; }
.management-page pre { background: #f6f8fc; border-radius: 8px; padding: 16px; font-size: .85rem; }
.empty-state { padding: 24px; text-align: center; background: #f7f9fc; border-radius: 8px; color: #64748b; }
.guest-ticket { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.guest-camera { display: block; max-width: 100%; width: 480px; border-radius: 8px; margin: 12px 0; }
.login-card { max-width: 460px; margin: 50px auto; padding: 32px; background: #fff; border: 1px solid #e0e6ef; border-radius: 14px; box-shadow: 0 8px 32px #22304708; }
.login-card > a { display: block; margin-top: 20px; }
@media (max-width: 1050px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .registration-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .management-page { padding: 16px; }
    .management-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .account-nav { text-align: left; }
    .event-workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .workspace-nav { position: static; flex-direction: row; overflow-x: auto; }
    .management-page .workspace-nav button { width: auto; flex-shrink: 0; white-space: nowrap; }
    .management-page section, .event-heading { padding: 20px; }
    .module-page main { padding: 18px; }
    .form-grid, .event-grid, .module-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 450px) { .registration-filters { grid-template-columns: minmax(0, 1fr); } .stat-card { padding: 12px; } }
@media print { .management-page { background: #fff; padding: 0; } .management-header, .workspace-nav { display: none; } .event-workspace { display: block; } }
