:root {
    --rm-red: #c9152e;
    --rm-red-dark: #8f0f22;
    --ink: #20242c;
    --muted: #647084;
    --line: #dde3ec;
    --surface: rgba(255, 255, 255, 0.86);
    --white: #ffffff;
    --success: #176b4d;
    --danger: #a71930;
    --shadow: 0 24px 70px rgba(22, 31, 50, 0.16);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    color: var(--ink);
    background: linear-gradient(135deg, #f7f9fc 0%, #ffffff 42%, #f4edf0 100%);
    min-height: 100vh;
}

.shell {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

.brand-panel {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 300px);
    gap: 24px;
    align-items: end;
    margin-bottom: 18px;
}
.brand-panel.compact {
    display: block;
}

.club {
    margin: 0 0 8px;
    font-weight: 800;
    color: var(--rm-red);
    letter-spacing: 0;
}

h1, h2, p { margin-top: 0; }
h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 4vw, 3.45rem);
    line-height: 1.02;
    letter-spacing: 0;
}
h2 { font-size: 1.25rem; margin-bottom: 0; }
.brand-panel p { color: var(--muted); font-size: 1.02rem; line-height: 1.6; }

.notice, .wizard-card, .login-box, .table-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    border-radius: 8px;
}

.notice { padding: 18px; }
.notice strong, .notice span { display: block; }
.notice span { color: var(--muted); margin-top: 6px; }

.alert {
    border-radius: 8px;
    padding: 14px 16px;
    margin: 14px 0;
    font-weight: 600;
}
.alert.success { background: #eaf7f1; color: var(--success); border: 1px solid #bde2d1; }
.alert.error { background: #fff0f2; color: var(--danger); border: 1px solid #f0b8c2; }

.wizard-card {
    padding: 22px;
    overflow: hidden;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.step-trigger {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    border-radius: 8px;
    padding: 12px;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.step-trigger span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-right: 8px;
    border-radius: 50%;
    background: #eef1f6;
    color: var(--muted);
}
.step-trigger.active {
    border-color: var(--rm-red);
    color: var(--ink);
    box-shadow: 0 12px 30px rgba(201, 21, 46, 0.12);
}
.step-trigger.active span { background: var(--rm-red); color: #fff; }

.wizard-step { display: none; min-height: 332px; }
.wizard-step.active { display: block; animation: fadeUp 180ms ease-out; }
.section-head {
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
    margin-bottom: 20px;
}
.merged-head {
    margin-top: 34px;
}

.grid, .credit-grid {
    display: grid;
    gap: 16px;
}
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
    color: #303744;
    font-size: 0.94rem;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 48px;
    padding: 12px 14px;
    font: inherit;
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
}
textarea {
    min-height: 92px;
    resize: vertical;
}
select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 21px, calc(100% - 12px) 21px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus {
    outline: 3px solid rgba(201, 21, 46, 0.15);
    border-color: var(--rm-red);
}
.invalid input, input.invalid { border-color: var(--danger); }
.invalid select, select.invalid { border-color: var(--danger); }
.invalid textarea, textarea.invalid { border-color: var(--danger); }

.credit-table {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.credit-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.15fr);
    min-height: 54px;
    border-bottom: 1px solid var(--line);
}
.credit-row:last-child { border-bottom: 0; }
.credit-row > label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8fafd;
    border-right: 1px solid var(--line);
}
.credit-row.contingent-row > label {
    display: grid;
    grid-template-columns: auto minmax(140px, 1fr);
    align-items: start;
}
.credit-row.contingent-row > label textarea {
    padding: 8px 10px;
    min-height: 84px;
}
.amount-cell {
    display: grid;
    grid-template-columns: 1fr 54px;
    align-items: center;
}
.amount-cell input {
    border: 0;
    border-radius: 0;
    min-height: 52px;
}
.amount-cell span {
    display: grid;
    place-items: center;
    height: 100%;
    border-left: 1px solid var(--line);
    font-weight: 800;
    color: var(--muted);
    background: #fbfcfe;
}

.dropzone {
    position: relative;
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 230px;
    border: 2px dashed #b8c2d1;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.66);
    text-align: center;
    padding: 24px;
    transition: border-color 160ms ease, background 160ms ease;
}
.dropzone.dragover {
    border-color: var(--rm-red);
    background: #fff7f8;
}
.dropzone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.drop-icon {
    display: grid;
    place-items: center;
    width: 68px;
    height: 82px;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--rm-red), var(--rm-red-dark));
    color: #fff;
    font-weight: 800;
    box-shadow: 0 18px 28px rgba(201, 21, 46, 0.22);
}
.dropzone p { margin: 0; font-weight: 800; }
.dropzone span { color: var(--muted); }
.file-list { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}
.file-list li > span {
    min-width: 0;
    overflow-wrap: anywhere;
}
.large-file-notice {
    margin-top: 12px;
    border: 1px solid #f0b8c2;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff6f7;
    color: var(--danger);
    font-weight: 700;
    line-height: 1.45;
}
.large-file-notice a {
    color: var(--danger);
    text-decoration: underline;
    overflow-wrap: anywhere;
}
.file-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.remove-file {
    min-height: 32px;
    width: 36px;
    padding: 6px;
    border: 1px solid #f0b8c2;
    background: #fff6f7;
    color: var(--danger);
    box-shadow: none;
    font-size: 0;
}
.remove-file::before {
    content: "";
    width: 14px;
    height: 14px;
    display: block;
    background: currentColor;
    clip-path: polygon(8% 18%, 18% 8%, 50% 40%, 82% 8%, 92% 18%, 60% 50%, 92% 82%, 82% 92%, 50% 60%, 18% 92%, 8% 82%, 40% 50%);
}
.review-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.review-item {
    position: relative;
    color: var(--muted);
    padding-right: 72px;
    min-height: 46px;
}
.review-item strong { display: block; color: var(--ink); }
.review-item span {
    display: block;
    overflow-wrap: anywhere;
}
.edit-review {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    min-height: 32px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--rm-red);
    box-shadow: none;
    font-size: 0;
}
.edit-review::before {
    content: "";
    width: 14px;
    height: 14px;
    display: block;
    background: currentColor;
    clip-path: polygon(76% 0, 100% 24%, 33% 91%, 4% 100%, 13% 71%);
}

.toast-zone {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 10px;
    z-index: 20;
    width: min(420px, calc(100% - 36px));
}
.toast {
    border-radius: 8px;
    padding: 13px 15px;
    box-shadow: 0 18px 44px rgba(32, 36, 44, 0.2);
    background: #fff;
    border: 1px solid var(--line);
    font-weight: 700;
    transition: opacity 180ms ease, transform 180ms ease;
}
.toast.error {
    color: var(--danger);
    border-color: #f0b8c2;
    background: #fff6f7;
}
.toast.leaving {
    opacity: 0;
    transform: translateY(8px);
}
.focus-pulse {
    outline: 3px solid rgba(201, 21, 46, 0.2) !important;
    border-color: var(--rm-red) !important;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
    margin-top: 24px;
}
button, .link {
    border: 0;
    border-radius: 8px;
    padding: 13px 18px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.primary { background: var(--rm-red); color: #fff; box-shadow: 0 12px 24px rgba(201, 21, 46, 0.2); }
.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.full { width: 100%; }

.submit-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(247, 249, 252, 0.82);
    backdrop-filter: blur(10px);
}
.submit-overlay-box {
    display: grid;
    justify-items: center;
    gap: 12px;
    width: min(420px, 100%);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.88);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    text-align: center;
}
.submit-overlay-box strong {
    font-size: 1.18rem;
}
.submit-overlay-box span {
    color: var(--muted);
    line-height: 1.5;
}
.submit-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid #f0c6ce;
    border-top-color: var(--rm-red);
    animation: spin 760ms linear infinite;
}
body.is-submitting {
    overflow: hidden;
}
.hidden { display: none; }

.admin-page {
    background: #f5f7fb;
}
.login-box {
    width: min(440px, calc(100% - 32px));
    margin: 9vh auto;
    padding: 28px;
}
.login-box p, .admin-top p { color: var(--muted); }
.login-box form { display: grid; gap: 16px; margin-top: 20px; }

.admin-shell {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}
.admin-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.admin-top h1 { font-size: 2.3rem; }
.admin-actions { display: flex; gap: 10px; }
.table-card { padding: 18px; overflow-x: auto; }
table.dataTable thead th { border-bottom: 1px solid var(--line); }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
    .brand-panel, .grid.two, .review-box { grid-template-columns: 1fr; }
    .credit-row { grid-template-columns: 1fr; }
    .credit-row > label { border-right: 0; border-bottom: 1px solid var(--line); }
    .credit-row.contingent-row > label { grid-template-columns: 1fr; }
    .steps { grid-template-columns: 1fr 1fr; }
    .step-trigger { font-size: 0.88rem; }
    .wizard-card { padding: 16px; }
    .admin-top { align-items: stretch; flex-direction: column; }
    .admin-actions { flex-direction: column; }
}
