:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --ink: #182033;
    --muted: #667085;
    --line: #d9e1ec;
    --primary: #e83e61;
    --primary-dark: #b91f43;
    --teal: #10a39a;
    --amber: #f6a623;
    --shadow: 0 18px 45px rgba(24, 32, 51, .12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: var(--ink);
    overflow-x: hidden;
    background:
        radial-gradient(circle at 20% 5%, rgba(232, 62, 97, .16), transparent 28rem),
        radial-gradient(circle at 90% 10%, rgba(16, 163, 154, .18), transparent 24rem),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card,
.panel,
.stat-card {
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(217, 225, 236, .92);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(100%, 480px);
    border-radius: 8px;
    padding: 26px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 800;
    background: conic-gradient(from 25deg, #e83e61, #f6a623, #10a39a, #3f7cff, #e83e61);
}

.eyebrow {
    margin: 18px 0 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.15;
}

h1 {
    font-size: 25px;
}

h2 {
    font-size: 18px;
}

.muted {
    color: var(--muted);
    line-height: 1.55;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
}

.stack-form,
.settings-form {
    display: grid;
    gap: 13px;
}

.settings-table-wrap table {
    min-width: 520px;
}

.settings-table th:first-child,
.settings-table td:first-child {
    width: 58px;
}

.settings-table th:nth-child(3),
.settings-table td:nth-child(3),
.settings-table th:nth-child(4),
.settings-table td:nth-child(4) {
    width: 170px;
}

.customer-actions-table th:nth-child(2),
.customer-actions-table td:nth-child(2) {
    width: 30%;
}

.customer-actions-table th:nth-child(3),
.customer-actions-table td:nth-child(3) {
    width: 22%;
}

.customer-actions-table th:nth-child(4),
.customer-actions-table td:nth-child(4) {
    width: 22%;
}

.customer-actions-table th:nth-child(5),
.customer-actions-table td:nth-child(5) {
    width: 92px;
}

.customer-actions-table th:nth-child(6),
.customer-actions-table td:nth-child(6) {
    width: 110px;
}

.action-options-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
}

.compact-remove-button {
    min-height: 34px;
    padding: 8px 11px;
}

.setting-master-toggle {
    width: fit-content;
    margin-bottom: 14px;
}

.setting-section {
    display: grid;
    gap: 12px;
}

.setting-section + .setting-section {
    border-top: 1px solid var(--line);
    padding-top: 18px;
    margin-top: 4px;
}

.setting-section h3 {
    margin: 0;
    font-size: 20px;
}

.admin-card-photo-preview {
    display: inline-grid;
    gap: 8px;
    width: min(280px, 100%);
    color: var(--muted);
    font-weight: 800;
}

.admin-card-photo-preview img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.theme-palette-field {
    display: grid;
    gap: 7px;
}

.theme-palette-field > span {
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.theme-palette-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.theme-palette-option {
    display: block;
    cursor: pointer;
}

.theme-palette-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-palette-swatch {
    width: 74px;
    height: 38px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: hidden;
    border: 2px solid #d7deea;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(16, 24, 40, .08);
}

.theme-palette-swatch i {
    display: block;
}

.theme-palette-option input:checked + .theme-palette-swatch {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(211, 37, 82, .12), 0 10px 22px rgba(16, 24, 40, .12);
}

.access-code-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #d6deea;
    border-radius: 8px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fff, #f5f7fb);
}

.access-code-panel span,
.access-code-stat small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.access-code-panel strong {
    display: block;
    margin-top: 4px;
    font-size: 34px;
    letter-spacing: 2px;
    color: var(--primary);
}

.access-code-panel p {
    max-width: 460px;
    margin: 0;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.45;
}

label {
    display: grid;
    gap: 7px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    font-weight: 400;
}

.tag-input {
    min-height: 46px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 9px;
    background: #fff;
}

.tag-input:focus-within {
    border-color: rgba(211, 37, 82, .35);
    box-shadow: 0 0 0 3px rgba(211, 37, 82, .08);
}

.tag-list {
    display: contents;
}

.tag-chip {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 8px;
    padding: 0 8px;
    color: var(--primary-dark);
    background: rgba(211, 37, 82, .09);
    font-weight: 800;
}

.tag-chip button {
    border: 0;
    padding: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.tag-chip.readonly {
    min-height: 26px;
    color: #344054;
    background: #eef3f8;
}

.tag-display {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-input input[data-tag-entry] {
    width: 160px;
    min-width: 120px;
    flex: 1 1 160px;
    border: 0;
    border-radius: 0;
    padding: 5px 2px;
    outline: none;
}

.grid-edit-form {
    display: grid;
    gap: 12px;
}

.prize-table {
    min-width: 1280px;
    table-layout: auto;
}

.prize-table input[type="number"],
.prize-table input[type="text"],
.prize-table input:not([type]) {
    min-width: 110px;
}

.prize-table input[type="color"] {
    width: 72px;
    min-width: 72px;
    padding: 4px;
}

.prize-thumb {
    width: 58px;
    height: 44px;
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 7px;
    background: #fff;
}

.prize-symbol-mini {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 7px;
    margin-right: 6px;
    color: #fff;
    background: linear-gradient(135deg, #8d53ff, #d32552);
    font-weight: 900;
    vertical-align: middle;
}

.html-editor {
    display: grid;
    gap: 6px;
    min-width: 240px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    border-radius: 7px;
    padding: 4px;
    background: #eef2f7;
}

.editor-toolbar button,
.editor-menu summary {
    min-height: 28px;
    border: 1px solid #d7deea;
    border-radius: 6px;
    padding: 0 8px;
    color: #182033;
    background: #fff;
    cursor: pointer;
    font-weight: 800;
    font-size: 12px;
}

.editor-inline-control {
    display: inline-flex;
    grid-auto-flow: column;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    border: 1px solid #d7deea;
    border-radius: 6px;
    padding: 0 7px;
    color: #182033;
    background: #fff;
    font-size: 11px;
    font-weight: 800;
}

.editor-inline-control select {
    min-width: 44px;
    height: 22px;
    border: 0;
    padding: 0;
    background: transparent;
}

.editor-inline-control input[type="color"] {
    width: 24px;
    min-width: 24px;
    height: 22px;
    border: 0;
    padding: 0;
    background: transparent;
}

.editor-toolbar-separator {
    width: 1px;
    height: 24px;
    margin: 0 2px;
    background: #d7deea;
}

.emoji-toolbar-button {
    width: 30px;
    padding: 0;
    font-size: 16px;
}

.editor-toolbar button:hover,
.editor-menu summary:hover,
.editor-menu[open] summary {
    border-color: rgba(211, 37, 82, .35);
    color: var(--primary-dark);
    background: #fff5f8;
}

.editor-menu {
    position: relative;
}

.editor-menu summary {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    list-style: none;
}

.editor-menu summary::-webkit-details-marker {
    display: none;
}

.editor-menu-panel {
    position: absolute;
    left: 0;
    top: calc(100% + 5px);
    z-index: 9;
    min-width: 150px;
    display: grid;
    gap: 7px;
    border: 1px solid #d7deea;
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    box-shadow: 0 16px 36px rgba(16, 24, 40, .14);
}

.editor-menu-row {
    display: flex;
    min-width: auto;
    gap: 5px;
}

.editor-menu-panel label {
    gap: 4px;
    font-size: 11px;
}

.editor-menu-panel select,
.editor-menu-panel input[type="color"] {
    min-width: 82px;
    height: 30px;
    padding: 3px 6px;
}

.editor-menu-panel input[type="color"] {
    width: 82px;
}

.editor-surface {
    min-height: 86px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px;
    background: #fbfcfe;
    font-weight: 400;
    outline: none;
    overflow: auto;
}

.editor-surface table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
}

.editor-surface td,
.editor-surface th {
    border: 1px solid #cfd8e6;
    padding: 6px;
}

.editor-surface hr {
    border: 0;
    border-top: 2px solid #d7deea;
    margin: 12px 0;
}

.emoji-menu {
    grid-template-columns: repeat(3, 32px);
    min-width: auto;
}

.emoji-menu button {
    padding: 0;
    font-size: 16px;
}

.prize-table .html-editor {
    min-width: 220px;
    padding: 6px;
}

.prize-table .editor-surface {
    min-height: 64px;
    max-height: 96px;
    padding: 8px;
    font-size: 13px;
}

.division-prize-table {
    min-width: 980px;
    table-layout: fixed;
}

.division-prize-table th:nth-child(1),
.division-prize-table td:nth-child(1) {
    width: 54px;
}

.division-prize-table th:nth-child(2),
.division-prize-table td:nth-child(2) {
    width: 180px;
}

.division-prize-table th:nth-child(3),
.division-prize-table td:nth-child(3) {
    width: 90px;
}

.division-prize-table th:nth-child(4),
.division-prize-table td:nth-child(4) {
    width: 180px;
}

.division-prize-table th:nth-child(5),
.division-prize-table td:nth-child(5),
.division-prize-table th:nth-child(6),
.division-prize-table td:nth-child(6) {
    width: 170px;
}

.division-prize-table th:nth-child(7),
.division-prize-table td:nth-child(7) {
    width: 86px;
}

.division-prize-table input[type="number"] {
    min-width: 68px;
}

.division-prize-table .icon-select {
    min-width: 150px;
}

.division-prize-table .html-editor {
    min-width: 0;
}

.compact-editor-button {
    min-height: 32px;
    padding: 0 12px;
}

.html-preview-text {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.html-editor-modal[hidden] {
    display: none;
}

.html-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(15, 23, 42, .48);
}

.html-editor-dialog {
    width: min(840px, 100%);
    display: grid;
    gap: 14px;
    border-radius: 10px;
    padding: 18px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h3 {
    margin: 0;
    font-size: 20px;
}

.icon-close-button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: var(--primary);
    cursor: pointer;
    font-size: 24px;
    font-weight: 900;
}

.modal-html-editor {
    min-width: 0;
}

.modal-html-editor .editor-surface {
    min-height: 260px;
    max-height: 52vh;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.stack-form .html-editor {
    min-width: 100%;
}

.stack-form .editor-surface {
    min-height: 140px;
}

.editor-surface:focus {
    border-color: rgba(211, 37, 82, .35);
    box-shadow: 0 0 0 3px rgba(211, 37, 82, .08);
}

option,
input::placeholder,
textarea::placeholder {
    font-weight: 400;
}

textarea {
    resize: vertical;
}

.primary-button,
.save-button,
.secondary-button,
.danger-button,
.icon-button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 800;
}

.primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.save-button {
    color: #fff;
    background: var(--teal);
}

.secondary-button,
.icon-button {
    color: var(--ink);
    background: #eef3f8;
}

.danger-button {
    color: #fff;
    background: #d92d20;
}

.alert {
    margin: 16px 0;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 700;
}

.alert-success {
    color: #05603a;
    background: #d1fadf;
}

.alert-error {
    color: #b42318;
    background: #fee4e2;
}

.layout {
    min-height: 100vh;
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 64px;
    padding: 10px 28px;
    color: #fff;
    background: #172033;
    box-shadow: 0 10px 24px rgba(24, 32, 51, .12);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.header-brand span {
    display: block;
    margin-top: 4px;
    color: #b8c2d6;
    font-size: 13px;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    overflow: visible;
}

.mobile-menu-button {
    display: none;
    width: 42px;
    height: 38px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .11);
    cursor: pointer;
    place-items: center;
    gap: 4px;
}

.mobile-menu-button span {
    width: 19px;
    height: 2px;
    display: block;
    border-radius: 999px;
    background: #fff;
}

.division-scope-form {
    flex: 0 0 260px;
}

.division-scope-form select {
    min-height: 38px;
    border-color: rgba(255, 255, 255, .18);
    color: #fff;
    background: rgba(255, 255, 255, .11);
    font-weight: 700;
}

.division-scope-form option {
    color: var(--ink);
    background: #fff;
}

.top-nav a,
.nav-dropdown-toggle {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 0 14px;
    color: #d7def0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    font-weight: 800;
    white-space: nowrap;
}

.nav-icon {
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9fb0c9;
    font-size: 15px;
    line-height: 1;
}

.top-nav a.active,
.top-nav a:hover,
.nav-dropdown-toggle.active,
.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
    color: #fff;
    background: rgba(211, 37, 82, .24);
}

.top-nav a.active .nav-icon,
.top-nav a:hover .nav-icon,
.nav-dropdown-toggle.active .nav-icon,
.nav-dropdown-toggle:hover .nav-icon,
.nav-dropdown.open .nav-dropdown-toggle .nav-icon {
    color: #fff;
}

.nav-dropdown {
    position: relative;
}

.dropdown-caret {
    color: inherit;
    font-size: 12px;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    min-width: 240px;
    display: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(24, 32, 51, .18);
}

.nav-dropdown.open .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: grid;
    gap: 4px;
}

.nav-dropdown-menu a {
    min-height: 36px;
    justify-content: flex-start;
    color: #344054;
    background: transparent;
}

.nav-dropdown-menu a.active,
.nav-dropdown-menu a:hover {
    color: var(--primary-dark);
    background: rgba(211, 37, 82, .09);
}

.nav-dropdown-menu a .nav-icon,
.nav-dropdown-menu a.active .nav-icon,
.nav-dropdown-menu a:hover .nav-icon {
    color: inherit;
}

.top-nav a.logout-link {
    color: #fff;
    background: var(--primary);
}

.top-nav a.logout-link:hover {
    background: var(--primary-dark);
}

.top-nav a.logout-link .nav-icon {
    color: #fff;
}

.content {
    width: 100%;
    max-width: none;
    padding: 20px 36px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 450px);
    align-items: end;
    gap: 20px;
    margin-bottom: 24px;
}

.compact-topbar {
    display: block;
    margin-bottom: 14px;
}

.topbar .eyebrow {
    margin-top: 0;
}

.division-switch {
    width: 100%;
}

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

.stat-card {
    border-radius: 8px;
    padding: 18px;
}

.stat-card span {
    color: var(--muted);
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 10px;
    font-size: 27px;
    word-break: break-word;
}

.stat-card.accent {
    color: #fff;
    background: linear-gradient(135deg, #172033, #10a39a);
}

.stat-card.accent span {
    color: rgba(255, 255, 255, .78);
}

.access-code-stat strong {
    color: var(--primary);
    letter-spacing: 2px;
}

.access-code-stat small {
    display: block;
    margin-top: 6px;
    line-height: 1.35;
}

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

.dashboard-chart-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(16, 24, 40, .08);
}

.chart-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.chart-card-head span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.chart-card-head h2 {
    margin: 4px 0 0;
    font-size: 18px;
}

.chart-card-head strong {
    min-width: 54px;
    border-radius: 8px;
    padding: 9px 10px;
    color: #fff;
    text-align: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.winners-chart .chart-card-head strong {
    background: linear-gradient(135deg, #10a39a, #087a73);
}

.bar-chart {
    display: flex;
    align-items: end;
    gap: 7px;
    min-height: 210px;
    overflow-x: auto;
    padding: 14px 2px 4px;
    border-top: 1px solid var(--line);
}

.bar-item {
    min-width: 28px;
    height: 170px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
}

.bar-item span {
    width: 100%;
    min-height: 3px;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    box-shadow: 0 8px 16px rgba(202, 31, 79, .15);
}

.winners-chart .bar-item span {
    background: linear-gradient(180deg, #22c7bd, #087a73);
}

.bar-item em {
    color: var(--muted);
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.dashboard-range-form {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.dashboard-range-form label {
    width: min(340px, 100%);
}

.panel {
    width: 100%;
    border-radius: 8px;
    padding: 22px 28px;
}

.panel.narrow {
    max-width: none;
}

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

.panel-title-link {
    color: inherit;
    font-weight: 900;
}

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

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

.favicon-preview {
    display: grid;
    gap: 8px;
    color: #344054;
    font-size: 14px;
    font-weight: 700;
}

.favicon-preview img {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: contain;
    padding: 6px;
    background: #fff;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(340px, 1fr) 220px 130px;
    gap: 12px;
    align-items: end;
    margin: 0;
}

.accordion {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fc;
    overflow: hidden;
}

.filter-accordion {
    background: #f3f5f8;
    border-color: #d3dbe7;
}

.filter-accordion > summary {
    background: #dbe2eb;
}

.filter-accordion[open] {
    background: #f6f8fb;
}

.accordion + .accordion {
    margin-top: 9px;
}

.accordion > summary {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    cursor: pointer;
    color: var(--ink);
    font-weight: 900;
    list-style: none;
    background: #e0e6ee;
}

.accordion > summary::-webkit-details-marker {
    display: none;
}

.accordion > summary::after {
    content: "+";
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
}

.accordion[open] > summary::after {
    content: "-";
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.accordion-body {
    display: grid;
    gap: 12px;
    padding: 14px 16px 14px;
    background: #f7f9fc;
}

.accordion > .filter-bar {
    padding: 14px 16px 14px;
}

.accordion > .filter-bar label {
    gap: 10px;
}

.accordion > .filter-bar input,
.accordion > .filter-bar select {
    min-height: 42px;
}

.accordion + .table-wrap,
.accordion + .empty-state {
    margin-top: 18px;
}

.login-box h2 {
    margin: 0;
    font-size: 16px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: fit-content;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
}

.toggle-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-ui {
    position: relative;
    width: 46px;
    height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    transition: background .16s ease, border-color .16s ease;
}

.switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #98a2b3;
    transition: transform .16s ease, background .16s ease;
}

.toggle-row input:checked + .switch-ui {
    border-color: #12b76a;
    background: #12b76a;
}

.toggle-row input:checked + .switch-ui::after {
    transform: translateX(22px);
    background: #fff;
}

.check-row input {
    width: 18px;
    height: 18px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
    table-layout: fixed;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: middle;
    font-weight: 400;
    word-break: break-word;
}

th {
    color: #182033;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.sort-link {
    color: inherit;
    font-weight: 900;
}

.select-col {
    width: 40px;
    text-align: center;
}

th:nth-child(2),
td:nth-child(2) {
    width: 58px;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4) {
    width: 14%;
}

th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7),
th:nth-child(8),
td:nth-child(8) {
    width: 13%;
}

td:nth-child(5) {
    overflow-wrap: anywhere;
}

.select-col input {
    width: 16px;
    height: 16px;
    padding: 0;
}

.filter-accordion > summary::before {
    content: "";
    width: 15px;
    height: 15px;
    display: inline-block;
    margin-right: 9px;
    border: 2px solid var(--muted);
    border-radius: 50%;
    box-shadow: 7px 7px 0 -5px var(--muted);
}

.filter-accordion > summary {
    justify-content: flex-start;
    gap: 0;
}

.filter-accordion > summary::after {
    margin-left: auto;
}

td span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.clickable-row {
    cursor: pointer;
}

.table-wrap tbody tr:nth-child(even) {
    background: #fff6f8;
}

.clickable-row:hover {
    background: #fff0f4;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    color: #344054;
    background: #eef3f8;
    font-size: 11px;
    font-weight: 800;
}

.pill.ok {
    color: #05603a;
    background: #d1fadf;
}

.pill.off {
    color: #667085;
    background: #eaecf0;
}

.password-code {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 8px;
    padding: 0 10px;
    color: #182033;
    background: #eef3f8;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    font-weight: 700;
    cursor: copy;
    user-select: all;
}

.password-code.copied {
    color: #05603a;
    background: #d1fadf;
}

.inline-toggle-form {
    margin: 0;
}

.table-toggle {
    margin: 0;
    display: inline-flex;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    width: auto;
    white-space: nowrap;
}

.table-toggle .switch-ui {
    flex: 0 0 auto;
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
    color: var(--muted);
    font-weight: 700;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 1;
    max-width: 100%;
}

.compact-pagination {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr);
    align-items: center;
}

.pagination a,
.page-select-label select {
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: #fff;
    font-weight: 700;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
}

.pagination a.disabled {
    pointer-events: none;
    opacity: .5;
}

.page-select-label {
    display: inline-flex;
    grid-auto-flow: column;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-weight: 500;
    white-space: nowrap;
}

.page-select-label select {
    width: 120px;
    padding: 0 10px;
}

.actions {
    display: flex;
    gap: 8px;
}

.actions form {
    margin: 0;
}

.empty-state {
    display: grid;
    gap: 6px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 18px;
    color: var(--muted);
}

.empty-state strong {
    color: var(--ink);
}

@media (max-width: 920px) {
    .admin-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 42px;
        align-items: center;
        padding: 14px;
    }

    .header-brand {
        min-width: 0;
    }

    .mobile-menu-button {
        display: grid;
    }

    .top-nav {
        grid-column: 1 / -1;
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 6px;
        padding-top: 10px;
        overflow: visible;
    }

    .admin-header.menu-open .top-nav {
        display: flex;
    }

    .top-nav a {
        justify-content: flex-start;
        width: 100%;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-toggle {
        justify-content: flex-start;
        width: 100%;
    }

    .nav-dropdown-menu {
        position: static;
        width: 100%;
        min-width: 0;
        margin-top: 4px;
        box-shadow: none;
        background: rgba(255, 255, 255, .06);
        border-color: rgba(255, 255, 255, .12);
    }

    .nav-dropdown.open .nav-dropdown-menu,
    .nav-dropdown:focus-within .nav-dropdown-menu {
        display: grid;
    }

    .nav-dropdown:not(.open):not(:focus-within):hover .nav-dropdown-menu {
        display: none;
    }

    .nav-dropdown.open:hover .nav-dropdown-menu {
        display: grid;
    }

    .nav-dropdown-menu a {
        color: #d7def0;
    }

    .nav-dropdown-menu a.active,
    .nav-dropdown-menu a:hover {
        color: #fff;
        background: rgba(211, 37, 82, .24);
    }

    .division-scope-form {
        grid-column: 1 / -1;
        display: none;
        flex: 1 1 auto;
    }

    .admin-header.menu-open .division-scope-form {
        display: block;
    }

    .content {
        padding: 18px;
    }

    .topbar {
        grid-template-columns: 1fr;
    }

    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .division-switch {
        width: 100%;
    }

    .stats-grid,
    .dashboard-charts,
    .split-grid,
    .form-grid,
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 22px;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .compact-pagination {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .page-select-label {
        justify-content: space-between;
    }

    table {
        min-width: 780px;
        table-layout: auto;
    }

    th,
    td {
        padding: 10px 8px;
        white-space: nowrap;
        word-break: normal;
    }

    .select-col {
        min-width: 38px;
        width: 38px;
    }

    th:nth-child(2),
    td:nth-child(2) {
        min-width: 48px;
        width: 54px;
    }

    th:nth-child(3),
    td:nth-child(3),
    th:nth-child(4),
    td:nth-child(4) {
        min-width: 120px;
    }

    th:nth-child(5),
    td:nth-child(5) {
        min-width: 160px;
        white-space: normal;
    }

    th:nth-child(6),
    td:nth-child(6),
    th:nth-child(7),
    td:nth-child(7) {
        min-width: 132px;
    }

    th:nth-child(8),
    td:nth-child(8) {
        min-width: 128px;
    }
}

@media (max-width: 520px) {
    h1 {
        font-size: 24px;
    }

    .content {
        padding: 14px;
    }

    .panel,
    .stat-card {
        padding: 16px;
    }

    .panel-head {
        gap: 12px;
    }

    .access-code-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-wrap {
        margin-right: -16px;
        padding-right: 16px;
    }

    table {
        min-width: 690px;
        font-size: 13px;
    }

    th {
        font-size: 10px;
    }

    th,
    td {
        padding: 9px 7px;
    }

    .password-code {
        min-height: 25px;
        padding: 0 8px;
        font-size: 12px;
    }

    .table-toggle {
        gap: 7px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }
}
