/* ============================================================
   Deepnet Configuration Editor — Metronic 7 Theme
   Dark Aside · White Header · Light Content · Poppins font
   Override custom properties on the host page or <iframe> parent.
   ============================================================ */

/* ── Metronic 7 design tokens ───────────────────────────────── */
:root {
    /* Core palette */
    --m-primary:          #3699FF;
    --m-primary-dark:     #187DE4;
    --m-primary-light:    #E1F0FF;
    --m-success:          #1BC5BD;
    --m-success-light:    #C9F7F5;
    --m-warning:          #FFA800;
    --m-warning-light:    #FFF4DE;
    --m-danger:           #F64E60;
    --m-danger-light:     #FFE2E5;

    /* Text scale (Metronic dark naming) */
    --m-dark:             #181C32;
    --m-dark75:           #3F4254;
    --m-dark65:           #5E6278;
    --m-dark50:           #7E8299;
    --m-dark25:           #B5B5C3;

    /* Backgrounds */
    --m-bg-page:          #F3F6F9;
    --m-bg-white:         #FFFFFF;
    --m-bg-light:         #F3F6F9;
    --m-bg-light2:        #ECF0F3;

    /* Borders */
    --m-border:           #EBEDF3;
    --m-border-input:     #E4E6EF;

    /* Light aside */
    --m-aside-bg:          #FFFFFF;
    --m-aside-brand:       #F3F6F9;
    --m-aside-text:        #5E6278;
    --m-aside-active-text: var(--m-dark);
    --m-aside-hover-bg:    #F3F6F9;
    --m-aside-active-bg:   rgba(54,153,255,0.08);
    --m-aside-sep:         #EBEDF3;

    /* Shadows */
    --m-shadow-card:      0px 0px 30px 0px rgba(82,63,105,0.05);
    --m-shadow-header:    0 0 40px 0 rgba(82,63,105,0.10);
    --m-shadow-dropdown:  0px 0px 50px 0px rgba(82,63,105,0.15);

    /* Editor aliases */
    --editor-bg:             var(--m-bg-white);
    --editor-surface:        var(--m-bg-light);
    --editor-surface-hover:  var(--m-bg-light2);
    --editor-border:         var(--m-border);
    --editor-border-focus:   var(--m-primary);
    --editor-accent:         var(--m-primary);
    --editor-accent-hover:   var(--m-primary-dark);
    --editor-text:           var(--m-dark75);
    --editor-text-secondary: var(--m-dark50);
    --editor-text-disabled:  var(--m-dark25);
    --editor-error:          var(--m-danger);
    --editor-required:       var(--m-danger);
    --editor-label-width:    200px;
    --editor-nav-width:      265px;
    --editor-content-max:    920px;
    --editor-font:           'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --editor-font-size:      13px;
    --editor-radius:         0.42rem;
    --editor-gap:            8px;
    --editor-spotlight:      var(--m-primary-dark);
    --editor-group-border:   var(--m-border);
    --editor-page-tint:      var(--m-bg-light);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--editor-font);
    font-size: var(--editor-font-size);
    color: var(--editor-text);
    background: var(--m-bg-page);
    height: 100vh;
    /* overflow intentionally omitted — editor layout fills exactly 100vh via its own grid,
       so body never scrolls on the editor page; results/load pages scroll naturally */
}

/* ── App shell ─────────────────────────────────────────────── */

#app { height: 100vh; display: flex; flex-direction: column; }

.editor-layout {
    display: grid;
    grid-template-columns: var(--editor-nav-width) 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    overflow: hidden;
}

.editor-layout.single-page {
    grid-template-columns: 1fr;
}

/* ── Top bar — Metronic white header ────────────────────────── */
.top-bar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr auto;   /* search stretches | action buttons */
    align-items: center;
    gap: 0;
    padding: 0 20px;
    height: 65px;                        /* Metronic header height */
    background: var(--m-bg-white);
    color: var(--m-dark75);
    box-shadow: var(--m-shadow-header);
    flex-shrink: 0;
    z-index: 100;
}


.top-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.auto-save-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--m-dark50);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.btn {
    padding: 7px 16px;
    border: none;
    border-radius: var(--editor-radius);
    background: var(--m-bg-light);
    color: var(--m-dark65);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--editor-font);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--m-bg-light2); color: var(--m-primary); }
.btn.btn-primary { background: var(--m-primary); color: #fff; }
.btn.btn-primary:hover { background: var(--m-primary-dark); }
.btn.btn-danger { background: var(--m-danger-light); color: var(--m-danger); }
.btn.btn-danger:hover { background: var(--m-danger); color: #fff; }
.btn.btn-export-blocked { background: var(--m-warning-light); color: var(--m-warning); }
.btn.btn-export-blocked:hover { background: var(--m-warning); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: default; }


/* ── Search bar — Metronic on white header ──────────────────── */
.search-container {
    min-width: 0;
    margin: 0 16px 0 20px;
    position: relative;
}

.search-input {
    width: 100%;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--m-border-input);
    border-radius: 0.42rem;
    background: var(--m-bg-light);
    color: var(--m-dark75);
    font-size: 12px;
    font-weight: 400;
    font-family: var(--editor-font);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input::placeholder { color: var(--m-dark25); }

.search-input:focus {
    background: var(--m-bg-white);
    border-color: var(--m-primary);
    box-shadow: 0 0 0 0.2rem rgba(54,153,255,0.15);
}

.search-input:-webkit-autofill,
.search-input:-webkit-autofill:hover,
.search-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--m-bg-light) inset;
    box-shadow: 0 0 0 1000px var(--m-bg-light) inset;
    -webkit-text-fill-color: var(--m-dark75);
}

.search-input::selection { background: var(--m-primary-light); color: var(--m-primary-dark); }

/* Floating search results — Metronic dropdown card */
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--m-bg-white);
    border: none;
    border-radius: 0.42rem;
    box-shadow: var(--m-shadow-dropdown);
    overflow: hidden;
    z-index: 10000;
    max-height: 320px;
    overflow-y: auto;
}

.search-result {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 12px;
    color: var(--m-dark75);
    border-bottom: 2px solid var(--m-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-top {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}
.search-result:last-child  { border-bottom: none; }
.search-result:hover       { background: var(--m-bg-light); }
.search-result--group-disabled { opacity: 0.7; }

.search-result-group-hint {
    font-size: 11px;
    color: #E65100;
    font-style: italic;
}

.search-result-prefix {
    color: var(--m-dark);
    font-size: 12px;
}

.search-result-label {
    font-weight: 600;
    color: var(--m-dark75);
}

.search-result-description {
    font-size: 11px;
    color: var(--m-dark50);
    font-style: italic;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-result-description p  { margin: 0; }
.search-result-description b,
.search-result-description strong { font-weight: 600; font-style: normal; }

mark.search-highlight {
    background: rgba(54,153,255,0.15);
    color: var(--m-primary);
    font-weight: 700;
    border-radius: 2px;
    padding: 0 1px;
}

/* ── Nav panel — Metronic dark aside ────────────────────────── */
.nav-panel {
    background: var(--m-aside-bg);
    border-right: 1px solid var(--m-aside-sep);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    grid-row: 2 / 3;
    min-height: 0;
}

/* Schema header — Metronic brand area */
.nav-schema-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px 14px;
    border-bottom: 1px solid var(--m-aside-sep);
    margin-bottom: 8px;
    background: var(--m-aside-brand);
}

.nav-schema-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #8B0000;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    line-height: 1;
}

.nav-schema-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--m-dark);
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex: 1;
}

.nav-schema-info {
    font-size: 13px;
    color: var(--m-dark25);
    cursor: default;
    flex-shrink: 0;
    align-self: center;
    transition: color 0.15s;
}
.nav-schema-info:hover { color: var(--m-primary); }

/*
 * All nav rows: 3-column grid — circle | chevron | label
 * Spacing matches desktop (ColumnSpacing=12 → gap: 12px)
 */
.nav-item {
    display: grid;
    grid-template-columns: 36px 22px 1fr;
    column-gap: 10px;
    padding: 7px 14px 7px 11px;
    cursor: pointer;
    color: var(--m-aside-text);
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
    user-select: none;
    align-items: center;
    border-left: 3px solid transparent;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.nav-item:hover {
    background: color-mix(in srgb, var(--nav-color, var(--m-primary)) 7%, transparent);
    color: var(--nav-color, var(--m-aside-active-text));
}

/* Active state — palette colour tint (13%) matching desktop circleColor.WithAlpha(0.13f) */
.nav-item.active {
    background: color-mix(in srgb, var(--nav-color, var(--m-primary)) 13%, transparent);
    border-left-color: var(--nav-color, var(--m-primary));
    color: var(--nav-color, var(--m-aside-active-text));
}

.nav-item.nav-page        { padding: 7px 14px 7px 11px; font-size: 13px; }
.nav-item.nav-section     { padding: 5px 14px 5px 11px; font-size: 12px; }

.nav-item.nav-subsection  {
    padding: 4px 14px 4px 11px;
    font-size: 12px;
    color: color-mix(in srgb, var(--m-aside-text) 80%, transparent);
}
.nav-item.nav-subsection.active { color: var(--nav-color, var(--m-aside-active-text)); }

/* ── Nav circle — Col 0 ─────────────────────────────────────── */
.nav-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

/* ── Page chevron — Col 1 ───────────────────────────────────── */
/* Light grey circle matching desktop ChevronDrawable(DrawBackground=true) */
.nav-chevron {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #E4E4E4;
    border: 1px solid #BBBBBB;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #505050;
    font-weight: 700;
    transform: rotate(0deg);
    transition: transform 0.18s ease, background 0.12s, border-color 0.12s;
    flex-shrink: 0;
    line-height: 1;
}
.nav-chevron.open    { transform: rotate(90deg); }
.nav-chevron--hidden { visibility: hidden; }

.nav-item:hover .nav-chevron,
.nav-item.active .nav-chevron {
    background: color-mix(in srgb, var(--nav-color, var(--m-primary)) 15%, #E4E4E4);
    border-color: var(--nav-color, var(--m-primary));
    color: var(--nav-color, var(--m-primary));
}

/* ── Section chevron — Col 1 ────────────────────────────────── */
.nav-chevron-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #E4E4E4;
    border: 1px solid #BBBBBB;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #505050;
    font-weight: 700;
    transform: rotate(0deg);
    transition: transform 0.18s ease, background 0.12s, border-color 0.12s;
    flex-shrink: 0;
    justify-self: center;
    line-height: 1;
}
.nav-chevron-small.open { transform: rotate(90deg); }
.nav-item:hover .nav-chevron-small,
.nav-item.active .nav-chevron-small {
    background: color-mix(in srgb, var(--nav-color, var(--m-primary)) 15%, #E4E4E4);
    border-color: var(--nav-color, var(--m-primary));
    color: var(--nav-color, var(--m-primary));
}

/* ── Section dot — Col 1 ────────────────────────────────────── */
.nav-dot {
    width: 7px;
    height: 7px;
    border-radius: 4px;
    background: #BBBBBB;
    flex-shrink: 0;
    justify-self: center;
    align-self: center;
    transition: background 0.12s;
}
.nav-item:hover .nav-dot,
.nav-item.active .nav-dot { background: var(--nav-color, var(--m-primary)); }

/* ── Subsection dot — Col 1 ─────────────────────────────────── */
.nav-dot-small {
    width: 5px;
    height: 5px;
    border-radius: 3px;
    background: #CCCCCC;
    flex-shrink: 0;
    justify-self: center;
    align-self: center;
    transition: background 0.12s;
}
.nav-item:hover .nav-dot-small,
.nav-item.active .nav-dot-small { background: var(--nav-color, var(--m-primary)); }

/* ── Label — Col 2 ──────────────────────────────────────────── */
.nav-label {
    min-width: 0;
    word-break: break-word;
    line-height: 1.3;
}

/* ── Content area ───────────────────────────────────────────── */
.content-area {
    overflow-y: auto;
    padding: 0;
    min-height: 0;
    background: var(--m-bg-page);
}

.content-center {
    max-width: var(--editor-content-max);
    margin: 0 auto;
    padding: 28px 24px 56px;
}

/* Incompatible cached state banner — shown when parent provides state that doesn't match schema */
.incompatible-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--m-danger-light);
    border-radius: var(--editor-radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.incompatible-banner-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: var(--m-danger);
}

.incompatible-banner-body strong { font-weight: 600; }
.incompatible-banner-body span   { font-weight: 400; font-size: 12px; }

.incompatible-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.incompatible-clear-btn {
    padding: 6px 14px;
    background: var(--m-danger);
    color: #fff;
    border: none;
    border-radius: var(--editor-radius);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--editor-font);
    cursor: pointer;
    transition: background 0.15s;
}
.incompatible-clear-btn:hover { background: #d63554; }

.incompatible-dismiss-btn {
    background: none;
    border: none;
    color: var(--m-danger);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

/* Restored-from-cache banner */

/* Breadcrumb — page/section title above tabs, coloured with the active page's palette colour */
.content-breadcrumb {
    font-size: 18px;
    font-weight: 600;
    color: var(--page-color, var(--editor-accent));
    margin-bottom: 18px;
    line-height: 1.2;
}

/* ── Tabs — Metronic line-tabs style ────────────────────────── */
.tab-wrapper {
    margin: 0 0 20px;
    background: var(--m-bg-white);
    border-radius: 0.42rem;
    box-shadow: var(--m-shadow-card);
    overflow: hidden;
}

/* Tab strip — white bg, bottom separator */
.tab-bar {
    display: flex;
    gap: 0;
    padding: 0 12px;
    position: sticky;
    top: 0;
    background: var(--m-bg-white);
    border-bottom: 1px solid var(--m-border);
    z-index: 10;
}

/* Tab button — Metronic line-tab */
.tab-btn {
    padding: 12px 18px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--editor-font);
    color: var(--m-dark50);
    white-space: nowrap;
    margin-bottom: -1px;   /* sit on the strip border */
    transition: color 0.15s, border-color 0.15s;
}

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

/* Active tab — primary underline, no box */
.tab-btn.active {
    color: var(--m-primary);
    font-weight: 600;
    border-bottom-color: var(--m-primary);
    background: transparent;
}

.tab-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Remove the ::after separator line — replaced by border-bottom on .tab-bar */
.tab-bar::after { display: none; }

/* Tab content — inside the white card, no extra border */
.tab-content-box {
    border: none;
    border-radius: 0;
    padding: 20px;
    background: var(--m-bg-white);
    overflow-y: auto;
}

/* Spotlight on focused tab container */
.tab-wrapper:focus-within .tab-btn.active {
    color: var(--m-primary);
    border-bottom-color: var(--m-primary);
}

/* ── Groups — Metronic card ─────────────────────────────────── */
.group-box {
    border: none;
    border-radius: 0.42rem;
    margin-bottom: 20px;
    overflow: visible;
    position: relative;
    background: var(--m-bg-white);
    box-shadow: var(--m-shadow-card);
}

/* No focus border change — Metronic cards don't react to spotlight */
.group-box:focus-within { border-color: transparent; }

/* Group header — Metronic card-header style */
.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 18px;
    background: var(--m-bg-white);
    border-bottom: 1px solid var(--m-border);
    font-weight: 600;
    font-size: 14px;
    color: var(--m-dark);
    border-radius: 0.42rem 0.42rem 0 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.group-header-title { flex: 1; font-weight: 600; }

.group-header-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.group-header-toggle-label {
    font-size: 12px;
    color: var(--m-dark50);
    font-weight: 400;
}

.group-box:focus-within .group-header { border-bottom-color: var(--m-border); }

.group-body { padding: 16px 18px; }
.group-body > .stack-vertical { gap: 8px; }

/* ── Stack layouts ──────────────────────────────────────────── */
.stack-vertical {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stack-horizontal {
    display: grid;
    gap: var(--editor-gap);
    align-items: start;
}

/* ── Field rows ─────────────────────────────────────────────── */
.field-row {
    display: grid;
    grid-template-columns: var(--editor-label-width) 1fr;
    gap: 8px;
    align-items: start;
    min-height: 32px;
}

/* Spotlight — primary color, Metronic style */
.field-row:hover       .field-label,
.field-row:focus-within .field-label {
    color: var(--m-primary);
    font-weight: 600;
}

.field-label {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 4px;
    padding-top: 9px;
    font-size: 12px;
    font-weight: 500;
    color: var(--m-dark75);
    text-align: right;
    line-height: 1.4;
    word-break: break-word;
    transition: color 0s, font-weight 0s;
}

.field-required-asterisk {
    color: var(--m-danger);
    font-size: 14px;
    line-height: 1.4;
}

.field-input {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Info icon — same style as the nav ⓘ: plain icon, grey, primary on hover */
.field-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-style: normal;
    color: var(--m-dark25);
    cursor: default;
    flex-shrink: 0;
    margin-left: 4px;
    user-select: none;
    vertical-align: middle;
    transition: color 0.15s;
}
.field-info-icon:hover { color: var(--m-primary); }

/* Tooltip */
.field-tooltip {
    position: fixed;
    z-index: 9999;
    background: var(--m-dark);
    color: #f0f0f0;
    font-size: 12px;
    font-family: var(--editor-font);
    font-weight: 400;
    line-height: 1.6;
    padding: 10px 14px;
    border-radius: 0.42rem;
    max-width: 300px;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.field-tooltip b, .field-tooltip strong { font-weight: 700; }
.field-tooltip i, .field-tooltip em     { font-style: italic; }
.field-tooltip a  { color: #7cb9ff; }
.field-tooltip ul { margin: 4px 0 0 14px; }
.field-tooltip li { margin: 2px 0; }

.field-error {
    font-size: 11px;
    color: var(--m-danger);
    margin-top: 2px;
    font-weight: 500;
}

/* ── Inputs — Metronic form controls ────────────────────────── */
input[type="text"],
input[type="password"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 7px 12px;
    border: 1px solid var(--m-border-input);
    border-radius: 0.42rem;
    font-size: 13px;
    font-family: var(--editor-font);
    font-weight: 400;
    color: var(--m-dark75);
    background: var(--m-bg-white);
    outline: none;
    min-height: 38px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: var(--m-primary);
    box-shadow: 0 0 0 0.2rem rgba(54,153,255,0.15);
}

input[type="text"]:disabled,
input[type="password"]:disabled,
textarea:disabled,
select:disabled {
    background: var(--m-bg-light);
    color: var(--m-dark25);
    cursor: default;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--m-border-input);
    border-radius: 3px;
    background: var(--m-bg-white);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s, border-color 0.15s;
    vertical-align: middle;
}

input[type="checkbox"]:checked {
    background: var(--m-primary);
    border-color: var(--m-primary);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 9px;
    border: 2px solid #ffffff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

input[type="checkbox"]:hover:not(:disabled) { border-color: var(--m-primary); }
input[type="checkbox"]:focus { outline: none; box-shadow: 0 0 0 0.2rem rgba(54,153,255,0.2); }
input[type="checkbox"]:disabled { cursor: default; opacity: 0.5; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 9px;
}

select { cursor: pointer; }

/* ── GenericListEditorControl ────────────────────────────────── */
.listeditor-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 5px 0;
}

.listeditor-empty {
    font-style: italic;
    color: var(--m-dark25);
    font-size: 12px;
}

.listeditor-items {
    display: flex;
    flex-direction: column;
}

.listeditor-item-row {
    display: grid;
    grid-template-columns: 1fr 5px 56px;
    align-items: center;
    padding: 5px 0;
}

.listeditor-item-text {
    word-break: break-word;
    line-height: 1.4;
    font-size: 13px;
    color: var(--m-dark75);
}

.listeditor-delete-btn {
    font-size: 14px;
    width: 100%;
    height: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--m-dark25);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-family: var(--editor-font);
    transition: color 0.12s;
}
.listeditor-delete-btn:hover { color: var(--m-danger); }

.listeditor-add-row {
    display: grid;
    grid-template-columns: 1fr 6px 32px;
    align-items: center;
}

.listeditor-add-input {
    min-width: 150px;
    height: 32px;
    width: 100%;
}

/* + button — Metronic primary circle */
.listeditor-add-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--m-primary);
    color: #ffffff;
    font-size: 18px;
    font-weight: 400;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--editor-font);
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s;
}
.listeditor-add-btn:hover:not(:disabled) { background: var(--m-primary-dark); }
.listeditor-add-btn:disabled { opacity: 0.4; cursor: default; }

.listeditor-error {
    font-size: 11px;
    color: var(--m-danger);
    margin-top: 2px;
    font-weight: 500;
}

/* ── ImageProviderControl ───────────────────────────────────── */
.imgprov-layout {
    display: flex;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
}

.imgprov-left  { flex: 1; min-width: 0; }
.imgprov-gap   { width: 20px; flex-shrink: 0; }

.imgprov-right {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.imgprov-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.imgprov-value-entry {
    flex: 1;
    min-width: 0;
    height: 32px;
}

.imgprov-mode-picker {
    display: flex;
    border: 1px solid var(--m-border-input);
    border-radius: 0.42rem;
    overflow: hidden;
    height: 32px;
    flex-shrink: 0;
    width: 110px;
}

.imgprov-mode-btn {
    flex: 1;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    font-family: var(--editor-font);
    color: var(--m-dark50);
    white-space: nowrap;
    padding: 0 6px;
    transition: background 0.12s, color 0.12s;
}
.imgprov-mode-btn:hover:not(:disabled) { background: var(--m-bg-light2); }
.imgprov-mode-btn.active { background: var(--m-primary); color: #ffffff; }
.imgprov-mode-btn:disabled { opacity: 0.5; cursor: default; }

.imgprov-browse-btn {
    height: 32px;
    padding: 0 12px;
    background: var(--m-primary);
    color: #ffffff;
    border: none;
    border-radius: 0.42rem;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--editor-font);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    transition: background 0.15s;
}
.imgprov-browse-btn:hover { background: var(--m-primary-dark); }

.imgprov-preview-border {
    width: 200px;
    height: 120px;
    border-radius: 0.42rem;
    border: 1px solid var(--m-border-input);
    background: var(--m-bg-light);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.imgprov-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    color: var(--m-dark50);
    background: var(--m-bg-light);
    z-index: 2;
}
.imgprov-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--m-border);
    border-top-color: var(--m-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.imgprov-error-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--m-danger);
    background: var(--m-danger-light);
    z-index: 2;
    text-align: center;
    padding: 8px;
}

.imgprov-img-hidden { opacity: 0; }

.imgprov-no-image {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-style: italic;
    color: var(--m-dark25);
}

.imgprov-preview-img {
    position: absolute;
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    object-fit: contain;
    transition: filter 0.35s ease, transform 0.35s ease;
}

/* Phase 1 — tiny thumbnail blown up with blur (progressive placeholder) */
.imgprov-preview-blur {
    filter: blur(8px);
    transform: scale(1.08); /* hide blurred edges */
}

/* Phase 2 — full image swapped in, blur fades out */
.imgprov-preview-sharp {
    filter: blur(0);
    transform: scale(1);
}

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

.imgprov-accept-row {
    display: flex;
    align-items: center;
    gap: 5px;
}
.imgprov-accept-row input[type="checkbox"] { width: 16px; flex-shrink: 0; }

.imgprov-accept-label {
    font-size: 12px;
    color: var(--m-dark75);
    white-space: nowrap;
}

.imgprov-clear-btn {
    height: 32px;
    padding: 0 12px;
    background: var(--m-bg-light2);
    color: var(--m-dark65);
    border: none;
    border-radius: 0.42rem;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--editor-font);
    display: inline-flex;
    align-items: center;
    transition: background 0.15s, color 0.15s;
}
.imgprov-clear-btn:hover { background: var(--m-danger-light); color: var(--m-danger); }

/* Upload-blocked navigation banner */
.upload-nav-block-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--m-warning-light);
    border-radius: var(--editor-radius);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--m-warning);
}
.upload-nav-block-body {
    display: flex;
    align-items: center;
    gap: 8px;
}
.upload-nav-block-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,168,0,0.3);
    border-top-color: var(--m-warning);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
.upload-nav-block-dismiss {
    background: none;
    border: none;
    color: var(--m-warning);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
}

/* Cancel button inside progress status */
.imgprov-cancel-btn {
    background: none;
    border: none;
    color: var(--m-danger);
    font-size: 12px;
    cursor: pointer;
    padding: 0 2px;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
}
.imgprov-cancel-btn:hover { color: #d63554; }

.imgprov-progress-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 5px;
}
.imgprov-progress-status.status-active { color: var(--m-primary); }
.imgprov-progress-status.status-done   { color: var(--m-success); }

.imgprov-progress-spinner {
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--m-primary-light);
    border-top-color: var(--m-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.d-none { display: none !important; }

/* ── Navigation validation dialog ───────────────────────────── */
.nav-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24,28,50,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.nav-dialog {
    background: var(--m-bg-white);
    border-radius: 0.42rem;
    box-shadow: 0 8px 40px rgba(82,63,105,0.18);
    padding: 28px;
    width: 440px;
    max-width: calc(100vw - 48px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.nav-dialog-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--m-dark);
}

.nav-dialog-body {
    font-size: 13px;
    color: var(--m-dark75);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-dialog-body ul {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-dialog-body li {
    color: var(--m-danger);
    font-size: 12px;
}

.nav-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.nav-dialog-btn {
    padding: 8px 20px;
    border-radius: 0.42rem;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--editor-font);
    background: none;
    transition: background 0.15s, color 0.15s;
}

.nav-dialog-btn--stay {
    color: var(--m-dark65);
    background: var(--m-bg-light);
}
.nav-dialog-btn--stay:hover { background: var(--m-bg-light2); }

.nav-dialog-btn--continue {
    background: var(--m-primary);
    color: #fff;
}
.nav-dialog-btn--continue:hover { background: var(--m-primary-dark); }

/* ── Decorative nodes ───────────────────────────────────────── */
.section-header {
    font-size: 15px;
    font-weight: 600;
    color: var(--m-dark);
    margin: 8px 0 2px;
}

.field-divider {
    border: none;
    border-top: 1px solid var(--m-border);
    margin: 8px 0;
}

.spec-heading-0 { font-size: 13px; margin: 6px 0 2px; }
.spec-heading   { font-weight: 600; color: var(--m-dark); }

/* ── Shared components ──────────────────────────────────────── */
.error-banner {
    background: var(--m-danger-light);
    border: none;
    border-radius: 0.42rem;
    padding: 12px 16px;
    color: var(--m-danger);
    font-size: 13px;
    font-weight: 500;
    white-space: pre-wrap;
    word-break: break-word;
}

.required-disclaimer {
    background: var(--m-warning-light);
    border: none;
    border-radius: 0.42rem;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--m-dark);
    margin-bottom: 16px;
    font-weight: 500;
}

.required-disclaimer ul { margin: 8px 0 0 16px; }
.required-disclaimer li { margin: 2px 0; font-weight: 400; }

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px;
    color: var(--m-dark50);
    font-size: 13px;
    font-weight: 500;
}

.spinner-ring {
    width: 26px;
    height: 26px;
    border: 3px solid var(--m-border);
    border-top-color: var(--m-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-init {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-family: var(--editor-font);
    color: var(--m-dark50);
    font-size: 14px;
    font-weight: 500;
    background: var(--m-bg-page);
}

#blazor-error-ui {
    background: var(--m-danger-light);
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(82,63,105,0.12);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: var(--m-danger);
    font-size: 13px;
    font-family: var(--editor-font);
}

/* ── Editor waiting overlay — shown before schema is loaded ─── */
.editor-waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--m-bg-page);
}

.editor-waiting-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--m-dark50);
    font-size: 14px;
    font-weight: 500;
}

.editor-waiting-error {
    color: var(--m-danger);
    font-weight: 500;
    font-size: 13px;
    max-width: 360px;
    text-align: center;
}

/* ── Load schema screen — Metronic login-card style ─────────── */
.load-schema-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 24px;
    gap: 32px;
    background: var(--m-bg-page);
}

.load-schema-card {
    width: 100%;
    max-width: 540px;
    border: none;
    border-radius: 0.42rem;
    padding: 36px 40px;
    background: var(--m-bg-white);
    box-shadow: var(--m-shadow-card);
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.load-schema-card h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--m-dark);
    letter-spacing: -0.3px;
}

.load-schema-subtitle {
    font-size: 13px;
    color: var(--m-dark50);
    margin-top: -10px;
}

.load-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.load-section label {
    font-size: 12px;
    font-weight: 600;
    color: var(--m-dark65);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.load-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.load-row input { flex: 1; }

/* Metronic primary button */
.btn-load {
    padding: 9px 20px;
    background: var(--m-primary);
    color: #fff;
    border: none;
    border-radius: 0.42rem;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--editor-font);
    white-space: nowrap;
    transition: background 0.15s;
}
.btn-load:hover    { background: var(--m-primary-dark); }
.btn-load:disabled { opacity: 0.5; cursor: default; }

/* Divider "or" */
.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--m-dark25);
    font-size: 12px;
    font-weight: 500;
}
.section-divider::before,
.section-divider::after { content: ''; flex: 1; border-top: 1px solid var(--m-border); }

/* File input label — Metronic dashed upload area */
.file-input-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    border: 1.5px dashed var(--m-primary);
    border-radius: 0.42rem;
    color: var(--m-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: var(--m-primary-light);
    transition: background 0.15s;
}
.file-input-label:hover { background: rgba(54,153,255,0.15); }

input[type="file"] { display: none; }

/* Drop zone */
.load-dropzone {
    border: 2px dashed var(--m-border-input);
    border-radius: 0.42rem;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
    font-size: 13px;
    color: var(--m-dark50);
}
.load-dropzone.drag-over {
    border-color: var(--m-primary);
    background: var(--m-primary-light);
}
.load-dropzone-icon { font-size: 32px; }
.load-selected {
    font-size: 12px;
    color: var(--m-primary);
    font-weight: 600;
}

/* Progress steps */
.load-progress { padding: 8px 0; }

.load-progress-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.load-progress-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--m-dark50);
    padding: 4px 0;
}

.load-progress-step.step-active {
    color: var(--m-dark75);
    font-weight: 600;
}

.step-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--m-border);
    border-top-color: var(--m-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.step-check {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--m-success);
    font-size: 12px;
    flex-shrink: 0;
}

/* Cache info banner */
.load-cache-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--m-primary-light);
    border: none;
    border-radius: 0.42rem;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--m-primary-dark);
}

.load-cache-clear {
    padding: 4px 12px;
    border: 1px solid var(--m-primary);
    border-radius: 0.42rem;
    background: none;
    color: var(--m-primary);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--editor-font);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.load-cache-clear:hover { background: var(--m-primary); color: #fff; }

.load-cache-cleared {
    font-size: 12px;
    font-weight: 500;
    color: var(--m-success);
    text-align: center;
    padding: 4px 0;
}

/* ── Results page ───────────────────────────────────────────── */
.results-page {
    max-width: 880px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.results-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.results-back-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 0.42rem;
    background: var(--m-bg-light2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--editor-font);
    color: var(--m-dark65);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.results-back-btn:hover { background: var(--m-primary-light); color: var(--m-primary); }

.results-title { display: flex; flex-direction: column; }
.results-schema-name { font-size: 20px; font-weight: 700; color: var(--m-dark); }
.results-schema-ver  { font-size: 13px; color: var(--m-dark50); }

.results-valid-badge {
    background: var(--m-success-light);
    border: none;
    border-radius: 0.42rem;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--m-success);
}

.results-warnings {
    background: var(--m-warning-light);
    border: none;
    border-radius: 0.42rem;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--m-warning);
}
.results-warnings ul { margin: 6px 0 0 16px; }
.results-warnings li { margin: 2px 0; font-size: 12px; font-weight: 400; }

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

.results-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--m-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-file-picker {
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--m-border-input);
    border-radius: 0.42rem;
    background: var(--m-bg-white);
    cursor: pointer;
    font-family: var(--editor-font);
}

.results-file-list {
    border: none;
    border-radius: 0.42rem;
    overflow: hidden;
    background: var(--m-bg-white);
    box-shadow: var(--m-shadow-card);
}

.results-file-row {
    display: grid;
    grid-template-columns: 24px 1fr 28px auto;
    column-gap: 10px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--m-border);
    font-size: 13px;
}
.results-file-row:last-child { border-bottom: none; }

.results-file-icon { font-size: 16px; }
.results-file-name { color: var(--m-dark75); font-weight: 500; }
.results-file-status { font-size: 14px; text-align: center; }
.status-ok   { color: var(--m-success); }
.status-warn { color: var(--m-warning); }

.results-dl-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 0.42rem;
    background: var(--m-primary-light);
    color: var(--m-primary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--editor-font);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.results-dl-btn:hover { background: var(--m-primary); color: #fff; }

/* JSON preview — VS Code dark theme */
.results-preview {
    background: #1E1E2D;     /* Metronic dark shade */
    color: #ABB2BF;
    border-radius: 0.42rem;
    padding: 18px;
    font-size: 12px;
    font-family: 'Cascadia Code', 'Consolas', 'Monaco', monospace;
    overflow-x: auto;
    max-height: 360px;
    overflow-y: auto;
    white-space: pre;
    line-height: 1.6;
    box-shadow: var(--m-shadow-card);
}

.results-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 48px;
}

.results-exporting {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--m-dark50);
}

.results-export-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--m-border);
    border-top-color: var(--m-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.results-dl-all-btn {
    padding: 11px 28px;
    background: var(--m-primary);
    color: #fff;
    border: none;
    border-radius: 0.42rem;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--editor-font);
    cursor: pointer;
    transition: background 0.15s;
    letter-spacing: 0.2px;
}
.results-dl-all-btn:hover { background: var(--m-primary-dark); }

/* ── Search highlight flash ─────────────────────────────────── */
@keyframes groupSpotlight {
    0%   { background: rgba(255,179,0,0.30); box-shadow: 0 0 0 3px rgba(255,179,0,0.50); }
    60%  { background: rgba(255,179,0,0.10); box-shadow: 0 0 0 3px rgba(255,179,0,0.20); }
    100% { background: transparent;          box-shadow: none; }
}

.group-spotlight {
    border-radius: var(--editor-radius);
    animation: groupSpotlight 2.5s ease forwards;
}

@keyframes fieldFlash {
    0%   { background: rgba(54,153,255,0.22); box-shadow: 0 0 0 3px rgba(54,153,255,0.22); }
    55%  { background: rgba(54,153,255,0.08); box-shadow: 0 0 0 3px rgba(54,153,255,0.08); }
    100% { background: transparent;           box-shadow: none; }
}

.field-flash {
    border-radius: var(--editor-radius);
    animation: fieldFlash 2s ease forwards;
}

.unsupported-field {
    padding: 6px 0;
    font-size: 11px;
    color: var(--m-dark25);
    font-style: italic;
}
