:root {
    --bg-start: #5cf0d8;
    --bg-end: #1f5ff2;
    --bg-orb: rgba(255, 255, 255, 0.18);
    --panel-bg: rgba(9, 29, 59, 0.2);
    --panel-strong: rgba(8, 29, 59, 0.34);
    --panel-border: rgba(255, 255, 255, 0.18);
    --text-main: #f4fbff;
    --text-soft: rgba(244, 251, 255, 0.78);
    --text-faint: rgba(244, 251, 255, 0.56);
    --success-bg: rgba(211, 255, 234, 0.18);
    --success-border: rgba(211, 255, 234, 0.35);
    --error-bg: rgba(255, 207, 207, 0.18);
    --error-border: rgba(255, 207, 207, 0.35);
    --warning-bg: rgba(255, 238, 202, 0.16);
    --warning-border: rgba(255, 238, 202, 0.34);
    --button-bg: rgba(255, 255, 255, 0.14);
    --button-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 24px 70px rgba(8, 19, 45, 0.28);
    color-scheme: light;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
    --bg-start: #07111f;
    --bg-end: #0d2340;
    --bg-orb: rgba(61, 120, 255, 0.18);
    --panel-bg: rgba(7, 14, 26, 0.74);
    --panel-strong: rgba(5, 11, 20, 0.9);
    --panel-border: rgba(179, 210, 255, 0.12);
    --text-main: #eef5ff;
    --text-soft: rgba(238, 245, 255, 0.74);
    --text-faint: rgba(238, 245, 255, 0.5);
    --button-bg: rgba(124, 168, 255, 0.08);
    --button-border: rgba(179, 210, 255, 0.16);
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    color: var(--text-main);
    background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
    position: relative;
    overflow-x: hidden;
}

.layout-shell {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 220ms ease, transform 220ms ease;
}

body.page-ready .layout-shell {
    opacity: 1;
    transform: translateY(0);
}

body.is-submitting .layout-shell {
    opacity: 0.82;
    transform: scale(0.995);
}

body.is-navigating .layout-shell {
    opacity: 0.18;
    transform: translateY(8px) scale(0.992);
    filter: blur(2px);
    transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}

body::before,
body::after {
    content: "";
    position: fixed;
    width: 28rem;
    height: 28rem;
    border-radius: 50%;
    background: radial-gradient(circle, var(--bg-orb) 0%, rgba(255, 255, 255, 0) 68%);
    pointer-events: none;
    z-index: 0;
    filter: blur(8px);
}

body::before {
    top: -10rem;
    right: -8rem;
}

body::after {
    bottom: -12rem;
    left: -9rem;
}

a {
    color: #c8fbff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
    max-width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

.layout-shell {
    min-height: 100vh;
    padding: 1.5rem;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 1.25rem;
    position: relative;
    z-index: 1;
}

.page-transition {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(6, 16, 32, 0.24);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    z-index: 30;
}

.page-transition.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.page-transition-card {
    display: grid;
    gap: 0.9rem;
    justify-items: center;
    padding: 1.2rem 1.4rem;
    min-width: min(320px, calc(100vw - 2rem));
    border-radius: 22px;
    background: var(--panel-strong);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: var(--shadow);
    text-align: center;
    transform: translateY(10px) scale(0.98);
    transition: transform 180ms ease, opacity 180ms ease;
}

.page-transition.is-visible .page-transition-card {
    transform: translateY(0) scale(1);
}

.page-spinner {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: rgba(255, 255, 255, 0.95);
    animation: spin 0.8s linear infinite;
}

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

.center-stage {
    width: min(1120px, 100%);
    margin: auto;
    display: grid;
    gap: 1.5rem;
}

.center-stage-screen {
    align-content: center;
}

.topbar {
    width: min(1320px, 100%);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.compact-topbar {
    justify-content: flex-end;
    margin-bottom: -0.25rem;
}

.topbar-centered {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.topbar-centered .topbar-actions {
    justify-self: end;
}

.topbar-spacer {
    min-height: 1px;
}

.brand-mark {
    justify-self: center;
    font-size: clamp(1.25rem, 2vw, 1.9rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar h1,
.card h1,
.card h2 {
    margin: 0;
    overflow-wrap: anywhere;
}

.topbar p,
.card p {
    margin-top: 0;
}

.topbar-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.ghost-link,
.primary-button,
.mini-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--button-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.75rem 1.1rem;
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease;
    backdrop-filter: blur(14px);
}

.mini-button {
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
}

.secondary-button {
    background: rgba(5, 35, 86, 0.32);
}

.button-danger {
    background: rgba(255, 124, 124, 0.16);
    border-color: rgba(255, 180, 180, 0.3);
}

.ghost-link:hover,
.primary-button:hover,
.mini-button:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.16);
    text-decoration: none;
}

.card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    padding: 1.6rem;
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(1120px, 100%);
}

.auth-card-narrow {
    width: min(760px, 100%);
}

.auth-card-single {
    margin: 0 auto;
}

.auth-login-only {
    width: min(430px, 100%);
    margin: 1.2rem auto 0;
}

.auth-login-only .auth-links-row {
    justify-content: center;
}

.redirect-status-card {
    text-align: center;
    display: grid;
    gap: 1rem;
    justify-items: center;
    align-content: center;
    margin: 0 auto;
    padding: clamp(1.5rem, 3vw, 2.4rem);
}

.redirect-status-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    font-size: 2rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 40px rgba(4, 16, 39, 0.22);
}

.redirect-status-card .field {
    width: min(360px, 100%);
    justify-items: stretch;
    text-align: left;
}

.redirect-status-card .field input {
    width: 100%;
    text-align: center;
}

.redirect-status-limit {
    background:
        linear-gradient(145deg, rgba(15, 98, 182, 0.34) 0%, rgba(20, 164, 196, 0.26) 48%, rgba(8, 34, 82, 0.56) 100%),
        var(--panel-bg);
    border-color: rgba(183, 235, 255, 0.28);
    box-shadow: 0 24px 70px rgba(6, 25, 58, 0.32);
}

.redirect-status-limit .lead {
    color: rgba(244, 251, 255, 0.88);
}

.redirect-status-limit .eyebrow {
    color: rgba(208, 246, 255, 0.82);
}

.redirect-status-card .stacked-form {
    width: min(420px, 100%);
    margin: 0 auto;
    justify-items: center;
}

.redirect-status-card .stacked-form .primary-button {
    min-width: 180px;
}

.redirect-status-card .notice {
    width: min(480px, 100%);
    margin-inline: auto;
}

.redirect-status-card .lead,
.redirect-status-card h1,
.redirect-status-card .eyebrow {
    text-align: center;
}

.redirect-status-card .topbar-actions {
    justify-content: center;
}

.maintenance-card {
    text-align: center;
    justify-items: center;
}

.maintenance-countdown-card {
    width: min(420px, 100%);
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.maintenance-countdown-value {
    margin-top: 0.75rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.03em;
}

.maintenance-login-link {
    margin-top: 0.35rem;
}

.maintenance-login-link .ghost-link {
    font-size: 0.88rem;
    opacity: 0.9;
}

.lead {
    color: var(--text-soft);
    max-width: 72ch;
    line-height: 1.6;
}

.eyebrow {
    margin: 0 0 0.55rem;
    color: var(--text-soft);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.auth-columns,
.page-grid,
.admin-layout {
    display: grid;
    gap: 1.5rem;
}

.auth-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1.4rem;
}

.page-grid {
    width: min(1320px, 100%);
    margin: 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-span-full {
    grid-column: 1 / -1;
}

.admin-layout {
    width: min(1320px, 100%);
    margin: 0 auto;
    grid-template-columns: 260px minmax(0, 1fr);
}

.admin-main {
    display: grid;
    gap: 1.5rem;
}

.admin-sidebar {
    align-self: start;
    position: sticky;
    top: 1.5rem;
}

.section-nav {
    display: grid;
    gap: 0.35rem;
}

.section-nav a:not(.nav-group-direct-link),
.nav-group-link {
    display: block;
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    color: var(--text-soft);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
}

.nav-group-link {
    width: 100%;
    text-align: left;
    appearance: none;
    cursor: pointer;
}

.section-nav a:not(.nav-group-direct-link):hover,
.nav-group-link:hover {
    text-decoration: none;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.12);
}

.section-nav a:not(.nav-group-direct-link).is-active,
.nav-group-link.is-active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.16);
}

.nav-group {
    display: grid;
    gap: 0.35rem;
}

.nav-group-summary {
    list-style: none;
    cursor: pointer;
}

.nav-group-summary::-webkit-details-marker {
    display: none;
}

.nav-group-summary,
.nav-group-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.nav-group-direct-link {
    flex: 1 1 auto;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.nav-group-direct-link:hover {
    text-decoration: none;
}

.nav-group-caret {
    flex: 0 0 auto;
    transition: transform 180ms ease;
}

.nav-group[open] .nav-group-caret,
.nav-group.is-open .nav-group-caret {
    transform: rotate(180deg);
}

.nav-group-children {
    display: grid;
    gap: 0.35rem;
}

.section-nav a:not(.nav-group-direct-link).is-child,
.nav-group-link.is-child {
    margin-left: 1rem;
    padding-left: 1.1rem;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.02);
}

.section-nav a:not(.nav-group-direct-link).is-child::before,
.nav-group-link.is-child::before {
    content: "↳";
    margin-right: 0.5rem;
    color: var(--text-faint);
}

.menu-builder {
    display: grid;
    gap: 1rem;
}

.dashboard-section-list {
    display: grid;
    gap: 1.25rem;
}

.dashboard-section-card {
    display: grid;
    gap: 1rem;
}

.dashboard-section-card.is-dragging {
    opacity: 0.6;
}

.dashboard-section-card[data-drop-mode="before"] {
    box-shadow: inset 0 3px 0 rgba(146, 235, 255, 0.85), var(--shadow);
}

.dashboard-section-card[data-drop-mode="after"] {
    box-shadow: inset 0 -3px 0 rgba(146, 235, 255, 0.85), var(--shadow);
}

.dashboard-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-section-header > div {
    min-width: 0;
}

.dashboard-section-handle {
    flex: 0 0 auto;
    cursor: grab;
}

.dashboard-sort-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.dashboard-sort-copy {
    display: grid;
    gap: 0.3rem;
}

.dashboard-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.dashboard-period-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-period-form .field {
    min-width: 220px;
}

.dashboard-filter-menu {
    width: min(100%, 440px);
}

.dashboard-filter-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.dashboard-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem 1rem;
}

.dashboard-filter-grid .checkbox-row {
    align-items: flex-start;
}

.dashboard-filter-grid .checkbox-row span {
    overflow-wrap: anywhere;
}

.dashboard-filter-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.9rem;
}

.dashboard-empty-state {
    margin-top: 1rem;
}

.menu-builder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.menu-builder-list-nested {
    margin-top: 0.65rem;
    margin-left: 1.4rem;
}

.menu-builder-item {
    display: grid;
    gap: 0.45rem;
}

.menu-builder-item.is-dragging {
    opacity: 0.6;
}

.menu-builder-item[data-drop-mode="before"] .menu-builder-row {
    box-shadow: inset 0 3px 0 rgba(146, 235, 255, 0.85);
}

.menu-builder-item[data-drop-mode="after"] .menu-builder-row {
    box-shadow: inset 0 -3px 0 rgba(146, 235, 255, 0.85);
}

.menu-builder-item[data-drop-mode="inside"] .menu-builder-row {
    border-color: rgba(146, 235, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
}

.menu-builder-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.9rem;
    align-items: center;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
}

.menu-builder-handle {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    cursor: grab;
}

.menu-builder-copy {
    display: grid;
    gap: 0.2rem;
}

.menu-builder-label-field {
    display: grid;
    gap: 0.35rem;
}

.menu-builder-parent-field {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.menu-builder-label-field span {
    font-size: 0.8rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.menu-builder-parent-field span {
    font-size: 0.76rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.menu-builder-label-field input {
    width: 100%;
}

.menu-builder-parent-field select {
    width: 100%;
}

.menu-builder-copy small {
    color: var(--text-soft);
    overflow-wrap: anywhere;
}

.menu-builder-level-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.menu-builder-level-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    cursor: pointer;
    font-size: 1rem;
}

.menu-builder-level-button:hover {
    background: rgba(255, 255, 255, 0.14);
}

.stacked-form {
    display: grid;
    gap: 1rem;
}

.field {
    display: grid;
    gap: 0.4rem;
}

.checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text-soft);
}

.checkbox-field input {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
}

.field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.help-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.help-trigger {
    width: 1.3rem;
    height: 1.3rem;
    min-height: 1.3rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.help-bubble {
    position: absolute;
    left: calc(100% + 0.6rem);
    top: 50%;
    width: min(320px, calc(100vw - 3rem));
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: var(--panel-strong);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--text-soft);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-6px);
    transition: opacity 160ms ease, transform 160ms ease;
    z-index: 12;
}

.help-tooltip:hover .help-bubble,
.help-tooltip:focus-within .help-bubble,
.help-tooltip.is-open .help-bubble {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.hp-trap {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.field span {
    color: var(--text-soft);
}

.field input,
.field select,
.field textarea,
.toolbar-form input,
.toolbar-form select,
.inline-form select {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.13);
    color: var(--text-main);
    padding: 0.9rem 1rem;
    outline: none;
}

.field select,
.toolbar-form select,
.inline-form select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.9rem;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-main) 50%),
        linear-gradient(135deg, var(--text-main) 50%, transparent 50%);
    background-position:
        calc(100% - 1.1rem) calc(50% - 0.18rem),
        calc(100% - 0.8rem) calc(50% - 0.18rem);
    background-size: 0.38rem 0.38rem, 0.38rem 0.38rem;
    background-repeat: no-repeat;
}

.field select option,
.toolbar-form select option,
.inline-form select option {
    color: #0b1320;
    background: #f4fbff;
}

.field select optgroup,
.toolbar-form select optgroup,
.inline-form select optgroup {
    color: #0b1320;
    background: #dbeafe;
    font-style: normal;
    font-weight: 700;
}

.field select:focus,
.toolbar-form select:focus,
.inline-form select:focus {
    border-color: rgba(146, 235, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
}

.field input::placeholder,
.field textarea::placeholder,
.toolbar-form input::placeholder {
    color: rgba(244, 251, 255, 0.5);
}

.field textarea {
    resize: vertical;
    min-height: 120px;
}

.notice,
.empty-box {
    border-radius: 18px;
    padding: 1rem 1.1rem;
    margin: 1rem 0 0;
}

.notice-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
}

.notice-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
}

.notice-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
}

.empty-box {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-box {
    padding: 1rem;
    border-radius: 20px;
    background: var(--panel-strong);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.stat-box span {
    display: block;
    color: var(--text-soft);
    margin-bottom: 0.5rem;
}

.stat-box strong {
    font-size: 1.8rem;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.data-table th,
.data-table td {
    padding: 0.9rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    text-align: left;
    vertical-align: top;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.data-table th {
    color: var(--text-soft);
    font-weight: 600;
}

.table-link-group {
    display: grid;
    gap: 0.45rem;
}

.toolbar-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.toolbar-form input,
.toolbar-form select {
    min-width: 180px;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.inline-form select {
    min-width: 120px;
    padding: 0.55rem 0.75rem;
}

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

.action-stack {
    display: grid;
    gap: 0.5rem;
}

.button-cloud {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    align-items: center;
}

.button-cloud form {
    margin: 0;
}

.action-menu {
    position: relative;
}

.action-menu summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    border-radius: 999px;
    border: 1px solid var(--button-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.55rem 0.9rem;
    backdrop-filter: blur(14px);
}

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

.action-menu summary::after {
    content: "+";
    margin-left: 0.45rem;
    font-weight: 700;
}

.action-menu[open] summary::after {
    content: "-";
}

.action-menu-panel {
    margin-top: 0.6rem;
    padding: 0.75rem;
    border-radius: 18px;
    background: var(--panel-strong);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: grid;
    gap: 0.6rem;
    min-width: 220px;
}

.action-menu-panel form {
    margin: 0;
}

.inline-meta {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin: 1rem 0 0;
}

.meta-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-size: 0.88rem;
}

.status-pill.success {
    background: rgba(211, 255, 234, 0.16);
    border-color: rgba(211, 255, 234, 0.28);
}

.status-pill.warning {
    background: rgba(255, 238, 202, 0.16);
    border-color: rgba(255, 238, 202, 0.28);
}

.status-pill.danger {
    background: rgba(255, 207, 207, 0.16);
    border-color: rgba(255, 207, 207, 0.28);
}

.status-pill.neutral {
    background: rgba(255, 255, 255, 0.08);
}

.checkbox-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    color: var(--text-soft);
}

.checkbox-grid {
    display: grid;
    gap: 0.8rem;
}

.compact-card {
    padding: 1rem;
}

.compact-empty {
    margin-top: 0;
}

.stacked-list {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

.list-card {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    border-radius: 18px;
    background: var(--panel-strong);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.section-split {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.settings-group {
    display: grid;
    gap: 1rem;
    margin-top: 1.35rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-group h3 {
    margin: 0;
    font-size: 1rem;
}

.admin-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.admin-tile {
    display: grid;
    gap: 0.4rem;
    padding: 1rem 1.05rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.admin-tile span {
    color: var(--text-soft);
    font-size: 0.92rem;
}

.admin-tile:hover {
    transform: translateY(-1px);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

.theme-toggle {
    min-width: 120px;
}

.metric-line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-line:last-child {
    border-bottom: 0;
}

.dashboard-pie-wrap {
    display: grid;
    gap: 1rem;
    margin-top: 0.75rem;
}

.dashboard-pie {
    width: min(220px, 100%);
    aspect-ratio: 1;
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.dashboard-pie::after {
    content: "";
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    background: var(--panel-strong);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-pie-center {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    z-index: 1;
    text-align: center;
}

.dashboard-pie-center strong {
    font-size: 1.35rem;
    line-height: 1;
}

.dashboard-pie-center span {
    color: var(--text-soft);
    font-size: 0.82rem;
    margin-top: 0.25rem;
}

.dashboard-pie-legend {
    display: grid;
    gap: 0.55rem;
}

.dashboard-pie-legend-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 0.55rem;
    align-items: center;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-pie-legend-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.dashboard-pie-dot {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 999px;
    display: inline-block;
}

.dashboard-pie-label {
    overflow-wrap: anywhere;
}

.dashboard-pie-legend-item small {
    color: var(--text-soft);
}

.order-input {
    width: 88px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.13);
    color: var(--text-main);
    padding: 0.7rem 0.8rem;
    text-align: center;
}

.qr-image {
    width: 180px;
    max-width: 100%;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem;
}

.two-factor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.two-factor-meta {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.recovery-code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.7rem;
    margin-top: 1rem;
}

.recovery-code-grid code {
    display: block;
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    text-align: center;
    font-size: 0.95rem;
}

.token-value {
    font-size: 1rem;
    word-break: break-all;
}

.switch-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.13);
}

.switch-row strong,
.switch-row small {
    display: block;
}

.switch-row small {
    color: var(--text-soft);
    margin-top: 0.35rem;
}

.switch-row input[type="checkbox"] {
    width: 24px;
    height: 24px;
}

.public-card {
    width: min(1120px, 100%);
}

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

.form-disclosure {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    margin-top: 0.15rem;
}

.form-disclosure summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.15rem;
    color: var(--text-soft);
    user-select: none;
}

.form-disclosure summary::-webkit-details-marker {
    display: none;
}

.form-disclosure summary::after {
    content: "+";
    float: right;
    color: var(--text-main);
    font-size: 1.1rem;
    line-height: 1;
}

.form-disclosure[open] summary::after {
    content: "-";
}

.disclosure-content {
    padding: 0 1.15rem 1.15rem;
}

.compact-disclosure {
    margin-top: 0.35rem;
}

.compact-disclosure summary {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
}

.auth-panel {
    align-content: start;
}

.field-span-full {
    grid-column: 1 / -1;
}

.homepage-empty {
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.auth-links-row {
    justify-content: flex-start;
    margin-top: 0;
}

.auth-utility-grid {
    margin-top: 1rem;
    align-items: start;
}

.footer-links a {
    color: var(--text-faint);
    font-size: 0.8rem;
}

.top-space {
    margin-top: 1rem;
}

.top-space-small {
    margin-top: 0.75rem;
}

code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92em;
    word-break: break-all;
}

.site-footer {
    text-align: center;
    color: var(--text-soft);
    font-size: 0.82rem;
}

@media (max-width: 860px) {
    .auth-columns,
    .page-grid,
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .public-form-grid,
    .topbar-centered,
    .two-factor-grid {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        padding: 1rem;
    }

    .topbar-centered .topbar-actions,
    .brand-mark {
        justify-self: center;
    }

    .topbar-spacer {
        display: none;
    }

    .stats-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-nav a {
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: normal;
    }

    .section-nav a.is-child,
    .nav-group-link.is-child {
        margin-left: 0;
        padding-left: 0.9rem;
    }

    .table-wrap {
        margin-top: 0.85rem;
    }

    .data-table {
        min-width: 780px;
    }

    .button-cloud {
        width: 100%;
    }

    .dashboard-filter-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-period-form,
    .dashboard-period-form .field {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .layout-shell {
        padding: 0.9rem;
    }

    .card {
        padding: 1rem;
        border-radius: 20px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
    }

    .topbar h1 {
        font-size: 1.55rem;
        line-height: 1.15;
    }

    .topbar-actions,
    .inline-form,
    .toolbar-form {
        width: 100%;
    }

    .topbar-actions {
        gap: 0.65rem;
    }

    .topbar-actions > a,
    .topbar-actions > button,
    .topbar-actions > form,
    .toolbar-form > * {
        width: 100%;
    }

    .inline-form,
    .toolbar-form {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-form input,
    .toolbar-form select,
    .toolbar-form button,
    .inline-form input,
    .inline-form select,
    .inline-form button {
        min-width: 0;
        width: 100%;
    }

    .stats-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-flow: row;
        overflow: visible;
        padding-bottom: 0;
    }

    .section-nav a {
        text-align: center;
        white-space: normal;
        text-wrap: balance;
    }


    .section-nav a.is-child,
    .nav-group-link.is-child {
        padding-left: 0.9rem;
    }

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

    .button-cloud > a,
    .button-cloud > button,
    .button-cloud > form {
        width: 100%;
    }

    .button-cloud form button {
        width: 100%;
    }

    .action-menu,
    .action-menu summary,
    .action-menu-panel {
        width: 100%;
    }

    .field-label {
        align-items: flex-start;
    }

    .inline-meta {
        gap: 0.5rem;
    }

    .list-card {
        padding: 0.9rem;
    }

    .metric-line,
    .switch-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-transition-card {
        min-width: min(100%, calc(100vw - 1.4rem));
        padding: 1rem;
    }

    .table-wrap {
        margin-inline: -0.15rem;
        padding-bottom: 0.15rem;
    }

    .data-table {
        min-width: 600px;
        font-size: 0.94rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.6rem;
    }

    .table-link-group a,
    .data-table small,
    .muted-text {
        overflow-wrap: anywhere;
    }

    .site-footer {
        font-size: 0.76rem;
    }

    .help-bubble {
        left: 0;
        right: auto;
        top: calc(100% + 0.45rem);
        width: min(320px, calc(100vw - 2.5rem));
        transform: translateY(-4px);
    }

    .help-tooltip:hover .help-bubble,
    .help-tooltip:focus-within .help-bubble,
    .help-tooltip.is-open .help-bubble {
        transform: translateY(0);
    }

    .section-split {
        flex-direction: column;
    }

    .dashboard-section-header,
    .dashboard-sort-toolbar,
    .dashboard-filter-bar,
    .dashboard-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-section-handle {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body::before,
    body::after {
        width: 18rem;
        height: 18rem;
    }

    .layout-shell {
        padding: 0.75rem;
    }

    .topbar h1,
    .card h2 {
        font-size: 1.35rem;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .section-nav {
        grid-template-columns: 1fr;
    }

    .section-nav a.is-child,
    .nav-group-link.is-child {
        padding-left: 1rem;
    }

    .ghost-link,
    .primary-button,
    .mini-button {
        min-height: 46px;
        padding: 0.72rem 0.95rem;
    }

    .mini-button {
        font-size: 0.92rem;
    }

    .field input,
    .field select,
    .field textarea,
    .toolbar-form input,
    .toolbar-form select {
        padding: 0.82rem 0.9rem;
    }

    .data-table {
        min-width: 520px;
    }

    .disclosure-content {
        padding: 0 0.9rem 0.9rem;
    }

    .form-disclosure summary {
        padding: 0.9rem;
    }
}
