:root {
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-text: #222;
    --color-muted: #6b7280;
    --color-background: #f9f9f9;
    --color-border: #dddddd;
    --color-panel: #ffffff;
    --color-light: #f5f5f5;
    --color-success: #16a34a;
    --color-warning: #f59e0b;
    --color-error: #dc2626;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --border-radius: 6px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.5;
}

body.auth-locked {
    overflow: hidden;
}

body.modal-open {
    overflow: hidden;
}

body.detail-view {
    overflow: hidden;
}

.simple-login-container {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #2b2f3a;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.simple-login-container::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--auth-bg-next, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
    z-index: 0;
}

.simple-login-container.is-bg-fading::after {
    opacity: 1;
    transform: scale(1);
}

.simple-login-container::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 25, 0.38);
    pointer-events: none;
    z-index: 1;
}

.login-glyphs {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    pointer-events: none;
    overflow: visible;
    transition: opacity 0.2s ease;
}

.login-glyphs.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.login-glyphs.is-hidden .login-glyph {
    animation-play-state: paused;
}

.login-glyph {
    position: absolute;
    left: 0;
    top: 0;
    font-size: var(--glyph-size, 18px);
    opacity: calc(var(--glyph-opacity, 0.45) * var(--glyph-opacity-mult, 1));
    offset-distance: 0%;
    offset-rotate: auto;
    offset-anchor: 50% 50%;
    transform: translate3d(0, 0, 0);
    animation: login-glyph-orbit var(--glyph-duration, 12s) linear infinite;
    animation-delay: var(--glyph-delay, 0s);
    animation-direction: var(--glyph-direction, normal);
    will-change: transform, opacity;
}

.login-glyph-inner {
    display: inline-block;
    color: var(--glyph-color, rgba(255, 255, 255, 0.78));
    text-shadow: var(--glyph-shadow, 0 3px 16px rgba(0, 0, 0, 0.35)),
        var(--glyph-glow, 0 0 0 rgba(0, 0, 0, 0));
    font-weight: var(--glyph-weight, 600);
    transform-origin: center;
}

@keyframes login-glyph-orbit {
    0% {
        offset-distance: 0%;
        opacity: calc(var(--glyph-opacity, 0.45) * var(--glyph-opacity-mult, 1));
    }
    100% {
        offset-distance: 100%;
        opacity: calc(var(--glyph-opacity, 0.45) * var(--glyph-opacity-mult, 1));
    }
}

.login-glyphs.theme-mono {
    --glyph-shadow: 0 6px 22px rgba(0, 0, 0, 0.38);
    --glyph-glow: 0 0 14px rgba(255, 255, 255, 0.25);
    --glyph-opacity-mult: 1.15;
    --glyph-weight: 650;
}

.login-glyphs.theme-pastel {
    --glyph-shadow: 0 6px 22px rgba(0, 0, 0, 0.32);
    --glyph-opacity-mult: 1.15;
    --glyph-weight: 650;
}

.login-glyphs.theme-rainbow-mix {
    --glyph-shadow: 0 6px 22px rgba(0, 0, 0, 0.32);
    --glyph-opacity-mult: 1.2;
    --glyph-weight: 650;
}

.login-glyphs.theme-mono-mix {
    --glyph-shadow: 0 6px 22px rgba(0, 0, 0, 0.34);
    --glyph-opacity-mult: 1.15;
    --glyph-weight: 650;
}

.simple-login-container.hidden {
    display: none;
}


.login-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 35px;
    width: 100%;
    max-width: 350px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 10;
}

.login-card h2 {
    text-align: center;
    color: #333333;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #999999;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 20px;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-description {
    text-align: center;
    margin-bottom: 30px;
}

.login-description h3 {
    color: #333333;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-description p {
    color: #666666;
    font-size: 14px;
    margin: 0;
}

.google-login-section {
    margin-bottom: 10px;
}

#google-login-button {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.error-message {
    background-color: #ffeeee;
    color: #c53030;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #feb2b2;
}

.dev-login-section {
    margin-top: 30px;
    border-top: 1px solid #eeeeee;
    padding-top: 20px;
    text-align: center;
}

.dev-login-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(45deg, #666666, #888888);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 700;
}

.dev-login-hint {
    font-size: 11px;
    color: #999999;
    margin-top: 8px;
}

@media (max-width: 480px) {
    .simple-login-container {
        padding: 10px;
    }

    .login-card {
        padding: 30px 20px;
        margin: 0;
        max-height: 95vh;
    }

    .login-card h2 {
        font-size: 20px;
    }
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 10px;
    background-color: #ffffff;
    border-bottom: 1px solid #e1e5e9;
    height: 55px;
}

.header-left {
    display: flex;
    align-items: center;
    height: 100%;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 14px;
}

.user-name {
    font-weight: 600;
    color: #333333;
}

.user-email {
    color: #666666;
    font-size: 12px;
}

.logout-btn {
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

#header-logo {
    width: 120px;
    height: auto;
    padding-left: 5px;
    display: block;
}

#body-main {
    display: flex;
    min-height: calc(100vh - 56px);
    align-items: stretch;
}

body.detail-view #body-main {
    height: calc(100vh - 56px);
    overflow: hidden;
}

body.detail-view #left-bar,
body.detail-view #main {
    height: 100%;
    overflow-y: auto;
}

body.detail-view #left-bar {
    background-color: #ffffff;
    border-right-color: #e2e8f0;
}

body.detail-view #sidebar-resizer {
    border-right-color: #e2e8f0;
}

body.resizing {
    cursor: col-resize;
    user-select: none;
}

#header .header-left a {
    display: flex;
    align-items: center;
    height: 100%;
}

@media (max-width: 768px) {
    #header {
        padding: 0 15px;
    }

    .user-info {
        display: none;
    }

    .logout-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

#left-bar {
    width: 240px;
    flex: 0 0 240px;
    min-width: 200px;
    border-right: 0;
    background-color: #ffffff;
    padding-top: var(--spacing-lg);
    min-height: calc(100vh - 56px);
    align-self: stretch;
}

#sidebar-resizer {
    flex: 0 0 6px;
    width: 6px;
    cursor: col-resize;
    background-color: var(--color-panel);
    border-right: 1px solid var(--color-border);
    align-self: stretch;
    position: relative;
}

#sidebar-resizer::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2px;
    width: 2px;
    background-color: transparent;
    transition: background-color 0.2s ease;
}

#sidebar-resizer:hover::before,
#sidebar-resizer.dragging::before {
    background-color: #cbd5e1;
}

#sidebar-nav ul,
#detail-sidebar-nav ul {
    list-style: none;
    padding: 0 10px;
    margin: 0;
}

#sidebar-nav li a,
#detail-sidebar-nav li button {
    display: block;
    padding: var(--spacing-md) var(--spacing-lg);
    text-decoration: none;
    color: var(--color-text);
    transition: background-color 0.2s ease;
    word-break: keep-all;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

#sidebar-nav li:not(.section-header) a,
#detail-sidebar-nav li:not(.section-header) button {
    padding-left: 20px;
}

#sidebar-nav li a:hover,
#detail-sidebar-nav li button:hover {
    background-color: #e9e9e9;
}

#sidebar-nav li a.active,
#detail-sidebar-nav li button.active {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

#sidebar-nav .section-header,
#detail-sidebar-nav .section-header {
    padding: var(--spacing-md) 10px;
    margin-top: var(--spacing-xl);
    margin-bottom: 8px;
}

#sidebar-nav .section-header:first-child,
#detail-sidebar-nav .section-header:first-child {
    margin-top: 0;
}

#sidebar-nav .section-title,
#detail-sidebar-nav .section-title {
    font-weight: 400;
    color: #888;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#detail-sidebar-nav .detail-source-item {
    display: flex;
    align-items: baseline;
    column-gap: 6px;
}

.detail-source-index {
    font-weight: 600;
}

.detail-source-name {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.2;
    margin-left: 4px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#main {
    flex: 1 1 auto;
    min-width: 0;
    background-color: var(--color-background);
}

.section-title-bar,
#main-title {
    font-size: 22px;
    font-weight: 500;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-panel);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.title-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.ghost-btn {
    border: 1px solid #cbd5f5;
    background: #ffffff;
    color: #334155;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
}

.ghost-btn:hover {
    background: #eef2ff;
}

.ghost-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#generation-queue-layout-container,
#generation-cms-queue-layout-container {
    display: block;
    padding: 0;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

.page-body {
    padding: var(--spacing-lg);
    width: 100%;
    margin: 0;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.generation-queue-text {
    font-size: 20px;
    padding-left: 2px;
}

.add-form-btn {
    background-color: var(--color-primary);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}

.add-form-btn:hover {
    background-color: var(--color-primary-hover);
}

.list-toolbar {
    margin-bottom: 12px;
}

#requestSearchInput,
#cmsRequestSearchInput {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid #b3b3b3;
    border-radius: var(--border-radius);
    width: 100%;
    height: 34px;
    font-size: 0.95em;
}

.generation-queue-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.generation-queue-table th {
    padding: 12px 8px;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    text-align: left;
    background: #f8fafc;
}

.generation-queue-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.cms-queue-table th:nth-child(1),
.cms-queue-table td:nth-child(1) {
    width: 16%;
}

.cms-queue-table th:nth-child(2),
.cms-queue-table td:nth-child(2) {
    width: 12%;
}

.cms-queue-table th:nth-child(3),
.cms-queue-table td:nth-child(3) {
    width: 26%;
}

.cms-queue-table th:nth-child(4),
.cms-queue-table td:nth-child(4) {
    width: 12%;
}

.cms-queue-table th:nth-child(5),
.cms-queue-table td:nth-child(5) {
    width: 10%;
}

.cms-queue-table th:nth-child(6),
.cms-queue-table td:nth-child(6) {
    width: 8%;
}

.cms-queue-table th:nth-child(7),
.cms-queue-table td:nth-child(7) {
    width: 16%;
}

.cms-queue-table.image-queue-table th:nth-child(1),
.cms-queue-table.image-queue-table td:nth-child(1) {
    width: 18%;
}

.cms-queue-table.image-queue-table th:nth-child(2),
.cms-queue-table.image-queue-table td:nth-child(2) {
    width: 12%;
}

.cms-queue-table.image-queue-table th:nth-child(3),
.cms-queue-table.image-queue-table td:nth-child(3) {
    width: 26%;
}

.cms-queue-table.image-queue-table th:nth-child(4),
.cms-queue-table.image-queue-table td:nth-child(4) {
    width: 16%;
}

.cms-queue-table.image-queue-table th:nth-child(5),
.cms-queue-table.image-queue-table td:nth-child(5) {
    width: 8%;
}

.cms-queue-table.image-queue-table th:nth-child(6),
.cms-queue-table.image-queue-table td:nth-child(6) {
    width: 20%;
}

.variant-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.variant-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid #e2e8f0;
    color: #475569;
    background: #f8fafc;
    text-transform: uppercase;
}

.variant-pill.is-empty {
    color: #94a3b8;
    border-color: #e2e8f0;
    background: #f8fafc;
}


.cms-module-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: #475569;
    line-height: 1.2;
}

.requester-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.requester-name {
    font-weight: 600;
    color: #1f2937;
}

.requester-email {
    font-size: 12px;
    color: #6b7280;
}

.requester-empty {
    color: #9ca3af;
}

.cms-module-item {
    display: inline-flex;
    align-items: center;
}

.cms-module-item.empty {
    color: var(--color-muted);
}

.cms-module-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    color: #1f2937;
    border-radius: 6px;
    border: 1px solid #d4d8e1;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.cms-module-link.is-study-activity {
    color: #0f4a6d;
    background: linear-gradient(180deg, #e6f8f4 0%, #d5f2ea 100%);
    border-color: #bfe6dc;
}

.cms-module-link.is-module {
    color: #3730a3;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: #c7d2fe;
}

.cms-module-link:hover {
    transform: translateY(-1px);
    border-color: #a8b3c5;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.request-row {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.request-row:hover {
    background-color: #f3f4f6;
}

.request-row.selected {
    background-color: #def3e9;
}

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

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #e2e8f0;
    color: #334155;
}

.status-chip.status-failed {
    background: #fee2e2;
    color: #b91c1c;
}

.status-chip.status-verified,
.status-chip.status-finished {
    background: #dcfce7;
    color: #15803d;
}

.status-chip.status-processing {
    background: #fef3c7;
    color: #b45309;
}

.status-chip.status-retry,
.status-chip.status-retry_queued {
    background: #fde68a;
    color: #b45309;
}

.status-chip.status-queued {
    background: #e5e7eb;
    color: #4b5563;
}

.status-chip.status-uploading {
    background: #e0f2fe;
    color: #0369a1;
}

.status-chip.status-preparing {
    background: #e0e7ff;
    color: #3730a3;
}

.monitoring-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

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

.summary-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    background: #ffffff;
}

.summary-card.summary-processing {
    border-color: #fde68a;
    background: #fffbeb;
}

.summary-card.summary-retry,
.summary-card.summary-retry_queued {
    border-color: #fecaca;
    background: #fef2f2;
}

.summary-card.summary-failed {
    border-color: #fecaca;
    background: #fff1f2;
}

.summary-card.summary-queued {
    border-color: #e5e7eb;
    background: #f8fafc;
}

.summary-card.summary-verified,
.summary-card.summary-finished {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.summary-label {
    font-size: 12px;
    color: var(--color-muted);
}

.summary-value {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-top: 2px;
}

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

.stage-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.stage-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
}

.stage-chip.is-empty {
    opacity: 0.4;
}

.stage-chip.stage-generate {
    background: #e0f2fe;
    color: #0369a1;
}

.stage-chip.stage-parsed {
    background: #ecfeff;
    color: #0e7490;
}

.stage-chip.stage-math_check {
    background: #fef3c7;
    color: #b45309;
}

.stage-chip.stage-latex {
    background: #dbeafe;
    color: #1d4ed8;
}

.stage-chip.stage-render {
    background: #dcfce7;
    color: #15803d;
}

.stage-chip.stage-image_verify {
    background: #fce7f3;
    color: #be185d;
}

.monitoring-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.monitoring-range {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.monitoring-range label {
    font-size: 12px;
    color: var(--color-muted);
}

.monitoring-range input[type="date"] {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    background: #ffffff;
}

.monitoring-range-sep {
    font-size: 12px;
    color: var(--color-muted);
}

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

.monitoring-panel {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    background: #ffffff;
}

.monitoring-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.monitoring-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.monitoring-table th,
.monitoring-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.monitoring-table th {
    text-align: left;
    font-size: 11px;
    color: var(--color-muted);
    font-weight: 600;
}

.monitoring-table td.numeric,
.monitoring-table th.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.summary-note {
    font-size: 12px;
    color: var(--color-muted);
}

.cell-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.cell-sub {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 2px;
}

.request-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.request-progress-bar {
    width: 120px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.request-progress-bar span {
    display: block;
    height: 100%;
    background: #3b82f6;
    border-radius: 999px;
}

.request-progress-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    min-width: 36px;
    text-align: right;
}

.progress-empty {
    color: var(--color-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    gap: var(--spacing-sm);
}

.page-button {
    width: 36px;
    height: 32px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    color: #777;
    border: 1px solid #b3b3b3;
    border-radius: 6px;
    cursor: pointer;
}

.page-button:hover {
    background-color: #e5e7eb;
}

.page-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Side sheet */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: flex-end;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-side-sheet {
    position: relative;
    width: 50%;
    min-width: 420px;
    height: 100%;
    background-color: #f8f8f8;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
    border-radius: 5px 0 0 5px;
}

.modal-backdrop.closing {
    animation: fadeOut 0.3s ease-in forwards;
}

.modal-side-sheet.closing {
    animation: slideOut 0.3s ease-in forwards;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close-btn:hover {
    background-color: #f0f0f0;
}

.modal-content {
    padding: 24px;
}

.regen-modal-backdrop {
    justify-content: center;
    align-items: center;
}

.regen-modal {
    width: min(520px, 92vw);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.regen-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #e5e7eb;
}

.regen-modal-header .modal-close-btn {
    position: static;
    width: 28px;
    height: 28px;
}

.regen-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.regen-modal-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

.regen-modal-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.regen-modal-label {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.regen-modal-textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid #d7dde4;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
}

.regen-modal-textarea:focus {
    outline: none;
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.2);
}

.regen-modal-hint {
    font-size: 12px;
    color: #94a3b8;
}

.regen-modal-error {
    font-size: 12px;
    color: #b91c1c;
    display: none;
}

.regen-modal-error.is-visible {
    display: block;
}

.regen-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 18px;
    border-top: 1px solid #e5e7eb;
    gap: 12px;
}

.regen-modal-counter {
    font-size: 12px;
    color: #94a3b8;
}

.regen-modal-actions {
    display: flex;
    gap: 8px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideOut {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

@media (max-width: 900px) {
    .modal-side-sheet {
        width: 100%;
        min-width: unset;
    }
}

.image-editor-backdrop {
    justify-content: center;
    align-items: center;
}

.image-editor-modal {
    width: min(1600px, 97vw);
    height: 97vh;
    max-height: 97vh;
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.image-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.image-editor-header .modal-close-btn {
    position: static;
    width: 28px;
    height: 28px;
}

.image-editor-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.image-editor-body {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 0.75fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 16px;
    padding: 20px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
}

.image-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.image-editor-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.image-editor-preview-modes {
    display: inline-flex;
    gap: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 2px;
    background: #f8fafc;
}

.image-editor-preview-mode {
    border: none;
    background: transparent;
    padding: 4px 10px;
    font-size: 11px;
    color: #475569;
    border-radius: 999px;
    cursor: pointer;
}

.image-editor-preview-mode.is-active {
    background: #ffffff;
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.image-editor-panel-ai {
    min-width: 220px;
}

.image-editor-panel-ai .image-editor-ai {
    flex: 1 1 auto;
    min-height: 0;
}

.image-editor-ai-output {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
    padding: 8px;
}

.image-editor-ai-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-editor-ai-entry {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-editor-ai-entry-actions {
    display: flex;
    justify-content: flex-end;
}

.image-editor-ai-user {
    align-self: flex-end;
    background: #e2e8f0;
    color: #0f172a;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    max-width: 85%;
}

.image-editor-ai-image {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
    overflow: auto;
    min-height: 180px;
}

.image-editor-ai-image img,
.image-editor-ai-image svg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.image-editor-ai-footer {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: auto;
}

.image-editor-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.image-editor-preview {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 12px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 360px;
    height: 100%;
}

.image-editor-code.hidden {
    display: none;
}

.image-editor-code-diff {
    width: 100%;
    min-height: 0;
    height: 100%;
    flex: 1 1 auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    padding: 10px;
    overflow: auto;
}

.image-editor-code-diff.hidden {
    display: none;
}

.image-editor-code-diff .diff-line {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 2px 0;
    white-space: pre;
}

.image-editor-code-diff .diff-line.add {
    background: #ecfdf3;
    color: #166534;
}

.image-editor-code-diff .diff-line.delete {
    background: #fef2f2;
    color: #991b1b;
}

.image-editor-code-diff .diff-line.context {
    color: #374151;
}

.image-editor-code-diff .diff-marker {
    text-align: center;
    color: #94a3b8;
}

.image-editor-diff-empty {
    font-size: 12px;
    color: #94a3b8;
}

.image-editor-preview img {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-editor-preview svg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.image-editor-preview .tikz-marker {
    display: none;
}

.image-editor-preview g.code-group {
    cursor: pointer;
    transition: filter 0.2s ease;
}

.image-editor-preview g.code-group.active path,
.image-editor-preview g.code-group.active text,
.image-editor-preview g.code-group.active rect,
.image-editor-preview g.code-group.active circle,
.image-editor-preview g.code-group.active ellipse,
.image-editor-preview g.code-group.active line,
.image-editor-preview g.code-group.active polyline,
.image-editor-preview g.code-group.active polygon,
.image-editor-preview g.code-group.active use {
    stroke: #f97316 !important;
    stroke-width: 2px !important;
    stroke-opacity: 0.9 !important;
    filter: drop-shadow(0px 0px 3px rgba(249, 115, 22, 0.8));
}

.image-editor-placeholder {
    font-size: 12px;
    color: #94a3b8;
}

.image-editor-code {
    width: 100%;
    min-height: 0;
    height: 100%;
    flex: 1 1 auto;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    font-size: 13px;
    line-height: 1.4;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    resize: vertical;
}

.image-editor-code.ace_editor {
    padding: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    background: #ffffff;
    resize: none;
}

.image-editor-code.ace_editor,
.image-editor-code.ace_editor * {
    box-sizing: content-box;
}

.image-editor-code.ace_editor,
.image-editor-code.ace_editor .ace_content,
.image-editor-code.ace_editor .ace_layer,
.image-editor-code.ace_editor .ace_gutter,
.image-editor-code.ace_editor .ace_scroller,
.image-editor-code.ace_editor .ace_text-layer {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
    letter-spacing: 0;
}

.image-editor-ai {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-editor-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.image-editor-ai-status {
    font-size: 12px;
    color: #64748b;
}

.image-editor-ai-quota {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}

.image-editor-ai-input-wrap {
    position: relative;
}

.image-editor-ai-send {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.image-editor-ai-send:hover {
    background: #eef2ff;
    border-color: #cbd5f5;
    color: #1e3a8a;
}

.image-editor-ai-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.image-editor-ai-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0;
}

.image-editor-ai-input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 44px 10px 12px;
    font-size: 13px;
    resize: vertical;
    background: #f8fafc;
}

.image-editor-ai-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
}

.image-editor-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #64748b;
}

.image-editor-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.image-editor-status-label {
    font-size: 11px;
    color: #94a3b8;
}

.image-editor-status-value {
    font-weight: 600;
    color: #334155;
}

.image-editor-status-value[data-status]::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    background: #cbd5f5;
}

.image-editor-status-value[data-status="complete"]::before {
    background: #22c55e;
}

.image-editor-status-value[data-status="loading"]::before {
    background: #06b6d4;
}

.image-editor-status-value[data-status="needs"]::before {
    background: #f59e0b;
}

.image-editor-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-editor-action {
    display: flex;
    align-items: center;
    gap: 8px;
}


@media (max-width: 900px) {
    .image-editor-body {
        grid-template-columns: 1fr;
    }
}

/* Sheet content */
.sheet-header {
    margin-bottom: var(--spacing-lg);
}

.sheet-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 6px;
}

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

.sheet-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: var(--spacing-md);
}

.sheet-tab {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

.sheet-tab.active {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0369a1;
    font-weight: 600;
}

.sheet-panel {
    display: none;
}

.sheet-panel.active {
    display: block;
}

.form-section {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: #ffffff;
    border-radius: var(--border-radius);
    border: 1px solid #e5e7eb;
}

.form-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-label-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.info-pill {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    position: relative;
    vertical-align: middle;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.info-pill:hover {
    border-color: #94a3b8;
    color: #334155;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.info-pill::after {
    display: none;
}

.info-tooltip {
    position: fixed;
    z-index: 2000;
    background: #1f2937;
    color: #f8fafc;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: normal;
    max-width: min(260px, 80vw);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.15);
}

.info-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.form-section .cms-activity-row {
    margin: 0;
    display: grid;
    font-weight: 500;
}

.form-section input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
}

.form-section input[type="text"]::placeholder {
    color: #94a3b8;
}

.form-section input[type="text"]:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.file-list {
    margin-top: 10px;
    font-size: 13px;
    color: var(--color-muted);
}

.file-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.cms-activity-batches {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cms-module-card {
    margin-top: 0;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cms-module-card[hidden] {
    display: none;
}

.cms-module-card.is-empty {
    border-color: #e2e8f0;
}

.cms-module-card.is-partial {
    border-color: #a7d8a7;
}

.cms-module-card.is-all {
    border-color: #b7ddb7;
}

.cms-module-summary {
    margin-top: 0;
    display: grid;
    gap: 12px;
}

.cms-summary-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-size: 14px;
    color: #475569;
}

.cms-summary-label-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cms-summary-value {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.cms-module-card-title {
    font-size: 12px;
    color: #64748b;
}

.cms-module-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.cms-module-remove {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.cms-module-remove:hover {
    border-color: #cbd5e1;
    color: #1f2937;
}

.cms-batch {
    border: none;
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cms-batch-header {
    width: 100%;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    user-select: none;
    border: 1px solid #e2e8f0;
    background: transparent;
}

.cms-batch-header:hover {
    background: transparent;
}

.cms-batch-header.is-collapsed {
    border-radius: 10px;
}

.cms-batch-header.is-expanded {
    border-radius: 10px 10px 0 0;
}

.cms-batch-select {
    margin: 0;
    width: 20px;
    height: 20px;
}

.cms-batch-select,
.cms-activity-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background: #ffffff;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.cms-batch-select::after,
.cms-activity-row input[type="checkbox"]::after {
    content: "";
    width: 6px;
    height: 10px;
    border-right: 2px solid transparent;
    border-bottom: 2px solid transparent;
    transform: translateY(-2px) rotate(45deg);
}

.cms-batch-select:checked,
.cms-activity-row input[type="checkbox"]:checked {
    background: #6cbd6c;
    border-color: #6cbd6c;
}

.cms-batch-select:checked::after,
.cms-activity-row input[type="checkbox"]:checked::after {
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.cms-batch-select:indeterminate {
    background: #a8d5a8;
    border-color: #6fbe6f;
}

.cms-batch-select:indeterminate::after {
    width: 10px;
    height: 0;
    border-right: 0;
    border-bottom: 2px solid #ffffff;
    transform: translateY(0);
}

.cms-batch-select:focus-visible,
.cms-activity-row input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(108, 189, 108, 0.4);
    outline-offset: 2px;
}

.cms-batch-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.cms-batch-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cms-batch-count {
    font-size: 12px;
    color: #475569;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 2px 8px;
    font-weight: 600;
    white-space: nowrap;
}

.cms-batch-state {
    font-size: 14px;
    color: #475569;
    font-weight: 700;
    margin-left: auto;
}

.cms-batch-remove {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.cms-batch-remove:hover {
    border-color: #cbd5e1;
    color: #1f2937;
}

.cms-batch-header.is-empty {
    border-color: #e2e8f0;
    color: #475569;
}

.cms-batch-header.is-empty:hover {
    background: transparent;
}

.cms-batch-header.is-partial {
    border-color: #a7d8a7;
    color: #2f5f2f;
}

.cms-batch-header.is-partial:hover {
    background: transparent;
}

.cms-batch-header.is-all {
    border-color: #b7ddb7;
    color: #1f4d1f;
}

.cms-batch-header.is-all:hover {
    background: transparent;
}

.cms-batch-header.is-empty .cms-batch-count {
    border-color: #d1d5db;
    color: #475569;
}

.cms-batch-header.is-partial .cms-batch-count {
    border-color: #94c894;
    color: #2f5f2f;
}

.cms-batch-header.is-all .cms-batch-count {
    border-color: #6fbe6f;
    color: #1f4d1f;
}

.cms-batch-body {
    padding: 0 14px;
    display: grid;
    gap: 0;
    border: none;
}

.cms-batch-body[hidden] {
    display: none;
}

.cms-activity-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px 6px;
    cursor: pointer;
    min-height: 44px;
    margin-bottom: 0;
}

.cms-activity-row:not(:last-child) {
    border-bottom: 1px solid #edf2f7;
}

.cms-activity-row input {
    margin-top: 0;
    width: 20px;
    height: 20px;
}

.cms-activity-title {
    font-size: 14px;
    color: #111827;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.cms-activity-row:hover {
    background: #f8fafc;
}

.primary-btn {
    background-color: var(--color-primary);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.primary-btn:hover {
    background-color: var(--color-primary-hover);
}

.primary-btn:disabled,
.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    border: 1px solid #cbd5f5;
    background: #ffffff;
    color: #334155;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
}

.detail-section {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: #ffffff;
    border-radius: var(--border-radius);
    border: 1px solid #e5e7eb;
    width: 100%;
}

.detail-section h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    letter-spacing: 0.3px;
}

.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.detail-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-section-header h3 {
    margin: 0;
}

.retry-all-btn {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

.retry-all-btn:hover {
    background: #fee2e2;
}

.detail-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-bottom: var(--spacing-md);
}

.detail-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-column .detail-section {
    margin-bottom: 0;
}

.variant-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
}

.variant-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.variant-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--variant-accent, #e5e7eb);
    border-radius: 8px 8px 0 0;
}

.variant-card[data-variant="easy"] {
    --variant-accent: #22c55e;
    --variant-tint: rgba(34, 197, 94, 0.18);
    --variant-border: rgba(34, 197, 94, 0.35);
}

.variant-card[data-variant="twin"] {
    --variant-accent: #3b82f6;
    --variant-tint: rgba(59, 130, 246, 0.18);
    --variant-border: rgba(59, 130, 246, 0.35);
}

.variant-card[data-variant="similar"] {
    --variant-accent: #f59e0b;
    --variant-tint: rgba(245, 158, 11, 0.18);
    --variant-border: rgba(245, 158, 11, 0.35);
}

.variant-card[data-variant="hard"] {
    --variant-accent: #ef4444;
    --variant-tint: rgba(239, 68, 68, 0.18);
    --variant-border: rgba(239, 68, 68, 0.35);
}

.variant-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.variant-card-header h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    letter-spacing: 0.2px;
    line-height: 1.2;
    background: var(--variant-tint, #f8fafc);
    border-radius: 6px;
    padding: 4px 12px;
    border: 1px solid var(--variant-border, rgba(148, 163, 184, 0.35));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}


.intent-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f8fafc;
    border-radius: 6px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
}

.intent-label {
    font-size: 13px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.intent-text {
    font-size: 14px;
    color: #1f2937;
}

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

.variant-column {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    background: #ffffff;
}

.variant-column.mathjax-process {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: inset 0 0 0 1px #f1f5f9;
}

.variant-column-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.variant-badge {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.variant-card.is-published .variant-badge {
    background: #dcfce7;
    color: #15803d;
}

.variant-card .action-row {
    margin-top: 4px;
}

.variant-card .action-row {
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.variant-card .action-left,
.variant-card .action-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.variant-card .action-left {
    margin-right: auto;
}

.variant-card .action-right .secondary-btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: var(--border-radius);
}

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

.pipeline-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cms-upload-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}

.cms-upload-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cms-upload-progress-meta {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    white-space: nowrap;
}

.cms-upload-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px;
}

.cms-upload-row {
    display: grid;
    grid-template-columns: 17% 18% 31% 34%;
    gap: 10px;
    align-items: center;
    color: #475569;
    padding: 6px 8px;
    border-radius: 8px;
}

.cms-upload-row.cms-upload-header {
    font-weight: 700;
    color: #111827;
    font-size: 14px;
    background: #eef2f7;
}

.cms-upload-row.cms-upload-actions-row {
    margin-top: 6px;
    color: inherit;
    background: transparent;
    padding: 2px 8px 0;
}

.cms-upload-row:not(.cms-upload-header):not(.cms-upload-actions-row) {
    background: #ffffff;
}

.cms-upload-cell {
    min-width: 0;
}

.cms-upload-status-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.cms-upload-action-cell {
    display: flex;
    align-items: center;
}

.cms-upload-variant {
    font-weight: 700;
    color: #111827;
}

.cms-upload-status {
    font-size: 14px;
    font-weight: 600;
}

.cms-upload-status.is-uploaded {
    color: #15803d;
}

.cms-upload-status.is-published {
    color: #0f766e;
}

.cms-upload-status.is-uploading {
    color: #2563eb;
}

.cms-upload-status.is-failed {
    color: #b91c1c;
}

.cms-upload-status.is-unpublished {
    color: #b45309;
}

.cms-upload-status.is-pending {
    color: #6b7280;
}

.pipeline-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pipeline-summary-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.pipeline-bar {
    width: 220px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.pipeline-bar span {
    display: block;
    height: 100%;
    background: #3b82f6;
    border-radius: 999px;
}

.pipeline-progress-text {
    font-size: 12px;
    color: var(--color-muted);
    font-weight: 600;
}

.pipeline-current {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

.pipeline-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pipeline-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    background: #f8fafc;
}

.pipeline-actions {
    margin-left: auto;
}

.pipeline-index {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pipeline-info {
    display: grid;
    grid-template-columns: minmax(70px, 1fr) 75px;
    align-items: center;
    column-gap: 12px;
}

.pipeline-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pipeline-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

.pipeline-state {
    font-size: 11px;
    color: #6b7280;
}

.pipeline-time {
    font-size: 11px;
    color: #9ca3af;
    text-align: left;
}

.pipeline-item.is-complete {
    border-color: #93c5fd;
    background: #eff6ff;
}

.pipeline-item.is-complete .pipeline-index {
    background: #3b82f6;
    color: #ffffff;
}

.pipeline-item.is-active {
    border-color: #22d3ee;
    background: #ecfeff;
    box-shadow: 0 6px 12px rgba(6, 182, 212, 0.12);
}

.pipeline-item.is-active .pipeline-index {
    background: #06b6d4;
    color: #ffffff;
}

.pipeline-item.is-partial {
    border-color: #22d3ee;
    background: #ecfeff;
}

.pipeline-item.is-partial .pipeline-index {
    background: #06b6d4;
    color: #ffffff;
}

.pipeline-item.is-failed {
    border-color: #fca5a5;
    background: #fef2f2;
}

.pipeline-item.is-failed .pipeline-index {
    background: #dc2626;
    color: #ffffff;
}

@media (max-width: 1200px) {
    .detail-top-grid {
        grid-template-columns: 1fr;
    }

    .pipeline-list {
        flex-direction: column;
    }
}

@media (max-width: 900px) {
    .pipeline-bar {
        width: 160px;
    }

    .variant-compare {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .pipeline-list {
        flex-direction: column;
    }
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.prompt-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.prompt-nav {
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    padding: 12px;
}

.prompt-nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prompt-nav-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #0f172a;
    padding: 2px 0 4px;
    margin-bottom: 2px;
}

.prompt-nav-item {
    text-align: left;
    border-radius: 8px;
    padding: 8px 10px;
    border: 1px solid transparent;
    background: #ffffff;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.prompt-nav-item:hover {
    border-color: #cbd5f5;
    background: #e2e8f0;
    color: #0f172a;
}

.prompt-nav-item.is-active {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
    box-shadow: none;
}

.prompt-panels {
    min-width: 0;
}

.prompt-panel {
    display: none;
}

.prompt-panel.is-active {
    display: block;
}

@media (max-width: 900px) {
    .prompt-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .prompt-nav {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .prompt-nav-group {
        min-width: 160px;
    }
}

.prompt-template-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.prompt-template-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.form-field input,
.form-field select,
.form-field textarea,
.prompt-template-field textarea {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5f5;
    font-size: 13px;
    line-height: 1.5;
}

.form-field textarea,
.prompt-template-field textarea {
    resize: vertical;
}

.prompt-token {
    color: #d97706;
    background: #fef3c7;
    font-weight: 700;
    border-radius: 3px;
    padding: 0 2px;
}

.prompt-token-guide {
    border: 1px dashed #cbd5f5;
    border-radius: 8px;
    background: #f8fafc;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-token-guide-title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
}

.prompt-token-guide-list {
    display: grid;
    gap: 6px;
}

.prompt-token-guide-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #334155;
}

.prompt-token-guide-text {
    line-height: 1.4;
}

.prompt-textarea-wrap {
    position: relative;
    width: 100%;
    --prompt-textarea-line-height: 20px;
}

.prompt-textarea-highlight {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 8px 10px;
    box-sizing: border-box;
    font-size: 13px;
    font-family: inherit;
    line-height: var(--prompt-textarea-line-height);
    font-weight: 400;
    letter-spacing: normal;
    color: #111827;
    border: 1px solid transparent;
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
    overflow: auto;
    scrollbar-width: none;
    display: none;
}

.prompt-textarea-highlight::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.prompt-textarea-wrap textarea {
    position: relative;
    z-index: 1;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
    line-height: var(--prompt-textarea-line-height);
    font-weight: 400;
    letter-spacing: normal;
}

.prompt-textarea-wrap textarea::placeholder {
    color: #94a3b8;
}

.prompt-textarea-wrap.is-highlight .prompt-textarea-highlight {
    display: block;
}

.prompt-textarea-wrap.is-highlight textarea {
    background: transparent;
    color: transparent;
    caret-color: #111827;
}

.prompt-form textarea[id^="promptOutput-"] {
    background: #f8fafc;
    border-color: #94a3b8;
}

.prompt-form textarea[id^="promptOutput-"]::placeholder {
    color: #6b7280;
}

@media (max-width: 760px) {
    .prompt-template-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

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

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

details summary {
    cursor: pointer;
    font-size: 12px;
    color: #1f2937;
}

details pre {
    margin: 8px 0 0;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    white-space: pre-wrap;
    font-size: 12px;
}

.prompt-stage-group {
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: var(--spacing-lg);
}

.prompt-stage-group:last-child {
    border-bottom: none;
}

.prompt-form {
    display: none;
}

.prompt-form.is-open {
    display: block;
}

.prompt-row-active {
    background-color: #f0fdf4;
}

.prompt-row {
    cursor: pointer;
}

.prompt-row:hover {
    background-color: #f8fafc;
}

.prompt-row-active:hover {
    background-color: #dcfce7;
}

.prompt-row.is-expanded {
    background-color: #eef2ff;
}

.prompt-detail-row {
    display: none;
}

.prompt-detail-row.is-open {
    display: table-row;
}

.prompt-detail {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.prompt-detail pre {
    margin: 0;
    white-space: pre-wrap;
}

.prompt-detail-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prompt-detail-section {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px;
    background: #ffffff;
}

.prompt-detail-section.is-output {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.prompt-detail-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.02em;
}

.prompt-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.prompt-copy-btn {
    padding: 4px 10px;
    font-size: 11px;
    border-color: #d1d5db;
}

.prompt-copy-btn:hover {
    background: #eef2ff;
}

.prompt-preview {
    color: #374151;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    font-size: 13px;
}

.detail-item span {
    color: var(--color-muted);
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.source-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.detail-source-grid {
    --detail-source-image-height: 360px;
}

.source-size-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

.source-size-controls label {
    font-weight: 600;
    color: #334155;
}

.source-size-controls input[type="range"] {
    width: 140px;
}

.source-size-value {
    min-width: 48px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #475569;
}

.source-card {
    border: none;
    border-radius: 0;
    padding: 0;
    background: transparent;
}

.source-card h4 {
    margin: 0 0 8px;
    font-size: 14px;
}

.preview-image {
    width: 100%;
    height: 360px;
    object-fit: contain;
    object-position: left center;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.detail-source-grid .preview-image {
    height: var(--detail-source-image-height);
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.prompt-table {
    table-layout: fixed;
}

.prompt-table th:nth-child(1),
.prompt-table td:nth-child(1) {
    width: 10%;
}

.prompt-table th:nth-child(2),
.prompt-table td:nth-child(2) {
    width: 16%;
}

.prompt-table th:nth-child(3),
.prompt-table td:nth-child(3) {
    width: 12%;
}

.prompt-table th:nth-child(4),
.prompt-table td:nth-child(4) {
    width: 32%;
}

.prompt-table th:nth-child(5),
.prompt-table td:nth-child(5) {
    width: 20%;
}

.prompt-table th:nth-child(6),
.prompt-table td:nth-child(6) {
    width: 10%;
}

.prompt-table th:nth-child(4),
.prompt-table td:nth-child(4) {
    padding-left: 6px;
}

.prompt-table th:nth-child(5),
.prompt-table td:nth-child(5) {
    padding-left: 6px;
}

.prompt-table th:nth-child(6),
.prompt-table td:nth-child(6) {
    padding-left: 6px;
}

@media (max-width: 760px) {
    .prompt-detail {
        grid-template-columns: minmax(0, 1fr);
    }
}

.task-table th,
.task-table td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: top;
}

.task-table th {
    background: #f8fafc;
}

.task-table tbody tr:hover {
    background: #f9fafb;
}

.task-table tbody tr.prompt-row:hover {
    background: #f8fafc;
}

.task-table tbody tr.prompt-row-active:hover {
    background: #dcfce7;
}

.selector-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.selector-row select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5f5;
}

.variant-option-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.variant-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

.variant-option input {
    accent-color: #3b82f6;
}

.variant-tabs {
    display: flex;
    gap: 6px;
}

.variant-tab {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #cbd5f5;
    background: #ffffff;
    cursor: pointer;
    font-size: 12px;
}

.variant-tab.active {
    background: #e0f2fe;
    border-color: #38bdf8;
    color: #0c4a6e;
    font-weight: 600;
}

.content-block {
    margin-bottom: 10px;
}

.multi-block {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.multi-block-label {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #1e293b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-bottom: 8px;
}

.stem-block {
    margin-bottom: 16px;
}

.subquestion-block {
    margin-top: 16px;
}

.stem-block + .subquestion-block {
    margin-top: 12px;
}

.content-block h4 {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.3px;
}

.content-text {
    white-space: pre-wrap;
    background: #f8fafc;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 15px;
}

.content-text.raw-text {
    background: #f1f5f9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
}

.raw-input {
    width: 100%;
    min-height: 120px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    font-size: 14px;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    resize: vertical;
}

.raw-input-answer {
    min-height: 0;
    height: auto;
    overflow: hidden;
    resize: none;
}

.raw-input-auto {
    overflow: hidden;
    resize: none;
}

.multi-block .raw-input-auto[data-field="question"],
.multi-block .raw-input-auto[data-field="explanation"] {
    min-height: 0;
}

.choices-editor {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.choices-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.choice-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.choice-label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    flex: 0 0 28px;
    text-align: center;
}

.choice-remove {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 13px;
    cursor: pointer;
    color: #475569;
    flex: 0 0 auto;
}

.choice-remove:hover {
    border-color: #cbd5f5;
    color: #1e293b;
}

.choice-input {
    flex: 1 1 auto;
    width: 100%;
    min-height: 36px;
    height: 36px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 14px;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    resize: vertical;
}

.choice-item-rendered .choice-label {
    background: #ffffff;
}

.choice-item-rendered.is-correct .choice-label {
    color: #3f6f3f;
}

.choice-text {
    flex: 1 1 auto;
    min-height: 36px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.choice-item-rendered.is-correct .choice-text {
    background: #e7f6ef;
    border-color: #cfe6d9;
}

.typeset-pending {
    visibility: hidden;
}

.rendered-staging {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
    pointer-events: none;
}

.choices-rendered {
    width: 100%;
}

.choice-empty {
    font-size: 14px;
    color: #94a3b8;
}

.choice-actions {
    display: flex;
    gap: 8px;
}

.inline-image-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 8px 0;
}

.inline-image {
    display: block;
    max-width: 320px;
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.inline-image-edit-btn {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.2;
}

.image-placeholder {
    color: #ef4444;
    font-weight: 600;
}

.image-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.image-row img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.image-list {
    --image-item-thumb-height: 220px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.image-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
    min-height: calc(var(--image-item-thumb-height) + 40px);
}

.image-item-add {
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    color: #64748b;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

.image-item-add:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #334155;
}

.image-item-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.image-item-add-label {
    font-size: 12px;
    font-weight: 600;
}

.image-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.image-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.image-label {
    font-size: 11px;
    color: #475569;
    font-weight: 600;
}

.image-edit-btn {
    padding: 2px 8px;
    font-size: 11px;
}

.image-delete-btn {
    padding: 2px 8px;
    font-size: 11px;
    border-color: #fecaca;
    color: #b91c1c;
    background: #ffffff;
}

.image-delete-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.image-thumb {
    width: 100%;
    height: var(--image-item-thumb-height);
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.image-item .image-placeholder {
    min-height: var(--image-item-thumb-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-empty {
    font-size: 12px;
    color: #94a3b8;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--color-muted);
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-section .action-row {
    margin-top: 8px;
}

.alert-text {
    color: var(--color-error);
    font-size: 12px;
}
