:root {
    color-scheme: dark;
    --bg: #04273f;
    --surface: #ffffff;
    --surface-soft: #eef3ef;
    --text: #828988;
    --muted: #66736e;
    --line: #d9e1dd;
    --primary: #126b5f;
    --primary-dark: #afc6f4;
    --warning: #986b00;
    --danger: #b3261e;
    --success: #2e7d32;
    --shadow: 0 14px 36px rgba(27, 41, 35, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px clamp(16px, 4vw, 48px);
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    color: var(--primary-dark);
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.main-nav a,
.status-tabs a {
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
    padding: 8px 11px;
    text-decoration: none;
}

.main-nav a.active,
.main-nav a:hover,
.status-tabs a.active,
.status-tabs a:hover {
    background: var(--surface-soft);
    border-color: var(--line);
    color: var(--text);
}

.page-shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: 32px clamp(16px, 4vw, 48px) 64px;
}

.toolbar {
    align-items: center;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 22px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1.04;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.15rem;
    line-height: 1.2;
}

.toolbar p,
.section-heading p,
.auth-panel p,
.empty-state p,
.listing-card p,
.admin-row-main p {
    color: var(--muted);
}

.button {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 800;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}

.button:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.button.success {
    background: #eaf6eb;
    border-color: #c4e3c6;
    color: var(--success);
}

.button.warning {
    background: #fff5d8;
    border-color: #f0d58b;
    color: var(--warning);
}

.button.danger {
    background: #fdeceb;
    border-color: #f4c7c3;
    color: var(--danger);
}

.filters,
.form-panel,
.auth-panel,
.empty-state,
.contact-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.filters {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto;
    margin-bottom: 24px;
    padding: 16px;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 0.9rem;
    font-weight: 800;
    gap: 7px;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(18, 107, 95, 0.16);
}

.listing-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.listing-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.listing-photo,
.admin-thumb,
.detail-media {
    background: linear-gradient(135deg, #e8eee9, #d9e8e1);
}

.listing-photo {
    aspect-ratio: 4 / 3;
    display: grid;
    overflow: hidden;
    place-items: center;
    text-decoration: none;
}

.listing-photo img,
.admin-thumb img,
.detail-media img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.listing-photo span,
.admin-thumb span,
.photo-placeholder {
    color: var(--primary-dark);
    font-size: 3rem;
    font-weight: 900;
}

.listing-card-body {
    padding: 16px;
}

.listing-card h2 {
    margin: 8px 0;
}

.listing-card h2 a,
.admin-row-main h2 a {
    text-decoration: none;
}

.listing-card h2 a:hover,
.admin-row-main h2 a:hover {
    color: var(--primary);
}

.listing-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.listing-meta span {
    background: var(--surface-soft);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 4px 8px;
}

.listing-card-footer {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 16px;
}

.listing-card-footer time {
    color: var(--muted);
    font-size: 0.84rem;
}

.detail-layout {
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
}

.detail-media {
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    overflow: hidden;
    place-items: center;
}

.detail-content {
    min-width: 0;
}

.detail-content .price {
    color: var(--primary-dark);
    font-size: 1.5rem;
    font-weight: 900;
}

.description {
    background: #ffffff;
    border-top: 1px solid var(--line);
    margin: 22px 0;
    padding-top: 22px;
    white-space: normal;
}

.contact-box {
    padding: 18px;
}

.contact-box h2 {
    margin-bottom: 12px;
}

.contact-box p {
    margin-bottom: 6px;
}

.form-panel,
.auth-panel {
    margin: 0 auto;
    max-width: 820px;
    padding: 24px;
}

.auth-panel {
    max-width: 460px;
}

.section-heading {
    margin-bottom: 20px;
}

.stacked-form {
    display: grid;
    gap: 16px;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.field-error {
    color: var(--danger);
    font-size: 0.84rem;
}

.form-errors,
.flash {
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.form-errors,
.flash.danger {
    background: #fdeceb;
    color: var(--danger);
}

.flash.success {
    background: #eaf6eb;
    color: var(--success);
}

.flash.warning {
    background: #fff5d8;
    color: var(--warning);
}

.empty-state {
    padding: 28px;
    text-align: center;
}

.diagnostic-table {
    border-collapse: collapse;
    margin: 0 0 22px;
    width: 100%;
}

.diagnostic-table th,
.diagnostic-table td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
}

.diagnostic-table th {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.status-tabs a span {
    background: rgba(18, 107, 95, 0.12);
    border-radius: 999px;
    color: var(--primary-dark);
    margin-left: 6px;
    padding: 2px 7px;
}

.admin-list {
    display: grid;
    gap: 14px;
}

.admin-row {
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 16px;
    grid-template-columns: 150px minmax(0, 1fr) auto;
    padding: 12px;
}

.admin-thumb {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    display: grid;
    overflow: hidden;
    place-items: center;
    text-decoration: none;
}

.admin-row-main h2 {
    margin: 8px 0;
}

.admin-actions {
    align-content: center;
    display: grid;
    gap: 8px;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    margin-top: 18px;
}

@media (max-width: 760px) {
    .site-header,
    .toolbar,
    .listing-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .main-nav {
        justify-content: flex-start;
    }

    .filters,
    .detail-layout,
    .form-grid.two,
    .admin-row {
        grid-template-columns: 1fr;
    }

    .admin-thumb {
        aspect-ratio: 4 / 3;
    }

    .form-actions {
        justify-content: stretch;
    }

    .button {
        width: 100%;
    }
}
