/* --- Konva / Drawings Styles --- */

/* ── Designer pages embedded in admin: anchor the editor to #workarea ──
   The editor host (.drawings-admin-host) is absolutely positioned to fill the
   #workarea scroll cell. This makes the editor height independent of the
   intermediate wrapper chain, which differs between layouts:
     · old metronic:  #workarea > .m-body > .m-wrapper > .m-content > host
     · webnext:        main.content > #workarea > host
   Previously the host used height:100%, which only resolves when *every*
   ancestor is height-bounded. The compensating `:has(.editor-topnav)` rule
   only matched the old metronic .m-* classes, so in the webnext admin the
   chain stayed unbounded: the editor collapsed to content height,
   #large-container grew against an unbounded clientHeight, and the whole page
   scrolled instead of the inner Konva #scroll-container (badge ended up
   centered ~1500px down and the user-list panel scrolled with the page).
   #workarea exists and is height-bounded in every layout (old Web cshtml,
   Web.Blazor, webnext), so anchoring there is layout-agnostic. */
#workarea:has(.drawings-admin-host) {
    position: relative;
    overflow: hidden;
}

.drawings-admin-host {
    position: absolute;
    inset: 0;
}

/* ── Editor layout root ── */
#editor-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* ── Sidebars ── */
.editor-sidebar {
    display: flex;
    flex-direction: row;
    flex-shrink: 0;
    height: 100%;
    background: #f8fafc;
    overflow: hidden;
    transition: width 180ms ease, min-width 180ms ease;
}

.editor-sidebar-right {
    order: 3;
    width: 320px;
    min-width: 260px;
    max-width: 90vw;
    flex-direction: column;
    background: var(--intemo-white, #fff);
    border-left: 1px solid var(--intemo-gray-200, #cbd5e1);
    box-shadow: -2px 0 6px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    resize: horizontal;
}

.editor-sidebar-right.dragging {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    opacity: 0.92;
}

.editor-sidebar.sidebar-collapsed {
    width: 32px;
    min-width: 32px;
    resize: none;
}

.editor-sidebar.sidebar-collapsed .sidebar-drag-title {
    display: none;
}

.sidebar-drag-handle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 8px;
    background: #eef2f7;
    border-bottom: 1px solid #cbd5e1;
    user-select: none;
}

.sidebar-drag-handle .insert-toolbox-collapse-btn {
    margin: 0 0 0 auto;
    width: 22px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-drag-title {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-toggle-btn {
    flex-shrink: 0;
    width: 28px;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-left: 1px solid #e2e8f0;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    transition: background 0.1s, color 0.1s;
}

.editor-sidebar-right .sidebar-toggle-btn {
    border-left: none;
    border-right: 1px solid #e2e8f0;
}

.sidebar-toggle-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.sidebar-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: auto;
    display: flex;
    flex-direction: column;
}

.editor-sidebar.sidebar-collapsed .sidebar-content {
    display: none;
}

/* Panel card inside sidebar (replaces position:absolute panels) */
.sidebar-panel {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

/* Fix headers: remove negative-margin hack, no grab cursor */
.sidebar-panel .controls-panel-header,
.sidebar-panel .edit-panel-header {
    cursor: default;
    margin: 0;
    border-radius: 0;
}

.sidebar-panel .edition-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    margin: 0;
    font-weight: 600;
    font-size: 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    cursor: default;
}

/* Body padding within sidebar */
.sidebar-panel .controls-panel-body,
.sidebar-panel .edition-panel-body,
.sidebar-panel .edit-panel-body {
    padding: 4px 4px 6px;
    overflow-y: auto;
    /* Overlay scrollbar: doesn't push content, appears on top when needed */
    overflow-y: overlay;
    scrollbar-width: thin;
}

/* Layer panel inside sidebar */
/* Layer panel is now always floating (positioned by .layer-panel base styles) */

/* ── Canvas column ── */
#konva-container {
    order: 2;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
    background-color: #e5e7eb;
    overflow: hidden;
}

#konva-div {
    width: 100%;
    height: 100%;
}

#large-container {
    width: 3000px;
    height: 3000px;
    overflow: hidden;
}

#scroll-container {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-gutter: auto;
    margin: 10px;
    border: 1px solid #cbd5e1;
    background-color: #e5e7eb;
    scrollbar-width: auto;
    scrollbar-color: #6b7280 #d1d5db;
}

#scroll-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

#scroll-container::-webkit-scrollbar-track {
    background: #d1d5db;
}

#scroll-container::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 8px;
    border: 2px solid #d1d5db;
}

#scroll-container::-webkit-scrollbar-corner {
    background: #d1d5db;
}

/* Provider data loading overlay (card/ebadge editor) */
.provider-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.88);
    z-index: 100;
}

.provider-loading-spinner {
    width: 3.5rem;
    height: 3.5rem;
    border: 0.35rem solid #e2e8f0;
    border-top-color: #0b6a5e;
    border-radius: 50%;
    animation: provider-loading-spin 0.75s linear infinite;
}

.provider-loading-text {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
}

@keyframes provider-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Shared startup loader (Facility / Card / Ebadge designers) ──
   Full-area screen mirroring the WelcomeScreen header (intemo.Drawings + variant), with a
   vertical stepper (steps + substeps) in place of the "Click Open" hint. Shown until ready. */
.editor-loading-screen {
    position: absolute;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    padding: 24px;
    animation: editor-loading-fade-in 0.15s ease-out;
}

/* Single line: current task + cycling dots (1 → 2 → 3 → 1 …). */
.els-task {
    margin-top: 22px;
    font-size: 13.5px;
    font-weight: 500;
    color: #475569;
}

.els-dots::after {
    content: ".";
    animation: els-dots 1.2s step-end infinite;
}

@keyframes els-dots {
    0%   { content: "."; }
    33%  { content: ".."; }
    66%  { content: "..."; }
    100% { content: "."; }
}

@keyframes editor-loading-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Top-nav placeholder shown while the Blazor circuit is still connecting ──
   Prevents the (non-interactive) prerendered toolbar from looking clickable
   before its @onclick handlers are wired. Same height as the real top nav so
   the layout does not jump when the editor becomes interactive. */
.editor-topnav-connecting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 44px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

.editor-topnav-spinner {
    width: 1rem;
    height: 1rem;
    border: 0.18rem solid #e2e8f0;
    border-top-color: #0b6a5e;
    border-radius: 50%;
    animation: provider-loading-spin 0.75s linear infinite;
}

/* ── Zoom Toolbar (top-right of canvas) ── */
.zoom-toolbar {
    position: absolute;
    top: 10px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--intemo-white, #fff);
    border: 1px solid var(--intemo-gray-200, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    z-index: 35;
    height: 36px;
    padding: 0 2px;
    user-select: none;
}

.zoom-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--intemo-gray-600, #475569);
    transition: background 0.15s, color 0.15s;
}

.zoom-toolbar-btn:hover {
    background: var(--intemo-gray-100, #f1f5f9);
    color: var(--intemo-gray-800, #1e293b);
}

.zoom-toolbar-btn:active {
    background: var(--intemo-gray-200, #e2e8f0);
}

.zoom-toolbar-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    height: 32px;
    cursor: pointer;
    border-radius: 6px;
    border-left: 1px solid var(--intemo-gray-200, #e2e8f0);
    border-right: 1px solid var(--intemo-gray-200, #e2e8f0);
    transition: background 0.15s;
}

.zoom-toolbar-display:hover {
    background: var(--intemo-gray-100, #f1f5f9);
}

.zoom-toolbar-pct {
    font-family: var(--intemo-font, sans-serif);
    font-size: 13px;
    font-weight: 500;
    color: var(--intemo-gray-700, #334155);
    min-width: 42px;
    text-align: center;
}

.zoom-toolbar-chevron {
    color: var(--intemo-gray-400, #94a3b8);
    flex-shrink: 0;
}

/* ── Zoom Dropdown ── */
.zoom-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.zoom-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--intemo-white, #fff);
    border: 1px solid var(--intemo-gray-200, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    padding: 4px 0;
    z-index: 100;
}

.zoom-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: transparent;
    font-family: var(--intemo-font, sans-serif);
    font-size: 13px;
    color: var(--intemo-gray-700, #334155);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.zoom-dropdown-item:hover:not(.disabled) {
    background: var(--intemo-gray-100, #f1f5f9);
}

.zoom-dropdown-item.disabled {
    color: var(--intemo-gray-300, #cbd5e1);
    cursor: not-allowed;
}

.zoom-dropdown-shortcut {
    font-size: 12px;
    color: var(--intemo-gray-400, #94a3b8);
    margin-left: 16px;
}

.zoom-dropdown-divider {
    height: 1px;
    background: var(--intemo-gray-200, #e2e8f0);
    margin: 4px 0;
}

/* --- Canvas Panel --- */
.controls-panel {
    position: absolute;
    top: 10px;
    left: 12px;
    width: 320px;
    background: #ffffff;
    border: 1px solid #c7c7c7;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 10px;
    z-index: 30;
    
    resize: horizontal;
    overflow: hidden;
    min-height: 200px;
    max-height: 90vh;
    min-width: 250px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    height: auto;
}

.controls-panel-header,
.edit-panel-header,
.edition-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    cursor: grab;
}

.controls-panel-header,
.edit-panel-header {
    margin: -10px -10px 8px -10px;
    border-radius: 6px 6px 0 0;
}

.edition-panel-header {
    margin: 0;
}

.controls-panel-body,
.edit-panel-body,
.edition-panel-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    align-content: start;
    scrollbar-gutter: stable;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.controls-panel-body {
    gap: 6px;
}

.edit-panel-body {
}

.edition-panel-body {
}

.controls-panel-section,
.edit-panel-section {
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 0;
    margin: 0;
    background: #ffffff;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.controls-panel-section summary,
.edit-panel-section summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    padding: 6px 8px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 5px;
    list-style: none;
}

.controls-panel-section summary::-webkit-details-marker,
.edit-panel-section summary::-webkit-details-marker {
    display: none;
}

.controls-panel-section summary::before,
.edit-panel-section summary::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 10 13 14 9'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.15s;
    flex-shrink: 0;
}

.controls-panel-section[open] > summary::before,
.edit-panel-section[open] > summary::before {
    transform: rotate(180deg);
}

.controls-panel-section[open],
.edit-panel-section[open] {
    padding-bottom: 6px;
}

.controls-panel-section > label,
.controls-panel-section > div,
.controls-panel-section > .controls-panel-hint,
.controls-panel-section > .controls-panel-checkbox,
.controls-panel-section > .controls-panel-row,
.controls-panel-section > .text-format-toolbar,
.edit-panel-section > label,
.edit-panel-section > div,
.edit-panel-section > .edit-panel-hint,
.edit-panel-section > .controls-panel-checkbox,
.edit-panel-section > .controls-panel-row,
.edit-panel-section > .text-format-toolbar {
    margin-left: 4px;
    margin-right: 4px;
    margin-top: 5px;
}

.controls-panel-body label,
.edit-panel-body label {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    font-size: 12px;
    min-width: 0;
}

.controls-panel-body input:not([type="checkbox"]):not([type="range"]),
.controls-panel-body select,
.edit-panel-body input:not([type="checkbox"]):not([type="range"]):not([type="color"]) {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12px;
}

.controls-panel-body input[type="checkbox"] {
    width: auto;
}

.controls-panel-body input[readonly],
.edit-panel-body input[readonly] {
    background: #f8fafc;
    color: #64748b;
}

.controls-panel-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.edit-panel-body .controls-panel-checkbox {
    display: flex;
    grid-template-columns: none;
}

.controls-panel-checkbox input {
    width: auto;
}

.controls-panel-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.controls-panel-hint,
.edit-panel-hint {
    font-size: 11px;
    color: #64748b;
}

/* Multi-column compact grids for property panel.
   Fit 2-4 short numeric inputs per row to save vertical space. */
.edit-panel-body .prop-grid-2,
.edit-panel-body .prop-grid-4 {
    display: grid;
    gap: 6px;
    margin: 5px 4px 0;
    min-width: 0;
}

.edit-panel-body .prop-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.edit-panel-body .prop-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.edit-panel-body .prop-grid-2 > label,
.edit-panel-body .prop-grid-4 > label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px;
    align-items: center;
    margin: 0;
    font-size: 11px;
    min-width: 0;
}

.edit-panel-body .prop-grid-2 > label > input,
.edit-panel-body .prop-grid-4 > label > input,
.edit-panel-body .prop-grid-2 > label > select,
.edit-panel-body .prop-grid-4 > label > select {
    width: 100%;
    padding: 3px 4px;
    font-size: 11px;
    min-width: 0;
}

.edit-panel-body .prop-grid-2 > label > .pad-icon,
.edit-panel-body .prop-grid-4 > label > .pad-icon {
    width: 14px;
    height: 14px;
    color: #64748b;
    flex-shrink: 0;
}

.edit-panel-body .padding-all-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 4px 4px 0;
}

.edit-panel-body .padding-all-row > label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px;
    align-items: center;
    margin: 0;
    font-size: 11px;
    min-width: 0;
}

.edit-panel-body .padding-all-row > label > input {
    width: 100%;
    padding: 3px 4px;
    font-size: 11px;
    min-width: 0;
}

/* --- Edition Panel (Tools) --- */
.edition-floating-panel {
    position: absolute !important;
    top: 400px;
    left: 12px;
    width: 320px;
    background: #ffffff;
    border: 1px solid #c7c7c7;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 10px;
    z-index: 50;
    
    resize: horizontal;
    overflow: hidden;
    min-height: 100px;
    max-height: 90vh;
    min-width: 250px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    height: auto;
}


/* --- Edit Panel (Properties) --- */
.edit-panel {
    position: absolute;
    top: 70px;
    width: 260px;
    background: #ffffff;
    border: 1px solid #c7c7c7;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 10px;
    z-index: 20;

    resize: horizontal;
    overflow: hidden;
    min-height: 200px;
    max-height: 90vh;
    min-width: 240px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    height: auto;
}

#edit-panel {
    width: 100%;
    min-width: 0;
}

.edit-panel-left {
    left: 12px;
}

.edit-panel-right {
    right: 12px;
}

.edit-panel-lock-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-inline-size: 0;
    display: grid;
    gap: 6px;
}

.color-input-group {
    display: grid;
    grid-template-columns: 1fr 34px;
    gap: 6px;
    align-items: center;
}

.color-picker-button {
    position: relative;
    width: 34px;
    height: 28px;
    padding: 0;
    border: 1px solid #c7c7c7;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.color-picker-button::before {
    position: absolute;
    content: "";
    inset: 0;
    background: url("data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 2'><path fill='white' d='M1,0H2V1H1V0ZM0,1H1V2H0V1Z'/><path fill='gray' d='M0,0H1V1H0V0ZM1,1H2V2H1V1Z'/></svg>");
    background-size: 6px;
    border-radius: 4px;
}

.color-picker-button::after {
    position: absolute;
    content: "";
    inset: 0;
    border-radius: 4px;
    background: var(--pcr-color, #ffffff);
}

/* --- Device Selection Panel --- */
.device-selection-panel {
    position: absolute;
    top: 50px;
    left: 350px;
    width: 250px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
    padding: 0;
    z-index: 60; /* Higher than edition panel */
    
    resize: both;
    overflow: hidden;
    min-height: 200px;
    max-height: 80vh;
    min-width: 200px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
}

.device-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    font-weight: 600;
    font-size: 12px;
    cursor: grab;
    color: #334155;
    background: #f8fafc;
    padding: 6px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.device-selection-close {
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
}

.device-selection-close:hover {
    color: #dc2626;
}

.device-selection-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: 8px;
}

.device-list {
    margin-top: 8px;
    display: grid;
    gap: 4px;
}

.device-type-section {
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 2px;
}

.device-type-section summary {
    font-size: 11px;
    padding: 4px 6px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
}

.device-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-bottom: 1px solid #e2e8f0;
    cursor: grab;
    background: #fff;
    transition: background 0.2s;
}

.device-item:hover {
    background: #f1f5f9;
}

.device-item:active {
    cursor: grabbing;
}

.traffic-light-icon {
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHJlY3QgeD0iNyIgeT0iMiIgd2lkdGg9IjEwIiBoZWlnaHQ9IjIwIiByeD0iMiIgcnk9IjIiIGZpbGw9IiMzMzMiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLXdpZHRoPSIxIi8+PGNpcmNsZSBjeD0iMTIiIGN5PSI2IiByPSIyLjUiIGZpbGw9IiNmZjAwMDAiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLXdpZHRoPSIwLjUiLz48Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIyLjUiIGZpbGw9IiNmZmViM2IiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLXdpZHRoPSIwLjUiLz48Y2lyY2xlIGN4PSIxMiIgY3k9IjE4IiByPSIyLjUiIGZpbGw9IiM0Y2FmNTAiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLXdpZHRoPSIwLjUiLz48L3N2Zz4=");
}

.device-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.device-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.device-code {
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-desc {
    font-size: 10px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.controls-panel-body input:not([type="checkbox"]):not([type="range"]):focus,
.controls-panel-body select:focus,
.edit-panel-body input:not([type="checkbox"]):not([type="range"]):not([type="color"]):focus,
.device-filter-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.18);
}

/* --- Misc --- */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    position: relative;
}

.close {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 20px;
}

.select-same-type-popup {
    min-width: 280px;
    max-width: 90vw;
}
.popup-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}
.popup-hint {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    color: var(--intemo-teal, #005d55);
}
.select-same-type-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}
.select-same-type-list li {
    margin-bottom: 0.25rem;
}
.select-same-type-item {
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.6rem;
}
.keyboard-hint {
    font-size: 0.8rem;
    color: #555;
}

/* Radial Menu */
.radial-menu-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; 
    z-index: 1000;
}

.radial-menu-container svg {
    pointer-events: auto;
}

.radial-menu-container g {
    cursor: pointer;
    transition: transform 0.2s, fill 0.2s;
}

.radial-menu-container text {
    font-family: Arial, sans-serif;
    font-size: 12px;
    fill: #000;
    text-anchor: middle;
    user-select: none;
}

.radial-menu-container.hidden {
    display: none;
}

#menu-holder {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3000;
}

.menu-segment {
    fill: #fdfff9;
    opacity: 0.5;
}

.menu-segment:hover {
    fill: #5689cd;
}

.menu-icon {
    pointer-events: none;
}

.svg-holder {
    margin: 0 auto;
}

.device-filter-input {
    width: 100%;
    padding: 6px;
    margin-bottom: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12px;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* --- Text Format Toolbar (inside edit panel) --- */
.text-format-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    padding: 4px 0 2px 0;
}

.text-format-group {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px;
}

.text-format-group .controls-panel-button {
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 4px;
}

.text-format-separator {
    width: 1px;
    height: 20px;
    background: #e0e0e0;
    margin: 0 2px;
}

/* Wrap / Overflow mode button groups (3-option inline) */
.text-mode-btn-group {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px;
}

.text-mode-btn-group .controls-panel-button {
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 4px;
}

.controls-panel-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 12px;
    transition: background 0.12s, border-color 0.12s;
    color: #334155;
}

.controls-panel-button:hover:not(:disabled) {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.controls-panel-button.controls-panel-button-active {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.controls-panel-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.controls-panel-button svg {
    width: 16px;
    height: 16px;
}

/* --- Shape Toolbar --- */
.shape-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    z-index: 35;
    flex-shrink: 0;
}

.shape-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 6px;
    transition: background 0.15s, border-color 0.15s;
    color: #334155;
}

.shape-tool-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.shape-tool-btn.active {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.shape-tool-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.shape-tool-btn svg {
    width: 20px;
    height: 20px;
}

.shape-toolbar-separator {
    width: 1px;
    height: 24px;
    background: #e0e0e0;
    margin: 0 6px;
}

.shape-toolbar-hint {
    font-size: 12px;
    color: #64748b;
    margin-left: 4px;
}

.shape-toolbar-spacer {
    flex: 1;
}

.shape-toolbar-grid-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    overflow: visible;
}

.grid-settings-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: transparent;
}

.view-controls-grid-settings-wrapper {
    position: relative;
}

.grid-settings-popup {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    padding: 10px 14px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.grid-settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
}

.grid-settings-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
    cursor: pointer;
}

input.grid-size-input,
input.grid-size-input[type="number"] {
    width: 48px !important;
    max-width: 48px !important;
    min-width: 0;
    padding: 3px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    margin-left: auto;
    box-sizing: border-box;
    -moz-appearance: textfield;
}

.grid-size-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* --- Layer Panel --- */
.layer-panel {
    position: absolute;
    bottom: 20px;
    left: 60px;
    top: auto;
    right: auto;
    width: 260px;
    max-height: 60vh;
    background: #ffffff;
    border: 1px solid #c7c7c7;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    z-index: 80;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    min-width: 200px;
    min-height: 180px;
    max-width: 450px;
}

.layer-panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-weight: 600;
    font-size: 13px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    cursor: grab;
    flex-shrink: 0;
}

.layer-panel-header > span:first-of-type {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-panel-collapse-btn {
    cursor: pointer;
    flex-shrink: 0;
}

.layer-panel-collapsed {
    max-height: none !important;
    height: auto !important;
    min-height: 0 !important;
    resize: none;
}

.layer-panel-collapsed .layer-panel-header {
    border-bottom: none;
}

.layer-panel-close {
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    color: #888;
    border-radius: 3px;
}

.layer-panel-close:hover {
    color: #d00;
    background: #fee;
}

.layer-filter-input {
    margin: 6px 8px 4px 8px;
    padding: 4px 8px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    font-size: 11px;
    flex-shrink: 0;
}

.layer-list {
    flex: 1;
    overflow-y: auto;
    padding: 2px 0;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f2f2f2;
    transition: background 0.12s;
    user-select: none;
}

.layer-item:hover {
    background: #f0f5ff;
}

.layer-item.selected {
    background: #dbeafe;
    border-left: 3px solid #3b82f6;
    padding-left: 3px;
}

.layer-item.hidden-shape {
    opacity: 0.45;
}

.layer-item.locked-shape {
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 6px,
        rgba(0,0,0,0.03) 6px,
        rgba(0,0,0,0.03) 12px
    );
}

.layer-item-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: #64748b;
}

.layer-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.layer-item-name-input {
    flex: 1;
    min-width: 0;
    padding: 1px 4px;
    border: 1px solid #3b82f6;
    border-radius: 3px;
    font-size: 12px;
    outline: none;
}

.layer-child-count {
    font-size: 10px;
    color: #94a3b8;
    margin-left: 2px;
}

.layer-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    padding: 2px;
    color: #64748b;
    flex-shrink: 0;
}

.layer-action-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.layer-reorder-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    font-size: 8px;
    color: #94a3b8;
    flex-shrink: 0;
}

.layer-reorder-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

.layer-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}

.layer-dragging {
    opacity: 0.5;
    background: #f1f5f9;
}

.layer-drop-indicator {
    height: 2px;
    background: #3b82f6;
    margin: 0 4px;
    border-radius: 1px;
}

/* --- Layer Panel: order actions bar --- */
.layer-order-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.layer-order-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    padding: 4px 2px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    font-size: 10px;
    color: #475569;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}

.layer-order-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.layer-order-btn:active {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* ═══════════════════════════════════════════════════════════════
   intemo.Drawings — Brand & UI Redesign
   Brand: Montserrat font, #005d55 teal accent
   ═══════════════════════════════════════════════════════════════ */

/* Brand UI font under a PRIVATE family name so user-uploaded custom fonts (which keep
   their real names, e.g. "Montserrat") can never hijack the editor chrome. Variable font:
   the weight range covers the UI weights (300/400/500/600). Drop the file at
   wwwroot/fonts/Montserrat-VariableFont_wght.ttf (served from _content/Intemo.Drawings.Components/fonts/).
   If the file is absent the UI gracefully falls back to the system stack below. */
@font-face {
    font-family: 'IntemoBrand';
    src: url('../fonts/Montserrat-VariableFont_wght.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --intemo-teal: #005d55;
    --intemo-teal-light: #007a70;
    --intemo-teal-bg: #e6f2f1;
    --intemo-teal-hover: #004a44;
    --intemo-black: #0f172a;
    --intemo-gray-700: #334155;
    --intemo-gray-500: #64748b;
    --intemo-gray-400: #94a3b8;
    --intemo-gray-300: #cbd5e1;
    --intemo-gray-200: #e2e8f0;
    --intemo-gray-100: #f1f5f9;
    --intemo-gray-50: #f8fafc;
    --intemo-white: #ffffff;
    --intemo-red: #dc2626;
    --intemo-green: #16a34a;
    /* UI chrome font. Must use a PRIVATE family name, never a public one a user might
       upload as a custom design font. Previously this was bare 'Montserrat' — uploading
       Montserrat-VariableFont.ttf registered a FontFace("Montserrat") that hijacked the
       whole editor UI (topnav/dialogs swapped to the uploaded variable font). 'Montserrat'
       was never actually shipped here, so the UI already rendered in the system fallback;
       to restore brand Montserrat, add an @font-face for 'IntemoBrand' pointing at a
       bundled Montserrat file. */
    --intemo-font: 'IntemoBrand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── DrawingsHome ── */

.drawings-home {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.drawings-home-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    gap: 32px;
    padding: 24px;
}

.drawings-home-title {
    text-align: center;
}

.drawings-home-title .editor-topnav-wordmark {
    font-size: 1.5rem;
}

.drawings-home-title .editor-topnav-logo-suffix {
    font-size: 1.5rem;
}

.drawings-home-subtitle {
    margin-top: 8px;
    font-size: 1rem;
    color: #64748b;
    font-weight: 400;
}

.drawings-home-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 780px;
    width: 100%;
}

@media (max-width: 700px) {
    .drawings-home-grid {
        grid-template-columns: 1fr;
        max-width: 320px;
    }
}

.editor-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 20px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    text-align: center;
}

.editor-card:hover {
    border-color: #007a70;
    box-shadow: 0 4px 16px rgba(0, 93, 85, 0.13);
    transform: translateY(-2px);
}

.editor-card.active {
    border-color: #005d55;
    box-shadow: 0 4px 16px rgba(0, 93, 85, 0.18);
}

.editor-card-icon {
    width: 48px;
    height: 48px;
    color: #007a70;
    flex-shrink: 0;
}

.editor-card-icon svg {
    width: 100%;
    height: 100%;
}

.editor-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #334155;
}

.editor-card-desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

/* ─── Top Navigation Bar ─── */

.editor-topnav {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 16px;
    height: 48px;
    background: var(--intemo-white);
    border-bottom: 1px solid var(--intemo-gray-200);
    font-family: var(--intemo-font);
    z-index: 100;
    flex-shrink: 0;
}

.editor-topnav-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 24px;
    text-decoration: none;
    color: var(--intemo-teal);
    flex-shrink: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.editor-topnav-logo .editor-topnav-wordmark {
    font-family: var(--intemo-font);
    font-size: 15px;
    font-weight: 600;
    color: var(--intemo-teal);
    flex-shrink: 0;
}

.editor-topnav-logo-suffix {
    font-family: var(--intemo-font);
    font-size: 15px;
    font-weight: 300;
    color: var(--intemo-gray-500);
    letter-spacing: -0.3px;
}

/* ─── Tab Pills ─── */

.editor-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: auto;
}

.editor-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-family: var(--intemo-font);
    font-size: 13px;
    font-weight: 500;
    color: var(--intemo-gray-500);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1;
}

.editor-tab:hover {
    background: var(--intemo-gray-100);
    color: var(--intemo-gray-700);
}

.editor-tab.active {
    background: var(--intemo-teal-bg);
    color: var(--intemo-teal);
    font-weight: 600;
}

.editor-tab.active svg {
    color: var(--intemo-teal);
    stroke: var(--intemo-teal);
}

.editor-tab svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ─── Separator ─── */

.editor-topnav-sep {
    width: 1px;
    height: 24px;
    background: var(--intemo-gray-200);
    margin: 0 12px;
    flex-shrink: 0;
}

/* ─── Document label in topnav ─── */

.editor-topnav-doc {
    font-family: var(--intemo-font);
    font-size: 12px;
    color: var(--intemo-gray-500);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

/* ─── Topnav spacer (pushes language selector to right) ─── */

.editor-topnav-spacer {
    flex: 1;
    min-width: 8px;
}

/* ─── Language selector ─── */

.editor-topnav-lang {
    display: flex;
    align-items: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.editor-topnav-lang .lang-select {
    font-family: var(--intemo-font);
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--intemo-gray-200);
    border-radius: 4px;
    background: var(--intemo-white);
    color: var(--intemo-gray-700);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.editor-topnav-lang .lang-select:hover {
    border-color: var(--intemo-gray-400);
}

.editor-topnav-lang .lang-select:focus {
    border-color: var(--intemo-primary);
}

/* ─── Zoom controls in topnav ─── */

.editor-topnav-zoom {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--intemo-white, #fff);
    border: 1px solid var(--intemo-gray-200, #e2e8f0);
    border-radius: 8px;
    height: 34px;
    padding: 0 2px;
    user-select: none;
    flex-shrink: 0;
    margin-right: 0;
}

.editor-topnav-zoom .zoom-toolbar-btn {
    width: 30px;
    height: 30px;
}

.editor-topnav-zoom .zoom-toolbar-display {
    height: 30px;
}

.editor-topnav-zoom .zoom-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 200;
}

/* ─── Action Buttons (Open/Save/Delete) ─── */

.editor-action-buttons {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.editor-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font-family: var(--intemo-font);
    font-size: 12px;
    font-weight: 500;
    color: var(--intemo-gray-700);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.editor-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.editor-action-btn:hover:not(:disabled) {
    background: var(--intemo-gray-100);
    border-color: var(--intemo-gray-300);
}

.editor-action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.editor-action-btn.action-save:hover:not(:disabled) {
    background: #f0fdf4;
    border-color: #86efac;
    color: var(--intemo-green);
}

.editor-action-btn.action-delete:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #fca5a5;
    color: var(--intemo-red);
}

/* ─── Status badge ─── */

.editor-status-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.editor-status {
    border: 0;
    font-family: var(--intemo-font);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.editor-status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-status-toggle {
    margin-left: 8px;
    flex: 0 0 auto;
    font-weight: 600;
}

.editor-status.expanded {
    max-width: min(520px, 80vw);
}

.editor-status-details {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    max-width: min(640px, 85vw);
    max-height: 240px;
    overflow: auto;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
}

.editor-status.status-ok {
    color: var(--intemo-green);
    background: #f0fdf4;
}

.editor-status.status-error {
    color: var(--intemo-red);
    background: #fef2f2;
}

.editor-status.status-warn {
    color: #b45309;
    background: #fffbeb;
}

.editor-status-details.status-ok {
    color: var(--intemo-green);
    background: #f0fdf4;
    border: 1px solid #86efac;
}

.editor-status-details.status-error {
    color: var(--intemo-red);
    background: #fef2f2;
    border: 1px solid #fca5a5;
}

.editor-status-details.status-warn {
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fcd34d;
}

/* ═══════════════════════════════════════════════════════════════
   Welcome Screen
   ═══════════════════════════════════════════════════════════════ */

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, var(--intemo-gray-50) 0%, var(--intemo-white) 40%, var(--intemo-teal-bg) 100%);
    font-family: var(--intemo-font);
    user-select: none;
}

.welcome-logo {
    color: var(--intemo-teal);
    margin-bottom: 12px;
}

.welcome-logo svg,
.welcome-logo img {
    height: 40px;
    width: auto;
    max-width: 200px;
    display: block;
    object-fit: contain;
}

.welcome-product-name {
    display: flex;
    align-items: baseline;
    gap: 1px;
    margin-bottom: 8px;
}

.welcome-product-name .brand {
    font-size: 32px;
    font-weight: 600;
    color: var(--intemo-teal);
    letter-spacing: -0.5px;
}

.welcome-product-name .product {
    font-size: 32px;
    font-weight: 300;
    color: var(--intemo-gray-700);
    letter-spacing: -0.5px;
}

.welcome-variant {
    font-size: 14px;
    font-weight: 500;
    color: var(--intemo-gray-400);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 40px;
}

.welcome-hint {
    font-size: 13px;
    font-weight: 400;
    color: var(--intemo-gray-400);
}

.welcome-hint svg {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   Open Drawing Dialog (Modal)
   ═══════════════════════════════════════════════════════════════ */

/* Inline custom-fonts launcher: select + "+" button in the same row.
   Used by the FontFamily edit control in the text-style panel. */
.font-family-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
}
.font-family-row .controls-select { flex: 1 1 auto; min-width: 0; }
.font-family-manage-btn {
    flex: 0 0 auto;
    width: 26px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: var(--intemo-white, #fff);
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: var(--intemo-text, #1a1a1a);
}
.font-family-manage-btn:hover { background: rgba(0, 0, 0, 0.05); }

/* Font manager hosted inside the in-editor dialog. Larger body to fit the table. */
.font-manager-dialog .dialog-body { max-height: 70vh; overflow: auto; }

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: dialog-fade-in 0.15s ease-out;
}

@keyframes dialog-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog-panel {
    background: var(--intemo-white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 520px;
    max-width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    font-family: var(--intemo-font);
    animation: dialog-slide-up 0.2s ease-out;
    overflow: hidden;
    position: relative;
}

/* Busy overlay — covers the whole panel while a (slow, remote-SQL) load runs.
   Blocks tab switching and re-loads; the only enabled control is Cancelar. */
.dialog-busy-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.92);
    border-radius: inherit;
}

.dialog-busy-overlay .dialog-btn {
    margin-top: 18px;
}

@keyframes dialog-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--intemo-gray-200);
}

.dialog-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--intemo-black);
}

.dialog-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--intemo-gray-400);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.dialog-close:hover {
    background: var(--intemo-gray-100);
    color: var(--intemo-gray-700);
}

.dialog-close svg {
    width: 16px;
    height: 16px;
}

/* Dialog tabs */

.dialog-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--intemo-gray-200);
}

.dialog-tab {
    padding: 10px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-family: var(--intemo-font);
    font-size: 13px;
    font-weight: 500;
    color: var(--intemo-gray-500);
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
    margin-bottom: -1px;
}

.dialog-tab:hover {
    color: var(--intemo-gray-700);
}

.dialog-tab.active {
    color: var(--intemo-teal);
    border-bottom-color: var(--intemo-teal);
    font-weight: 600;
}

/* Immediate press feedback — InteractiveServer routes the @onclick through the
   circuit, so without this the tab looks dead until the round-trip returns. */
.dialog-tab:active {
    background: var(--intemo-gray-100);
}

.dialog-tab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dialog-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
}

/* New tab — template grid */

.new-template-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.new-template-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--intemo-gray-600);
}

.new-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.new-template-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px 10px;
    border: 1.5px solid var(--intemo-gray-200);
    border-radius: 10px;
    background: var(--intemo-white);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    text-align: center;
}

.new-template-card:hover {
    border-color: var(--intemo-gray-400);
    background: var(--intemo-gray-50, #fafafa);
}

.new-template-card.selected {
    border-color: var(--intemo-teal);
    background: var(--intemo-teal-bg);
    box-shadow: 0 0 0 2px var(--intemo-teal-bg);
}

.new-template-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--intemo-gray-400);
}

.new-template-card.selected .new-template-card-icon {
    color: var(--intemo-teal);
}

.new-template-card-icon svg {
    width: 100%;
    height: 100%;
}

.new-template-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--intemo-gray-700);
    line-height: 1.3;
}

.new-template-card.selected .new-template-card-label {
    color: var(--intemo-teal);
}

.new-template-card-desc {
    font-size: 10px;
    color: var(--intemo-gray-400);
    line-height: 1.2;
}

.new-template-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid var(--intemo-gray-200);
    margin-top: 4px;
}

.new-template-name-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--intemo-gray-700);
    white-space: nowrap;
}

.new-template-name-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--intemo-gray-300);
    border-radius: 6px;
    font-family: var(--intemo-font);
    font-size: 13px;
    color: var(--intemo-gray-700);
    background: var(--intemo-white);
    outline: none;
    transition: border-color 0.15s;
}

.new-template-form {
    margin-top: 10px;
}

.new-template-form-control {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--intemo-gray-300);
    border-radius: 6px;
    font-family: var(--intemo-font);
    font-size: 13px;
    color: var(--intemo-gray-700);
    background: var(--intemo-white);
    outline: none;
    transition: border-color 0.15s;
}

/* ─── Page count stepper ─── */
.new-page-count-control {
    display: flex;
    align-items: center;
    gap: 0;
    width: fit-content;
    border: 1px solid var(--intemo-gray-300);
    border-radius: 6px;
    overflow: hidden;
    background: var(--intemo-white);
}

.new-page-count-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--intemo-gray-100);
    color: var(--intemo-gray-700);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.new-page-count-btn:hover:not(:disabled) {
    background: var(--intemo-gray-200);
}

.new-page-count-btn:disabled {
    color: var(--intemo-gray-400);
    cursor: default;
}

.new-page-count-value {
    min-width: 36px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--intemo-gray-700);
    padding: 0 4px;
}

.new-template-name-input:focus {
    border-color: var(--intemo-teal);
    box-shadow: 0 0 0 2px var(--intemo-teal-bg);
}

.new-template-form-control:focus {
    border-color: var(--intemo-teal);
    box-shadow: 0 0 0 2px var(--intemo-teal-bg);
}

/* File tab */

.file-drop-zone {
    border: 2px dashed var(--intemo-gray-300);
    border-radius: 10px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.file-drop-zone:hover,
.file-drop-zone-dragover {
    border-color: var(--intemo-teal);
    background: var(--intemo-teal-bg);
}

.file-drop-zone svg {
    width: 36px;
    height: 36px;
    color: var(--intemo-gray-400);
    margin-bottom: 10px;
}

.file-drop-zone:hover svg,
.file-drop-zone-dragover svg {
    color: var(--intemo-teal);
}

.file-drop-zone-text {
    font-size: 13px;
    color: var(--intemo-gray-500);
}

.file-drop-zone-hint {
    font-size: 11px;
    color: var(--intemo-gray-400);
    margin-top: 6px;
}

/* Server tab */

.server-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.server-form label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--intemo-gray-700);
    margin-bottom: 4px;
}

.server-form select {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--intemo-gray-300);
    border-radius: 6px;
    font-family: var(--intemo-font);
    font-size: 13px;
    color: var(--intemo-gray-700);
    background: var(--intemo-white);
    transition: border-color 0.15s;
    outline: none;
}

.server-form select:focus {
    border-color: var(--intemo-teal);
    box-shadow: 0 0 0 2px var(--intemo-teal-bg);
}

.server-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--intemo-gray-400);
    font-size: 14px;
    font-weight: 400;
}

.server-coming-soon svg {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.server-resource-list {
    padding: 4px 0;
}
.server-resource-list-loading,
.server-resource-list-empty {
    padding: 24px 16px;
    color: var(--intemo-gray-400);
    font-size: 13px;
    text-align: center;
}
.server-resource-list-error {
    padding: 16px;
    color: var(--intemo-red);
    font-size: 13px;
}

/* Samples tab */

.samples-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sample-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    font-family: var(--intemo-font);
    font-size: 13px;
    color: var(--intemo-gray-700);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    text-align: left;
    width: 100%;
}

.sample-item:hover {
    background: var(--intemo-gray-100);
    border-color: var(--intemo-gray-300);
}

.sample-item.selected {
    background: var(--intemo-teal-bg);
    border-color: var(--intemo-teal);
    color: var(--intemo-teal);
}

.sample-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--intemo-gray-400);
}

.sample-item.selected svg {
    color: var(--intemo-teal);
}

.sample-item-label {
    flex: 1;
}

.sample-item-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--intemo-gray-200);
    color: var(--intemo-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dialog footer */

.dialog-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--intemo-gray-200);
}

.dialog-btn {
    padding: 7px 18px;
    border: 1px solid var(--intemo-gray-300);
    border-radius: 6px;
    background: var(--intemo-white);
    font-family: var(--intemo-font);
    font-size: 13px;
    font-weight: 500;
    color: var(--intemo-gray-700);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.dialog-btn:hover {
    background: var(--intemo-gray-100);
    border-color: var(--intemo-gray-300);
}

.dialog-btn-primary {
    background: var(--intemo-teal);
    border-color: var(--intemo-teal);
    color: var(--intemo-white);
}

.dialog-btn-primary:hover {
    background: var(--intemo-teal-hover);
    border-color: var(--intemo-teal-hover);
}

.dialog-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Print dialog --- */

.print-dialog-panel {
    max-width: 440px;
}

.print-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.print-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    user-select: none;
}

.print-option:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.print-option.selected {
    border-color: var(--intemo-teal, #14b8a6);
    background: var(--intemo-teal-bg, #f0fdfa);
}

.print-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.print-option-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    transition: border-color 0.12s;
}

.print-option.selected .print-option-radio {
    border-color: var(--intemo-teal, #14b8a6);
}

.print-option-radio-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--intemo-teal, #14b8a6);
}

.print-option-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    transition: border-color 0.12s, background 0.12s;
}

.print-option-checkbox.checked {
    border-color: var(--intemo-teal, #14b8a6);
    background: var(--intemo-teal, #14b8a6);
    color: #fff;
}

.print-option-checkbox svg {
    width: 11px;
    height: 11px;
}

.print-option-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.print-option-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: #64748b;
    margin-top: 1px;
}

.print-option.selected .print-option-icon {
    color: var(--intemo-teal, #14b8a6);
}

.print-option-label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    color: #1e293b;
    line-height: 1.4;
}

.print-option-desc {
    display: block;
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.4;
    margin-top: 2px;
}

/* --- Minimapa --- */
.minimap-panel {
    position: absolute;
    bottom: 24px;
    left: 24px;
    width: 200px; /* Ancho fijo, el alto se calcula en JS */
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transition: width 0.2s, height 0.2s;
}

.minimap-panel.minimized {
    width: auto !important;
    height: auto !important;
}

.minimap-panel.minimized .minimap-body {
    display: none;
}

.minimap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    cursor: grab;
    user-select: none;
}

.minimap-header:active {
    cursor: grabbing;
}

.minimap-title {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.minimap-toggle-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimap-toggle-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.minimap-body {
    padding: 8px;
    background: #f1f5f9;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimap-content {
    position: relative;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    /* El JS asignará el ancho y alto exacto aquí */
}

.minimap-image {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none; /* No queremos que la imagen interfiera con los clics */
}

/* Defensa en profundidad: si la <img> aún no tiene src válido no mostrar el
   icono de "imagen rota" del navegador. El JS sólo asigna src cuando el snapshot
   se ha generado correctamente. */
.minimap-image:not([src]),
.minimap-image[src=""] {
    visibility: hidden;
}

.minimap-viewport {
    position: absolute;
    border: 1.5px solid #0ea5e9;
    background-color: rgba(14, 165, 233, 0.15);
    cursor: grab;
    box-sizing: border-box;
    /* El JS asignará top, left, width, height aquí */
}

.minimap-viewport:active {
    cursor: grabbing;
}

/* ─── Gradient Origin XY Pad ─── */

.gradient-offset-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 4px;
}

.gradient-xy-pad {
    position: relative;
    width: 64px;
    height: 64px;
    min-width: 64px;
    background:
        linear-gradient(to right, #e5e7eb 1px, transparent 1px),
        linear-gradient(to bottom, #e5e7eb 1px, transparent 1px),
        #f9fafb;
    background-size: 16px 16px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
}

.gradient-xy-pad::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 1px; height: 1px;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
    pointer-events: none;
}

.gradient-xy-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #fff;
    box-shadow: 0 0 3px rgba(0,0,0,0.4);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.gradient-offset-inputs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.gradient-offset-inputs label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #6b7280;
}

.gradient-offset-inputs input[type="number"] {
    width: 54px;
    padding: 2px 4px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    background: #fff;
    color: #1f2937;
}

.btn-reset-offset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
}

.btn-reset-offset:hover {
    background: #e5e7eb;
    color: #374151;
}

/* ─── Gradient Editor Component ─── */

.gradient-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}

.gradient-bar-container {
    position: relative;
    width: 100%;
    height: 28px;
}

.gradient-bar {
    position: absolute;
    inset: 0;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    cursor: crosshair;
}

.gradient-bar-drag-overlay {
    position: absolute;
    inset: -30px -20px;
    z-index: 10;
    cursor: grabbing;
}

.gradient-stop-marker {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--stop-color, #fff);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #9ca3af, 0 1px 3px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 2;
    transition: box-shadow 0.1s;
}

.gradient-stop-marker:hover {
    box-shadow: 0 0 0 1px #6366f1, 0 1px 4px rgba(0,0,0,0.4);
}

.gradient-stop-marker.selected {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px #4f46e5, 0 1px 4px rgba(0,0,0,0.4);
    z-index: 3;
}

.gradient-stop-marker:active {
    cursor: grabbing;
}

.gradient-stop-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
}

.gradient-stop-color-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Gradient stop uses same .color-input-group + .color-picker-button as solid fill */

.gradient-stop-color-row .color-input-group {
    flex: 1;
}

.gradient-color-text {
    flex: 1;
    min-width: 0;
    padding: 2px 4px;
    font-size: 11px;
    font-family: monospace;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    background: #fff;
    color: #1f2937;
}

.gradient-stop-position-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gradient-stop-label {
    font-size: 11px;
    color: #6b7280;
    min-width: 22px;
}

.gradient-position-slider {
    flex: 1;
    height: 16px;
    cursor: pointer;
}

.gradient-stop-value {
    font-size: 11px;
    color: #6b7280;
    min-width: 28px;
    text-align: right;
}

.gradient-stop-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.gradient-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
}

.gradient-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.gradient-btn-remove {
    color: #dc2626;
    font-size: 11px;
}

.gradient-btn-remove:hover {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* ── Keyboard shortcuts reference ── */
.shortcuts-reference {
    padding: 2px 0;
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    line-height: 1.3;
}

.shortcuts-table td {
    padding: 2px 4px;
    vertical-align: middle;
}

.shortcuts-table td:first-child {
    white-space: nowrap;
    color: #475569;
    width: 1%;
    padding-right: 8px;
}

.shortcuts-table td:last-child {
    color: #64748b;
}

.shortcuts-table kbd {
    display: inline-block;
    padding: 1px 4px;
    font-size: 10px;
    font-family: inherit;
    color: #334155;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    box-shadow: 0 1px 0 #cbd5e1;
    line-height: 1.4;
}

/* ── Print capture veil (hides multi-page toggle flicker during export) ── */
#konva-container { position: relative; }
.konva-capture-veil {
    position: absolute;
    inset: 0;
    background: #f3f4f6;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.konva-capture-snapshot {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}


/* ── Layer mask panel ───────────────────────────────────────── */
.mask-parts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.mask-part-row {
    display: grid;
    grid-template-columns: minmax(60px, 1fr) auto 1fr auto auto;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
}

.mask-part-name {
    text-transform: capitalize;
    color: #334155;
    font-weight: 500;
}

.mask-part-feather {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #64748b;
    font-size: 11px;
}

.mask-part-feather input[type="range"] {
    width: 80px;
}

.mask-add-buttons {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

/* ── Layer mask badge in LayerPanel ─────────────────────────── */
.layer-mask-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 0 2px;
    padding: 2px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    color: #475569;
    transition: background 80ms, border-color 80ms, color 80ms;
}

.layer-mask-badge:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.layer-mask-badge.enabled {
    color: #2563eb;
}

.layer-mask-badge.disabled {
    color: #94a3b8;
}

.layer-mask-badge.add {
    opacity: 0.45;
}

.layer-mask-badge.add:hover {
    opacity: 1;
    color: #2563eb;
}

.layer-mask-badge.editing {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 0 0 2px #93c5fd inset;
}

.layer-mask-count {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

/* ── Mask edit floating banner ─────────────────────────────── */
#konva-container.mask-edit-active {
    /* Subtle inner accent so the user knows they're in a mode */
    box-shadow: inset 0 0 0 2px #2563eb;
}

.mask-edit-banner {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1400;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 10px;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
    font-size: 13px;
    font-weight: 500;
    user-select: none;
    pointer-events: auto;
}

.mask-edit-banner-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    color: #60a5fa;
}

.mask-edit-banner-label {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mask-edit-banner-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background 80ms, border-color 80ms;
}

.mask-edit-banner-btn.primary {
    background: #2563eb;
    color: #ffffff;
}

.mask-edit-banner-btn.primary:hover {
    background: #1d4ed8;
}

.mask-edit-banner-btn.ghost {
    background: transparent;
    color: #cbd5e1;
    border-color: #475569;
}

.mask-edit-banner-btn.ghost:hover {
    background: #334155;
    color: #ffffff;
    border-color: #64748b;
}

.mask-edit-banner-btn.ghost.active {
    background: #60a5fa;
    color: #0f172a;
    border-color: #93c5fd;
}

.mask-edit-banner-btn.ghost.active:hover {
    background: #3b82f6;
    color: #ffffff;
    border-color: #60a5fa;
}

/* ── Export PNG dialog ─────────────────────────────────────── */
.export-png-dialog .dialog-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.export-png-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.export-png-field > span,
.export-png-field-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.export-png-dpi-presets {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.export-png-dpi-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    transition: background 80ms, border-color 80ms, color 80ms;
}

.export-png-dpi-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.export-png-dpi-btn.selected {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
}

.export-png-dpi-value {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2px;
}

.export-png-dpi-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

.export-png-hint {
    font-size: 11px;
    color: #64748b;
    line-height: 1.4;
}
