/* --- Core Theme Variables --- */
:root {
    color-scheme: light;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;

    /* Champagne/Cream Palette - Glassmorphism Light Mode */
    --bg-gradient: linear-gradient(135deg, #f9f6ef 0%, #e8e0d5 100%);
    --bg: #fdfbf7;
    /* Navy text */
    --fg: #05142B;

    --bg-subtle: rgba(5, 20, 43, 0.05);
    --box-bg: rgba(255, 255, 255, 0.6);
    /* Semi-transparent Gold */
    --border: rgba(248, 181, 0, 0.15);

    /* Navy primary buttons */
    --primary: #0F2C59;
    --primary-hover: #05142B;
    --primary-fg: #ffffff;

    --bad-bg: rgba(254, 226, 226, 0.8);
    --bad-fg: #991b1b;
    --bad-graphical-fg: #ef4444;

    --ok-bg: rgba(220, 252, 231, 0.8);
    --ok-fg: #166534;
    --ok-graphical-fg: #22c55e;

    --space-sm: 0.75rem;
    --space-md: 1.5rem;
    --space-lg: 3rem;

    --radius: 8px;
}



h1,
h2,
h3,
h4,
h5,
h6,
.brand,
.serif {
    font-family: var(--font-serif);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--fg);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Base Element Resets & Styles --- */
img,
svg {
    max-width: 100%;
    display: block;
}

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: var(--space-sm);
    font-weight: 700;
}

h1 {
    margin-bottom: var(--space-lg);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-md);
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--border);
    transition: text-decoration-color 0.2s;
}

a:hover {
    text-decoration-color: currentColor;
}

ul,
ol,
dl {
    margin-top: 0;
    margin-bottom: var(--space-md);
    padding-left: 1.5rem;
}

dd {
    margin-left: 0;
    margin-bottom: 0.5rem;
}

/* --- Layout Utilities --- */
.center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tool-bar {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

.f-row,
.row {
    display: flex;
    flex-direction: row;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.f-switch {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--space-md);
}

@media (min-width: 600px) {
    .f-switch {
        flex-direction: row;
    }
}

.w-full {
    width: 100%;
}

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

header.glass {
    background-color: rgba(253, 251, 247, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid rgba(248, 181, 0, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
}

#logout {
    margin: 0;
}

/* Sidebar additions */
.brand {
    padding: var(--space-sm) var(--space-md) 0 var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}

.brand img {
    max-height: 100px;
    width: auto;
}

.user-profile {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.9rem;
    color: var(--fg);
    opacity: 0.8;
}

.user-profile strong {
    font-size: 0.95rem;
    font-weight: 600;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    display: block;
}

nav[aria-label="Site sections"] {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

nav ul[role="list"] {
    list-style: none;
    padding: 0 var(--space-sm) var(--space-sm) var(--space-sm);
    margin: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

nav ul[role="list"] li {
    margin-bottom: 0.25rem;
}

nav ul[role="list"] li.logout-item {
    margin-top: auto;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
}

nav ul[role="list"] li a,
nav ul[role="list"] li button.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--fg);
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1rem;
    cursor: pointer;
}

nav ul[role="list"] li a:hover,
nav ul[role="list"] li button.nav-link:hover {
    background-color: var(--bg-subtle);
}

nav ul[role="list"] li a.active {
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    color: var(--primary-fg);
    box-shadow: 0 4px 12px rgba(15, 44, 89, 0.3);
}

.icon {
    width: 20px;
    height: 20px;
    filter: invert(11%) sepia(17%) saturate(2385%) hue-rotate(185deg) brightness(97%) contrast(97%) opacity(0.8);
}

.svg-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

nav ul[role="list"] li a.active .icon {
    filter: invert(1);
}

/* --- Layout overrides --- */
.fullscreen,
.sidebar-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (width>=75ch) {
    .sidebar-layout {
        display: grid;
        grid-template-columns: 250px 1fr;
    }

    header.glass {
        margin: 0;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

.flex-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex-grow: 1;
}

main {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
    flex: 1 0 auto;
}

footer {
    margin-top: 0;
    margin-bottom: 0;
    padding: var(--space-md);
    border-top: 1px solid var(--border);
    background-color: var(--bg-subtle);
}

/* --- Components --- */
.card {
    background: var(--box-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(8px);
}

.auth-card {
    max-width: 450px;
    margin: 4rem auto;
    text-align: center;
}

.auth-card form {
    text-align: left;
}

.card>*:first-child {
    margin-top: 0;
}

.card>*:last-child {
    margin-bottom: 0;
}

/* --- Lists --- */
.list-filter {
    margin-bottom: 2em;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    background: rgba(248, 181, 0, 0.03);
    border: 1px solid rgba(248, 181, 0, 0.08);
    border-top: 1px solid rgba(248, 181, 0, 0.15);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(248, 181, 0, 0.05);
    transition: all 0.2s ease;
    position: relative;
}

.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

a.stretched-link,
a.stretched-link:hover,
a.stretched-link:focus {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.list-row form {
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
    position: relative;
    z-index: 2;
    width: max-content !important;
    pointer-events: none;
}

.list-row form button,
.list-row form a {
    pointer-events: auto;
}

.list-row:hover {
    background: rgba(248, 181, 0, 0.05);
    border: 1px solid rgba(248, 181, 0, 0.12);
    border-top: 1px solid rgba(248, 181, 0, 0.2);
}

.drag-handle {
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.6rem 0.5rem 0;
    margin-right: 0.5rem;
    color: var(--muted-fg, #888);
    opacity: 0.6;
    transition: opacity 0.15s ease, transform 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.drag-handle:hover {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.grip-icon {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.list-row.dragging {
    opacity: 0.35;
    border: 2px dashed rgba(248, 181, 0, 0.5);
    background: rgba(248, 181, 0, 0.02);
}

.list-row.drag-over-top {
    border-top: 3px solid var(--accent, #f8b500);
}

.list-row.drag-over-bottom {
    border-bottom: 3px solid var(--accent, #f8b500);
}

.list-row .actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.item-title-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.item-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.item-notes-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.2s;
    vertical-align: middle;
}

.item-notes-tooltip:hover,
.item-notes-tooltip:focus-visible {
    opacity: 1;
}

.item-notes-tooltip .tooltip-bubble {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary, #0F2C59);
    color: var(--primary-fg, #ffffff);
    border: 1px solid var(--border, rgba(248, 181, 0, 0.2));
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius, 8px);
    font-size: 0.8rem;
    line-height: 1.4;
    font-weight: 400;
    white-space: pre-wrap;
    word-break: break-word;
    min-width: 120px;
    max-width: 280px;
    width: max-content;
    box-shadow: 0 4px 16px rgba(5, 20, 43, 0.25);
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.item-notes-tooltip .tooltip-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: var(--primary, #0F2C59) transparent transparent transparent;
}

.item-notes-tooltip:hover .tooltip-bubble,
.item-notes-tooltip:focus-visible .tooltip-bubble {
    visibility: visible;
    opacity: 1;
}

.item-subtle-link {
    font-size: 0.85rem;
    opacity: 0.7;
    color: inherit;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.2s;
}

.item-subtle-link:hover {
    text-decoration-color: currentColor;
}

/* Base Buttons */
button,
.button,
.\<button\> {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(248, 181, 0, 0.06);
    background-image: none !important;
    color: var(--fg);
    border: 1px solid rgba(248, 181, 0, 0.12);
    border-top: 1px solid rgba(248, 181, 0, 0.22);
    border-radius: var(--radius);
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(248, 181, 0, 0.05);
    text-decoration: none;
    text-shadow: none !important;
    line-height: 1.5;
}

button:hover,
.button:hover,
.\<button\>:hover {
    background: rgba(248, 181, 0, 0.12);
    border: 1px solid rgba(248, 181, 0, 0.2);
    border-top: 1px solid rgba(248, 181, 0, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(248, 181, 0, 0.1);
    color: var(--fg);
    text-decoration: none;
}

button:active,
.button:active,
.\<button\>:active {
    transform: translateY(0);
    background: rgba(248, 181, 0, 0.02);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(248, 181, 0, 0.1);
}

button.icon-button,
.button.icon-button,
.\<button\>.icon-button {
    padding: 0;
    width: 2.25rem;
    height: 2.25rem;
    line-height: 1;
    font-size: 1.1rem;
}

/* Primary buttons */
button.primary,
.button.primary,
.\<button\>.primary {
    background: var(--primary) !important;
    background-image: none !important;
    color: var(--primary-fg) !important;
    border: 1px solid var(--primary-hover);
    border-top: 1px solid rgba(248, 181, 0, 0.3);
    box-shadow: 0 2px 8px rgba(15, 44, 89, 0.4), inset 0 1px 0 rgba(248, 181, 0, 0.2);
}

button.primary:hover,
.button.primary:hover,
.\<button\>.primary:hover {
    background: var(--primary-hover) !important;
    box-shadow: 0 4px 12px rgba(15, 44, 89, 0.6), inset 0 1px 0 rgba(248, 181, 0, 0.3);
}

button.primary:active,
.button.primary:active,
.\<button\>.primary:active {
    background: var(--primary) !important;
    box-shadow: 0 1px 2px rgba(15, 44, 89, 0.4);
}

/* Subtle buttons */
button.subtle,
.button.subtle,
.\<button\>.subtle {
    background: transparent;
    background-image: none !important;
    color: var(--fg);
    border-color: transparent;
    box-shadow: none;
}

button.subtle:hover,
.button.subtle:hover,
.\<button\>.subtle:hover {
    background: var(--bg-subtle);
    border-color: var(--border);
    border-top-color: rgba(248, 181, 0, 0.15);
    transform: none;
    box-shadow: none;
}

/* Subtle Bad buttons */
button.subtle.bad,
.button.subtle.bad,
.\<button\>.subtle.bad {
    background: transparent !important;
    color: var(--bad-graphical-fg) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

button.subtle.bad:hover,
.button.subtle.bad:hover,
.\<button\>.subtle.bad:hover {
    background: var(--bad-bg) !important;
    color: var(--bad-fg) !important;
    border-color: transparent !important;
}

/* Bad/Danger buttons */
button.bad,
.button.bad,
.\<button\>.bad {
    background: var(--bad-graphical-fg) !important;
    background-image: none !important;
    color: white !important;
    border: 1px solid var(--bad-bg);
    border-top: 1px solid rgba(248, 181, 0, 0.3);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4), inset 0 1px 0 rgba(248, 181, 0, 0.2);
}

button.bad:hover,
.button.bad:hover,
.\<button\>.bad:hover {
    background: var(--bad-fg) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.6), inset 0 1px 0 rgba(248, 181, 0, 0.3);
}

/* Details List */
.details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 0;
}

@media (min-width: 600px) {
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.details-grid>div {
    display: flex;
    flex-direction: column;
}

.details-grid dt {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg);
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.details-grid dd {
    font-size: 1rem;
    margin-left: 0;
}

.details-grid .full-width {
    grid-column: 1 / -1;
}

/* --- Existing utility and transition overrides --- */

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes fade-out {
    to {
        opacity: 0;
    }
}

::view-transition-old(page-change) {
    animation: 50ms ease-out both fade-out;
}

::view-transition-new(page-change) {
    animation: 100ms ease-in 90ms both fade-in;
}

.page-change {
    view-transition-name: page-change;
}

/* --- Forms --- */
fieldset {
    border: 1px solid rgba(248, 181, 0, 0.2);
    border-radius: var(--radius);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    margin-bottom: var(--space-md);
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

legend {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.5rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]):not([type="file"]),
textarea,
select {
    background: rgba(253, 251, 247, 0.5) !important;
    background-image: none !important;
    border: 1px solid rgba(248, 181, 0, 0.15) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.2) !important;
    color: var(--fg) !important;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    width: 100%;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(253, 251, 247, 0.5);
    margin: 0;
    margin-right: 0.6rem;
    font: inherit;
    color: currentColor;
    width: 1.4em;
    height: 1.4em;
    border: 1px solid rgba(248, 181, 0, 0.3);
    border-radius: 0.3em;
    display: inline-grid;
    place-content: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

input[type="checkbox"]::before {
    content: "";
    width: 0.75em;
    height: 0.75em;
    transform: scale(0);
    transition: 120ms transform cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 1em 1em var(--primary);
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="checkbox"]:checked {
    background: rgba(253, 251, 247, 0.8);
    border-color: rgba(15, 44, 89, 0.4);
}

input[type="checkbox"]:checked::before {
    transform: scale(1);
}

input[type="checkbox"]:focus {
    outline: none;
    border-color: rgba(15, 44, 89, 0.4);
    box-shadow: 0 0 0 1px rgba(15, 44, 89, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    line-height: 1.4;
}

.w-full {
    width: 100% !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]):not([type="file"]):focus,
textarea:focus,
select:focus {
    outline: none;
    background: rgba(253, 251, 247, 0.7) !important;
    border-color: rgba(15, 44, 89, 0.4) !important;
    box-shadow: 0 0 0 1px rgba(15, 44, 89, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

input::placeholder,
textarea::placeholder {
    color: rgba(248, 181, 0, 0.3) !important;
}

/* Fix for browser autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
    box-shadow: 0 0 0 1000px #0f172a inset !important;
    -webkit-text-fill-color: var(--fg) !important;
    transition: background-color 5000s ease-in-out 0s;
}

input:disabled,
textarea:disabled {
    background: var(--bg-subtle);
    cursor: default;
    opacity: 0.7;
}

a.wrap-link {
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

html:not(.js-enabled) .script {
    display: none;
}

.js-enabled .noscript {
    display: none;
}

@keyframes indicatorFadeIn {
    0% {
        opacity: 0;
    }

    90% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.indicator {
    display: none;
    opacity: 0;
    filter: invert(15%) sepia(89%) saturate(2926%) hue-rotate(197deg) brightness(94%) contrast(84%);
}

.indicator.htmx-request {
    display: inline-block;
    opacity: 1;
    animation: indicatorFadeIn 1s linear forwards;
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.button-indicator {
    display: none;
    height: 1.2em;
    vertical-align: text-bottom;
    margin-left: 0.25rem;
}

form.htmx-request button .button-indicator,
button.htmx-request .button-indicator {
    display: inline-block !important;
    opacity: 1;
    animation: indicatorFadeIn 0.5s linear forwards;
}

button.swal2-confirm {
    background-color: var(--ok-bg) !important;
    color: var(--ok-fg) !important;
    border: 1px solid var(--ok-graphical-fg) !important;
}

button.swal2-confirm:focus {
    box-shadow: 0 0 0 3px var(--ok-graphical-fg) !important
}

button.swal2-reject {
    background-color: var(--bad-bg) !important;
    color: var(--bad-fg) !important;
    border: 1px solid var(--bad-graphical-fg) !important;
}

button.swal2-reject:focus {
    box-shadow: 0 0 0 3px var(--bad-graphical-fg) !important
}

.validation-error {
    background-color: var(--bad-bg);
    color: var(--bad-fg);
    border: 1px solid var(--bad-graphical-fg);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    margin-top: 0.25rem;
}

/* --- Modals --- */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(253, 251, 247, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
    animation: modalFadeIn 0.15s ease-out;
}

.modal-content {
    background-color: rgba(253, 251, 247, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 65ch;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
}

.modal-close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(248, 181, 0, 0.1);
    border: 1px solid rgba(248, 181, 0, 0.2);
    color: var(--fg);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(248, 181, 0, 0.2);
}

.modal-body {
    padding: var(--space-md);
    overflow-y: auto;
}

/* --- Utilities --- */
.list-section-title {
    margin-top: 2rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fg);
    opacity: 0.7;
}

.banner-new-user {
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(248, 181, 0, 0.15) 0%, rgba(253, 251, 247, 0.4) 100%);
    border: 1px solid rgba(248, 181, 0, 0.3);
    border-radius: var(--radius);
}

.banner-expired {
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(253, 251, 247, 0.4) 100%);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius);
}

.banner-expired .button {
    margin-left: 1rem;
}

.list-row-content {
    flex: 1;
}

.action-copy-link {
    min-width: 145px;
}

.action-logout {
    width: 100%;
    justify-content: flex-start;
    gap: 0.75rem;
}

.item-notes {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    opacity: 0.7;
    white-space: pre-wrap;
}

.resize-none {
    resize: none;
}

/* --- Flash Messages --- */
.flash-container {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 400px;
}

.flash-msg {
    pointer-events: auto;
    background-color: var(--box-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(248, 181, 0, 0.1);
    color: var(--fg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: flashSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes flashSlideIn {
    0% {
        transform: translateX(120%);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.flash-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: inline;
    margin-right: 0.25rem;
}

.flash-text {
    font-size: 0.9rem;
    opacity: 0.9;
    display: inline;
}

.flash-info {
    border-left: 4px solid var(--primary);
    background: linear-gradient(90deg, rgba(248, 181, 0, 0.1) 0%, var(--box-bg) 100%);
}

.flash-ok {
    border-left: 4px solid var(--ok-graphical-fg);
    background: linear-gradient(90deg, rgba(22, 163, 74, 0.1) 0%, var(--box-bg) 100%);
}

.flash-bad {
    border-left: 4px solid var(--bad-graphical-fg);
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.1) 0%, var(--box-bg) 100%);
}

.flash-warn {
    border-left: 4px solid #eab308;
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.1) 0%, var(--box-bg) 100%);
}

.flash-plain {
    border-left: 4px solid rgba(248, 181, 0, 0.3);
}

/* --- Landing Page --- */
.landing-page {
    position: relative;
    color: #fdfbf7;
}

.landing-page::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('/static/landing-bg.png');
    background-size: cover;
    background-position: center;
    z-index: -1;
}

.login-action {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

.login-action .button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

.login-action .button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.login-action .button .icon {
    filter: invert(1);
}

.landing-hero {
    padding-top: 4rem;
    padding-bottom: 2rem;
}

.hero-logo {
    width: 200px;
    height: 200px;
    margin-bottom: 2rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto 2rem auto;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-actions {
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-cta {
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
}

.landing-features-section {
    padding: 4rem 1rem;
    max-width: 1000px;
    margin: 0 auto;
}

.landing-features-grid {
    --grid-min-item-size: 250px;
    gap: 2rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.feature-title {
    color: #fdfbf7;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.feature-text {
    color: #fdfbf7;
    opacity: 0.9;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.user-name-field {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    height: 0;
    width: 0;
    z-index: -1;
    pointer-events: none;
}

.billing-return-card {
    text-align: center;
    padding: 4rem 2rem;
}

.billing-return-indicator {
    opacity: 1;
    display: inline-block;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.billing-return-actions {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.billing-return-fallback {
    opacity: 0;
}