:root {
    --bg:            #0e0f13;
    --bg-elev:       #16181f;
    --bg-elev-2:     #1d2029;
    --border:        #2a2e3a;
    --border-strong: #3a4050;
    --text:          #e7e9ee;
    --text-muted:    #9aa0ad;
    --text-dim:      #6b7280;
    --accent:        #4d8ef0;
    --accent-hover:  #6ba3f5;
    --accent-ink:    #ffffff;
    --danger:        #e5484d;
    --danger-hover:  #f2686c;
    --ok:            #3fb950;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 8px 30px rgba(0, 0, 0, .45);
    --ring:          0 0 0 3px rgba(77, 142, 240, .45);
    --maxw:          1180px;
    --gap:           clamp(14px, 2.5vw, 24px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

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

a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }

main.container { flex: 1 0 auto; padding-block: clamp(20px, 4vw, 40px); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 8px; top: -60px; z-index: 100;
    background: var(--accent); color: var(--accent-ink);
    padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600;
    transition: top .15s ease;
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(14, 15, 19, .82);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; letter-spacing: .3px; }
.brand i { color: var(--accent); }
.header-actions { display: inline-flex; align-items: center; gap: 10px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary   { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-elev-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-hover); }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-danger    { background: transparent; color: var(--danger); border-color: rgba(229,72,77,.5); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-block { width: 100%; }

.flash {
    margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm);
    background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.4); color: #cdefd3;
    display: flex; align-items: center; gap: 10px;
}
.flash i { color: var(--ok); }

.hero { padding: 8px 0 4px; }
.hero h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.5px; }
.hero-sub { margin: 6px 0 0; color: var(--text-muted); }

.filters {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin: 22px 0 26px; padding-bottom: 4px;
}
.filter {
    padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-elev); color: var(--text-muted); font-weight: 600; font-size: .95rem;
    transition: all .15s ease;
}
.filter:hover { color: var(--text); border-color: var(--border-strong); }
.filter.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: var(--gap);
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-link { display: block; height: 100%; }
.card-media { position: relative; aspect-ratio: 1 / 1; background: var(--bg-elev-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .card-media img { transform: scale(1.05); }
.card-noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-dim); font-size: 2.4rem; }
.card-badge {
    position: absolute; top: 10px; left: 10px;
    background: rgba(14,15,19,.82); color: var(--text); backdrop-filter: blur(4px);
    padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
    border: 1px solid var(--border);
}
.card-body { padding: 14px 16px 16px; }
.card-title { margin: 0; font-size: 1.02rem; font-weight: 600; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { margin: 8px 0 0; color: var(--accent); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.card-price i { font-size: .85em; }
.card-price--muted { color: var(--text-muted); font-weight: 600; }
.card-rent { margin: 3px 0 0; color: var(--text-muted); font-size: .88rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.card-rent i { font-size: .85em; }

.empty-state {
    text-align: center; padding: 70px 20px; color: var(--text-muted);
    display: grid; gap: 14px; place-items: center;
}
.empty-state i { font-size: 3rem; color: var(--text-dim); }

.breadcrumb { display: flex; gap: 10px; align-items: center; color: var(--text-muted); margin-bottom: 20px; font-size: .95rem; }
.breadcrumb a:hover { color: var(--accent-hover); }

.detail { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(20px, 4vw, 48px); align-items: start; }
@media (max-width: 820px) { .detail { grid-template-columns: 1fr; } }

.gallery-main { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg-elev-2); }
.zoomable { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.zoomable img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.zoom-hint {
    position: absolute; bottom: 12px; right: 12px;
    background: rgba(14,15,19,.8); color: #fff; width: 40px; height: 40px;
    display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border);
    opacity: 0; transition: opacity .15s ease;
}
.zoomable:hover .zoom-hint, .zoomable:focus-visible .zoom-hint { opacity: 1; }
.detail-noimg { aspect-ratio: 1/1; border-radius: var(--radius); }

.thumbs { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; padding: 0; }
.thumb { padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; background: none; width: 72px; height: 72px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-active { border-color: var(--accent); }

.detail-cat { display: inline-block; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-size: .78rem; font-weight: 700; }
.detail-title { margin: 8px 0 12px; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.2; }
.detail-price { font-size: 1.6rem; font-weight: 800; color: var(--accent); margin: 0 0 18px; }
.detail-price--muted { color: var(--text-muted); }

.price-block { display: grid; gap: 10px; margin: 0 0 20px; }
.price-line {
    display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
    margin: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-elev);
}
.price-line .price-label { color: var(--text-muted); font-weight: 600; font-size: .95rem; display: inline-flex; align-items: center; gap: 8px; }
.price-line .price-value { font-size: 1.35rem; font-weight: 800; color: var(--text); white-space: nowrap; }
.price-buy { border-color: rgba(77,142,240,.4); }
.price-buy .price-label i, .price-buy .price-value { color: var(--accent); }
.price-rent .price-label i { color: var(--text-muted); }
.detail-note { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.inline-form { display: inline; }

.lightbox {
    position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
    background: rgba(6,7,10,.94); padding: 20px; cursor: zoom-out;
    animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 96vw; max-height: 92vh; width: auto; height: auto; border-radius: 8px; box-shadow: var(--shadow); }
.lightbox-close {
    position: absolute; top: 18px; right: 18px; width: 48px; height: 48px;
    border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg-elev);
    color: var(--text); font-size: 1.3rem; cursor: pointer; display: grid; place-items: center;
}
.lightbox-close:hover { color: var(--accent-hover); border-color: var(--accent); }

.auth-wrap { display: grid; place-items: center; padding: clamp(20px, 6vw, 60px) 0; }
.auth-card {
    width: 100%; max-width: 420px; background: var(--bg-elev);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: clamp(24px, 4vw, 36px); box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.auth-card h1 i { color: var(--accent); }
.auth-sub { color: var(--text-muted); margin: 0 0 20px; font-size: .95rem; }
.auth-card label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: .9rem; }
.auth-card input { width: 100%; }
.auth-card .btn { margin-top: 22px; }
.auth-back { display: inline-flex; gap: 8px; align-items: center; margin-top: 18px; color: var(--text-muted); font-size: .9rem; }
.auth-back:hover { color: var(--accent-hover); }

input[type="text"], input[type="password"], input[type="number"], select, input[type="file"] {
    width: 100%; background: var(--bg-elev-2); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 11px 13px; font: inherit;
}
input:focus, select:focus { border-color: var(--accent); }
input:disabled { opacity: .5; cursor: not-allowed; }
input[type="file"] { padding: 9px; cursor: pointer; }
input[type="file"]::file-selector-button {
    background: var(--bg-elev); color: var(--text); border: 1px solid var(--border-strong);
    border-radius: 6px; padding: 7px 12px; margin-right: 12px; cursor: pointer; font: inherit;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%239aa0ad'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 38px; }

.form-wrap { max-width: 760px; margin-inline: auto; }
.form-wrap > h1 { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.form-wrap > h1 i { color: var(--accent); }
.item-form { display: grid; gap: 20px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 600; font-size: .92rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.req { color: var(--accent); }
.hint { color: var(--text-dim); font-size: .84rem; margin: 4px 0 0; font-weight: 400; }
legend .hint { display: inline; }
.field-check { margin-top: -4px; }
.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.checkbox input { width: auto; }
.form-error {
    background: rgba(229,72,77,.12); border: 1px solid rgba(229,72,77,.45); color: #f4b6b8;
    padding: 12px 16px; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
}
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

.sortable { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.preview-multi:empty { display: none; }
.sortable-item {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: var(--bg-elev-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 10px; width: 108px; cursor: grab;
}
.sortable-item.dragging { opacity: .4; }
.sortable-item.drag-over { border-color: var(--accent); }
.sortable-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; pointer-events: none; }
.drag-handle { color: var(--text-dim); }
.main-tag { display: none; font-size: .7rem; font-weight: 700; color: var(--accent-ink); background: var(--accent); padding: 2px 8px; border-radius: 999px; }
.sortable-item:first-child .main-tag { display: inline-block; }
.remove-check { font-size: .78rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.remove-check input { width: auto; }
.sortable-item.to-remove { opacity: .45; border-style: dashed; border-color: var(--danger); }
.preview-single img { max-width: 120px; border-radius: var(--radius-sm); margin-top: 8px; border: 1px solid var(--border-strong); }
.btn-mini-remove {
    position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--danger); color: #fff; border: 0; cursor: pointer; font-size: .8rem; display: grid; place-items: center;
}

.site-footer { flex-shrink: 0; border-top: 1px solid var(--border); padding: 24px 0; margin-top: 40px; color: var(--text-dim); font-size: .9rem; text-align: center; }
.site-footer p { margin: 0; }
