/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0b1117;
    --bg-secondary: #111c26;
    --bg-card: #162029;
    --accent: #4a7c8f;
    --accent-hover: #6a9bac;
    --accent-glow: rgba(74, 124, 143, 0.25);
    --orange: #c9a24e;
    --orange-light: #dbb563;
    --text-primary: #e2ddd3;
    --text-muted: #8a94a0;
    --border-color: rgba(74, 124, 143, 0.15);
}

/* ===== Base ===== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    overscroll-behavior: none;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}


body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(74, 124, 143, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(201, 162, 78, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(74, 124, 143, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-family: 'Cinzel', serif;
}

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

a:hover {
    color: var(--orange-light);
}

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

hr {
    border: 0;
    height: 40px;
    background: url('/images/vine-divider.png') center / contain no-repeat;
    opacity: 0.5;
    margin: 1.5rem 0;
}

/* Plain thin rule for the lines flanking an inline word ("or"), where the
   vine ornament would repeat on each side. */
hr.hr-plain {
    height: 0;
    border-top: 1px solid rgba(138, 148, 160, 0.35);
    background: none;
    opacity: 1;
}

/* ===== Navbar ===== */
.navbar {
    background: rgba(17, 28, 38, 0.85) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color) !important;
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar > .container {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
}

.navbar-brand {
    padding: 0 !important;
}

/* ===== Brand: the chest-and-fox mark plus the name in the brand serif (_Brand.cshtml) ===== */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.brand-mark {
    height: 75px;
    width: auto;
}

.brand-name {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.7rem;
    letter-spacing: 0.04em;
    line-height: 1;
    white-space: nowrap;
    background: linear-gradient(90deg, #6a9bac 0%, #4a7c8f 40%, #c9a24e 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

@media (max-width: 767.98px) {
    .brand-nav .brand-mark {
        height: 48px;
    }

    .brand-nav .brand-name {
        font-size: 1.2rem;
    }
}

/* The narrowest phones: keep the name and the header bell on one line. */
@media (max-width: 359.98px) {
    .brand-nav .brand-name {
        font-size: 1rem;
        letter-spacing: 0.02em;
    }
}

.brand-login {
    flex-direction: column;
    gap: 0.9rem;
}

.brand-login .brand-mark {
    height: 150px;
    filter: drop-shadow(0 0 16px rgba(201, 162, 78, 0.25));
}

.brand-login .brand-name {
    font-size: 2.1rem;
}

.navbar-brand:hover {
    opacity: 0.9;
}

.navbar .nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.2s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--text-primary) !important;
    background: rgba(74, 124, 143, 0.1);
}

/* ===== Landscape phone optimization ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .navbar {
        padding: 0.25rem 0;
    }

    .brand-nav .brand-mark {
        height: 36px;
    }

    .brand-nav .brand-name {
        font-size: 1rem;
    }

    .navbar .nav-link {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.85rem;
    }

    .container.mt-4 {
        margin-top: 0.5rem !important;
    }
}

/* ===== Bottom Nav (mobile) ===== */
@media (max-width: 767.98px) {
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    display: flex;
    justify-content: space-around;
    background: rgb(17, 28, 38);
    border-top: 1px solid var(--border-color);
    padding: 0.35rem 0;
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.75rem;
    border: none;
    background: none;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    justify-content: center;
}

.bottom-nav-item:hover,
.bottom-nav-item:active,
.bottom-nav-item.active {
    color: var(--accent-hover);
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

.pwa-back-btn {
    display: none;
}

.pwa-back-btn.is-visible {
    display: flex;
}

.pwa-back-btn.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}


/* ===== Notification badge ===== */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    color: #fff;
    background: var(--orange);
    border-radius: 50px;
}

.notification-item.unread {
    border-left: 3px solid var(--accent);
}

/* ===== Offcanvas (mobile menu) ===== */
.offcanvas {
    background: var(--bg-secondary) !important;
    color: var(--text-primary);
    border-left: 1px solid var(--border-color) !important;
}

.offcanvas-header {
    border-bottom: 1px solid var(--border-color);
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
}

.offcanvas-link {
    color: var(--text-primary) !important;
    font-weight: 500;
    padding: 0.65rem 0.5rem !important;
    border-radius: 8px;
    transition: background 0.15s;
}

.offcanvas-link:hover,
.offcanvas-link:active {
    background: rgba(74, 124, 143, 0.1);
    color: var(--text-primary) !important;
}

/* ===== Cards ===== */
.card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -1px;
    width: 90px;
    height: 90px;
    background: url('/images/spiderweb-corner.png') bottom right / contain no-repeat;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
}

.card:hover {
    border-color: rgba(74, 124, 143, 0.4);
    box-shadow: 0 0 20px var(--accent-glow);
}

.card-header {
    background: rgba(74, 124, 143, 0.1);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0 !important;
}

.card-footer {
    background: rgba(74, 124, 143, 0.05);
    border-top: 1px solid var(--border-color);
}

/* ===== Buttons ===== */
.btn-danger,
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--orange)) !important;
    border: none !important;
    border-radius: 50px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    color: #fff !important;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(74, 124, 143, 0.3);
}

.btn-danger:hover,
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(74, 124, 143, 0.5);
    opacity: 0.95;
}

.btn-outline-secondary {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-primary);
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background: rgba(74, 124, 143, 0.15);
    border-color: var(--accent);
    color: var(--text-primary);
}

.btn-sm {
    border-radius: 50px;
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
}

.btn-link {
    color: var(--accent-hover);
    text-decoration: none;
}

.btn-link:hover {
    color: var(--orange-light);
}

/* ===== Forms ===== */
.form-control,
.form-select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    padding: 0.6rem 0.85rem;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-primary);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    color: var(--text-primary);
    outline: none;
}

.form-control::placeholder {
    color: rgba(189, 189, 212, 0.5);
}

.form-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.form-check-input {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--accent-glow);
    border-color: var(--accent);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== File Input ===== */
input[type="file"]::file-selector-button {
    background: linear-gradient(135deg, var(--accent), var(--orange));
    border: none;
    border-radius: 50px;
    padding: 0.4rem 1.2rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0.75rem;
}

input[type="file"]::file-selector-button:hover {
    opacity: 0.9;
}

input[type="file"].form-control {
    padding: 1.45rem 1.85rem;
}

/* ===== Nav Tabs ===== */
.nav-tabs {
    border-bottom: 1px solid var(--border-color) !important;
}

.nav-tabs .nav-link {
    color: var(--text-muted) !important;
    background: none !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    padding: 0.4rem 1rem;
    border-radius: 0 !important;
    transition: all 0.2s;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary) !important;
    border-bottom-color: var(--accent) !important;
}

.nav-tabs .nav-link.active {
    color: var(--text-primary) !important;
    background: none !important;
    border-bottom: 2px solid var(--accent) !important;
}

/* ===== Alerts ===== */
.alert {
    border-radius: 10px;
    border: 1px solid;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.3);
    color: #fde047;
}

.alert-info {
    background: rgba(74, 124, 143, 0.1);
    border-color: rgba(74, 124, 143, 0.3);
    color: var(--accent-hover);
}

/* ===== Badges ===== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.75em;
    border-radius: 50px;
}

.badge.bg-success {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge.bg-warning {
    background: rgba(234, 179, 8, 0.2) !important;
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.badge.bg-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.bg-info {
    background: rgba(74, 124, 143, 0.2) !important;
    color: var(--accent-hover);
    border: 1px solid rgba(74, 124, 143, 0.3);
}

.badge.bg-secondary {
    background: rgba(189, 189, 212, 0.15) !important;
    color: var(--text-muted);
    border: 1px solid rgba(189, 189, 212, 0.2);
}

/* ===== Tables ===== */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-color);
}

.table thead th {
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    border-color: var(--border-color);
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background: rgba(74, 124, 143, 0.03);
    --bs-table-bg-type: transparent;
}

.table-hover > tbody > tr:hover > * {
    background: rgba(74, 124, 143, 0.08);
    --bs-table-bg-state: transparent;
}

/* ===== Dropdowns ===== */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 0.5rem;
}

.dropdown-item {
    color: var(--text-primary);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    transition: all 0.15s;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(74, 124, 143, 0.15);
    color: var(--text-primary);
}

.dropdown-divider {
    border-color: var(--border-color);
}

/* ===== Modal ===== */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

.btn-close {
    filter: invert(1);
}

/* ===== PWA standalone safe area ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    .navbar {
        padding-top: calc(0.75rem + env(safe-area-inset-top));
    }
}

/* ===== Utility ===== */
.container {
    position: relative;
    z-index: 1;
}

.page-heading {
    font-family: 'Cinzel', serif;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

/* Passkey button */
.passkey-btn {
    background: linear-gradient(135deg, var(--accent), var(--orange));
    border: none;
    border-radius: 50px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(74, 124, 143, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.passkey-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(74, 124, 143, 0.5);
}

.passkey-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(74, 124, 143, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 124, 143, 0.5);
}

/* ===== Touch targets ===== */
@media (pointer: coarse) {
    .btn,
    .nav-link,
    .dropdown-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* ===== FreeStuff-specific: Listing Grid =====
   minmax(0, 1fr) rather than plain 1fr so a single wide grid child (a tall
   cover image, a long unbroken word) can't blow out the column and squish the
   rest of the row to a few pixels. */
.listing-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
}

@media (min-width: 576px) {
    .listing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .listing-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ===== FreeStuff-specific: Listing Card ===== */
.listing-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    display: block;
}

.listing-card:hover {
    border-color: rgba(74, 124, 143, 0.4);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.listing-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-primary);
}

.listing-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.listing-card:hover .listing-card-image img {
    transform: scale(1.05);
}

.listing-card-image .status-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25em 0.75em;
    border-radius: 50px;
    backdrop-filter: blur(8px);
}

.status-badge.available {
    background: rgba(34, 197, 94, 0.8);
    color: #fff;
}

.status-badge.pending {
    background: rgba(234, 179, 8, 0.8);
    color: #162029;
}

.status-badge.reserved {
    background: rgba(245, 158, 11, 0.8);
    color: #162029;
}

/* Breeze frame wrapping the contact-form textarea: the decorative PNG surrounds the
   editable area on wider screens. On mobile the breeze is dropped entirely — the
   corners would collide with the input — and the textarea reverts to a plain
   full-width Bootstrap form-control matching the Subject input. */
.breeze-frame {
    position: relative;
}

@media (min-width: 768px) {
    .breeze-frame {
        background-image: url('/images/breeze.png');
        background-repeat: no-repeat;
        background-position: center;
        background-size: 100% 100%;
        /* top right bottom left — biased to move the textarea down and slightly left
           so it sits in the visual centre of the breeze (which leans left-of-centre
           due to the asset's denser right-side artwork). */
        padding: 5rem 6rem 2.5rem 4rem;
        min-height: 380px;
    }

    /* The textarea should feel like a hole in the breeze you type into, not a
       rectangle pasted over it. Borderless + transparent until focused; on focus
       a soft amber glow hints at the writing surface without boxing it. */
    .breeze-textarea {
        background: transparent;
        border: 1px solid transparent;
        border-radius: 10px;
        min-height: 160px;
        position: relative;
        z-index: 1;
        box-shadow: none;
        color: var(--text-primary);
        transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
    }

    .breeze-textarea::placeholder {
        color: rgba(226, 221, 211, 0.45);
        font-style: italic;
    }

    .breeze-textarea:hover {
        border-color: rgba(201, 162, 78, 0.15);
    }

    .breeze-textarea:focus {
        background: rgba(11, 17, 25, 0.55);
        border-color: rgba(201, 162, 78, 0.35);
        box-shadow: 0 0 24px rgba(201, 162, 78, 0.12);
        outline: none;
    }
}

@media (min-width: 1100px) {
    .breeze-frame {
        padding: 8.5rem 8rem 9rem 3rem;
        min-height: 460px;
    }
}

.status-badge.claimed {
    background: rgba(107, 114, 128, 0.8);
    color: #e5e7eb;
}

.status-badge.expired {
    background: rgba(239, 68, 68, 0.8);
    color: #fff;
}

.status-badge.accepted {
    background: rgba(34, 197, 94, 0.8);
    color: #fff;
}

.status-badge.declined,
.status-badge.cancelled {
    background: rgba(107, 114, 128, 0.8);
    color: #e5e7eb;
}

.listing-card-body {
    padding: 1rem;
}

.listing-card-body h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-card-body .listing-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.listing-card-body .listing-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== FreeStuff-specific: Category Pill ===== */
.category-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2em 0.65em;
    border-radius: 50px;
    background: rgba(74, 124, 143, 0.15);
    color: var(--accent-hover);
    border: 1px solid rgba(74, 124, 143, 0.25);
}

/* ===== FreeStuff-specific: Condition Badge ===== */
.condition-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2em 0.65em;
    border-radius: 50px;
}

.condition-badge.new,
.condition-badge.like-new {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.condition-badge.good {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.condition-badge.well-loved,
.condition-badge.fair {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.condition-badge.worn {
    background: rgba(201, 162, 78, 0.15);
    color: var(--orange-light);
    border: 1px solid rgba(201, 162, 78, 0.3);
}

/* ===== FreeStuff-specific: Claim Button ===== */
.claim-btn {
    background: linear-gradient(135deg, var(--accent), var(--orange));
    border: none;
    border-radius: 50px;
    padding: 0.75rem 2rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 124, 143, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.claim-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(74, 124, 143, 0.6);
}

.claim-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== Login page layout ===== */
.login-page {
    padding-top: env(safe-area-inset-top, 0px);
}

.login-tap {
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    line-height: 1.3;
}

/* ===== Login moth (the brand above it is .brand-login) ===== */
.login-moth {
    display: block;
    width: 100px;
    height: auto;
    opacity: 0.35;
    margin: 0.75rem auto 0;
    filter: drop-shadow(0 0 10px rgba(201, 162, 78, 0.22));
}

/* ===== Footer moth ===== */
.footer-moth {
    width: 120px;
    height: auto;
    opacity: 0.15;
    margin-bottom: 7rem;
}

/* ===== Infinite scroll: moth-on-infinity loader ===== */
.infinite-scroll-sentinel {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    margin: 2rem 0 4rem;
}

.moth-loader {
    position: relative;
    width: 180px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* .moth-loader-path is the coordinate origin the offset-path walks from.
   Anchor it centred in the loader so the figure-eight traces symmetrically. */
.moth-loader-path {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
}

.moth-loader-body {
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 26px;
    margin-top: -13px;
    margin-left: -22px;
    /* Figure-eight / lemniscate path in the loader's local coordinate space.
       The curve is ~140px wide and ~48px tall, which reads as a moth's lazy
       loop without feeling frantic. */
    offset-path: path("M -70,0 C -70,-32 -30,-32 0,0 C 30,32 70,32 70,0 C 70,-32 30,-32 0,0 C -30,32 -70,32 -70,0 Z");
    offset-rotate: 0deg;
    animation: moth-trace 3.6s linear infinite;
}

.moth-loader-img {
    display: block;
    width: 44px;
    height: auto;
    opacity: 0.65;
    transform-origin: 50% 50%;
    animation: moth-wings 0.55s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 6px rgba(201, 162, 78, 0.18));
}

@keyframes moth-trace {
    from { offset-distance: 0%; }
    to { offset-distance: 100%; }
}

@keyframes moth-wings {
    from { transform: scaleX(1); }
    to { transform: scaleX(0.82); }
}

@media (prefers-reduced-motion: reduce) {
    .moth-loader-body {
        animation: none;
        offset-path: none;
        /* Without motion, centre the moth on the loader. */
        top: 50%;
        left: 50%;
        margin-top: -13px;
        margin-left: -22px;
    }
    .moth-loader-img {
        animation: moth-pulse 2.4s ease-in-out infinite;
    }
    @keyframes moth-pulse {
        0%, 100% { opacity: 0.35; }
        50%      { opacity: 0.85; }
    }
}

.infinite-scroll-end {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.7;
    padding: 2.5rem 1rem 3rem;
    font-size: 0.95em;
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 150px;
    height: 150px;
    margin: 0 auto 1rem;
    opacity: 0.7;
}

.empty-state-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.empty-state h3 {
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* ===== View switcher (Card / Grid / List) ===== */
.view-switcher {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
}

.view-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.view-switcher-btn + .view-switcher-btn {
    border-left: 1px solid var(--border-color);
}

.view-switcher-btn:hover {
    color: var(--text-primary);
    background: rgba(74, 124, 143, 0.08);
}

.view-switcher-btn.active {
    background: rgba(74, 124, 143, 0.22);
    color: var(--text-primary);
}

@media (max-width: 575px) {
    .view-switcher-label {
        display: none;
    }
    .view-switcher-btn {
        padding: 0.4rem 0.65rem;
    }
}

/* Grid-mode override for the browse listing grid: more tiles per row,
   trimmed card body. */
.listing-grid.view-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (min-width: 576px) {
    .listing-grid.view-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (min-width: 768px) {
    .listing-grid.view-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
@media (min-width: 1200px) {
    .listing-grid.view-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.listing-grid.view-grid .listing-card-image {
    aspect-ratio: 1 / 1;
}
.listing-grid.view-grid .listing-card-body {
    padding: 0.5rem 0.6rem;
}
.listing-grid.view-grid .listing-card-body h3 {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}
.listing-grid.view-grid .listing-card-body .listing-description,
.listing-grid.view-grid .listing-card-body .category-pill,
.listing-grid.view-grid .listing-card-body .condition-badge {
    display: none;
}
.listing-grid.view-grid .listing-card-body .listing-meta {
    font-size: 0.7rem;
    margin-bottom: 0;
}

/* List-mode override: text-forward rows, small thumbnail. */
.listing-grid.view-list {
    grid-template-columns: 1fr;
    gap: 0.5rem;
}
.listing-grid.view-list .listing-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
}
.listing-grid.view-list .listing-card-image {
    width: 72px;
    height: 72px;
    aspect-ratio: 1 / 1;
}
.listing-grid.view-list .listing-card-image .status-badge {
    display: none;
}
.listing-grid.view-list .listing-card-body {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.listing-grid.view-list .listing-card-body h3 {
    font-size: 0.95rem;
    margin: 0;
}
.listing-grid.view-list .listing-card-body .listing-description {
    display: none;
}
.listing-grid.view-list .listing-card-body .listing-meta {
    margin: 0;
    font-size: 0.75rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}
.listing-grid.view-list .listing-card-body .category-pill {
    display: none;
}

/* Map-mode browse view. The map replaces the listing grid; markers are small
   square thumbnails of each listing's cover image, dropped at a per-listing
   deterministic jitter of the real coordinates. */
.listing-map-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
    padding: 0.5rem;
}
.listing-map {
    width: 100%;
    height: 70vh;
    min-height: 420px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}
.listing-map-caption,
.listing-map-empty {
    padding: 0.5rem 0.25rem 0.25rem;
}
.listing-map-marker {
    background: transparent;
    border: 0;
}
.listing-map-thumb {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(74, 124, 143, 0.55);
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
}
.listing-map-popup {
    display: flex;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    align-items: center;
}
.listing-map-popup img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.listing-map-popup-title {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}
.listing-map-popup-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.15rem;
}
/* Leaflet popup styling to match the dark theme. */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.leaflet-popup-content {
    margin: 0.6rem 0.75rem;
}
.leaflet-container a.leaflet-popup-close-button {
    color: var(--text-muted);
}

/* Mine-list modes — grid/list variants of the stacked list on /Listings/Mine and /Claims/Mine */
.mine-list.view-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (min-width: 768px) {
    .mine-list.view-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 1200px) {
    .mine-list.view-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Grid-mode of mine-list: tap-only compact tiles. Image-on-top, square, status
   badge floats over the image like the Browse grid. Action buttons and meta
   rows are hidden — for full controls, switch to card view. */
.mine-list.view-grid .my-listing-card {
    flex-direction: column !important;
    display: flex;
}
.mine-list.view-grid .my-listing-card-img-link {
    width: 100%;
    flex-shrink: 0;
}
.mine-list.view-grid .my-listing-card-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    min-height: 0;
    border-radius: 0;
}
.mine-list.view-grid .my-listing-card .card-body {
    padding: 0.5rem 0.6rem;
}
.mine-list.view-grid .my-listing-card .card-body h5 {
    font-size: 0.85rem;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mine-list.view-grid .mine-row-extras,
.mine-list.view-grid .mine-row-status-inline {
    display: none !important;
}

/* Status badge that overlays the image — only used in grid mode of mine-list. */
.my-listing-card-img-link {
    position: relative;
}
.my-listing-card-img-link > .status-badge {
    display: none;
}
.mine-list.view-grid .my-listing-card-img-link > .status-badge {
    display: inline-block;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2em 0.65em;
    border-radius: 50px;
    backdrop-filter: blur(8px);
}

.mine-list.view-list .card {
    border-radius: 6px;
}
.mine-list.view-list .card-body {
    padding: 0.5rem 0.75rem !important;
}
.mine-list.view-list .card-body img,
.mine-list.view-list .my-listing-card-img {
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 6px;
}
.mine-list.view-list .mine-row-description {
    display: none;
}

/* ===== My Listings Cards ===== */
.my-listing-card {
    overflow: hidden;
}

.my-listing-card-img-link {
    display: block;
}

.my-listing-card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    object-position: center;
}

@media (min-width: 576px) {
    .my-listing-card {
        flex-direction: row !important;
        display: flex;
    }

    .my-listing-card-img-link {
        flex-shrink: 0;
    }

    .my-listing-card-img {
        width: 120px;
        height: 100%;
        min-height: 100px;
        border-radius: 0;
    }

    .my-listing-card .card-body {
        flex: 1;
        min-width: 0;
    }
}

/* ===== Install guide spotlight screenshots ===== */
.spotlight-frame {
    position: relative;
    display: inline-block;
    max-width: 320px;
    width: 100%;
    aspect-ratio: var(--ratio, auto);
    border-radius: 16px;
    overflow: hidden;
    line-height: 0;
}
.spotlight-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--ox, var(--cx, 50%)) var(--oy, var(--cy, 50%));
}
.spotlight-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse var(--sx, 35%) var(--sy, 6%) at var(--cx, 50%) var(--cy, 50%),
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0) 55%,
        rgba(0, 0, 0, 0.78) 100%
    );
}

/* ===== Changelog share link ===== */
.changelog-card {
    scroll-margin-top: 5rem;
}

.changelog-card .card-body {
    position: relative;
}

.changelog-share {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    font-size: 0.75rem;
    z-index: 2;
    line-height: 1;
}

.changelog-card:hover .changelog-share,
.changelog-share:focus-visible,
.changelog-share.is-copied {
    opacity: 1;
}

.changelog-share:hover {
    color: var(--orange-light);
    background: rgba(74, 124, 143, 0.1);
    border-color: var(--border-color);
}

.changelog-share svg {
    width: 14px;
    height: 14px;
    display: block;
}

.changelog-share .changelog-share-copied {
    display: none;
    color: var(--orange-light);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.changelog-share.is-copied .changelog-share-icon {
    display: none;
}

.changelog-share.is-copied .changelog-share-copied {
    display: inline;
}

/* A brief flash when a card is landed on via a fragment link */
@keyframes changelog-card-flash {
    0% {
        box-shadow: 0 0 0 0 rgba(201, 162, 78, 0);
        border-color: var(--border-color);
    }
    15% {
        box-shadow: 0 0 28px 2px rgba(201, 162, 78, 0.35);
        border-color: rgba(201, 162, 78, 0.55);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(201, 162, 78, 0);
        border-color: var(--border-color);
    }
}

.changelog-card.is-highlighted {
    animation: changelog-card-flash 2.4s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .changelog-card.is-highlighted {
        animation: none;
        border-color: rgba(201, 162, 78, 0.55);
    }
}

/* Keep the share control visible on touch devices, where :hover isn't reliable */
@media (hover: none) {
    .changelog-share {
        opacity: 0.75;
    }
}

/* ===== Volume knob (notification preference slider) ===== */
.volume-knob {
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1rem 0.9rem;
    margin: 0;
    background: rgba(74, 124, 143, 0.04);
}

.volume-knob--disabled {
    opacity: 0.55;
    pointer-events: none;
}

.volume-knob__legend {
    float: none;
    width: auto;
    margin-bottom: 0.35rem;
    padding: 0;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--text-primary);
}

.volume-knob__hint {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.6rem;
}

/* Fixed-height head so the Off/Quiet/Loud track lands at the same Y in every tile,
   regardless of how many lines of hint or how many inline inputs sit above it. */
.volume-knob__head {
    min-height: 5.5rem;
    display: flex;
    flex-direction: column;
}

/* Below the two-column breakpoint the tiles stack, so there's no neighbour to align
   with. The reserved head height would just leave a blank band under the short-hint
   tiles (In-App, Push), so drop it here and let each head size to its own content. */
@media (max-width: 767.98px) {
    .volume-knob__head {
        min-height: 0;
    }
}

.volume-knob__inline-edit {
    margin-bottom: 0.6rem;
    margin-top: auto;
}

.volume-knob__ios-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 0.6rem;
    padding: 0.35rem 0.5rem;
    border-left: 2px solid var(--orange);
    background: rgba(201, 162, 78, 0.08);
    border-radius: 0 4px 4px 0;
}

.volume-knob__inline-edit input {
    width: 100%;
}

/* Keep the inline-edit input fully interactive even when the knob itself is dimmed
   because the email/phone is missing — the input is the user's way to fix that, and
   for SMS the consent text + opt-in button must also stay legible for Twilio compliance. */
.volume-knob--disabled .volume-knob__inline-edit,
.volume-knob--disabled .volume-knob__consent,
.volume-knob--disabled .volume-knob__hint,
.volume-knob--disabled > .alert {
    opacity: 1;
    pointer-events: auto;
}

/* Track is visually gated (e.g. no email on file, or SMS not opted in). The radios are
   also server-rendered with `disabled` so the browser blocks actual state change, but
   clicks on the labels still fire, and JS intercepts them to flash a "please add an
   email / opt in to SMS" prompt. Only the track dims, not the whole tile. */
.volume-knob__track--locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.volume-knob__track--locked label {
    cursor: not-allowed;
}

.volume-knob__track {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 3px;
    overflow: hidden;
}

.volume-knob__stop {
    position: relative;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.volume-knob__stop input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.volume-knob__stop-label {
    display: block;
    text-align: center;
    padding: 0.5rem 0.15rem;
    border-radius: 999px;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.volume-knob__stop:hover .volume-knob__stop-label {
    color: var(--text-primary);
}

.volume-knob__stop input:focus-visible + .volume-knob__stop-label {
    outline: 2px solid var(--accent-hover);
    outline-offset: 2px;
}

.volume-knob__stop input:checked + .volume-knob__stop-label {
    background: var(--orange);
    color: var(--bg-primary);
    box-shadow: 0 0 10px rgba(201, 162, 78, 0.3);
    font-weight: 600;
}

.volume-knob__description {
    margin: 0.6rem 0 0;
    margin-top: auto;
    padding-top: 0.6rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    min-height: 1.3em;
}

.volume-knob[data-mode="custom"] .volume-knob__track {
    border-color: rgba(201, 162, 78, 0.35);
}

.volume-knob__custom-hint {
    margin: 0.35rem 0 0;
    color: var(--orange-light);
    font-size: 0.8rem;
    font-style: italic;
}

/* Inline cadence widget that sits inside the Email tile, under the Off/Quiet/Loud
   row. Stays interactive even when dimmed so the user can still preset their cadence
   for the next time they switch to Quiet. */
.volume-knob__cadence {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-column-gap: 0.6rem;
    align-items: center;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border-color);
}

.volume-knob__cadence-slider {
    grid-column: 2;
}

.volume-knob__cadence-readout {
    grid-column: 3;
    white-space: nowrap;
}

.volume-knob__cadence-hint {
    grid-column: 1 / -1;
    margin-top: 0.25rem;
    font-style: italic;
}

.volume-knob__cadence[data-active="false"] {
    opacity: 0.55;
}

/* ===== Notifications Simple / Advanced tabs ===== */
.notif-tabs {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--bg-secondary);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.notif-tabs__nav {
    --bs-nav-tabs-border-color: var(--border-color);
    --bs-nav-tabs-link-active-bg: var(--bg-secondary);
    --bs-nav-tabs-link-active-color: var(--text-primary);
    --bs-nav-tabs-link-active-border-color: var(--border-color) var(--border-color) var(--bg-secondary);
    margin-bottom: -1px;
}

.notif-tabs__nav .nav-link {
    color: var(--text-muted);
    border: 1px solid transparent;
    background: transparent;
}

.notif-tabs__nav .nav-link:hover {
    color: var(--text-primary);
    border-color: var(--border-color) var(--border-color) transparent;
}

.notif-tabs__nav .nav-link.active {
    color: var(--text-primary);
}

.notif-tabs__actions {
    flex-shrink: 0;
}

.advanced-prefs__body {
    padding-top: 0.75rem;
}

.notif-prefs__group-row > .notif-prefs__group-header {
    background: var(--bg-secondary);
    color: var(--orange-light);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1.1rem 0.75rem 0.5rem;
    border-top: 2px solid var(--accent);
    border-bottom: 1px solid var(--border-color);
    border-left: 3px solid var(--orange);
}

.notif-prefs > tbody:first-of-type > .notif-prefs__group-row:first-child > .notif-prefs__group-header {
    padding-top: 0.55rem;
    border-top-width: 0;
}

.notif-prefs__cadence-row > td {
    background: transparent;
    border-top: 0;
    padding-top: 0;
    padding-bottom: 0.5rem;
}

.notif-prefs__cadence {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.25rem 0 0.1rem 1.25rem;
}

.notif-prefs__cadence-slider {
    flex: 1 1 14rem;
    max-width: 22rem;
    min-width: 12rem;
}

.notif-prefs__cadence-readout {
    min-width: 6.5rem;
}

.notif-prefs__cadence-hint {
    flex-basis: 100%;
    padding-left: 0;
    opacity: 0.75;
}

.notif-prefs__na {
    font-size: 0.8rem;
    opacity: 0.6;
}

.notif-prefs__row-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    line-height: 1.2;
}

/* ===== Profile Avatars ===== */
.profile-avatar {
    display: inline-block;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.profile-avatar-xs { width: 24px; height: 24px; }
.profile-avatar-sm { width: 32px; height: 32px; }
.profile-avatar-md { width: 48px; height: 48px; }
.profile-avatar-lg { width: 96px; height: 96px; }
.profile-avatar-xl { width: 144px; height: 144px; }

/* ===== Admin Dashboard Groups ===== */
.admin-dashboard .admin-group-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.admin-dashboard .admin-group-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.admin-dashboard .admin-group-card .card-header h5 {
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.admin-dashboard .admin-group-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--orange-light);
    box-shadow: 0 0 6px rgba(219, 181, 99, 0.6);
}

.admin-dashboard .admin-group-links .list-group-item {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: background 0.15s, color 0.15s;
}

.admin-dashboard .admin-group-links .list-group-item:hover,
.admin-dashboard .admin-group-links .list-group-item:focus {
    background: rgba(74, 124, 143, 0.1);
    color: var(--accent-hover);
}

.admin-dashboard .admin-link-count {
    display: inline-block;
    min-width: 1.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--orange);
    color: var(--bg-primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
}

/* ===== Admin Activity Chart ===== */
.admin-activity-chart {
    width: 100%;
    min-height: 240px;
}

.admin-activity-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    user-select: none;
}

.admin-activity-toggle input {
    accent-color: var(--accent);
}

.admin-activity-toggle .swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* ===== Browse: Requests Strip =====
   Inline horizontal scroller of open requests above the listing grid.
   Visually distinct from listing cards (parchment-tinted, framed, scrolls
   horizontally) so listers passing through Browse can scan asks without
   confusing them for stuff being given away. */
/* ===== Donation banner (Browse, spec 11.9) ===== */
.donation-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background:
        radial-gradient(circle at 100% 0%, rgba(201, 162, 78, 0.10), transparent 55%),
        linear-gradient(160deg, rgba(74, 124, 143, 0.12), rgba(22, 32, 41, 0.7));
    border: 1px solid rgba(201, 162, 78, 0.3);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.donation-banner__art {
    width: 72px;
    height: auto;
    flex-shrink: 0;
}

.donation-banner__body {
    flex: 1 1 auto;
    min-width: 0;
}

.donation-banner__title {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    margin: 0 0 0.25rem;
}

.donation-banner__text {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0;
}

.donation-banner__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    flex-shrink: 0;
}

.donation-banner__cta {
    white-space: nowrap;
}

.donation-banner__dismiss-form {
    margin: 0;
}

.donation-banner__dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 0.25rem 0;
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
    min-height: 32px;
}

.donation-banner__dismiss:hover,
.donation-banner__dismiss:focus-visible {
    color: var(--text-primary);
}

@media (max-width: 575.98px) {
    .donation-banner {
        flex-wrap: wrap;
        padding: 1rem;
    }

    .donation-banner__art {
        width: 56px;
    }

    .donation-banner__body {
        flex-basis: calc(100% - 56px - 1rem);
    }

    .donation-banner__actions {
        flex-basis: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.request-strip {
    position: relative;
    background:
        radial-gradient(circle at 8% 0%, rgba(201, 162, 78, 0.08), transparent 55%),
        linear-gradient(160deg, rgba(74, 124, 143, 0.10), rgba(22, 32, 41, 0.6));
    border: 1px solid rgba(201, 162, 78, 0.25);
    border-radius: 14px;
    padding: 1rem 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.request-strip__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.request-strip__title {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    margin: 0;
    color: var(--orange-light);
    letter-spacing: 0.02em;
}

.request-strip__subtitle {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.2rem;
    font-style: italic;
}

.request-strip__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.request-strip__see-all {
    font-size: 0.85rem;
    color: var(--accent-hover);
    white-space: nowrap;
}

.request-strip__see-all:hover { color: var(--orange-light); }

.request-strip__dismiss-form {
    margin: 0.85rem 0 0;
}

.request-strip__dismiss {
    width: 100%;
    background: transparent;
    border: 1px dashed rgba(138, 148, 160, 0.35);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    min-height: 44px;
}

.request-strip__dismiss:hover,
.request-strip__dismiss:focus-visible {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(74, 124, 143, 0.1);
}

.request-strip__scroller {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    padding: 0.25rem 0.1rem 0.6rem;
    -webkit-overflow-scrolling: touch;
}

.request-strip__scroller::-webkit-scrollbar {
    height: 8px;
}
.request-strip__scroller::-webkit-scrollbar-track {
    background: transparent;
}
.request-strip__scroller::-webkit-scrollbar-thumb {
    background: rgba(74, 124, 143, 0.35);
    border-radius: 999px;
}
.request-strip__scroller::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 124, 143, 0.55);
}

.request-card {
    flex: 0 0 17rem;
    max-width: 17rem;
    min-height: 13rem;
    background: linear-gradient(150deg, var(--bg-card), var(--bg-secondary));
    border: 1px solid rgba(201, 162, 78, 0.22);
    border-radius: 12px;
    padding: 0.85rem 0.9rem 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
    position: relative;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.request-card:hover {
    color: var(--text-primary);
    border-color: rgba(201, 162, 78, 0.55);
    box-shadow: 0 0 16px rgba(201, 162, 78, 0.12);
    transform: translateY(-2px);
}

.request-card__badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2em 0.6em;
    border-radius: 999px;
    background: rgba(201, 162, 78, 0.85);
    color: var(--bg-primary);
}

.request-card__borrow {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2em 0.55em;
    border-radius: 999px;
    background: rgba(74, 124, 143, 0.25);
    color: var(--accent-hover);
    border: 1px solid rgba(74, 124, 143, 0.45);
}

.request-card__image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.request-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.request-card__image--empty {
    background: rgba(11, 17, 25, 0.6);
}

.request-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.request-card__title {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.2;
    /* Don't strip the title with ellipsis — requests are short by design and
       the full text is the most useful thing on the card. */
    word-break: break-word;
}

.request-card__purpose {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.request-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.request-card__meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.request-card__requester {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 8rem;
}

@media (max-width: 575px) {
    .request-card {
        flex-basis: 14.5rem;
        max-width: 14.5rem;
        min-height: 12rem;
    }
}

/* ===== Tag input (listing + request create/edit) =====
   Applied pills and autocomplete suggestions share a single pill vocabulary
   so the two states read as one control: solid = applied, outlined =
   pickable. Touch targets bump up under pointer: coarse so the remove X is
   finger-sized on mobile. */
.tag-input {
    position: relative;
}

.tag-input-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}

.tag-input-pills:empty {
    display: none;
}

.tag-pill,
.tag-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    line-height: 1.2;
    border: 1px solid transparent;
    white-space: normal;
    overflow-wrap: anywhere;
}

.tag-pill {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    cursor: default;
}

.tag-pill-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    margin-right: -0.25rem;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 0;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
}

.tag-pill-remove:hover,
.tag-pill-remove:focus-visible {
    background: rgba(255, 255, 255, 0.4);
    outline: none;
}

.tag-input-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 100;
    margin-top: 0.35rem;
    padding: 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-suggestion {
    background: transparent;
    color: var(--text-primary);
    border-color: rgba(74, 124, 143, 0.5);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tag-suggestion:hover,
.tag-suggestion:focus-visible {
    background: rgba(74, 124, 143, 0.22);
    border-color: var(--accent-hover);
    color: var(--text-primary);
    outline: none;
}

.tag-suggestion-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--orange-light);
    padding: 0.1em 0.45em;
    border-radius: 999px;
    background: rgba(201, 162, 78, 0.12);
    border: 1px solid rgba(201, 162, 78, 0.3);
}

@media (pointer: coarse) {
    .tag-pill,
    .tag-suggestion {
        font-size: 0.95rem;
        padding: 0.55rem 1rem;
    }

    .tag-pill-remove {
        width: 30px;
        height: 30px;
        margin-right: -0.4rem;
        font-size: 1.25rem;
    }

    .tag-input-pills {
        gap: 0.5rem;
        margin-bottom: 0.6rem;
    }

    .tag-input-suggestions {
        gap: 0.5rem;
        padding: 0.7rem;
    }
}

/* ===== Badge tiles =====
   A badge is a small framed plaque: square illustration inside a gold-tinted
   frame with a soft glow, captioned underneath. Hover (or tap on touch) reveals
   a flavour-text tooltip that hints at how the badge was earned without
   exposing the exact threshold. */
.badge-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem;
}

.badge-tile {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 6.5rem;
    cursor: default;
}

.badge-tile:focus {
    outline: none;
}

.badge-tile-frame {
    position: relative;
    width: 5.25rem;
    height: 5.25rem;
    border-radius: 14px;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(201, 162, 78, 0.22) 0%, transparent 65%),
        var(--bg-card);
    border: 1px solid rgba(201, 162, 78, 0.42);
    box-shadow:
        inset 0 0 0 1px rgba(74, 124, 143, 0.12),
        inset 0 6px 14px -6px rgba(255, 255, 255, 0.08),
        inset 0 -6px 14px -6px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(11, 17, 23, 0.6),
        0 4px 14px -4px rgba(0, 0, 0, 0.55),
        0 0 18px -8px rgba(201, 162, 78, 0.55);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.badge-tile-frame::before,
.badge-tile-frame::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

/* Inner gold beading: a thin inset ring just inside the frame. */
.badge-tile-frame::before {
    inset: 3px;
    border-radius: 11px;
    border: 1px solid rgba(201, 162, 78, 0.18);
}

/* Subtle corner-light highlight to suggest the plaque is metal-rimmed. */
.badge-tile-frame::after {
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 35%, transparent 70%, rgba(0, 0, 0, 0.18) 100%);
    mix-blend-mode: overlay;
}

.badge-tile:hover .badge-tile-frame,
.badge-tile:focus .badge-tile-frame,
.badge-tile.is-revealed .badge-tile-frame {
    transform: translateY(-1px);
    border-color: rgba(219, 181, 99, 0.7);
    box-shadow:
        inset 0 0 0 1px rgba(74, 124, 143, 0.16),
        inset 0 6px 14px -6px rgba(255, 255, 255, 0.12),
        inset 0 -6px 14px -6px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(11, 17, 23, 0.6),
        0 6px 18px -4px rgba(0, 0, 0, 0.55),
        0 0 26px -6px rgba(201, 162, 78, 0.7);
}

.badge-tile-img {
    position: absolute;
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    object-fit: contain;
    z-index: 1;
}

.badge-tile-glyph {
    position: absolute;
    inset: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    color: var(--orange-light);
    opacity: 0;
    z-index: 0;
    pointer-events: none;
}

/* When the AI image fails to load, the glyph fallback becomes visible. */
.badge-tile-frame--no-img .badge-tile-glyph {
    opacity: 0.85;
    z-index: 1;
}

.badge-tile-name {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    line-height: 1.15;
    text-align: center;
    color: var(--orange-light);
    letter-spacing: 0.03em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.badge-tile-tooltip {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: 16rem;
    max-width: 80vw;
    padding: 0.7rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid rgba(201, 162, 78, 0.35);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 22px -10px rgba(201, 162, 78, 0.45);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 30;
}

.badge-tile-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(201, 162, 78, 0.35);
}

.badge-tile-tooltip-title {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--orange-light);
    margin-bottom: 0.25rem;
}

.badge-tile-tooltip-flavor {
    margin: 0 0 0.4rem 0;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--text-primary);
    font-style: italic;
}

.badge-tile-tooltip-hint {
    display: block;
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--text-muted);
    font-style: normal;
}

.badge-tile:hover .badge-tile-tooltip,
.badge-tile:focus-visible .badge-tile-tooltip,
.badge-tile.is-revealed .badge-tile-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Smaller variant used on dense surfaces (conversation header). */
.badge-tile--sm {
    width: 4.25rem;
    gap: 0.25rem;
}

.badge-tile--sm .badge-tile-frame {
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 9px;
}

.badge-tile--sm .badge-tile-frame::before {
    inset: 2px;
    border-radius: 7px;
}

.badge-tile--sm .badge-tile-name {
    font-size: 0.62rem;
}

/* ===== Badges grimoire (the /badges help page) ===== */
.badge-grimoire-entry {
    display: flex;
    gap: 1.1rem;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.badge-grimoire-entry:last-child {
    border-bottom: none;
}

.badge-grimoire-entry .badge-tile {
    flex-shrink: 0;
    width: auto;
}

.badge-grimoire-entry .badge-tile-name {
    display: none;
}

.badge-grimoire-entry .badge-tile-tooltip {
    display: none;
}

.badge-grimoire-body {
    flex: 1;
    min-width: 0;
}

.badge-grimoire-body h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    color: var(--orange-light);
    margin: 0 0 0.3rem 0;
}

.badge-grimoire-flavor {
    margin: 0 0 0.45rem 0;
    color: var(--text-primary);
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.4;
}

.badge-grimoire-hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

@media (max-width: 575px) {
    .badge-grimoire-entry {
        gap: 0.85rem;
    }
}

