:root {
    --v-bg: #17120d;
    --v-panel: #211914;
    --v-panel-2: #2a2018;
    --v-border: #463728;
    --v-gold: #c4a15c;
    --v-gold-soft: #e1c98f;
    --v-ivory: #f0e6d4;
    --v-muted: #b8a98f;
    --v-danger: #b95d55;
}

html, body {
    background: #120e0a;
    color: var(--v-ivory);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a, .btn-link {
    color: var(--v-gold-soft);
}

h1, h2, h3 {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

h1 {
    font-size: 2rem;
    margin: 0;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.content {
    padding-top: 1.5rem;
}

.page-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.eyebrow {
    color: var(--v-gold);
    font-size: .75rem;
    letter-spacing: .12em;
    margin: 0 0 .35rem;
    text-transform: uppercase;
}

.panel, .metric-card, .table-wrap, .empty-state {
    background: linear-gradient(180deg, rgba(42, 32, 24, .98), rgba(31, 24, 18, .98));
    border: 1px solid var(--v-border);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
}

.panel {
    padding: 1.25rem;
}

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

.metric-card {
    display: flex;
    flex-direction: column;
    min-height: 130px;
    justify-content: center;
    padding: 1.25rem;
}

.metric-value {
    color: var(--v-gold-soft);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    line-height: 1;
}

.metric-label {
    color: var(--v-muted);
    margin-top: .5rem;
}

.table-wrap {
    overflow: hidden;
}

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

.admin-table th, .admin-table td {
    border-bottom: 1px solid rgba(196, 161, 92, .16);
    padding: .95rem 1rem;
    vertical-align: middle;
}

.admin-table th {
    color: var(--v-muted);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

.product-cell {
    align-items: center;
    display: flex;
    gap: .85rem;
}

.product-cell img {
    aspect-ratio: 1;
    border-radius: 6px;
    object-fit: cover;
    width: 52px;
}

.product-cell span {
    color: var(--v-muted);
    display: block;
    font-size: .85rem;
}

.actions {
    text-align: right;
    white-space: nowrap;
}

.status-pill {
    border: 1px solid rgba(196, 161, 92, .35);
    border-radius: 999px;
    color: var(--v-gold-soft);
    display: inline-flex;
    font-size: .78rem;
    padding: .2rem .6rem;
}

.form-control, .form-select {
    background-color: #150f0b;
    border-color: var(--v-border);
    color: var(--v-ivory);
}

.form-control:focus, .form-select:focus {
    background-color: #150f0b;
    border-color: var(--v-gold);
    box-shadow: 0 0 0 .2rem rgba(196, 161, 92, .15);
    color: var(--v-ivory);
}

label {
    color: var(--v-muted);
    display: grid;
    gap: .35rem;
    font-size: .85rem;
}

.field-hint {
    color: var(--v-muted);
    font-size: .82rem;
    margin: .65rem 0;
}

.btn-primary {
    background: var(--v-gold);
    border-color: var(--v-gold);
    color: #15100b;
}

.btn-primary:hover {
    background: var(--v-gold-soft);
    border-color: var(--v-gold-soft);
    color: #15100b;
}

.btn-outline-secondary {
    border-color: var(--v-border);
    color: var(--v-ivory);
}

.btn-outline-danger {
    border-color: rgba(185, 93, 85, .7);
    color: #f0b8b2;
}

.editor-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) 360px;
}

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

.story-field {
    margin-top: 1rem;
}

.cover-preview {
    aspect-ratio: 4 / 3;
    border: 1px solid var(--v-border);
    border-radius: 8px;
    margin-bottom: 1rem;
    object-fit: cover;
    width: 100%;
}

.button-row {
    display: flex;
    gap: .75rem;
    margin-top: 1rem;
}

.button-row.no-margin {
    margin-top: 0;
}

.editor-stack {
    display: grid;
    gap: 1rem;
}

.panel-heading {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-heading h2, .panel-heading h3 {
    margin: 0;
}

.subpanel {
    background: rgba(18, 14, 10, .42);
    border: 1px solid rgba(196, 161, 92, .16);
    border-radius: 8px;
    padding: 1rem;
}

.repeat-list {
    display: grid;
    gap: .85rem;
    margin-top: 1rem;
}

.repeat-row {
    align-items: end;
    border-bottom: 1px solid rgba(196, 161, 92, .14);
    display: grid;
    gap: .75rem;
    padding-bottom: .85rem;
}

.repeat-row.image-row {
    grid-template-columns: 90px minmax(0, 2fr) minmax(0, 1fr) 120px auto;
}

.repeat-row.spec-row {
    grid-template-columns: 90px minmax(0, 1fr) minmax(0, 2fr) auto;
}

.checkbox-label {
    align-items: center;
    display: flex;
    gap: .5rem;
    min-height: 38px;
}

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

.recommendation-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-card {
    background: rgba(18, 14, 10, .42);
    border: 1px solid rgba(196, 161, 92, .16);
    border-radius: 8px;
    display: grid;
    grid-template-columns: auto 1fr;
    padding: .8rem;
}

.checkbox-card input {
    grid-row: span 2;
    margin-right: .65rem;
    margin-top: .2rem;
}

.checkbox-card small {
    color: var(--v-muted);
}

.inline-form {
    align-items: end;
    display: grid;
    gap: .75rem;
    grid-template-columns: 1fr 1fr 2fr 90px auto auto;
}

.compact-input {
    min-width: 80px;
}

.detail-panel {
    display: grid;
    gap: .85rem;
    max-width: 920px;
}

.detail-row {
    border-bottom: 1px solid rgba(196, 161, 92, .14);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .75rem;
}

.detail-row span, .detail-label {
    color: var(--v-muted);
}

.json-box {
    background: #120e0a;
    border: 1px solid var(--v-border);
    border-radius: 6px;
    color: var(--v-ivory);
    padding: 1rem;
    white-space: pre-wrap;
}

.empty-state {
    color: var(--v-muted);
    padding: 2rem;
}

.login-page {
    align-items: center;
    background: radial-gradient(circle at 50% 10%, rgba(196, 161, 92, .12), transparent 35%), #120e0a;
    display: flex;
    min-height: 100vh;
    justify-content: center;
    padding: 2rem;
}

.login-panel {
    background: var(--v-panel);
    border: 1px solid var(--v-border);
    border-radius: 8px;
    padding: 2rem;
    width: min(420px, 100%);
}

.login-form {
    display: grid;
    gap: 1rem;
}

.blazor-error-boundary {
    background: var(--v-danger);
    color: white;
    padding: 1rem;
}

@media (max-width: 900px) {
    .metric-grid, .editor-grid, .form-grid, .inline-form, .translation-grid, .recommendation-grid,
    .repeat-row.image-row, .repeat-row.spec-row {
        grid-template-columns: 1fr;
    }
}
