:root {
  /* light theme vars here (same as your :root now) */
  /* Light theme */

    /* Base surfaces */
    --color-bg: #FFFFFF;
    --color-bg-semi: rgba(255, 255, 255, 0.6);
    --color-entity-actions-bg: #FCFCFC;
    --color-calendar-no-business: #FBFBFC;
    --color-action-link: rgb(81, 81, 84);
    --color-divider: rgb(200,200,200);

    --color-panel-bg: rgba(0,0,0, 0.03);

    /* Layout / sidebar */
    --color-sidebar-bg: rgb(246, 246, 246);
    --color-sidebar-bga: rgba(246, 246, 246, 0.7);
    --color-sidebar-border: rgb(237, 237, 237);

    /* Text */
    --color-text-primary: rgb(29, 29, 31);
    --color-text-muted: rgb(110, 110, 115);
    --color-text-subtle: rgb(135, 135, 140);
    --color-text-event: rgba(0, 0, 0, 0.88);

    /* Borders */
    --color-border-subtle: rgb(237, 237, 237);
    --color-border-strong: #e0e0e0;
    --color-border-input: #ccc;
    --color-border-tab: #E8E8EC;

    /* Dropdowns / inputs */
    --color-dropdown-bg: #FFFFFF;
    --color-dropdown-hover-bg: #f5f5f5;

    /* Accents (purple) */
    --color-accent: rgb(0, 102, 204); /* rgb(99, 3, 253);*/
    --color-accent-link-border-subtle: color-mix(in srgb, var(--color-accent) 20%, transparent);
    --color-accent-soft: #f3ebff;
    --color-accent-calendar-bg: rgba(99, 3, 253, 0.06);
    --color-accent-calendar-hover-bg: rgba(99, 3, 253, 0.2);
    --color-accent-calendar-dot: rgba(99, 3, 253, 1);

    /* Buttons */
    --color-btn-bg: rgb(226, 226, 228);
    --color-btn-bg-neutral: rgb(226, 226, 228);     /* always gray — never colorized by data-color-theme */
    --color-btn-hover-bg: rgb(230, 240, 250);
    /* Primary buttons (Save / submit) follow the accent. color-mix darkens
     * 15% for the hover state. Both light and dark themes use the same
     * formula since accent is already lightness-tuned per scheme. */
    --color-btn-primary-bg: var(--color-accent);
    --color-btn-primary-hover-bg: color-mix(in srgb, var(--color-accent) 85%, black);
    --color-btn-primary-text: #FFFFFF;
    --color-btn-hover-text: rgb(0, 102, 204);
    --color-btn-primary-shadow: var(--color-accent);
    --color-btn-primary-shadow-ring: rgb(230, 240, 250);

    /* Neutral copies of borders that should stay gray under any color theme */
    --color-sidebar-border-neutral: rgb(237, 237, 237);
    --color-border-subtle-neutral:  rgb(237, 237, 237);

    /* Calendar / special states */
    --color-today-bg: rgb(227, 0, 0);
    --color-today-text: #FFFFFF;
    --color-calendar-monthweek-bg: rgba(118, 118, 128, 0.12);
    --color-calendar-orange-bg: rgba(255, 204, 0, 0.2);
    --color-calendar-orange-hover-bg: rgb(255, 204, 0);
    --color-calendar-orange-dot: #F19A37;

    /* Misc */
    --color-entry-hover: rgb(245, 245, 247);

    /* Shadows */
    --shadow-soft: rgba(0, 0, 0, 0.04);
    --shadow-medium: rgba(0, 0, 0, 0.06);

    /* Legacy / only in comments or assets */
    --color-svg-icon: #333;
    --color-comment-muted: #999;
    --color-comment-border: #eee;

    /* Layout */
    --main-area-sideways-padding: 48px;     /* horizontal gutter for entity-actions, detail-header(-row), tabs-container */
}

/* Theme switching:
 *   - System default (Auto):   apply dark vars when prefers-color-scheme: dark
 *                              AND the user has not explicitly chosen "light".
 *   - Explicit "light":        suppresses both the @media block and the
 *                              data-theme="dark" block (light :root remains).
 *   - Explicit "dark":         html[data-theme="dark"] applies dark vars
 *                              regardless of system preference.
 *
 * The :not() chain on the @media rule excludes both explicit choices so
 * the user's preference is honored over the OS one. The same dark vars
 * are duplicated under html[data-theme="dark"] for explicit dark mode. */
@media (prefers-color-scheme: dark) {
  /* :where() neutralizes the specificity of the :not() filters so this
   * rule stays at (0,1,0) — same as the light :root above and lower
   * than the html[data-color-theme="..."] color-theme rules below.
   * That's what lets a color-theme's --color-accent override survive in
   * dark mode (it does in light too — same cascade ordering). */
  :root:where(:not([data-theme="light"])):where(:not([data-theme="dark"])) {
    /* Base surfaces */
    --color-bg: #1C1C1E;
    --color-bg-semi: rgba(28, 28, 30, 0.6);
    --color-entity-actions-bg: rgb(38, 38, 40);
    --color-calendar-no-business: #202023;
    --color-action-link: rgb(171, 171, 174);
    --color-divider: rgb(70,70,70);

    --color-panel-bg: rgba(255,255,255, 0.03);

    /* Layout / sidebar */
    --color-sidebar-bg: rgb(32, 32, 35);
    --color-sidebar-bga: rgb(32, 32, 35, 0.5);
    --color-sidebar-border: rgb(50, 50, 54);

    /* Text */
    --color-text-primary: #f5f5f7;
    --color-text-muted: #a1a1a6;
    --color-text-subtle: #8e8e93;
    --color-text-event: #f5f5f7;

    /* Borders */
    --color-border-subtle: #27272A;
    --color-border-strong: #3a3a3c;
    --color-border-input: #3a3a3c;
    --color-border-tab: #2c2c2e;

    /* Dropdowns / inputs */
    --color-dropdown-bg: #1c1c1e;
    --color-dropdown-hover-bg: #2c2c2e;

    /* Accents (purple-ish) */
    --color-accent: rgb(59, 130, 247); /*#b58cff;*/
    --color-accent-soft: rgba(181, 140, 255, 0.16);
    --color-accent-link-border-subtle: color-mix(in srgb, var(--color-accent) 35%, transparent);
    --color-accent-calendar-bg: rgba(181, 140, 255, 0.2);
    --color-accent-calendar-hover-bg: rgba(181, 140, 255, 0.35);
    --color-accent-calendar-dot: rgba(181, 140, 255, 1);

    /* Buttons */
    --color-btn-bg: #2c2c2e;
    --color-btn-bg-neutral: #2c2c2e;                /* always gray — never colorized */
    --color-btn-hover-bg: #3a3a3c;
    --color-btn-primary-bg: var(--color-accent);
    --color-btn-primary-hover-bg: color-mix(in srgb, var(--color-accent) 85%, black);
    --color-btn-primary-text: #ffffff;
    --color-btn-hover-text: #4da3ff;
    --color-btn-primary-shadow: var(--color-accent);
    --color-btn-primary-shadow-ring: rgba(10, 132, 255, 0.25);

    --color-sidebar-border-neutral: rgb(50, 50, 54);
    --color-border-subtle-neutral:  #27272A;

    /* Calendar / special states */
    --color-today-bg: #ff3b30;
    --color-today-text: #ffffff;
    --color-calendar-monthweek-bg: rgba(120, 120, 128, 0.32);
    --color-calendar-orange-bg: rgba(255, 214, 10, 0.18);
    --color-calendar-orange-hover-bg: rgba(255, 214, 10, 0.7);
    --color-calendar-orange-dot: #ffd60a;

    /* Misc */
    --color-entry-hover: rgb(36, 36, 38);

    /* Shadows */
    --shadow-soft: rgba(0, 0, 0, 0.2);
    --shadow-medium: rgba(0, 0, 0, 0.3);
  }
}

/* Explicit user choice: dark mode regardless of system preference.
 * Placed BEFORE the color-theme blocks so a color theme's --color-accent
 * (and any other explicit override) wins by source order in dark mode. */
html[data-theme="dark"] {
    /* Base surfaces */
    --color-bg: #1C1C1E;
    --color-bg-semi: rgba(28, 28, 30, 0.6);
    --color-entity-actions-bg: rgb(38, 38, 40);
    --color-calendar-no-business: #202023;
    --color-action-link: rgb(171, 171, 174);
    --color-divider: rgb(70,70,70);

    --color-panel-bg: rgba(255,255,255, 0.03);

    /* Layout / sidebar */
    --color-sidebar-bg: rgb(32, 32, 35);
    --color-sidebar-bga: rgb(32, 32, 35, 0.5);
    --color-sidebar-border: rgb(50, 50, 54);
    --color-sidebar-border-neutral: rgb(50, 50, 54);

    /* Text */
    --color-text-primary: #f5f5f7;
    --color-text-muted: #a1a1a6;
    --color-text-subtle: #8e8e93;
    --color-text-event: #f5f5f7;

    /* Borders */
    --color-border-subtle: #27272A;
    --color-border-subtle-neutral: #27272A;
    --color-border-strong: #3a3a3c;
    --color-border-input: #3a3a3c;
    --color-border-tab: #2c2c2e;

    /* Dropdowns / inputs */
    --color-dropdown-bg: #1c1c1e;
    --color-dropdown-hover-bg: #2c2c2e;

    /* Accents (purple-ish) */
    --color-accent: rgb(59, 130, 247);
    --color-accent-soft: rgba(181, 140, 255, 0.16);
    --color-accent-link-border-subtle: color-mix(in srgb, var(--color-accent) 35%, transparent);
    --color-accent-calendar-bg: rgba(181, 140, 255, 0.2);
    --color-accent-calendar-hover-bg: rgba(181, 140, 255, 0.35);
    --color-accent-calendar-dot: rgba(181, 140, 255, 1);

    /* Buttons */
    --color-btn-bg: #2c2c2e;
    --color-btn-bg-neutral: #2c2c2e;
    --color-btn-hover-bg: #3a3a3c;
    --color-btn-primary-bg: var(--color-accent);
    --color-btn-primary-hover-bg: color-mix(in srgb, var(--color-accent) 85%, black);
    --color-btn-primary-text: #ffffff;
    --color-btn-hover-text: #4da3ff;
    --color-btn-primary-shadow: var(--color-accent);
    --color-btn-primary-shadow-ring: rgba(10, 132, 255, 0.25);

    /* Calendar / special states */
    --color-today-bg: #ff3b30;
    --color-today-text: #ffffff;
    --color-calendar-monthweek-bg: rgba(120, 120, 128, 0.32);
    --color-calendar-orange-bg: rgba(255, 214, 10, 0.18);
    --color-calendar-orange-hover-bg: rgba(255, 214, 10, 0.7);
    --color-calendar-orange-dot: #ffd60a;

    /* Misc */
    --color-entry-hover: rgb(36, 36, 38);

    /* Shadows */
    --shadow-soft: rgba(0, 0, 0, 0.2);
    --shadow-medium: rgba(0, 0, 0, 0.3);
}


/* ─── Color themes ───────────────────────────────────────────────────────
 * Each theme overrides --color-accent and tints --color-sidebar-bg /
 * --color-btn-bg with the same hue and saturation as the accent (via
 * --th-h / --th-s) and the existing neutral-gray luminance:
 *   light:  sidebar 96%   btn 89%
 *   dark:   sidebar 13%   btn 18%
 *
 *  data-color-theme="default" → no override (tenant / app default applies)
 *  data-color-theme="neutral" → existing gray look (hue 0, sat 0%)
 *  data-color-theme=...       → tinted accent + bgs
 *
 * Selectable from the user dropdown via data-color-theme on <html>.
 * ──────────────────────────────────────────────────────────────────────── */

html[data-color-theme="neutral"]  { --th-h: 0;   --th-s: 0%; }
html[data-color-theme="blue"]     { --th-h: 206; --th-s: 100%; --color-accent: #008EFC; }
html[data-color-theme="green"]    { --th-h: 130; --th-s: 75%;  --color-accent: #18A42F; }
html[data-color-theme="yellow"]   { --th-h: 47;  --th-s: 100%; --color-accent: #EEBC00; }
html[data-color-theme="orange"]   { --th-h: 33;  --th-s: 100%; --color-accent: #F98800; }
html[data-color-theme="red"]      { --th-h: 1;   --th-s: 97%;  --color-accent: #FC2B27; }
html[data-color-theme="purple"]   { --th-h: 289; --th-s: 57%;  --color-accent: #B245CC; }

/* Light luminance — applies whenever an explicit theme is active.
 *
 * Background luminances:
 *   sidebar-bg       96%   (was rgb(246,246,246))
 *   btn-bg           89%   (was rgb(226,226,228))
 * Border luminances (slightly darker than the surfaces they sit on):
 *   border-subtle    93%   (was rgb(237,237,237))
 *   sidebar-border   88%   (matches sidebar-bg → btn-bg transition)
 */
/* Neutral excluded — its --th-s is 0% and the original light :root values
 * are already pure gray; running them through the formula adds nothing
 * and would also bleed into dark mode (this block is unconditional). */
html[data-color-theme="blue"],
html[data-color-theme="green"],
html[data-color-theme="yellow"],
html[data-color-theme="orange"],
html[data-color-theme="red"],
html[data-color-theme="purple"] {
    --color-sidebar-bg:      hsl(var(--th-h) var(--th-s) 96%);
    --color-btn-bg:          hsl(var(--th-h) var(--th-s) 89%);
    --color-border-subtle:   hsl(var(--th-h) var(--th-s) 93%);
    --color-sidebar-border:  hsl(var(--th-h) var(--th-s) 88%);
    /* Hover states colorize too — bg = light tint, text = the accent. */
    --color-btn-hover-bg:    hsl(var(--th-h) var(--th-s) 92%);
    --color-btn-hover-text:  var(--color-accent);
    --color-entry-hover:     hsl(var(--th-h) var(--th-s) 95%);
    /* Soft accent backing (icon hover bgs) */
    --color-accent-soft:     hsl(var(--th-h) var(--th-s) 92%);
}

/* Dark luminance: when system prefers dark AND user is in auto, OR when
 * user explicitly chose dark. Two matching blocks below.
 *
 * Background luminances:
 *   sidebar-bg       13%   (was rgb(32,32,35))
 *   btn-bg           18%   (was #2c2c2e)
 * Border luminances:
 *   border-subtle    16%   (was #27272A)
 *   sidebar-border   20%   (was rgb(50,50,54))
 */
/* Dark surfaces are originally near-gray (rgb(32,32,35) ≈ 4.5% saturation).
 * To stay faithful to that low-saturation character while picking up the
 * theme hue, derive the dark surface vars at low saturation and the
 * original luminance — so blue/red/etc. become subtle tints rather than
 * deep, vivid backdrops.
 *
 * --color-accent itself is NOT tweaked in dark mode — the theme's hex
 * (e.g. #008EFC) is kept as-is so the Save button, swatches, and
 * accent-soft alpha-blends all read consistently across themes. */
/* Neutral is excluded from dark-mode overrides — its --th-h is 0 and
 * --th-s is 0%, which would render every dark surface as pure-gray
 * (e.g. rgb(33, 33, 33)) and drop the original very-slight blue tint
 * of rgb(32, 32, 35). Instead we let the dark :root defaults flow
 * through unchanged for the neutral theme. */
@media (prefers-color-scheme: dark) {
    html[data-color-theme]:not([data-color-theme="default"]):not([data-color-theme="neutral"]):not([data-theme="light"]) {
        /* Surfaces: theme hue + ~original (low) saturation + original luminance */
        --color-sidebar-bg:      hsl(var(--th-h) 5% 13%);
        --color-btn-bg:          hsl(var(--th-h) 3% 18%);
        --color-border-subtle:   hsl(var(--th-h) 5% 16%);
        --color-btn-hover-bg:    hsl(var(--th-h) 5% 22%);
        --color-entry-hover:     hsl(var(--th-h) 3% 14%);
        /* Accents */
        --color-sidebar-border:  hsl(var(--th-h) 8% 20%);            /* original was hsl(240, 4%, 20%); 8% keeps the colored hint subtle (yellow/green were too bright at full sat) */
        --color-btn-hover-text:  var(--color-accent);
        --color-accent-soft:     color-mix(in srgb, var(--color-accent) 16%, transparent);
        /* Sidebar nav hover/active — needs visible theme tint, not the
         * near-gray --color-btn-bg. Higher saturation, hover-level luminance. */
        --color-sidebar-nav-hover: hsl(var(--th-h) 15% 22%);  /* low sat to stay close to neutral's subtle #2c2c2e hover */
    }
}

html[data-theme="dark"][data-color-theme]:not([data-color-theme="default"]):not([data-color-theme="neutral"]) {
    --color-sidebar-bg:      hsl(var(--th-h) 5% 13%);
    --color-btn-bg:          hsl(var(--th-h) 3% 18%);
    --color-border-subtle:   hsl(var(--th-h) 5% 16%);
    --color-btn-hover-bg:    hsl(var(--th-h) 5% 22%);
    --color-entry-hover:     hsl(var(--th-h) 3% 14%);
    --color-sidebar-border:  hsl(var(--th-h) 8% 20%);
    --color-btn-hover-text:  var(--color-accent);
    --color-accent-soft:     color-mix(in srgb, var(--color-accent) 16%, transparent);
    --color-sidebar-nav-hover: hsl(var(--th-h) 15% 22%);  /* low sat to stay close to neutral's subtle #2c2c2e hover */
}

/* ─── User-dropdown color swatch row ─────────────────────────────────── */
.color-swatch-row {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    justify-content: space-between;
    align-items: center;
}
.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--swatch, #888);
    flex: 0 0 22px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease;
    box-sizing: content-box;
}
.color-swatch:hover {
    transform: scale(1.1);
}
.color-swatch.selected {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

/* (The html[data-theme="dark"] block was moved earlier in the file —
 * before the color-theme blocks — so a color-theme's --color-accent
 * override wins by source order. See above, immediately after the
 * dark @media :root block.) */


/* ORIGINAL CSS BELOW, WITH COLORS USING VARIABLES */

html, body {
    margin:0; padding:0;
    background-color:var(--color-bg);
    color:var(--color-text-primary);
}

/* ICONS */
/* APPLE SF SYMBOLS */
@font-face {
    font-family: "SF Light";
    src: url('/ui/SF-Pro-Display-Light.woff2') format('woff2'),
         url('/ui/SF-Pro-Display-Light.otf') format('opentype');
    font-display: block;
}
@font-face {
    font-family: "SF Thin";
    src: url('/ui/SF-Pro-Display-Thin.woff2') format('woff2'),
         url('/ui/SF-Pro-Display-Thin.otf') format('opentype');
    font-display: block;
}
@font-face {
    font-family: "SF Medium";
    src: url('/ui/SF-Pro-Display-Medium.woff2') format('woff2'),
         url('/ui/SF-Pro-Display-Medium.otf') format('opentype');
    font-display: block;
}

* {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Text Remote", ui-sans-serif, sans-serif;
    font-size:16px;
    text-rendering: optimizelegibility;
    -webkit-font-smoothing: antialiased;
}



label,
h1, h2, h3, h4, h5,
.tab-button,
.small-pill,
.sf-icon,
.related-table th, .sort-asc, .sort-desc,
.sidebar * {
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}
label,
.tab-button,
.small-pill,
.related-table th, .sort-asc, .sort-desc {
    cursor: pointer;
}




p {
    margin:0;
}


.sf-icon,
.sf-icon-and-label > span:first-child,
.search-input-container:before {
        font-family: "SF Light";
        font-size:16px;
        display:inline-block;
        width:32px;
        text-align:center;
        color:var(--color-accent);
        text-decoration:none;
}
div.sf-icon {
    font-family: "SF Light";
    width:38px;
    height:32px;
    font-size:24px;
    line-height:32px;
}
button.sf-icon {
    appearance: none;
    background-color:transparent;
    border:none;
}
.menu-item .sf-icon {
    margin-left:-4px;
    margin-right:4px;
}

.sf-icon-and-label {
    display:flex;
    flex-direction:column;
    text-decoration:none;
    align-items:center;
}
.sf-icon-and-label > span:last-child {
    font-size:12px;
}
.sf-icon-and-label > * {
    color: var(--color-action-link) !important;
}
.sf-icon-and-label.disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: default;
}
/* render_icon() emits a masked <div> for named SVG icons. Make it behave like a
   glyph sibling: inherit the surrounding text color (not the accent), scale with
   the element's font-size (1em), and stay centered — so it matches in the menu,
   list rows (24px / text color) and the 80px detail-header badge (36px / muted). */
.sf-icon > div {
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask-size: contain !important;
    mask-size: contain !important;
    -webkit-mask-position: center !important;
    mask-position: center !important;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}
/* Center the masked icon within its .sf-icon box (only when it holds one). */
.sf-icon:has(> div) {
    display: flex;
    align-items: center;
    justify-content: center;
}
/* SF-Symbol glyphs render visually larger than their nominal font-size, so a
   1em-contained SVG looks small next to them — most noticeable in the big
   detail-header badge (80px / font 36). Scale the masked icon up there. */
.detail-header .icon > div {
    width: 1.6em;
    height: 1.6em;
}










/* Desktop Layout - Your existing styles */
.stage {
    display: flex;
    flex-direction: row;
    block-size: 100vh;
}

.column,
.pseudocolumn {
    /*
    padding-left: 16px;
    padding-right: 16px;
    */
    width: calc(min(max(378px, 100vw * 0.2), 450px));
    box-sizing:border-box;
}

.column.main,
.pseudocolumn.main {
    /*width: 100%;*/
    flex:1;
}

.back-mobile {display:none;}

/* Mobile Responsive Layout */
@media (max-width: 768px) {

    .back-mobile {display:inline-block;}

    .stage {
        overflow: hidden;
        position: relative;
    }

    .sidebar,
    .column,
    .column.main,
    .pseudocolumn,
    .pseudocolumn.main {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        transition: transform 0.3s ease-in-out;
    }

    /* Default: show sidebar */
    .sidebar {
        transform: translateX(0);
        z-index: 3;
    }

    .column,
    .pseudocolumn {
        transform: translateX(100%);
        z-index: 2;
    }

    .column.main,
    .pseudocolumn.main {
        transform: translateX(100%);
        z-index: 1;
    }

    /* State: show-list */
    .stage.show-list .sidebar {
        transform: translateX(-100%);
    }

    .stage.show-list .column {
        transform: translateX(0);
    }

    .stage.show-list .column.main {
        transform: translateX(100%);
    }

    /* State: show-main */
    .stage.show-main .sidebar {
        transform: translateX(-100%);
    }

    .stage.show-main .column {
        transform: translateX(-100%);
    }

    .stage.show-main .column.main {
        transform: translateX(0);
    }
}












.sidebar {
    background-color:var(--color-sidebar-bg);
    border-right: 1px solid var(--color-sidebar-border);
    /*
    --current-details-width: calc(100vw - calc(min(max(256px, 100vw * 0.12), 272px)) - calc(min(max(378px, 100vw * 0.2), 450px)));
    --current-list-width: calc(min(max(378px, 100vw * 0.2), 450px));
    --current-nav-width: calc(min(max(256px, 100vw * 0.12), 272px));
    */
    width: calc(min(max(256px, 100vw * 0.12), 272px));
}
.sidebar > div {
    display:flex;
    flex-direction:column;
}
.sidebar-main-part {
    flex:1;
    display:flex;
    flex-direction:column;
    /*inline-size:min(max(256px, 12vw), 272px);*/
    gap:36px;
    padding:24px 16px 18px 16px;
    overflow-y:auto;
    position:relative;
}
.sidebar a,
.dropdown-item {
    display:flex;
    flex-direction:row;
    font-size: 16px;
    letter-spacing: unset;
    line-height: 1.375;
    font-weight: 400;
    color: var(--color-text-primary) !important;
    border-radius:8px;
    
    margin-block-end: 2px;
    margin-inline: 4px;
    padding: 8px;
    padding-inline-start: 12px;
    text-decoration:none;
}
.sidebar .sidebar-main-part a:hover,
.sidebar .sidebar-main-part a.active {
    /* Dark + colorized themes set --color-sidebar-nav-hover to a more
     * saturated tint (the surface btn-bg is intentionally near-gray);
     * everywhere else this falls back to --color-btn-bg, preserving the
     * existing light-mode and default/neutral look. */
    background-color: var(--color-sidebar-nav-hover, var(--color-btn-bg));
}

/* Second-level (child) menu items indent further than top-level ones. The
   base `.sidebar a` rule sets padding-inline-start:12px regardless of level;
   this higher-specificity rule bumps children to 40px. */
.sidebar a.menu-item-child {
    padding-inline-start: 40px;
}

.sidebar .tenant-logo {
    width:100px;
    padding-left:16px;
}

.column {
    /*
    padding-left:16px; padding-right:16px;
    */
    /*width: min(max(378px, min(max(378px, 28vw), 450px)), 450px);*/
    display:flex;
    flex-direction:column;
    overflow-y:auto;
    row-gap:16px;
    /* Neutral var: only the .sidebar's border-right gets colorized per
     * theme — list/main column dividers stay gray. */
    border-right:1px solid var(--color-sidebar-border-neutral);
}
.column.list {
    /* overflow-y:hidden; */

}
.column.list > *,
.pseudocolumn.list > * {
    padding-left:16px; padding-right:16px;
}
.column.list > :last-child {
    margin-bottom:32px;
}
.column.main {
    /*width:100%;*/
    padding:0;
    position:relative;

    display:flex;
    flex-direction:column;

}

.notification {
    display: flex;
    flex-direction: row;
    gap: 6px;

    position:fixed;
    z-index:10;
    bottom:20px;
    right:20px;
    line-height:58px;
    background-color:var(--color-text-primary);
    color:var(--color-bg);
    padding-left:17px;
    padding-right:20px;
    border-radius:18px;
    box-shadow: var(--shadow-medium) 0px 8px 32px 0px, var(--shadow-soft) 0px 2px 4px 0px, var(--shadow-medium) 0px 4px 16px 0px;
}
.notification .sf-icon {
    font-size:24px;
    line-height:60px;
}
.notification.success .sf-icon {
    color:#489F30;
}

/* ── Pending-downloads dev indicator ───────────────────────────────────────
   Fixed top-right pill, dev-mode only. The PHP-side gate (`$GLOBALS['dev_mode']`)
   decides whether to emit the markup at all; the JS poller toggles
   visibility by remaining-count and updates the number inline. */
#tv-pending-indicator {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 100;
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    background-color: var(--color-text-primary);
    color: var(--color-bg);
    font-size: 13px;
    line-height: 18px;
    box-shadow: var(--shadow-medium) 0px 4px 12px 0px;
    font-variant-numeric: tabular-nums;
}
#tv-pending-indicator .tv-pending-count {
    font-weight: 700;
    font-size: 14px;
}
#tv-pending-indicator .tv-pending-label {
    opacity: 0.7;
    font-size: 12px;
}
.notification .notification-action {
    margin-left: 6px;
    padding: 4px 12px;
    border-radius: 10px;
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 28px;
    align-self: center;
    text-decoration: none;
    font-weight: 600;
}
.notification .notification-action:hover {
    opacity: 0.85;
}

.column-header {
    padding-top:15px;
    padding-bottom:12px;

    /*
    margin-left:-16px;
    margin-right:-16px;
    padding-left:16px;
    padding-right:16px;
    */
    box-sizing:border-box;
    

    position:sticky;
    top:0;
    display:flex;  flex-direction:column; gap:18px;
    background-color:transparent; /*var(--color-bg-semi);*/
   
    /*backdrop-filter: blur(16px);*/

    background: linear-gradient(
        to bottom,
        var(--color-bg) 0,
        var(--color-bg) calc(100% - 12px),
        rgba(255, 255, 255, 0) 100%
    );
    z-index:3;
    
}
.flex-row {
    display:flex;
    flex-direction: row;
    align-items:center;
    gap:12px;
}

.flex-row > .sf-icon:last-child {
    margin-right:-6px;
}

.column-header h5 {
    float:left;
    margin-bottom:4px;
}

h5 {
    margin-top:0;
    margin-bottom:0;
    font-size: 17px;
    letter-spacing: unset;
    line-height: 1.235294;
    color: var(--color-text-primary);
    flex:1;
}
h5 > a {
    color: inherit;
    text-decoration: none;
}

a.sf-icon,
button.sf-icon {
    /*padding:4px;
    margin-top:-4px;
    border-radius:8px;
    */ 
    /*margin-top: -7px;*/
    border-radius: 8px;
    min-width: 30px;
    line-height: 30px;
}
a.sf-icon:hover,
button.sf-icon:hover {
    background-color:var(--color-accent-soft);
}

a.sf-icon.dev,
button.sf-icon.dev {
    padding:2px;
    justify-content: center;
    position:absolute;
    right:0;
    font-weight:normal;
    z-index:1;
    background: none;   /* reset button default */
    border: none;
    cursor: pointer;

    background: linear-gradient(
        90deg,
        #1191f8,
        #6a80fc,
        #b05af8,
        #d84bb5,
        #f0437a,
        #f45a1a
        );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.dev-name {
    background: linear-gradient(
        90deg,
        #1191f8,
        #6a80fc,
        #b05af8,
        #d84bb5,
        #f0437a,
        #f45a1a
        );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h5 > a.sf-icon.dev,
h5 > button.sf-icon.dev {
    position:static;
}

/* Dev dropdown button inside a dropdown wrapper */
.dev-dropdown {position:relative;}
.dev-dropdown > button.sf-icon.dev {
    position: absolute; left:0; top:-6px;
}

/* Sidebar nav: dev toolbar pinned top-right of .sidebar-main-part */
.dev-nav-toolbar {
    position: absolute;
    top: 4px;
    right: 44px;
    z-index: 5;
}

/* Detail/form: dev toolbar aligned to the right, after actions strip */
/* Detail: dev icon pinned top-right of .column.main */
.column.main > .dropdown.dev-dropdown {
    position: absolute;
    top: 64px;
    right: 44px;
    z-index: 5;
}

/* List header: dev icon flows inline with the title */
.column-header h5 .dropdown.dev-dropdown {
    display: inline;
}

/* Style switcher inside a dropdown item */
.dropdown-item-switcher {
    padding: 0;
}

.entries-container { /* not used */
    position:relative;
    flex:1;
    overflow-y:auto;

    --fade: 24px;
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0,
        black var(--fade),
        black 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0,
        black var(--fade),
        black 100%
    );
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}
.entries {
    display:flex;
    flex-direction:column;
    gap:2px;
    margin-top:-10px;

    
}



.entries > a,
.entry {
    display:flex;
    flex-direction:row;
    align-items:center;
    column-gap: 12px;
    padding:4px 12px 4px 12px; min-height:48px;
    border-radius:12px;
    text-decoration:none;
}
.entries > a *,
.entry * {
    color: var(--color-text-primary);
}
.entries > a:hover,
.entry:hover {
    background-color: var(--color-entry-hover);
}

.entries > a.group,
.entry.group {
    margin-bottom:12px;
}


.entries > a .flex-vertical
.entry .flex-vertical {
    display:flex;
    flex-direction:column;
    gap:2px;
}

.entries > a .title,
.entry .title {
    font-weight: 400;
    /*height: 20px;*/
    letter-spacing: normal;
    line-height: 20px;
}
.entries > a .subtitle,
.entry .subtitle {
    color: var(--color-text-muted);
    font-size:12px;
    line-height:16px;
}
.entries > a.active,
.entry.active {
    background-color: var(--color-accent);
    /*color: var(--color-bg);*/
    color:#FFFFFF;
}
.entries > a.active *,
.entries > a.active .subtitle,
.entry.active * {
    /*color: var(--color-bg) !important;*/
    color:#FFFFFF;
}



.boxed-entry a:first-child {
    flex:1;
}
.boxed-entry a {
    border-bottom:none;
    text-decoration:none;
}




.grouping {
    display:grid;
    grid-template-columns: repeat(auto-fit, calc(33% - 16px));
    gap: 24px;
}
.grouping > .field {
    display: flex;
    flex-direction: column;
}
/* type='image_url' fields render an <img> directly inside .field-value
   (no class on the img per the design choice). Cap so a 4000px source
   doesn't blow out the layout — fits within the column and never
   exceeds 40% of viewport height. */
.field img {
    max-width: 100%;
    max-height: 40vh;
    height: auto;
    width: auto;
}


.entity-actions {
    padding: 19px var(--main-area-sideways-padding) 12px var(--main-area-sideways-padding);
    background-color:var(--color-entity-actions-bg);
}

.detail-header {
    margin-top:16px;
    margin-bottom:16px;
    padding-left: var(--main-area-sideways-padding);
    padding-right: var(--main-area-sideways-padding);
    display:flex;
    flex-direction:row;
    column-gap:16px;
    align-items: center;
}
.detail-header h4,
.detail-header h4 *,
.group-header-row h4,
.group-header-row h4 * {
    font-size:24px;
    padding:0;
    margin:0;
}
.detail-header .icon {
    width:80px;
    height:80px;
    font-size:36px;
    line-height:80px;
    border-radius:80px;
    color: var(--color-text-muted);
    background-color:var(--color-sidebar-border-neutral);   /* stays gray under any color theme */
}
.detail-header .thumbnail-container,
.entry .thumbnail-container {
    background-color:var(--color-sidebar-border);
    width:280px;
    height:280px;
    display:flex;
    justify-content:center;
    align-items:center;
    border-radius:10px;
    padding: 12px;
}
.detail-header .thumbnail-container > img,
.entry .thumbnail-container > img {
    max-width:100%;
    max-height:100%;
}
.entry .thumbnail-container {
    /*margin: -12px;
    margin-right: 12px;
    */
    margin:-8px;
    width:44px;
    height:44px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding: 6px;
    background-color:transparent;
}
.avatar {
    border-radius:50%;
    max-width:40px;
    max-height:40px;
    margin-top:-6px;
    margin-bottom:-6px;
}
.initials-avatar {
    width:40px;
    height:40px;
    border-radius:50%;
    display:flex;
    justify-content:center;
    align-items:center;
    margin-top:-6px;
    margin-bottom:-6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* role-icon (sf-icon, initials-avatar, anything flagged as role-icon):
   keep contents on a single line and ellipsize if they overflow. */
.role-icon {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}



.detail-properties {
    display:flex;
    flex-direction: column;
    gap:8px;;
}

.field-name,
.record-count {
    color: var(--color-text-muted);
    font-size:12px;
    line-height:16px;
}





/* Header row */
.detail-header-row,
.group-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: var(--main-area-sideways-padding);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Keep icon/hero column fixed-width and let the title wrap instead of squeezing
   the icon to zero when the title is wide (e.g. many mfk chips). Mirror of the
   .entries.none / .entries.ab-rows fix in view-styles-v2.css. */
.detail-header > .icon,
.detail-header > .sf-icon,
.detail-header > .thumbnail-container,
.detail-header > .avatar-stack,
.detail-header > .initials-avatar,
.detail-header > img.avatar {
    flex-shrink: 0;
}
.detail-header > h4 {
    flex: 1 1 0;
    min-width: 0;
}

.entity-actions {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle,
.big-dropdown-toggle {
    cursor: pointer;
}

.big-dropdown-toggle {
    padding-left:0;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-dropdown-bg);
    
    border-radius: 12px;
    padding:8px;
    box-shadow: var(--shadow-medium) 0px 8px 32px 0px, var(--shadow-soft) 0px 2px 4px 0px, var(--shadow-medium) 0px 4px 16px 0px;
    min-width: 100%;
    z-index: 1000;
    margin-top: 0.5rem;
}
.sidebar .dropdown-menu {
    top:unset;
    right:0;
    left:0;
    bottom:100%;
    margin-bottom:6px;
    width:100%;
    box-sizing:border-box;
}

.dropdown.open .dropdown-menu {
    display: block;
}

/* Add-new dropdown (detail header). The container layout (viewport height cap +
   flex column-wrap on wide screens / scroll on narrow) is applied INLINE by
   toggleDropdown() in v2/index.php: the open menu is detached to <body> (so
   `.dropdown.open` selectors can't reach it) and its inline display:block would
   beat a stylesheet rule anyway. Here we only set the per-item width so wrapped
   columns line up — this matches wherever the menu is in the DOM. */
.dropdown-menu.add-new-menu .dropdown-item {
    width: 230px;
    box-sizing: border-box;
}
@media (max-width: 600px) {
    .dropdown-menu.add-new-menu .dropdown-item { width: auto; }
}

/* Menu search component — the "(search: …)" sidebar box + its floating results
   overlay. The panel is position:fixed (anchored under the box by JS) so it
   never disturbs the menu/list column; hiding it restores the UI as-is. */
.menu-search { padding: 4px 8px 8px; }
.menu-search-results {
    position: fixed;
    z-index: 1200;
    background: var(--color-dropdown-bg, var(--color-bg));
    border-radius: 12px;
    box-shadow: var(--shadow-medium) 0px 8px 32px 0px, var(--shadow-soft) 0px 2px 4px 0px;
    padding: 8px;
    overflow-y: auto;
}
.menu-search-results[hidden] { display: none; }
/* the base .entries has margin-top:-10px (tucks under the list-column header) —
   undo it here so results don't ride up under their group title. */
.menu-search-results .entries { margin-top: 0; }
.menu-search-group { margin-bottom: 12px; }
.menu-search-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    padding: 4px 8px 0;
    margin-bottom: 6px;   /* clear the first entry below */
}
/* keyboard-highlighted result */
.menu-search-results .entry.ms-active {
    background-color: var(--color-entry-hover, var(--color-btn-bg));
    border-radius: 10px;
}
.menu-search-empty,
.menu-search-loading {
    padding: 12px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.dropdown-item {
    white-space:nowrap;
    /*
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    */
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--color-dropdown-hover-bg);
}

/* Dropdown section labels & dividers */
.dropdown-section-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-subtle);
    padding: 6px 12px 2px;
}
.dropdown-divider {
    height: 1px;
    background: var(--color-border-subtle);
    margin: 4px 8px;
}

/* Checkmark uses sf-icon sizing so it aligns with Dev Tools / Log out icons */
.dropdown-item .item-check {
    opacity: 0;
}
.dropdown-item.selected .item-check {
    opacity: 1;
}
/* Gradient icon for Developer Tools when dev mode is active (not checkmarks) */
.dropdown-item.selected .sf-icon:not(.item-check) {
    background: linear-gradient(90deg, #1191f8, #6a80fc, #b05af8, #d84bb5, #f0437a, #f45a1a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
/* Dimmed state for sort-order items when no sort field is selected */
.dropdown-item.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Tabs */
.tabs-container {
    padding-left: var(--main-area-sideways-padding);
    padding-right: var(--main-area-sideways-padding);
    position: relative;
}

.tabs-nav {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--color-border-tab);
    margin-bottom: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }

/* Grouped tab nav */
.tabs-nav-grouped {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-bottom: none; /* rows handle their own borders */
}

.tabs-nav-primary {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--color-border-tab);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs-nav-primary::-webkit-scrollbar { display: none; }

.tabs-nav-secondary {
    display: none;
    gap: 12px;
    padding: 2px 0 0;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--color-border-tab);
}
.tabs-nav-secondary::-webkit-scrollbar { display: none; }

.tab-group-pane.active {
    display: flex;
}

.tab-group-btn::after {
    content: ' ›';
    font-size: 11px;
    opacity: 0.5;
    vertical-align: middle;
}

.tab-group-btn.active::after {
    content: ' ‹';
    opacity: 0.8;
}

.tab-group-btn.active {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-text-primary);
}

.tabs-nav-secondary .tab-button {
    font-size: 13px;
    padding: 5px 4px;
    color: var(--color-text-muted);
}

/* Restore spacing for the Details tab (properties view) */
.detail-properties {
    padding-top: 1.5rem;
}

.tab-button {
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    border-bottom: 1px solid transparent;
    cursor: pointer;
    font-size: 16px;
}

.tab-button:hover {
    color: var(--color-text-primary);
}

.tab-button.active {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-text-primary);
}

.tabs-content {
    position: relative;
}

.tab-pane {
    display: none;
    /* Horizontal scrolling is handled by descendants that need it:
       - tab-body (for ab-table / none — wide tables)
       - .rt-body (for shelf mode)
       Setting overflow-x:auto here would also promote overflow-y to auto
       (per CSS spec), causing a spurious vertical scrollbar inside the tab. */
    overflow: visible;
}

.tab-pane.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tab-header h3 {
    margin: 0;
}

.common-table,
.related-table {
    width:100%;
}
.common-table th,
.related-table th,
.bulk-edit-table th {
    text-align: left;
    font-size:12px;
    font-weight:normal;
    white-space: nowrap;
    padding-right:16px;
    position:relative;
}
.common-table td,
.related-table td {
    height:56px;
    width:10%;
    white-space: nowrap;
}
.common-table td:empty::before,
.related-table td:empty::before {
  content: "\00a0—"; /* a dash for empty cells */
}

/* ── Div-based table (.rt) — default look mirrors .related-table ── */
.rt        { display: table; width: 100%; border-collapse: collapse; }
.rt-head   { display: table-header-group; }
.rt-body   { display: table-row-group; }
.rt-row    { display: table-row; }
.rt-th,
.rt-td     { display: table-cell; vertical-align: middle; }

.rt-th {
    text-align: left;
    font-size: 12px;
    font-weight: normal;
    white-space: nowrap;
    padding-top: 1.5rem;
    padding-right: 16px;
    padding-bottom: 8px;
    position: relative;
    cursor: pointer;
    user-select: none;
}
.rt-th:first-child,
.rt-td:first-child {
    padding-left: 16px;
}
.rt-td {
    height: 56px;
    white-space: nowrap;
    padding-right: 16px;
    border-bottom: none;
}
.rt-body .rt-row .rt-td:first-child {
    border-radius: 8px 0 0 8px;
}
.rt-body .rt-row .rt-td:last-child {
    border-radius: 0 8px 8px 0;
}
.rt-body .rt-row:hover .rt-td {
    background: var(--color-entry-hover);
}
.rt-td:empty::before {
    content: "\00a0—";
}
/* gen_* /synthetic field referenced in a view but processor produced
   no value — surfaces missing-dependency / processor-bug situations
   loudly instead of rendering an empty cell. */
.rt-td.cell-error {
    color: var(--color-warning, #c00);
    background: var(--color-warning-bg, rgba(204, 0, 0, .08));
    text-align: center;
    font-weight: 600;
    cursor: help;
}
.rt-actions-col {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.rt .rt-head .rt-row .rt-th:hover {
    color: var(--color-accent);
}
.rt a.fk {
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--color-accent-link-border-subtle);
}

.sort-asc:after,
.sort-desc:after {
    font-family: "SF Light";
    font-size:12px;
    display:inline-block;
    margin-left:4px;
    position:absolute;
    
}
.sort-asc:after {
    content:"􀄩"
}
.sort-desc:after {
    content:"􀄨";
}

a.fk {
    color:unset;
    text-decoration:none;
}

/* Extra content emitted by process_{entity} via $record['gen_extra_content'].
   Default (no modifier, or .top) = stacked above the detail-content wrapper,
   flush against it (cancels .column's 16px row-gap). Other positions are
   utility classes opted into via $record['gen_extra_content_class']. */
.entity-extra-content {
    margin-bottom: -16px;
}

/* .top-sticky — stacked, but pinned to the top while scrolling the column */
.entity-extra-content.top-sticky {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Width of the side column for .left / .right / .left-sticky / .right-sticky.
   Override per-tenant/per-page by setting this custom property on a parent. */
:root {
    --entity-extra-content-side-width: 50%;
}

/* Side variants turn .column.main into a 2-column grid. The wrapper around the
   rest of the detail content (.detail-content) takes the other column, so the
   two siblings sit beside each other cleanly — no row-spanning tricks needed.
   grid-auto-flow:dense is required so that .detail-content with grid-column:1
   doesn't wrap to row 2 when the side panel (placed at col 2) has already
   advanced the auto-flow cursor past column 1 in row 1. */
.column.main:has(> .entity-extra-content.left),
.column.main:has(> .entity-extra-content.right),
.column.main:has(> .entity-extra-content.left-sticky),
.column.main:has(> .entity-extra-content.right-sticky) {
    display: grid;
    grid-auto-flow: dense;
    row-gap: 0;
    column-gap: 0;
    align-items: start;
}
.column.main:has(> .entity-extra-content.left),
.column.main:has(> .entity-extra-content.left-sticky) {
    grid-template-columns: var(--entity-extra-content-side-width, 50%) 1fr;
}
.column.main:has(> .entity-extra-content.right),
.column.main:has(> .entity-extra-content.right-sticky) {
    grid-template-columns: 1fr var(--entity-extra-content-side-width, 50%);
}

/* Side placement + reset stacking margin */
.entity-extra-content.left,
.entity-extra-content.right,
.entity-extra-content.left-sticky,
.entity-extra-content.right-sticky {
    margin-bottom: 0;
    height: 100vh;
}
.entity-extra-content.left,
.entity-extra-content.left-sticky  { grid-column: 1; }
.entity-extra-content.right,
.entity-extra-content.right-sticky { grid-column: 2; }

/* Sticky variants pin to the top of the scroll container */
.entity-extra-content.left-sticky,
.entity-extra-content.right-sticky {
    position: sticky;
    top: 0;
    align-self: start;
}

/* The detail-content wrapper takes the other grid column. min-width:0 lets it
   shrink inside the grid without being held open by wide children (tables,
   long labels, etc.); its own scroll/overflow is handled by .column.main. */
.detail-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    row-gap: 16px;
    padding-bottom:120px;
}
.column.main:has(> .entity-extra-content.left) > .detail-content,
.column.main:has(> .entity-extra-content.left-sticky) > .detail-content {
    grid-column: 2;
}
.column.main:has(> .entity-extra-content.right) > .detail-content,
.column.main:has(> .entity-extra-content.right-sticky) > .detail-content {
    grid-column: 1;
}

/* Any direct <div> child of the side panel (the actual visible content —
   <style>/<script> don't take layout space) fills vertically. Overrides
   per-content fixed heights like .bus-route-map { height: 500px }. */
.entity-extra-content.left > div,
.entity-extra-content.right > div,
.entity-extra-content.left-sticky > div,
.entity-extra-content.right-sticky > div {
    height: 100%;
}

/* Responsive fallback: on narrow viewports, side layouts collapse back to
   stacked-above so the extra content and main content don't fight for space. */
@media (max-width: 900px) {
    .column.main:has(> .entity-extra-content.left),
    .column.main:has(> .entity-extra-content.right),
    .column.main:has(> .entity-extra-content.left-sticky),
    .column.main:has(> .entity-extra-content.right-sticky) {
        display: flex;
        flex-direction: column;
        row-gap: 16px;
    }
    .entity-extra-content.left,
    .entity-extra-content.right,
    .entity-extra-content.left-sticky,
    .entity-extra-content.right-sticky {
        position: static;
        width: auto;
        height: auto;
        grid-column: auto;
        grid-row: auto;
        align-self: auto;
        margin-bottom: -16px;
    }
    .entity-extra-content.left > div,
    .entity-extra-content.right > div,
    .entity-extra-content.left-sticky > div,
    .entity-extra-content.right-sticky > div {
        height: auto;
    }
}

.mfk-chip + .mfk-chip::before {
    content: " – ";
}
.detail-properties a.fk,
.common-table a.fk,
.related-table a.fk {
    text-decoration:none;
    /*color:  rgb(226, 226, 228);*/
    padding-bottom:2px;
    border-bottom:1px solid var(--color-accent-link-border-subtle);
}
.detail-properties a.fk:hover,
.common-table a.fk:hover,
.related-table a.fk:hover {
    color: var(--color-accent);
    border-bottom:1px solid var(--color-accent);
}





.center-vertical {
    min-height:100vh;
    display:flex;
    flex-direction:column;
    justify-content: center;
}
.center-horizontal {
    width:800px;
    max-width:calc(100% - 96px);
    margin-left:auto;
    margin-right:auto;
}






.entity-grid,
.entity-grid-title {
    /* This line enforces both max width AND 48px min gutters */
    width: min(1100px, calc(100% - 96px)); /* 96px = 48px left + 48px right */
    margin-inline: auto;  /* center horizontally inside .main */
}
.entity-grid-title {
    padding-bottom:8px;
    border-bottom: 1px solid var(--color-divider);
}
.entity-grid-title > .sf-icon {display:none;}
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  box-sizing: border-box;
}

.entity-grid-item .entity-preview-table,
.entity-grid-item .no-data {
    padding-left:6px;
    padding-right:6px;
    margin-top:4px;
    font-size:12px;
}
.entity-grid-item .no-data {
    padding-left:8px;
}
.entity-grid-item .entity-preview-table th {
    font-weight:normal;
}
.entity-grid-item .entity-preview-table *  {
    text-align:left;
    font-size:12px;
}


.small-link {
    display:flex;
    margin-top:12px;
    margin-bottom:12px;

    font-size:12px;
    text-decoration: none;
    color:var(--color-accent);
    margin-left:12px;
}
.entity-grid-item .small-link {
    margin-left:8px;
}
.boxed-entry .small-link {
    margin-left:0;
}

/* ============================================================
   SETTINGS / ENTITIES BROWSER
   ============================================================ */

.entity-detail-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 24px;
}
.entity-detail-header h3 {
    margin: 0;
}
.entity-row-count {
    font-size: 12px;
    color: var(--color-text-muted);
}

.entity-section {
    margin-bottom: 32px;
}
.entity-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-divider);
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    font-size: 11px;
    font-weight: normal;
    color: var(--color-text-muted);
    background: var(--color-sidebar-border);
    border-radius: 10px;
    padding: 1px 7px;
}

.entity-meta-table,
.entity-props-table,
.entity-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.entity-meta-table th,
.entity-meta-table td,
.entity-props-table th,
.entity-props-table td,
.entity-list-table th,
.entity-list-table td {
    text-align: left;
    padding: 5px 10px;
    border-bottom: 1px solid var(--color-divider);
}
.entity-meta-table th,
.entity-props-table th,
.entity-list-table th {
    font-weight: 600;
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.entity-props-table tr.missing-col td,
.entity-props-table tr.unregistered-col td {
    color: var(--color-text-muted);
    font-style: italic;
}

.status-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}
.status-badge.status-registered {
    background: #d1fae5;
    color: #065f46;
}
.status-badge.status-unregistered {
    background: var(--color-sidebar-border);
    color: var(--color-text-muted);
}
@media (prefers-color-scheme: dark) {
    .status-badge.status-registered {
        background: #064e3b;
        color: #6ee7b7;
    }
}

/* Flash notice — virtual entity detail saves */
.flash-success {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 12px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
@media (prefers-color-scheme: dark) {
    .flash-success {
        background: #064e3b;
        color: #6ee7b7;
        border-color: #065f46;
    }
}

/* Editable properties table */
.editable-props-table input[type=text],
.editable-props-table input[type=number],
.editable-props-table select {
    padding: 3px 6px;
    border: 1px solid var(--color-border-input);
    border-radius: 4px;
    font-size: 12px;
    background: var(--color-input-bg, #fff);
    color: var(--color-text);
}
.editable-props-table input[type=checkbox] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Tab section headers (for filters/actions "Add" buttons) */
.tab-section-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 12px;
}
.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

/* Floating input wrapper — position context for floating labels inside custom layouts */
.floating-input-wrapper {
    position: relative;
}

/* JSON Config Builder */
.jcb-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-subtle);
    margin: 4px 0 6px;
}
.json-config-builder {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--color-panel-bg);
}
.jcb-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.jcb-ro-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.jcb-subsection-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-subtle);
}
.jcb-ro-rows {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.jcb-ro-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
    align-items: center;
}
.jcb-ro-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-subtle);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}
.jcb-ro-remove:hover { color: var(--color-danger, #c00); background: var(--color-danger-bg, #fee); }
.jcb-ro-add {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 12px;
    padding: 2px 0;
    text-align: left;
}

/* Dev mode view badges */
.dev-view-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 7px;
    vertical-align: middle;
    margin-left: 4px;
    text-decoration: none;
    white-space: nowrap;
    color: white;
    -webkit-text-fill-color: white;
    background: linear-gradient(90deg, #1191f8, #6a80fc, #b05af8, #d84bb5, #f0437a, #f45a1a);
}
.dev-view-badge:hover { filter: brightness(1.1); }
.dev-view-badge .dv-icon { font-size: 11px; }

/* Button group — used in config builder and slot/page-layout fields */
.jcb-btn-group {
    display: inline-flex;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--color-border-input);
}
.jcb-btn-group button {
    background: none;
    border: none;
    border-right: 1px solid var(--color-border-input);
    padding: 5px 11px;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1;
    transition: background 0.12s;
}
.jcb-btn-group button:last-child { border-right: none; }
.jcb-btn-group button.active {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}
.jcb-btn-group button:hover:not(.active) { background: var(--color-dropdown-hover-bg); }
.jcb-btn-group-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.jcb-btn-group-label {
    font-size: 11px;
    color: var(--color-text-subtle);
    font-weight: 500;
    white-space: nowrap;
}
.jcb-btn-group-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-subtle);
    font-size: 12px;
    padding: 2px 5px;
    border-radius: 3px;
    line-height: 1;
    display: none;
}
.jcb-btn-group-clear.visible { display: inline-flex; align-items: center; }
.jcb-btn-group-clear:hover { background: var(--color-dropdown-hover-bg); color: var(--color-text-primary); }

/* Naming tab layout */
.naming-icon-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.naming-icon-field { flex: 0 0 20%; }
.naming-code-field { flex: 1; }

.naming-lang-header {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--color-text-subtle);
    margin: 16px 0 8px;
    text-transform: uppercase;
}
.naming-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}
.form-note {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 4px 0 16px;
}

/* Select floating label — always raised (selects always have a value) */
select.floating-input ~ .floating-label,
.floating-input-select ~ .floating-label {
    top: 10px;
    font-size: 12px;
}



















.main-content-container {
    padding-left:48px;
    padding-right:48px;
    position:relative;
}

.entity-form {
    /*min-height: 100dvh;*/
    display: flex;
    flex-direction: column;
    min-height: 100%; 
}

.entity-form > * {
    max-width: 800px;
}

/* Settings config form inputs — match standard form visual style, no floating labels */
.config-input {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--color-border-input);
    border-radius: 12px;
    background: var(--color-dropdown-bg);
    color: var(--color-text-primary);
    font-size: 15px;
    padding: 8px 14px;
    box-sizing: border-box;
}
.config-input:focus {
    outline: none;
    border-color: var(--color-btn-primary-bg);
}

.form-grouping {
    margin-bottom: 2rem;
}

.form-grouping h5 {
    margin-bottom: 0;
    padding-bottom: 16px;
    /*border-bottom: 2px solid var(--color-border-strong);*/
}

.form-field {
    position: relative;
    margin-bottom: 10px;
}

.search-input {
    flex: 1;
    min-width:20px;
    padding: 0px 16px 0 40px;
    border: 1px solid var(--color-border-input);
    border-radius: 10px;
    font-size: 12px;
    line-height:40px;
    transition: border-color 0.2s;
    background: var(--color-dropdown-bg);
    box-sizing: border-box;
    color:var(--color-text-primary);
}
.search-input-container {
    position:relative;
}
.search-input-container:before {
    content: "􀊫";
    display:block;
    position:absolute;
    left:7px;
    top:11px;
    font-size:18px;
    color: var(--color-action-link)
}

.floating-input {
    width: 100%;
    padding: 20px 16px 0 16px;
    border: 1px solid var(--color-border-input);
    border-radius: 12px;
    font-size: 16px;
    line-height:34px;
    transition: border-color 0.2s;
    background: var(--color-dropdown-bg);
    box-sizing: border-box;
    color:var(--color-text-primary);
}

.floating-input::placeholder {
    color: transparent;
}

.floating-input:focus {
    outline: none;
    border-color: var(--color-btn-primary-bg);
}

.floating-label {
    position: absolute;
    left: 16px;
    top: 18px;
    color: var(--color-text-subtle);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.2s ease;
    background: transparent;
}

/* Float label on focus or when input has value */
.floating-input:focus ~ .floating-label,
.floating-input:not(:placeholder-shown) ~ .floating-label {
    top: 10px;
    font-size: 12px;
    /*color: #999;*/
}

/* Special handling for select */
/* Special handling for select */
select.floating-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Label starts small and at top for select by default */
select.floating-input ~ .floating-label {
    top: 10px;
    font-size: 12px;
}

/* On focus, always make label small */
select.floating-input:focus ~ .floating-label {
    top: 10px;
    font-size: 12px;
}

/* When select has the empty/placeholder option selected, make label larger */
select.floating-input[data-empty="true"] ~ .floating-label {
    top: 18px;
    font-size: 1rem;
}



/* Date and datetime inputs - always float the label */
input[type="date"].floating-input ~ .floating-label,
input[type="datetime-local"].floating-input ~ .floating-label,
input[type="time"].floating-input ~ .floating-label {
    top: 10px;
    font-size: 12px;
}

/* Make placeholder date more subtle in Safari */
/*
input[type="date"].floating-input::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"].floating-input::-webkit-datetime-edit-fields-wrapper,
input[type="time"].floating-input::-webkit-datetime-edit-fields-wrapper {
    opacity: 0.5;
}
*/
/* When input has focus or value, restore normal appearance */
/*
input[type="date"].floating-input:focus::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"].floating-input:focus::-webkit-datetime-edit-fields-wrapper,
input[type="time"].floating-input:focus::-webkit-datetime-edit-fields-wrapper {
    opacity: 1;
}
*/

/* Number inputs with value */
input[type="number"].floating-input:valid ~ .floating-label {
    top: 0.35rem;
    font-size: 0.75rem;
}

/* Textarea adjustment */
textarea.floating-input ~ .floating-label {
    top: 1rem;
}

textarea.floating-input:focus ~ .floating-label,
textarea.floating-input:not(:placeholder-shown) ~ .floating-label {
    top: 0.35rem;
    font-size: 0.75rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.checkbox-wrapper label {
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 1rem;
    position:sticky;
    bottom:0; left:0; right:0;
    padding:20px 0px;
    justify-content: end;
    background-color: transparent; /*var(--color-bg-semi);*/
    backdrop-filter: blur(16px);
    max-width: unset;

    margin-left:-48px;
    margin-right:-48px;
    padding-left:48px;
    padding-right:48px;

    margin-top: auto;
}

.btn {
    cursor:pointer;
    appearance:unset;
    -webkit-appearance: unset;
    border:none;
    border-radius:8px;
    padding: 0 16px 0 16px;
    line-height:42px;
    display:inline-block;
    background-color: var(--color-btn-bg);

    text-decoration:none;
    color: var(--color-text-primary);
}
.btn-sm {
    font-size:12px;
    line-height:30px;
}
.btn:hover {
    color: var(--color-btn-hover-text);
    border-color: var(--color-btn-hover-bg);
    background-color: var(--color-btn-hover-bg);
}
.btn-primary {
    background-color: var(--color-btn-primary-bg);
    color: var(--color-btn-primary-text);
}
.btn-primary:hover {
    background-color: var(--color-btn-primary-hover-bg);
    color:var(--color-btn-primary-text);
}
.btn:active {
    box-shadow: var(--color-btn-primary-shadow) 0px 0px 0px 2px, var(--color-btn-primary-shadow-ring) 0px 0px 0px 5px;
}

.btn.disabled {
    opacity:0.32;
}

/* Inline action buttons (View / Edit / Delete) inside a row's actions
 * keep a neutral gray background regardless of color theme; on hover
 * they pick up the theme's tinted hover bg + accent-colored text. */
.actions-list .btn {
    background-color: var(--color-btn-bg-neutral);
}
.actions-list .btn:hover {
    background-color: var(--color-btn-hover-bg);
    color: var(--color-btn-hover-text);
}

/* Form Cancel button (anything inside .form-actions that isn't the
 * primary Save button) stays gray under any color theme. */
.form-actions .btn:not(.btn-primary) {
    background-color: var(--color-btn-bg-neutral);
}
.form-actions .btn:not(.btn-primary):hover {
    background-color: var(--color-btn-hover-bg);
    color: var(--color-btn-hover-text);
}

/* ──────────────────────────────────────────────────────────────────────
 * Icon backings — appear ON HOVER only
 * ──────────────────────────────────────────────────────────────────────
 *
 * Action icons in the entity-actions top bar (Edit / Delete / quick-set)
 * and the "Add" icon next to the list-view search field get a soft
 * accent-colored 30×30 rounded backing on hover.
 *
 * Implemented via a ::before pseudo absolutely positioned and centered
 * behind the glyph so the icon's intrinsic size (font-size, layout flow)
 * is unaffected. z-index:-1 inside the parent's own stacking context
 * (z-index:0) keeps it tucked behind the text without escaping further.
 */
.entity-actions .sf-icon-and-label > span:first-child,
.search-input-container .sf-icon-and-label > span:first-child {
    position: relative;
    z-index: 0;
}
.entity-actions .sf-icon-and-label > span:first-child::before,
.search-input-container .sf-icon-and-label > span:first-child::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    border-radius: 8px;
    background-color: var(--color-accent-soft);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}
.entity-actions .sf-icon-and-label:hover > span:first-child::before,
.search-input-container .sf-icon-and-label:hover > span:first-child::before {
    opacity: 1;
}

/* The "+" dropdown trigger in the detail-header row was 32×35 (32 from
 * .sf-icon width, plus the button's vertical padding). Pin it to 32×32,
 * and give it the same hover backing the labelled icons get — except
 * the bg fills the whole 32×32 button (no inner pseudo needed). */
.detail-header-row > .dropdown > button.sf-icon {
    width: 32px;
    height: 32px;
    line-height: 32px;
    padding: 0;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}
.detail-header-row > .dropdown > button.sf-icon:hover {
    background-color: var(--color-accent-soft);
}


.small-pill {
    text-decoration:none;
    border-radius:16px;
    background-color: var(--color-entry-hover);
    color: var(--color-text-primary);
    padding:4px 12px;
    display:flex;
    flex-direction: row;;
    align-items:center;
    gap:0px;
}
.small-pill,
.small-pill > * {
    font-size:12px;
    color:var(--color-text-primary);
}
.small-pill > .sf-icon {
    font-size:14px;
    line-height:12px;

}
.small-pill > .sf-icon:first-child {
    margin-left:-12px;
}
.small-pill > .sf-icon:last-child {
    margin-right:-12px;
}

.filters-and-sorting-container {
    display: flex;
    flex-direction: row;
    justify-content: end;
    gap:6px;
    flex-wrap:nowrap; 
    white-space:nowrap;
    float:right;
}
.filters-and-sorting-container .dropdown-item {
    white-space: normal;
    min-width:200px;
}




.sidebar-footer {
    padding-left:16px;
    padding-right:16px;
}
.user-info {
    padding:12px;
    margin-bottom:18px;
    /*background-color: var(--color-btn-bg);*/
    border:1px solid var(--color-border-subtle);
    border-radius:10px;
}
.user-info:hover {
    background-color: var(--color-border-subtle)
}





.execution-time {
    position:fixed;
    bottom:10px;
    left:45vw;
    font-size:12px;
    z-index:3;
}
.execution-time * {
    font-size:12px;
}
.toggler:hover {
    
}
.monitor,
.monitor * {
    font-size:10px;
}
.monitor {
    position:fixed; 
    bottom:38px; 
    left:280px; 
    font-size:12px; 
    max-height:80vh; 
    overflow-y:auto; 
    background-color:#000; /*var(--color-bg); */
    color:#4aff9d;
    z-index:2; 
    border-radius:24px; 
    border:24px solid transparent; 
    
}


.migrations-page {
    padding:16px 48px 16px 48px;
    font-size:12px;
}





/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* Table Edit */
.bulk-edit-wrapper {
    max-width:calc(100vw - 300px);
    min-height:100vh;
    overflow-x: auto;
    display:flex; flex-direction:column;
}

.bulk-edit-wrapper .detail-header-row {
    position:sticky;
    left:0;
}
.bulk-edit-wrapper .bulk-edit-form {
    flex:1;
    display:flex; flex-direction:column;
    justify-content:space-between;

    max-width: calc(100vw - 300px);
    overflow-x: auto;
}
.bulk-edit-form .form-actions {
    position:sticky;
    z-index:2;
    right:0;
    margin-left:0;
    margin-right:0;
    padding-right:48px;
}

.bulk-edit-table {
    padding:16px;
    padding-left:0;

    border-collapse: separate;
    border-spacing: 0;
}
.bulk-edit-table th,
.bulk-edit-table td {
    padding:4px 4px;
}
.bulk-edit-table th:first-child,
.bulk-edit-table td:first-child {
    padding-left:48px;
    position:sticky;
    left:0;
    z-index:1;
    backdrop-filter: blur(16px);
}
.bulk-edit-input {
    margin:0; padding:0;
    padding-left:16px; padding-right:16px;
    appearance: textfield;
    border: 1px solid var(--color-border-input);
    border-radius:12px;
    font-size:16px;
    line-height:38px;
    background-color: var(--color-dropdown-bg);
    color: var(--color-text-primary);
}




/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* Custom styling for FullCalendar */
/* */
/* */
/* */
/* */
/* */
/* */
/* */

#calendar {
    /*
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    */
}

.fc {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
/*
.fc-toolbar-title {
    font-size: 1.5em !important;
    font-weight: 600 !important;
}
*/


.fc-event {
    border: none !important;
    border-radius: 4px !important;
    padding: 2px 4px !important;
    box-shadow:none !important;
}

.fc-daygrid-event {
    white-space: normal !important;
}

/* Therapy session color scheme */
.fc-event {
    
}

.fc-event:hover {
    cursor: pointer;
}

/* Make event titles more readable */
.fc-event-title {
    font-weight: 500;
}


.fc .fc-scrollgrid-section-sticky > * {
    background-color:var(--color-bg);
}


/* Make the header toolbar flex and override FullCalendar's default spacing */
.fc-header-toolbar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
}

/* Force chunks to behave like left / center / right areas */
.fc-header-toolbar .fc-toolbar-chunk {
    flex: 1;
    display: flex;
    align-items: center;
}

/* --- LEFT SECTION: Month + Year --- */
.fc-header-toolbar .fc-toolbar-chunk:nth-child(2) {
    justify-content: flex-start;

}

/* --- CENTER SECTION: Month / Week / Day buttons --- */
.fc-header-toolbar .fc-toolbar-chunk:nth-child(3) {
    justify-content: center;
}
.fc .fc-toolbar-title {
    font-size:21px;
    font-weight:600;
}

/* --- RIGHT SECTION: Prev | Today | Next --- */
.fc-header-toolbar .fc-toolbar-chunk:nth-child(1) {
    justify-content: flex-end;
    gap: 8px; /* space between groups */
    order: 3;
}

/* Move Today between Prev and Next */
.fc-header-toolbar .fc-today-button {
    order: 1;
}
.fc-header-toolbar .fc-button-group,
.fc-header-toolbar .fc-prev-button {
    order: 2;
}

.fc-header-toolbar .fc-next-button {
    order: 3;
}

/* Make the prev/next group inline with Today */
.fc-header-toolbar .fc-button-group {
    display: flex;
}


/* Month / Week / Day */
.fc-header-toolbar .fc-button-group {
    /*background-color: rgb(246, 246, 246); */
    background-color: var(--color-calendar-monthweek-bg);
    display:flex;
    gap:2px;
    padding:2px;
    border-radius:8px;
}
.fc .fc-button {
    background-color:transparent;
    color: var(--color-text-primary);
    font-size:14px;
    line-height:24px;
    min-width:80px;
    padding:0; margin:0; border:0;
    border-radius:6px !important;
}

.fc .fc-button:hover,
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active {
    background-color:transparent;
    color: var(--color-text-primary);
}
.fc-button-active {
    background-color:var(--color-bg) !important;
    color: var(--color-text-primary) !important;
    font-weight:bold !important;
}

.fc-header-toolbar .fc-toolbar-chunk:nth-child(1) .fc-button {
    background-color:transparent !important;
    color:var(--color-accent);
    font-size:17px; font-weight:400;
    padding-left:6px; padding-right:6px;
    min-width:unset;
}
.fc-header-toolbar .fc-toolbar-chunk:nth-child(1) .fc-button-group {
    background-color: transparent;
}


/* Year view */
.fc .fc-multimonth {
    border-color:transparent;
    border:none;
}
.fc-multimonth-daygrid.fc-daygrid {
    background-color:transparent;
}

/* Days */
.fc-col-header-cell-cushion {
    float:left;
    font-size:17px;
    font-weight:normal;
}
/* Today */
.fc .fc-daygrid-day.fc-day-today {
    background-color:transparent;
}
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background-color:var(--color-today-bg);
    color:var(--color-today-text);
    border-radius:50%;
}

.fc .fc-non-business {
    background-color:var(--color-calendar-no-business);
}
/* Today in week view */
.fc-timeGridWeek-view .fc-day.fc-day-today,
.fc-resourceTimeGridWeek-view .fc-day.fc-day-today {
    color:var(--color-today-bg);
}
.fc .fc-timegrid-col.fc-day-today {
    background-color:unset;
}




/* My changes */
.fc-theme-standard .fc-scrollgrid {
    border:0;
}
.fc-theme-standard td, .fc-theme-standard th {
    border-left:4px solid var(--color-bg);
    border-right:4px solid var(--color-bg);
    border-top-color: var(--color-sidebar-border);
    border-bottom-color: var(--color-sidebar-border);
}
.fc .fc-daygrid-day-top {
    flex-direction:row;
    padding:6px;
}
.fc .fc-daygrid-day-number {
    padding:0;
    min-width: 30px;
    height: 30px;
    font-size: 15px;
    font-weight: 400;
    line-height:27px;
    text-align:center;
}
.fc .fc-daygrid-body-natural .fc-daygrid-day-events {
    margin-bottom:2px;
}

.fc-daygrid-dot-event {
    align-items:start;
}
.fc-daygrid-event-dot {
    margin-top:3px;
}
.fc-event-time {font-size:9px; order:3; margin-top:3px;}
.fc-event-title,
.fc-event-title * {font-size:12px; 
    font-weight: normal !important;
    max-width:100%; white-space:nowrap; overflow-x:hidden; text-overflow:ellipsis;
}

.fc-timeGridWeek-view .fc-event,
.fc-timeGridDay-view .fc-event {
    border-left:4px solid var(--color-accent-calendar-dot) !important;
}
.fc-timeGridWeek-view .fc-event .fc-daygrid-event-dot,
.fc-timeGridDay-view .fc-event .fc-daygrid-event-dot {
    display:none;
}

.fc-direction-ltr .fc-timegrid-now-indicator-arrow {
    width: 48px;
    height: 20px;
    margin-left: 10px;
    background-color: var(--color-today-bg);
    color:#FFFFFF;
    z-index: 10;
    margin-top:-10px;
    border-radius: 20px;
    border:0;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    line-height: 17px;
}
.my-period-class {
    opacity:0.6;
    text-transform: uppercase;
    margin-left:2px;
    font-size:10px;
}


.fc-v-event .fc-event-main {
    color: var(--color-text-event);
}
.fc-timegrid-event .fc-event-time {
    font-size:9px;
}
thead > tr:nth-child(2) .fc-col-header-cell-cushion {
    font-size:11px; /* resources row */
}

/* YEAR */
.fc-multiMonthYear-view {
    gap:36px;
}
.fc-multimonth-month {
    
    /*
  width: calc(25% - 27px) !important;
  min-width: auto !important;
  */
}
.fc .fc-multimonth-multicol .fc-multimonth-month {
    padding:0;
}
.fc .fc-multimonth-singlecol .fc-multimonth-header {
    background-color:transparent;
}
.fc .fc-cell-shaded, .fc .fc-day-disabled {background-color:transparent;}
.fc .fc-multimonth-title {
    text-align:left;
    font-weight:normal;
    padding:0; padding-bottom:12px;
}
.fc-multimonth-month th {
    padding-left:6px;
    padding-bottom:12px;
}
.fc-multimonth-month th,
.fc-multimonth-month td {
    border:none !important;
}
.fc-multimonth-month .fc-col-header-cell-cushion {
    font-size:13px;
}
.fc-multimonth-month .fc-daygrid-day-top {
    padding:3px;
}
.fc-multimonth-month .fc-daygrid-day-number {
    font-size:13px;
    min-width:23px;
    height:23px;
    line-height:20px;
}

/* orange */
.fc-event {
    background-color: var(--color-calendar-orange-bg);
    color: var(--color-text-event);
}
.fc-daygrid-event-dot {
    border-color: var(--color-calendar-orange-dot);
}
.fc-event:hover {
    background-color: var(--color-calendar-orange-hover-bg);
}

/* purple */
.fc-event {
    background-color: var(--color-accent-calendar-bg);
    color: var(--color-text-event);
}
.fc-daygrid-event-dot {
    border-color: var(--color-accent-calendar-dot);
}
.fc-event:hover {
    background-color: var(--color-accent-calendar-hover-bg);
}

























/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* PRINT */
@media print {
  @page {
    size: A4;
    margin: 18mm 12mm; /* adjust as needed */
  }

  .sidebar,
  .column.list,
  .entity-actions,
  button.sf-icon {
    display:none;
  }
}


/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* QUICK SEARCH */
.searchhighlight {
    color:#000000 !important;
    background-color: #FFEE00;
    padding: 4px 2px;
    border-radius: 6px;
    margin-left: -2px;
    margin-right: -2px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
thead .searchhighlight,
.under-table .searchhighlight {
    background-color:transparent;
    padding:0;
    margin:0;
    box-shadow:none;
}



/* collapsed */
.menu-parent:not(.active) .menu-children {
  
  overflow: hidden;
  max-height: 0;
  transition: max-height 1000ms ease;
  
  /* key part: anchor children to the bottom so last item reveals first */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* expanded */
.menu-parent.active .menu-children {
  /* set higher than any submenu height you expect */
  max-height: 500px;
  
}

.menu-parent .menu-item-parent:after {
    border-color:transparent;
    border-bottom: 1px solid transparent;
    transition:all 0.5s;
}

.menu-parent.active .menu-item-parent {position:relative;}
.menu-parent.active .menu-item-parent:after {
    content: "";
    position:absolute; bottom:0;
    left:44px; right:16px;
    border-bottom: 1px solid var(--color-divider);
}

.menu-parent .menu-item-parent:hover:after {
    opacity:0;
}

/* Dev-mode menu row: wraps menu-item + register link */
.menu-item-row {
    display: flex;
    align-items: center;
}
.menu-item-row .menu-item {
    flex: 1;
    min-width: 0;
}
/*
.dev-register-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: var(--color-accent, #007aff);
    opacity: 0.5;
    text-decoration: none;
    transition: opacity 0.15s;
}
.dev-register-link:hover {
    opacity: 1;
    background: var(--color-hover, rgba(0,0,0,0.06));
}
*/









.console {
    position:fixed;
    left:0px;
    bottom:76px;
    width:218px;
    padding:16px 0 16px 36px; padding-right:16px;
    backdrop-filter:blur(20px);
    background-color:var(--color-sidebar-bga);
    font-size:12px;
    z-index:2;
}
.console * {
    font-size:12px;
}
.metrics-page-size {
    font-size:12px; padding-top:4px;
    padding-left:8px;
    color: var(--color-text-muted);

}
.ms-chart{
  display:flex;
  flex-direction:row;
  align-items: center;
  overflow:hidden;
  background:var(--color-btn-bg);
  border-radius:8px;
  border:3px solid var(--color-bg);
  filter:grayscale();
  margin-bottom:4px;
  cursor: pointer;
  transition: height 0.18s ease-out;
}
.console:hover .ms-chart {
    filter:none;
}
.console:hover > .metrics-page-size {
    color:var(--color-text-primary);
}

.console,
.console-1 {
    background-color:var(--color-sidebar-bga);
    bottom:8px; left:30vw; width: auto;
    display:flex;
    align-items:center;
    border-radius:12px; border-radius:32px;
}
.console .ms-chart,
.console-1 .ms-chart {
    margin-bottom:0;
}


.ms-seg{
  height:100%;
  position: relative;          /* anchor for the label ::before */
  transition: margin-top 0.18s ease-out;
}

/* Label sits to the right of each segment. Hidden in the collapsed state
   (the chart's own overflow:hidden clips it, and we also keep opacity:0
   so it doesn't claim space when computing widths). Revealed when the
   chart toggles into waterfall mode. */
.ms-seg::before {
  content: attr(data-label);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 6px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  color: var(--color-text-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
}

/* ─── Waterfall (expanded) state ─────────────────────────────────────────
   - Chart's bordered box stays exactly the same size as in compact mode.
     The visual "growth" comes from segments extending *above* the box,
     not from the box itself growing.
   - Each segment uses a negative margin-top proportional to its index, so
     the staircase goes up without altering flex layout (segment widths
     and x-positions stay identical to the compact view).
   - overflow:visible on the chart (and on .console, which inherits it via
     its default) lets the staircase + labels show above the box. */
.console {
  overflow: visible;
}
.ms-chart.expanded {
  overflow: visible;
  filter: none;                /* user is inspecting — always crisp */
}
.ms-chart.expanded .ms-seg {
  margin-top: calc(var(--idx, 0) * var(--row, 14px) * -1);
}
.ms-chart.expanded .ms-pad {
  /* The padding segment fills leftover width in compact mode but has no
     --idx, so it'd sit at row 0 — leave it there; it gracefully fades into
     the chart's background and provides a visual baseline. */
}
.ms-chart.expanded .ms-seg::before {
  opacity: 1;
}

.ms-total {
    font-size:12px;
    padding-right:8px;
    white-space: nowrap;
}
.ms-total:after {
    content:"ms";
    opacity:0.6;
    margin-left:2px;
}





















/* Group View - Stacked Avatars */

:root {
  --avatar-size: 80px;
  --avatar-peek: 32px;
  --avatar-gap: 8px;
  --avatar-stroke: 6px;
}

.group-header-row {
    flex-direction:column;
    padding:48px;
}

.group-view-wrapper {
  padding: 20px;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}

/* Avatar Stack Container */
.avatar-stack {
  position: relative;
  width: calc(var(--avatar-size) + 4 * var(--avatar-peek));
  height: calc(var(--avatar-size) + var(--avatar-stroke) + var(--avatar-stroke));
  flex-shrink: 0;
    margin-top: -6px;
    margin-left: -6px;
    margin-bottom: -6px;
}

/* Stacked Avatar Base Styles */
.stacked-avatar {
  position: absolute;
  top: 0;
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--avatar-stroke) solid var(--color-bg);
  /*box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);*/
}

/* Position each avatar with z-index */
.stacked-avatar.pos-0 { 
  left: 0; 
  z-index: 5; 
}

.stacked-avatar.pos-1 { 
  left: var(--avatar-peek); 
  z-index: 4;
  /* Clip the left side to create the crescent effect */
  clip-path: inset(0 0 0 calc(var(--avatar-gap) + var(--avatar-stroke)));
}

.stacked-avatar.pos-2 { 
  left: calc(2 * var(--avatar-peek)); 
  z-index: 3;
  clip-path: inset(0 0 0 calc(var(--avatar-gap) + var(--avatar-stroke)));
}

.stacked-avatar.pos-3 { 
  left: calc(3 * var(--avatar-peek)); 
  z-index: 2;
  clip-path: inset(0 0 0 calc(var(--avatar-gap) + var(--avatar-stroke)));
}

.stacked-avatar.pos-4 { 
  left: calc(4 * var(--avatar-peek)); 
  z-index: 1;
  clip-path: inset(0 0 0 calc(var(--avatar-gap) + var(--avatar-stroke)));
}

/* Avatar Content Styles */
.stacked-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stacked-avatar.initials {
  color: #fff;
  font-weight: 600;
  font-size: 24px;
  text-transform: uppercase;
}

.stacked-avatar.sf-icon {
  width:80px;
    height:80px;
    font-size:36px;
    line-height:80px;
    border-radius:80px;
    color: var(--color-text-muted);
    background-color:var(--color-sidebar-border);
}

/* Group Title Section */
.group-title-section {
  flex: 1;
}

.group-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 5px 0;
  color: #333;
}

.group-count {
  color: #666;
  font-size: 16px;
  font-weight:normal;
}

/* Tabs Navigation */
.group-tabs {
  border-bottom: 1px solid #ddd;
  margin-bottom: 20px;
}

.group-tabs a {
  display: inline-block;
  padding: 12px 20px;
  text-decoration: none;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}

.group-tabs a:hover {
  color: #333;
}

.group-tabs a.active {
  color: #007bff;
  border-bottom-color: #007bff;
  font-weight: 500;
}

/* Tab Content */
.tab-content {
  padding: 20px 0;
}

/* Action List */
.action-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.action-list li {
  margin-bottom: 10px;
}

.action-list a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  text-decoration: none;
  color: #007bff;
  background: #f8f9fa;
  border-radius: 6px;
  transition: background 0.2s;
}

.action-list a:hover {
  background: #e9ecef;
}

.action-list a .sf-icon {
  font-size: 18px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  :root {
    --avatar-size: 60px;
    --avatar-peek: 24px;
  }
  
  .group-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .group-title {
    font-size: 24px;
  }
}






.layout16 > .main > * {
    padding-left:16px;
    padding-right:16px;
}


/* ============================================================================
   VIEW STYLE SWITCHER
   ============================================================================ */

.view-style-switcher {
    display: flex;
    width: fit-content;
    max-width: 600px;
    flex-direction: row;
    flex-wrap: wrap;       /* large registries (15+ styles × variants)
                              spill onto a second row instead of cropping
                              behind overflow:hidden when the host has a
                              max-width. Buttons keep their own rounded-
                              corner clipping via overflow:hidden so the
                              wrap reads as two pill rows, not one
                              squashed strip. */
    align-items: center;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--color-entry-hover);
    clear: both;
}

.view-style-btn {
    background: none;
    border: none;
    padding: 0 10px;
    height: 38px;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.view-style-btn:hover {
    background: var(--color-entry-hover-dark, rgba(0,0,0,0.07));
    color: var(--color-text-primary);
}
.view-style-btn.active {
    background: var(--color-accent, #007aff);
    color: #fff;
}

/* Tab toolbar: float to the right of the tabs nav */
.tab-toolbar {
    position: absolute;
    top: 0;
    right: 48px; /* match .tabs-container padding */
    display: flex;
    align-items: center;
    height: 37px; /* match tab-button height (padding 8+8 + font 16*1.3) */
    z-index: 1;
}


/* ============================================================================
   VIEW STYLE VARIANTS
   These classes are applied to .entries (list view) or .tab-body (detail tabs)
   ============================================================================ */

/* --- None — no extra styling, inherits default entry appearance --- */
/* (intentionally empty — this is the baseline/reset style) */

/* --- Simple (default) — existing card list, no change needed --- */

/* --- 2col — two-column grid --- */
.entries.view-style-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
}
.entries.view-style-2col > a {
    box-sizing: border-box;
}

/* --- Rows — compact single-line rows --- */
.entries.view-style-rows > a,
.tab-body.view-style-rows .data-table tr {
    /* placeholder: will be styled once the style is in use */
}

/* --- Grid --- */
.entries.view-style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 10px;
}
.entries.view-style-grid > a {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px;
    border-radius: 10px;
}

/* --- Table (list view rendered as a table rather than cards) --- */
.entries.view-style-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
}
.entries.view-style-table > a {
    display: table-row;
}
.entries.view-style-table > a > * {
    display: table-cell;
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border, #eee);
    vertical-align: middle;
}



:root {
    --g-blue:#4285F4;--g-red:#EA4335;--g-yellow:#FBBC05;--g-green:#34A853;
  }
  .dev.dropdown-menu {
    z-index:20;
    /*background-color:#000000;*/
  }
  button.sf-icon.dev::before, 
  .dev.dropdown-menu::before {
    z-index:10000;
    pointer-events:none;
    content:'';
    position:absolute;
    inset:0;
    border-radius:inherit;
    padding:2px;
    /*
    background:conic-gradient(
      from var(--angle, 0deg),
      #111 0%,
      #111 40%,
      var(--g-blue) 50%,
      var(--g-red) 62%,
      var(--g-yellow) 74%,
      var(--g-green) 86%,
      #111 100%
    );
    */
    background:conic-gradient(
        from var(--angle, 0deg),
        var(--color-bg) 0%,
        var(--color-bg) 10%,
        #1191f8 20%,
        #6a80fc 40%,
        #b05af8 50%,
        #d84bb5 60%,
        #f0437a 70%,
        #f45a1a 90%,
        var(--color-bg) 100%
    );
    -webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite:xor;
    mask-composite:exclude;
    animation: spin 5.4s linear, fadeout 8s ease 1.3s 1 forwards;
    opacity:1;
  }
  @property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
  }
  @keyframes spin {
    from { --angle: 0deg; }
    to   { --angle: 360deg; }
  }
  @keyframes fadeout {
    from { opacity: 1; }
    to   { opacity: 0; }
  }

  button.sf-icon.dev::before {
    border-radius:30px;
    padding:2px;
    inset:4px;
  }


/* ============================================================================
   SHELF MODE
   Toggle that hides tab nav buttons and shows every related-entity tab as a
   horizontal scrolling shelf — Apple App Store style.
   Activated by .with-shelves on .tabs-container.

   Card appearance is driven by the tab's existing view-style-* class so the
   per-shelf style switcher (shown in dev mode) works automatically.
   Table/row styles (none, ab-rows, ab-table) fall back to a generic 144×144 card.
   ============================================================================ */

/* (Old `.shelf-toggle-btn` rules removed — the standalone in-nav toggle
    button is gone; layout is now driven by the dev-popup style switcher
    against `.tabs-container[data-style-key]`, and the `with-tabs` /
    `with-shelves` classes flip between the two modes.) */

/* ── Nav in shelves layout: hide all tab buttons (no in-nav toggle now) ─ */
.tabs-container.with-shelves .tabs-nav .tab-button,
.tabs-container.with-shelves .tabs-nav-primary .tab-button {
    display: none !important;
}
.tabs-container.with-shelves .tabs-nav-secondary { display: none !important; }
.tabs-container.with-shelves .tabs-nav           { border-bottom: none; }
.tabs-container.with-shelves .tabs-nav-primary   { border-bottom: none; }

/* ── Pane visibility ───────────────────────────────────────────────────── */
/* Make .tabs-content a flex column so we can use `order` to push the
   details pane (DOM-first, for tab-mode's default-active state) to the
   end of the visual stack — after every related shelf. */
.tabs-container.with-shelves .tabs-content {
    display: flex;
    flex-direction: column;
}
.tabs-container.with-shelves .tab-pane                      { display: none; }
.tabs-container.with-shelves .tab-pane[data-tab^="related"] {
    display: block !important;
    /* Clear the default `overflow-x: auto` so the .rt's negative-margin
       extension (where the scroll arrows sit) isn't clipped. The actual
       horizontal scroll container is .rt-body, which keeps its own overflow. */
    overflow: visible;
}
/* Details pane: show LAST in shelf mode (after all related shelves). The
   `order: 1000` sentinel beats any related-shelf order (those default to
   their DOM order via 0). */
.tabs-container.with-shelves .tab-pane[data-tab="details"] {
    display: block !important;
    order: 1000;
    overflow: visible;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--color-divider, rgba(127,127,127,0.18));
}

/* tab-toolbar is moved into the shelf header — reset its absolute positioning */
.shelf-header .tab-toolbar {
    position: relative;
    height: auto;
    margin-left: auto;
}
.tabs-container.with-shelves .record-count  { display: none !important; }

/* ── Shelf section header ──────────────────────────────────────────────── */
/* Pre-rendered in PHP inside each related tab-pane; hidden in tab mode. */
.shelf-header { display: none; }
.tabs-container.with-shelves .shelf-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0 10px;
}

.shelf-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--color-text-primary);
}


/* ── Horizontal scroll: override rt-body layout for card/row styles ──────
   Excludes ab-table, which keeps its native table layout (headers + rows)
   inside shelf mode — use the tab-pane's native overflow-x to scroll it.     */

.tabs-container.with-shelves .tab-body:not(.ab-table) .rt      { display: block !important; padding: 0; position: relative; }
.tabs-container.with-shelves .tab-body:not(.ab-table) .rt-head { display: none !important; }

.tabs-container.with-shelves .tab-body:not(.ab-table) .rt-body {
    /* Grid with a configurable number of rows (default 1). Items flow down
       each column first, then into the next — Apple Music style — so that
       horizontally-scrolled multi-row shelves read top-to-bottom within the
       same visible "screenful". `--shelf-rows` is set by JS per shelf based
       on item count, items-per-row and each view style's `--shelf-rows-max`. */
    display: grid !important;
    grid-template-rows: repeat(var(--shelf-rows, 1), auto) !important;
    grid-auto-flow: column !important;
    /* Per-style column width. `min-content` wouldn't respect the entry's
       declared `width` (it uses the item's intrinsic min-content), which made
       cards "shrink when scrolled". --card-w is the canonical source of
       truth set on the base view-style rule (see view-styles-v2.css);
       --shelf-card-w is the legacy fallback for styles that haven't been
       migrated to --card-w yet (am-grid-s/m, profiles, am-portrait,
       am-square, atv-avatars). */
    grid-auto-columns: var(--card-w, var(--shelf-card-w, min-content)) !important;
    overflow-x: auto !important;
    /* `overflow-y: visible` would be silently promoted to `auto` because of
       the `overflow-x: auto` on the same element (per CSS spec). `clip` is
       a non-scrollable, non-promoting value — keeps horizontal scroll only,
       no spurious vertical scrollbar even if a row is a few pixels tall. */
    overflow-y: clip !important;
    gap: 14px !important;
    padding: 4px 0 24px !important;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* Edge fades: CSS vars updated by JS on scroll — start hidden, appear once scrollable */
    --shelf-fade-l: 0px;
    --shelf-fade-r: 0px;
    -webkit-mask-image: linear-gradient(to right,
        transparent 0px, black var(--shelf-fade-l),
        black calc(100% - var(--shelf-fade-r)), transparent 100%);
    mask-image: linear-gradient(to right,
        transparent 0px, black var(--shelf-fade-l),
        black calc(100% - var(--shelf-fade-r)), transparent 100%);
}

/* Per-view-style shelf params:
   --shelf-card-w  : fixed track width for the horizontal grid
   --shelf-rows-max: cap on number of rows before horizontal scroll kicks in */
.tabs-container.with-shelves .tab-body.am-grid-s {
    --shelf-card-w: 230px;
    --shelf-rows-max: 3;
}
.tabs-container.with-shelves .tab-body.am-grid-m {
    --shelf-card-w: 310px;
    --shelf-rows-max: 2;
}
.tabs-container.with-shelves .tab-body.am-portrait {
    --shelf-card-w: clamp(200px, 15.50vw, 276px);
    --shelf-rows-max: 1;
}
.tabs-container.with-shelves .tab-body.am-square {
    --shelf-card-w: clamp(144px, 15.5vw, 226px);
    --shelf-rows-max: 1;
}
.tabs-container.with-shelves .tab-body.profiles {
    --shelf-card-w: 230px;
    --shelf-rows-max: 2;
}
.tabs-container.with-shelves .tab-body.atv-landscape {
    /* Width comes from --card-w on the base style (302px, or 243px when
     * the .m modifier is set). Only the row cap stays here — that's a
     * shelf-mode concern, not a sizing one. */
    --shelf-rows-max: 1;
}
.tabs-container.with-shelves .tab-body.atv-portrait {
    --shelf-rows-max: 1;
}
.tabs-container.with-shelves .tab-body.atv-avatars {
    --shelf-card-w: 142px;
    --shelf-rows-max: 1;
}
.tabs-container.with-shelves .tab-body.ab-rows,
.tabs-container.with-shelves .tab-body.none {
    --shelf-card-w: clamp(220px, 28vw, 348px);
    --shelf-rows-max: 1;
}
.tabs-container.with-shelves .tab-body:not(.ab-table) .rt-body::-webkit-scrollbar { display: none; }

/* ab-table in shelf mode: keep native table layout (headers visible) */
.tabs-container.with-shelves .tab-body.ab-table .rt      { display: table !important; width: 100%; }
.tabs-container.with-shelves .tab-body.ab-table .rt-head { display: table-header-group !important; }
.tabs-container.with-shelves .tab-body.ab-table .rt-body { display: table-row-group !important; }
.tabs-container.with-shelves .tab-body.ab-table .rt-row,
.tabs-container.with-shelves .tab-body.ab-table .rt-row.entry { display: table-row !important; width: auto !important; }
.tabs-container.with-shelves .tab-body.ab-table .rt-td,
.tabs-container.with-shelves .tab-body.ab-table .rt-th   { display: table-cell !important; }
.tabs-container.with-shelves .tab-body.ab-table .shelf-scroll-btn { display: none !important; }

/* ── Shelf scroll arrow buttons ────────────────────────────────────────── */
/* Pre-rendered in PHP inside each .rt; hidden outside shelf mode.
   Rendered OUTSIDE the scrollable .rt-body — we add horizontal padding to
   .rt that reserves space for the arrows, and position them within that
   reserved strip. */
.shelf-scroll-btn { display: none; }
.tabs-container.with-shelves .shelf-scroll-btn { display: flex; }

/* .rt is widened with negative margins and given matching padding —
   the net effect is that .rt-body (its block child) stays at the original
   content width, aligned with the shelf title above, while .rt's padding
   strip extends 36 px beyond each side for the scroll-arrow buttons.
   width: auto is required to override the `.rt { width: 100% }` base rule —
   with box-sizing: border-box, width:100% would cap the box at the parent
   width and the 72 px of padding would eat into the content instead. */
.tabs-container.with-shelves .tab-body:not(.ab-table) .rt {
    width: auto !important;
    padding-left: 36px;
    padding-right: 36px;
    margin-left: -36px;
    margin-right: -36px;
    box-sizing: border-box;
}

.shelf-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 28px;
    height: 64px;
    border-radius: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: rgba(255, 255, 255, 0.85);
    overflow: hidden;
    opacity: 0;                /* hidden by default — reveal on shelf hover */
    pointer-events: none;
    transition: background-color .25s linear, opacity .25s linear;
}
/* Reveal arrows when the user hovers *this* shelf (its .rt wrapper) */
.tabs-container.with-shelves .rt:hover .shelf-scroll-btn {
    opacity: 1;
    pointer-events: auto;
}
.shelf-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}
.shelf-scroll-btn svg {
    width: 9px;
    height: 18px;
    fill: currentColor;
    display: block;
}
/* flip the same chevron SVG to point right for the "next" button */
.shelf-scroll-next svg { transform: scaleX(-1); }

.shelf-scroll-prev { left:  4px; }
.shelf-scroll-next { right: 4px; }
/* .shelf-hidden wins over the hover reveal (at scroll boundaries) */
.shelf-scroll-btn.shelf-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* All entries: never shrink below their natural/assigned width */
.tabs-container.with-shelves .tab-body .rt-row.entry {
    flex-shrink: 0 !important;
    scroll-snap-align: start;
}

/* ── Card styles: keep existing appearance, fix width for flex context ──── */

/* am-square: match grid column clamp + gap */
.tabs-container.with-shelves .tab-body.am-square .rt-body {
    gap: clamp(9px, 1.4vw, 20px) !important;
}
.tabs-container.with-shelves .tab-body.am-square .rt-row.entry {
    flex: 0 0 clamp(144px, 15.5vw, 226px) !important;
    width: clamp(144px, 15.5vw, 226px) !important;
}

/* am-portrait: match grid gap + column clamp */
.tabs-container.with-shelves .tab-body.am-portrait .rt-body {
    gap: clamp(10px, 1.5vw, 18px) !important;
}
.tabs-container.with-shelves .tab-body.am-portrait .rt-row.entry {
    flex: 0 0 clamp(200px, 15.50vw, 276px) !important;
    width: clamp(200px, 15.50vw, 276px) !important;
}

/* profiles: already width:230px via .profiles .entry */

/* am-grid-s: list-area cards are minmax(230px, 1fr) — pin to 230px in shelf mode.
   box-sizing: border-box because the entry has ~104px of horizontal padding
   (reserves space for the absolute image + menu button); otherwise the
   entry's actual box width would be 230 + 104 = 334 and neighbours overlap. */
.tabs-container.with-shelves .tab-body.am-grid-s .rt-body {
    column-gap: 16px !important;
    row-gap: 0 !important;    /* the per-entry border-top line acts as divider */
}
.tabs-container.with-shelves .tab-body.am-grid-s .rt-row.entry {
    flex: 0 0 230px !important;
    width: 230px !important;
    box-sizing: border-box !important;
}

/* am-grid-m: list-area cards are minmax(310px, 1fr) — pin to 310px. Unlike
   am-grid-s the cards have no divider border, so we need an explicit row
   gap too or stacked cards visually merge. */
.tabs-container.with-shelves .tab-body.am-grid-m .rt-body {
    column-gap: 20px !important;
    row-gap: 20px !important;
}
.tabs-container.with-shelves .tab-body.am-grid-m .rt-row.entry {
    flex: 0 0 310px !important;
    width: 310px !important;
    box-sizing: border-box !important;
}

/* atv-landscape: landscape 16:9 thumbnails.
 * min-width: 0 lets the explicit width win against the grid item's
 * automatic min-width: auto (= min-content). Without it, the entry's
 * inner display:grid + text content can inflate the box and paint
 * over the neighbor cards. */
.tabs-container.with-shelves .tab-body.atv-landscape .rt-body {
    gap: 16px !important;
}
.tabs-container.with-shelves .tab-body.atv-landscape .rt-row.entry {
    flex: 0 0 245px !important;
    width: 245px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* atv-portrait: 2:3 posters — same min-width fix. */
.tabs-container.with-shelves .tab-body.atv-portrait .rt-body {
    gap: 16px !important;
}
.tabs-container.with-shelves .tab-body.atv-portrait .rt-row.entry {
    flex: 0 0 160px !important;
    width: 160px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* atv-avatars: fixed 142×142 circles */
.tabs-container.with-shelves .tab-body.atv-avatars .rt-body {
    gap: 16px !important;
}
.tabs-container.with-shelves .tab-body.atv-avatars .rt-row.entry {
    flex: 0 0 142px !important;
    width: 142px !important;
}

/* ── Row / table styles in shelf: look identical to ab-rows elsewhere ───── */
/* Entries keep their natural row appearance; just capped width + am-square  */
/* gap so they sit side-by-side in the horizontal scroll container.          */

.tabs-container.with-shelves .tab-body.none .rt-body,
.tabs-container.with-shelves .tab-body.ab-rows .rt-body {
    gap: clamp(9px, 1.4vw, 20px) !important;
}

.tabs-container.with-shelves .tab-body.none .rt-row.entry,
.tabs-container.with-shelves .tab-body.ab-rows .rt-row.entry {
    display: flex !important;
    flex-direction: row !important;
    flex: 0 0 clamp(220px, 28vw, 348px) !important;
    width: clamp(220px, 28vw, 348px) !important;
    min-width: 0 !important;
    border-radius: 8px;
}

/* ========================================================================
   Embed mode — pages rendered into iframes (calendar popover/modal, SVV
   preview, etc.). Strip outer margins so the iframe content is flush, and
   pull the form-header up close to the top.
   ======================================================================== */
/* Make body the scroll container at full iframe height so position:sticky
   on .form-actions has a parent of known height to stick to. Without this
   the form collapses to content height and the sticky save bar lands in
   the wrong place (or off-screen if the form-actions negative margins
   carry it past the iframe edge). */
html:has(> body > .stage.embed-mode),
body:has(> .stage.embed-mode) {
    height: 100%;
    margin: 0;
}
.stage.embed-mode {
    min-height: 100vh;
    padding: 12px 16px;
    background: var(--color-bg);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
.stage.embed-mode > form.entity-form,
.stage.embed-mode > .main-content-container {
    flex: 1 1 auto;
    min-height: 0;
}
/* The base .main-content-container uses 48px horizontal padding which the
   sticky .form-actions cancels with -48px margin. In embed mode we keep
   that relationship — but we don't want the .stage's own 16px padding to
   double up, so let the inner container own it. */
.stage.embed-mode > .main-content-container {
    padding-left: 16px;
    padding-right: 16px;
}
.stage.embed-mode > .main-content-container > .form-actions {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
}
/* Cancel the giant <br><br><br><br> the entity form puts above the title */
.stage.embed-mode .detail-header {
    margin-top: 0 !important;
}
.stage.embed-mode br + br + br + br {
    display: none;
}
/* Hide the back-mobile arrow inside an iframe — there is no back to go to */
.stage.embed-mode .back-mobile {
    display: none !important;
}

