/* console: customize mode (Nov 5)
   Layout → Customize turns the console into editable blocks: every section gets a thin ice rim and a soft glow,
   a grip on its header and small glass chips (place, copy, hide); docks show as dashed drop targets; splitters glow.
   Section contents sit under a frosted veil and do not answer (js/console.js blocks them too); the page is the only
   scroller, with an "add panel" slot under the grid and a hint pinned to the bottom of the screen. */
.cx.cz {
  --cz-rim: rgba(214,232,252,.42); --cz-rim2: rgba(226,240,255,.78); --cz-glow: rgba(150,196,245,.20);
  --cz-dash: rgba(201,220,242,.34); --cz-chip: rgba(255,255,255,.06); --cz-chip2: rgba(255,255,255,.12); --cz-chipb: rgba(214,232,252,.20);
  --cz-veil: rgba(10,14,20,.30); --cz-t: .2s cubic-bezier(.2,.7,.3,1);
}

/* ---------- the page grows: one screen of grid, then the add-panel slot (page scrolls, see js wheel handler) ---------- */
@media (min-width: 1101px) {
  .cx.cz { height: auto; min-height: calc(100dvh - var(--cx-stb, 26px)); grid-template-rows: auto calc(100dvh - var(--cx-stb, 26px) - 76px); grid-auto-rows: auto; padding-bottom: 84px; }
  body.cx-mode.cx-tall .app.side .main:has(.cx.cz) { height: auto; min-height: 100dvh; overflow: visible; }
  html:has(.cx.cz) { overflow: auto; scrollbar-gutter: stable; }
}
/* inner zones never scroll while customizing */
.cx.cz :is(.cx-pane, .cx-rail, .cx-xpick, .cx-db, .cx-cb, .tbl-wrap, .cx-tape, [data-wcon], [data-hold]) { overflow: hidden !important; overscroll-behavior: none; }

/* ---------- sections: ice rim + glow ---------- */
.cx.cz :is(.cx-dock, .cx-rs) { box-shadow: var(--cx-edge), inset 0 0 0 1px var(--cz-rim), 0 0 0 1px rgba(214,232,252,.06), 0 0 22px -6px var(--cz-glow), var(--fz-sh, 0 18px 40px -26px rgba(0,0,0,.7)) !important; transition: box-shadow var(--cz-t), opacity var(--cz-t), filter var(--cz-t); }
.cx.cz :is(.cx-dock, .cx-rs):hover { box-shadow: var(--cx-edge), inset 0 0 0 1px var(--cz-rim2), 0 0 0 1px rgba(214,232,252,.10), 0 0 28px -4px var(--cz-glow), var(--fz-sh, 0 18px 40px -26px rgba(0,0,0,.7)) !important; }
/* frosted veil over what a section shows: it reads as a block, and does not answer */
.cx.cz .cx-pane { position: relative; pointer-events: none; user-select: none; }
.cx.cz .cx-pane > * { opacity: .5; filter: saturate(.55) blur(.6px); transition: opacity var(--cz-t), filter var(--cz-t); }
.cx.cz .cx-pane::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; border-radius: 0 0 var(--cx-r) var(--cx-r);
  background: linear-gradient(180deg, rgba(214,232,252,.035), transparent 40%), var(--cz-veil); }
.cx.cz :is(.cx-dock, .cx-rs):hover .cx-pane > * { opacity: .62; }
/* the strip, sidebar and status bar step back */
.cx.cz .cx-strip { pointer-events: none; user-select: none; opacity: .55; filter: saturate(.6); transition: opacity var(--cz-t); }
body:has(.cx.cz) .app.side > .sb, body:has(.cx.cz) .status { pointer-events: none; user-select: none; opacity: .5; filter: saturate(.6); transition: opacity var(--cz-t); }

/* ---------- grips and headers ---------- */
.cx.cz .grip { opacity: .75; width: 8px; color: var(--cx-ice); }
.cx.cz [data-cx-drag]:hover .grip { opacity: 1; }
.cx.cz .cx-eh { cursor: grab; background: linear-gradient(180deg, rgba(214,232,252,.06), transparent); }
.cx.cz .cx-eh:active, .cx.cz [data-cx-tab][draggable="true"]:active { cursor: grabbing; }
.cx.cz .cx-tabbar [data-cx-tab] { cursor: grab; }
.cx.cz .cx-tabbar [data-cx-tab] > .grip { margin-right: 2px; }

/* ---------- docks that take a section: dashed drop targets ---------- */
.cx.cz .cx-tabbar { box-shadow: inset 0 0 0 1px transparent; outline: 1px dashed var(--cz-dash); outline-offset: -4px; border-radius: 10px 10px 0 0; transition: outline-color var(--cz-t), background-color var(--cz-t); }
.cx.cz .cx-rail { outline: 1px dashed var(--cz-dash); outline-offset: 3px; transition: outline-color var(--cz-t); }
.cx.cz [data-cx-dock].is-empty, .cx.cz .cx-rail.is-empty > .cx-z { outline: 1px dashed var(--cz-rim); outline-offset: -5px; }
.cx.cz .dock-empty { opacity: .9; }

/* ---------- quick-option chips (place picker, copy, hide) ---------- */
.cz-chips { display: inline-flex; align-items: center; gap: 4px; flex: none; margin-left: 4px; }
.cz-chip { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 0; border-radius: 999px; flex: none;
  background: var(--cz-chip); box-shadow: inset 0 0 0 1px var(--cz-chipb), inset 0 1px 0 rgba(255,255,255,.06); color: var(--tx2); font: 500 11px var(--f); cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: background var(--cz-t), color var(--cz-t), box-shadow var(--cz-t); }
.cz-chip:hover, .cz-chip:focus-within { background: var(--cz-chip2); color: var(--tx); box-shadow: inset 0 0 0 1px var(--cz-rim2), 0 0 12px -4px var(--cz-glow); }
.cz-chip .i { width: 11px; height: 11px; color: var(--cx-ice); }
.cz-place select { appearance: none; -webkit-appearance: none; max-width: 112px; height: 22px; padding: 0 14px 0 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; outline: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-size: 4px 4px; background-position: right 4px center, right 0 center; background-repeat: no-repeat; text-overflow: ellipsis; }
.cz-place select option { background: #141922; color: #e8eef6; }
.cx.cz .cx-hx { width: 22px; height: 22px; border-radius: 999px; background: var(--cz-chip); box-shadow: inset 0 0 0 1px var(--cz-chipb); color: var(--tx2); transition: background var(--cz-t), color var(--cz-t), box-shadow var(--cz-t); }
.cx.cz .cx-hx:hover, .cx.cz .cx-hx:focus-visible { background: rgba(255,120,120,.14); color: var(--tx); box-shadow: inset 0 0 0 1px rgba(255,150,150,.35); }
.cx.cz .cx-tabbar .cx-hx { width: 16px; height: 16px; box-shadow: none; background: none; }
.cx.cz .cx-mv { border-radius: 999px; background: var(--cz-chip); box-shadow: inset 0 0 0 1px var(--cz-chipb); }
.cx.cz :is(.cz-chip, .cx-hx, .cx-mv, [data-cx-tab], .cz-hb, .cz-addb, [data-cx-split]):focus-visible { outline: none; box-shadow: 0 0 0 2px var(--cz-rim2), 0 0 14px -2px var(--cz-glow) !important; }

/* ---------- splitters glow, with a hint on hover ---------- */
.cx.cz .cx-split::after { background: rgba(214,232,252,.32); box-shadow: 0 0 10px rgba(150,196,245,.35); transition: background var(--cz-t), box-shadow var(--cz-t); }
.cx.cz .cx-split.v::after { top: 22%; bottom: 22%; left: 3px; width: 2px; }
.cx.cz .cx-split.h::after { left: 30%; right: 30%; top: 3px; height: 2px; }
.cx.cz .cx-split:hover::after, .cx.cz .cx-split.on::after, .cx.cz .cx-split:focus-visible::after { background: var(--cz-rim2); box-shadow: 0 0 14px 1px rgba(150,196,245,.55); }
.cx.cz .cx-split::before { content: "Drag to resize · double-click resets"; position: absolute; z-index: 30; left: 50%; top: 50%; translate: -50% -50%; padding: 4px 9px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  font: 500 11px var(--f); color: var(--tx); background: rgba(20,26,36,.82); box-shadow: inset 0 0 0 1px var(--cz-chipb), 0 8px 20px -10px rgba(0,0,0,.7); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transition: opacity var(--cz-t); }
.cx.cz .cx-split.v::before { writing-mode: horizontal-tb; }
.cx.cz .cx-split:hover::before, .cx.cz .cx-split:focus-visible::before { opacity: 1; }
body.cx-drag .cx.cz .cx-split::before { opacity: 0; }

/* ---------- while dragging: valid docks light up, the rest dims ---------- */
body.dock-dragging .cx.cz [data-cx-dock] { outline: 1px dashed var(--cz-rim); outline-offset: -3px; transition: outline-color var(--cz-t), background-color var(--cz-t), box-shadow var(--cz-t); }
body.dock-dragging .cx.cz [data-cx-dock].drop-on { outline: 1px solid var(--cz-rim2); background-color: rgba(150,196,245,.07);
  box-shadow: var(--cx-edge), inset 0 0 0 1px var(--cz-rim2), 0 0 0 3px rgba(150,196,245,.14), 0 0 34px -2px rgba(150,196,245,.38) !important; }
body.dock-dragging .cx.cz [data-cx-dock].drop-on::after { content: "Drop here"; position: absolute; z-index: 40; left: 50%; top: 50%; translate: -50% -50%; padding: 5px 12px; border-radius: 999px; pointer-events: none;
  font: 600 11.5px var(--f); letter-spacing: .02em; color: var(--tx); background: rgba(20,28,40,.86); box-shadow: inset 0 0 0 1px var(--cz-rim2), 0 0 18px -2px rgba(150,196,245,.45); }
.cx.cz .cx-rail[data-cx-dock] { position: relative; }
body.dock-dragging .cx.cz :is(.cx-strip, .cz-bar, .cx-split) { opacity: .35; filter: saturate(.4); }
body.dock-dragging .cx.cz [data-cx-dock]:not(.drop-on) .cx-pane > * { opacity: .32; }
body.dock-dragging .cx.cz .cx-rail.drop-on > .cx-rs { opacity: .9; }
.cx.cz .dragging { opacity: .3; filter: saturate(.4); }
/* insertion line */
.cx.cz .dock-mark { display: block; flex: none; align-self: stretch; width: 2px; margin: 4px 2px; border-radius: 2px; background: var(--cz-rim2); box-shadow: 0 0 10px 1px rgba(150,196,245,.6); }
.cx.cz .dock-mark.h { width: auto; height: 2px; margin: 0 12px; }
.cz-addz > .dock-mark { display: none; }

/* ---------- add-panel slot under the grid ---------- */
.cz-addz { position: relative; display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 120px; padding: 18px; border-radius: var(--cx-r);
  outline: 1px dashed var(--cz-rim); outline-offset: -1px; background: linear-gradient(180deg, rgba(214,232,252,.04), rgba(214,232,252,.01)); color: var(--tx2); font-size: 12.5px; transition: background var(--cz-t), outline-color var(--cz-t); }
.cz-addz:hover { outline-color: var(--cz-rim2); background: rgba(214,232,252,.06); }
.cz-addb { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer; color: var(--tx); font: 600 13px var(--f);
  background: var(--cz-chip2); box-shadow: inset 0 0 0 1px var(--cz-rim), 0 0 18px -6px var(--cz-glow); transition: background var(--cz-t), box-shadow var(--cz-t); }
.cz-addb:hover { background: rgba(214,232,252,.18); box-shadow: inset 0 0 0 1px var(--cz-rim2), 0 0 22px -4px var(--cz-glow); }
.cz-addb b { font-weight: 600; }
.cx.cz .cx-xg > .cx-dock.is-empty { outline: 1px dashed var(--cz-rim); outline-offset: -5px; }

/* ---------- hint pinned to the bottom ---------- */
.cz-hint { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--cx-stb, 26px) + 14px); translate: -50% 0; display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px;
  background: rgba(18,24,33,.72); box-shadow: inset 0 0 0 1px var(--cz-chipb), inset 0 1px 0 rgba(255,255,255,.08), 0 0 24px -8px var(--cz-glow), 0 18px 40px -18px rgba(0,0,0,.8);
  -webkit-backdrop-filter: blur(22px) saturate(1.2); backdrop-filter: blur(22px) saturate(1.2); font-size: 12px; animation: cz-in .22s cubic-bezier(.2,.7,.3,1) both; }
.cz-hb { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--tx2); font: 500 12px var(--f); cursor: pointer; transition: background var(--cz-t), color var(--cz-t); }
.cz-hb:hover { background: var(--cz-chip2); color: var(--tx); }
.cz-hb .i { width: 12px; height: 12px; }
.cz-dot { color: var(--tx3); font-style: normal; }
.cz-ar { display: inline-block; font-style: normal; color: var(--cx-ice); animation: cz-bob 1.6s ease-in-out infinite; }
.cz-done { margin-left: 4px; color: var(--ac-tx, #0b1220); background: var(--cx-ice); font-weight: 600; }
.cz-done:hover { background: #fff; color: #0b1220; }
@keyframes cz-bob { 0%, 100% { transform: translateY(-1px); } 50% { transform: translateY(3px); } }
@keyframes cz-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 1100px) { .cz-hint { bottom: 12px; } }
@media (prefers-reduced-motion: reduce) {
  .cz-ar, .cz-hint { animation: none; }
  .cx.cz *, .cx.cz *::before, .cx.cz *::after, .cz-hint * { transition: none !important; }
}

/* ---------- light theme ---------- */
html:root[data-theme="light"] .cx.cz {
  --cz-rim: rgba(47,111,181,.36); --cz-rim2: rgba(47,111,181,.7); --cz-glow: rgba(47,111,181,.16);
  --cz-dash: rgba(47,111,181,.32); --cz-chip: rgba(255,255,255,.55); --cz-chip2: rgba(255,255,255,.85); --cz-chipb: rgba(47,111,181,.22);
  --cz-veil: rgba(236,242,250,.38);
}
html:root[data-theme="light"] .cx.cz .grip { color: var(--ac); }
html:root[data-theme="light"] .cx.cz .cx-eh { background: linear-gradient(180deg, rgba(47,111,181,.05), transparent); }
html:root[data-theme="light"] .cx.cz .cx-split::after { background: rgba(47,111,181,.35); box-shadow: 0 0 10px rgba(47,111,181,.25); }
html:root[data-theme="light"] .cx.cz .cx-split:hover::after, html:root[data-theme="light"] .cx.cz .cx-split.on::after { box-shadow: 0 0 14px 1px rgba(47,111,181,.4); }
html:root[data-theme="light"] .cx.cz .cx-split::before,
html:root[data-theme="light"] body.dock-dragging .cx.cz [data-cx-dock].drop-on::after { background: rgba(255,255,255,.92); color: var(--tx); }
html:root[data-theme="light"] body.dock-dragging .cx.cz [data-cx-dock].drop-on { background-color: rgba(47,111,181,.06); box-shadow: var(--cx-edge), inset 0 0 0 1px var(--cz-rim2), 0 0 0 3px rgba(47,111,181,.12), 0 0 30px -4px rgba(47,111,181,.3) !important; }
html:root[data-theme="light"] .cx.cz .dock-mark { box-shadow: 0 0 10px 1px rgba(47,111,181,.45); }
html:root[data-theme="light"] .cz-place select option { background: #fff; color: #0f1724; }
html:root[data-theme="light"] .cz-hint { background: rgba(255,255,255,.78); box-shadow: inset 0 0 0 1px var(--cz-chipb), 0 0 24px -8px rgba(47,111,181,.25), 0 18px 40px -20px rgba(20,40,70,.35); }
html:root[data-theme="light"] .cz-done { background: var(--ac); color: #fff; }
html:root[data-theme="light"] .cz-done:hover { background: var(--ac-ice); color: #fff; }
html:root[data-theme="light"] .cz-addz { background: linear-gradient(180deg, rgba(47,111,181,.05), rgba(47,111,181,.01)); }
html:root[data-theme="light"] .cz-addb:hover { background: #fff; }
html:root[data-theme="light"] .cx.cz .cx-hx:hover { background: rgba(200,60,60,.1); box-shadow: inset 0 0 0 1px rgba(200,60,60,.3); }

/* ---------- compact chips where room is short: rail headers show the place chip as an icon, copy is icon-only, tabs drop their icon ---------- */
.cx.cz .cx-rs .cz-place { width: 30px; padding: 0; justify-content: center; }
.cx.cz .cx-rs .cz-place::after { content: ""; width: 0; height: 0; margin-left: 1px; border: 3px solid transparent; border-top-color: currentColor; translate: 0 2px; }
.cx.cz .cx-rs .cz-place select { position: absolute; inset: 0; width: 100%; max-width: none; opacity: 0; }
.cx.cz .cx-rs .cx-eh { gap: 5px; padding: 0 8px 0 10px; }
.cx.cz .cx-rs .cx-eh > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx.cz .cz-chip[data-cx-dup] { width: 24px; padding: 0; justify-content: center; }
.cx.cz .cz-chip[data-cx-dup] > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cx.cz .cx-tabbar [data-cx-tab] > svg.i { display: none; }
.cx.cz .cx-tabbar .cz-place select { max-width: 96px; }
