/* static/css/style.css */
:root { 
    --main-maroon: #600000; --border-cream: #F5F0CE; --gold-accent: #FFB701; 
    --ink-white: #FFFFFF; --bg-black: #111111; 
    --btn-blue: #007bff; --btn-green: #28a745; --btn-red: #dc3545;
    --btn-purple: #6f42c1; --btn-orange: #fd7e14; --btn-teal: #17a2b8;
    --btn-gray: #6c757d;
    --panel-bg: #4a0d0d; 

    /* Status Colors */
    --status-raw: #6c757d;
    --status-edit: #fd7e14;
    --status-textclean: #17a2b8;
    --status-trans: #007bff;
    --status-proof: #6f42c1;
    --status-complete: #28a745;
}
@font-face { font-family: 'Mizrachi'; src: url('/fonts/Mizrachi_ketiv-Regular.ttf') format('truetype'); }

body { 
    margin: 0; padding: 20px; background-color: var(--bg-black); 
    direction: rtl; font-family: 'Segoe UI', Tahoma, sans-serif; 
    color: var(--ink-white); height: 100vh; overflow: hidden;
    user-select: none; display: flex; flex-direction: column; box-sizing: border-box;
}

/* --- MENU --- */
.menu-container { 
    max-width: 1600px; width: 100%; margin: 0 auto 15px auto; 
    background: #1a1a1a; border: 2px solid var(--gold-accent); 
    display: flex; height: 40px; z-index: 5000; flex-shrink: 0;
}
body.work-edit-mode .menu-container {
    display: none;
}
.menu-item { 
    padding: 0 25px; height: 100%; display: flex; align-items: center;
    cursor: pointer; font-weight: bold; color: var(--gold-accent); 
    border-left: 1px solid #333; position: relative; font-family: 'Mizrachi', sans-serif; font-size: 1.1rem;
}
.menu-item:hover { background: #333; }
.menu-item.active { background: var(--main-maroon); color: var(--ink-white); }

.dropdown {
    display: none; position: absolute; top: 100%; right: 0; 
    background: #222; min-width: 180px; border: 1px solid var(--gold-accent); 
    z-index: 5001;
}
.menu-item:hover .dropdown { display: block; }
.drop-link {
    padding: 10px 15px; color: var(--border-cream); display: block; 
    border-bottom: 1px solid #444; text-decoration: none; font-family: 'Segoe UI', sans-serif; font-size: 0.9rem;
}
.drop-link:hover { background: var(--main-maroon); color: white; }

/* --- SHELL --- */
.main-wrapper {
    max-width: 1600px; width: 100%; flex: 1; margin: 0 auto;
    background-color: var(--main-maroon); padding: 20px;
    border: 7px solid var(--border-cream); 
    box-shadow: 0 0 30px rgba(255, 183, 1, 0.2);
    display: flex; flex-direction: column; overflow: hidden; position: relative;
}

/* --- BUTTONS --- */
button, .form-button {
    padding: 4px 12px; color: var(--ink-white); 
    border: 2px solid var(--border-cream); border-radius: 4px; 
    cursor: pointer; font-weight: bold; font-family: 'Segoe UI', sans-serif;
    transition: all 0.2s; background-color: #333; height: 36px; white-space: nowrap;
}
button:hover { border-color: var(--gold-accent); transform: translateY(-1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; border-color:#555; }
.btn-green { background-color: var(--btn-green); }
.btn-orange { background-color: var(--btn-orange); }
.btn-red { background-color: var(--btn-red); }
.btn-blue { background-color: var(--btn-blue); }
.btn-purple { background-color: var(--btn-purple); }
.btn-teal { background-color: var(--btn-teal); }
.btn-gray { background-color: var(--btn-gray); }
.btn-orange.active, .btn-purple.active, .btn-teal.active, .btn-green.active {
    border-color: #ffff00; box-shadow: 0 0 15px var(--gold-accent);
}

/* --- VIEWS --- */
.app-view { display: none; height: 100%; flex-direction: column; overflow: hidden; gap: 15px;}
.app-view.active { display: flex; }

.landing-view {
    height: 100%; display: flex; justify-content: flex-start; align-items: center;
    flex-direction: column; text-align: center; padding-top: 25px; gap: 20px;
    position: relative;
    width: 100%;
}
.landing-title { font-family: 'Mizrachi'; font-size: 4rem; color: var(--gold-accent); margin: 0; }
.landing-main-title {
    width: 70%;
    max-width: 980px;
    min-width: 520px;
    text-align: center;
}
.landing-title-studio {
    font-size: 0.5em;
}
.landing-title-brand {
    font-size: 1.25em;
}
.landing-brand-logo-corner {
    position: absolute;
    top: 10px;
    right: 24px;
    width: 144px;
    height: auto;
    object-fit: contain;
    z-index: 2;
}
.landing-dashboard-title {
    width: 70%;
    max-width: 980px;
    min-width: 520px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--gold-accent);
    font-weight: bold;
    font-size: 1.2rem;
}
.landing-header-row {
    width: 100%;
    position: relative;
    text-align: right;
    padding-left: 34px;
}
.landing-refresh-inline {
    position: absolute !important;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.landing-sub { font-size: 1.2rem; color: var(--border-cream); opacity: 0.7; margin-top: 10px; }
.landing-tasks {
    width: 70%; max-width: 980px; min-width: 520px;
    margin-top: 10px;
}
.landing-tasks-title {
    color: var(--gold-accent); font-weight: bold; margin-bottom: 10px;
    font-size: 1.2rem;
}
.landing-table { background: rgba(0,0,0,0.25); }
.landing-table-frame {
    border: 2px solid var(--gold-accent);
    border-radius: 8px;
    background: rgba(0,0,0,0.25);
    overflow: hidden;
}

/* --- ADMIN COSTS --- */
.admin-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding-top: 20px;
}
.admin-summary {
    width: 75%;
    display: flex;
    gap: 16px;
}
.admin-card {
    flex: 1 1 0;
    border: 1px solid var(--gold-accent);
    background: rgba(0,0,0,0.25);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}
.admin-card-label {
    color: var(--border-cream);
    font-size: 0.95rem;
    opacity: 0.8;
}
.admin-card-value {
    color: var(--gold-accent);
    font-size: 1.4rem;
    font-weight: bold;
}
.admin-filter {
    width: 75%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}
.admin-tables {
    width: 80%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.admin-table-wrap {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--gold-accent);
    padding: 10px;
}
.admin-table-title {
    color: var(--gold-accent);
    font-weight: bold;
    margin-bottom: 8px;
}

/* --- TRANSLATION SETUP --- */
.t-setup {
    margin: 10px;
    padding: 14px 16px;
    border: 2px dashed var(--gold-accent);
    background: rgba(0,0,0,0.2);
}
.t-setup-section {
    border: 1px solid var(--gold-accent);
    padding: 14px 16px;
    background: rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}
.t-section-title {
    color: var(--gold-accent);
    font-weight: bold;
    font-size: 1.1rem;
}
.t-process-subtitle {
    margin: 6px 0 4px;
    color: var(--gold-accent);
    font-weight: 700;
}
.t-section-head {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 10px;
}
.t-section-head.t-section-head-right {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    text-align: right;
}
#t-book-config-body {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    gap: 12px;
}
.t-section-sub {
    font-size: 0.78rem;
    color: var(--border-cream);
    opacity: 0.7;
    white-space: nowrap;
}

/* --- Graphics Mode (Scoped) --- */
#view-graphics .inv-tile {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,183,1,0.25);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
}
#view-graphics .inv-tile:hover { border-color: var(--gold-accent); }

#view-graphics #gfx-right-sidebar .file-item {
    border-bottom: 1px solid rgba(255, 183, 1, 0.2);
}

#view-graphics #gfx-right-sidebar .file-item.active {
    background: rgba(255, 183, 1, 0.18);
    color: var(--gold-accent);
}

#view-graphics #gfx-page-loader-body.is-collapsed {
    display: none !important;
}

#view-graphics #gfx-source-body.is-collapsed,
#view-graphics #gfx-inpaint-body.is-collapsed {
    display: none !important;
}

#view-graphics .gfx-loader-top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 0 10px;
}

#view-graphics #gfx-book-context-label {
    margin: 0 10px;
    padding: 10px;
    background: var(--gold-accent);
    color: #111;
    text-align: center;
    font-weight: 700;
    border-radius: 6px;
    min-height: 20px;
}

#view-graphics .gfx-page-loader-head {
    position: relative;
    justify-content: center;
    text-align: center;
}

#view-graphics .gfx-page-loader-head #gfx-page-section-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

#view-graphics.gfx-start-mode .app-body {
    direction: rtl !important;
    gap: 10px !important;
    flex-direction: row-reverse !important;
}

#view-graphics.gfx-start-mode .workspace {
    border: 2px solid var(--gold-accent);
    background-color: #1a1a1a;
}

#view-graphics.gfx-start-mode > .toolbar {
    display: flex !important;
}

#view-graphics.gfx-start-mode > .toolbar > * {
    visibility: hidden !important;
    pointer-events: none !important;
}

#view-graphics.gfx-start-mode #gfx-right-sidebar {
    display: flex !important;
    flex-direction: column;
    gap: 0 !important;
    width: 260px !important;
}

#view-graphics.gfx-start-mode .gfx-loader-top-actions,
#view-graphics.gfx-start-mode #gfx-source-section,
#view-graphics.gfx-start-mode #gfx-text-remove-section,
#view-graphics.gfx-start-mode #gfx-inpaint-section,
#view-graphics.gfx-start-mode .gfx-info-section {
    display: none !important;
}

#view-graphics.gfx-start-mode #gfx-book-context-label {
    margin: 0;
    padding: 10px;
    background: var(--gold-accent);
    color: #000;
    text-align: center;
    font-weight: bold;
    border-radius: 0;
    min-height: 20px;
}

#view-graphics.gfx-start-mode .gfx-page-loader-head {
    padding: 10px;
    min-height: 0 !important;
    background: rgba(0,0,0,0.6);
    border: 0 !important;
    border-bottom: 1px solid var(--gold-accent) !important;
    border-radius: 0 !important;
}

#view-graphics.gfx-start-mode .gfx-page-loader-head #gfx-page-section-toggle {
    display: none !important;
}

#view-graphics.gfx-start-mode #gfx-page-loader-body {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    padding: 6px 10px 0 !important;
    flex: 1 1 auto;
}

#view-graphics.gfx-start-mode #gfx-right-sidebar > div:nth-child(4) {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    padding-bottom: 0 !important;
}

#view-graphics.gfx-start-mode #gfx-canvas-wrap,
#view-graphics.gfx-start-mode #gfx-cursor {
    display: none !important;
}

#view-graphics.gfx-start-mode #gfx-pages {
    min-height: 0 !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    flex: 1 1 auto;
}

#view-graphics.gfx-start-mode #gfx-empty {
    display: flex !important;
}

#view-graphics .gfx-source-mode-row {
    display: flex;
    gap: 8px;
}

#view-graphics .gfx-source-mode-row .gfx-source-btn {
    flex: 1 1 0;
}

#view-graphics .gfx-source-mode-row .gfx-source-btn.active {
    border-color: var(--gold-accent);
    background: rgba(255, 183, 1, 0.25);
    color: var(--gold-accent);
}

#view-graphics .gfx-info-section {
    margin-top: auto;
}

#view-graphics #gfx-tools-color {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: auto;
    flex-wrap: nowrap;
    direction: ltr;
}

#view-graphics .gfx-color-palette {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    row-gap: 4px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 0 0 auto;
}

#view-graphics .gfx-basic-colors {
    display: grid;
    grid-template-columns: repeat(3, 13px);
    grid-template-rows: repeat(2, 13px);
    gap: 2px;
    align-items: center;
    margin-top: 0;
    flex: 0 0 auto;
}

#view-graphics .gfx-color-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 92px;
    flex: 0 0 92px;
    align-self: flex-start;
    direction: ltr;
}

#view-graphics .gfx-color-target-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    white-space: nowrap;
}

#view-graphics .gfx-target-check-spacer {
    width: 22px;
    height: 22px;
    display: inline-block;
}

#view-graphics .gfx-target-check {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

#view-graphics .gfx-target-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

#view-graphics .gfx-color-target {
    border: 1px solid rgba(255, 183, 1, 0.45);
    background: rgba(64, 10, 10, 0.88);
    color: var(--border-cream);
    border-radius: 5px;
    font-size: 0.76rem;
    line-height: 1;
    padding: 0 10px !important;
    min-height: 28px !important;
    height: 28px !important;
    width: 70px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#view-graphics .gfx-color-target.active {
    border-color: var(--gold-accent);
    color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.22) inset;
}

#view-graphics .gfx-color-target:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#view-graphics #gfx-color-shared {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255, 183, 1, 0.75);
    border-radius: 4px;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    background: transparent;
    overflow: hidden;
}

#view-graphics .gfx-outline-mini {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

#view-graphics .gfx-mini-lbl {
    color: var(--border-cream);
    font-size: 0.72rem;
}

#view-graphics .gfx-outline-mini div {
    color: var(--border-cream);
    font-size: 0.78rem;
    min-width: 24px;
    text-align: left;
    direction: ltr;
}

#view-graphics .gfx-outline-mini #gfx-border-thick {
    width: 58px;
    height: 14px;
    margin: 0;
    padding: 0;
}

#view-graphics .gfx-outline-mini #gfx-fill-alpha {
    width: 58px;
    height: 14px;
    margin: 0;
    padding: 0;
}

#view-graphics #gfx-color-shared::-webkit-color-swatch-wrapper {
    padding: 0;
}

#view-graphics #gfx-color-shared::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

#view-graphics #gfx-color-shared::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

#view-graphics .gfx-basic-swatch {
    width: 13px;
    height: 13px;
    border: 1px solid rgba(255, 183, 1, 0.75);
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
}

#view-graphics #gfx-border-thick-val {
    color: var(--border-cream);
    font-size: 0.66rem;
    width: 12px;
    line-height: 1;
    text-align: left;
}

#view-graphics .gfx-basic-swatch:hover {
    transform: translateY(-1px);
}

#view-graphics #gfx-page-loader-body .btn-green.active,
#view-graphics #gfx-page-loader-body .btn-gray.active {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.25) inset;
}

#view-graphics #gfx-pages .file-item.gfx-page-done {
    opacity: 0.8;
}

/* Graphics workspace embedded in work flow */
#view-work .work-graphics-workspace-host #gfx-right-sidebar .file-item {
    border-bottom: 1px solid rgba(255, 183, 1, 0.2);
}

#view-work .work-graphics-workspace-host #gfx-right-sidebar .file-item.active {
    background: rgba(255, 183, 1, 0.18);
    color: var(--gold-accent);
}

#view-work .work-graphics-workspace-host #gfx-page-loader-body.is-collapsed {
    display: none !important;
}

#view-work .work-graphics-workspace-host #gfx-source-body.is-collapsed,
#view-work .work-graphics-workspace-host #gfx-inpaint-body.is-collapsed {
    display: none !important;
}

#view-work .work-graphics-workspace-host .gfx-loader-top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 0 10px;
}

#view-work .work-graphics-workspace-host #gfx-book-context-label {
    margin: 0 10px;
    padding: 10px;
    background: var(--gold-accent);
    color: #111;
    text-align: center;
    font-weight: 700;
    border-radius: 6px;
    min-height: 20px;
}

/* In process graphics we use the process phase list/toolbar; hide standalone loader chrome */
#view-work .work-graphics-workspace-host .gfx-loader-top-actions,
#view-work .work-graphics-workspace-host #gfx-book-context-label,
#view-work .work-graphics-workspace-host .gfx-page-loader-head,
#view-work .work-graphics-workspace-host #gfx-page-loader-body {
    display: none !important;
}

#view-work .work-graphics-workspace-host .gfx-page-loader-head {
    position: relative;
    justify-content: center;
    text-align: center;
}

#view-work .work-graphics-workspace-host .gfx-page-loader-head #gfx-page-section-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

#view-work .work-graphics-workspace-host .gfx-source-mode-row {
    display: flex;
    gap: 8px;
}

#view-work .work-graphics-workspace-host .gfx-source-mode-row .gfx-source-btn {
    flex: 1 1 0;
}

#view-work .work-graphics-workspace-host .gfx-source-mode-row .gfx-source-btn.active {
    border-color: var(--gold-accent);
    background: rgba(255, 183, 1, 0.25);
    color: var(--gold-accent);
}

#view-work .work-graphics-workspace-host #gfx-page-loader-body .btn-green.active,
#view-work .work-graphics-workspace-host #gfx-page-loader-body .btn-gray.active {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.25) inset;
}

#view-work .work-graphics-workspace-host #gfx-pages .file-item.gfx-page-done {
    opacity: 0.8;
}

#view-graphics .gfx-library-modal-content,
#gfx-library-modal .gfx-library-modal-content {
    width: 860px;
    max-width: 92vw;
    height: 720px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    text-align: right;
    overflow: hidden;
}

#view-graphics .gfx-library-grid,
#gfx-library-modal .gfx-library-grid {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid rgba(255,183,1,0.25);
    border-radius: 8px;
    background: rgba(0,0,0,0.25);
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
    align-content: start;
}

#view-graphics .gfx-library-grid .inv-tile img,
#gfx-library-modal .gfx-library-grid .inv-tile img {
    width: 100%;
    height: 110px;
    object-fit: contain;
    display: block;
}

#view-graphics .gfx-library-grid-empty,
#gfx-library-modal .gfx-library-grid-empty {
    grid-column: 1 / -1;
    color: var(--border-cream);
    opacity: 0.8;
    text-align: center;
    padding: 16px 8px;
}

@media (max-width: 1100px) {
    #gfx-library-modal .gfx-library-grid {
        grid-template-columns: repeat(3, minmax(130px, 1fr));
    }
}

@media (max-width: 780px) {
    #gfx-library-modal .gfx-library-modal-content {
        width: 94vw;
        height: 86vh;
    }
    #gfx-library-modal .gfx-library-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

#gfx-save-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
#gfx-save-modal .modal-box {
    background: var(--panel-bg);
    border: 1px solid var(--gold-accent);
    padding: 20px;
    border-radius: 8px;
    width: 320px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    display: flex; flex-direction: column; gap: 10px;
}
#gfx-save-modal .modal-header { font-family: 'Mizrachi', sans-serif; font-size: 1.2rem; color: var(--gold-accent); margin-bottom: 5px; }
#gfx-save-modal .modal-label { font-size: 0.85rem; color: var(--border-cream); opacity: 0.8; margin-bottom: -5px; }
#gfx-save-modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.t-section-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
}
.t-settings-divider {
    height: 1px;
    background: var(--gold-accent);
    opacity: 0.4;
    margin: 4px 0;
}
.t-book-config-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,183,1,0.3);
}
.t-field-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1 1 0;
}
.t-source-row {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    flex-wrap: nowrap;
    justify-content: space-between;
}
.t-source-divider {
    width: 1px;
    height: 70px;
    background: var(--gold-accent);
    opacity: 0.5;
    align-self: center;
    margin: 0 24px;
}
.table-wrap {
    position: relative;
}
.table-refresh {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 4px;
    border: 1px solid var(--gold-accent);
    background: rgba(0,0,0,0.4);
    color: var(--gold-accent);
    cursor: pointer;
    font-size: 16px;
    line-height: 24px;
}
.table-refresh:hover {
    background: rgba(255,183,1,0.2);
}
.lib-toolbar-divider {
    height: 26px;
    align-self: center;
    margin: 0 16px;
}
.lib-refresh-group {
    margin-right: auto;
    display: flex;
    gap: 8px;
}
.t-field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.t-book-check-status {
    color: var(--border-cream);
    font-size: 0.9rem;
}
.t-field-row.is-dimmed {
    opacity: 0.4;
}
.t-field-row.is-dimmed * {
    pointer-events: none;
}
.t-field-group.is-dimmed {
    opacity: 0.4;
}
.t-field-group.is-dimmed * {
    pointer-events: none;
}
.t-checkbox.is-dimmed {
    opacity: 0.4;
}
.control-debug-frame {
    margin-top: 16px;
    padding: 12px;
    border: 2px dashed var(--gold-accent);
    background: rgba(0,0,0,0.15);
}
.control-debug-head {
    color: var(--gold-accent);
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.control-debug-copy {
    margin-right: auto;
    padding: 4px 10px;
    font-size: 0.8rem;
    height: 26px;
}
.control-debug-log {
    max-height: 220px;
    overflow-y: auto;
    background: #111;
    border: 1px solid var(--border-cream);
    padding: 8px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--border-cream);
    white-space: pre-wrap;
    user-select: text;
}
.t-radio, .t-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--border-cream);
    cursor: pointer;
}
.t-radio-note {
    font-size: 0.85rem;
    color: var(--border-cream);
    opacity: 0.8;
}
#t-process-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#t-process-controls .t-radio,
#t-process-controls .t-checkbox {
    gap: 10px;
}
#t-process-controls .t-radio + .t-radio,
#t-process-controls .t-checkbox + .t-checkbox {
    margin-top: 2px;
}
#t-translation-source-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#t-translation-source-section .t-radio + .t-radio {
    margin-top: 0;
}
.t-radio-label {
    font-weight: 600;
}
.t-radio input, .t-checkbox input {
    cursor: pointer;
}
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    display: inline-block;
    position: relative;
}
input[type="radio"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
    opacity: 0;
    display: block;
}
input[type="radio"]:checked::after {
    opacity: 1;
}
input[type="radio"]:disabled {
    opacity: 0.6;
}
.t-setup-section #t-book-config-btn {
    width: fit-content;
}
.t-setup-section #t-open-inventory {
    width: fit-content;
}
.t-field-actions {
    display: flex;
    align-items: center;
    margin-top: 4px;
}
.t-book-row {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: flex-start;
}
.t-book-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.t-book-preview {
    min-width: 140px;
    max-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--gold-accent);
    background: rgba(0,0,0,0.3);
    margin-left: auto;
}
.t-book-preview img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background: #111;
    border: 1px solid rgba(255,183,1,0.4);
}
.t-book-preview .t-book-name {
    font-size: 0.85rem;
    color: var(--gold-accent);
    text-align: center;
}
.t-subtitle {
    font-size: 0.75rem;
    color: var(--border-cream);
    opacity: 0.7;
    margin-right: 22px;
}
.t-page-title {
    font-family: 'Mizrachi';
    font-size: 2.2rem;
    color: var(--gold-accent);
    margin: 10px 16px 0;
}
.t-start-row {
    display: flex;
    justify-content: center;
    margin-top: 8px;
    gap: 10px;
    position: relative;
}
.t-start-row .btn-green {
    min-width: 180px;
    transform: translateX(10%);
}
.t-start-row .btn-blue {
    transform: translateX(-6%);
}
#t-selection-grid .t-select-page {
    -webkit-appearance: none;
    appearance: none;
    width: 33px;
    height: 33px;
    border: 2px solid #ffd400;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.45);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
#t-selection-grid .t-select-page::after {
    content: "✓";
    color: #111;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    opacity: 0;
}
#t-selection-grid .t-select-page:checked {
    background: #ffd400;
    border-color: #ffd400;
}
#t-selection-grid .t-select-page:checked::after {
    opacity: 1;
}

/* --- TOOLBARS --- */
.toolbar {
    display: flex; align-items: center; background: var(--panel-bg);
    padding: 5px 10px; border: 1px solid var(--gold-accent);
    border-radius: 4px; height: 60px; flex-shrink: 0; gap: 10px;
}
.middle-toolbar { flex-grow: 1; display: flex; justify-content: space-evenly; height: 100%; }
.control-group { display: flex; align-items: center; gap: 10px; height: 100%; }
.lib-series-group { margin-right: 0; }
.divider { width: 1px; height: 30px; background: var(--gold-accent); opacity: 0.5; margin: 0 5px; }

#view-work .w-editor-shell-toolbar {
    direction: ltr;
    justify-content: flex-start;
    gap: 8px;
    padding: 3px 8px;
    height: 48px;
}

#view-work .w-editor-shell-fixed {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 0;
}

#view-work .w-editor-shell-left {
    direction: ltr;
}

#view-work .w-editor-shell-left .btn-green {
    min-width: 48px;
    height: 28px;
    padding: 0 7px;
}

#view-work .w-editor-shell-edit {
    direction: rtl;
}

#view-work .w-editor-shell-edit .btn-blue,
#view-work .w-editor-shell-edit .btn-gray {
    min-width: 74px;
    height: 30px;
    padding: 0 10px;
    white-space: nowrap;
}

#view-work .w-editor-shell-middle {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    height: 0;
    min-height: 0;
    padding: 0;
    gap: 0;
    border: 0;
    background: transparent;
    pointer-events: none;
    overflow: visible;
    z-index: 30;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell .divider {
    display: none !important;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell .w-editor-shell-fixed {
    pointer-events: auto;
    background: var(--panel-bg);
    border: 1px solid var(--gold-accent);
    border-radius: 4px;
    padding: 3px 6px;
    box-sizing: border-box;
    height: 82px;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell .w-editor-shell-left {
    position: absolute;
    left: 0;
    top: 0;
    width: 196px;
    justify-content: center;
    align-items: center;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell .w-editor-shell-right {
    position: absolute;
    right: 0;
    top: 0;
    margin-left: 0;
    width: 196px;
    justify-content: space-between;
    align-items: center;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell .w-editor-shell-middle {
    display: flex;
    align-items: flex-start;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(820px, calc(100% - 320px));
    pointer-events: auto;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    overflow: visible;
    min-height: 0;
}

#view-work #w-toolbar-editor-shell .w-editor-dirty-indicator {
    position: absolute;
    top: 50px;
    left: 196px;
    right: 196px;
    height: 82px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 40;
}

#view-work #w-toolbar-editor-shell .w-editor-dirty-message {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    direction: ltr;
    color: var(--gold-accent);
    font-weight: bold;
    font-size: 1.38rem;
    line-height: 1.35;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

#view-work #w-toolbar-editor-shell .w-editor-dirty-ellipsis,
#view-work #w-toolbar-editor-shell .w-editor-dirty-text {
    unicode-bidi: isolate;
}

#view-work #w-toolbar-editor-shell .w-editor-dirty-ellipsis {
    margin-right: 0.28em;
}

#view-work[data-overlay-phase="cleaning"] #w-toolbar-editor-shell #w-editor-shell-middle {
    display: none !important;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell .w-editor-shell-middle > * {
    flex: 0 0 auto;
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-sizing: border-box;
    margin: 0 !important;
    min-height: 0;
    box-shadow: none;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-toolbar-graphics,
#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-toolbar-publishing,
#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-final-toolbar-host,
#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-final-toolbar-host .toolbar {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    align-items: flex-start;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-cleaning-toolbar-host .middle-toolbar,
#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-toolbar-graphics,
#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-final-toolbar-host .toolbar > .control-group,
#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-toolbar-publishing .control-group {
    background: var(--panel-bg);
    border: 1px solid var(--gold-accent);
    border-radius: 4px;
    padding: 3px 8px;
    box-sizing: border-box;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-toolbar-publishing .control-group {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

#view-work.overlay-editor-mode #w-toolbar-editor-shell #w-final-toolbar-host .toolbar {
    background: transparent;
    border: 0;
    padding: 0;
}

#view-work .w-editor-shell-middle > * {
    flex: 1 1 auto;
    min-width: 0;
}

#view-work .w-editor-shell-right {
    direction: rtl;
    margin-left: auto;
    justify-content: flex-end;
}

#view-work .w-editor-shell-right .btn-red,
#view-work .w-editor-shell-right .btn-green {
    min-width: 54px;
    height: 28px;
    padding: 0 7px;
}

#view-work .w-editor-shell-right .auto-check {
    margin-right: 0;
}

#view-work .w-editor-shell-right .auto-check span {
    display: block;
    width: 100%;
    text-align: center;
}

#view-work .w-editor-shell-right .auto-check span,
#view-work .w-editor-shell-left .zoom-val {
    font-size: 0.84rem;
}

#view-work .w-editor-shell-left .zoom-box {
    transform: scale(0.94);
    transform-origin: left center;
}

#view-work .w-editor-shell-middle .toolbar,
#view-work #w-cleaning-toolbar-host .toolbar,
#view-work #w-final-toolbar-host .toolbar {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    height: auto;
    min-height: 0;
    width: 100%;
    box-shadow: none;
}

#view-cleaning .middle-toolbar,
#view-work #w-cleaning-toolbar-host .middle-toolbar {
    justify-content: flex-start;
    direction: rtl;
    gap: 3px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 0 0;
    scrollbar-width: thin;
}

#view-cleaning .clean-toolbar-group,
#view-work #w-cleaning-toolbar-host .clean-toolbar-group {
    flex-shrink: 0;
    gap: 6px;
}

#view-cleaning .clean-group-pages,
#view-work #w-cleaning-toolbar-host .clean-group-pages {
    min-width: 210px;
    justify-content: flex-start;
}

#view-cleaning .clean-group-erased-toggle,
#view-work #w-cleaning-toolbar-host .clean-group-erased-toggle {
    min-width: 92px;
    justify-content: center;
}

#view-cleaning .clean-group-zap,
#view-work #w-cleaning-toolbar-host .clean-group-zap {
    min-width: 92px;
    justify-content: flex-start;
}

#view-cleaning .clean-group-zap > .clean-preserve-group,
#view-cleaning .clean-group-zap > .clean-inline-settings-zap,
#view-cleaning .clean-group-zap > .clean-swatch-wrap,
#view-work #w-cleaning-toolbar-host .clean-group-zap > .clean-preserve-group,
#view-work #w-cleaning-toolbar-host .clean-group-zap > .clean-inline-settings-zap,
#view-work #w-cleaning-toolbar-host .clean-group-zap > .clean-swatch-wrap {
    display: none !important;
}

#view-cleaning .clean-group-paint-line,
#view-cleaning .clean-group-area-brush,
#view-cleaning .clean-group-clone-stamp,
#view-cleaning .clean-group-smart-erase,
#view-cleaning .clean-group-paint-bound,
#view-cleaning .clean-group-copy-area,
#view-cleaning .clean-group-lasso,
#view-cleaning .clean-group-edit,
#view-cleaning .clean-group-zoom,
#view-work #w-cleaning-toolbar-host .clean-group-paint-line,
#view-work #w-cleaning-toolbar-host .clean-group-area-brush,
#view-work #w-cleaning-toolbar-host .clean-group-clone-stamp,
#view-work #w-cleaning-toolbar-host .clean-group-smart-erase,
#view-work #w-cleaning-toolbar-host .clean-group-paint-bound,
#view-work #w-cleaning-toolbar-host .clean-group-copy-area,
#view-work #w-cleaning-toolbar-host .clean-group-lasso,
#view-work #w-cleaning-toolbar-host .clean-group-edit,
#view-work #w-cleaning-toolbar-host .clean-group-zoom {
    justify-content: center;
}

#view-cleaning .clean-group-zoom,
#view-work #w-cleaning-toolbar-host .clean-group-zoom {
    direction: ltr;
}

#view-cleaning .clean-inline-settings {
    display: none;
}

/* Process-mode cleaning toolbar layout:
   keep pages at right, pin zoom at far left, and spread groups between. */
#view-work #w-cleaning-toolbar-host .middle-toolbar {
    justify-content: flex-start;
    align-items: center;
    direction: ltr;
    gap: 10px;
    padding: 0 8px;
    flex-wrap: nowrap;
}

#view-work #w-cleaning-toolbar-host .middle-toolbar > .divider {
    display: none;
}

#view-work #w-toolbar-editor-shell #w-cleaning-toolbar-host {
    display: flex;
    min-width: 0;
}

#view-work #w-cleaning-toolbar-host .clean-group-pages,
#view-work #w-cleaning-toolbar-host .clean-group-edit,
#view-work #w-cleaning-toolbar-host .clean-group-zap,
#view-work #w-cleaning-toolbar-host .clean-group-paint-line,
#view-work #w-cleaning-toolbar-host .clean-group-area-brush,
#view-work #w-cleaning-toolbar-host .clean-group-clone-stamp,
#view-work #w-cleaning-toolbar-host .clean-group-smart-erase,
#view-work #w-cleaning-toolbar-host .clean-group-paint-bound,
#view-work #w-cleaning-toolbar-host .clean-group-copy-area,
#view-work #w-cleaning-toolbar-host .clean-group-lasso {
    direction: rtl;
}

#view-work #w-cleaning-toolbar-host .clean-group-zoom {
    order: 1;
}

#view-work #w-cleaning-toolbar-host .clean-group-edit {
    order: 2;
}

#view-work #w-cleaning-toolbar-host .clean-group-zap {
    order: 3;
    display: none;
    flex: 1 1 auto;
    min-width: 0;
}

#view-work #w-cleaning-toolbar-host .clean-group-paint-line {
    order: 4;
    display: none;
}

#view-work #w-cleaning-toolbar-host .clean-group-area-brush {
    order: 5;
    display: none;
}

#view-work #w-cleaning-toolbar-host .clean-group-clone-stamp {
    order: 7;
    display: none;
}

#view-work #w-cleaning-toolbar-host .clean-group-smart-erase {
    order: 8;
    display: none;
}

#view-work #w-cleaning-toolbar-host .clean-group-paint-bound {
    order: 9;
    display: none;
}

#view-work #w-cleaning-toolbar-host .clean-group-copy-area {
    order: 10;
    display: none;
}

#view-work #w-cleaning-toolbar-host .clean-group-lasso {
    order: 11;
    display: none;
}

#view-work #w-cleaning-toolbar-host .clean-group-pages {
    order: 12;
    margin-left: auto;
}

#view-work #w-cleaning-toolbar-host .clean-group-erased-toggle {
    order: 10;
    margin-left: auto;
    direction: rtl;
}

#view-work #w-cleaning-toolbar-host[data-clean-action="zap"] .clean-group-zap,
#view-work #w-cleaning-toolbar-host[data-clean-action="clean-assist"] .clean-group-zap,
#view-work #w-cleaning-toolbar-host[data-clean-action="stuck-sever"] .clean-group-zap,
#view-work #w-cleaning-toolbar-host[data-clean-action="gap-assist"] .clean-group-zap,
#view-work #w-cleaning-toolbar-host[data-clean-action="lasso"] .clean-group-zap,
#view-work #w-cleaning-toolbar-host[data-clean-action="line-brush"] .clean-group-paint-line,
#view-work #w-cleaning-toolbar-host[data-clean-action="area-brush"] .clean-group-area-brush,
#view-work #w-cleaning-toolbar-host[data-clean-action="clone-stamp"] .clean-group-clone-stamp,
#view-work #w-cleaning-toolbar-host[data-clean-action="smart-erase"] .clean-group-smart-erase,
#view-work #w-cleaning-toolbar-host[data-clean-action="paint-bound"] .clean-group-paint-bound,
#view-work #w-cleaning-toolbar-host[data-clean-action="copy-area"] .clean-group-copy-area {
    display: flex;
}

#view-work #w-cleaning-toolbar-host .clean-tool-button-wrap,
#view-work #w-cleaning-toolbar-host .clean-toolbar-tool-btn,
#view-work #w-cleaning-toolbar-host .clean-tool-settings-btn {
    display: none !important;
}

#view-work #w-cleaning-toolbar-host .clean-inline-settings {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#view-work #w-cleaning-toolbar-host .clean-inline-stepper {
    min-width: 86px;
}

#view-work #w-cleaning-toolbar-host .clean-group-zap .clean-preserve-group {
    margin-left: 6px;
}

#view-work #w-cleaning-toolbar-host .clean-group-zap .clean-swatch-wrap {
    margin-right: auto;
}

#view-work #w-toolbar-editor-shell #w-cleaning-toolbar-host .middle-toolbar {
    padding: 0;
    gap: 12px;
}

#view-work #w-toolbar-editor-shell #w-cleaning-toolbar-host .clean-group-pages,
#view-work #w-toolbar-editor-shell #w-cleaning-toolbar-host .clean-group-edit,
#view-work #w-toolbar-editor-shell #w-cleaning-toolbar-host .clean-group-zoom {
    display: none;
}

#view-work #w-toolbar-editor-shell #w-cleaning-toolbar-host .clean-group-zap {
    flex: 1 1 auto;
    min-width: 0;
}

#view-cleaning .clean-preserve-group,
#view-work #w-cleaning-toolbar-host .clean-preserve-group {
    min-width: 58px;
}

#view-cleaning .clean-tool-button-wrap,
#view-work #w-cleaning-toolbar-host .clean-tool-button-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 26px; /* reserve room for the superscript settings icon */
}

#view-cleaning .clean-main-btn,
#view-work #w-cleaning-toolbar-host .clean-main-btn {
    min-width: 64px;
    height: 34px;
}

#view-cleaning .clean-tool-settings-btn,
#view-work #w-cleaning-toolbar-host .clean-tool-settings-btn {
    position: absolute;
    top: -14px;
    left: -24px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #ddd;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.88;
    z-index: 2;
}

#view-cleaning .clean-tool-settings-btn:hover,
#view-work #w-cleaning-toolbar-host .clean-tool-settings-btn:hover {
    color: var(--gold-accent);
    opacity: 1;
}

#view-cleaning .clean-tool-settings-btn:focus-visible,
#view-work #w-cleaning-toolbar-host .clean-tool-settings-btn:focus-visible {
    outline: 1px solid rgba(255, 183, 1, 0.65);
    outline-offset: 1px;
}

/* --- INVENTORY STYLES --- */
.dark-select {
    background: #222; color: var(--border-cream); border: 1px solid var(--gold-accent);
    padding: 5px 10px; border-radius: 4px; outline: none; font-family: inherit;
}
.inventory-table-container {
    flex: 1; overflow: auto; border: 2px solid var(--gold-accent); background: rgba(0,0,0,0.2);
}
.inv-table { width: 100%; border-collapse: collapse; text-align: right; }
.inv-table th {
    background: rgba(255, 183, 1, 0.15); color: var(--gold-accent);
    padding: 12px 15px; position: sticky; top: 0; border-bottom: 2px solid var(--gold-accent);
}
.inv-table td { padding: 10px 15px; border-bottom: 1px solid rgba(245, 240, 206, 0.1); color: var(--border-cream); }
.inv-table tr:hover { background: rgba(255, 255, 255, 0.05); }

/* Badges */
.badge {
    padding: 3px 8px; border-radius: 12px; font-size: 0.8rem; font-weight: bold;
    color: white; display: inline-block; min-width: 80px; text-align: center;
}
.status-raw { background: var(--status-raw); }
.status-EditReady { background: var(--status-edit); }
.status-TextClean { background: var(--status-textclean); }
.status-EffectsClean { background: #138496; }
.status-Translated { background: var(--status-trans); }
.status-EffectsNew { background: #e83e8c; }
.status-ProofReady { background: var(--status-proof); }
.status-Complete { background: var(--status-complete); }
.status-ProcessingOCR { background: #f0ad4e; }
.status-ProcessingTranslation { background: #17a2b8; }
.status-ReadyforFinalEdit { background: #28a745; }

/* --- MODAL --- */
.modal {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0,0,0,0.8);
    justify-content: center; align-items: center;
}
.modal-content {
    background: var(--panel-bg); border: 2px solid var(--gold-accent);
    padding: 25px; width: 400px; border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8); text-align: center;
}
.form-group { margin-bottom: 15px; text-align: right; }
.form-group label { display: block; color: var(--gold-accent); margin-bottom: 5px; font-size: 0.9rem;}
.form-group input, .form-group select {
    width: 100%; padding: 8px; box-sizing: border-box;
    background: #222; border: 1px solid #555; color: white; border-radius: 4px;
}
.modal-actions { display: flex; justify-content: space-between; margin-top: 20px; }

/* --- MODULE A: TRANSLATION CSS --- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; overflow-y: auto; padding-bottom: 20px;}
.card { background: rgba(0,0,0,0.3); padding: 10px; border: 2px solid var(--gold-accent); text-align: center; }
.card img { width: 100%; height: 200px; object-fit: cover; border: 1px solid #fff; }
.editor-container { display: flex; gap: 20px; height: 100%; }
.editor-left { flex: 2; background: #222; border: 2px solid var(--gold-accent); overflow: auto; position: relative; }
.editor-right { flex: 1; background: rgba(0,0,0,0.3); border: 2px solid var(--gold-accent); padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.t-font-size-panel {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(255,183,1,0.3);
    border-radius: 6px;
    background: rgba(0,0,0,0.18);
}
.t-rich-toolbar {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    min-height: 34px;
}
.t-simple-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.t-editor-target-kind {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(255, 183, 1, 0.18);
    border: 1px solid rgba(255, 183, 1, 0.35);
    color: #ffe8a6;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.t-editor-target-kind.is-rich {
    background: rgba(34, 162, 255, 0.18);
    border-color: rgba(34, 162, 255, 0.35);
    color: #cfeaff;
}
.t-editor-target-kind.is-bubble {
    background: rgba(255, 183, 1, 0.18);
    border-color: rgba(255, 183, 1, 0.35);
    color: #ffe8a6;
}
.t-rich-select,
.t-rich-size {
    height: 30px;
    border: 1px solid rgba(255,183,1,0.38);
    border-radius: 6px;
    background: rgba(25, 15, 15, 0.88);
    color: var(--text-cream);
    padding: 0 8px;
}
.t-rich-select {
    min-width: 112px;
    max-width: 132px;
}
.t-rich-size {
    width: 62px;
    text-align: center;
}
.t-rich-apply,
.t-rich-style-btn {
    min-width: 34px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}
.t-rich-style-btn em,
.t-rich-style-btn strong {
    pointer-events: none;
}
.t-rich-color {
    width: 36px;
    height: 30px;
    padding: 2px;
    border: 1px solid rgba(255,183,1,0.38);
    border-radius: 6px;
    background: rgba(25, 15, 15, 0.88);
    cursor: pointer;
}

.t-rich-size:disabled,
.t-rich-color:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: saturate(0.2);
}
.t-font-scope-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.1;
}
.t-font-scope-col .t-checkbox {
    margin: 0;
    white-space: nowrap;
}
.t-font-size-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}
.t-font-size-input {
    width: 100%;
    min-width: 0;
    padding: 7px 8px;
    box-sizing: border-box;
    background: #222;
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
    border-radius: 4px;
    text-align: center;
    font: inherit;
}
.t-font-size-row .btn-blue {
    min-width: 56px;
}
.t-validation-banner {
    display: none;
    margin: 8px 10px 0;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 213, 90, 0.55);
    background: rgba(0, 0, 0, 0.32);
    color: var(--border-cream);
    font-size: 0.9rem;
    line-height: 1.45;
    text-align: right;
}
.t-validation-banner.is-alert {
    border-color: rgba(255, 213, 90, 0.82);
    color: #ffe69a;
}
.t-validation-banner.is-repaired {
    border-color: rgba(120, 225, 155, 0.78);
    color: #c8f7d1;
}
.t-page-warning-banner {
    border-color: rgba(255, 213, 90, 0.82);
    color: #ffe69a;
    font-weight: 700;
}
.t-page-warning-overlay {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    max-width: min(86%, 760px);
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 213, 90, 0.82);
    background: rgba(32, 10, 6, 0.82);
    color: #ffe69a;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
    direction: rtl;
}
.final-editor-scroll,
#t-editor-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.final-editor-scroll::-webkit-scrollbar,
#t-editor-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
    background: transparent;
}
@media (max-width: 980px) {
    .t-final-side-panel {
        flex-basis: 172px;
        min-width: 160px;
        padding: 10px;
    }
}

/* --- MODULE B: CLEANING CSS --- */
.app-body { display: flex; flex: 1; gap: 20px; overflow: hidden; }
.sidebar { width: 260px; background: rgba(0,0,0,0.3); border: 2px solid var(--gold-accent); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 10px; background: rgba(0,0,0,0.6); color: var(--border-cream); border-bottom: 1px solid var(--gold-accent); text-align: center; font-weight: bold; }
#c-filename-header { padding: 10px; background: var(--gold-accent); color: #000; text-align: center; font-weight: bold; }
#fileList { overflow-y: auto; flex: 1; }
.file-item { padding: 10px; cursor: pointer; border-bottom: 1px solid rgba(255,183,1,0.2); direction: ltr; text-align: right; }
.file-item:hover { background: rgba(255,183,1,0.2); color: var(--gold-accent); }
.file-item.clean-ready { position: relative; padding-left: 26px; }
.file-item.clean-ready::before { content: "✔"; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: #3fd26b; font-weight: 900; font-size: 14px; }
.workspace { flex: 1; position: relative; background-color: #1a1a1a; border: 2px solid var(--gold-accent); overflow: hidden; cursor: crosshair; }
.image-container { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; transform-origin: 0 0; position: relative; }
#comic-image { max-width: 95%; max-height: 95%; box-shadow: 0 0 20px rgba(0,0,0,0.5); display: none; pointer-events: none; border: 2px solid #fff; }

.empty-state { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--border-cream); font-size: 1.5rem; opacity: 0.7; }
.brush-cursor {
    position: fixed;
    border: 2px solid rgba(0,100,255,0.9);
    background: rgba(135,206,250,0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    display: none;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}
.brush-cursor::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.55);
    transform: translate(-50%, -50%);
}
.gap-assist-cursor {
    border: 2px solid rgba(255, 166, 0, 0.95);
    background-color: rgba(0, 0, 0, 0.22);
    border-radius: 2px;
    background-image:
        linear-gradient(to right, transparent calc(50% - 1px), rgba(255, 208, 132, 0.95) calc(50% - 1px), rgba(255, 208, 132, 0.95) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(to bottom, transparent calc(50% - 1px), rgba(255, 208, 132, 0.95) calc(50% - 1px), rgba(255, 208, 132, 0.95) calc(50% + 1px), transparent calc(50% + 1px));
}
.clean-assist-cursor {
    border: 3px solid rgba(35, 148, 255, 0.98);
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    background-image:
        linear-gradient(to right, transparent calc(50% - 1px), rgba(220, 20, 60, 0.98) calc(50% - 1px), rgba(220, 20, 60, 0.98) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(to bottom, transparent calc(50% - 1px), rgba(220, 20, 60, 0.98) calc(50% - 1px), rgba(220, 20, 60, 0.98) calc(50% + 1px), transparent calc(50% + 1px));
}
.stuck-sever-cursor {
    border: 3px solid rgba(255, 255, 255, 0.98);
    background-color: rgba(255, 255, 255, 0.20);
    border-radius: 2px;
    background-image:
        linear-gradient(to right, transparent calc(50% - 1px), rgba(35, 148, 255, 0.98) calc(50% - 1px), rgba(35, 148, 255, 0.98) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(to bottom, transparent calc(50% - 1px), rgba(35, 148, 255, 0.98) calc(50% - 1px), rgba(35, 148, 255, 0.98) calc(50% + 1px), transparent calc(50% + 1px));
}
.gap-assist-point { position: absolute; border: 1px solid #ffb348; background: rgba(255, 179, 72, 0.14); border-radius: 1px; transform: translate(-50%,-50%); pointer-events: none; z-index: 11; }
.stuck-sever-line-mark { position: absolute; background: transparent; border: 1px solid rgba(255, 40, 40, 0.96); border-radius: 3px; box-shadow: 0 0 3px rgba(255, 0, 0, 0.45); transform-origin: 0 50%; pointer-events: none; z-index: 12; }
.stuck-sever-circle-mark { position: absolute; background: transparent; border: 2px solid rgba(255, 35, 35, 0.96); border-radius: 999px; box-shadow: 0 0 4px rgba(255, 0, 0, 0.45); pointer-events: none; z-index: 12; }
.stuck-sever-endpoint-mark { position: absolute; background: rgba(35, 148, 255, 0.98); border: none; border-radius: 999px; box-shadow: none; pointer-events: none; z-index: 13; }
.stepper-container { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--gold-accent); padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,0.3); }
.stepper-label { font-size: 0.65rem; color: var(--gold-accent); margin-bottom: 2px; }
.stepper-row { display: flex; align-items: center; gap: 5px; }
.step-btn { width: 18px; height: 18px; line-height: 16px; padding: 0; background: var(--border-cream); color: black; border:none; }
.step-val { font-size: 0.9rem; font-weight: bold; width: 25px; text-align: center; color: white; }
.zoom-box { display: flex; align-items: center; border: 1px solid var(--gold-accent); border-radius: 4px; background: #000; height: 36px; }
.zoom-btn { background: transparent; padding: 0 10px; font-weight: bold; color: var(--border-cream); border: none; font-size: 1.2rem; }
.zoom-val { background: white; color: black; font-weight: bold; padding: 0 5px; height: 24px; line-height: 24px; min-width: 40px; text-align: center; font-size: 0.8rem; }
.auto-check { display: flex; flex-direction: column; align-items: center; color: var(--border-cream); font-size: 0.75rem; margin-right: 15px; }
.preserve-group { display: flex; flex-direction: column; gap: 2px; }
.toggle-opt { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--border-cream); cursor: pointer; }
.clean-swatch-wrap { display: flex; align-items: center; gap: 6px; padding: 2px 6px; border: 1px solid rgba(255,183,1,0.4); border-radius: 4px; background: rgba(0,0,0,0.35); }
.clean-swatch-label { font-size: 0.68rem; color: var(--gold-accent); line-height: 1; }
.clean-fill-swatch { width: 20px; height: 20px; border: 1px solid rgba(245,240,206,0.7); border-radius: 3px; background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2); cursor: pointer; }
.clean-fill-value { font-size: 0.62rem; color: var(--border-cream); min-width: 60px; direction: ltr; text-align: left; letter-spacing: 0.2px; }
.clean-fill-reset { width: 16px; height: 16px; border: 1px solid rgba(245,240,206,0.45); border-radius: 50%; background: rgba(0,0,0,0.45); color: var(--border-cream); font-size: 11px; line-height: 10px; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.clean-fill-reset:hover { border-color: var(--gold-accent); color: var(--gold-accent); }

#view-cleaning .clean-group-zap .clean-swatch-wrap,
#view-work #w-cleaning-toolbar-host .clean-group-zap .clean-swatch-wrap {
    padding: 1px 5px;
    gap: 4px;
}

#view-cleaning .clean-group-zap .clean-swatch-label,
#view-work #w-cleaning-toolbar-host .clean-group-zap .clean-swatch-label {
    font-size: 0.62rem;
}

#view-cleaning .clean-group-zap .clean-fill-swatch,
#view-work #w-cleaning-toolbar-host .clean-group-zap .clean-fill-swatch {
    width: 18px;
    height: 18px;
}

#view-cleaning .clean-group-zap .clean-fill-reset,
#view-work #w-cleaning-toolbar-host .clean-group-zap .clean-fill-reset {
    width: 14px;
    height: 14px;
    font-size: 10px;
}

.clean-mini-settings-modal {
    position: fixed;
    width: 260px;
    max-width: calc(100vw - 16px);
    padding: 10px 10px 12px;
    background: var(--panel-bg);
    border: 1px solid var(--gold-accent);
    border-radius: 8px;
    z-index: 2600;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
    direction: rtl;
}

.clean-mini-settings-head {
    display: flex;
    direction: ltr;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    cursor: grab;
    user-select: none;
}

.clean-mini-settings-modal.is-dragging .clean-mini-settings-head {
    cursor: grabbing;
}

.clean-mini-title {
    margin-left: auto;
    color: var(--gold-accent);
    font-weight: 700;
    font-size: 0.95rem;
}

.clean-mini-settings-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clean-modal-stepper-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.clean-modal-stepper-row .stepper-container {
    min-width: 0;
}

.clean-modal-preserve-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    padding: 8px;
    border: 1px solid rgba(255,183,1,0.28);
    border-radius: 6px;
    background: rgba(0,0,0,0.18);
}

.clean-modal-preserve-group .toggle-opt:last-child {
    grid-column: 1 / -1;
}

.clean-modal-assist-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.clean-modal-assist-row .clean-toolbar-tool-btn {
    width: 100%;
    min-height: 30px;
}

.clean-modal-swatch-wrap {
    display: none !important;
}

.clean-zap-sidebar-swatch {
    width: 100%;
    min-height: 34px;
    box-sizing: border-box;
    justify-content: space-between;
}

.clean-zap-sidebar-swatch .clean-fill-value {
    min-width: 54px;
    text-align: left;
}

.clean-modal-paint-swatches {
    display: inline-grid;
    justify-content: center;
    gap: 7px;
    flex: 0 0 auto;
}

.clean-modal-paint-color-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    flex-wrap: nowrap;
}

.clean-modal-paint-color-wrap {
    justify-content: flex-start;
    flex: 0 0 auto;
}

.clean-modal-slider-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: center;
}

.clean-line-brush-settings-modal {
    width: 334px;
    min-height: 264px;
    padding: 14px 14px 18px;
}

.clean-line-brush-settings-modal .clean-mini-settings-body {
    align-items: center;
    gap: 18px;
}

.clean-line-brush-settings-modal .clean-mini-settings-head {
    margin-bottom: 16px;
}

.clean-line-brush-presets {
    --clean-line-preset-size: 52px;
    display: grid;
    grid-template-columns: repeat(3, var(--clean-line-preset-size)) 8px var(--clean-line-preset-size);
    gap: 3px;
    width: 100%;
    justify-content: center;
}

.clean-line-brush-preset-btn {
    width: var(--clean-line-preset-size);
    min-height: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 3px 5px;
    background: #050505 !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
}

.clean-line-brush-preset-blend {
    margin-top: 0;
}

.clean-line-brush-preset-spacer {
    display: block;
    width: 8px;
    height: 38px;
    min-height: 38px;
    position: relative;
    pointer-events: none;
}

.clean-line-brush-preset-spacer::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 6px;
    bottom: 6px;
    width: 1px;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.16);
}

.clean-line-brush-preset-icon {
    display: block;
    width: 28px;
    border-radius: 999px;
    background: #ffffff;
}

.clean-line-brush-preset-icon-hard {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.05);
}

.clean-line-brush-preset-icon-soft {
    background: rgba(255,255,255,0.78);
    box-shadow: 0 0 6px rgba(255,255,255,0.42);
}

.clean-line-brush-preset-icon-blend {
    background: rgba(255,255,255,0.42);
    box-shadow: 0 0 10px rgba(255,255,255,0.28);
    filter: blur(0.55px);
}

.clean-line-brush-preset-icon-narrow {
    height: 3px;
}

.clean-line-brush-preset-icon-regular {
    height: 7px;
}

.clean-line-brush-preset-icon-large {
    height: 10px;
}

.clean-line-brush-preset-icon-xl {
    width: 28px;
    height: 10px;
}

.clean-line-brush-settings-modal .clean-modal-paint-color-row {
    margin-top: 6px;
    margin-bottom: 12px;
}

.clean-line-stepper-row {
    justify-content: center;
}

.clean-line-stepper-controls {
    min-width: 118px;
}

.clean-line-stepper-val {
    width: 58px;
    text-align: center;
}

.clean-line-stepper-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.clean-clone-stamp-settings-modal {
    width: 292px;
}

.clean-clone-stamp-settings-modal .clean-mini-settings-body {
    align-items: center;
}

.clean-clone-stepper-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.clean-clone-stepper-label {
    min-width: 72px;
    text-align: right;
    color: var(--gold-accent);
    font-size: 0.8rem;
}

.clean-clone-stepper-controls {
    justify-content: center;
    min-width: 108px;
}

.clean-clone-stepper-val {
    width: 52px;
}

.clean-clone-stepper-controls .step-btn {
    width: 24px;
    height: 24px;
    line-height: 22px;
    font-size: 1rem;
}

.clean-smart-erase-settings-modal,
.clean-copy-area-settings-modal {
    width: 420px;
}

.clean-paint-bound-settings-modal {
    width: 292px;
}

.clean-smart-erase-settings-modal .w-gfx-erase-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.clean-smart-erase-settings-modal .w-gfx-erase-main {
    order: 1;
}

.clean-smart-erase-settings-modal .w-gfx-erase-icons {
    order: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.clean-smart-erase-settings-modal .w-gfx-erase-icons .btn-blue,
.clean-smart-erase-settings-modal .w-gfx-erase-icons .btn-gray,
.clean-smart-erase-settings-modal .w-gfx-erase-icons .btn-green,
.clean-smart-erase-settings-modal .w-gfx-erase-icons .btn-red {
    min-width: 0;
    width: 100%;
}

.clean-smart-erase-settings-modal .w-gfx-erase-main {
    padding-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.clean-smart-erase-settings-modal .w-gfx-erase-radios-h {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    align-self: center;
}

.clean-smart-erase-settings-modal .c-smart-erase-grid .w-gfx-toolbar-slider {
    width: 100%;
    grid-template-columns: 46px minmax(0, 1fr) 30px;
    gap: 6px;
}

.clean-smart-erase-settings-modal .c-smart-erase-grid .w-gfx-slider-inline {
    width: 100%;
}

.clean-smart-erase-settings-modal #c-smart-erase-clear,
.clean-smart-erase-settings-modal #c-smart-erase-cancel {
    width: 100%;
    justify-self: stretch;
}

.clean-smart-erase-settings-modal #c-smart-erase-apply:not(:disabled) {
    transform: scale(1.04);
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 16px rgba(40, 167, 69, 0.28);
}

.clean-modal-action-btn {
    width: 100%;
    margin-top: 10px;
}

.clean-modal-hint {
    margin-top: 10px;
    text-align: right;
    line-height: 1.35;
}

.clean-smart-erase-mode-help {
    margin-top: 6px;
    color: rgba(245, 240, 206, 0.92);
    font-size: 0.8rem;
    line-height: 1.45;
}

.clean-processing-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 12, 0.14);
    backdrop-filter: blur(1px);
    pointer-events: none;
}

.clean-processing-overlay-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 183, 1, 0.34);
    border-radius: 10px;
    background: rgba(25, 20, 20, 0.86);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

.clean-processing-overlay.is-active .clean-processing-overlay-card {
    transform: translateY(-12px);
}

.clean-processing-overlay-text {
    color: var(--border-cream);
    font-size: 0.9rem;
    line-height: 1.2;
}

.clean-processing-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 183, 1, 0.24);
    border-top-color: var(--gold-accent);
    animation: clean-processing-spin 0.85s linear infinite;
}

@keyframes clean-processing-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.clean-mini-close,
.clean-mini-reset {
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--border-cream);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.clean-mini-close:hover,
.clean-mini-reset:hover {
    color: var(--gold-accent);
}

.clean-mini-reset {
    margin-left: auto;
}

.clean-mini-settings-body {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* --- EMPTY STATE & ACTION BUTTONS --- */
.empty-state { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    z-index: 100; 
    
    /* Container Styling */
    background: #1a1a1a; /* Solid background to hide underlying elements */
    padding: 40px;
    border-radius: 12px;
    border: 2px dashed var(--gold-accent);
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    
    /* Layout */
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    justify-content: center;
    min-width: 320px;
}

.empty-title {
    font-family: 'Mizrachi', sans-serif;
    font-size: 1.8rem;
    color: var(--gold-accent);
    margin: 0 0 10px 0;
    text-align: center;
}

.action-btn {
    display: grid !important;
    grid-template-columns: 1fr 30px;
    align-items: center;
    column-gap: 14px;
    
    width: 360px;
    height: 64px;
    padding: 0 16px;
    margin: 0;
    
    background: var(--panel-bg);
    border: 2px solid var(--border-cream);
    border-radius: 8px;
    color: var(--ink-white);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.action-btn:hover {
    border-color: var(--gold-accent);
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 183, 1, 0.2);
}

.action-btn span.icon {
    font-size: 1.6rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
}

.action-btn span.label {
    text-align: center;
    white-space: nowrap;
}

/* --- INFO VIEW --- */
.info-view {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: auto;
}
.info-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: right;
}
.info-title {
    color: var(--gold-accent);
    font-weight: bold;
    font-size: 1.6rem;
}
.info-subtitle {
    color: var(--border-cream);
    font-size: 0.95rem;
}
.info-hint {
    color: #c8c0a2;
    font-size: 0.8rem;
}
.info-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.info-card {
    border: 1px solid var(--gold-accent);
    background: rgba(0,0,0,0.25);
    padding: 14px;
}
.info-visual-card {
    background: var(--gold-accent);
    border-color: var(--gold-accent);
}
.info-visual-wrap {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: var(--gold-accent);
}
.info-visual-wrap img {
    width: 100%;
    height: auto;
    display: block;
    border: none;
    background: var(--gold-accent);
}
.info-caption {
    margin-top: 8px;
    color: #000;
    font-size: 0.85rem;
    text-align: center;
}
.info-hotspot {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: none;
}
.info-hotspot::after {
    content: none;
}
.info-hotspot:hover,
.info-hotspot:focus-visible,
.info-hotspot.active {
    opacity: 1;
}
.info-detail-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 260px;
}
.info-step-title {
    color: var(--gold-accent);
    font-weight: bold;
    font-size: 1.2rem;
}
.info-section-title {
    color: var(--gold-accent);
    font-weight: bold;
    font-size: 0.95rem;
    margin-top: 6px;
}
.info-text {
    color: var(--border-cream);
    line-height: 1.5;
    font-size: 0.95rem;
}

/* --- WORK HUB --- */
#view-work {
    position: relative;
    gap: 8px;
    overflow-y: auto;
}

#view-work .work-shell {
    display: grid;
    grid-template-columns: 196px minmax(0, 1fr) 196px;
    gap: 8px;
    flex: 1;
    min-height: 0;
    direction: ltr;
}

#view-work .work-col {
    border: 2px solid var(--gold-accent);
    background: rgba(0,0,0,0.32);
    display: flex;
    flex-direction: column;
    min-height: 0;
    direction: rtl;
    overflow: hidden;
}

#view-work .work-left-col {
    display: flex;
}

#view-work .work-center-col {
    position: relative;
    transition: opacity 150ms ease-out;
    will-change: opacity;
}

#view-work .work-placeholder,
#view-work .work-scan-mock,
#view-work .work-prepare-workspace,
#view-work .work-cleaning-workspace,
#view-work .work-graphics-workspace,
#view-work .work-final-workspace {
    transition: opacity 120ms ease-out;
}

#view-work .work-left-col .sidebar-header,
#view-work .work-center-col .sidebar-header,
#view-work .work-right-col .sidebar-header {
    border-bottom: 1px solid var(--gold-accent);
}

#view-work #w-center-header {
    display: none !important;
}

#view-work .work-center-header-title {
    display: none;
}

#view-work .w-phase-nav-toolbar {
    display: none;
    direction: ltr;
    align-items: center;
    justify-content: stretch;
    gap: 12px;
    min-height: 44px;
    height: 44px;
    padding: 4px 10px;
}

#view-work .w-phase-nav-toolbar.is-visible {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
}

#view-work .w-phase-nav-side {
    display: flex;
    align-items: center;
    min-width: 0;
}

#view-work .w-phase-nav-left {
    justify-content: flex-start;
}

#view-work .w-phase-nav-left .btn-red {
    min-width: 62px;
    height: 28px;
    padding: 0 10px;
}

#view-work .work-editor-phase-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    direction: rtl;
    margin: 0 auto;
}

#view-work .work-editor-phase-btn {
    width: auto;
    min-width: 104px;
    height: 30px;
    padding: 0 12px;
    justify-content: center;
}

#view-work .work-phase-btn.active {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.25) inset;
    background: rgba(255, 183, 1, 0.18);
    color: var(--gold-accent);
}

#view-work .work-phase-btn:disabled {
    opacity: 0.68;
    background: rgba(120, 120, 120, 0.18);
    color: rgba(255, 244, 210, 0.72);
    border-color: rgba(255, 183, 1, 0.16);
    cursor: default;
}

#view-work .work-phase-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px;
}

#view-work.overlay-editor-mode .work-left-col {
    padding-top: 74px;
    box-sizing: border-box;
}

#view-work.overlay-editor-mode .work-phase-meta {
    padding-top: 14px;
}

#view-work.overlay-editor-mode .work-right-col {
    padding-top: 106px;
}

#view-work .work-publishing-scope-group {
    gap: 6px;
}

#view-work .work-publishing-scope-label {
    color: var(--border-cream);
    font-size: 0.88rem;
    font-weight: 600;
}

#view-work .work-publishing-scope-select {
    width: 100%;
    min-width: 0;
}

#view-work .work-general-tool-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#view-work .work-general-tool-btn {
    width: 100%;
    min-height: 36px;
    justify-content: center;
    font-size: 0.86rem;
}

#view-work .work-left-col .work-tool-panel .btn-gray:not(#w-phase-reset-page-btn),
#view-work .work-left-col #w-phase-undo-group .btn-gray,
#view-work .work-left-col #w-phase-delete-group .btn-gray {
    background-color: #56a8ff;
}

#view-work #w-tool-selector-btn {
    background-color: #1f4f96;
}

#view-work .work-general-tool-btn.active {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.24) inset;
}

#view-work .work-general-tool-divider {
    height: 3px;
    background: rgba(255, 183, 1, 0.28);
}

#view-work .work-tool-panel {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 0;
}

#view-work .work-clean-tool-list,
#view-work .work-graphics-tool-list,
#view-work .work-misc-tool-list,
#view-work .work-final-tool-list,
#view-work .work-publishing-tool-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#view-work .work-tool-subgroup {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#view-work .work-tool-panel-divider {
    height: 3px;
    background: rgba(255, 183, 1, 0.28);
}

#view-work .work-clean-tool-btn,
#view-work .work-graphics-tool-btn,
#view-work .work-misc-tool-btn,
#view-work .work-final-tool-btn,
#view-work .work-publishing-tool-btn {
    width: 100%;
    min-height: 36px;
    justify-content: center;
    font-size: 0.86rem;
}

#view-work #w-final-font-size-panel {
    width: 100%;
    box-sizing: border-box;
}

#view-work #w-final-line-spacing-panel {
    width: 100%;
    box-sizing: border-box;
}

#view-work #w-final-font-size-panel .t-checkbox {
    justify-content: flex-start;
}

#view-work #w-final-line-spacing-panel .t-checkbox {
    justify-content: flex-start;
}

#view-work #w-final-tool-font-size-input {
    width: 100%;
    box-sizing: border-box;
}

#view-work #w-final-tool-line-spacing-input {
    width: 100%;
    box-sizing: border-box;
}

#view-work #w-final-tool-font-size-apply {
    width: auto;
    flex: 0 0 auto;
}

#view-work #w-final-tool-line-spacing-apply {
    width: auto;
    flex: 0 0 auto;
}

#view-work .work-clean-tool-btn.active,
#view-work .work-graphics-tool-btn.active {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.24) inset;
}

#view-work .work-phase-current-title {
    color: var(--gold-accent);
    font-weight: bold;
    text-align: center;
    font-size: 1rem;
}

#view-work .work-placeholder {
    flex: 1;
    margin: 10px;
    border: 2px dashed rgba(255, 183, 1, 0.5);
    background: #1a1a1a;
    color: var(--border-cream);
    opacity: 0.85;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    min-height: 280px;
}

#view-work .work-placeholder.has-image {
    border-style: solid;
    border-color: rgba(255, 183, 1, 0.45);
    background: #111;
    padding: 6px;
    opacity: 1;
    overflow: auto;
}

#view-work .work-placeholder.has-image img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}

#view-work .work-scan-mock {
    flex: 1;
    margin: 10px 10px 6px;
    min-height: 0;
    border: 1px solid rgba(255, 183, 1, 0.35);
    background: rgba(0, 0, 0, 0.18);
    overflow: auto;
}

#view-work .work-prepare-workspace {
    flex: 1;
    margin: 10px 10px 6px;
    min-height: 0;
    border: 1px solid rgba(255, 183, 1, 0.35);
    background: rgba(0, 0, 0, 0.18);
    overflow: auto;
}

#view-work .work-prepare-host {
    width: 100%;
    min-height: 100%;
    box-sizing: border-box;
}

#view-work .work-scan-live-host {
    width: 100%;
    min-height: 100%;
    padding: 8px;
    box-sizing: border-box;
}

#view-work .work-cleaning-workspace {
    flex: 1;
    margin: 10px;
    min-height: 0;
    border: 1px solid rgba(255, 183, 1, 0.35);
    background: rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: flex;
}

#view-work .work-graphics-workspace {
    position: relative;
}

#view-work .work-cleaning-workspace-host {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#view-work .work-cleaning-workspace-host .app-body {
    display: flex;
    flex: 1;
    min-height: 0;
    margin: 0;
    gap: 0;
}

#view-work .work-cleaning-workspace-host .sidebar {
    display: none !important;
}

#view-work .work-cleaning-workspace-host .workspace {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
}

.clean-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 2;
}

.clean-erased-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.clean-inline-settings-paint-line,
.clean-inline-settings-area-brush,
.clean-inline-settings-clone-stamp,
.clean-inline-settings-smart-erase {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.clean-group-paint-line,
.clean-group-area-brush,
.clean-group-clone-stamp,
.clean-group-smart-erase,
.clean-group-paint-bound,
.clean-group-copy-area {
    min-width: 0;
}

.clean-group-paint-line .clean-main-btn,
.clean-group-area-brush .clean-main-btn,
.clean-group-clone-stamp .clean-main-btn,
.clean-group-smart-erase .clean-main-btn,
.clean-group-paint-bound .clean-main-btn,
.clean-group-copy-area .clean-main-btn {
    min-width: 94px;
}

.clean-inline-settings-paint-bound,
.clean-inline-settings-copy-area {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.clean-copy-area-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.clean-copy-area-mode .active {
    box-shadow: inset 0 0 0 2px rgba(255, 214, 74, 0.95);
}

.clean-copy-area-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.clean-modal-labeled-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.clean-modal-row-label {
    color: var(--border-cream);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
}

.clean-copy-area-settings-modal .clean-copy-area-mode,
.clean-copy-area-settings-modal .clean-copy-area-actions {
    display: grid;
    grid-template-columns: repeat(3, 88px);
    align-items: center;
    gap: 8px;
    min-width: 0;
    justify-content: flex-end;
}

.clean-copy-area-settings-modal .clean-copy-area-actions-wide {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 75%;
    margin: 0 auto;
}

.clean-copy-area-wide-btn {
    width: 100%;
}

.clean-copy-area-settings-modal .clean-modal-labeled-row {
    width: 100%;
    max-width: 75%;
    margin: 0 auto;
    grid-template-columns: 58px minmax(0, 1fr);
}

.clean-copy-area-settings-modal .clean-modal-row-label {
    min-width: 58px;
    white-space: nowrap;
}

.clean-copy-area-fixed-btn {
    width: 88px;
    min-width: 88px;
    padding-inline: 10px;
    text-align: center;
}

.clean-copy-area-icon-btn {
    width: 88px;
    min-width: 88px;
    padding-inline: 10px;
    text-align: center;
}

.clean-copy-area-settings-modal #c-copy-area-source-status,
.clean-copy-area-settings-modal #c-copy-area-rotation-val {
    width: 88px;
    min-width: 88px;
    text-align: right;
}

.clean-copy-area-settings-modal .clean-modal-hint {
    width: 75%;
    max-width: 75%;
    margin: 2px auto 0;
    line-height: 1.45;
}

.c-smart-erase-grid {
    display: flex;
    flex-direction: column;
    min-width: 220px;
    gap: 4px;
    align-items: stretch;
}

.c-smart-erase-grid .w-gfx-toolbar-slider {
    width: 100%;
    grid-template-columns: auto 82px max-content;
    gap: 2px;
}

.c-smart-erase-grid .w-gfx-toolbar-slider-val {
    min-width: 0;
    text-align: left;
    justify-self: start;
}

.c-smart-erase-grid .w-gfx-slider-inline {
    width: 82px;
}

.clean-inline-settings-smart-erase .w-gfx-erase-main {
    align-items: flex-start;
}

#view-work #w-cleaning-toolbar-host .toolbar {
    display: flex;
    width: 100%;
    box-sizing: border-box;
}

#view-work .work-graphics-workspace {
    flex: 1;
    margin: 10px;
    min-height: 0;
    border: 1px solid rgba(255, 183, 1, 0.35);
    background: rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: flex;
    direction: ltr;
}

#view-work .work-graphics-workspace-host {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#view-work .work-graphics-workspace-host .app-body {
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 0;
    margin: 0;
    gap: 0;
}

/* In process graphics, hide the standalone graphics right sidebar completely.
   Process mode already provides phase pages/actions via the work shell. */
#view-work .work-graphics-workspace-host #gfx-right-sidebar {
    display: none !important;
}

#view-work .work-graphics-workspace-host .workspace {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#view-work .work-graphics-workspace-host #gfx-scroll {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

#view-work .work-final-workspace {
    flex: 1;
    margin: 10px;
    min-height: 0;
    border: 1px solid rgba(255, 183, 1, 0.35);
    background: rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: flex;
}

#view-work .work-final-workspace-host {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#view-work #w-final-toolbar-host .toolbar {
    display: flex;
    width: 100%;
    box-sizing: border-box;
}

#view-work #w-toolbar-editor-shell #w-final-toolbar-host {
    display: flex;
    min-width: 0;
}

#view-work #w-toolbar-editor-shell #w-final-toolbar-host .toolbar {
    position: static !important;
    gap: 0;
}

#view-work #w-toolbar-editor-shell #w-final-toolbar-host .toolbar > .divider,
#view-work #w-toolbar-editor-shell #w-final-toolbar-host #t-editor-left-cluster,
#view-work #w-toolbar-editor-shell #w-final-toolbar-host #t-editor-right-cluster,
#view-work #w-toolbar-editor-shell #w-final-toolbar-host #t-title-wrap,
#view-work #w-toolbar-editor-shell #w-final-toolbar-host #t-title-divider-left,
#view-work #w-toolbar-editor-shell #w-final-toolbar-host #t-title-divider-right,
#view-work #w-toolbar-editor-shell #w-final-toolbar-host #t-editor-page-nav {
    display: none !important;
}

#view-work #w-toolbar-editor-shell #w-final-toolbar-host .toolbar > .control-group {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    justify-content: flex-start;
    scrollbar-width: thin;
    padding: 0 2px 0 0;
}

#view-work .work-final-workspace-host .editor-container {
    display: flex;
    flex: 1;
    min-height: 0;
}

#view-work .work-page-loading-overlay,
.work-page-loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 10, 0.56);
    backdrop-filter: blur(1.5px);
    pointer-events: auto;
    z-index: 10080;
}

#view-work.phase-loading #w-image-placeholder,
#view-work.phase-loading #w-prepare-workspace,
#view-work.phase-loading #w-scan-mock,
#view-work.phase-loading #w-cleaning-workspace,
#view-work.phase-loading #w-graphics-workspace,
#view-work.phase-loading #w-final-workspace {
    visibility: hidden !important;
}

#view-work .work-page-loading-overlay-card,
.work-page-loading-overlay-card {
    min-width: 190px;
    max-width: min(320px, calc(100% - 32px));
    padding: 14px 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 183, 1, 0.38);
    background: rgba(18, 18, 18, 0.84);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--border-cream);
    text-align: center;
    direction: rtl;
}

#view-work .work-page-loading-overlay-text,
.work-page-loading-overlay-text {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

#view-work .work-page-list {
    overflow-y: auto;
    flex: 1;
}

#view-work .work-page-item {
    padding: 9px 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,183,1,0.2);
    direction: ltr;
    text-align: right;
    color: var(--border-cream);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

#view-work .work-page-item:hover {
    background: rgba(255,183,1,0.12);
}

#view-work .work-page-item.active {
    background: rgba(255,183,1,0.2);
    border-right: 3px solid var(--gold-accent);
    color: var(--gold-accent);
    font-weight: bold;
}

#view-work .work-page-number {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    font-weight: 700;
    user-select: none;
}

#view-work .work-page-phase-icons {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    flex: 0 0 auto;
    min-width: 0;
}

#view-work .work-page-phase-chip {
    width: 17px;
    height: 17px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    color: #140400;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22) inset;
}

#view-work .work-page-phase-chip[data-phase="cleaning"] {
    background: #74d6ff;
}

#view-work .work-page-phase-chip[data-phase="graphics"] {
    background: #9bf29f;
}

#view-work .work-page-phase-chip[data-phase="misc"] {
    background: #ffb347;
}

#view-work .work-page-phase-chip[data-phase="final"] {
    background: #ffdd57;
}

#view-work .work-page-phase-chip[data-phase="publishing"] {
    background: #caa5ff;
}

#view-work .work-page-phase-chip.is-current {
    outline: 2px solid rgba(255, 183, 1, 0.9);
    outline-offset: 1px;
}

#view-work .work-preview-strip {
    margin: 0 10px 10px;
    min-height: 345px;
    max-height: 345px;
    border: 1px solid rgba(255, 183, 1, 0.45);
    background: rgba(0, 0, 0, 0.38);
    padding: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
}

#view-work .work-preview-single {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#view-work .work-preview-single img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 1px solid rgba(255, 183, 1, 0.35);
    background: #111;
}

#view-work .work-preview-caption {
    color: var(--border-cream);
    font-size: 0.82rem;
}

#view-work .work-preview-empty {
    color: var(--border-cream);
    opacity: 0.9;
    text-align: center;
    padding: 8px 12px;
    border: 1px dashed rgba(255, 183, 1, 0.35);
}

#view-work #w-toolbar-default.scan-blank .control-group,
#view-work #w-toolbar-default.scan-blank .divider {
    display: none !important;
}

#view-work #w-toolbar-default.scan-blank {
    min-height: 38px;
    padding: 4px 10px;
}

#view-work .work-page-item {
    padding: 9px 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,183,1,0.2);
    direction: ltr;
    text-align: right;
    color: var(--border-cream);
}

#view-work .work-page-item:hover {
    background: rgba(255,183,1,0.12);
}

#view-work .work-page-item.active {
    background: rgba(255,183,1,0.2);
    border-right: 3px solid var(--gold-accent);
    color: var(--gold-accent);
    font-weight: bold;
}

#view-work .work-loader-top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

#view-work .work-loader-top-actions .btn-green,
#view-work .work-loader-top-actions .btn-red {
    min-width: 64px;
    height: 28px;
    padding: 0 10px;
    font-size: 0.86rem;
}

#view-work .work-book-title {
    margin: 8px 10px 0;
    padding: 7px 8px;
    border: 1px solid rgba(255,183,1,0.45);
    background: rgba(255,183,1,0.12);
    color: var(--gold-accent);
    font-weight: bold;
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.35;
    white-space: pre-line;
}

#view-work.is-start-mode #w-toolbar-start {
    display: flex !important;
}

#view-work.is-start-mode #w-toolbar-default,
#view-work.is-start-mode #w-phase-nav-toolbar,
#view-work.is-start-mode #w-toolbar-editor-shell,
#view-work.is-start-mode #w-toolbar-graphics,
#view-work.is-start-mode #w-cleaning-toolbar-host,
#view-work.is-start-mode #w-final-toolbar-host {
    display: none !important;
}

#view-work.is-start-mode #w-start-select {
    display: flex !important;
}

#view-work.is-start-mode .work-shell {
    grid-template-columns: minmax(0, 1fr);
}

#view-work.is-start-mode #w-image-placeholder,
#view-work.is-start-mode #w-prepare-workspace,
#view-work.is-start-mode #w-scan-mock,
#view-work.is-start-mode #w-cleaning-workspace,
#view-work.is-start-mode #w-graphics-workspace,
#view-work.is-start-mode #w-final-workspace {
    display: none !important;
}

#view-work.is-start-mode .work-left-col,
#view-work.is-start-mode .work-right-col {
    display: none !important;
}

#view-work.is-start-mode .work-center-col > .sidebar-header {
    display: none !important;
}

#view-work.is-start-mode .work-center-col {
    grid-column: 1 / -1;
}

#view-work.scan-config-open .work-shell {
    grid-template-columns: minmax(0, 1fr);
}

#view-work.scan-config-open .work-left-col,
#view-work.scan-config-open .work-right-col {
    display: none !important;
}

#view-work.scan-config-open .work-center-col {
    border-left: 2px solid var(--gold-accent);
    border-right: 2px solid var(--gold-accent);
}

#view-work.scan-config-open #w-center-header,
#view-work.scan-config-open #w-graphics-workspace {
    display: none !important;
}

#view-work.prepare-mode .work-shell {
    grid-template-columns: minmax(0, 1fr);
}

#view-work.prepare-mode .work-left-col,
#view-work.prepare-mode .work-right-col {
    display: none !important;
}

#view-work.prepare-mode .work-center-col {
    grid-column: 1 / -1;
}

#view-work.scan-mode .work-shell {
    grid-template-columns: 168px minmax(0, 1fr);
}

#view-work.scan-mode .work-right-col {
    display: none !important;
}

#view-work.scan-config-open #w-scan-mock {
    margin: 0;
    border: none;
    background: transparent;
}

#view-work.scan-config-open #w-scan-live-host > :not(#t-book-config-view) {
    display: none !important;
}

#view-work.scan-config-open #t-book-config-view {
    display: flex !important;
    min-height: calc(100vh - 220px);
}

#view-work .w-start-select {
    flex: 1;
    margin: 10px;
    border: 2px solid var(--gold-accent);
    background: #1a1a1a;
    display: none;
    align-items: stretch;
    justify-content: flex-start;
    padding: 12px;
    min-height: 320px;
    overflow-y: auto;
}

#view-work .w-start-select-inner {
    width: 100%;
    max-width: none;
    min-height: 0;
    flex: 1 1 auto;
    border: 2px dashed rgba(255, 183, 1, 0.65);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

#view-work .w-start-title {
    color: var(--gold-accent);
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

#view-work .w-start-subtitle {
    color: var(--border-cream);
    text-align: center;
    font-size: 1rem;
    margin-top: -4px;
}

#view-work .w-start-block {
    border: 2px solid rgba(255, 244, 210, 0.9);
    border-radius: 14px;
    background: rgba(114, 12, 12, 0.9);
    padding: 14px 16px;
}

#view-work .w-start-block-title {
    color: var(--gold-accent);
    font-size: 1.55rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: right;
}

#view-work .w-start-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--border-cream);
    direction: rtl;
    flex-wrap: wrap;
}

#view-work .w-start-row .btn-blue {
    height: 30px;
    min-width: 88px;
    padding: 0 10px;
    font-size: 0.9rem;
}

#view-work .w-start-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 3;
    background: #1a1a1a;
    padding-bottom: 6px;
}

#view-work .w-start-actions-left,
#view-work .w-start-actions-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#view-work .w-start-actions-right {
    margin-inline-start: auto;
}

#view-work .w-start-create-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 280px;
    max-width: 460px;
    flex: 1 1 320px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 183, 1, 0.28);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
}

#view-work .w-start-create-progress-title {
    color: var(--gold-accent);
    font-weight: bold;
    font-size: 0.92rem;
}

#view-work .w-start-create-progress-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--border-cream);
    font-size: 0.84rem;
}

#view-work .w-start-create-progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

#view-work .w-start-create-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2ec4b6 0%, #6cf0ae 100%);
    transition: width 0.25s ease;
}

#view-work .w-start-create-progress-note {
    color: #d5e7ff;
    font-size: 0.8rem;
}

#view-work .w-start-create-panel {
    border: 1px solid rgba(255, 183, 1, 0.28);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.24);
    padding: 12px;
    margin-bottom: 10px;
}

#view-work .w-start-create-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

#view-work .w-start-create-title {
    color: var(--gold-accent);
    font-weight: bold;
    font-size: 1rem;
}

#view-work .w-start-create-error {
    color: #ffd6a2;
    margin-bottom: 10px;
}

#view-work .w-start-create-form {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

#view-work .w-start-create-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
    color: var(--gold-accent);
}

#view-work .w-start-create-file {
    min-width: 260px;
}

#view-work .w-start-create-file input[type="file"] {
    color: var(--border-cream);
}

#view-work .w-start-create-help {
    margin-top: 10px;
    color: var(--border-cream);
    opacity: 0.95;
}

#view-work .w-start-inventory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding-inline-end: 4px;
    margin-top: 10px;
}

#view-work .w-start-inventory-item {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(255, 183, 1, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
    padding: 10px;
}

#view-work .w-start-inventory-thumb {
    width: 80px;
    height: 108px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border-cream);
}

#view-work .w-start-inventory-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#view-work .w-start-inventory-main {
    min-width: 0;
}

#view-work .w-start-inventory-title {
    color: var(--gold-accent);
    font-weight: bold;
}

#view-work .w-start-inventory-sub {
    color: var(--border-cream);
    margin-top: 4px;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#view-work #w-start-series-filter {
    min-width: 150px;
    height: 34px;
}

#view-work #w-start-dashboard-filter {
    min-width: 260px;
    height: 34px;
}

#view-work .w-start-dashboard-meta {
    color: var(--border-cream);
    min-height: 20px;
    text-align: right;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #1a1a1a;
    padding-bottom: 4px;
}

#view-work .w-start-dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-inline-end: 4px;
}

#view-work .w-start-empty,
#view-work .w-start-error {
    border: 1px solid rgba(255, 183, 1, 0.28);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    padding: 20px;
    color: var(--border-cream);
    text-align: center;
}

#view-work .w-start-error {
    color: #ffd6a2;
}

#view-work .w-start-project-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    padding: 8px 10px;
}

#view-work .w-start-project-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 10px;
    align-items: start;
    direction: ltr;
}

#view-work .w-start-project-thumb {
    width: 86px;
    height: 118px;
    min-width: 86px;
    border-radius: 8px;
    border: 1px solid rgba(255, 183, 1, 0.2);
    background: rgba(0, 0, 0, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--gold-accent);
    font-weight: 700;
}

#view-work .w-start-project-resume {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

#view-work .w-start-project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#view-work .w-start-project-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#view-work .w-start-project-top {
    display: flex;
    direction: rtl;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

#view-work .w-start-project-status {
    color: var(--gold-accent);
    font-weight: 700;
    font-size: 0.98rem;
    text-align: center;
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#view-work .w-start-project-comments-link {
    flex: 0 0 auto;
    height: 28px;
    padding: 0 9px;
    font-size: 0.82rem;
    direction: rtl;
    min-width: 0;
}

#view-work .w-start-project-comments-link.has-messages {
    border-color: rgba(255, 183, 1, 0.6);
    box-shadow: 0 0 0 1px rgba(255, 183, 1, 0.24) inset;
    color: #ffe4a9;
}

#view-work .w-start-project-title {
    color: var(--gold-accent);
    font-size: 1.2rem;
    font-weight: 700;
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    direction: rtl;
}

#view-work .w-start-project-title-link,
#view-work .w-start-project-resume-link {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    text-align: inherit;
    max-width: 100%;
}

#view-work .w-start-project-title-link:hover,
#view-work .w-start-project-title-link:focus-visible,
#view-work .w-start-project-resume-link:hover,
#view-work .w-start-project-resume-link:focus-visible,
#view-work .w-start-project-resume:hover,
#view-work .w-start-project-resume:focus-visible {
    opacity: 0.88;
}

#view-work .w-start-status-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

#view-work .w-start-status-pill {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.24);
    color: var(--border-cream);
    font-size: 0.84rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#view-work .w-start-phases {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    direction: rtl;
}

#view-work .w-start-comments-modal {
    position: fixed;
    inset: 0;
    z-index: 2600;
    background: rgba(0, 0, 0, 0.74);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

#view-work .w-start-comments-modal-box {
    width: min(820px, 95vw);
    max-height: 90vh;
    border: 1px solid rgba(255, 183, 1, 0.42);
    border-radius: 12px;
    background: #151515;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#view-work .w-start-comments-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 183, 1, 0.2);
    background: rgba(0, 0, 0, 0.24);
}

#view-work .w-start-comments-modal-title {
    color: var(--gold-accent);
    font-weight: 700;
    min-height: 24px;
}

#view-work .w-start-comments-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    overflow-y: auto;
}

#view-work .w-start-comments-modal-toolbar,
#view-work .w-start-comment-form-actions,
#view-work .w-start-comment-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

#view-work .w-start-comments-summary,
#view-work .w-start-comments-loading,
#view-work .w-start-comments-empty,
#view-work .w-start-comment-complete-note,
#view-work .w-start-comment-replyto,
#view-work .w-start-comment-form-reply {
    color: rgba(255, 244, 210, 0.8);
    font-size: 0.88rem;
}

#view-work .w-start-comment-item {
    border: 1px solid rgba(255, 183, 1, 0.18);
    border-radius: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#view-work .w-start-comment-item[data-status="completed"] {
    background: rgba(70, 165, 102, 0.14);
    border-color: rgba(70, 165, 102, 0.28);
}

#view-work .w-start-comment-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: rgba(255, 244, 210, 0.72);
    font-size: 0.84rem;
}

#view-work .w-start-comment-author,
#view-work .w-start-comment-form-title {
    color: var(--gold-accent);
    font-weight: 700;
}

#view-work .w-start-comment-message {
    color: var(--border-cream);
    line-height: 1.45;
    white-space: normal;
}

#view-work .w-start-comment-form {
    border-top: 1px solid rgba(255, 183, 1, 0.16);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#view-work .w-start-comment-form-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

#view-work .w-start-comment-text {
    min-height: 84px;
    resize: vertical;
    width: 100%;
}

#view-work .w-start-phase-card {
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.14);
    padding: 4px 6px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

#view-work .w-start-phase-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    color: inherit;
    cursor: pointer;
    text-align: right;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

#view-work .w-start-phase-link:disabled {
    cursor: not-allowed;
    opacity: 0.68;
    text-decoration: none;
}

#view-work .w-start-phase-name {
    color: var(--gold-accent);
    font-weight: 700;
    font-size: 0.9rem;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#view-work .w-start-phase-count-inline {
    color: rgba(255, 244, 210, 0.8);
    font-size: 0.74rem;
    line-height: 1;
    min-width: 38px;
    text-align: center;
    white-space: nowrap;
}

#view-work .w-start-phase-count-inline.is-empty {
    opacity: 0;
}

#view-work .w-start-phase-badge {
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 0.7rem;
    white-space: nowrap;
    background: rgba(255, 183, 1, 0.16);
    color: var(--border-cream);
}

#view-work .w-start-phase-badge[data-status="done"] {
    background: rgba(70, 165, 102, 0.28);
    color: #a8ffbf;
}

#view-work .w-start-phase-badge[data-status="in_progress"] {
    background: rgba(54, 117, 191, 0.32);
    color: #a9d8ff;
}

#view-work .w-start-phase-badge[data-status="blocked"] {
    background: rgba(146, 69, 69, 0.38);
    color: #ffcbcb;
}

#view-work .w-start-phase-badge[data-status="not_started"] {
    background: rgba(255, 183, 1, 0.16);
    color: var(--border-cream);
}

#view-work .w-start-phase-badge[data-status="ready"] {
    background: rgba(113, 173, 255, 0.22);
    color: #c7e5ff;
}

#view-work .w-start-phase-badge[data-status="queued"] {
    background: rgba(170, 157, 101, 0.25);
    color: #f8e9b7;
}

#view-work .w-start-phase-card[data-lock-state="executable"] {
    background: rgba(28, 76, 51, 0.24);
    border-color: rgba(255, 255, 255, 0.72);
}

#view-work .w-start-phase-card[data-lock-state="role"] {
    background: rgba(72, 72, 82, 0.38);
    border-color: rgba(255, 255, 255, 0.72);
}

#view-work .w-start-phase-card[data-lock-state="role"] .w-start-phase-name,
#view-work .w-start-phase-card[data-lock-state="role"] .w-start-phase-count-inline {
    color: rgba(255, 244, 210, 0.76);
}

#view-work .w-start-phase-card[data-lock-state="workflow"] {
    background: rgba(88, 38, 38, 0.36);
    border-color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 1280px) {
    #view-work .w-start-project-layout {
        grid-template-columns: minmax(0, 1fr) 76px;
        gap: 8px;
    }

    #view-work .w-start-project-thumb {
        width: 76px;
        height: 106px;
        min-width: 76px;
    }
}

@media (max-width: 920px) {
    #view-work .w-start-inventory-item {
        grid-template-columns: 1fr;
    }

    #view-work .w-start-project-card {
        padding: 8px;
    }

    #view-work .w-start-project-layout {
        grid-template-columns: minmax(0, 1fr) 70px;
        gap: 8px;
    }

    #view-work .w-start-project-thumb {
        width: 70px;
        height: 98px;
        min-width: 70px;
    }

    #view-work .w-start-project-top {
        gap: 8px;
        flex-wrap: wrap;
    }

    #view-work .w-start-phases {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    #view-work .w-start-project-layout {
        grid-template-columns: 1fr;
    }

    #view-work .w-start-project-thumb {
        width: 100%;
        height: 170px;
        min-width: 0;
    }

    #view-work .w-start-phases {
        grid-template-columns: 1fr;
    }

    #view-work #w-start-dashboard-filter {
        min-width: 0;
        width: 100%;
    }
}

.w-toolbar-graphics {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    direction: ltr;
    justify-content: flex-start;
    scrollbar-width: thin;
    padding-right: 2px;
}

.w-gfx-sec {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding: 1px 2px;
    min-height: 36px;
    border-right: 1px solid rgba(255,183,1,0.35);
    flex: 0 0 auto;
    min-width: 0;
    direction: ltr;
    overflow: hidden;
}

.w-gfx-sec:first-child {
    border-right: none;
}

.w-gfx-sec:last-child {
    border-right: 1px solid rgba(255,183,1,0.35);
}

.w-gfx-sec-zoom {
    width: 176px;
    justify-content: flex-start;
}

.w-gfx-sec-map {
    width: auto;
    min-width: 76px;
    justify-content: flex-start;
}

.w-gfx-sec-edit {
    width: 118px;
    justify-content: center;
}

.w-gfx-sec-misc-flip {
    display: none;
    width: auto;
    min-width: 222px;
    justify-content: flex-start;
}

.w-gfx-sec-misc-actions {
    display: none;
    width: auto;
    min-width: 72px;
    justify-content: flex-start;
}

.w-gfx-sec-misc-align {
    display: none;
    width: auto;
    min-width: 252px;
    justify-content: flex-start;
    gap: 6px;
}

.w-gfx-sec-paint {
    width: 220px;
}

.w-gfx-sec-color {
    width: 218px;
    justify-content: flex-start;
    gap: 3px;
}

.w-gfx-sec-erase {
    width: 246px;
    justify-content: flex-start;
}

.w-gfx-sec-effects {
    width: auto;
    min-width: 214px;
    justify-content: flex-start;
}

.w-gfx-sec-mode {
    width: auto;
    min-width: 78px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    direction: rtl;
    padding-left: 6px;
    padding-right: 2px;
}

.w-gfx-mode-radio {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    line-height: 1;
}

.w-gfx-mode-radio .t-radio-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--border-cream);
}

.w-gfx-sec-pages {
    width: auto;
    min-width: 186px;
    margin-left: auto;
    justify-content: flex-end;
    direction: rtl;
    gap: 5px;
    padding-left: 8px;
    border-left: 1px solid rgba(255,183,1,0.35);
}

.w-gfx-page-actions {
    display: flex;
    gap: 5px;
}

.w-gfx-sec-pages .auto-check {
    margin-right: 0;
}

.w-gfx-sec-pages .auto-check span {
    font-size: 0.8rem;
}

.w-gfx-sec-pages .btn-red,
.w-gfx-sec-pages .btn-green {
    min-width: 58px;
    height: 30px;
    padding: 0 8px;
}

.w-gfx-sec-edit .btn-blue,
.w-gfx-sec-edit .btn-red {
    min-width: 50px;
    height: 30px;
    padding: 0 8px;
}

/* Process graphics toolbar standardization:
   zoom matches cleaning behavior, divider spacing is 10px per side,
   and freed Pages<->Effects space is shared equally by Color/Erase/Effects. */
#view-work #w-toolbar-graphics .w-gfx-sec {
    padding: 1px 10px;
}

#view-work #w-toolbar-graphics .w-gfx-sec-zoom {
    width: 176px;
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics .w-gfx-sec-map {
    width: auto;
    min-width: 76px;
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics .w-gfx-sec-zoom .btn-green {
    min-width: 0;
    height: 36px;
    padding: 4px 12px;
}

#view-work #w-toolbar-graphics .w-gfx-sec-map .btn-blue {
    min-width: 56px;
    height: 30px;
    padding: 0 10px;
}

#view-work #w-toolbar-graphics .w-gfx-sec-edit {
    width: 118px;
    justify-content: center;
}

#view-work #w-toolbar-graphics .w-gfx-sec-misc-flip {
    width: auto;
    min-width: 222px;
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics .w-gfx-sec-misc-actions {
    width: auto;
    min-width: 72px;
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics .w-gfx-sec-color,
#view-work #w-toolbar-graphics .w-gfx-sec-erase,
#view-work #w-toolbar-graphics .w-gfx-sec-paint,
#view-work #w-toolbar-graphics .w-gfx-sec-effects {
    flex: 1 1 0;
    width: auto;
    min-width: 220px;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-paint {
    flex: 0 1 auto;
    min-width: 620px;
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-erase {
    flex: 0 0 auto;
    min-width: 246px;
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-mode,
#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-pages {
    flex: 0 0 auto;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-edit {
    width: auto;
    min-width: 78px;
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-pages {
    min-width: 210px;
    margin-left: auto;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-erase-layout {
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-paint-inline {
    justify-content: flex-start;
}

#view-work #w-toolbar-graphics .w-gfx-sec-mode {
    flex: 0 0 auto;
    min-width: 78px;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-color,
#view-work #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-effects {
    display: none;
}

#view-work #w-toolbar-graphics[data-toolbar-mode="effects"] .w-gfx-sec-erase,
#view-work #w-toolbar-graphics[data-toolbar-mode="effects"] .w-gfx-sec-paint {
    display: none;
}

#view-work #w-toolbar-editor-shell #w-toolbar-graphics {
    padding: 0;
}

#view-work[data-standalone-kind="graphics"] #w-toolbar-editor-shell #w-toolbar-graphics {
    display: none !important;
}

#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec {
    border-right: none;
    border-left: none;
    padding: 1px 8px;
}

#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec:first-child,
#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec:last-child {
    border-right: none;
}

#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec-zoom,
#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec-edit,
#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec-misc-flip,
#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec-pages {
    display: none !important;
}

#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec-color,
#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec-erase,
#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec-paint,
#view-work #w-toolbar-editor-shell #w-toolbar-graphics .w-gfx-sec-effects {
    flex: 1 1 0;
    width: auto;
    min-width: 220px;
}

#view-work #w-toolbar-editor-shell #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-paint {
    min-width: 620px;
}

#view-work #w-toolbar-editor-shell #w-toolbar-graphics[data-toolbar-mode="painting"] .w-gfx-sec-erase {
    flex: 0 0 auto;
    min-width: 246px;
}

#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics .w-gfx-sec-mode {
    display: none !important;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-misc-flip {
    display: flex !important;
    flex: 0 0 auto;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-misc-actions {
    display: none !important;
    flex: 0 0 auto;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-misc-align {
    display: none !important;
    flex: 0 0 auto;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-effects #w-gfx-remove {
    display: none;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-paint,
#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-mode,
#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-erase {
    display: none !important;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-color,
#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-effects {
    display: none !important;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-color-stack,
#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics #w-graphics-save-asset-btn,
#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics #w-gfx-curve-top,
#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics #w-gfx-curve-bottom,
#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-warp-wrap {
    display: none !important;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-color {
    min-width: 176px;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-effects {
    min-width: 64px;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-color {
    min-width: 188px;
}

#view-work #w-toolbar-editor-shell[data-phase="misc"] #w-toolbar-graphics .w-gfx-sec-misc-align {
    min-width: 262px;
}

#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics .w-gfx-paint-modes {
    display: none !important;
}

#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics .w-gfx-sec-color,
#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics .w-gfx-sec-erase,
#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics .w-gfx-sec-paint,
#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics .w-gfx-sec-effects {
    display: none;
}

#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics[data-gfx-tool="brush-line"] .w-gfx-sec-paint,
#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics[data-gfx-tool="brush-texture"] .w-gfx-sec-paint {
    display: flex;
    flex: 1 1 auto;
    min-width: 560px;
}

#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics[data-gfx-tool="mark-area"] .w-gfx-sec-erase {
    display: flex;
    flex: 1 1 auto;
    min-width: 380px;
}

#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics[data-gfx-tool="new-effect"] .w-gfx-sec-effects,
#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics[data-gfx-tool="library-effect"] .w-gfx-sec-effects,
#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics[data-gfx-tool="editing-effect"] .w-gfx-sec-effects {
    display: flex;
}

#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics[data-gfx-tool="editing-effect"] .w-gfx-sec-color,
#view-work #w-toolbar-editor-shell[data-phase="graphics"] #w-toolbar-graphics #w-gfx-selected-text-font-row {
    display: none !important;
}

.w-gfx-sec-paint {
    gap: 12px;
    direction: rtl;
    justify-content: flex-start;
}

.w-gfx-paint-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    direction: ltr;
}

.w-gfx-paint-btn {
    min-width: 52px;
    height: 30px;
    padding: 0 10px;
}

.w-gfx-paint-btn.active {
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.35) inset;
    border-color: rgba(255, 183, 1, 0.95);
}

.w-gfx-paint-modes {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    direction: rtl;
}

.w-gfx-paint-inline {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
}

.w-gfx-paint-inline-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    direction: rtl;
}

.w-gfx-inline-icon {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 183, 1, 0.5);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--border-cream);
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.w-gfx-inline-icon:hover {
    border-color: var(--gold-accent);
    color: var(--gold-accent);
}

.w-gfx-paint-inline-swatches {
    display: inline-grid;
    grid-template-columns: repeat(3, 14px);
    gap: 3px;
    direction: ltr;
}

.w-gfx-paint-basic-swatch {
    width: 14px;
    height: 14px;
    border: 1px solid rgba(245, 240, 206, 0.82);
    border-radius: 2px;
    padding: 0;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.w-gfx-paint-basic-swatch.active {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 1px rgba(255, 183, 1, 0.5);
}

.w-gfx-paint-color-wrap {
    padding: 2px 4px;
    gap: 0;
    min-width: 30px;
}

.w-gfx-toolbar-slider {
    display: inline-grid;
    grid-template-columns: auto 88px auto;
    align-items: center;
    gap: 6px;
    direction: ltr;
    min-width: 0;
}

.w-gfx-toolbar-slider-label {
    color: var(--border-cream);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.w-gfx-toolbar-slider-val {
    color: var(--border-cream);
    font-size: 0.82rem;
    min-width: 34px;
    text-align: right;
    white-space: nowrap;
}

.w-gfx-slider-inline {
    width: 88px;
}

.w-gfx-paint-texture-inline-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    align-items: center;
}

.w-gfx-paint-texture-preview-btn {
    width: 38px;
    height: 38px;
    align-self: stretch;
    flex: 0 0 auto;
    background-repeat: no-repeat;
    cursor: pointer;
}

.w-gfx-paint-texture-preview-btn.sampling {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.25);
}

.w-gfx-paint-texture-hint {
    min-width: 86px;
    max-width: 96px;
    text-align: right;
}

.w-gfx-paint-mode-radio {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.w-gfx-paint-mode-radio .t-radio-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--border-cream);
}

.w-gfx-paint-texture-preview {
    width: 52px;
    height: 52px;
    border: 1px solid rgba(255, 183, 1, 0.7);
    border-radius: 4px;
    background: #ffffff;
    background-size: cover;
    background-position: center;
    align-self: center;
}

.w-gfx-paint-texture-hint {
    color: var(--border-cream);
    font-size: 0.74rem;
    text-align: center;
}

.w-gfx-misc-flip-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    direction: rtl;
}

.w-gfx-misc-tool-btn {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    height: auto;
    padding: 0 10px;
}

.w-gfx-misc-tool-btn.active {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.26) inset;
    color: var(--gold-accent);
}

.w-gfx-sec-misc-actions .btn-red {
    min-width: 58px;
    height: 30px;
    padding: 0 10px;
}

.w-gfx-sec-effects .btn-gray,
.w-gfx-sec-effects .btn-blue {
    min-width: 30px;
    height: 26px;
    padding: 0 5px;
}

.w-gfx-outline-stack {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.w-gfx-misc-align-count {
    min-width: 24px;
    text-align: center;
    color: var(--gold-accent);
    font-size: 0.82rem;
    font-weight: 700;
}

.w-gfx-misc-align-grid {
    display: grid;
    grid-template-columns: repeat(3, 28px);
    grid-template-rows: 12px 28px 12px;
    gap: 2px;
    align-items: center;
    justify-items: center;
}

.w-gfx-sec-misc-align .btn-blue,
.w-gfx-sec-misc-align .btn-green,
.w-gfx-sec-misc-align .btn-gray {
    min-width: 0;
    height: 28px;
    padding: 0 9px;
}

.w-gfx-align-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1;
}

.w-gfx-align-icon {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    color: currentColor;
}

.w-gfx-align-icon-line,
.w-gfx-align-icon-shape {
    position: absolute;
    display: block;
    background: currentColor;
    border-radius: 2px;
}

.w-gfx-align-icon-top .w-gfx-align-icon-line,
.w-gfx-align-icon-bottom .w-gfx-align-icon-line {
    left: 1px;
    width: 12px;
    height: 2px;
}

.w-gfx-align-icon-top .w-gfx-align-icon-line {
    top: 1px;
}

.w-gfx-align-icon-bottom .w-gfx-align-icon-line {
    bottom: 1px;
}

.w-gfx-align-icon-top .w-gfx-align-icon-shape,
.w-gfx-align-icon-bottom .w-gfx-align-icon-shape {
    left: 4px;
    width: 6px;
    height: 7px;
}

.w-gfx-align-icon-top .w-gfx-align-icon-shape {
    top: 4px;
}

.w-gfx-align-icon-bottom .w-gfx-align-icon-shape {
    bottom: 4px;
}

.w-gfx-align-icon-left .w-gfx-align-icon-line,
.w-gfx-align-icon-right .w-gfx-align-icon-line {
    top: 1px;
    width: 2px;
    height: 12px;
}

.w-gfx-align-icon-left .w-gfx-align-icon-line {
    left: 1px;
}

.w-gfx-align-icon-right .w-gfx-align-icon-line {
    right: 1px;
}

.w-gfx-align-icon-left .w-gfx-align-icon-shape,
.w-gfx-align-icon-right .w-gfx-align-icon-shape {
    top: 4px;
    width: 7px;
    height: 6px;
}

.w-gfx-align-icon-left .w-gfx-align-icon-shape {
    left: 4px;
}

.w-gfx-align-icon-right .w-gfx-align-icon-shape {
    right: 4px;
}

.w-gfx-align-btn.active,
#w-gfx-misc-multi-toggle.active {
    border-color: var(--gold-accent);
    color: var(--gold-accent);
    box-shadow: 0 0 0 1px rgba(255, 183, 1, 0.28) inset;
}

#w-gfx-misc-align-top {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    transform: translateY(8px);
}

#w-gfx-misc-align-left {
    grid-column: 1;
    grid-row: 2;
}

#w-gfx-misc-align-right {
    grid-column: 3;
    grid-row: 2;
}

#w-gfx-misc-align-bottom {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
    transform: translateY(-8px);
}

.w-gfx-sec-effects #w-gfx-duplicate,
.w-gfx-sec-map #w-graphics-map-toggle {
    min-width: 42px;
}

.w-gfx-warp-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    color: var(--border-cream);
    font-size: 0.74rem;
}

.w-gfx-erase-layout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.w-gfx-erase-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.w-gfx-erase-icons .btn-blue,
.w-gfx-erase-icons .btn-green,
.w-gfx-erase-icons .btn-red {
    min-width: 42px;
    height: 30px;
    padding: 0 8px;
}

.w-gfx-erase-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    direction: ltr;
    min-width: 0;
    padding-left: 8px;
}

.w-gfx-erase-radios-h .t-radio {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.w-gfx-erase-radios-h .t-radio-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--border-cream);
}

.w-gfx-erase-row {
    display: grid;
    grid-template-columns: 72px 1fr 24px;
    align-items: center;
    gap: 8px;
    direction: ltr;
}

.w-gfx-erase-row-label {
    color: var(--border-cream);
    font-size: 0.96rem;
    min-width: 72px;
    text-align: right;
}

.w-gfx-erase-row-val {
    color: #fff;
    font-size: 0.98rem;
    min-width: 18px;
    text-align: left;
    direction: ltr;
}

.w-gfx-erase-row .w-gfx-slider {
    width: 128px;
    height: 12px;
    transform: scaleY(0.86);
    transform-origin: center;
}

.w-gfx-slider {
    width: 78px;
    height: 18px;
}

.w-gfx-slider-small {
    width: 74px;
}

.w-gfx-color-palette {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    row-gap: 4px;
    flex-wrap: wrap;
    direction: ltr;
    align-self: center;
    width: auto;
}

.w-gfx-basic-colors {
    display: grid;
    grid-template-columns: repeat(3, 11px);
    grid-template-rows: repeat(2, 11px);
    gap: 2px;
    align-items: center;
}

.w-gfx-basic-swatch {
    width: 11px;
    height: 11px;
    border: 1px solid rgba(255, 183, 1, 0.75);
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
}

.w-gfx-color-shared {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(255, 183, 1, 0.75);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

.w-gfx-outline-mini {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    direction: ltr;
}

.w-gfx-mini-lbl {
    color: var(--border-cream);
    font-size: 0.75rem;
}

.w-gfx-color-palette-lbl {
    display: none;
}

.w-gfx-outline-val {
    color: var(--border-cream);
    font-size: 0.78rem;
    min-width: 10px;
    text-align: left;
}

.w-gfx-color-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.w-gfx-color-row {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    direction: ltr;
}

.w-gfx-target-check-spacer {
    width: 18px;
    height: 18px;
    display: inline-block;
}

.w-gfx-target-check {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.w-gfx-target-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
}

.w-gfx-color-label {
    cursor: pointer;
    border: 1px solid rgba(255, 183, 1, 0.45);
    background: rgba(64, 10, 10, 0.88);
    color: var(--border-cream);
    border-radius: 5px;
    font-size: 0.72rem;
    line-height: 1;
    padding: 0 8px;
    min-width: 58px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.w-gfx-color-label.active {
    border-color: var(--gold-accent);
    color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.22) inset;
}

.w-gfx-color-row input[type="color"] {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid rgba(255, 183, 1, 0.75);
    border-radius: 4px;
    background: transparent;
}

.w-gfx-sec-zoom .btn-green {
    min-width: 52px;
    height: 30px;
    padding: 0 8px;
}

.w-gfx-erase-modal {
    position: fixed;
    z-index: 2600;
    min-width: 300px;
    background: linear-gradient(180deg, #6f0404 0%, #5b0404 100%);
    border: 1px solid rgba(255,183,1,0.75);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.45);
    padding: 8px 10px 10px;
    direction: rtl;
}

.w-gfx-erase-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    direction: ltr;
}

.w-gfx-modal-icon {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 1.18rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.w-gfx-erase-modal-row {
    display: grid;
    grid-template-columns: 72px 1fr 26px;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    direction: ltr;
}

.w-gfx-settings-btn {
    position: absolute;
    top: -10px;
    left: -2px;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #f4f4f4;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    text-shadow: 0 0 4px rgba(0,0,0,0.6);
}

#w-newfx-modal {
    justify-content: flex-end;
    align-items: flex-start;
    padding: 72px 16px 16px;
    background-color: rgba(0, 0, 0, 0.24);
    pointer-events: none;
}

#w-newfx-modal .w-newfx-modal-content {
    width: min(760px, 92vw);
    max-height: calc(100vh - 96px);
    overflow: auto;
    text-align: right;
    pointer-events: auto;
}

#w-effect-edit-modal,
#w-final-text-edit-modal,
#w-misc-frame-edit-modal,
#w-misc-page-number-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    width: auto;
    height: auto;
    background-color: transparent;
    pointer-events: none;
}

#w-effect-edit-modal .w-effect-edit-modal-content,
#w-final-text-edit-modal .w-effect-edit-modal-content,
#w-final-rephrase-modal .w-effect-edit-modal-content,
#w-misc-frame-edit-modal .w-effect-edit-modal-content,
#w-misc-page-number-modal .w-effect-edit-modal-content {
    position: absolute;
    left: 0;
    top: 0;
    width: min(320px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    overflow: auto;
    text-align: right;
    pointer-events: auto;
    padding: 12px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid rgba(255, 183, 1, 0.28);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

#w-final-rephrase-modal .w-final-rephrase-modal-content {
    width: min(760px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    overflow: auto;
    direction: rtl;
    text-align: right;
    pointer-events: auto;
}

.w-effect-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.w-effect-edit-drag-handle {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    cursor: grab;
    user-select: none;
}

.w-effect-edit-modal-content.is-dragging .w-effect-edit-drag-handle {
    cursor: grabbing;
}

.w-effect-edit-drag-grip {
    color: rgba(255, 183, 1, 0.78);
    font-size: 1rem;
    letter-spacing: -1px;
    line-height: 1;
}

.w-effect-edit-selection {
    min-width: 0;
    color: var(--border-cream);
    font-size: 0.85rem;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.w-effect-edit-close-btn {
    flex: 0 0 auto;
    min-width: 52px;
    height: 32px;
    padding: 0 10px;
}

.w-effect-edit-hint {
    color: rgba(255, 243, 230, 0.9);
    font-size: 0.8rem;
    line-height: 1.45;
}

.w-effect-edit-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 183, 1, 0.18);
}

.w-effect-edit-section:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.w-effect-edit-section-title {
    color: var(--gold-accent);
    font-size: 0.86rem;
    font-weight: 700;
}

.w-effect-edit-section-toggle {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: right;
}

.w-effect-edit-section-chevron {
    flex: 0 0 auto;
    color: rgba(255, 243, 230, 0.82);
    font-size: 0.95rem;
    line-height: 1;
    transition: transform 0.18s ease;
}

.w-effect-edit-section.is-open .w-effect-edit-section-chevron {
    transform: rotate(180deg);
}

.w-effect-edit-section-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 8px;
}

.w-effect-edit-section-body[hidden] {
    display: none !important;
}

.w-effect-edit-control-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.w-effect-edit-control-label {
    color: rgba(255, 243, 230, 0.92);
    font-size: 0.82rem;
    line-height: 1.2;
    white-space: normal;
    text-align: right;
}

.w-effect-edit-shape-row {
    display: grid;
    grid-template-columns: 36px 36px minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
}

.w-effect-edit-shape-row-compact {
    grid-template-columns: repeat(2, 36px);
    justify-content: flex-start;
}

.w-effect-edit-warp-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
}

.w-effect-edit-icon-btn {
    min-width: 36px;
    width: 36px;
    height: 34px;
    padding: 0;
    font-size: 1.08rem;
    font-weight: 700;
}

.w-effect-edit-action-btn {
    min-width: 0;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    font-size: 0.84rem;
    white-space: nowrap;
}

.w-effect-edit-action-btn.active {
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.45);
}

.w-effect-edit-stepper {
    display: grid;
    grid-template-columns: 36px auto 36px 36px;
    gap: 6px;
    align-items: center;
    justify-content: start;
}

.w-effect-edit-stepper-value {
    min-height: 36px;
    min-width: 74px;
    padding: 0 8px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 183, 1, 0.22);
    background: rgba(255, 243, 230, 0.08);
    color: var(--border-cream);
    font-size: 0.95rem;
    font-weight: 700;
}

.w-effect-edit-stepper-icon {
    gap: 3px;
    font-size: 0.9rem;
    letter-spacing: 0;
    direction: ltr;
    unicode-bidi: isolate;
}

.w-effect-edit-stepper-icon span {
    display: block;
    line-height: 1;
}

.w-effect-edit-stepper-icon span:nth-child(2) {
    font-size: 0.8rem;
    opacity: 0.86;
}

.w-effect-edit-stepper-value.is-disabled {
    opacity: 0.55;
}

.w-effect-edit-stepper > .btn-gray,
.w-effect-edit-stepper > .btn-blue,
.w-effect-edit-stepper > .btn-green,
.w-effect-edit-stepper > .btn-red {
    min-width: 38px;
    height: 36px;
    padding: 0;
}

.w-effect-edit-field-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.w-effect-edit-field-stack .dark-select {
    width: 100%;
}

.w-effect-edit-color-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.w-effect-edit-basic-colors {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
}

.w-effect-edit-modal-content .w-gfx-basic-swatch {
    width: 16px;
    height: 16px;
    justify-self: center;
    border-radius: 4px;
}

.w-effect-edit-modal-content .w-gfx-basic-swatch.active {
    box-shadow: 0 0 0 2px rgba(255, 183, 1, 0.28);
}

.w-effect-edit-modal-content .w-gfx-color-shared {
    width: 30px;
    height: 30px;
}

#w-final-text-edit-modal .w-effect-edit-modal-content {
    width: min(324px, calc(100% - 24px));
}

#w-misc-frame-edit-modal .w-effect-edit-modal-content {
    width: min(312px, calc(100% - 24px));
}

#w-misc-page-number-modal .w-effect-edit-modal-content {
    width: min(312px, calc(100% - 24px));
}

.w-misc-page-number-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 34px;
    color: rgba(255, 243, 230, 0.92);
    font-size: 0.84rem;
    line-height: 1.2;
    cursor: pointer;
}

.w-misc-page-number-toggle input {
    margin: 0;
}

#w-misc-frame-edit-modal .w-effect-edit-section-body {
    gap: 12px;
}

#w-misc-frame-edit-modal .w-misc-frame-edit-controls {
    display: flex;
    width: 100%;
    min-width: 0;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#w-misc-frame-edit-modal .w-gfx-misc-align-count {
    min-width: 28px;
}

#w-misc-frame-edit-modal .w-gfx-misc-align-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

#w-misc-frame-edit-modal #w-gfx-misc-align-top,
#w-misc-frame-edit-modal #w-gfx-misc-align-left,
#w-misc-frame-edit-modal #w-gfx-misc-align-right,
#w-misc-frame-edit-modal #w-gfx-misc-align-bottom {
    grid-column: auto;
    grid-row: auto;
    align-self: auto;
    transform: none;
}

#w-misc-frame-edit-modal #w-gfx-color-section {
    display: flex !important;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    gap: 22px;
    order: initial;
}

#w-misc-frame-edit-modal .w-gfx-color-palette {
    display: grid;
    grid-template-columns: 54px repeat(7, minmax(0, 1fr));
    align-items: center;
    column-gap: 6px;
    row-gap: 10px;
    width: 100%;
}

#w-misc-frame-edit-modal .w-gfx-color-palette-lbl {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    align-items: center;
    align-self: center;
    justify-content: flex-end;
    justify-self: stretch;
    min-height: 30px;
    height: 30px;
    text-align: right;
}

#w-misc-frame-edit-modal .w-gfx-basic-colors {
    grid-column: 2 / span 6;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    align-items: center;
    align-self: center;
    align-content: center;
    min-height: 30px;
    height: 30px;
    transform: translateY(2px);
}

#w-misc-frame-edit-modal .w-gfx-color-shared {
    grid-column: 8;
    grid-row: 1;
    justify-self: center;
}

#w-misc-frame-edit-modal .w-gfx-basic-swatch {
    justify-self: center;
}

#w-misc-frame-edit-modal .w-gfx-outline-stack {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-inline-start: 0;
    gap: 8px;
    width: 100%;
    align-items: stretch;
}

#w-misc-frame-edit-modal .w-gfx-outline-mini {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 100%;
}

#w-misc-frame-edit-modal .w-gfx-mini-lbl {
    min-width: 0;
    text-align: right;
}

#w-misc-frame-edit-modal .w-misc-frame-slider-stepper {
    display: grid;
    grid-template-columns: 36px minmax(74px, auto) 36px;
    gap: 6px;
    align-items: center;
    justify-content: start;
    min-width: 0;
}

#w-misc-frame-edit-modal .w-gfx-slider-small {
    display: none;
}

#w-misc-frame-edit-modal .w-gfx-outline-val {
    min-height: 36px;
    min-width: 74px;
    padding: 0 8px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 183, 1, 0.22);
    background: rgba(255, 243, 230, 0.08);
    color: var(--border-cream);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    direction: ltr;
    unicode-bidi: isolate;
}

#w-misc-frame-edit-modal .w-misc-frame-slider-stepper > .btn-gray {
    min-width: 38px;
    height: 36px;
    padding: 0;
}

#w-misc-frame-edit-modal .w-gfx-color-stack {
    display: none;
}

.w-final-text-edit-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.w-final-text-edit-modal-content .t-rich-select {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.w-final-text-edit-modal-content .w-effect-edit-section-body {
    gap: 8px;
}

.w-final-text-edit-modal-content .w-effect-edit-control-row {
    grid-template-columns: 78px minmax(0, 1fr);
}

.w-final-text-edit-modal-content .w-effect-edit-control-label {
    font-size: 0.8rem;
}

.w-effect-edit-color-sliders {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.w-effect-edit-slider-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 183, 1, 0.16);
    border-radius: 10px;
    background: rgba(255, 243, 230, 0.04);
}

.w-effect-edit-slider-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.w-effect-edit-slider-label {
    color: rgba(255, 243, 230, 0.92);
    font-size: 0.78rem;
    line-height: 1.2;
}

.w-effect-edit-color-stack {
    gap: 6px;
}

.w-effect-edit-modal-content.is-disabled .w-effect-edit-hint {
    color: rgba(255, 243, 230, 0.72);
}

.w-newfx-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

#view-work .work-scan-mock {
    flex: 1;
    min-height: 0;
    margin: 10px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: auto;
}

#view-work .work-scan-live-host {
    display: flex;
    flex-direction: column;
    gap: 12px;
    direction: rtl;
    text-align: right;
}

#view-work .work-scan-live-host .t-setup-section {
    margin-bottom: 0;
}

#view-work .work-scan-live-host .t-start-row {
    justify-content: flex-end;
    margin-top: 0;
}

#view-work .work-scan-live-host #t-continue-hint {
    margin: 8px 0 0 auto !important;
    max-width: 100% !important;
    text-align: right !important;
}

#view-work .work-scan-block {
    border: 1px solid rgba(255,183,1,0.45);
    background: rgba(0,0,0,0.35);
    padding: 10px;
    min-height: 0;
}

#view-work .work-scan-title {
    color: var(--gold-accent);
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

#view-work .work-scan-items {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

#view-work .work-scan-item {
    border: 1px solid rgba(255,183,1,0.25);
    background: rgba(255,255,255,0.04);
    padding: 7px 8px;
    color: var(--border-cream);
    font-size: 0.88rem;
}
@media (max-width: 980px) {
    #view-work .work-shell {
        grid-template-columns: 1fr;
    }
    #view-work .w-phase-nav-toolbar.is-visible {
        grid-template-columns: 1fr;
        height: auto;
        gap: 8px;
    }
    #view-work .w-phase-nav-side {
        justify-content: center;
    }
    #view-work .work-editor-phase-tabs {
        justify-content: center;
    }
    #view-work .work-scan-mock {
        margin: 8px;
    }
    .info-grid {
        grid-template-columns: 1fr;
    }
    .info-visual-wrap {
        max-width: 100%;
    }
}
@media (max-width: 700px) {
    .info-hotspot {
        width: 48px;
        height: 48px;
    }
}
