* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: #1e293b;
    background: #f8fafc;
}

.container {
    width: min(960px, 92%);
    margin: 0 auto;
}

.site-header,
.site-footer {
    background: #0f172a;
    color: #e2e8f0;
}

.site-header .container,
.site-footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.brand {
    margin: 0;
    font-size: 1.1rem;
}

.header-stack {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.header-title-row {
    width: 100%;
    display: flex;
    justify-content: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: center;
}

.user-pill {
    border: 1px solid #334155;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
}

main.container {
    padding: 24px 0 36px;
}

.card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 18px;
}

.form-row {
    margin-bottom: 12px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #94a3b8;
    border-radius: 10px;
    background: #ffffff;
}

textarea {
    resize: vertical;
}

button {
    border: 0;
    border-radius: 10px;
    background: #15803d;
    color: #ffffff;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
}

button:hover {
    background: #166534;
}

.btn-link {
    display: inline-block;
    border-radius: 8px;
    background: #15803d;
    color: #ffffff;
    padding: 8px 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
}

.btn-link:hover {
    background: #166534;
}

.msg-count {
    background: #b91c1c;
    color: #fff;
    border-radius: 999px;
    padding: 1px 6px;
    font-size: 0.72rem;
    margin-left: 6px;
    font-weight: 700;
}

.inline-form {
    margin: 0;
}

.btn-link-button {
    border: 0;
    border-radius: 8px;
    background: #15803d;
    color: #ffffff;
    padding: 8px 10px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.82rem;
    white-space: nowrap;
}

.btn-link-button:hover {
    background: #166534;
}

.btn-small {
    padding: 8px 10px;
    font-size: 0.85rem;
}

.register-cta {
    font-size: 1rem;
    padding: 12px 16px;
    background: #b91c1c;
    animation: register-cta-flash 0.6s ease-in-out 0s 4;
}

.register-cta:hover {
    background: #991b1b;
}

@keyframes register-cta-flash {
    0%, 100% {
        background: #b91c1c;
    }
    50% {
        background: #ef4444;
    }
}

.alert {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
}

.alert-success {
    background: #dcfce7;
    color: #14532d;
    border-color: #bbf7d0;
}

.muted {
    color: #475569;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.table th,
.table td {
    border: 1px solid #cbd5e1;
    padding: 6px;
    text-align: left;
    vertical-align: top;
}

.table th {
    background: #f1f5f9;
}

.item-repeat-head th {
    background: #dcfce7;
    color: #14532d;
    font-weight: 700;
    border-top: 2px solid #86efac;
}

.thumb {
    width: 86px;
    height: 86px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
}

.stack-actions {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.public-item .price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #166534;
}

.public-item {
    max-width: 640px;
    margin: 0 auto;
}

.public-photo {
    width: min(100%, 420px);
    height: auto;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    margin: 8px 0 12px;
}

.public-qr {
    margin: 10px 0 14px;
}

.public-qr img {
    width: 180px;
    height: 180px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
}

.event-grid,
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.event-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.event-header-qr {
    flex: 0 0 auto;
}

.event-card h3,
.item-card h3 {
    margin-top: 0;
}

.event-distance-near {
    color: #b91c1c;
    font-weight: 700;
    animation: nearby-flash 0.7s ease-in-out 0s 4;
}

.event-select-form {
    margin-top: 10px;
}

.zip-filter-form {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}

.nearby-controls {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

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

.row-actions-center {
    justify-content: center;
    margin: 8px 0 22px;
}

.event-detail {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
}

.event-detail h3 {
    margin-top: 0;
}

.tx-date {
    font-size: 0.85rem;
    color: #334155;
}

.tx-seq {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
    vertical-align: -0.15em;
}

.last-item-thumb {
    width: 172px;
    height: 172px;
}

.pending-offer {
    color: #b91c1c;
    animation: pending-offer-flash 0.65s ease-in-out 0s 4;
}

.remove-item-form {
    margin-top: 12px;
}

.money-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    margin-right: 6px;
}

.money-chip-bill {
    border-radius: 6px;
    background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #4ade80;
    color: #14532d;
    box-shadow: inset 0 0 0 1px #86efac;
}

.money-chip-bill::before,
.money-chip-bill::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #86efac;
    border: 1px solid #4ade80;
}

.money-chip-bill::before {
    left: 5px;
}

.money-chip-bill::after {
    right: 5px;
}

.money-chip-coin {
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #e2e8f0 45%, #94a3b8 100%);
    border: 1px solid #64748b;
    color: #1e293b;
    box-shadow: inset 0 0 0 1px #cbd5e1;
}

@keyframes pending-offer-flash {
    0%, 100% {
        color: #b91c1c;
    }
    50% {
        color: #ef4444;
    }
}

@keyframes nearby-flash {
    0%, 100% {
        color: #b91c1c;
    }
    50% {
        color: #ef4444;
    }
}

.mobile-item-list {
    display: none;
}

.item-open-row {
    cursor: pointer;
}

.item-open-row:hover td {
    background: #f0fdf4;
}

.table button,
.table .btn-link,
.table .btn-link-button {
    padding: 6px 9px;
    font-size: 0.8rem;
    border-radius: 8px;
}

@media (max-width: 800px) {
    button,
    .btn-link,
    .btn-link-button {
        font-size: 0.82rem;
        padding: 8px 10px;
    }

    .mobile-item-list {
        display: block !important;
    }

    .mobile-item-list .event-detail {
        margin-bottom: 12px;
    }

    .mobile-item-list .thumb {
        width: 172px;
        height: 172px;
        display: block;
        margin: 0 auto 10px;
    }

    .desktop-items-table {
        display: none !important;
    }
}
