:root {
    color-scheme: light;
    --bg: #f6f7f8;
    --panel: #ffffff;
    --panel-soft: #f0f5f3;
    --text: #1f2933;
    --muted: #667085;
    --line: #d9e0df;
    --accent: #18756b;
    --accent-strong: #0f5f56;
    --gold: #a86816;
    --danger: #b42318;
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.45;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.auth-box {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: 0 18px 45px rgba(31, 41, 51, 0.08);
}

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

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    padding: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    margin-bottom: 28px;
}

.brand-mark {
    align-items: center;
    background: var(--panel-soft);
    border-radius: var(--radius);
    color: var(--accent-strong);
    display: inline-flex;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    margin-right: 8px;
    width: 36px;
}

.brand-title {
    display: inline-block;
    font-size: 16px;
    font-weight: 800;
    vertical-align: middle;
}

.brand-subtitle,
.muted {
    color: var(--muted);
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a,
.logout-button {
    align-items: center;
    border-radius: var(--radius);
    color: var(--text);
    display: flex;
    gap: 10px;
    padding: 10px 12px;
}

.nav a.active,
.nav a:hover,
.logout-button:hover {
    background: var(--panel-soft);
    color: var(--accent-strong);
    text-decoration: none;
}

.logout-button {
    background: transparent;
    border: 0;
    cursor: pointer;
    margin-top: 18px;
    width: 100%;
}

.content {
    padding: 28px;
}

.topbar {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0;
}

.subtitle {
    color: var(--muted);
    margin: 6px 0 0;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

.stack {
    display: grid;
    gap: 16px;
}

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

.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.filters {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 1fr)) auto;
}

.public-filters {
    grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 1fr);
}

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

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

.field label {
    color: #344054;
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    background: #ffffff;
    border: 1px solid #cfd8d7;
    border-radius: var(--radius);
    color: var(--text);
    min-height: 42px;
    padding: 9px 11px;
    width: 100%;
}

.field textarea {
    min-height: 104px;
    resize: vertical;
}

.checkbox {
    align-items: center;
    display: flex;
    gap: 10px;
}

.checkbox input {
    height: 18px;
    width: 18px;
}

.button,
.button-secondary,
.button-danger {
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    font-weight: 750;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    text-decoration: none;
    white-space: nowrap;
}

.button {
    background: var(--accent);
    color: #ffffff;
}

.button:hover {
    background: var(--accent-strong);
    color: #ffffff;
    text-decoration: none;
}

.button-secondary {
    background: #ffffff;
    border-color: var(--line);
    color: var(--text);
}

.button-secondary:hover {
    background: var(--panel-soft);
    text-decoration: none;
}

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

.table-wrap {
    overflow-x: auto;
}

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

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

th {
    color: #475467;
    font-size: 12px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.pill {
    background: var(--panel-soft);
    border-radius: 999px;
    color: var(--accent-strong);
    display: inline-flex;
    font-size: 12px;
    font-weight: 750;
    padding: 3px 9px;
}

.pill-warning {
    background: #fff6e5;
    color: var(--gold);
}

.notice,
.error-list,
.secret-box {
    border-radius: var(--radius);
    margin-bottom: 16px;
    padding: 12px 14px;
}

.notice {
    background: #eaf7f2;
    color: #075e54;
}

.error-list {
    background: #fff1f0;
    color: var(--danger);
}

.secret-box {
    background: #fff8e8;
    border: 1px solid #f2cf8d;
    color: #633b00;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow-wrap: anywhere;
}

.pagination {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.empty {
    color: var(--muted);
    padding: 30px;
    text-align: center;
}

.embed-body {
    background: #ffffff;
    min-height: 100vh;
}

.embed-wrap {
    margin: 0 auto;
    max-width: 1120px;
    padding: 22px;
}

.embed-header {
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    padding-bottom: 14px;
}

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

.directory-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px;
}

.directory-card h2 {
    font-size: 17px;
    margin: 0 0 8px;
}

.detail-list {
    display: grid;
    gap: 6px;
    margin: 0;
}

.detail-list div {
    color: var(--muted);
    font-size: 13px;
}

.product-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

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

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

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

    .filters,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        display: grid;
    }
}

@media (max-width: 640px) {
    .content,
    .embed-wrap {
        padding: 16px;
    }

    .stats-grid,
    .directory-grid {
        grid-template-columns: 1fr;
    }

    .title {
        font-size: 22px;
    }
}
