.editor-shell { max-width: 1800px; }
.editor-drop-zone { padding: 18px; border: 2px dashed var(--border); border-radius: 12px; background: var(--soft); }
.editor-drop-zone.drag-over { border-color: var(--accent); background: #e2eef6; }
.editor-drop-zone input { max-width: 520px; }
.editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.editor-toolbar h2 { margin: 0; }
.editor-search { flex: 1 1 260px; max-width: 480px; }
.editor-check { display: flex; align-items: center; gap: 9px; margin: 0; }
.editor-check input { width: 18px; height: 18px; flex: 0 0 auto; }
.editor-workspace { margin-top: 22px; }
.editor-table-scroll { max-height: 65vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.editor-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .85rem; }
.editor-table th { position: sticky; top: 0; z-index: 2; background: var(--accent-strong); color: white; text-align: left; white-space: nowrap; padding: 10px 8px; }
.editor-table td { padding: 4px; border-bottom: 1px solid var(--border); background: var(--card); }
.editor-table tr:nth-child(even) td { background: var(--soft); }
.editor-table td:first-child { position: sticky; left: 0; z-index: 1; }
.editor-table th:first-child { left: 0; z-index: 3; }
.editor-table input, .editor-table select, .editor-table textarea { min-width: 125px; padding: 7px; font-size: .85rem; border-radius: 5px; background: var(--card); }
.editor-table input[type=number] { min-width: 88px; width: 88px; }
.editor-table input[data-field=Name], .editor-table input[data-field=Comment] { min-width: 180px; }
.editor-table input:focus, .editor-table select:focus, .editor-table textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.editor-table input:disabled { background: #e9ecef; color: #687078; cursor: not-allowed; opacity: .7; }
.editor-arrange-cell { white-space: nowrap; }
.editor-row-tools { display: inline-flex; vertical-align: middle; align-items: center; gap: 4px; }
.editor-table button { padding: 6px 9px; border-radius: 5px; font-size: .85rem; white-space: nowrap; }
.editor-table .editor-drag { cursor: grab; font-size: 1.1rem; padding: 6px 9px; border: 1px solid var(--border); border-radius: 5px; background: var(--soft); color: var(--accent-strong); user-select: none; touch-action: none; -webkit-user-drag: element; }
.editor-table .editor-drag:focus { outline: 2px solid var(--accent); }
.editor-table .editor-drag[aria-disabled=true] { opacity: .5; cursor: default; -webkit-user-drag: none; }
.editor-search input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.editor-table tr.drag-target td { border-top: 3px solid var(--accent); }
.editor-export { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-top: 22px; }
.editor-export > div { min-width: 280px; }
.editor-shell button:disabled { opacity: .5; cursor: default; transform: none; }
.editor-shell [hidden] { display: none !important; }
@media (max-width: 640px) { .editor-shell { padding: 12px; } .editor-shell .hero { padding: 20px; } .editor-shell h1 { font-size: 1.8rem; } }

.editor-table textarea { min-width: 240px; resize: both; font-family: inherit; vertical-align: middle; }

.editor-table .editor-new-row td { border-top: 2px dashed var(--border); background: #e7f4ea; }

.editor-tone-options { position: fixed; z-index: 20; overflow-y: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--accent); border-radius: 5px; box-shadow: 0 4px 12px #0003; }
.editor-tone-options [role=option] { padding: 8px 12px; cursor: pointer; font-size: .85rem; }
.editor-tone-options [role=option]:hover, .editor-tone-options [aria-selected=true] { background: var(--accent-strong); color: white; }

@media (prefers-color-scheme: dark) {
    .editor-drop-zone.drag-over {
        background: #203b4d;
    }

    .editor-table th {
        background: #1b3040;
        color: var(--accent-strong);
    }

    .editor-table input:disabled {
        background: var(--soft);
        color: var(--muted);
    }

    .editor-table .editor-new-row td {
        background: var(--good-bg);
    }

    .editor-tone-options [role=option]:hover,
    .editor-tone-options [aria-selected=true] {
        background: #23485e;
        color: var(--ink);
    }
}

/* A solid error fill remains readable in both light and dark themes. */
.editor-table input[aria-invalid="true"],
.editor-table textarea[aria-invalid="true"] {
    background: #8b1e2d;
    color: #fff;
    border: 1px solid #ff8f99;
    caret-color: #fff;
}

.editor-table input[aria-invalid="true"]:focus,
.editor-table textarea[aria-invalid="true"]:focus {
    outline-color: #ff8f99;
}
