body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 20px;
    background: #f5f5f5;
    --toolbar-height: 56px;
}

h1 {
    text-align: center;
    color: #333;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    table-layout: auto;
}

th, td {
    border: 1px solid #e0e0e0;
    padding: 8px;
    text-align: center;
    vertical-align: top;
    font-size: 12px;
}

th {
    background: #fafafa;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    position: sticky;
    top: var(--toolbar-height);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

img {
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

.action-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 2px;
    font-size: 12px;
    min-width: 60px;
}

a.action-btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
}

/* Shrink action buttons outside the SKU column by roughly half. */
td:not(.sku-cell) .action-btn {
    padding: 2px 5px;
    border-radius: 2px;
    margin: 1px;
    font-size: 10px;
    min-width: 30px;
}

.btn-blue {
    background: #1890ff;
    color: white;
}

.btn-blue:hover {
    background: #40a9ff;
}

.btn-gray {
    background: #d9d9d9;
    color: #666;
    cursor: not-allowed;
}

.btn-red {
    background: #ff4d4f;
    color: white;
}

.btn-red:hover {
    background: #ff7875;
}

.direction-display {
    width: 120px;
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
    padding: 4px;
    font-size: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fafafa;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-all;
    display: block;
    margin: 0 auto 4px;
}

.direction-textarea {
    width: 120px;
    height: 60px;
    resize: vertical;
    padding: 4px;
    font-size: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    display: block;
    margin: 0 auto 4px;
}

.toolbar {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f5f5f5;
    padding: 10px 0;
    height: var(--toolbar-height);
    box-sizing: border-box;
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 13px;
    color: #333;
}

.toolbar-filters label {
    margin-left: 8px;
}

.toolbar-filters select {
    padding: 4px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
}

.select-page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.selected-count {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

.batch-count {
    margin: 8px 0 0;
    font-size: 12px;
    color: #666;
    text-align: right;
}

.batch-count-limit {
    color: #ff4d4f;
    font-weight: 600;
}

.filter-result-count {
    margin: -8px 0 12px;
    font-size: 12px;
    color: #666;
    text-align: right;
    position: sticky;
    top: var(--toolbar-height);
    z-index: 15;
    background: #f5f5f5;
    padding: 4px 0;
}

.direction-modal-field {
    margin: 0 0 12px;
    font-size: 13px;
    color: #333;
}

.direction-modal-field label {
    margin-right: 6px;
}

.direction-modal-field select {
    padding: 4px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
}

.btn-create {
    padding: 8px 20px;
    background: #52c41a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-create:hover {
    background: #73d13d;
}

.btn-create:disabled {
    background: #d9d9d9;
    color: #999;
    cursor: not-allowed;
}

.btn-create:disabled:hover {
    background: #d9d9d9;
}

.btn-danger {
    background: #ff4d4f;
}

.btn-danger:hover {
    background: #ff7875;
}

.highlight-new-row {
    background-color: #e6f7ff;
}

.cell-image a {
    display: inline-block;
    text-decoration: none;
}

.cell-image a:hover {
    opacity: 0.8;
}

#hover-preview {
    display: none;
    position: fixed;
    z-index: 1000;
    max-width: 600px;
    max-height: 600px;
    border: 2px solid #1890ff;
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #cccccc 25%, transparent 25%, transparent 75%, #cccccc 75%, #cccccc),
        linear-gradient(45deg, #cccccc 25%, transparent 25%, transparent 75%, #cccccc 75%, #cccccc);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
}

#hover-preview img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Lock toggle */
.sku-cell {
    min-width: 80px;
}

.lock-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 6px 0;
    gap: 6px;
}

.product-type-label {
    display: inline-block;
    margin: 2px 0;
    padding: 1px 6px;
    font-size: 10px;
    color: #555;
    background: #e9ecef;
    border-radius: 4px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #1890ff;
}

input:checked + .slider:before {
    transform: translateX(16px);
}

.lock-label {
    font-size: 12px;
    color: #666;
}

/* Row locked state */
.row-locked .action-btn:not([data-action="copy"]):not([data-action="download"]):not([data-action="download-manuscript"]):not(.lock-checkbox):not(.lock-toggle *) {
    background: #d9d9d9 !important;
    color: #666 !important;
    cursor: not-allowed !important;
}

.row-locked .action-btn:not([data-action="copy"]):not([data-action="download"]):not([data-action="download-manuscript"]) {
    pointer-events: none;
}

.row-locked .direction-textarea {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.production-bg {
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #cccccc 25%, transparent 25%, transparent 75%, #cccccc 75%, #cccccc),
        linear-gradient(45deg, #cccccc 25%, transparent 25%, transparent 75%, #cccccc 75%, #cccccc);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    color: #333333;
    min-height: 120px;
}

.production-bg a,
.production-bg img {
    display: inline-block;
}

.production-bg .cell-image:empty,
.production-bg div:empty {
    background-color: #000000;
}

.cell-loading .cell-image {
    position: relative;
    opacity: 0.5;
    min-height: 60px;
}

.cell-loading .cell-image::after {
    content: "生成中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #1890ff;
    font-size: 12px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Disable all action buttons within a cell while its image is being generated. */
.cell-generating .action-btn {
    background: #d9d9d9 !important;
    color: #666 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Prompt editor modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #ffffff;
    margin: 8% auto;
    padding: 20px;
    border-radius: 8px;
    width: 700px;
    max-width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.log-cell-textarea {
    width: 200px;
    height: 120px;
    padding: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 10px;
    line-height: 1.4;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fafafa;
    resize: none;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    box-sizing: border-box;
}

.modal-content h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333333;
}

#prompt-modal-textarea {
    width: 100%;
    height: 400px;
    padding: 10px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
}

#batch-modal-textarea {
    width: 100%;
    height: 120px;
    padding: 10px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
}

#direction-modal-textarea {
    width: 100%;
    height: 120px;
    padding: 10px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
}

.modal-actions {
    text-align: right;
    margin-top: 16px;
}

.modal-actions .action-btn {
    margin-left: 8px;
}

/* Pagination controls */
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
}

.pagination-per-page label {
    margin-right: 6px;
}

.pagination-per-page select {
    padding: 4px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-info {
    padding: 0 8px;
    color: #666;
    white-space: nowrap;
}



/* ---------------------------------------------------------------------------
 * Nine-grid (body.ng-page) & Four-grid (body.fg-page) — SheIsLI brand skin V2
 * Apple-style: floating frosted toolbar, pill controls, borderless airy table,
 * sheet modals. Colors come from the --brand-* tokens in brand.css; the two
 * pages share one rule set via grouped .ng-*/.fg-* selectors. The shared block
 * above (used by the legacy index page) is overridden in scope, never edited.
 * --------------------------------------------------------------------------- */

/* Page canvas: kill the legacy 20px body margin, ivory ground. */
body.ng-page,
body.fg-page {
    margin: 0;
    padding: 0 0 56px;
}

/* Page header: big left-aligned title + one-line description. The header
 * scrolls away; only the toolbar sticks (apple.com behavior). */
.ng-page h1,
.fg-page h1 {
    text-align: left;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 32px 32px 6px;
    color: var(--brand-text);
}
.ng-page .page-desc,
.fg-page .page-desc {
    margin: 0 32px 24px;
    font-size: 13px;
    color: var(--brand-text-2);
}

/* Floating frosted-glass toolbar. --ng-toolbar-height / --fg-toolbar-height is
 * the STICKY THEAD offset: sticky top 12 + bar height 104 (padding 10*2 +
 * row 38 + gap 8 + row 38) = 116. Change bar metrics -> update all three. */
.ng-page {
    --ng-toolbar-height: 116px;
}
.fg-page {
    --fg-toolbar-height: 116px;
}
.ng-page .toolbar.ng-toolbar,
.fg-page .toolbar.fg-toolbar {
    position: sticky;
    top: 12px;
    z-index: 20;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    height: 104px;
    margin: 0 16px 24px;
    padding: 10px 12px;
    background: var(--brand-glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--brand-glass-border);
    border-radius: var(--brand-radius-card);
    box-shadow: var(--brand-shadow-md);
}
.ng-toolbar-row,
.fg-toolbar-row {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
.ng-toolbar-actions,
.fg-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex: 0 0 auto;
}
.ng-toolbar-filter-row,
.fg-toolbar-filter-row {
    justify-content: space-between;
}
.ng-page .select-page-wrapper,
.fg-page .select-page-wrapper {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

/* Filter summary lives inside the second toolbar row on these pages. */
.ng-page .filter-result-count,
.fg-page .filter-result-count {
    position: static;
    margin: 0;
    padding: 0;
    background: transparent;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    color: var(--brand-text-3);
}
.ng-page .toolbar-filters,
.fg-page .toolbar-filters {
    color: var(--brand-text-2);
    font-size: 12px;
}
.ng-page .toolbar-filters label,
.fg-page .toolbar-filters label {
    white-space: nowrap;
    margin-left: 4px;
}
.ng-page .selected-count,
.fg-page .selected-count {
    font-size: 11px;
    color: var(--brand-text-3);
}

/* Pill buttons: quiet ghost default, solid gold only for the primary CTA. */
.ng-page .ng-btn,
.fg-page .fg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--brand-radius-pill);
    border: 1px solid transparent;
    background: transparent;
    color: var(--brand-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
    box-sizing: border-box;
    cursor: pointer;
    transition: background-color 0.2s var(--brand-ease), color 0.2s var(--brand-ease),
                border-color 0.2s var(--brand-ease), box-shadow 0.2s var(--brand-ease),
                transform 0.15s var(--brand-ease);
}
.ng-page .ng-btn:hover,
.fg-page .fg-btn:hover {
    background: var(--brand-accent-soft);
}
.ng-page .ng-btn-primary,
.fg-page .fg-btn-primary {
    background: var(--brand-accent-deep);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--brand-shadow-sm);
}
.ng-page .ng-btn-primary:hover,
.fg-page .fg-btn-primary:hover {
    background: var(--brand-accent-deep-hover);
    box-shadow: var(--brand-shadow-md);
}
.ng-page .ng-btn-danger,
.fg-page .fg-btn-danger {
    background: transparent;
    border-color: rgba(255, 59, 48, 0.4);
    color: var(--brand-danger);
}
.ng-page .ng-btn-danger:hover,
.fg-page .fg-btn-danger:hover {
    background: var(--brand-danger-soft);
    border-color: var(--brand-danger);
}
.ng-page .ng-btn:disabled,
.ng-page .ng-btn:disabled:hover,
.fg-page .fg-btn:disabled,
.fg-page .fg-btn:disabled:hover {
    background: transparent;
    border-color: transparent;
    color: var(--brand-text-3);
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Button press feedback. */
.fg-page .fg-btn:active,
.fg-page .action-btn:active {
    transform: scale(0.97);
}

/* Toolbar form controls: borderless warm-gray pills, gold focus ring. */
.ng-page .ng-create-form,
.fg-page .fg-create-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.ng-page .ng-create-form input,
.ng-page .ng-create-form select,
.ng-page .ng-toolbar-filter-row input,
.ng-page .ng-toolbar-filter-row select,
.fg-page .fg-create-form input,
.fg-page .fg-create-form select,
.fg-page .fg-toolbar-filter-row input,
.fg-page .fg-toolbar-filter-row select {
    height: 34px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: var(--brand-radius-pill);
    font-size: 13px;
    padding: 0 14px;
    background: var(--brand-surface-2);
    color: var(--brand-text);
    transition: background-color 0.2s var(--brand-ease), box-shadow 0.2s var(--brand-ease),
                border-color 0.2s var(--brand-ease);
}
.ng-page .ng-create-form input:focus,
.ng-page .ng-create-form select:focus,
.ng-page .ng-toolbar-filter-row input:focus,
.ng-page .ng-toolbar-filter-row select:focus,
.fg-page .fg-create-form input:focus,
.fg-page .fg-create-form select:focus,
.fg-page .fg-toolbar-filter-row input:focus,
.fg-page .fg-toolbar-filter-row select:focus {
    outline: none;
    background: var(--brand-surface);
    border-color: var(--brand-accent-deep);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}
.ng-page .ng-toolbar-filter-row input,
.fg-page .fg-toolbar-filter-row input {
    width: 140px;
}
.ng-page .ng-create-form select,
.fg-page .fg-create-form select {
    max-width: 180px;
    text-overflow: ellipsis;
}

/* Nine-grid create-form widths (border/radius supplied by the rule above). */
.ng-page .ninegrid-form input {
    width: 220px;
}
.ng-page .ninegrid-form input.qty {
    width: 76px;
}

/* Four-grid create-form widths. */
.fg-page .fg-create-form input {
    width: 150px;
}
.fg-page .fg-create-form input.qty {
    width: 82px;
}

/* Checkboxes / radios pick up the brand gold (lock switch input excluded). */
.ng-page input[type="checkbox"]:not(.lock-checkbox),
.fg-page input[type="checkbox"]:not(.lock-checkbox),
.ng-page input[type="radio"],
.fg-page input[type="radio"] {
    accent-color: var(--brand-accent-deep);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Filter row right side: 本页全选 + 已选中 + 筛选结果 grouped. */
.fg-page .fg-filter-side {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    min-width: 0;
    flex: 0 1 auto;
}
.fg-page .fg-filter-side .selected-count {
    flex: 0 0 auto;
}

/* Filter-row controls run slightly tighter than the create form. */
.fg-page .fg-toolbar-filter-row input,
.fg-page .fg-toolbar-filter-row select {
    padding: 0 8px;
    font-size: 12px;
}
.fg-page .fg-toolbar-filter-row select {
    max-width: 140px;
    text-overflow: ellipsis;
}

/* Serial filter: same borderless pill language as the other filter controls
   (inline styles removed from the template). */
#filter-serial {
    width: 120px;
    height: 34px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--brand-radius-pill);
    background: var(--brand-surface-2);
    color: var(--brand-text);
    font-size: 12px;
    font-family: inherit;
    box-sizing: border-box;
    resize: none;
    overflow: hidden;
    transition: background-color 0.2s var(--brand-ease), box-shadow 0.2s var(--brand-ease),
                border-color 0.2s var(--brand-ease);
}
#filter-serial:focus {
    outline: none;
    background: var(--brand-surface);
    border-color: var(--brand-accent-deep);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}

/* Broken-image fallback: gray alt text on a quiet block instead of the
   browser-default blue alt + broken icon. */
.fg-page .fg-cell img,
.fg-page .fg-mslib-card img,
.fg-page .fg-edit-ms-grid img {
    color: var(--brand-text-3);
    font-size: 11px;
}

/* ≤1500px: the verbose filter summary duplicates the visible filter
   selections — drop it so 本页全选 and the selected count stay intact. */
@media (max-width: 1500px) {
    .fg-page .filter-result-count {
        display: none;
    }
}

/* Narrow viewports: keep the brand mark, hide the wordmark. */
@media (max-width: 1360px) {
    .fg-page .b-brand span {
        display: none;
    }
}

/* Empty image cell: dashed placeholder instead of a bare gray line. */
.fg-page .fg-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    margin: 0 auto;
    border: 1px dashed var(--brand-border-strong);
    border-radius: var(--brand-radius-img);
    color: var(--brand-text-3);
    font-size: 12px;
    box-sizing: border-box;
}

/* Sticky thead offsets by the toolbar height on each page. */
.ng-page th {
    top: var(--ng-toolbar-height);
}
.fg-page th {
    top: var(--fg-toolbar-height);
}

/* Borderless airy table on the ivory canvas (apple compare-table style). */
.ng-page .ng-table,
.fg-page .fg-table {
    width: calc(100% - 64px);
    margin: 0 32px;
    background: transparent;
}
.ng-page .ng-table th,
.ng-page .ng-table td,
.fg-page .fg-table th,
.fg-page .fg-table td {
    border: none;
    border-bottom: 1px solid var(--brand-border);
}
.ng-page .ng-table th,
.fg-page .fg-table th {
    background: rgba(245, 245, 247, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: var(--brand-text-3);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-align: left;
    padding: 12px 16px;
    box-shadow: none;
}
.ng-page .ng-table td,
.fg-page .fg-table td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--brand-text);
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

/* Row hover / selection: background-color only (rows are swapped by polling). */
.ng-page tbody tr,
.fg-page tbody tr {
    transition: background-color 0.2s var(--brand-ease);
}
.ng-page tbody tr:hover td,
.fg-page tbody tr:hover td {
    background-color: var(--brand-accent-soft);
}
.ng-page tbody tr.row-selected td,
.fg-page tbody tr.row-selected td {
    background-color: var(--brand-accent-faint);
}
.ng-page tbody tr.row-selected td:first-child,
.fg-page tbody tr.row-selected td:first-child {
    box-shadow: inset 2px 0 0 var(--brand-accent-deep);
}

/* Serial number: confident, tabular. */
.ng-page .sku-cell > div:first-child,
.fg-page .sku-cell > div:first-child {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

/* Cell thumbnails: white mini-cards that lift on hover (transitions live on
 * the img/a, never on the row, so polling swaps don't flash). */
.ng-page .ng-cell img,
.fg-page .fg-cell img {
    max-width: 88px;
    max-height: 88px;
    display: block;
    margin: 0 auto;
    border-radius: var(--brand-radius-img);
    background: #fff;
    box-shadow: var(--brand-shadow-sm);
    transition: transform 0.25s var(--brand-ease), box-shadow 0.25s var(--brand-ease);
}
.ng-page .ng-cell a:hover img,
.fg-page .fg-cell a:hover img {
    transform: scale(1.04);
    box-shadow: var(--brand-shadow-pop);
}

/* Text columns: narrow, left-aligned, scrollable overflow. */
.ng-page .ng-table .ng-theme,
.ng-page .ng-table .ng-ptype,
.fg-page .fg-table .fg-theme,
.fg-page .fg-table .fg-ptype,
.fg-page .fg-table .fg-style-col {
    width: 120px;
    text-align: left;
    vertical-align: top;
}
.ng-page .ng-table .ng-cell-text,
.fg-page .fg-table .fg-cell-text {
    max-height: 64px;
    overflow-y: auto;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    scrollbar-width: thin;
}
.ng-page .ng-theme {
    max-width: 180px;
    word-break: break-all;
}

/* Operation buttons: small ghost pills (must out-specify the legacy
 * td:not(.sku-cell) .action-btn shrink rule — same specificity, later wins). */
.ng-page .action-btn,
.fg-page .action-btn {
    border: 1px solid var(--brand-border-strong);
    border-radius: var(--brand-radius-pill);
    background: transparent;
    color: var(--brand-text-2);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s var(--brand-ease), color 0.2s var(--brand-ease),
                border-color 0.2s var(--brand-ease), box-shadow 0.2s var(--brand-ease),
                transform 0.15s var(--brand-ease);
}
.ng-page td .action-btn,
.fg-page td .action-btn {
    min-width: 0;
    padding: 5px 14px;
    margin: 2px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: var(--brand-radius-pill);
}
.ng-page .action-btn.btn-blue,
.fg-page .action-btn.btn-blue {
    color: var(--brand-accent-deep);
    border-color: rgba(0, 113, 227, 0.35);
    background: transparent;
}
.ng-page .action-btn.btn-blue:hover,
.fg-page .action-btn.btn-blue:hover {
    background: var(--brand-accent-soft);
    border-color: var(--brand-accent-deep);
}
.ng-page .action-btn.btn-red,
.fg-page .action-btn.btn-red {
    color: var(--brand-danger);
    border-color: rgba(255, 59, 48, 0.35);
    background: transparent;
}
.ng-page .action-btn.btn-red:hover,
.fg-page .action-btn.btn-red:hover {
    background: var(--brand-danger-soft);
    border-color: var(--brand-danger);
}
.ng-page .action-btn.btn-gray,
.fg-page .action-btn.btn-gray {
    color: var(--brand-text-3);
    border-color: var(--brand-border);
    background: transparent;
    cursor: not-allowed;
}
.ng-page .action-btn:disabled,
.fg-page .action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* iOS-style lock toggle (scoped override of the shared .switch/.slider). */
.ng-page .switch,
.fg-page .switch {
    width: 44px;
    height: 26px;
}
.ng-page .slider,
.fg-page .slider {
    background-color: #e9e9ea;
    border-radius: var(--brand-radius-pill);
    transition: background-color 0.25s var(--brand-ease);
}
.ng-page .slider:before,
.fg-page .slider:before {
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s var(--brand-ease);
}
.ng-page input:checked + .slider,
.fg-page input:checked + .slider {
    background-color: var(--brand-accent-deep);
}
.ng-page input:checked + .slider:before,
.fg-page input:checked + .slider:before {
    transform: translateX(18px);
}
.ng-page .lock-label,
.fg-page .lock-label {
    font-size: 12px;
    color: var(--brand-text-2);
}

/* Task state badge: soft tint + deep text + status dot drawn with ::before
 * (JS-rendered badge HTML stays unchanged). */
.ng-badge,
.fg-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 2px 0;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border-radius: var(--brand-radius-pill);
}
.ng-badge::before,
.fg-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.ng-badge-running,
.fg-badge-running {
    background: var(--brand-accent-soft);
    color: var(--brand-accent-deep);
}
.ng-badge-queued,
.fg-badge-queued {
    background: var(--brand-warning-soft);
    color: var(--brand-warning);
}
.ng-badge-error,
.fg-badge-error {
    background: var(--brand-danger-soft);
    color: var(--brand-danger);
}
.ng-badge-running::before,
.fg-badge-running::before {
    animation: ngfg-badge-pulse 1.2s ease-in-out infinite;
}
@keyframes ngfg-badge-pulse {
    50% { opacity: 0.3; }
}

/* Bottom pagination: centered, minimal, pill controls. */
.ng-page .pagination-controls,
.fg-page .pagination-controls {
    justify-content: center;
    gap: 20px;
    margin: 24px 0 8px;
    font-size: 12px;
    color: var(--brand-text-2);
}
.ng-page .pagination-nav .action-btn,
.fg-page .pagination-nav .action-btn {
    padding: 6px 14px;
    font-size: 12px;
}
.ng-page .pagination-info,
.fg-page .pagination-info {
    color: var(--brand-text-3);
    font-size: 12px;
}
.ng-page .pagination-per-page select,
.fg-page .pagination-per-page select {
    height: 30px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: var(--brand-radius-pill);
    background: var(--brand-surface-2);
    color: var(--brand-text);
    font-size: 12px;
}
.ng-page .pagination-per-page label,
.fg-page .pagination-per-page label {
    color: var(--brand-text-2);
}

/* Sheet-style modals: big radius, generous padding, heavy soft shadow. */
.ng-page .modal,
.fg-page .modal {
    background: rgba(0, 0, 0, 0.36);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    backdrop-filter: blur(8px) saturate(140%);
}
.ng-page .modal .modal-content,
.fg-page .modal .modal-content {
    background: var(--brand-surface);
    border: none;
    border-radius: var(--brand-radius-sheet);
    padding: 28px;
    box-shadow: var(--brand-shadow-sheet);
}
.ng-page .modal-content h3,
.fg-page .modal-content h3 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--brand-text);
    margin: 0 0 18px;
}
.ng-page .modal-content input[type="text"],
.ng-page .modal-content input[type="number"],
.ng-page .modal-content input[type="file"],
.ng-page .modal-content select,
.ng-page .modal-content textarea,
.fg-page .modal-content input[type="text"],
.fg-page .modal-content input[type="number"],
.fg-page .modal-content input[type="file"],
.fg-page .modal-content select,
.fg-page .modal-content textarea {
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--brand-surface-2);
    color: var(--brand-text);
    font-size: 13px;
    transition: background-color 0.2s var(--brand-ease), box-shadow 0.2s var(--brand-ease),
                border-color 0.2s var(--brand-ease);
}
.ng-page .modal-content input:focus,
.ng-page .modal-content select:focus,
.ng-page .modal-content textarea:focus,
.fg-page .modal-content input:focus,
.fg-page .modal-content select:focus,
.fg-page .modal-content textarea:focus {
    outline: none;
    background: var(--brand-surface);
    border-color: var(--brand-accent-deep);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}
.ng-page .modal-actions,
.fg-page .modal-actions {
    margin-top: 20px;
}
.ng-page .modal-actions .action-btn,
.fg-page .modal-actions .action-btn {
    padding: 7px 20px;
    font-size: 13px;
}
/* Primary action inside a sheet is solid gold. */
.ng-page .modal .action-btn.btn-blue,
.fg-page .modal .action-btn.btn-blue {
    background: var(--brand-accent-deep);
    border-color: transparent;
    color: #fff;
}
.ng-page .modal .action-btn.btn-blue:hover,
.fg-page .modal .action-btn.btn-blue:hover {
    background: var(--brand-accent-deep-hover);
}
.ng-page .modal .action-btn.btn-red,
.fg-page .modal .action-btn.btn-red {
    background: var(--brand-danger);
    border-color: transparent;
    color: #fff;
}
.ng-page .modal .action-btn.btn-red:hover,
.fg-page .modal .action-btn.btn-red:hover {
    background: var(--brand-danger-hover);
}

/* Toast: bottom-center dark pill with a colored status dot. */
.ng-page #toast-container,
.fg-page #toast-container {
    top: auto;
    right: auto;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
}
.ng-page .toast,
.fg-page .toast {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 18px;
    border-radius: var(--brand-radius-pill);
    background: rgba(29, 29, 31, 0.92);
    color: #fff;
    font-size: 13px;
    box-shadow: var(--brand-shadow-pop);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.25s var(--brand-ease), transform 0.25s var(--brand-ease);
}
.ng-page .toast.toast-show,
.fg-page .toast.toast-show {
    opacity: 1;
    transform: translateY(0);
}
.ng-page .toast::before,
.fg-page .toast::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.ng-page .toast-success::before,
.fg-page .toast-success::before {
    background: #30d158;
}
.ng-page .toast-error::before,
.fg-page .toast-error::before {
    background: #ff6961;
}
.ng-page .toast-info::before,
.fg-page .toast-info::before {
    background: var(--brand-accent);
}

/* Thin warm scrollbars. */
.ng-page ::-webkit-scrollbar,
.fg-page ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.ng-page ::-webkit-scrollbar-thumb,
.fg-page ::-webkit-scrollbar-thumb {
    background: var(--brand-border-strong);
    border-radius: var(--brand-radius-pill);
}
.ng-page ::-webkit-scrollbar-track,
.fg-page ::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------------------------------------------------------------------------
 * Nine-grid specific components
 * --------------------------------------------------------------------------- */

/* 生图设置弹窗开关行 */
.ng-page .switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--brand-border);
    font-size: 13px;
}
.ng-page .settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
}
#ng-settings-json {
    width: 100%;
    min-height: 320px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 12px;
    box-sizing: border-box;
    background: var(--brand-surface-2);
    color: var(--brand-text);
}
/* ---------------------------------------------------------------------------
 * Four-grid specific components
 * --------------------------------------------------------------------------- */

/* 稿件列: 可点击单元格 + 3 列迷你格 + 空态占位 */
.fg-page .fg-ms-cell {
    cursor: pointer;
    min-width: 110px;
}
.fg-ms-grid {
    display: grid;
    grid-template-columns: repeat(3, 32px);
    gap: 3px;
    justify-content: center;
}
.fg-ms-thumb img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
    border: none;
    border-radius: 6px;
    background: var(--brand-surface-2);
}
.fg-ms-placeholder {
    display: inline-block;
    padding: 6px 10px;
    border: 1px dashed var(--brand-accent);
    border-radius: 6px;
    color: var(--brand-accent-deep);
    font-size: 12px;
    background: var(--brand-accent-soft);
    white-space: nowrap;
}
.fg-ms-cell:hover .fg-ms-placeholder {
    background: var(--brand-accent-soft);
    border-color: var(--brand-accent-deep);
}

/* 风格自定义下拉（创建表单） */
.fg-style-select {
    position: relative;
    flex: 0 0 auto;
}
.fg-page .fg-style-btn {
    min-width: 150px;
    justify-content: space-between;
    gap: 8px;
}
.fg-style-caret {
    color: var(--brand-text-3);
    font-size: 11px;
}
.fg-style-dropdown {
    position: absolute;
    top: 40px;
    left: 0;
    z-index: 1000;
    min-width: 230px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--brand-surface);
    border: none;
    border-radius: 12px;
    box-shadow: var(--brand-shadow-pop);
}
.fg-style-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.fg-style-option:hover {
    background: var(--brand-surface-2);
}
.fg-style-option-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
.fg-style-option-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border: 1px solid var(--brand-border);
    border-radius: 4px;
    background: var(--brand-surface-2);
    flex: 0 0 auto;
}
.fg-style-option-noimg {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-surface-2);
    border-radius: 4px;
    color: var(--brand-text-3);
    font-size: 11px;
    flex: 0 0 auto;
}
.fg-style-add {
    color: var(--brand-accent-deep);
    border-top: 1px solid var(--brand-border);
}
.fg-style-add-input {
    width: 100%;
    height: 26px;
    padding: 0 6px;
    border: 1px solid var(--brand-accent);
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

/* 稿件选择器网格 */
.fg-ms-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 4px 2px;
}
.fg-ms-pick-item {
    border: 2px solid var(--brand-border);
    border-radius: 12px;
    padding: 5px;
    cursor: pointer;
    text-align: center;
    background: var(--brand-surface);
}
.fg-ms-pick-item:hover {
    border-color: var(--brand-accent);
}
.fg-ms-pick-item.fg-ms-pick-selected {
    border-color: var(--brand-accent-deep);
    background: var(--brand-accent-soft);
}
.fg-ms-pick-item img {
    width: 100%;
    height: 90px;
    object-fit: contain;
    display: block;
}
.fg-ms-pick-name {
    font-size: 11px;
    color: var(--brand-text-2);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fg-ms-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--brand-border);
}
.fg-ms-count {
    font-size: 13px;
    color: var(--brand-text);
}

/* 生图设置弹窗: 标签页 */
.fg-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--brand-border);
    margin-bottom: 12px;
    flex: 0 0 auto;
}
.fg-tab {
    padding: 7px 16px;
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--brand-text-2);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.fg-tab:hover {
    color: var(--brand-accent-deep);
}
.fg-tab-active {
    color: var(--brand-accent-deep);
    border-bottom-color: var(--brand-accent-deep);
    font-weight: 600;
}

/* 生图设置弹窗: JSON 编辑器 */
.fg-cfg-block {
    margin-bottom: 12px;
}
.fg-cfg-label {
    font-size: 12px;
    color: var(--brand-text-2);
    margin-bottom: 4px;
}
.fg-cfg-textarea {
    width: 100%;
    min-height: 150px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 12px;
    box-sizing: border-box;
    resize: vertical;
    background: var(--brand-surface-2);
    color: var(--brand-text);
}

/* 风格库列表行 */
.fg-style-lib-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1px solid var(--brand-border);
    border-radius: 6px;
    margin-bottom: 8px;
}
.fg-style-lib-thumb {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border: 1px solid var(--brand-border);
    border-radius: 4px;
    background: var(--brand-surface-2);
    flex: 0 0 auto;
}
.fg-style-lib-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-text-3);
    font-size: 11px;
}
.fg-style-lib-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    word-break: break-all;
}

/* ---------------------------------------------------------------------------
 * Four-grid style library (独立风格库弹窗 + 只读风格选择框)
 * --------------------------------------------------------------------------- */

/* 只读风格选择框（创建表单 / 编辑弹窗 / 创建风格内联表单共用） */
.fg-style-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    min-width: 140px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--brand-radius-pill);
    background: var(--brand-surface-2);
    font-size: 13px;
    color: var(--brand-text);
    cursor: pointer;
    box-sizing: border-box;
    white-space: nowrap;
    flex: 0 0 auto;
}
.fg-style-box:hover {
    border-color: var(--brand-accent);
}
.fg-style-box-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border: 1px solid var(--brand-border);
    border-radius: 3px;
    background: var(--brand-surface-2);
    flex: 0 0 auto;
}
.fg-style-box-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fg-style-box-caret {
    color: var(--brand-text-3);
    font-size: 11px;
    flex: 0 0 auto;
}
.fg-style-box-sm {
    min-width: 200px;
}

/* 风格库卡片网格 */
.fg-stylelib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 4px 2px;
}
.fg-stylelib-card {
    border: 2px solid var(--brand-border);
    border-radius: 14px;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    background: var(--brand-surface);
    transition: border-color 0.15s ease;
}
.fg-stylelib-card:hover {
    border-color: var(--brand-accent);
}
.fg-stylelib-card-selected {
    border-color: var(--brand-accent-deep);
    background: var(--brand-accent-soft);
}
.fg-stylelib-thumb {
    width: 100%;
    height: 120px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    background: var(--brand-surface-2);
}
.fg-stylelib-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-text-3);
    font-size: 12px;
    border: 1px solid var(--brand-border);
    box-sizing: border-box;
}
.fg-stylelib-card-name {
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 效果图容器: 操作按钮绝对定位锚在它的右下角（换行向上长, 不压名称） */
.fg-stylelib-thumb-wrap {
    position: relative;
}
.fg-stylelib-card-ops {
    position: absolute;
    right: 4px;
    bottom: 4px;
    left: 4px;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
}
/* 注意: 必须用 (0,5,0) 级选择器压住 .fg-page .modal .action-btn.btn-blue/btn-red
   (0,4,0) 的品牌样式, 否则按钮会渲染成大号实心品牌 pill 并溢出卡片(2026-09-03 踩过) */
.fg-page .modal .fg-stylelib-thumb-wrap .action-btn.fg-stylelib-op {
    min-width: 0;
    margin: 0;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.6;
    border: none;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
}
.fg-page .modal .fg-stylelib-thumb-wrap .action-btn.fg-stylelib-op:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

/* 创建风格内联表单 */
.fg-stylelib-create-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px dashed var(--brand-accent);
    border-radius: 6px;
    background: var(--brand-accent-soft);
    flex: 0 0 auto;
}
.fg-stylelib-create-form input[type="text"] {
    height: 34px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--brand-radius-pill);
    font-size: 13px;
    width: 180px;
    box-sizing: border-box;
}

/* 稿件选择器必须压在风格库/编辑弹窗之上（都从它们内部打开） */
#fg-ms-modal {
    z-index: 2100;
}

/* 通用确认弹窗必须永远最顶层（稿件库/风格库等 z-2000 弹窗之上） */
#fg-confirm-modal {
    z-index: 2200;
}

/* 弹窗顶部文件名搜索框（选择稿件 / 稿件库共用） */
.fg-modal-search {
    width: 240px;
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius-pill);
    font-size: 13px;
    box-sizing: border-box;
}
.fg-modal-search:focus {
    outline: none;
    border-color: var(--brand-accent);
}

/* ---------------------------------------------------------------------------
 * Four-grid scoped-rerun dropdown + manuscript library
 * --------------------------------------------------------------------------- */

/* 行内「重新生成 ▾」自绘下拉菜单 */
.fg-run-wrap {
    position: relative;
    display: inline-block;
}
.fg-run-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1200;
    min-width: 120px;
    margin-top: 4px;
    background: var(--brand-surface);
    border: none;
    border-radius: 12px;
    box-shadow: var(--brand-shadow-pop);
    overflow: hidden;
}
.fg-run-menu-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--brand-text);
    cursor: pointer;
    white-space: nowrap;
    text-align: left;
}
.fg-run-menu-item:hover {
    background: var(--brand-accent-soft);
    color: var(--brand-accent-deep);
}

/* 稿件库网格卡片 */
.fg-mslib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 4px 2px;
}
.fg-mslib-card {
    position: relative;
    border: 1px solid var(--brand-border);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    background: #fff;
}
.fg-mslib-card-selected {
    border-color: var(--brand-accent-deep);
    background: var(--brand-accent-soft);
}
.fg-mslib-check {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand-accent-deep);
    cursor: pointer;
}
.fg-mslib-card img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    background: var(--brand-surface-2);
}
.fg-mslib-card-name {
    font-size: 11px;
    color: var(--brand-text-2);
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fg-mslib-card-ops {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}
.fg-mslib-op {
    padding: 3px 8px;
    font-size: 12px;
}

/* ---------------------------------------------------------------------------
 * Four-grid: settings four-tab JSON editors + default style + edit-modal
 * manuscript section
 * --------------------------------------------------------------------------- */

/* 稿件列静态空态（不再可点击） */
.fg-page .fg-ms-cell {
    cursor: default;
}
.fg-ms-static {
    color: var(--brand-text-3);
    font-size: 12px;
    white-space: nowrap;
}

/* 禁用态的风格只读框（编辑弹窗 manual 模式） */
.fg-style-box-disabled {
    opacity: 0.55;
    pointer-events: none;
}

/* 编辑弹窗稿件缩略图区 */
.fg-edit-ms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 40px;
}
.fg-edit-ms-grid img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border: 1px solid var(--brand-border);
    border-radius: 4px;
    background: var(--brand-surface-2);
    display: block;
}

/* 风格库: 默认徽章 + 空风格卡片 */
.fg-stylelib-default-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 400;
    border-radius: 8px;
    background: var(--brand-success);
    color: #fff;
    vertical-align: 1px;
}
.fg-stylelib-card-empty {
    border-style: dashed;
    color: var(--brand-text-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 生图设置四 tab 页 */
.fg-tab-pane {
    min-height: 0;
}
.fg-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.fg-editor-status {
    font-size: 12px;
    margin-left: auto;
}
.fg-editor-status.ok {
    color: var(--brand-success);
}
.fg-editor-status.err {
    color: var(--brand-danger);
}

/* JSON 编辑器: 深色代码风, 行号栏 + 高亮层 + 透明 textarea 叠加 */
.fg-editor-wrap {
    display: flex;
    height: 340px;
    background: #1e1e2e;
    border: 1px solid #303040;
    border-radius: 6px;
    overflow: hidden;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
}
.fg-editor-gutter {
    margin: 0;
    padding: 8px 6px;
    min-width: 38px;
    text-align: right;
    color: #5c6370;
    background: #16161e;
    user-select: none;
    overflow: hidden;
    flex: 0 0 auto;
    box-sizing: border-box;
    white-space: pre;
    line-height: inherit;
}
.fg-editor-main {
    position: relative;
    flex: 1;
    min-width: 0;
}
.fg-editor-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 8px 10px;
    font: inherit;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
    box-sizing: border-box;
    pointer-events: none;
}
.fg-editor-highlight .fg-ph {
    color: #ffd166;
    background: rgba(255, 209, 102, 0.15);
    border-radius: 2px;
}
/* VS Code 深色 JSON 配色 */
.fg-editor-highlight .fg-j-key {
    color: #9cdcfe;
}
.fg-editor-highlight .fg-j-str {
    color: #6a9955;
}
.fg-editor-highlight .fg-j-kw {
    color: #569cd6;
}
.fg-editor-highlight .fg-j-num {
    color: #b5cea8;
}
.fg-editor-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 8px 10px;
    font: inherit;
    line-height: inherit;
    background: transparent;
    color: transparent;
    caret-color: #f8f8f2;
    border: none;
    outline: none;
    resize: none;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: auto;
    box-sizing: border-box;
}

/* 稿件库网格与「选择稿件」弹窗同高 */
.fg-mslib-grid {
    max-height: 55vh;
    overflow-y: auto;
}

/* 修复：弹窗全局 textarea 浅色背景盖过编辑器（特异性更高） */
.fg-page .modal-content .fg-editor-wrap .fg-editor-input {
    background: transparent;
    color: transparent;
    border: none;
    border-radius: 0;
}
.fg-page .modal-content .fg-editor-wrap .fg-editor-input:focus {
    background: transparent;
    box-shadow: none;
}

/* 修复：输入层字体必须与高亮层完全一致，否则光标错位 */
.fg-page .modal-content .fg-editor-wrap .fg-editor-input {
    font: inherit;
    line-height: inherit;
    letter-spacing: inherit;
}

/* 流水号格内的作者名（小灰字，挂在流水号下方） */
.fg-page .fg-author {
    font-size: 11px;
    color: var(--brand-text-3);
    margin-top: 2px;
}

/* 工具栏「删除 ▾」下拉项: 红色文字; 复用 .fg-run-menu 容器样式 */
.fg-menu-item-danger {
    color: var(--brand-danger);
}
.fg-menu-item-danger:hover {
    background: #fff1f0;
    color: var(--brand-danger);
}
/* 下拉项用 <button> 时的浏览器默认样式复位 */
button.fg-run-menu-item {
    background: none;
    border: none;
    width: 100%;
    font: inherit;
    cursor: pointer;
}
/* 置灰菜单项（「删除 ▾」无选中行 / 行内全流程已关联稿件或缺字段） */
.fg-run-menu-item:disabled,
.fg-run-menu-item-disabled {
    color: var(--brand-text-3);
    cursor: not-allowed;
}
.fg-run-menu-item:disabled:hover,
.fg-run-menu-item-disabled:hover {
    background: #fff;
    color: var(--brand-text-3);
}

/* 行内「下载稿件」不可用态（无稿件行渲染为 span，无 disabled 属性可用） */
.fg-action-disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ---------------------------------------------------------------------------
 * 2026-09-04: 工具栏下拉防裁剪 / 行内字段复制 / 复制成功横幅 / 稿件库页自适应
 * --------------------------------------------------------------------------- */

/* 工具栏级下拉（删除 ▾ / 全局执行 ▾）: 菜单是 .fg-toolbar 的直接子节点,
 * 由 JS 按按钮位置定位（.fg-toolbar-row 的 overflow-y:hidden 会裁剪行内菜单） */
.fg-toolbar-menu {
    position: absolute;
}

/* 行内字段复制图标: 行 hover 时浮现, 点击复制 */
.fg-copy-icon {
    display: inline-block;
    margin-left: 4px;
    vertical-align: -1px;
    color: #c7c7cc;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease, color 0.15s ease;
}
.fg-copy-icon:hover {
    color: #8e8e93;
}
.fg-page .fg-table tbody tr:hover .fg-copy-icon {
    opacity: 1;
}

/* 顶部滑下「复制成功」横幅 */
#fg-copy-banner {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -150%);
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
    font-size: 13px;
    color: var(--brand-text);
    pointer-events: none;
    transition: transform 0.3s ease;
}
#fg-copy-banner.show {
    transform: translate(-50%, 16px);
}
#fg-copy-banner .fg-copy-banner-check {
    color: #30d158;
    font-weight: 700;
}

/* 稿件库独立页: 搜索框可纵向拉大, 工具栏随内容撑开, 网格吃剩余视口高度 */
body.ms-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
}
.fg-page .toolbar.fg-toolbar.ms-toolbar {
    height: auto;
    flex: 0 0 auto;
}
.ms-toolbar .fg-toolbar-row {
    height: auto;
    min-height: 38px;
    align-items: flex-start;
    flex-wrap: wrap;
    overflow: visible;
}
.ms-toolbar .fg-toolbar-row .action-btn {
    flex: 0 0 auto;
    margin-top: 2px;
}
body.ms-page .ms-page-grid {
    flex: 1;
    min-height: 160px;
    max-height: none;
    overflow-y: auto;
}
