/* Central admin — base styles */

:root {
    --c-dark:    #222;
    --c-bg:      #f4f5f7;
    --c-surface: #ffffff;
    --c-border:  #e2e4e8;
    --c-text:    #222;
    --c-muted:   #777;
    --c-accent:  #006ce7; /* save / primary — blue (matches the editor) */
    --c-danger:  #c0392b; /* delete — red */
    --c-link:    #2456a6;
    --radius:    6px;
    --header-h:  56px;
}

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.6;
}

/* Very subtle blurred colour wash behind the whole admin (shows through the
   gaps/margins between cards). Fixed + oversized so the blur has no hard edge. */
body::before {
    content: "";
    position: fixed;
    inset: -12vmax;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(38vmax 38vmax at 12% 6%,  rgba(0, 108, 231, 0.10), transparent 60%),
        radial-gradient(42vmax 42vmax at 92% 4%,  rgba(142, 68, 173, 0.07), transparent 60%),
        radial-gradient(40vmax 40vmax at 84% 94%, rgba(41, 128, 185, 0.08), transparent 60%),
        radial-gradient(32vmax 32vmax at 6% 90%,  rgba(0, 108, 231, 0.05), transparent 60%);
    filter: blur(64px);
}

h1, h2, h3 { line-height: 1.25; }
a { color: var(--c-link); }

/* ---- Header (fixed, dark) ---- */
.admin-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--c-dark);
    color: #fff;
    z-index: 100;
}

.admin-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 100%;
    padding: 0 24px;
}

.admin-brand { color: #fff; font-weight: 600; text-decoration: none; }

.admin-nav { display: flex; gap: 4px; }
.admin-nav a {
    color: #bbb;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.95rem;
}
.admin-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.admin-nav a.active { color: #fff; background: rgba(255,255,255,0.14); }

/* Empty by default; a pinned page-action bar (e.g. System Save) docks here on
   scroll and shows flush-right, just before the user/logout links. */
.admin-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.admin-header-right {
    margin-left: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9rem;
}
/* Workspace header has no static actions slot (the pin bar docks into the
   sub-nav), so the user/logout links must push themselves flush right. */
.ws .admin-header-right { margin-left: auto; }
.admin-user { color: #fff; }
.admin-user-link { text-decoration: none; }
.admin-user-link:hover { text-decoration: underline; }
.admin-icon-link { color: #bbb; text-decoration: none; }
.admin-icon-link:hover { color: #fff; text-decoration: underline; }
.admin-lang { display: flex; gap: 6px; color: #888; }
.admin-lang a { color: #888; text-decoration: none; }
.admin-lang a:hover { color: #fff; }
.admin-lang a.active { color: #fff; font-weight: 600; }

/* ---- Main ---- */
.admin-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: calc(var(--header-h) + 24px) 24px 48px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-head h1 { margin: 0; font-size: 1.5rem; }
.muted { color: var(--c-muted); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    box-sizing: border-box;
}
.btn-primary { background: var(--c-dark); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-success { background: var(--c-accent); color: #fff; }
.btn-success:hover { filter: brightness(0.95); }
.btn-secondary { background: #fff; color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover { background: #f0f1f3; text-decoration: none; }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.95); }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---- Forms ---- */
label { display: block; margin-bottom: 0.3rem; font-weight: 600; font-size: 0.9rem; }
input, select, textarea {
    width: 100%;
    padding: 0.55rem 0.6rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--c-dark);
    box-shadow: 0 0 0 2px rgba(34,34,34,0.12);
}
.form-group { margin-bottom: 1rem; }

/* ---- Alerts ---- */
.alert { padding: 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.95rem; }
.alert-error   { background: #fdecea; color: #c0392b; border: 1px solid #f0b8b2; }
.alert-success { background: #eafaf1; color: #1e7e44; border: 1px solid #aee0c2; }

/* ---- Auth (login) ---- */
.auth-body {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: var(--c-bg);
}
.auth-main { width: 100%; max-width: 380px; padding: 24px; }
.auth-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 2rem;
}
.auth-card h1 { margin: 0 0 1.25rem; font-size: 1.4rem; }

/* ---- Project grid ---- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.project-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 1.1rem;
}
.project-name { font-weight: 600; font-size: 1.05rem; }
.project-host { color: var(--c-muted); font-size: 0.85rem; font-family: monospace; margin-bottom: 0.7rem; }
.project-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1rem; min-height: 24px; }
.badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: #eef0f2;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.badge-feature { background: #e7f0ff; color: #2456a6; text-transform: none; }
/* Crawl-disabled marker (eye-slash): neutral, inherits the surrounding text
   colour at reduced opacity so it reads on both the dark header and white cards. */
.crawl-off-icon { display: inline-flex; align-items: center; vertical-align: middle; opacity: 0.55; margin-left: 4px; }
.project-actions { display: flex; gap: 8px; }
.project-actions .btn { flex: 1; text-align: center; }

/* ---- Workspace header / sub-nav ---- */
.ws-project { display: flex; align-items: center; gap: 10px; }
.ws-back { color: #bbb; text-decoration: none; font-size: 0.9rem; }
.ws-back:hover { color: #fff; }
.ws-project-name { color: #fff; font-weight: 600; }
.ws-project-link { text-decoration: none; }
.ws-project-link:hover { text-decoration: underline; }
.ws-project-host { color: #888; font-size: 0.8rem; font-family: monospace; }
.ws-view-link { color: #8ab4ff; font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
.ws-view-link:hover { color: #fff; text-decoration: underline; }

/* Workspace fulltext search: a magnifier that expands an input on click. */
.ws-search { display: flex; align-items: center; gap: 0; }
.ws-search-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    background: none; border: 0; color: #bbb; cursor: pointer; border-radius: 6px;
}
.ws-search-toggle:hover { color: #fff; background: rgba(255,255,255,0.08); }
.ws-search-input {
    width: 0; padding: 0; border: 0; opacity: 0;
    background: rgba(255,255,255,0.12); color: #fff;
    border-radius: 6px; transition: width 0.2s, opacity 0.2s, padding 0.2s;
}
.ws-search.is-open .ws-search-input { width: 200px; padding: 5px 10px; opacity: 1; }
.ws-search-input::placeholder { color: #aaa; }

/* Search results page */
.search-page-form { display: flex; gap: 8px; margin-bottom: 1.5rem; max-width: 640px; }
.search-page-form input { flex: 1; }
.search-results { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.search-result {
    display: block;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--c-text);
}
.search-result:hover { border-color: var(--c-accent); box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.search-result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.search-result-name { font-size: 1.05rem; }
.search-result-snippet { font-size: 0.88rem; color: var(--c-muted); margin: 2px 0; line-height: 1.5; }
.search-result-snippet mark { background: #fff3bf; color: inherit; padding: 0 2px; border-radius: 2px; }

.ws-nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    height: 44px;
    background: #fff;
    border-bottom: 1px solid var(--c-border);
    z-index: 90;
}
/* Full-width like the dark admin header above it (same 24px side padding):
   nav links hug the left edge, the pinned page actions the right edge. */
.ws-nav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 24px;
}
.ws-nav a {
    padding: 6px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    color: #555;
    font-size: 0.95rem;
}
.ws-nav a:hover { background: #f0f1f3; color: var(--c-text); }
.ws-nav a.active { background: var(--c-dark); color: #fff; }
.ws-nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Nav items with sub-pages: hover (or keyboard focus) reveals a dropdown.
   The wrapper spans the bar's full height so there is no hover gap between
   the link and the dropdown. */
.ws-nav-item { position: relative; height: 100%; display: flex; align-items: center; }
.ws-nav-item > a { display: inline-flex; align-items: center; gap: 5px; }
.ws-nav-caret { opacity: 0.55; transition: transform 0.18s ease; }
.ws-nav-item:hover .ws-nav-caret,
.ws-nav-item:focus-within .ws-nav-caret { transform: rotate(180deg); }
.ws-subnav {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 95;
}
.ws-nav-item:hover .ws-subnav,
.ws-nav-item:focus-within .ws-subnav { opacity: 1; visibility: visible; transform: translateY(0); }
.ws-subnav a { display: block; white-space: nowrap; }

/* ---- Page action set (Save / Delete / Back) ---- */
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.page-actions--pinned .btn { padding: 0.3rem 0.8rem; font-size: 0.85rem; }

/* ---- Confirmation dialog ---- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.confirm-overlay.is-open { display: flex; }
.confirm-dialog {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.confirm-title { margin: 0 0 0.5rem; font-size: 1.15rem; }
.confirm-message { margin: 0 0 1.4rem; color: var(--c-text); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---- SEO card (snippet preview + character meters) ---- */
.seo-snippet {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 1.25rem;
    max-width: 600px;
}
.seo-snippet-url { color: #4d5156; font-size: 0.8rem; word-break: break-all; }
.seo-snippet-title { color: #1a0dab; font-size: 1.15rem; line-height: 1.3; margin: 3px 0; }
.seo-snippet-desc { color: #4d5156; font-size: 0.85rem; line-height: 1.45; }
.seo-meter { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.seo-meter-bar { flex: 1; height: 6px; background: #eef0f2; border-radius: 3px; overflow: hidden; }
.seo-meter-bar span { display: block; height: 100%; width: 0; transition: width 0.15s, background 0.15s; }
.seo-meter-count { font-size: 0.8rem; color: var(--c-muted); min-width: 3ch; text-align: right; }
.seo-meter.is-ok   .seo-meter-bar span { background: #2e7d32; }
.seo-meter.is-warn .seo-meter-bar span { background: #e08a00; }
.seo-meter.is-bad  .seo-meter-bar span { background: var(--c-danger); }
.seo-flags { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 0.75rem; }
.seo-flags .checkbox-label { margin: 0; }

/* ---- TinyMCE UI buttons: match admin weight; red Delete in the button dialog ---- */
.tox .tox-button { font-weight: 500; }
/* Workspace pages sit below both the header and the sub-nav */
body.ws .admin-main { padding-top: calc(var(--header-h) + 44px + 24px); }

/* ---- Generic card ---- */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.card-flush { padding: 0; overflow: hidden; }
.card-danger { border-color: #f0b8b2; }
.card-danger h2 { color: var(--c-danger); }
.input-error { border-color: var(--c-danger) !important; box-shadow: 0 0 0 2px rgba(192,57,43,0.15) !important; }
.confirm-slug-hint { color: var(--c-muted); font-weight: 400; }
.lang-order { list-style: none; margin: 0 0 1rem; padding: 0; }
.lang-order-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--c-border); border-radius: var(--radius); margin-bottom: 6px; background: #fff; }
.lang-order-item.is-dragging { opacity: 0.5; }
.lang-order-item .drag-handle { cursor: grab; }
.logo-placements { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0.5rem 0; }
.logo-placements .checkbox-label { margin: 0; }
/* A table inside a padded card: align edge cells with the card's own padding. */
.table-inset th:first-child, .table-inset td:first-child { padding-left: 0; }
.table-inset th:last-child, .table-inset td:last-child { padding-right: 0; }
.table-inset tr:last-child td { border-bottom: 0; }
.card h2 { margin: 0 0 1rem; font-size: 1.1rem; }

/* ---- Resizable / collapsible / drag-and-drop boxes (JS masonry) ---- */
/* boxes.js packs the boxes into a shortest-column masonry (fills the vertical
   gaps a plain CSS grid would leave next to a tall box) by absolutely
   positioning each one. A box is NEVER moved in the DOM, so a box hosting a
   TinyMCE iframe is never reparented/reloaded. Before the script runs the boxes
   just stack in normal flow — a plain but non-broken fallback. */
/* Box screens use the full width of the admin area, not the centred column. */
.admin-main:has([data-boxes]) { max-width: none; }
[data-boxes] { position: relative; }
[data-boxes] .card[data-box] {
    padding: 0;
    margin: 0;
    max-width: none !important;  /* the chosen width drives size — beat inline caps */
    box-sizing: border-box;
}
/* Smooth reflow once the first layout has run (not on the initial paint). */
[data-boxes].boxes-ready .card[data-box] { transition: left 0.18s ease, top 0.18s ease; }

.box-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.75rem 0.6rem 0.5rem;
    border-bottom: 1px solid var(--c-border);
    /* No solid fill — just a very subtle gradient sheen over the card. */
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.08) 78%);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}
.card[data-box].is-collapsed .box-head { border-bottom: 0; }
.box-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--c-text);
    cursor: pointer;
    text-align: left;
    flex: 1;
    min-width: 0;
}
.box-toggle > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.box-caret {
    width: 8px;
    height: 8px;
    flex: none;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s;
    opacity: 0.7;
}
.card[data-box].is-collapsed .box-caret { transform: rotate(-45deg); }

/* Width control — a shrink ([← −]) and a grow ([+ →]) icon; disabled + dimmed
   at min/max. Hidden when the grid collapses to a single column (nothing to
   resize — every box is already full width). */
.box-sizes { display: flex; flex: none; gap: 4px; }
[data-boxes].boxes-stacked .box-sizes { display: none; }
.box-size {
    height: 26px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    color: var(--c-muted, #6b7378);
    cursor: pointer;
}
.box-size:hover { background: #f0f1f3; color: var(--c-text); }
.box-size svg { pointer-events: none; }
.box-size.is-disabled { opacity: 0.3; cursor: default; background: #fff; color: var(--c-muted, #9aa1a6); }
/* Drag handle — starts the pointer-drag reorder handled by boxes.js.
   Hidden in compact mode (window too narrow to honor pinned columns — the grid
   auto-packs in desktop reading order, so there is nowhere precise to drop). */
[data-boxes].boxes-compact .box-drag { display: none; }
.box-drag {
    flex: none;
    width: 24px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--c-muted, #9aa1a6);
    cursor: grab;
}
.box-drag:active { cursor: grabbing; }
.box-drag svg { pointer-events: none; }

/* Animated collapse: the grid row goes 1fr → 0fr; the inner wrapper is clipped
   so the content slides closed rather than vanishing. */
.box-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.25s ease; }
.box-body-inner { min-height: 0; overflow: hidden; padding: 1.25rem; }
.card[data-box].is-collapsed .box-body { grid-template-rows: 0fr; }
.card[data-box].is-collapsed .box-body-inner { padding-top: 0; padding-bottom: 0; }

/* Drag state: the dragged box floats under the cursor (position:fixed) while a
   dashed placeholder holds its target slot in the masonry; iframes stop
   intercepting the pointer so the drag reads cleanly over the content box. */
[data-boxes].boxes-dragging { cursor: grabbing; user-select: none; }
[data-boxes].boxes-dragging iframe { pointer-events: none; }
.card[data-box].is-drag-float {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    opacity: 0.96;
    transition: none !important;
    cursor: grabbing;
    z-index: 1000;
}
.box-ph {
    position: absolute;
    border: 2px dashed var(--c-accent, #006ce7);
    border-radius: var(--radius, 8px);
    background: rgba(0, 108, 231, 0.07);
    pointer-events: none;
    box-sizing: border-box;
    transition: left 0.18s ease, top 0.18s ease;
}

/* ---- Form layout ---- */
.form-row { display: flex; gap: 16px; }
.form-row .grow { flex: 1; }
.card-subhead { font-size: 0.95rem; margin: 1.25rem 0 0.6rem; color: var(--c-text); }
.card-subhead:first-child { margin-top: 0; }

/* Appearance colour pickers: fixed square swatch + label to the right, so rows
   stay aligned regardless of label length. */
.color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; }
.color-row { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 0.9rem; line-height: 1.25; }
.color-row input[type="color"] {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }
.color-row input[type="color"]::-moz-color-swatch { border: none; border-radius: 7px; }
@media (max-width: 540px) {
    .color-grid { grid-template-columns: 1fr; }
}

/* Colour roles: a base picker plus optional lighter/darker variant overrides
   (empty = the auto-generated shade shown as the placeholder). */
.role-colors { display: flex; flex-direction: column; gap: 14px; }
.role-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.role-base { flex: 0 0 300px; }
/* "Display in palettes" — an eye toggle inside the colour row (right of the
   reset): open eye = offered in palettes, crossed eye (checked) = hidden.
   Geometry is a 1:1 clone of .color-field-reset, so both icons centre
   identically. */
.role-palette-hide {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    color: #9aa3ab;
    cursor: pointer;
}
.role-palette-hide:hover { color: var(--c-text); }
.role-palette-hide input { display: none; }
.role-palette-hide .rp-eye-off { display: none; }
.role-palette-hide input:checked ~ .rp-eye { display: none; }
.role-palette-hide input:checked ~ .rp-eye-off { display: inline; }

/* Colour field = swatch picker + hex text field + label (used for base roles
   and surface panels), so a hex code is editable everywhere. */
.color-field { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.color-field-pick {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--c-border);
    border-radius: 7px;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.color-field-pick::-webkit-color-swatch-wrapper { padding: 0; }
.color-field-pick::-webkit-color-swatch { border: none; border-radius: 6px; }
.color-field-pick::-moz-color-swatch { border: none; border-radius: 6px; }
.color-field-hex {
    flex: 0 0 88px;
    width: 88px;
    font-family: monospace;
    font-size: 0.8rem;
    text-align: center;
    padding: 6px 4px;
}
/* Empty = inherited: the placeholder shows the inherited hex, kept extra
   light so it clearly reads as "not set here". */
.color-field-hex::placeholder,
.role-variant-in::placeholder { color: #ccd2d8; opacity: 1; }
/* Reset: clears the colour back to "never set" (inherit / built-in default). */
.color-field-reset {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 6px;
    color: #9aa3ab;
    cursor: pointer;
}
.color-field-reset:hover { color: var(--c-text); background: rgba(0,0,0,0.06); }
.color-field-label { flex: 1 1 auto; min-width: 0; }
/* "Průhledná" toggle next to a surface colour (stores the literal 'transparent'). */
.color-field-trans {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: none;
    font-size: 0.78rem;
    color: var(--c-muted, #6b7378);
    white-space: nowrap;
    cursor: pointer;
}

/* Colour helper: a label on its own line above the picker + hex + opacity
   slider row (admin.js syncs them; opacity < 100% is stored as #rrggbbaa). */
.color-helper { margin-bottom: 0.8rem; }
.color-helper-label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.85rem; }
/* Several colour helpers side by side (e.g. a button's base/text + hover pair). */
.color-helper-group { display: flex; flex-wrap: wrap; gap: 0 28px; }
.color-helper-group > .color-helper { flex: 1 1 210px; min-width: 190px; }
/* Two columns of stacked colour helpers (button base pair | hover pair). */
.color-helper-cols { display: flex; flex-wrap: wrap; gap: 0 28px; }
.color-helper-col { flex: 1 1 210px; min-width: 190px; }
.color-alpha {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
}
.color-alpha-range { width: 90px; }
.color-alpha-val {
    font-size: 0.75rem;
    color: var(--c-muted, #6b7378);
    min-width: 34px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Gradient settings are shown only while the gradient checkbox is on. */
.grad-fields { margin-top: 0.5rem; }
.grad-fields[hidden] { display: none !important; }

/* Live preview of a configured (inner) shadow. */
.shadow-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    padding: 6px 14px;
    background: #eef1f4;
    border-radius: 8px;
}
.shadow-preview-box {
    width: 64px;
    height: 38px;
    background: #fff;
    border-radius: 6px;
}

/* Compact shadow editor: X / Y / blur / spread / colour / opacity in a row. */
.shadow-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; margin-bottom: 0.4rem; }
.shadow-row > label { display: flex; flex-direction: column; gap: 3px; font-size: 0.75rem; margin: 0; font-weight: 400; }
.shadow-row > label > span { color: var(--c-muted); }
.shadow-row input[type="number"] { width: 62px; padding: 5px 6px; }
.shadow-row .color-row { flex-direction: row; align-items: center; gap: 8px; }
.shadow-row .color-row input[type="color"] { width: 32px; height: 32px; }
.role-variants { display: flex; gap: 10px; flex-wrap: wrap; }
.role-variant { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 74px; }
.role-variant-pick {
    width: 100%;
    height: 22px;
    padding: 0;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.role-variant-pick::-webkit-color-swatch-wrapper { padding: 0; }
.role-variant-pick::-webkit-color-swatch { border: none; border-radius: 5px; }
.role-variant-pick::-moz-color-swatch { border: none; border-radius: 5px; }
.role-variant-in {
    width: 100%;
    font-family: monospace;
    font-size: 0.75rem;
    text-align: center;
    padding: 4px 2px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
}
.role-variant small { font-size: 0.68rem; color: var(--c-muted); }
@media (max-width: 640px) { .role-base { flex-basis: 100%; } }
.form-hint { display: block; margin-top: 0.3rem; font-size: 0.8rem; color: var(--c-muted); }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    margin-bottom: 0.5rem;
    cursor: pointer;
}
.checkbox-label input { width: auto; }
/* Checkboxes and radios always show the pointer cursor. */
input[type="checkbox"], input[type="radio"] { cursor: pointer; }

/* Banner CTA: the two buttons' settings sit side by side (50/50), stacking on
   narrow screens. */
.banner-cta-cols { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.banner-cta-col { flex: 1 1 260px; min-width: 240px; }
.banner-cta-col > .card-subhead:first-child { margin-top: 0; }

/* Range sliders must not inherit the text-input chrome — the padding would
   inset the track, so the thumb never reaches the visual right edge at 100%. */
input[type="range"] {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    height: auto;
}
input[type="range"]:focus { box-shadow: none; }

/* ---- Tabbed strip (appearance: Primární pozadí / Plochy / Karty) ---- */
.appearance-tabs { margin: 0.25rem 0 1rem; }
/* ---- Tab strips — ONE shared look everywhere ----
   Used by the settings sub-pages, the appearance surface cards and the module
   tab strip: a plain underline bar where the active tab is marked by an accent
   bottom border (no fill, no rounded "folder" tabs). The transparent bottom
   border is always present so hover/active only recolour it and the strip never
   shifts by a pixel. */
.tab-strip,
.module-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 22px;
    border-bottom: 1px solid var(--c-border);
}
.tab-btn,
.module-tab {
    padding: 9px 11px;
    margin-bottom: -1px;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    font: inherit;
    font-weight: 500;
    color: var(--c-muted);
    text-decoration: none;
    cursor: pointer;
}
.tab-btn:hover,
.module-tab:hover { color: var(--c-text); text-decoration: none; }
.tab-btn.is-active,
.module-tab.is-active { color: var(--c-text); border-bottom-color: var(--c-accent); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---- Palette-colour text field (banner headings) ---- */
.palette-text { border: 1px solid var(--c-border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.palette-text-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; background: #fafbfc; border-bottom: 1px solid var(--c-border); }
.pt-swatch { width: 22px; height: 22px; padding: 0; border: 1px solid rgba(0,0,0,0.18); border-radius: 4px; cursor: pointer; }
.pt-swatch-reset { background: #fff; color: var(--c-muted); font-size: 1.05rem; line-height: 1; }
.pt-swatch-reset:hover { color: var(--c-text); }
.palette-text-input { padding: 0.55rem 0.6rem; min-height: 1.6rem; font-size: 1rem; outline: none; line-height: 1.4; }
.palette-text-input:focus { box-shadow: inset 0 0 0 2px rgba(34,34,34,0.1); }

/* ---- Article labels (ribbon definitions repeater + form dots) ---- */
.label-def-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.label-def-row input[type="text"] { flex: 1; min-width: 0; }
.label-def-row [data-label-remove] { flex: none; padding: 0.4rem 0.7rem; }
.label-defs [data-label-add] { margin-top: 4px; }
/* Colour dot next to the label name — the background carries the project's
   actual role colour (inline style, kept in sync with the picked swatch). */
.label-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    flex: none;
    border-radius: 50%;
    background: #c9ced4;
    vertical-align: -1px;
    margin-right: 4px;
}
/* Visual colour picker: one swatch per predefined role colour. */
.label-color-pick { display: inline-flex; gap: 6px; align-items: center; flex: none; }
.label-swatch { position: relative; display: inline-flex; cursor: pointer; }
.label-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.label-swatch-dot {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10);
    transition: transform 0.12s;
}
.label-swatch:hover .label-swatch-dot { transform: scale(1.12); }
.label-swatch input:checked + .label-swatch-dot {
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10), 0 0 0 2px #fff, 0 0 0 4px var(--c-text, #222);
}

/* ---- Single-level row drag (labels repeater, form-fields editor) ---- */
.drag-row-handle {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #b8bfc6;
    cursor: grab;
    user-select: none;
}
.drag-row-handle:hover { color: #6b7378; }
.drag-row-handle:active { cursor: grabbing; }
[data-drag-row].is-drag-row { opacity: 0.55; }

/* Draggable page-module order rows (Settings → General → Modules). */
.module-order-list { max-width: 420px; }
.module-order-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 6px;
    background: #f6f8fa;
    border: 1px solid #e7eaee;
    border-radius: 6px;
}
.module-order-name { font-weight: 500; }

/* Appearance tabs: one tab may hold several surfaces (e.g. Header + dropdown
   submenu, or the three button styles). Each surface gets a prominent heading
   marked by an accent bar; every section after the first is set off by a
   hairline rule so the groups read as distinct blocks. */
.surface-section-head {
    margin: 0 0 14px;
    font-size: 1.02rem;
    font-weight: 600;
    color: #222;
}
.surface-section + .surface-section-head {
    margin-top: 32px;
    padding-top: 26px;
    border-top: 1px solid #dde2e7;
}

/* ---- Link field: object-type select + per-type picker (or URL input) ---- */
.link-field { display: flex; gap: 8px; align-items: stretch; }
.link-field [data-lf-type] { flex: 0 0 auto; max-width: 170px; }
.link-field [data-lf-url],
.link-field [data-lf-pick] { flex: 1; min-width: 0; }
textarea { min-height: 120px; resize: vertical; font-family: ui-monospace, monospace; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.65rem 0.85rem; text-align: left; border-bottom: 1px solid var(--c-border); }
.table th { background: #fafbfc; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: #666; }
.table tr:last-child td { border-bottom: none; }
.ta-right { text-align: right; }

/* Hierarchical title cell (page tree): indent children, mark them with a branch. */
.tree-title { display: inline-flex; align-items: baseline; }
.tree-branch { color: var(--c-muted); font-weight: 400; }

/* Right-aligned action column in list tables (Edit / Delete buttons). */
.col-actions { text-align: right; white-space: nowrap; width: 1%; }
.col-actions .btn { vertical-align: middle; }
.col-actions form { display: inline; margin-left: 4px; }

/* ---- Drag-and-drop ordering ---- */
.col-drag { width: 34px; padding-right: 0 !important; }
.drag-handle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; color: var(--c-muted);
    cursor: grab; border-radius: 6px; fill: currentColor;
}
.drag-handle:hover { background: #f0f1f3; color: var(--c-text); }
.drag-handle:active { cursor: grabbing; }
.table-sortable tr.is-dragging { opacity: 0.4; }
.table-sortable tr.is-dragging .drag-handle { cursor: grabbing; }
.sort-placeholder td {
    padding: 0.65rem 0.85rem;
    background: rgba(0,108,231,0.06);
    box-shadow: inset 0 0 0 2px var(--c-accent);
}
/* The placeholder title matches the row's title (same font / colour / position). */
.sort-ph-label {
    display: inline-block;
    color: var(--c-text);
    transition: padding-left 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
/* └ nesting marker in the placeholder — the same .tree-branch marker a saved
   nested row shows; visible only while the drop would nest the row under the
   one above (hidden again back at the top level). */
.sort-ph-nest { display: none; }
.sort-placeholder.is-nested .sort-ph-nest { display: inline; }
.table-sortable td { transition: padding-left 0.15s ease; }
.table-sortable tr.is-dragging-child { opacity: 0.5; }

/* ---- Language tabs ---- */
.lang-tabs { display: flex; gap: 4px; margin-bottom: 1rem; }
.lang-tabs a {
    padding: 5px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    text-decoration: none;
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
}
.lang-tabs a.active { background: var(--c-dark); color: #fff; border-color: var(--c-dark); }

/* ---- Misc ---- */
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.badge-ok { background: #e6f5ec; color: #1e7e44; }
code { background: #f0f1f3; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }

/* ---- Error page ---- */
.error-page { text-align: center; padding: 3rem 1rem; }
.error-page h1 { margin: 0 0 0.5rem; font-size: 1.6rem; }
.error-page p { max-width: 480px; margin: 0 auto 1.5rem; }

/* Subtle checkerboard behind image previews so transparent PNGs are visible. */
.img-checker,
.media-card-thumb,
.media-field-preview img,
.media-tile {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(-45deg, #e9ecef 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9ecef 75%),
        linear-gradient(-45deg, transparent 75%, #e9ecef 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.media-card-thumb picture, .media-field-preview picture { display: block; width: 100%; height: 100%; }
.media-card-thumb picture img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Showcase modules (reference customers / partners / certificates) ---- */
/* Small logo preview in the items list — contained, never cropped. */
.col-showcase-thumb { width: 92px; }
.showcase-thumb {
    display: inline-flex;
    width: 74px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    overflow: hidden;
}
.showcase-thumb picture { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }
/* Explicit box + object-fit (not max-*): an SVG with only a viewBox has no
   intrinsic size and would collapse to 0×0 under max-width/max-height. */
.showcase-thumb img { width: 100%; height: 100%; object-fit: contain; }

/* ---- Media library ---- */
/* Library toolbar: name search + select-all + bulk delete. */
.media-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}
.media-toolbar .media-search { flex: 0 1 320px; min-width: 200px; }
.media-toolbar .media-select-all { margin: 0; white-space: nowrap; }
.media-toolbar form { display: inline-flex; margin: 0; }

.media-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.media-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
/* The explicit display:flex would beat the UA [hidden] rule — the search
   filter hides cards via the hidden attribute. */
.media-card[hidden] { display: none !important; }
.media-card-thumb {
    aspect-ratio: 4 / 3;
    background: #f0f1f3;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    position: relative; /* anchors the bulk-select checkbox */
}
/* Bulk-select checkbox in the thumbnail's top-right corner. */
.media-card-check {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    display: inline-flex;
    padding: 5px;
    background: rgba(255,255,255,0.92);
    border-radius: 7px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    cursor: pointer;
}
.media-card-check input {
    width: 15px;
    height: 15px;
    margin: 0;
    padding: 0;
    cursor: pointer;
}
.media-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-card-body { padding: 0.6rem 0.7rem; flex: 1; }
.media-card-name {
    font-size: 0.82rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-card-dims { font-size: 0.72rem; margin-bottom: 0.4rem; }
/* Alt text spans the full card width; Save + Delete sit side by side below it. */
.media-card-alt { margin-top: 0.3rem; }
.media-card-alt input { width: 100%; font-size: 0.82rem; padding: 0.35rem 0.45rem; }
.media-card-alt input + input { margin-top: 6px; }

/* Media library: modern uploader — an unmistakable dropzone (click or drop)
   plus a preview queue of the picked files before the actual upload. */
.media-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 36px 20px;
    border: 2px dashed var(--c-border);
    border-radius: 10px;
    background: #fafbfc;
    color: var(--c-muted, #6b7378);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.media-dropzone strong { color: var(--c-text); font-size: 1rem; }
.media-dropzone span { font-size: 0.85rem; }
.media-dropzone-hint { font-size: 0.76rem !important; opacity: 0.8; margin-top: 4px; }
.media-dropzone-icon { color: var(--c-accent); margin-bottom: 6px; }
.media-dropzone:hover,
.media-dropzone:focus-visible,
.media-dropzone.is-drop { border-color: var(--c-accent); background: #f0f6ff; }
.media-dropzone.is-drop { border-style: solid; }

.media-queue {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.media-queue-item {
    position: relative;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.media-queue-item img { width: 100%; height: 76px; object-fit: cover; display: block; }
.media-queue-name {
    display: block;
    padding: 3px 6px;
    font-size: 0.68rem;
    color: var(--c-muted, #6b7378);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-queue-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 13px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
}
.media-queue-remove:hover { background: rgba(0,0,0,0.75); }
.media-uploader-actions { display: flex; gap: 8px; margin-top: 14px; }
/* display:flex/grid above would defeat the hidden attribute — restore it, so
   the queue and its buttons only show once some images are picked. */
.media-queue[hidden],
.media-uploader-actions[hidden] { display: none; }
.media-uploader.is-uploading { opacity: 0.7; pointer-events: none; }

/* Gallery tiles reorder by drag & drop (order of tiles = displayed order). */
.media-gallery-item { cursor: grab; }
.media-gallery-item.is-dragging { opacity: 0.45; cursor: grabbing; }

/* WP-style insert-between-blocks indicator, overlaid on the TinyMCE iframe
   from the parent document (it must never become part of the content).
   Fixed to the viewport — editor.js places it from the iframe's client rect;
   z-index stays under the admin header (100) so it never bleeds over it. */
.cms-gap-line {
    position: fixed;
    display: none;
    height: 0;
    border-top: 2px solid var(--c-accent);
    pointer-events: none;
    z-index: 90;
}
.cms-gap-line .cms-gap-plus {
    position: absolute;
    /* Integer offset instead of translateX(-50%): the translate keeps a
       half-pixel on odd line widths and the circle painted a hair left. */
    left: calc(50% - 11px);
    top: -12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--c-accent);
    color: #fff;
}
.cms-gap-line .cms-gap-plus svg { width: 13px; height: 13px; display: block; flex: none; }

/* ---- Editor element-properties bar (Gutenberg-like second toolbar row).
   Injected by editor.js into .tox-editor-header so it sticks together with
   the toolbar. Left: breadcrumb of ancestor-element icons (click a parent to
   configure it). Middle: element name + quick actions. Right: move up/down,
   delete, and the "Vlastnosti" toggle rolling out the full config panel.
   ⚠ Every selector is prefixed with .tox: the oxide skin ships a universal
   reset `.tox *:not(svg):not(rect)` (0,1,2) that zeroes width/border/padding/
   background and is injected AFTER admin.css — plain single-class selectors
   (0,1,0) lose to it. The .tox prefix (0,2,0) outranks the reset. */
.tox .cms-elbar {
    /* .tox-editor-header is a 2-column grid (1fr min-content) — span both,
       else the bar would sit in the first track only. */
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 37px;
    padding: 3px 8px 4px;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    font-size: 0.85rem;
}
.tox .cms-elbar-chips { display: flex; align-items: center; gap: 2px; }
.tox .cms-elbar-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: var(--radius);
    color: var(--c-muted);
    cursor: pointer;
}
.tox .cms-elbar-chip svg { width: 20px; height: 20px; display: block; }
.tox .cms-elbar-chip:hover { background: var(--c-bg); color: var(--c-text); }
.tox .cms-elbar-chip.is-current {
    color: var(--c-accent);
    background: rgba(0, 108, 231, 0.08);
    cursor: default;
}
.tox .cms-elbar-sep { color: #c6cad1; padding: 0 1px; }
.tox .cms-elbar-label { font-weight: 600; margin: 0 6px 0 4px; white-space: nowrap; }
.tox .cms-elbar-actions { display: flex; align-items: center; gap: 4px; }
.tox .cms-elbar-spacer { flex: 1; }
.tox .cms-elbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 9px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--c-text);
    cursor: pointer;
}
.tox .cms-elbar-btn:hover { background: var(--c-bg); }
.tox .cms-elbar-btn:disabled { opacity: 0.35; cursor: default; background: var(--c-surface); }
.tox .cms-elbar-btn svg { width: 15px; height: 15px; display: block; }
/* Arrows/trash: same height as the "Vlastnosti" button, near-square. */
.tox .cms-elbar-btn--icon { width: 30px; padding: 0; justify-content: center; }
.tox .cms-elbar-btn--danger:hover { border-color: var(--c-danger); color: var(--c-danger); }
.tox .cms-elbar-props-toggle svg { transition: transform 0.15s; }
.tox .cms-elbar.props-open .cms-elbar-props-toggle svg { transform: rotate(180deg); }
/* Roll-out panel: grid-rows 0fr→1fr = animated slide (same trick as the
   collapsible boxes). */
.tox .cms-elbar-panelwrap {
    width: 100%;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.18s ease;
}
.tox .cms-elbar.props-open .cms-elbar-panelwrap { grid-template-rows: 1fr; }
/* Fields sit side by side at their natural width — no grid stretching, so
   short controls (icon pickers, swatches) don't leave gaps between fields.
   Bottom-aligned: label-less controls (buttons, the ratio lock) line up with
   the input row without phantom label spacers. */
.tox .cms-elbar-panel {
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 18px;
}
.tox .cms-elbar-field { flex: 0 0 auto; }
/* Panel controls share the inputs' 30px height (vertical centring). */
.tox .cms-elbar-panel .cms-elbar-btn { height: 30px; }
.tox .cms-elbar-panel .cms-elbar-iconbtn { height: 30px; width: 32px; }
.tox .cms-elbar.props-open .cms-elbar-panel {
    padding: 8px 2px 10px;
    border-top: 1px dashed var(--c-border);
    margin-top: 3px;
}
.tox .cms-elbar-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.75rem;
    color: var(--c-muted);
}
.tox .cms-elbar-field input[type="text"],
.tox .cms-elbar-field select {
    width: 220px;
    padding: 5px 8px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--c-text);
    background: var(--c-surface);
    font-family: inherit;
    appearance: auto;
    -webkit-appearance: auto;
}
/* Segmented icon picker (list type / bullet symbol) in the panel. */
.tox .cms-elbar-iconset { display: flex; gap: 3px; }
.tox .cms-elbar-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: var(--radius);
    color: var(--c-muted);
    cursor: pointer;
}
.tox .cms-elbar-iconbtn svg { width: 18px; height: 18px; display: block; }
.tox .cms-elbar-iconbtn:hover { background: var(--c-bg); color: var(--c-text); }
.tox .cms-elbar-iconbtn.is-active {
    border-color: var(--c-accent);
    color: var(--c-accent);
    background: rgba(0, 108, 231, 0.08);
}
.tox .cms-elbar-swatches { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 24px; }
.tox .cms-elbar-swatch {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 4px;
    cursor: pointer;
    flex: none;
}
.tox .cms-elbar-swatch.is-active { outline: 2px solid var(--c-accent); outline-offset: 1px; }
/* "No background": white with a diagonal strike. */
.tox .cms-elbar-swatch--none {
    background:
        linear-gradient(to top left,
            transparent calc(50% - 1px), var(--c-danger) calc(50% - 1px),
            var(--c-danger) calc(50% + 1px), transparent calc(50% + 1px)) #fff;
}
/* Transient highlight of the element a breadcrumb chip points at — fixed
   overlay in the parent document (same model as .cms-gap-line). */
.cms-el-flash {
    position: fixed;
    display: none;
    border: 2px solid var(--c-accent);
    border-radius: 4px;
    box-shadow: 0 0 0 4px rgba(0, 108, 231, 0.12);
    pointer-events: none;
    z-index: 89;
}
.media-card-actions { display: flex; gap: 6px; margin-top: 0.4rem; }
.media-card-actions form { margin: 0; display: inline; }
.media-card-actions .btn { flex: 1; }

/* ---- Single-image picker field ---- */
.media-field-preview {
    margin: 0.4rem 0;
    min-height: 0;
}
.media-field-preview img,
.media-field-preview picture {
    max-width: 240px; max-height: 150px;
    border: 1px solid var(--c-border); border-radius: var(--radius);
    display: block;
}
.media-field-preview picture img { max-width: 100%; border: 0; }
.media-field-actions { display: flex; gap: 8px; }

/* ---- Gallery picker ---- */
.media-gallery-items {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-bottom: 0.6rem;
}
.media-gallery-item { position: relative; width: 96px; height: 72px; }
.media-gallery-item img {
    width: 100%; height: 100%; object-fit: cover;
    border: 1px solid var(--c-border); border-radius: var(--radius);
}
.media-gallery-remove {
    position: absolute; top: -8px; right: -8px;
    width: 22px; height: 22px; padding: 0;
    border-radius: 50%; border: none;
    background: var(--c-danger); color: #fff;
    font-size: 1rem; line-height: 1; cursor: pointer;
}

/* ---- Picker modal ---- */
/* Above TinyMCE dialogs (~1300) so the picker opens over the image dialog. */
.media-modal { position: fixed; inset: 0; z-index: 100000; display: none; }
.media-modal.is-open { display: block; }
.media-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.media-modal-dialog {
    position: relative;
    width: min(900px, calc(100% - 32px));
    max-height: calc(100vh - 64px);
    margin: 32px auto;
    background: var(--c-surface);
    border-radius: 10px;
    display: flex; flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.media-modal-head, .media-modal-foot {
    display: flex; align-items: center; gap: 12px;
    padding: 0.9rem 1.1rem;
}
.media-modal-head { border-bottom: 1px solid var(--c-border); }
.media-modal-foot { border-top: 1px solid var(--c-border); }
.media-modal-head .media-upload-btn { margin-left: auto; cursor: pointer; }
.media-modal-body { overflow-y: auto; padding: 1rem 1.1rem; }
.media-modal-foot .grow { flex: 1; }
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    min-height: 120px;
}
.media-grid.is-drop { outline: 2px dashed var(--c-accent); outline-offset: 4px; }
.media-grid.is-uploading { opacity: 0.6; }
.media-tile {
    position: relative; padding: 0; cursor: pointer;
    border: 2px solid var(--c-border); border-radius: var(--radius);
    background: #f0f1f3; overflow: hidden; aspect-ratio: 4 / 3;
}
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile.is-selected { border-color: var(--c-accent); box-shadow: 0 0 0 2px var(--c-accent); }
.media-tile-alt {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55); color: #fff;
    font-size: 0.7rem; padding: 2px 5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
