:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1d2433;
    background: #f4f6f9;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.site-header {
    min-height: 64px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #171a21;
    color: #fff;
}

.site-header form {
    margin: 0;
}

.brand,
.link-button {
    color: inherit;
    text-decoration: none;
}

.brand {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand small {
    display: block;
    color: #c4cad4;
    font-size: .7rem;
    font-weight: 500;
}

.brand-mark {
    width: 56px;
    height: 36px;
    object-fit: contain;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
    margin-right: 32px;
}

.main-nav a {
    color: #d8dce3;
    text-decoration: none;
    font-size: .9rem;
}

.main-nav a:hover {
    color: #fff;
}

.link-button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.page-shell {
    width: min(100% - 32px, 1080px);
    margin: 48px auto 80px;
}

.auth-card,
.dashboard-card {
    padding: 32px;
    border: 1px solid #e0e4eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 28px rgb(20 25 35 / 8%);
}

.auth-card {
    width: min(100%, 440px);
    margin: 0 auto;
}

.auth-card form {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

input[type="email"],
input[type="password"],
.auth-card input[type="text"] {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #b8c0cc;
    border-radius: 6px;
    font: inherit;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}

.primary-button {
    padding: 11px 18px;
    border: 0;
    border-radius: 6px;
    background: #9a7115;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.validation-message {
    color: #b42318;
    font-size: .9rem;
}

.eyebrow {
    color: #9a7115;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.page-heading h1 {
    margin-bottom: 8px;
    font-size: clamp(1.8rem, 4vw, 2.55rem);
    letter-spacing: -.035em;
}

.page-heading p:not(.eyebrow) {
    margin-bottom: 0;
    color: #667085;
}

.page-heading--editor {
    align-items: center;
}

.back-link,
.quiet-link {
    display: inline-block;
    margin-bottom: 12px;
    color: #825f10;
    text-decoration: none;
    font-weight: 650;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    min-height: 148px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
}

.metric-card--gold {
    border-color: #d8b35b;
    background: linear-gradient(150deg, #fffdf6, #fff8e6);
}

.metric-card span {
    color: #667085;
    font-size: .85rem;
    font-weight: 650;
}

.metric-card strong {
    margin: 10px 0 5px;
    font-size: 2.1rem;
    line-height: 1;
}

.metric-card small {
    margin-top: auto;
    color: #98a2b3;
}

.metric-grid--compact .metric-card {
    min-height: 106px;
}

.panel,
.form-card,
.publish-card,
.danger-card,
.confirm-card {
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 20px rgb(20 25 35 / 5%);
}

.panel {
    overflow: hidden;
}

.panel-heading {
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #eaecf0;
}

.panel-heading h2 {
    margin-bottom: 4px;
    font-size: 1.15rem;
}

.panel-heading p {
    margin-bottom: 0;
    color: #667085;
    font-size: .9rem;
}

.secondary-button,
.danger-button {
    padding: 9px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    cursor: pointer;
    font: inherit;
    font-size: .9rem;
    font-weight: 650;
    text-decoration: none;
}

.danger-button {
    border-color: #b42318;
    background: #b42318;
    color: #fff;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.data-table th {
    padding: 12px 18px;
    background: #f9fafb;
    color: #667085;
    font-size: .72rem;
    letter-spacing: .045em;
    text-align: left;
    text-transform: uppercase;
}

.data-table td {
    padding: 16px 18px;
    border-top: 1px solid #eaecf0;
    color: #475467;
    vertical-align: middle;
}

.report-cell {
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-cell strong,
.report-cell span {
    display: block;
}

.report-cell strong {
    max-width: 340px;
    margin-bottom: 4px;
    overflow: hidden;
    color: #101828;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-cell span {
    color: #98a2b3;
    font-size: .75rem;
}

.report-cover {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 7px;
    overflow: hidden;
    background-color: #ece5d2;
}

.report-cover img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.status-badge {
    padding: 5px 9px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 750;
}

.status-badge::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-active {
    background: #ecfdf3;
    color: #027a48;
}

.status-draft {
    background: #f2f4f7;
    color: #475467;
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    white-space: nowrap;
}

.row-actions a,
.table-action {
    border: 0;
    background: transparent;
    color: #825f10;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    text-decoration: none;
}

.empty-state {
    padding: 54px 24px;
    text-align: center;
}

.empty-state__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #fff7df;
    color: #825f10;
    font-weight: 800;
}

.empty-state p {
    color: #667085;
}

.filter-bar {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eaecf0;
}

.filter-bar input,
.filter-bar select {
    padding: 9px 11px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    font: inherit;
}

.search-field {
    flex: 1;
}

.search-field input {
    width: 100%;
}

.filter-bar .quiet-link {
    margin: 0;
}

.result-count {
    margin-left: auto;
    color: #667085;
    font-size: .85rem;
}

.pagination {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border-top: 1px solid #eaecf0;
    color: #667085;
    font-size: .85rem;
}

.pagination a {
    color: #825f10;
    font-weight: 700;
    text-decoration: none;
}

.editor-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: 22px;
}

.editor-main {
    display: grid;
    gap: 20px;
}

.form-card,
.publish-card,
.danger-card {
    padding: 24px;
}

.section-heading {
    margin-bottom: 24px;
    display: flex;
    gap: 14px;
}

.section-heading > span {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #fff7df;
    color: #825f10;
    font-size: .72rem;
    font-weight: 800;
}

.section-heading h2,
.publish-card h2 {
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.section-heading p {
    margin-bottom: 0;
    color: #667085;
    font-size: .85rem;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.field {
    display: grid;
    gap: 7px;
}

.field--full {
    grid-column: 1 / -1;
}

.field label {
    color: #344054;
    font-size: .83rem;
    font-weight: 700;
}

.field input:not([type="checkbox"]),
.field textarea,
.slug-input,
.filter-bar input,
.filter-bar select {
    border: 1px solid #d0d5dd;
    border-radius: 7px;
}

.field input:not([type="checkbox"]),
.field textarea {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    color: #101828;
    font: inherit;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field textarea:focus,
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: #a77a15;
    box-shadow: 0 0 0 3px rgb(167 122 21 / 12%);
    outline: none;
}

.field-help {
    min-height: 18px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: #98a2b3;
    font-size: .75rem;
}

.field-note {
    margin: 0;
    color: #667085;
    font-size: .78rem;
    line-height: 1.5;
}

.cover-preview {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 10px;
    border: 1px solid #eaecf0;
    border-radius: 7px;
    background: #fcfcfd;
}

.cover-preview img {
    width: 112px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 6px;
    background: #f2f4f7;
}

.cover-preview span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #475467;
    font-size: .8rem;
}

.slug-input {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.slug-input span {
    align-self: stretch;
    padding: 10px 0 10px 12px;
    display: flex;
    align-items: center;
    background: #f9fafb;
    color: #667085;
    font-size: .84rem;
}

.slug-input input {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.code-editor {
    direction: ltr;
    font-family: "Cascadia Code", Consolas, monospace !important;
    font-size: .82rem !important;
    line-height: 1.65;
}

.optional-section {
    margin-top: 18px;
    border-top: 1px solid #eaecf0;
}

.optional-section summary {
    padding: 18px 0;
    cursor: pointer;
    font-weight: 700;
}

.optional-section summary span {
    margin-left: 8px;
    color: #98a2b3;
    font-size: .75rem;
    font-weight: 500;
}

.editor-sidebar {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 16px;
}

.publish-card {
    display: grid;
    gap: 20px;
}

.publish-toggle {
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    cursor: pointer;
}

.publish-toggle input {
    margin-top: 3px;
}

.publish-toggle strong,
.publish-toggle small {
    display: block;
}

.publish-toggle strong {
    color: #344054;
    font-size: .85rem;
}

.publish-toggle small {
    margin-top: 3px;
    color: #667085;
    line-height: 1.4;
}

.primary-button--full {
    width: 100%;
}

.save-note {
    margin-bottom: 0;
    color: #98a2b3;
    font-size: .72rem;
    line-height: 1.5;
    text-align: center;
}

.danger-card h3 {
    margin-bottom: 5px;
    font-size: .9rem;
}

.danger-card p {
    color: #667085;
    font-size: .8rem;
}

.danger-link {
    color: #b42318;
    font-size: .82rem;
    font-weight: 700;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 15px;
    border-radius: 7px;
    font-size: .88rem;
}

.validation-summary-valid {
    display: none;
}

.alert-success {
    border: 1px solid #abefc6;
    background: #ecfdf3;
    color: #067647;
}

.alert-error {
    grid-column: 1 / -1;
    border: 1px solid #fecdca;
    background: #fef3f2;
    color: #b42318;
}

.preview-toolbar {
    margin-bottom: 22px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    background: #fff;
}

.preview-toolbar > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-preview {
    max-width: 820px;
    margin: 0 auto;
    padding: clamp(26px, 6vw, 64px);
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 40px rgb(20 25 35 / 7%);
    color: #26200f;
    font-family: Tahoma, Arial, sans-serif;
}

.report-preview header > p:first-child {
    color: #9a7115;
    font-size: .8rem;
    font-weight: 800;
}

.report-preview h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.25;
}

.report-preview img {
    width: 100%;
    max-height: 420px;
    margin: 26px 0;
    border-radius: 10px;
    object-fit: cover;
}

.preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    color: #746b56;
    font-size: .82rem;
}

.preview-summary {
    padding: 18px 0;
    border-bottom: 1px solid #e8e1d2;
    color: #5e5542;
    font-size: 1.05rem;
    line-height: 1.8;
}

.preview-frame {
    width: 100%;
    min-height: 760px;
    border: 0;
    background: #fff;
}

.confirm-card {
    max-width: 620px;
    margin: 40px auto;
    padding: 36px;
    text-align: center;
}

.confirm-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fee4e2;
    color: #b42318;
    font-size: 1.5rem;
    font-weight: 900;
}

.confirm-card > p:not(.eyebrow) {
    color: #667085;
    line-height: 1.6;
}

.confirm-details {
    margin: 24px 0;
    padding: 14px 18px;
    border-radius: 8px;
    background: #f9fafb;
    text-align: left;
}

.confirm-details div {
    padding: 7px 0;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.confirm-details dt {
    color: #667085;
}

.confirm-details dd {
    margin: 0;
    font-weight: 650;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.sr-only {
    width: 1px;
    height: 1px;
    padding: 0;
    position: absolute;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor-form {
        grid-template-columns: 1fr;
    }

    .editor-sidebar {
        position: static;
    }
}

@media (max-width: 680px) {
    .site-header {
        padding: 0 16px;
    }

    .main-nav {
        display: none;
    }

    .page-heading,
    .panel-heading,
    .preview-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .metric-grid,
    .field-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .result-count {
        margin-left: 0;
    }

    .preview-toolbar > div {
        align-items: flex-start;
        flex-direction: column;
    }
}
