:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #667085;
    --line: #d9e0e6;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --ink: #102027;
    --soft: #eef5f4;
    --gold: #b7791f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

.public-content {
    min-height: 70vh;
    padding: 32px;
}

.diagnostic,
.panel {
    width: min(720px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

.button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.button:hover {
    background: var(--accent-dark);
}

.site-header,
.site-footer {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 16px clamp(20px, 5vw, 64px);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
}

.site-brand,
.site-nav,
.site-footer nav,
.hero-actions,
.contact-actions,
.tag-list,
.pagination,
.filter-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.site-brand,
.site-nav a,
.site-footer a {
    font-weight: 750;
    text-decoration: none;
}

.brand-mark {
    align-items: center;
    background: var(--accent);
    border-radius: 6px;
    color: #fff;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    width: 42px;
}

.nav-cta {
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    padding: 8px 12px;
}

.site-footer {
    align-items: flex-start;
    border-bottom: 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.site-footer p {
    margin: 4px 0 0;
}

.footer-copy {
    white-space: nowrap;
}

.public-hero,
.page-hero,
.directory-layout,
.category-grid,
.company-profile {
    margin: 0 auto;
    width: min(1180px, 100%);
}

.public-hero,
.page-hero {
    background: linear-gradient(135deg, #ffffff 0%, #eef5f4 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: clamp(28px, 6vw, 68px);
}

.public-hero h1,
.page-hero h1,
.profile-hero h1 {
    color: var(--ink);
    font-size: clamp(34px, 6vw, 64px);
    line-height: 1.04;
    margin-bottom: 14px;
}

.page-hero.compact {
    margin-bottom: 24px;
    padding: clamp(24px, 4vw, 44px);
}

.page-hero.compact h1 {
    font-size: clamp(32px, 4vw, 48px);
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.breadcrumbs a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.breadcrumbs span::before {
    color: var(--muted);
    content: "/";
    margin-right: 8px;
}

.public-filters {
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(150px, 1fr)) auto;
    margin-bottom: 18px;
    padding: 16px;
}

.results-head {
    color: var(--muted);
    font-weight: 750;
    margin-bottom: 14px;
}

.company-grid,
.category-grid,
.catalog-grid,
.profile-meta-grid {
    display: grid;
    gap: 18px;
}

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

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

.company-card,
.category-card,
.catalog-card,
.profile-section,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.company-card {
    display: grid;
    gap: 14px;
    grid-template-rows: auto 1fr auto;
    padding: 18px;
}

.company-logo,
.profile-logo,
.catalog-fallback {
    align-items: center;
    background: var(--soft);
    border: 1px solid var(--line);
    color: var(--accent-dark);
    display: flex;
    font-weight: 850;
    justify-content: center;
    overflow: hidden;
}

.company-logo {
    border-radius: 8px;
    height: 76px;
    width: 76px;
}

.company-logo img,
.profile-logo img,
.catalog-card img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.company-card h2,
.category-card h2,
.catalog-card h3 {
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 8px;
}

.company-card h2 a,
.category-card h2 a {
    text-decoration: none;
}

.card-kicker,
.category-count,
.card-location,
.profile-location,
.profile-since,
.price-text {
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
    margin-bottom: 6px;
}

.card-action {
    align-self: end;
}

.category-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 190px;
    padding: 22px;
}

.empty-state {
    padding: 28px;
}

.pagination {
    justify-content: center;
    margin-top: 24px;
}

.profile-hero {
    border-radius: 8px;
    margin: 0 auto 24px;
    min-height: 420px;
    overflow: hidden;
    position: relative;
    width: min(1180px, 100%);
}

.profile-cover {
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    width: 100%;
}

.profile-hero::after {
    background: linear-gradient(90deg, rgba(16, 32, 39, 0.9), rgba(16, 32, 39, 0.46));
    content: "";
    inset: 0;
    position: absolute;
}

.profile-hero.neutral-cover {
    background: linear-gradient(135deg, #102027, #0f766e);
}

.profile-hero-content {
    color: #fff;
    max-width: 760px;
    padding: clamp(28px, 6vw, 64px);
    position: relative;
    z-index: 1;
}

.profile-hero-content .breadcrumbs a,
.profile-hero-content .eyebrow,
.profile-hero-content .profile-location,
.profile-hero-content .profile-since {
    color: #d9fffb;
}

.profile-title-row {
    align-items: center;
    display: flex;
    gap: 18px;
}

.profile-logo {
    background: #fff;
    border-radius: 8px;
    flex: 0 0 auto;
    height: 104px;
    width: 104px;
}

.profile-intro {
    font-size: 20px;
    margin: 18px 0;
}

.profile-section {
    margin-bottom: 18px;
    padding: 24px;
}

.catalog-card {
    display: grid;
    gap: 16px;
    grid-template-columns: 116px 1fr;
    padding: 16px;
}

.catalog-card img,
.catalog-fallback {
    border-radius: 8px;
    height: 116px;
    width: 116px;
}

.tag-list a {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent-dark);
    font-weight: 750;
    padding: 8px 12px;
    text-decoration: none;
}

.clean-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.clean-list li + li {
    margin-top: 8px;
}

:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.35);
    outline-offset: 2px;
}

@media (max-width: 980px) {
    .public-filters,
    .company-grid,
    .category-grid,
    .catalog-grid,
    .profile-meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-actions {
        align-self: stretch;
    }
}

@media (max-width: 680px) {
    .site-header,
    .site-footer,
    .profile-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .public-content {
        padding: 18px;
    }

    .public-filters,
    .company-grid,
    .category-grid,
    .catalog-grid,
    .profile-meta-grid,
    .catalog-card {
        grid-template-columns: 1fr;
    }

    .profile-hero {
        min-height: auto;
    }

    .profile-hero-content {
        padding: 24px;
    }
}

.admin-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    background: #17212b;
    color: #fff;
    padding: 24px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
    margin-top: 24px;
}

.sidebar a {
    border-radius: 6px;
    color: #d8dee6;
    padding: 10px 12px;
    text-decoration: none;
}

.sidebar a.active,
.sidebar a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 20px 28px;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
}

.admin-content {
    padding: 28px;
}

.status {
    color: var(--muted);
}

.userbar,
.actions,
.section-head,
.filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.section-head {
    justify-content: space-between;
    margin-bottom: 18px;
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
}

input,
select,
textarea {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.alert {
    border-radius: 6px;
    margin: 0 0 14px;
    padding: 10px 12px;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.warning {
    background: #fef3c7;
    color: #92400e;
}

.text-link,
.link-button {
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
    text-decoration: none;
}

.table-wrap {
    overflow: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.fieldset {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
}

.check-row {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    color: var(--text);
    font-weight: 500;
    margin: 8px 0;
}

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

.wide-panel {
    width: 100%;
    margin-bottom: 20px;
}

.button.secondary {
    background: #475467;
}

.button.danger {
    background: #b42318;
}

.form-grid,
.choice-grid,
.preview-grid {
    display: grid;
    gap: 14px;
}

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

.logo-placeholder {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: #e6f4f1;
    color: var(--accent-dark);
    font-weight: 800;
}

.logo-placeholder.large {
    width: 72px;
    height: 72px;
    font-size: 28px;
}

.table-logo,
.media-preview {
    display: block;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    object-fit: contain;
}

.table-logo {
    width: 38px;
    height: 38px;
}

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

.media-box {
    display: grid;
    gap: 12px;
    align-content: start;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.media-form {
    display: grid;
    gap: 10px;
}

.logo-preview {
    width: 96px;
    height: 96px;
}

.cover-preview,
.preview-cover,
.cover-placeholder,
.catalog-preview {
    width: 100%;
    aspect-ratio: 16 / 7;
}

.cover-preview,
.preview-cover {
    object-fit: cover;
}

.cover-placeholder {
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #f8fafc;
}

.preview-cover {
    margin-bottom: 18px;
}

.catalog-preview {
    object-fit: contain;
}

.catalog-card {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 10px;
    align-items: start;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    background: #eef2f6;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
}

.empty-state,
.eligibility {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 16px;
}

.pagination {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    border-top: 1px solid var(--line);
    background: var(--bg);
    padding: 12px 0;
}

.debug {
    overflow: auto;
    border-radius: 6px;
    background: #111827;
    color: #f9fafb;
    padding: 16px;
}

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

    .sidebar {
        padding: 16px;
    }

    .form-grid.two,
    .preview-grid,
    .media-grid {
        grid-template-columns: 1fr;
    }
}
