:root {
    color-scheme: light;
    --bg: #e7efe8;
    --bg-top: #f8fbf7;
    --panel: rgba(251, 252, 249, 0.94);
    --panel-strong: #ffffff;
    --line: #cad8cb;
    --line-strong: #b5c8b7;
    --text: #18231b;
    --muted: #4a5a4e;
    --accent: #1c6d4b;
    --accent-strong: #155339;
    --accent-soft: #d8ece0;
    --accent-pale: #eef6f0;
    --warn: #8c6d12;
    --warn-soft: #f7ecc1;
    --error: #9e2f2f;
    --error-soft: #f7d9d9;
    --shadow: 0 1px 3px rgba(41, 64, 49, 0.06), 0 1px 2px rgba(41, 64, 49, 0.04);
    --radius-lg: 8px;
    --radius-md: 6px;
    --radius-sm: 4px;
    --info: #2a6496;
    --info-soft: #dbe9f5;
    --success: #1c6d4b;
    --success-soft: #d8ece0;
    --input-bg: #fff;
    --secondary-bg: #eef2ee;
    --secondary-text: #314335;
    --secondary-hover: #dfe8e0;
    --card-bg: rgba(255, 255, 255, 0.82);
    --inset-bg: rgba(255, 255, 255, 0.7);
    --code-bg: #f7faf7;
    --topbar-bg: rgba(248, 251, 247, 0.88);
    --topbar-line: rgba(202, 216, 203, 0.95);
    --footer-bg: rgba(248, 251, 247, 0.78);
    --preview-bg: #eff4ef;
    --backdrop: rgba(20, 31, 23, 0.55);
    --shell-width: 1360px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "DejaVu Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

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

a:hover {
    color: var(--accent-strong);
}

button,
input,
select,
textarea {
    font: inherit;
    box-sizing: border-box;
}

img {
    max-width: 100%;
    display: block;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button,
.button-link {
    appearance: none;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
    box-shadow: 0 2px 8px rgba(28, 109, 75, 0.12);
}

button:hover,
.button-link:hover {
    background: var(--accent-strong);
    transform: translateY(-1px);
}

button.secondary,
.button-link.secondary,
.chip-button {
    background: var(--secondary-bg);
    color: var(--secondary-text);
    box-shadow: none;
}

button.secondary:hover,
.button-link.secondary:hover,
.chip-button:hover {
    background: var(--secondary-hover);
}

button.warn-action {
    color: #b33;
    border: 1px solid #b333;
}
button.warn-action:hover {
    background: #b331;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    background: var(--input-bg);
    color: var(--text);
    padding: 0.55rem 0.75rem;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(28, 109, 75, 0.10);
}

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

label {
    display: grid;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
}

.auth-feedback {
    display: none;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    color: var(--secondary-text);
    font-weight: 600;
}

.auth-feedback:not([hidden]) {
    display: block;
}

.auth-feedback[data-state="pending"] {
    border-color: var(--line-strong);
    background: var(--secondary-bg);
}

.auth-feedback[data-state="success"] {
    border-color: color-mix(in srgb, var(--success) 35%, white);
    background: var(--success-soft);
    color: var(--accent-strong);
}

.auth-feedback[data-state="error"] {
    border-color: color-mix(in srgb, var(--error) 35%, white);
    background: var(--error-soft);
    color: var(--error);
}

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

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

th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

code {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.86rem;
}

.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(12px);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-line);
}

.topbar-inner,
.page-wrap,
.footer-inner {
    width: min(var(--shell-width), calc(100% - 32px));
    margin: 0 auto;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 0;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--accent);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.brand-copy strong {
    display: block;
    font-size: 1.05rem;
}

.brand-copy span {
    color: var(--muted);
    font-size: 0.86rem;
}

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

.topnav a {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    color: var(--secondary-text);
    font-weight: 600;
    font-size: 0.92rem;
}

.topnav a:hover,
.topnav a.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.topbar-account {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.account-meta {
    color: var(--muted);
    font-size: 0.84rem;
    text-align: right;
}

.page-wrap {
    flex: 1;
    padding: 28px 0 36px;
}

.page-stack {
    display: grid;
    gap: 0;
}

.footer {
    border-top: 1px solid var(--topbar-line);
    background: var(--footer-bg);
}

.footer-inner {
    padding: 20px 0 28px;
    color: var(--muted);
    font-size: 0.84rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 24px;
}

.footer-inner a {
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: rgba(91, 106, 95, 0.3);
    text-underline-offset: 2px;
}

.footer-inner a:hover {
    color: var(--accent);
}

.hero-panel,
.surface-card,
.dashboard-shell,
.auth-shell,
.split-shell,
.studio-sidebar,
.studio-content,
.data-table-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

[hidden] {
    display: none !important;
}

.hero-panel {
    padding: 28px;
    display: grid;
    gap: 18px;
}

.hero-header-row,
.section-heading,
.gallery-item-header,
.search-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.hero-header-row {
    align-items: flex-start;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-panel h1,
.section-title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.02;
}

.lede,
.muted {
    color: var(--muted);
    line-height: 1.6;
}

.compact-copy {
    font-size: 0.92rem;
}

.flash-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.flash-message {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(28, 109, 75, 0.16);
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 600;
    font-size: 0.92rem;
}

.split-shell {
    display: grid;
    grid-template-columns: minmax(340px, 430px) 1fr;
    overflow: hidden;
}

.studio-sidebar {
    padding: 28px 24px 30px;
    border-right: 1px solid var(--topbar-line);
    background: var(--panel);
}

.studio-content {
    padding: 28px;
}

.pane-header {
    margin-bottom: 22px;
}

.studio-sidebar .pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.studio-sidebar .pane-header .eyebrow,
.studio-content .hero-panel .eyebrow {
    margin: 0;
}

.surface-grid,
.form-stack,
.gallery-list,
.dashboard-shell,
.auth-shell {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr);
}

.dashboard-shell {
    padding: 24px;
}

.surface-card,
.data-table-card {
    padding: 22px;
}

.data-table-card {
    max-width: 100%;
    overflow-x: auto;
}

.dashboard-shell,
.auth-shell,
.surface-card,
.data-table-card,
.stat-card,
.gallery-item,
.section-heading > * {
    min-width: 0;
}

.dashboard-shell > *,
.auth-shell > *,
.surface-card > *,
.data-table-card > *,
.stat-card > *,
.gallery-item > * {
    min-width: 0;
}

.admin-users-card {
    overflow-x: auto;
}

.admin-users-table {
    min-width: 980px;
    table-layout: fixed;
}

.admin-users-col-email {
    width: 24%;
}

.admin-users-col-display-name {
    width: 16%;
}

.admin-users-col-flag {
    width: 8%;
}

.admin-users-col-tokens {
    width: 10%;
}

.admin-users-col-created {
    width: 13%;
}

.admin-users-col-action {
    width: 13%;
}

.admin-users-table th,
.admin-users-table td {
    vertical-align: middle;
}

.admin-users-centered {
    text-align: center;
}

.admin-users-centered input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.admin-user-display-name-input,
.admin-user-token-input {
    width: 100%;
    min-width: 0;
}

.admin-user-email,
.admin-user-display-name {
    overflow-wrap: anywhere;
}

.admin-user-email {
    font-weight: 700;
}

.admin-user-display-name {
    color: var(--muted);
}

.admin-user-token-input {
    width: 100%;
    min-width: 0;
}

.admin-user-update-form {
    margin: 0;
}

.admin-user-update-form button {
    width: 100%;
}

.surface-card h2,
.surface-card h3,
.feature-card h3,
.gallery-item h3,
.data-table-card h2 {
    margin: 0;
}

.field-grid,
.filter-row,
.stats-grid,
.feature-grid {
    display: grid;
    gap: 14px;
}

.field-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.field-grid > * {
    min-width: 0;
}

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

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

.compact-grid {
    gap: 12px;
}

.filter-row {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 14px;
}

.local-filter-row label {
    gap: 6px;
}

.button-row,
.chip-row {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.button-row > *,
.chip-row > * {
    width: 100%;
    min-width: 0;
}

.button-row > form {
    width: 100%;
}

.button-row > form > button {
    width: 100%;
}

.button-row > button,
.button-row > .button-link,
.chip-row > button,
.chip-row > .button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gallery-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.active-workflow-card {
    margin-top: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
}

.active-workflow-card h3 {
    margin: 6px 0 4px;
}

.active-workflow-actions {
    align-self: stretch;
}

.toggle-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact-toggle-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.single-column-toggle-grid {
    grid-template-columns: 1fr;
}

.toggle-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    min-height: 44px;
    min-width: 0;
    border-radius: 3px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.25;
}

.toggle-card span {
    flex: 1 1 auto;
    min-width: 0;
}

.toggle-card input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
}

.inset-card {
    background: var(--inset-bg);
    box-shadow: none;
}

.artwork-settings-card {
    display: grid;
    gap: 14px;
}

.artwork-options-group {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(46, 86, 59, 0.28);
    background: var(--code-bg);
}

.artwork-options-group:not(.is-render-enabled) {
    border-color: rgba(95, 115, 100, 0.22);
}

.artwork-token-note {
    padding: 14px 16px;
}

.prompt-preview-block {
    margin: 0;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(95, 115, 100, 0.18);
    background: var(--code-bg);
    font-size: 0.9rem;
    line-height: 1.55;
}

.admin-json-block {
    max-height: 320px;
    overflow: auto;
    white-space: pre;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.45;
}

.token-cost-inline {
    color: var(--accent);
    white-space: nowrap;
}

.checkbox-field {
    display: grid;
    gap: 8px;
    align-content: start;
}

.checkbox-field input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.terms-consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 4px 0 2px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.terms-consent-row input {
    width: 18px;
    height: 18px;
    margin: 3px 0 0;
    flex: 0 0 auto;
}

.chip-button {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.86rem;
}

.status-pill,
.mini-badge,
.gallery-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 0 8px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(28, 109, 75, 0.2);
}

.status-pill.neutral,
.mini-badge.neutral,
.gallery-stats span {
    background: var(--secondary-bg);
    color: var(--muted);
    border-color: rgba(95, 115, 100, 0.18);
}

.status-pill.warn,
.mini-badge.warn {
    background: var(--warn-soft);
    color: var(--warn);
    border-color: rgba(140, 109, 18, 0.2);
}

.status-pill.error,
.mini-badge.error {
    background: var(--error-soft);
    color: var(--error);
    border-color: rgba(158, 47, 47, 0.18);
}

.status-pill.success,
.mini-badge.success {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(28, 109, 75, 0.2);
}

.status-pill.info,
.mini-badge.info {
    background: var(--info-soft);
    color: var(--info);
    border-color: rgba(42, 100, 150, 0.2);
}

.stat-card,
.feature-card,
.gallery-item,
.render-result {
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    border: 1px solid var(--line);
}

.stat-card.stat-warn {
    border-left: 3px solid var(--warn);
}

.stat-card.stat-error {
    border-left: 3px solid var(--error);
}

.stat-card.stat-success {
    border-left: 3px solid var(--success);
}

.stat-card.stat-info {
    border-left: 3px solid var(--info);
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    line-height: 1;
    margin-top: 8px;
}

.stat-card.mini strong {
    font-size: 1.35rem;
}

a.stat-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: opacity 0.15s;
}

a.stat-card-link:hover {
    opacity: 0.8;
}

/* Verification overlay accordion */
.overlay-check-stack {
    position: relative;
    margin-top: 8px;
    height: 280px;
}
.overlay-check-card {
    position: absolute;
    left: 0;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 200ms ease, box-shadow 200ms ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    background: var(--panel-strong);
}
.overlay-check-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    z-index: 10 !important;
}
.overlay-check-card img {
    width: 100%;
    display: block;
}
.overlay-check-card .overlay-card-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3px 8px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.7rem;
    text-align: center;
}

.interactive-card {
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.interactive-card:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: 0 12px 24px rgba(41, 64, 49, 0.08);
}

.gallery-item p,
.card-note {
    margin: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.gallery-preview-card {
    display: grid;
    gap: 14px;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
}

.gallery-preview-card .button-row,
.studio-sidebar .button-row,
.studio-sidebar .chip-row,
.studio-sidebar .toggle-grid,
.studio-sidebar .compact-toggle-grid,
.studio-sidebar .field-grid {
    grid-template-columns: 1fr;
}

.studio-sidebar .toggle-card {
    padding: 11px 12px;
}

.gallery-preview-frame {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--preview-bg);
    box-shadow: none;
    box-sizing: border-box;
}

.gallery-preview-frame img {
    width: 100%;
    height: 100%;
    min-width: 0;
    object-fit: cover;
    transition: opacity 200ms ease;
}

.gallery-preview-frame img[src=""] {
    opacity: 0;
}

.gallery-preview-empty {
    min-height: 220px;
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 18px;
    text-align: center;
    color: var(--muted);
    background: var(--preview-bg);
}

.gallery-preview-empty strong {
    color: var(--text);
}

.card-note {
    color: var(--secondary-text);
    line-height: 1.55;
}

.review-stack {
    margin-top: 12px;
}

.skill-selection-row {
    gap: 14px;
}

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

.gallery-grid-two.gallery-preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 360px));
    justify-content: start;
    align-items: start;
}

.gallery-preview-grid .gallery-preview-frame {
    aspect-ratio: 4 / 5;
}

.app-modal {
    width: min(1120px, calc(100% - 24px));
    max-width: 1120px;
    border: 0;
    padding: 0;
    border-radius: var(--radius-lg);
    background: transparent;
}

.builder-modal {
    width: min(1240px, calc(100% - 24px));
    max-width: 1240px;
}

.app-modal::backdrop {
    background: var(--backdrop);
    backdrop-filter: blur(10px);
}

.modal-shell {
    box-sizing: border-box;
    background: var(--panel-strong);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 24px;
}

.builder-shell {
    max-height: min(92vh, 980px);
    overflow: auto;
}

.operations-modal-shell {
    width: min(960px, calc(100vw - 24px));
    max-width: 960px;
}

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

.modal-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.modal-header > * ,
.modal-body-grid > * {
    min-width: 0;
}

.modal-header h2 {
    margin: 0;
}

.modal-shell .surface-card,
.modal-shell .gallery-item,
.modal-shell .gallery-list,
.modal-shell .button-row,
.modal-shell .chip-row,
.modal-shell .gallery-grid-two,
.modal-shell .detail-image {
    min-width: 0;
}

.modal-shell h2,
.modal-shell h3,
.modal-shell p,
.modal-shell .card-note,
.modal-shell .muted,
.modal-shell .button-link,
.modal-shell button,
.modal-shell pre {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.modal-shell pre {
    max-width: 100%;
    white-space: pre-wrap;
}

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

.operations-detail-sections {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
}

.operations-detail-full {
    grid-column: 1 / -1;
}

.operations-modal-shell details summary {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.operations-modal-shell .modal-header .button-row {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.math-detail-grid {
    align-items: start;
}

.math-detail-review-card {
    margin-top: 18px;
}

.builder-card-grid,
.route-card-grid,
.pipeline-job-grid,
.home-hero,
.metric-strip {
    display: grid;
    gap: 18px;
}

.builder-card-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.95fr);
}

.builder-stack {
    display: grid;
    gap: 18px;
}

.skill-selection-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.pipeline-job-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.admin-review-grid {
    align-items: start;
}

.pipeline-job-card {
    min-width: 0;
}

.home-hero {
    grid-template-columns: 1fr;
    padding: 24px 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.home-hero-copy h1,
.route-card h2 {
    letter-spacing: -0.025em;
}

.home-hero-copy {
    display: grid;
    gap: 14px;
}

.home-action-row {
    align-items: start;
}

.home-elevator-pitch {
    max-width: 820px;
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.home-feature-summary,
.route-card {
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--card-bg);
}

.home-feature-summary strong {
    display: block;
    font-size: 1.35rem;
    line-height: 1.15;
    margin: 8px 0 10px;
}

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

.metric-strip > div {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: rgba(238, 246, 240, 0.9);
    border: 1px solid rgba(28, 109, 75, 0.12);
}

.metric-strip p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

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

.route-card {
    display: grid;
    gap: 14px;
}

.route-card h2 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.04;
}

.route-card p {
    margin: 0;
}

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

.featured-gallery-card .gallery-preview-frame {
    aspect-ratio: 4 / 5;
}

.detail-image {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--code-bg);
}

.auth-shell {
    width: min(620px, 100%);
    margin: 32px auto 0;
    padding: 26px;
}

.accent-card {
    background: linear-gradient(180deg, #f6fbf7, #eef6f0);
}

.render-result[hidden] {
    display: none;
}

/* ── Progress Modal ── */

.progress-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    background: #24372a;
    color: #fff;
}

.progress-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(28, 109, 75, 0.15);
    border-left-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-checklist {
    display: grid;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--code-bg);
    font-size: 0.9rem;
    color: var(--muted);
    transition: color 200ms ease, background 200ms ease, border-color 200ms ease;
}

.progress-step .step-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    background: var(--input-bg);
    display: grid;
    place-items: center;
    transition: background 200ms ease, border-color 200ms ease;
}

.progress-step.is-active {
    color: var(--accent);
    font-weight: 700;
    background: var(--accent-pale);
    border-color: rgba(28, 109, 75, 0.2);
}

.progress-step.is-active .step-icon {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.progress-step.is-done {
    color: var(--accent);
    font-weight: 700;
}

.progress-step.is-done .step-icon {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.progress-step.is-done .step-icon::after {
    content: "\2713";
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
}

.progress-step.is-error {
    color: var(--error);
    font-weight: 700;
    background: var(--error-soft);
    border-color: rgba(168, 50, 50, 0.24);
}

.progress-step.is-error .step-icon {
    border-color: var(--error);
    background: var(--error);
    color: #fff;
}

.progress-step.is-error .step-icon::after {
    content: "!";
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
}

.progress-word-box {
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--accent-pale);
    border: 1px solid rgba(28, 109, 75, 0.14);
    font-size: 0.9rem;
    line-height: 1.55;
    max-height: 160px;
    overflow-y: auto;
}

.progress-error {
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--error-soft);
    border: 1px solid rgba(158, 47, 47, 0.18);
    color: var(--error);
    font-weight: 700;
}

.progress-step[hidden] {
    display: none;
}

.progress-summary-line {
    margin: 0;
}

.progress-log-item {
    gap: 10px;
}

.progress-log-item p {
    margin: 0;
}

/* ── Image Lightbox ── */

.lightbox-modal {
    width: auto;
    max-width: 92vw;
    max-height: 92vh;
    border: 0;
    padding: 0;
    background: transparent;
    overflow: visible;
}

.lightbox-modal::backdrop {
    background: rgba(10, 16, 12, 0.82);
    backdrop-filter: blur(6px);
}

.lightbox-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    gap: 8px;
}

.lightbox-nav {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

.lightbox-body img {
    max-width: 88vw;
    max-height: 84vh;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    cursor: zoom-out;
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: none;
}

/* ── OCR Warning ── */

.ocr-warning {
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--error-soft);
    border: 1px solid rgba(158, 47, 47, 0.18);
    color: var(--error);
}

.ocr-warning h3 {
    margin: 0 0 6px;
}

/* ── Copy Button ── */

.copy-button {
    padding: 0.5rem 0.8rem;
    font-size: 0.82rem;
    min-height: auto;
}

.icon-button,
button.icon-button,
.button-link.icon-button {
    box-sizing: border-box;
    width: 2.5rem;
    min-width: 2.5rem;
    height: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    line-height: 1;
    position: relative;
    vertical-align: middle;
}

.copy-button.icon-button,
button.copy-button.icon-button {
    width: auto;
    padding: 0 0.85rem;
    white-space: nowrap;
}

.icon-button:hover,
button.icon-button:hover,
.button-link.icon-button:hover {
    transform: none;
}

.icon-button svg {
    width: 1.1rem;
    height: 1.1rem;
    display: block;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.copy-button-label {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
}

.lightbox-close.icon-button {
    width: 2.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    min-height: 2.25rem;
}

/* ── Clickable Image ── */

.clickable-image {
    cursor: zoom-in;
    transition: transform 140ms ease;
}

.clickable-image:hover {
    transform: scale(1.015);
}

/* ── Interactive gallery cards ── */

.gallery-preview-card {
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.gallery-preview-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(41, 64, 49, 0.10);
}

@media (max-width: 1180px) {
    .feature-grid,
    .filter-row,
    .gallery-grid-two,
    .compact-toggle-grid,
    .modal-body-grid,
    .operations-detail-sections {
        grid-template-columns: 1fr 1fr;
    }

    .builder-card-grid,
    .home-hero,
    .route-card-grid {
        grid-template-columns: 1fr;
    }
}

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

    .studio-sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(202, 216, 203, 0.9);
    }

    .feature-grid,
    .filter-row,
    .gallery-grid-two,
    .toggle-grid,
    .compact-toggle-grid,
    .modal-body-grid,
    .operations-detail-sections {
        grid-template-columns: 1fr;
    }

    .metric-strip,
    .pipeline-job-grid,
    .featured-gallery-grid,
    .active-workflow-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .topbar-inner,
    .hero-header-row,
    .section-heading,
    .search-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-account {
        justify-items: start;
    }

    .account-meta {
        display: none;
    }

    .topnav {
        gap: 4px;
    }

    .topnav a {
        padding: 0.4rem 0.6rem;
        font-size: 0.84rem;
    }

    .operations-modal-shell .modal-header {
        flex-direction: column;
    }

    .operations-modal-shell .modal-header .button-row {
        width: 100%;
        justify-content: flex-start;
    }

    .modal-shell {
        padding: 18px;
    }

    .modal-header {
        gap: 10px;
    }

    .modal-header-actions {
        gap: 6px;
    }

    .copy-button.icon-button,
    button.copy-button.icon-button {
        width: 2.5rem;
        padding: 0;
        gap: 0;
    }

    .copy-button.icon-button[data-copy-state="copied"],
    button.copy-button.icon-button[data-copy-state="copied"] {
        width: auto;
        padding: 0 0.7rem;
        gap: 0.35rem;
    }

    .copy-button.icon-button .copy-button-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .copy-button.icon-button[data-copy-state="copied"] .copy-button-label {
        position: static;
        width: auto;
        height: auto;
        padding: 0;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: nowrap;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .button-row,
    .chip-row {
        grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    }

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

    .page-wrap {
        padding-top: 18px;
    }

    .studio-sidebar,
    .studio-content,
    .hero-panel,
    .surface-card,
    .dashboard-shell,
    .auth-shell,
    .data-table-card,
    .home-hero,
    .home-callout,
    .route-card {
        padding: 18px;
    }
}

/* ── Dark Mode ── */

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #141a16;
        --bg-top: #191f1b;
        --panel: rgba(30, 37, 33, 0.95);
        --panel-strong: #222a25;
        --line: #2e3a32;
        --line-strong: #3d4d42;
        --text: #d4ddd7;
        --muted: #8a9a8e;
        --accent: #4daa7f;
        --accent-strong: #6dc4a0;
        --accent-soft: rgba(77, 170, 127, 0.12);
        --accent-pale: rgba(77, 170, 127, 0.06);
        --warn: #c9a530;
        --warn-soft: rgba(201, 165, 48, 0.12);
        --error: #d06060;
        --error-soft: rgba(208, 96, 96, 0.12);
        --info: #5a9fd4;
        --info-soft: rgba(90, 159, 212, 0.12);
        --success: #4daa7f;
        --success-soft: rgba(77, 170, 127, 0.12);
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
        --input-bg: #1a221d;
        --secondary-bg: #263029;
        --secondary-text: #b0c0b5;
        --secondary-hover: #2e3a32;
        --card-bg: rgba(30, 37, 33, 0.7);
        --inset-bg: rgba(25, 31, 27, 0.6);
        --code-bg: #1a221d;
        --topbar-bg: rgba(25, 31, 27, 0.92);
        --topbar-line: rgba(46, 58, 50, 0.95);
        --footer-bg: rgba(25, 31, 27, 0.85);
        --preview-bg: #1e2820;
        --backdrop: rgba(0, 0, 0, 0.65);
    }

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

    .brand-mark {
        background: var(--accent);
    }

    .topnav a:hover,
    .topnav a.is-active {
        background: var(--accent-soft);
        color: var(--accent-strong);
    }

    .progress-timer {
        background: #0d1410;
    }

    .progress-step.is-done .step-icon {
        background: var(--accent);
    }

    .flash-message {
        border-color: rgba(77, 170, 127, 0.2);
    }

    .studio-sidebar {
        border-right-color: var(--line);
    }

    .artwork-options-group {
        border-color: rgba(77, 170, 127, 0.18);
    }

    img {
        opacity: 0.92;
    }

    .gallery-preview-frame img,
    .detail-image,
    .lightbox-body img {
        opacity: 1;
    }

    .metric-strip > div {
        background: var(--accent-soft);
        border-color: rgba(77, 170, 127, 0.1);
    }

    .accent-card {
        background: var(--accent-soft);
    }

    .home-hero {
        background: var(--panel);
    }
}
