/* ============================================================================================
   esi-web-app-shell.css — shared styles for the ESI shell/sidebar and app UI pages.
   ============================================================================================ */
:root {
  --brand-indigo-deep:#311B92; --brand-purple-mid:#6750B4; --brand-electric-violet:#6038E8;
  --brand-blue-bright:#1A6CFF;
  --neutral-bg:#FCFAF9; --neutral-surface:#F9F6F4; --neutral-border-warm:#E7DCD5;
  --neutral-border:#E2E8F0; --neutral-muted:#F1F5F9;
  --surface:#FFFFFF; --row-hover:#F5EDE6;
  --text-primary:#1A1A2E; --text-secondary:#475569; --text-muted:#64748B; --text-faint:#94A3B8;
  --success:#10B981; --success-text:#166534; --warning:#F59E0B; --warning-text:#D97706;
  --error:#EF4444; --error-text:#DC2626;
  --font-title:'Founders Grotesk','Aptos',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --font-body:'Aptos',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --brand-gradient: linear-gradient(90deg, #6DD8FF 0%, #1A6CFF 30%, #6038E8 60%, #9440C1 80%, #C168FF 100%);
}

/* Dark mode: same tokens as the dark block in esi-web-app-pages.css. Toggled by data-theme="dark" on <html>,
   set from the Preferences page (/app/esi-web-app-theme.js). Brand colours, badges and callout tints stay as-is. */
:root[data-theme="dark"] {
  color-scheme:dark;
  --neutral-bg:#14161C; --neutral-surface:#1C1F27;
  --neutral-border-warm:var(--brand-purple-mid); --neutral-border:var(--brand-purple-mid); --neutral-muted:#242730;
  --text-primary:#EDEEF2; --text-secondary:#C3C6CE; --text-muted:#9297A3; --text-faint:#6B7078;
  --row-hover:#2A2E38; --surface:#1C1F27;
}

.badge { display:inline-block; font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:1px;
         padding:4px 10px; border-radius:20px; background:var(--neutral-muted); color:var(--text-secondary); }
.badge.snapshot { background:#FEF3C7; color:var(--warning-text); }
.badge.info { background:#CEF2FF; color:var(--brand-blue-bright); }

.callout { border-radius:8px; padding:10px 14px; margin:0; font-size:12.5px; border-left:4px solid var(--warning); background:#FEF3C7; color:var(--warning-text); }
.callout.error { border-left-color:var(--error); background:#FEE2E2; color:var(--error-text); }
.callout.success { border-left-color:var(--success); background:#D8F5EE; color:var(--success-text); }

table.cyncly { width:100%; border-collapse:collapse; font-size:13px; }
table.cyncly thead th { background:var(--brand-indigo-deep); color:white; font-weight:700; font-size:11px;
        text-transform:uppercase; letter-spacing:1px; text-align:left; padding:10px 12px; }
table.cyncly td { padding:9px 12px; border-bottom:1px solid var(--neutral-muted); }
table.cyncly tbody tr:hover { background:var(--row-hover); }
table.cyncly td.num { text-align:right; font-variant-numeric:tabular-nums; }

/* Shared toolbar buttons for app UI pages. */
.pill-btn { font-family:var(--font-body); font-size:11.5px; font-weight:700; color:var(--brand-electric-violet);
            background:none; border:1px solid var(--brand-electric-violet); border-radius:6px; padding:7px 14px;
            cursor:pointer; }
.pill-btn:hover { background:var(--brand-electric-violet); color:white; }
.pill-btn.primary { background:var(--brand-electric-violet); color:white; }
.pill-btn.primary:hover { background:var(--brand-indigo-deep); border-color:var(--brand-indigo-deep); }

html { background:var(--neutral-bg); }
.admin-body, .us-body { width:calc(100% - 40px); max-width:1400px; height:auto; min-height:calc(100% - 40px); margin:20px auto; padding:0; background:var(--surface); color:var(--text-primary); font-family:var(--font-body); border:1px solid var(--neutral-border-warm); border-radius:14px; box-shadow:0 1px 6px rgba(0,0,0,.03); }
.admin-body::before, .us-body::before { content:''; display:block; height:6px; background:var(--brand-gradient); border-radius:14px 14px 0 0; }
.admin-header, .us-header { display:flex; align-items:center; flex-wrap:wrap; gap:16px; margin:0; padding:32px 40px 18px; }
.admin-header h1, .us-header h1 { flex:1; min-width:0; margin:0; font:700 28px var(--font-title); overflow-wrap:anywhere; }
.admin-header .auth-bar, .us-header .auth-bar { margin:0; padding:0; border:0; }
.admin-iframe .admin-header .auth-bar, .us-iframe .us-header .auth-bar { display:none; }
.admin-back, .us-back { color:#ccc5e6; text-decoration:none; font-size:12.5px; font-weight:600; }
.admin-back:hover, .us-back:hover { color:#fff; }
.admin-main, .us-main { margin:0; padding:0 40px 48px; }
.admin-help, .us-help { font-size:12.5px; color:var(--text-secondary); background:var(--neutral-surface); border:1px solid var(--neutral-border-warm); border-radius:8px; padding:10px 14px; }
.admin-blob-info { display:flex; gap:12px; flex-wrap:wrap; margin:0 0 8px; }
.admin-blob-info input { padding:4px 8px; font-size:13px; font-family:var(--font-body); color:var(--text-faint); background:var(--neutral-surface); border:1px solid var(--neutral-border); border-radius:6px; cursor:default; }
.admin-toolbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; position:sticky; top:0; z-index:15; margin:0 0 8px; padding:12px 0; background:var(--neutral-bg); border-bottom:1px solid var(--neutral-border); }
.pill-btn:disabled { opacity:.5; cursor:not-allowed; }
@media (max-width:600px) {
  .admin-body, .us-body { width:calc(100% - 20px); margin:10px auto; }
  .admin-header, .us-header { padding:20px 16px 12px; }
  .admin-main, .us-main { padding:0 16px 40px; }
  .admin-header h1, .us-header h1 { font-size:24px; }
  .admin-tree .row { flex-wrap:wrap; }
  .admin-tree .row input, .admin-tree .row select { max-width:100%; }
}
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.admin-status, .us-status { font-size:12.5px; color:var(--text-secondary); }
.admin-status.callout, .us-status.callout { border-left:none; }
.admin-tree { display:flex; flex-direction:column; gap:8px; }
.row { display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--neutral-border); border-radius:8px; padding:8px 10px; }
.row.dragging { opacity:.4; }
.row-type-folder { flex-wrap:wrap; border-left:3px solid var(--brand-indigo-deep); background:var(--neutral-surface); }
.row-type-item { flex-wrap:wrap; border-left:3px solid var(--brand-electric-violet); }
.row-type-folder .badge { background:var(--brand-indigo-deep); color:#fff; }
.row-type-item .badge { background:var(--brand-electric-violet); color:#fff; }
.row-collapse { border:0; background:none; cursor:pointer; color:var(--text-secondary); font-size:20px; line-height:1; padding:4px 8px; min-width:32px; min-height:32px; }
.row-handle { cursor:grab; color:var(--text-faint); font-size:14px; padding:0 2px; }
.row input[type="text"], .row input[type="number"], .row select { border:1px solid #CBD5E1; border-radius:5px; padding:5px 8px; font-size:12.5px; font-family:inherit; }
.row .f-name { width:200px; }
.row .f-dir { width:190px; }
.row .f-groups { width:100%; box-sizing:border-box; display:flex; flex-wrap:wrap; align-items:center; gap:6px 16px; }
.row .f-select { width:170px; }
.row .f-blob { width:220px; }
.row-label { font-size:10.5px; color:var(--text-faint); display:block; margin-bottom:2px; }
.row-readonly { font-size:13px; color:var(--text-faint); padding:4px 0; display:inline-block; }
.row-field { display:flex; flex-direction:column; }
.row-field:has(.f-groups) { flex:1 1 100%; }
.row-actions { margin-left:auto; display:flex; gap:6px; align-items:center; }
.row-actions button { border:0; background:none; color:var(--text-faint); cursor:pointer; font-size:13px; padding:4px 6px; }
.folder-block { display:flex; flex-direction:column; gap:6px; }
.folder-items { display:flex; flex-direction:column; gap:6px; margin:4px 0 4px 26px; }
.folder-items-empty { font-size:12px; color:var(--text-faint); margin:2px 0 2px 26px; }
.folder-add-item { align-self:flex-start; margin:0 0 4px 26px; font-size:11.5px; color:var(--brand-electric-violet); background:none; border:0; cursor:pointer; font-weight:700; }
.folder-count { font-size:11.5px; color:var(--text-faint); font-weight:600; }
.banner-config-label { display:block; margin:12px 0 6px; font-size:12px; font-weight:700; color:var(--text-secondary); }
.config-json { display:block; width:100%; min-height:60vh; resize:vertical; padding:12px; border:1px solid var(--neutral-border); border-radius:6px; background:#fff; color:var(--text-primary); font:12.5px/1.5 Consolas,'Courier New',monospace; tab-size:2; }
.config-json:focus-visible { outline:2px solid var(--brand-blue-bright); outline-offset:2px; }
.us-help { margin:0 0 16px; }
.us-status { margin-top:10px; }

/* Shell layout and sidebar navigation. */
* { box-sizing: border-box; }
html, body { margin:0; height:100%; font-family:var(--font-body); }
.shell { display:flex; flex-direction:column; height:100vh; }
.shell-body { display:flex; flex:1; min-height:0; }
.sidebar { width:350px; flex:0 0 350px; background:var(--neutral-surface); color:var(--text-primary); display:flex; flex-direction:column; padding:0; overflow-y:auto; }
.sidebar-brand { display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; font-family:var(--font-title); font-size:15px; font-weight:700; padding:20px 18px; background:var(--neutral-bg); color:var(--text-primary); border-bottom:3px solid var(--brand-electric-violet); margin-bottom:10px; }
.sidebar-logo { width:150px; height:auto; }
.sidebar-logo-dark { display:none; }
:root[data-theme="dark"] .sidebar-logo-light { display:none; }
:root[data-theme="dark"] .sidebar-logo-dark { display:inline; }
.sidebar-version, .signin-version { display:inline-flex; align-items:center; justify-content:center; gap:4px; line-height:1; }
.sidebar-version { margin-top:-6px; font-family:var(--font-body); font-size:12px; font-weight:400; color:var(--text-muted); }
.v1-link { margin:-4px 0 0; font-family:var(--font-body); font-size:12px; font-weight:400; line-height:1.3; color:var(--text-muted); }
.signin-v1-link { margin-top:12px; }
.v1-link a { color:var(--brand-electric-violet); font-weight:700; text-decoration:none; }
.v1-link a:hover { text-decoration:underline; }
.version-info { position:relative; display:inline-flex; align-items:center; color:var(--text-muted); cursor:help; }
.version-info svg { display:block; width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.version-info:focus-visible { outline:2px solid var(--brand-blue-bright); outline-offset:2px; border-radius:50%; }
.version-tip { display:none; position:absolute; top:calc(100% + 8px); left:50%; transform:translateX(-50%); z-index:5; padding:8px 12px; border-radius:8px; background:var(--text-primary); color:var(--surface); font-size:12px; line-height:1.5; text-align:left; white-space:nowrap; }
.version-info:hover .version-tip, .version-info:focus .version-tip { display:block; }
.env-badge { margin-top:-4px; font-size:10.5px; font-weight:700; letter-spacing:1.5px; color:#fff; background:var(--error); padding:2px 10px; border-radius:10px; }
.auth-bar { padding:14px 18px; font-size:13.5px; color:var(--text-muted); display:flex; align-items:center; gap:8px; flex-wrap:wrap; border-top:1px solid var(--neutral-border); margin-top:auto; }
.auth-bar a { color:#6038e8; font-weight:700; text-decoration:none; }
.auth-bar a:hover { text-decoration:underline; }
.nav-search-wrapper { display:flex; align-items:center; gap:6px; padding:8px 8px; margin:0 4px; background:var(--surface); border:1px solid var(--neutral-border); border-radius:6px; }
.nav-search-input { flex:1; border:none; padding:6px 8px; font-size:13px; font-family:var(--font-body); color:var(--text-primary); outline:none; background:transparent; }
.nav-search-input::placeholder { color:var(--text-faint); }
.nav-search-clear { border:none; background:none; color:var(--text-faint); cursor:pointer; font-size:14px; padding:2px 4px; line-height:1; }
.nav-search-clear:hover { color:var(--text-secondary); }
.nav-tree { flex:1; padding:4px 8px; overflow-y:auto; }
.nav-link.nav-home-link { margin:0 12px 8px; }
.nav-link.nav-release-link { display:flex; align-items:center; column-gap:20px; margin:0 12px 8px; }
.nav-loading, .nav-error { padding:10px; font-size:12px; color:#8A8A8A; }
.nav-folder { margin:6px 0; }
.nav-folder-title { display:flex; align-items:center; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:#6038e8; padding:8px 10px 4px; }
.nav-folder > .nav-link { margin-left:22px; }
.nav-folder-toggle { border:none; background:none; color:#6038e8; cursor:pointer; padding:0 4px 0 0; font-size:12px; line-height:1; display:flex; align-items:center; }
.nav-folder-toggle::before { content:'▼'; font-size:8px; }
.nav-folder.collapsed .nav-folder-toggle::before { content:'▶'; }
.nav-folder.collapsed > .nav-link, .nav-folder.collapsed > .nav-folder { display:none; }
.nav-utility-folder { margin:4px 0 0; }
.nav-utility-folder > .nav-folder-title { gap:0; }
.nav-utility-folder.collapsed > .nav-utility-items { display:none; }
.nav-utility-items { margin-left:22px; }
.nav-folder-nested { margin:0 0 0 10px; border-left:1px solid var(--neutral-border); padding-left:4px; }
.nav-folder-nested .nav-folder-title { text-transform:none; letter-spacing:0; font-size:11.5px; color:#6038e8; }
.nav-link { display:block; padding:8px 10px; border-radius:6px; font-size:13.5px; color:var(--text-primary); text-decoration:none; margin:1px 4px; }
.nav-link:hover { background:rgba(96,56,232,0.08); }
.nav-link.active { background:var(--brand-electric-violet); color:#fff; font-weight:600; }
.nav-release-badge { display:inline-flex; flex:0 0 auto; min-width:16px; height:16px; align-items:center; justify-content:center; margin-left:auto; padding:0 5px; border-radius:8px; background:#f08754; color:#28174b; font-size:10px; font-weight:700; line-height:1; }
.nav-release-badge[hidden] { display:none; }
.nav-utility { margin:10px 8px 0; padding:10px 0 4px; border-top:1px solid var(--neutral-border); }
.nav-utility-separator { border-top:1px solid var(--neutral-border); margin:8px 0 6px; }
.search-hidden { display:none; }
.search-highlight { background:rgba(255,235,59,0.3); border-radius:4px; }
.nav-icon-link { display:flex; align-items:center; gap:8px; }
.nav-icon { width:16px; height:16px; flex:0 0 16px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.nav-icon-filled { fill:currentColor; stroke:none; }
.content { flex:1; display:flex; }
#content-frame { flex:1; border:0; width:100%; height:100%; background:var(--surface); }
