:root {
    color-scheme: light;
    --bg: var(--color-canvas);
    --surface: var(--color-surface);
    --surface-soft: var(--color-surface-soft);
    --surface-strong: #ebe4d8;
    --border: var(--color-border);
    --border-strong: rgb(200 161 75 / 42%);
    --text: var(--color-ink);
    --text-soft: var(--color-muted);
    --text-faint: #8b806e;
    --primary: var(--color-gold);
    --primary-hover: #a98231;
    --primary-soft: #f4ead3;
    --success: var(--color-positive);
    --success-soft: #e8f8f1;
    --warning: var(--color-warning);
    --warning-soft: #fff3dd;
    --danger: var(--color-danger);
    --danger-soft: #ffedef;
    --violet: #7655d6;
    --violet-soft: #f1edff;
    --cyan: #047f95;
    --cyan-soft: #e6f8fb;
    --sidebar: var(--color-navy);
    --sidebar-text: #f5efe3;
    --sidebar-muted: #aeb8c7;
    --shadow: var(--shadow-soft);
    font-family: var(--font-body);
    font-synthesis: none;
    line-height: 1.5;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1020;
    --surface: #141b2d;
    --surface-soft: #101728;
    --surface-strong: #1d263b;
    --border: #273249;
    --border-strong: #3a465e;
    --text: #edf1f8;
    --text-soft: #a6b0c3;
    --text-faint: #78849b;
    --primary: #7693ff;
    --primary-hover: #92a8ff;
    --primary-soft: #202c55;
    --success: #51cea3;
    --success-soft: #16372f;
    --warning: #f1ad59;
    --warning-soft: #402c18;
    --danger: #ff8490;
    --danger-soft: #46232b;
    --violet: #aa91ff;
    --violet-soft: #2e2750;
    --cyan: #58cce0;
    --cyan-soft: #183941;
    --sidebar: #080d19;
    --sidebar-text: #dce4f5;
    --sidebar-muted: #7f8ba3;
    --shadow: 0 1px 2px rgb(0 0 0 / 20%),
        0 12px 32px rgb(0 0 0 / 18%);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--primary);
}

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

.icon-library {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    padding: 1.4rem 1rem;
    color: var(--sidebar-text);
    background: var(--sidebar);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0 0.65rem 1.5rem;
    color: #fff;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 0.7rem;
    color: #fff;
    background: linear-gradient(145deg, #6d8bff, #7655d6);
    box-shadow: 0 6px 18px rgb(49 85 217 / 35%);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.04em;
}

.brand strong,
.brand small,
.sidebar-footer strong,
.sidebar-footer small {
    display: block;
}

.brand strong {
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.brand small {
    margin-top: 0.08rem;
    color: var(--sidebar-muted);
    font-size: 0.7rem;
}

.main-navigation {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    gap: 0.8rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.6rem;
    color: var(--sidebar-muted);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 140ms ease, background 140ms ease;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
    color: #fff;
    background: rgb(255 255 255 / 8%);
}

.nav-item.is-active {
    box-shadow: inset 3px 0 #7693ff;
}

.nav-item.is-disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.nav-item small {
    margin-left: auto;
    padding: 0.1rem 0.38rem;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 999px;
    font-size: 0.58rem;
    text-transform: uppercase;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: auto;
    padding: 0.85rem 0.65rem 0;
    border-top: 1px solid rgb(255 255 255 / 9%);
}

.sidebar-footer strong {
    font-size: 0.72rem;
}

.sidebar-footer small {
    color: var(--sidebar-muted);
    font-size: 0.68rem;
}

.environment-dot,
.pulse-dot {
    width: 0.55rem;
    height: 0.55rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #50d0a3;
    box-shadow: 0 0 0 4px rgb(80 208 163 / 12%);
}

.app-shell {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 4.25rem;
    align-items: center;
    gap: 1rem;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(12px);
}

.topbar-context strong,
.topbar-context span {
    display: block;
}

.topbar-context strong {
    font-size: 0.88rem;
}

.topbar-context span {
    color: var(--text-soft);
    font-size: 0.72rem;
}

.icon-button {
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    margin-left: auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    color: var(--text-soft);
    background: var(--surface);
    cursor: pointer;
}

.icon-button:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.mobile-menu {
    display: none;
    margin-left: 0;
}

.page {
    width: min(100%, 92rem);
    margin: 0 auto;
    padding: 2rem clamp(1.25rem, 3vw, 3rem) 4rem;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2.2rem;
}

.hero h1 {
    margin: 0.45rem 0 0.25rem;
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.hero p {
    margin: 0;
    color: var(--text-soft);
}

.hero-kicker,
.hero-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.hero-kicker {
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 700;
}

.product-badge {
    padding: 0.22rem 0.52rem;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.system-pill {
    display: flex;
    min-height: 2.8rem;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--surface);
}

.system-pill strong,
.system-pill small {
    display: block;
}

.system-pill strong {
    font-size: 0.76rem;
}

.system-pill small {
    color: var(--text-soft);
    font-size: 0.65rem;
}

.system-warning .pulse-dot {
    background: var(--warning);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 14%, transparent);
}

.system-neutral .pulse-dot {
    background: var(--text-faint);
    box-shadow: none;
}

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

.section-heading h2 {
    margin: 0.15rem 0 0;
    font-size: 1.12rem;
    letter-spacing: -0.015em;
}

.section-meta,
.eyebrow {
    color: var(--text-soft);
    font-size: 0.7rem;
}

.section-meta {
    margin: 0;
}

.eyebrow {
    display: block;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 2rem;
}

.kpi-card {
    display: flex;
    min-width: 0;
    gap: 0.8rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.kpi-icon,
.timeline-icon {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 0.65rem;
    color: var(--primary);
    background: var(--primary-soft);
}

.kpi-card > div {
    min-width: 0;
}

.kpi-label,
.kpi-card small {
    display: block;
    color: var(--text-soft);
    font-size: 0.67rem;
}

.kpi-label {
    font-weight: 700;
}

.kpi-value {
    display: block;
    margin: 0.1rem 0;
    font-size: 1.65rem;
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.tone-violet .kpi-icon,
.kpi-icon.tone-violet {
    color: var(--violet);
    background: var(--violet-soft);
}

.tone-green .kpi-icon {
    color: var(--success);
    background: var(--success-soft);
}

.tone-amber .kpi-icon {
    color: var(--warning);
    background: var(--warning-soft);
}

.tone-red .kpi-icon {
    color: var(--danger);
    background: var(--danger-soft);
}

.tone-cyan .kpi-icon {
    color: var(--cyan);
    background: var(--cyan-soft);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.draft-overview {
    margin-bottom: 2rem;
}

.panel,
.category-card,
.summary-section,
.form-section,
.readonly-section,
.empty-state,
.filter-panel,
.bulk-actions,
.channel-preview {
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel,
.category-card,
.summary-section,
.form-section,
.readonly-section,
.empty-state {
    padding: 1.25rem;
}

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

.activity-timeline li {
    position: relative;
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    gap: 0.8rem;
    padding-bottom: 1rem;
}

.activity-timeline li:not(:last-child)::before {
    position: absolute;
    top: 2.25rem;
    bottom: 0;
    left: 1.1rem;
    width: 1px;
    background: var(--border);
    content: "";
}

.timeline-icon {
    position: relative;
    z-index: 1;
    width: 2.25rem;
    height: 2.25rem;
}

.timeline-icon.tone-sync,
.timeline-icon.tone-validated {
    color: var(--success);
    background: var(--success-soft);
}

.timeline-icon.tone-error {
    color: var(--danger);
    background: var(--danger-soft);
}

.timeline-icon.tone-modified {
    color: var(--warning);
    background: var(--warning-soft);
}

.timeline-icon.tone-neutral {
    color: var(--text-soft);
    background: var(--surface-strong);
}

.activity-timeline strong {
    display: block;
    font-size: 0.82rem;
}

.activity-timeline p,
.empty-inline p {
    margin: 0.12rem 0;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-timeline time {
    color: var(--text-faint);
    font-size: 0.66rem;
}

.text-link {
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
}

.source-cards {
    display: grid;
    gap: 0.65rem;
}

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

.source-card {
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--surface-soft);
}

.source-card-heading {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.source-logo {
    display: grid;
    width: 2.15rem;
    height: 2.15rem;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    color: var(--primary);
    background: var(--surface);
    font-size: 0.68rem;
    font-weight: 850;
}

.source-card-heading strong,
.source-health {
    display: block;
}

.source-card-heading strong {
    font-size: 0.78rem;
}

.source-card-heading .badge {
    margin-left: auto;
}

.source-card-expanded {
    padding: 1.1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.source-card-expanded .metadata-list {
    margin-bottom: 0;
}

.source-health {
    color: var(--text-soft);
    font-size: 0.66rem;
}

.source-success {
    color: var(--success);
}

.source-failed {
    color: var(--danger);
}

.source-card dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    margin: 0.75rem 0 0;
}

.source-card dl div:last-child {
    text-align: right;
}

.source-card dt,
.source-card dd {
    margin: 0;
}

.source-card dt {
    color: var(--text-faint);
    font-size: 0.62rem;
}

.source-card dd {
    margin-top: 0.08rem;
    font-size: 0.7rem;
    font-weight: 650;
}

.source-error {
    margin: 0.7rem 0 0;
    color: var(--danger);
    font-size: 0.68rem;
}

.empty-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.empty-inline strong {
    font-size: 0.82rem;
}

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

.category-card-heading {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.category-card-heading h3,
.category-card-heading p {
    margin: 0;
}

.category-card-heading h3 {
    font-size: 0.92rem;
}

.category-card-heading p {
    color: var(--text-soft);
    font-size: 0.7rem;
}

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

.status-card {
    display: flex;
    min-width: 0;
    min-height: 4.5rem;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    color: inherit;
    background: var(--surface-soft);
    text-decoration: none;
    transition: border-color 140ms ease, transform 140ms ease,
        box-shadow 140ms ease;
}

.status-card:hover,
.status-card:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 10%, transparent);
    transform: translateY(-2px);
}

.status-card-label {
    overflow: hidden;
    color: var(--text-soft);
    font-size: 0.65rem;
    font-weight: 650;
    text-overflow: ellipsis;
}

.status-card-count {
    font-size: 1.35rem;
}

.page-heading,
.detail-heading {
    margin-bottom: 1.5rem;
}

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

.page-heading h1,
.detail-heading h1 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.breadcrumbs {
    margin-bottom: 1rem;
    font-size: 0.78rem;
}

.breadcrumbs a {
    color: var(--text-soft);
    text-decoration: none;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

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

.draft-table th,
.draft-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.draft-table th {
    color: var(--text-soft);
    background: var(--surface-soft);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.draft-table td {
    font-size: 0.82rem;
}

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

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover,
.clickable-row:focus {
    background: var(--primary-soft);
    outline: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 750;
}

.badge.status-new {
    color: var(--primary);
    background: var(--primary-soft);
}

.badge.status-modified {
    color: var(--warning);
    background: var(--warning-soft);
}

.badge.status-validated {
    color: var(--success);
    background: var(--success-soft);
}

.badge.status-ready_for_generation {
    color: var(--violet);
    background: var(--violet-soft);
}

.badge.status-sent {
    color: var(--text-soft);
    background: var(--surface-strong);
}

.filter-panel,
.bulk-actions,
.channel-preview {
    padding: 1rem;
    margin-bottom: 1rem;
}

.home-actions,
.bulk-actions,
.filter-panel,
.preview-tabs,
.pagination {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-panel input,
.filter-panel select {
    min-height: 2.55rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.55rem;
    color: var(--text);
    background: var(--surface);
}

.summary-section,
.form-section,
.readonly-section,
.empty-state {
    margin-bottom: 1rem;
}

.summary-section h2,
.form-section h2,
.readonly-section h2 {
    margin-top: 0;
    font-size: 1.05rem;
}

.draft-form label,
.draft-form legend {
    display: block;
    margin: 1rem 0 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.draft-form input[type="text"],
.draft-form input[type="url"],
.draft-form textarea {
    width: 100%;
    padding: 0.72rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.55rem;
    color: var(--text);
    background: var(--surface);
}

.money-input {
    display: grid;
    grid-template-columns: minmax(0, 14rem) auto;
    align-items: center;
    gap: 0.65rem;
}

.money-input span {
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 700;
}

.draft-form input:focus,
.draft-form textarea:focus,
.filter-panel input:focus,
.filter-panel select:focus {
    border-color: var(--primary);
    outline: 3px solid color-mix(in srgb, var(--primary) 15%, transparent);
}

.draft-form input:disabled,
.draft-form textarea:disabled {
    color: var(--text-soft);
    background: var(--surface-strong);
}

.draft-form fieldset {
    margin: 1.25rem 0 0;
    padding: 0;
    border: 0;
}

.channel-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.channel-option {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    margin: 0 !important;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    font-weight: 500 !important;
    background: var(--surface-soft);
}

.image-row {
    display: grid;
    grid-template-columns: 4.5rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.image-row-new {
    grid-template-columns: 1fr auto;
}

.image-preview {
    width: 4.5rem;
    height: 4.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    object-fit: cover;
}

[data-image-zoom] {
    cursor: zoom-in;
}

[data-image-zoom]:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

body.lightbox-open {
    overflow: hidden;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: rgb(3 7 18 / 88%);
}

.image-lightbox[hidden] {
    display: none;
}

.image-lightbox img {
    max-width: min(94vw, 1200px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: .75rem;
    box-shadow: 0 24px 80px rgb(0 0 0 / 55%);
}

.image-lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgb(255 255 255 / 16%);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 0.7rem;
    margin-bottom: 1.5rem;
}

.button {
    display: inline-flex;
    min-height: 2.55rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.58rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 0.55rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 140ms ease, border-color 140ms ease,
        transform 140ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: wait;
    opacity: 0.7;
}

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

.button-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

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

.button-secondary {
    border-color: var(--border-strong);
    color: var(--text);
    background: var(--surface);
}

.message {
    margin-bottom: 1rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    font-size: 0.8rem;
}

.message-success {
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
    background: var(--success-soft);
}

.message-error {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
    background: var(--danger-soft);
}

.message-readonly {
    color: var(--text-soft);
    background: var(--surface-strong);
}

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

.metadata-list div {
    min-width: 0;
}

.metadata-list dt {
    color: var(--text-soft);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metadata-list dd {
    margin: 0.2rem 0 0;
    overflow-wrap: anywhere;
    font-size: 0.8rem;
}

pre {
    overflow-x: auto;
    padding: 1rem;
    border-radius: 0.6rem;
    background: var(--surface-soft);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.preview-body {
    white-space: pre-wrap;
    line-height: 1.6;
}

.generation-empty-state {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px dashed var(--border-strong);
    border-radius: 0.7rem;
    background: var(--surface-soft);
}

.generation-empty-state h3,
.generation-empty-state p {
    margin: 0;
}

.generation-empty-state h3 {
    font-size: 0.88rem;
}

.future-options {
    margin: 0.8rem 0 0;
    color: var(--text-faint);
    font-size: 0.7rem;
}

.editorial-profile-form fieldset {
    margin: 0 0 1rem;
}

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

.profile-option {
    display: flex !important;
    align-items: center;
    gap: 0.7rem;
    margin: 0 !important;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--surface-soft);
    cursor: pointer;
}

.profile-option > span:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.profile-option strong,
.profile-option small {
    display: block;
}

.profile-option strong {
    font-size: 0.8rem;
}

.profile-option small {
    margin-top: 0.15rem;
    color: var(--text-soft);
    font-size: 0.66rem;
}

.profile-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.editorial-master-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface-soft);
}

.editorial-master-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.editorial-master-card h3,
.editorial-master-card header p {
    margin: 0;
}

.editorial-master-card h3 {
    font-size: 0.9rem;
}

.editorial-master-card header p {
    color: var(--text-soft);
    font-size: 0.68rem;
}

.editorial-master-card .metadata-list {
    margin: 0.9rem 0;
}

.profile-preview {
    margin: 0.9rem 0;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--surface);
}

.profile-preview h4 {
    margin: 0 0 0.65rem;
}

.pagination {
    justify-content: space-between;
    margin-top: 1rem;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.muted {
    color: var(--text-soft);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgb(4 8 16 / 55%);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .app-shell {
        margin-left: 0;
    }

    .mobile-menu {
        display: grid;
    }

    .dashboard-grid,
    .category-grid,
    .source-cards-page,
    .profile-grid,
    .master-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .page {
        padding: 1.35rem 1rem 3rem;
    }

    .topbar {
        padding: 0 1rem;
    }

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

    .hero-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .system-pill,
    .hero-actions form,
    .hero-actions .button {
        width: 100%;
    }

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

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

    .metadata-list {
        grid-template-columns: 1fr;
    }

    .image-row {
        grid-template-columns: 3.5rem 1fr;
    }

    .image-preview {
        width: 3.5rem;
        height: 3.5rem;
    }

    .image-row .button {
        grid-column: 2;
        justify-self: start;
    }

    .detail-heading,
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 420px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

.operator-name {
    color: var(--text-soft);
    font-size: 0.75rem;
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 10%, rgb(200 161 75 / 18%), transparent 30rem),
        linear-gradient(145deg, var(--color-navy), #0e2345);
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem;
}

.login-card {
    width: min(100%, 28rem);
    padding: 2rem;
    border: 1px solid rgb(230 209 162 / 35%);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.login-brand strong,
.login-brand span {
    display: block;
}

.login-brand > div > span {
    color: var(--text-soft);
    font-size: 0.75rem;
}

.login-card h1 {
    margin: 0.35rem 0;
}

.login-form {
    display: grid;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

.login-form label {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface);
}

.login-form .button {
    margin-top: 1rem;
}

.admin-form {
    display: grid;
    max-width: 38rem;
    gap: 0.65rem;
}

.admin-form label {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.admin-form input,
.admin-form select {
    min-height: 2.55rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface);
}

.admin-form .button {
    justify-self: start;
    margin-top: 0.5rem;
}

.credential-reveal {
    border-color: var(--success);
    background: var(--success-soft);
}

.credential-reveal code {
    user-select: all;
    font-size: 0.9rem;
}
.ai-editor {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.ai-editor textarea {
    width: 100%;
    margin-bottom: .75rem;
}

.revision-difference {
    margin: .75rem 0;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: .75rem;
}

.revision-difference > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.revision-difference pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .revision-difference > div {
        grid-template-columns: 1fr;
    }
}
.channel-title-preview {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: .75rem;
    background: var(--surface-subtle);
}

.channel-title-preview div + div {
    margin-top: .75rem;
}

.channel-title-preview p {
    margin: .25rem 0 0;
}

.field-help {
    margin-top: -.35rem;
    color: var(--muted);
    font-size: .875rem;
}

/* Premium philately presentation layer */
body {
    background-image:
        radial-gradient(circle at 20% 0%, rgb(200 161 75 / 7%), transparent 28rem),
        repeating-linear-gradient(
            135deg,
            transparent 0 32px,
            rgb(7 27 52 / 1.6%) 32px 33px
        );
}

h1,
h2,
h3,
.brand strong {
    font-family: var(--font-display);
    font-weight: 700;
}

.sidebar {
    overflow: hidden;
    border-right: 1px solid rgb(230 209 162 / 18%);
    background:
        radial-gradient(circle at 50% 88%, rgb(200 161 75 / 14%), transparent 11rem),
        linear-gradient(180deg, var(--color-navy), #051527);
}

.brand {
    position: relative;
    z-index: 1;
    padding-bottom: 1.7rem;
    border-bottom: 1px solid rgb(230 209 162 / 12%);
}

.brand-mark {
    width: 2.65rem;
    height: 2.65rem;
    border: 1px solid rgb(230 209 162 / 48%);
    border-radius: 50%;
    color: var(--color-gold-light);
    background: rgb(255 255 255 / 4%);
    box-shadow: inset 0 0 0 4px rgb(200 161 75 / 7%);
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

.brand strong {
    color: #fffaf0;
    font-size: 1rem;
    letter-spacing: 0;
}

.brand small {
    color: var(--color-gold-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.main-navigation {
    position: relative;
    z-index: 1;
    gap: 0.3rem;
    padding-top: 1.2rem;
}

.nav-item {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition:
        color var(--motion-fast) ease,
        background var(--motion-fast) ease,
        border-color var(--motion-fast) ease,
        transform var(--motion-fast) ease;
}

.nav-item:hover,
.nav-item:focus-visible {
    border-color: rgb(200 161 75 / 18%);
    background: rgb(255 255 255 / 5%);
    transform: translateX(2px);
}

.nav-item.is-active {
    border-color: rgb(200 161 75 / 32%);
    color: #fff9ec;
    background: linear-gradient(90deg, rgb(200 161 75 / 18%), rgb(200 161 75 / 4%));
    box-shadow: inset 3px 0 var(--color-gold);
}

.postal-globe {
    position: relative;
    width: 8.5rem;
    height: 5rem;
    margin: auto auto 1.1rem;
    border: 1px solid rgb(200 161 75 / 22%);
    border-radius: 50%;
    opacity: 0.75;
}

.postal-globe::before,
.postal-globe::after {
    position: absolute;
    inset: 12% 24%;
    border: 1px solid rgb(200 161 75 / 25%);
    border-radius: 50%;
    content: "";
}

.postal-globe::after {
    inset: 45% 0 auto;
    height: 1px;
    border: 0;
    background: rgb(200 161 75 / 32%);
}

.postal-globe span {
    position: absolute;
    width: 0.28rem;
    height: 0.28rem;
    border-radius: 50%;
    background: var(--color-gold);
    box-shadow: 0 0 9px rgb(200 161 75 / 75%);
}

.postal-globe span:nth-child(1) { inset: 22% auto auto 28%; }
.postal-globe span:nth-child(2) { inset: 55% 18% auto auto; }
.postal-globe span:nth-child(3) { inset: auto auto 18% 42%; }
.postal-globe span:nth-child(4) { inset: 35% auto auto 58%; }

.topbar {
    min-height: 4.8rem;
    border-color: var(--color-border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.topbar-context strong {
    font-family: var(--font-display);
    font-size: 1rem;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.topbar-meta time {
    color: var(--text-soft);
    font-size: 0.72rem;
}

.operator-seal {
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    place-items: center;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    color: var(--color-navy);
    background: var(--color-gold-light);
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 700;
}

.topbar .icon-button {
    margin-left: 0;
}

.hero {
    position: relative;
    isolation: isolate;
    min-height: 13rem;
    overflow: hidden;
    padding: clamp(1.5rem, 4vw, 2.7rem);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(110deg, var(--surface) 12%, rgb(255 253 249 / 85%)),
        var(--surface);
    box-shadow: var(--shadow-soft);
}

.hero h1 {
    color: var(--color-navy);
    font-size: clamp(2rem, 4vw, 3.25rem);
    letter-spacing: -0.025em;
}

[data-theme="dark"] .hero h1 {
    color: var(--text);
}

.hero-kicker {
    color: #7d6737;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.san-petronio-watermark {
    position: absolute;
    z-index: -1;
    right: 5%;
    bottom: -1.25rem;
    display: flex;
    width: min(42%, 31rem);
    height: 12rem;
    align-items: flex-end;
    justify-content: center;
    gap: 0.3rem;
    opacity: 0.055;
}

.san-petronio-watermark::before {
    position: absolute;
    right: 0;
    bottom: 1.25rem;
    left: 0;
    height: 6.5rem;
    border: 5px solid var(--color-navy);
    border-bottom: 0;
    clip-path: polygon(0 35%, 12% 35%, 12% 20%, 22% 20%, 22% 30%, 38% 30%, 50% 0, 62% 30%, 78% 30%, 78% 20%, 88% 20%, 88% 35%, 100% 35%, 100% 100%, 0 100%);
    content: "";
}

.san-petronio-watermark span {
    width: 12%;
    height: 42%;
    border: 4px solid var(--color-navy);
    border-bottom: 0;
    border-radius: 50% 50% 0 0;
}

.product-badge {
    border: 1px solid var(--color-border);
    color: #725817;
    background: #fbf2dd;
}

.button {
    border-radius: var(--radius-sm);
    transition:
        transform var(--motion-fast) ease,
        box-shadow var(--motion-fast) ease,
        background var(--motion-fast) ease;
}

.button-primary {
    color: var(--color-navy);
    background: linear-gradient(135deg, var(--color-gold-light), var(--color-gold));
    box-shadow: 0 8px 20px rgb(200 161 75 / 20%);
}

.button-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #f0ddb2, #b98d32);
    box-shadow: 0 12px 25px rgb(200 161 75 / 28%);
}

.kpi-grid {
    gap: 1rem;
}

.kpi-card,
.category-card,
.panel,
.form-section,
.readonly-section,
.summary-section,
.channel-preview {
    border-color: var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transition:
        transform var(--motion-fast) ease,
        box-shadow var(--motion-fast) ease,
        border-color var(--motion-fast) ease;
}

.kpi-card {
    position: relative;
    overflow: hidden;
    min-height: 8rem;
    padding: 1.15rem;
}

.kpi-card::after {
    position: absolute;
    right: -1.1rem;
    bottom: -1.1rem;
    width: 3.2rem;
    height: 3.2rem;
    border: 1px dashed rgb(200 161 75 / 22%);
    border-radius: 50%;
    content: "";
}

.kpi-card:hover,
.category-card:hover,
.panel:hover {
    border-color: rgb(200 161 75 / 48%);
    box-shadow: var(--shadow-raised), var(--glow-gold);
    transform: translateY(-3px);
}

.kpi-value {
    color: var(--color-navy);
    font-size: 2rem;
    font-weight: 600;
}

[data-theme="dark"] .kpi-value {
    color: var(--text);
}

.kpi-icon,
.timeline-icon {
    border: 1px solid var(--color-border);
    color: #8c6a1e;
    background: #fbf3e1;
}

.category-card,
.panel {
    position: relative;
}

.category-card::before,
.panel::before {
    position: absolute;
    inset: -1px;
    z-index: -1;
    border: 1px dotted rgb(200 161 75 / 24%);
    border-radius: calc(var(--radius-md) + 3px);
    content: "";
    pointer-events: none;
}

.eyebrow {
    color: #96742a;
    letter-spacing: 0.11em;
}

.section-heading h2 {
    font-size: 1.3rem;
}

.status-card {
    border-color: var(--color-border);
}

.status-card:hover,
.status-card:focus-visible {
    border-color: var(--color-gold);
    box-shadow: var(--glow-gold);
}

@media (max-width: 680px) {
    .topbar-meta time {
        display: none;
    }

    .operator-seal {
        display: none;
    }

    .san-petronio-watermark {
        right: -10%;
        width: 70%;
    }
}
