:root {
    --bg: #f5f7f8;
    --panel: #ffffff;
    --ink: #15202b;
    --muted: #667085;
    --line: #d7dee6;
    --brand: #0d5c63;
    --brand-2: #f2b84b;
    --brand-soft: #e7f2f1;
    --danger: #b42318;
    --ok: #117a48;
    --shadow: 0 18px 42px rgba(21, 32, 43, .08);
}

* { box-sizing: border-box; }

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    min-width: 0;
    margin: 0;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

img, svg, video, iframe {
    max-width: 100%;
}

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

main {
    width: min(1200px, calc(100% - 32px));
    margin: 28px auto 56px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    width: min(1200px, calc(100% - 32px));
    min-height: 74px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    min-width: 0;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--brand);
    font-size: 22px;
    font-weight: 800;
    white-space: nowrap;
}

.brand-mark {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    font-weight: 900;
}

.brand img {
    max-height: 42px;
    max-width: 190px;
    object-fit: contain;
}

.main-nav,
.actions,
.tabs,
.inline,
.side-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.main-nav {
    min-width: 0;
    justify-content: flex-end;
}

.main-nav a,
.main-nav button,
.tabs a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    border: 0;
    background: transparent;
    color: #53627a;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.main-nav a:hover,
.tabs a:hover {
    color: var(--brand);
}

.main-nav form { margin: 0; }

.menu-button {
    display: none;
}

.button,
button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.button.secondary,
button.ghost {
    background: #fff;
    color: var(--brand);
}

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

.button.compact {
    min-height: 38px;
    padding: 0 14px;
}

.flash {
    width: min(1200px, calc(100% - 32px));
    margin: 18px auto 0;
    padding: 14px 16px;
    border-left: 4px solid var(--brand);
    border-radius: 6px;
    background: #fff;
    box-shadow: var(--shadow);
}

.hero {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, .98fr) minmax(280px, .72fr);
    gap: 24px;
    align-items: center;
    padding: 28px;
    overflow: hidden;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(13, 92, 99, .98), rgba(17, 99, 91, .94)),
        #0d5c63;
    color: #fff;
}

.hero-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.eyebrow {
    width: fit-content;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    color: #eaf7f6;
    font-size: 13px;
    font-weight: 800;
}

.hero h1 {
    max-width: 650px;
    margin: 0;
    font-size: 48px;
    line-height: 1.06;
    letter-spacing: 0;
}

.hero p {
    max-width: 650px;
    margin: 0;
    color: #e6f2f1;
    font-size: 18px;
    line-height: 1.55;
}

.hero-media {
    min-width: 0;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 390px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 8px;
    background: #edf2f4;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .16);
}

.hero-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.hero-search {
    width: 100%;
    max-width: 760px;
    display: grid;
    grid-template-columns: minmax(220px, 1.35fr) minmax(130px, .75fr) minmax(130px, .75fr) auto;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 34px rgba(0, 0, 0, .16);
}

.hero-search input,
.hero-search select {
    min-width: 0;
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hero-links a {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    color: #ecf8f7;
    font-size: 14px;
    font-weight: 700;
}

.notice {
    max-width: 760px;
    display: inline-flex;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 6px;
    background: rgba(255,255,255,.10);
    color: #fff;
    line-height: 1.45;
}

.notice.warning {
    display: block;
    background: #fff7e6;
    color: #7a4b00;
    border-color: #ffd89a;
}

.notice.success {
    display: block;
    background: #e8f7ef;
    color: var(--ok);
    border-color: #bde5cd;
}

.category-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.category-strip a,
.shortcut-grid a {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    transition: border-color .16s ease, transform .16s ease;
}

.category-strip a:hover,
.shortcut-grid a:hover {
    border-color: var(--brand);
    transform: translateY(-1px);
}

.category-strip strong,
.shortcut-grid strong {
    color: var(--ink);
    font-size: 17px;
}

.category-strip span,
.shortcut-grid span {
    color: var(--muted);
    line-height: 1.4;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.stat-grid div,
.panel,
.listing-card {
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat-grid div {
    padding: 18px;
}

.stat-grid strong {
    display: block;
    color: var(--brand);
    font-size: 25px;
}

.stat-grid span,
.muted,
.listing-card p,
.section-head p {
    color: var(--muted);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin: 30px 0 14px;
}

.section-head.in-panel {
    margin: 0 0 18px;
}

.section-head h1,
.section-head h2 {
    margin: 0 0 6px;
}

.grid {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.listing-card {
    min-height: 390px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.listing-card > :not(.thumb) {
    margin-left: 16px;
    margin-right: 16px;
}

.listing-card .meta { margin-bottom: 16px; }

.listing-card h3 {
    margin: 0;
    min-height: 52px;
    font-size: 20px;
    line-height: 1.3;
}

.listing-card p { margin: 0; }

.thumb {
    display: flex;
    width: 100%;
    aspect-ratio: 4 / 3;
    align-items: center;
    justify-content: center;
    background: #dfe7ed;
    color: var(--muted);
    font-weight: 800;
}

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

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    margin-bottom: 10px;
}

.badge {
    align-self: flex-start;
    padding: 5px 9px;
    background: #fff4d8;
    color: #7a4b00;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.badge.hot {
    background: #fde2df;
    color: var(--danger);
}

.badge.showcase {
    background: #dff3ec;
    color: var(--brand);
}

.badge.bid {
    background: #e6edff;
    color: #3152a3;
}

.listing-specs,
.quick-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.listing-specs span,
.quick-specs span {
    padding: 6px 8px;
    border-radius: 6px;
    background: #eef3f4;
    color: var(--muted);
    font-size: 13px;
}

.price {
    margin-top: 14px;
    font-size: 24px;
    font-weight: 800;
    color: var(--brand);
}

.meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.panel {
    padding: 22px;
    margin-bottom: 18px;
}

.admin-shortcuts {
    margin-top: 18px;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.filter-panel {
    display: grid;
    gap: 10px;
    margin: 18px 0;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filter-panel.advanced {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filter-panel button {
    grid-column: 4;
}

.narrow {
    width: min(520px, 100%);
    margin: 38px auto;
}

.narrowish {
    width: min(760px, 100%);
}

.form {
    display: grid;
    gap: 14px;
}

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

.admin-user-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-listing-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.span-2 {
    grid-column: span 2;
}

.form label {
    min-width: 0;
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 700;
}

.form-title {
    margin: 12px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 18px;
}

.check {
    display: flex !important;
    grid-template-columns: none !important;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    color: var(--ink) !important;
}

.check input {
    width: auto;
    min-height: auto;
}

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

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

textarea { resize: vertical; }

table {
    width: 100%;
    border-collapse: collapse;
}

.responsive-table {
    width: 100%;
    overflow-x: auto;
}

.admin-edit-table input,
.admin-edit-table select {
    min-width: 170px;
    margin: 3px 0;
}

.admin-edit-table td {
    vertical-align: top;
}

.table-actions {
    display: grid;
    gap: 8px;
    min-width: 120px;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.detail {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, .75fr);
    gap: 18px;
}

.sticky-side {
    align-self: start;
    position: sticky;
    top: 90px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.gallery img,
.empty-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    background: #dfe7ed;
}

.empty-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 800;
}

.long-text {
    line-height: 1.75;
}

dl {
    display: grid;
    grid-template-columns: 128px 1fr;
    gap: 11px;
}

dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; }

.side-actions {
    margin: 18px 0;
}

.payment-panel iframe {
    width: 100%;
    min-height: 720px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.site-footer {
    width: 100%;
    margin-top: 48px;
    padding: 40px 0 28px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.footer-inner {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(260px, 1.25fr) repeat(auto-fit, minmax(150px, 1fr));
    gap: 28px;
    align-items: start;
}

.footer-about {
    min-width: 0;
}

.footer-brand {
    margin-bottom: 12px;
}

.footer-inner p {
    max-width: 460px;
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.footer-group {
    min-width: 0;
    padding-top: 4px;
}

.footer-inner h3 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 15px;
}

.footer-links {
    display: grid;
    gap: 8px;
}

.footer-links a {
    width: fit-content;
    color: var(--muted);
    line-height: 1.35;
}

.footer-links a:hover {
    color: var(--brand);
}

.footer-contact {
    font-weight: 700;
}

.content-page {
    max-width: 860px;
    margin: 0 auto 18px;
    line-height: 1.7;
}

.empty-state {
    text-align: center;
}

@media (max-width: 1100px) {
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 0;
        gap: 12px;
    }

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

    .hero {
        grid-template-columns: 1fr;
    }

    .hero-media {
        max-height: none;
        aspect-ratio: 16 / 7;
    }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    main {
        width: min(100% - 20px, 1200px);
        margin-top: 16px;
    }

    .topbar-inner {
        width: min(100% - 20px, 1200px);
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
    }

    .brand {
        font-size: 19px;
    }

    .brand-mark {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
    }

    .menu-button {
        min-height: 38px;
        display: inline-flex;
        padding: 0 12px;
    }

    .main-nav {
        display: none;
        grid-column: 1 / -1;
        width: 100%;
        padding-top: 8px;
    }

    .main-nav.is-open {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .main-nav a,
    .main-nav form,
    .main-nav button {
        width: 100%;
    }

    .main-nav a,
    .main-nav button {
        justify-content: flex-start;
        min-height: 42px;
        padding: 0 10px;
        border-radius: 6px;
        background: #f7fafb;
    }

    .main-nav .button {
        justify-content: center;
        background: var(--brand);
        color: #fff;
    }

    .hero {
        padding: 18px;
        gap: 18px;
    }

    .hero h1 {
        font-size: 34px;
    }

    .hero p {
        font-size: 16px;
    }

    .hero-search {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .hero-media {
        aspect-ratio: 16 / 10;
    }

    .grid,
    .stat-grid,
    .filter-panel,
    .filter-panel.advanced,
    .category-strip,
    .shortcut-grid,
    .detail,
    .form.two,
    .admin-user-form,
    .admin-listing-form,
    .footer-inner {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .filter-panel button {
        grid-column: auto;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .sticky-side {
        position: static;
    }

    .panel {
        padding: 18px;
    }

    table { white-space: nowrap; }

    dl {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media (max-width: 420px) {
    .hero h1 {
        font-size: 30px;
    }

    .price {
        font-size: 21px;
    }
}

/* Admin SaaS layout */
.admin-body {
    background: #f3f6f8;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    background: #0f172a;
    color: #dbe4f0;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    color: #fff;
    font-weight: 800;
    font-size: 18px;
}

.admin-menu {
    display: grid;
    gap: 6px;
}

.admin-menu a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 700;
}

.admin-menu a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    min-height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.admin-topbar strong {
    display: block;
    color: #0f172a;
}

.admin-topbar span {
    color: #64748b;
    font-size: 14px;
}

.admin-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-content {
    width: min(1280px, calc(100% - 40px));
    margin: 24px auto 56px;
}

.admin-flash {
    width: min(1280px, calc(100% - 40px));
}

.admin-page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-page-head h1 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 28px;
}

.admin-page-head p {
    margin: 0;
    color: #64748b;
}

.compact-head {
    margin-bottom: 18px;
}

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.admin-stat-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-stat-card,
.admin-card {
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .04);
}

.admin-stat-card {
    padding: 18px;
}

.admin-stat-card span {
    display: block;
    margin-bottom: 10px;
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
}

.admin-stat-card strong {
    color: #0f172a;
    font-size: 28px;
}

.admin-card {
    padding: 22px;
    margin-bottom: 18px;
}

.admin-card h2 {
    margin: 0 0 12px;
    color: #0f172a;
}

.admin-card p {
    color: #64748b;
    line-height: 1.65;
}

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

.admin-mini-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.admin-mini-list span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
}

.admin-mini-list strong {
    color: #0f172a;
}

.admin-action-grid,
.admin-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.admin-action-grid a {
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 800;
}

.muted-card {
    background: #f8fafc;
}

.status-pill {
    display: inline-flex;
    margin-top: 10px;
    padding: 5px 9px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
}

.status-pill.on {
    background: #dcfce7;
    color: #166534;
}

.admin-cpc-inline input {
    max-width: 120px;
}

@media (max-width: 1100px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
    }

    .admin-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-stat-grid,
    .admin-stat-grid.compact,
    .admin-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .admin-content,
    .admin-flash {
        width: min(100% - 20px, 1280px);
    }

    .admin-topbar,
    .admin-page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-topbar {
        padding: 14px 16px;
    }

    .admin-top-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .admin-menu,
    .admin-stat-grid,
    .admin-stat-grid.compact,
    .admin-grid-2 {
        grid-template-columns: 1fr;
    }
}
