:root {
    color-scheme: light;
    --bg: #f7f2f3;
    --panel: #f7f2f3;
    --text: #042940;
    --muted: #a8717c;
    --line: #5c9a6a;
    --primary: #005c53;
    --primary-dark: #042940;
    --accent: #5c9a6a;
    --accent-strong: #1e755b;
    --danger: #cf2d50;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Segoe UI, system-ui, sans-serif;
    font-size: 15px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 86px;
    padding: 12px 32px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 250px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
}

.brand:hover {
    text-decoration: none;
}

.brand img {
    display: block;
    width: 154px;
    height: auto;
}

.brand span {
    padding-left: 14px;
    border-left: 1px solid var(--line);
    color: var(--muted);
    white-space: nowrap;
}

.topbar nav,
.actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.topbar nav a,
.link-button {
    color: var(--primary);
    font-weight: 650;
}

.topbar nav a:hover,
.link-button:hover {
    color: var(--accent-strong);
}

.topbar form {
    margin: 0;
}

.shell {
    width: min(1180px, calc(100vw - 32px));
    margin: 34px auto;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

h1,
h2 {
    margin: 0 0 12px;
    line-height: 1.2;
}

h1 {
    font-size: 31px;
    font-weight: 800;
}

h2 {
    font-size: 20px;
    font-weight: 800;
}

p {
    margin-top: 0;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.2fr) repeat(2, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.panel,
.auth-panel,
.table-wrap,
.row-card,
.metrics > div {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel,
.auth-panel {
    padding: 22px;
}

.auth-panel {
    max-width: 420px;
    margin: 80px auto;
}

.table-wrap {
    overflow-x: auto;
}

.table-wrap.spaced,
.spaced {
    margin-top: 18px;
}

.table-wrap.members table {
    min-width: 1280px;
}

.table-wrap.members th:nth-child(1),
.table-wrap.members td:nth-child(1) {
    min-width: 180px;
}

.table-wrap.members th:nth-child(7),
.table-wrap.members td:nth-child(7),
.table-wrap.members th:nth-child(8),
.table-wrap.members td:nth-child(8) {
    min-width: 320px;
}

.table-title {
    padding: 16px 14px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #f7f2f3;
}

tr:last-child td {
    border-bottom: 0;
}

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

.row-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
}

.row-card span {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.metrics div {
    padding: 18px;
    border-top: 4px solid var(--primary);
}

.metrics strong {
    display: block;
    font-size: 26px;
}

.metrics span,
.empty,
.muted {
    color: var(--muted);
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--primary);
    border-radius: 999px;
    background: var(--primary);
    color: #f7f2f3;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

button.secondary,
.button.secondary {
    background: #f7f2f3;
    color: var(--primary);
}

button.secondary:hover,
.button.secondary:hover {
    border-color: var(--accent-strong);
    background: var(--accent-strong);
    color: #f7f2f3;
}

.button.cta {
    min-width: 132px;
    border-color: var(--primary);
    background: var(--primary);
    color: #f7f2f3;
}

.button.cta:hover {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
    color: #f7f2f3;
    transform: translateY(-1px);
}

.row-card .button.cta {
    flex-shrink: 0;
}

.link-button {
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
}

.link-button:hover {
    background: transparent;
    text-decoration: underline;
}

.sort-link {
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.sort-link.active {
    color: var(--primary);
}

.count-link,
.tooltip-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: #f7f2f3;
    color: var(--text);
    font-weight: 700;
}

.count-link {
    min-width: 34px;
    min-height: 28px;
    border-radius: 6px;
}

.count-link:hover {
    background: var(--accent);
    color: #f7f2f3;
    text-decoration: none;
}

.tooltip-pill {
    cursor: help;
    font-size: 13px;
}

.form p {
    display: grid;
    gap: 6px;
}

.search-form {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto auto;
    align-items: end;
    gap: 10px;
}

.member-filter-form {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr)) auto auto;
    align-items: end;
    gap: 10px;
}

.merge-select-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr)) auto;
    align-items: end;
    gap: 12px;
}

.merge-select-form p {
    display: grid;
    gap: 6px;
    margin: 0;
}

.member-compare {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 14px;
    margin: 0;
}

.member-compare dt {
    color: var(--muted);
    font-weight: 700;
}

.member-compare dd {
    margin: 0;
}

.merge-confirm-form {
    max-width: 720px;
}

.member-filter-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form input,
.form select,
.form textarea,
.search-form input,
.member-filter-form input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f7f2f3;
    color: var(--text);
    font: inherit;
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.search-form input:focus,
.member-filter-form input:focus {
    outline: 2px solid #5c9a6a;
    border-color: var(--primary);
}

.form.compact {
    max-width: 520px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.badge.confirmed,
.badge.accepted,
.message.success {
    background: #5c9a6a;
    border-color: #5c9a6a;
    color: #f7f2f3;
}

.badge.waitlisted,
.badge.pending,
.badge.late {
    background: #a8717c;
    color: #f7f2f3;
}

.badge.cancelled,
.badge.declined,
.badge.expired,
.badge.broadcast,
.badge.very_late,
.message.error {
    background: #cf2d50;
    border-color: #cf2d50;
    color: #f7f2f3;
}

.badge.standard {
    background: #f7f2f3;
    border: 1px solid #5c9a6a;
    color: var(--text);
}

.cancellation-panel ul {
    margin-top: 0;
}

.cancellation-form {
    max-width: 760px;
}

.messages {
    margin-bottom: 18px;
}

.message {
    padding: 11px 14px;
    border-radius: 6px;
    background: #f7f2f3;
    border: 1px solid #5c9a6a;
}

.kpi-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.kpi-list div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.kpi-list div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.kpi-list dt {
    color: var(--muted);
    font-weight: 700;
}

.kpi-list dd {
    margin: 0;
    color: var(--text);
    font-weight: 800;
}

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

.ranking-list a {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 4px 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.ranking-list a:hover {
    border-color: var(--primary);
    text-decoration: none;
}

.ranking-list span {
    grid-row: span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--primary);
    color: #f7f2f3;
    font-weight: 800;
}

.ranking-list.secondary span {
    background: #a8717c;
}

.ranking-list strong {
    color: var(--text);
}

.ranking-list em {
    color: var(--muted);
    font-style: normal;
    font-size: 13px;
}

@media (max-width: 760px) {
    .topbar,
    .page-heading,
    .row-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .brand {
        min-width: 0;
    }

    .brand img {
        width: 138px;
    }

    .brand span {
        padding-left: 0;
        border-left: 0;
    }

    .grid.two,
    .dashboard-grid,
    .metrics,
    .search-form,
    .member-filter-form,
    .merge-select-form {
        grid-template-columns: 1fr;
    }
}
