:root {
    color-scheme: light;
    --ink: #251315;
    --muted: #715b5e;
    --line: #ead4d7;
    --soft: #fff5f6;
    --paper: #ffffff;
    --red: #b5121b;
    --deep-red: #7f0d14;
    --blue: #b5121b;
    --green: #227a4b;
    --amber: #a45b00;
    --shadow: 0 16px 40px rgba(127, 13, 20, 0.13);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: #fff7f8;
}

a {
    color: var(--blue);
}

.page-head {
    min-height: 250px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    padding: 34px min(5vw, 64px);
    background:
        linear-gradient(90deg, rgba(127, 13, 20, 0.94), rgba(181, 18, 27, 0.64)),
        url("https://images.unsplash.com/photo-1612872087720-bb876e2e67d1?auto=format&fit=crop&w=1800&q=80") center 38% / cover;
    color: #fff;
}

.compact-head {
    min-height: 190px;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
}

h1,
h2,
h3 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(34px, 6vw, 72px);
    line-height: 1;
}

.head-copy {
    max-width: 780px;
}

.head-copy p:last-child {
    max-width: 680px;
    margin: 14px 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 18px;
    line-height: 1.45;
}

.head-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.shell {
    width: min(1180px, calc(100% - 28px));
    margin: -34px auto 56px;
}

body:has(#adminTeamList) .shell {
    width: min(1240px, calc(100% - 20px));
}

.section,
.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.section {
    padding: 24px;
}

.panel {
    padding: 18px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-stack {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.wide {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d8aeb4;
    border-radius: 6px;
    padding: 11px 12px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(181, 18, 27, 0.16);
    border-color: var(--red);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    padding: 0 15px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    background: var(--red);
    cursor: pointer;
}

button.secondary,
.button.secondary {
    color: var(--deep-red);
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.7);
}

button.danger {
    background: var(--red);
}

button.ghost-danger {
    color: var(--red);
    background: #fff;
    border: 1px solid var(--red);
}

button.success {
    background: var(--green);
}

button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.admin-menu {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 18px;
}

.admin-menu .button.secondary {
    border-color: var(--line);
}

.admin-menu .button.active {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
}

.team-list {
    display: grid;
    gap: 14px;
}

.team-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: var(--soft);
}

.team-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.check {
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    font-weight: 600;
    background: #fff;
}

.check:has(input:checked) {
    border-color: var(--red);
    background: #fff0f1;
}

.check input {
    width: auto;
}

.status {
    min-height: 26px;
    margin-top: 12px;
    color: var(--muted);
}

.status.ok {
    color: var(--green);
}

.status.error {
    color: var(--red);
}

.price-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    margin-top: 4px;
    font-size: 24px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 16px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: #fff0f1;
    font-size: 13px;
    color: var(--deep-red);
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 9px;
    font-size: 13px;
    font-weight: 700;
    color: var(--deep-red);
    background: #fff0f1;
}

.pill.green {
    color: #fff;
    background: var(--green);
}

.pill.amber {
    color: #fff;
    background: var(--amber);
}

.pill.red {
    color: #fff;
    background: var(--red);
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.settings-list {
    display: grid;
    gap: 10px;
}

.settings-list label {
    font-size: 13px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.settings-grid label {
    font-size: 13px;
}

.dropdown-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    list-style: none;
}

.dropdown-panel summary::-webkit-details-marker {
    display: none;
}

.dropdown-panel summary strong {
    display: block;
    font-size: 22px;
}

.summary-hint {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.panel-actions {
    margin-top: 14px;
}

.confirm-line {
    max-width: 420px;
    margin-top: 16px;
}

.admin-dialog {
    width: min(720px, calc(100% - 28px));
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    color: var(--ink);
    box-shadow: var(--shadow);
}

.admin-dialog::backdrop {
    background: rgba(37, 19, 21, 0.45);
}

.dialog-progress {
    margin-top: 16px;
    color: var(--muted);
    font-weight: 700;
}

.reset-panel .muted {
    max-width: 720px;
}

.team-name-input {
    min-width: 0;
}

.team-count {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.team-list-head,
.team-list-item {
    display: grid;
    grid-template-columns: 54px minmax(180px, 1.3fr) minmax(220px, 1.35fr) minmax(120px, 0.75fr) 110px 86px 44px;
    gap: 12px;
    align-items: center;
}

.team-list-head {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    color: var(--deep-red);
    background: #fff0f1;
    font-size: 12px;
    font-weight: 800;
}

.admin-team-list {
    display: grid;
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    background: #fff;
}

.team-list-item {
    min-height: 58px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
}

.team-list-item:last-child {
    border-bottom: 0;
}

.team-list-item:hover {
    background: #fffafa;
}

.team-list-item.is-cancelled {
    background: #fff6f6;
}

.team-list-item.is-cancelled .team-main strong {
    text-decoration: line-through;
    color: var(--muted);
}

.team-col {
    min-width: 0;
}

.team-number {
    color: var(--muted);
    font-weight: 800;
}

.team-main,
.team-contact {
    display: grid;
    gap: 2px;
}

.team-main strong,
.team-contact strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-main span,
.team-contact span,
.team-place {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-contact {
    position: relative;
    padding-right: 38px;
}

.team-contact .wa-button {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.team-actions-cell {
    display: flex;
    justify-content: flex-end;
}

.paid-state {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 8px;
    color: var(--muted);
    background: #f6eeee;
    font-weight: 800;
}

.paid-state.paid-yes {
    color: #fff;
    background: var(--green);
}

.team-edit-dialog {
    width: min(820px, calc(100% - 28px));
}

.dialog-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.team-edit-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.team-edit-modal-grid .wide {
    grid-column: span 2;
}

.modal-section-title {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--deep-red);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.modal-check {
    display: flex;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

.slot-input {
    width: 48px;
}

.slot-cell {
    color: var(--muted);
    font-weight: 800;
}

.team-edit-cell,
.refund-cell,
.row-actions,
.contact-cell {
    display: grid;
    gap: 8px;
}

.compact-team-row td {
    padding-top: 7px;
    padding-bottom: 7px;
}

.team-read-cell {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.team-name-read {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-read-cell span {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-cell {
    white-space: normal;
    line-height: 1.25;
}

.contact-cell span {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.row-actions {
    align-content: start;
}

.row-actions button {
    width: 100%;
    min-height: 32px;
    padding: 0 8px;
    font-size: 12px;
}

.icon-actions {
    text-align: right;
}

.icon-button {
    width: 30px;
    min-height: 30px;
    padding: 0;
    color: var(--deep-red);
    background: #fff;
    border: 1px solid var(--line);
    font-size: 17px;
    line-height: 1;
}

.icon-button:hover {
    color: #fff;
    background: var(--red);
}

.paid-check {
    width: auto;
    margin-top: 10px;
}

.wa-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    color: #fff;
    background: #1fa855;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.row-details summary {
    width: max-content;
    cursor: pointer;
    color: var(--deep-red);
    font-weight: 700;
}

.row-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fffafa;
}

.row-detail-grid label {
    gap: 4px;
    font-size: 11px;
}

.cancelled-row td {
    background: #fff6f6;
}

.public-cancelled td {
    background: #f2eef0;
    color: #8b7b7e;
}

.cancelled-row td:nth-child(2) input:first-child,
.public-cancelled .team-name-cell {
    text-decoration: line-through;
    color: var(--muted);
}

.mini-check {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 700;
}

.mini-check input {
    width: auto;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 0 0 14px;
}

.public-subtable-head {
    margin: 24px 0 10px;
}

.public-subtable-head h3 {
    font-size: 22px;
}

.public-team-table + .public-subtable-head {
    border-top: 1px solid var(--line);
    padding-top: 20px;
}

.login-box {
    width: min(520px, calc(100% - 28px));
    margin: -34px auto 56px;
}

@media (max-width: 820px) {
    .page-head,
    .grid,
    .admin-grid,
    .settings-grid,
    .form-grid,
    .price-strip,
    .check-grid {
        grid-template-columns: 1fr;
    }

    .page-head {
        align-items: start;
    }

    .shell {
        margin-top: -20px;
    }

    .team-list-head {
        display: none;
    }

    .team-list-item {
        grid-template-columns: 44px minmax(0, 1fr) 38px;
        gap: 8px;
    }

    .team-contact,
    .team-place,
    .team-list-item .team-col:nth-child(5),
    .team-list-item .team-col:nth-child(6) {
        grid-column: 2 / 3;
    }

    .team-actions-cell {
        grid-column: 3 / 4;
        grid-row: 1 / 2;
    }

    .team-edit-modal-grid {
        grid-template-columns: 1fr;
    }

    .team-edit-modal-grid .wide {
        grid-column: span 1;
    }
}
