/*
 * CashBot interaction layer (loaded after theme.css): states and motion for every control, tables, windows, cards,
 * the player dock and the overlay catalog. Motion is short and soft; everything respects prefers-reduced-motion.
 */
:root { --ease: cubic-bezier(.2, .7, .2, 1); --t-fast: 120ms; --t: 180ms; --hover: #1d232d; --press: #232a35; --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* ---------- base interaction states ---------- */
a, button, .btn, .chip, .tab, .nav-item, .nav-sub, .toggle .track, .toggle .thumb, .input, .dt-row, .ov-card, .member-row, .layer, .add-item {
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.input:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); }
.btn:hover:not(:disabled) { background: var(--hover); border-color: #39424f; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); background: var(--press); }
.btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); filter: brightness(1.1); }
.btn.primary:active:not(:disabled) { background: var(--accent); filter: brightness(.9); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.is-busy { cursor: progress; }
.btn.xs { height: 22px; padding: 0 7px; font-size: 12px; border-radius: 5px; }
.btn.danger:hover:not(:disabled) { background: #ff6e7e; }
.linklike { background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; font: inherit; text-align: start; }
.linklike:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 1px; }
.nav-item:active, .nav-sub:active { transform: scale(.985); }
.tab { position: relative; }
.tab::after { content: ''; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform var(--t) var(--ease); }
.tab.active::after { transform: scaleX(1); }
.tab.active { border-bottom-color: transparent; }
.chip:hover:not(.active) { border-color: #3a4352; color: var(--text); }
.chip:active { transform: scale(.97); }
.toggle:hover .track { background: #3a4352; }
.toggle:hover input:checked + .track { background: var(--accent); filter: brightness(1.1); }
.toggle.disabled .track { cursor: not-allowed; }
.input.sm, select.input.sm { height: 30px; font-size: 13px; padding: 0 8px; }
.input.narrow { max-width: 90px; }
.input:hover:not(:focus):not(:disabled) { border-color: #3a4352; }
.input:disabled { opacity: .55; cursor: not-allowed; }

/* page + content entrance */
.view { animation: view-in var(--t) var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }
.toast { animation: toast-in var(--t) var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.toast.out { opacity: 0; transform: translateY(4px); transition: opacity 220ms, transform 220ms; }

/* ---------- loading ---------- */
.spinner { display: inline-block; flex: none; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; opacity: .8; animation: spin .7s linear infinite; vertical-align: -3px; }
.view-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 240px; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- windows ---------- */
.modal-back { background: rgba(3, 5, 9, .62); opacity: 0; transition: opacity var(--t) var(--ease); padding: 16px; align-items: center; }
.modal-back.in { opacity: 1; }
.modal { padding: 0; gap: 0; width: min(460px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; transform: translateY(6px) scale(.985); transition: transform var(--t) var(--ease); }
.modal-back.in .modal { transform: none; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.confirm-text { white-space: pre-line; line-height: 1.55; }

/* ---------- data tables ---------- */
.card.flush > .card-body { padding: 0; }
.dt { display: flex; flex-direction: column; }
.dt-row { display: grid; gap: 12px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--border); min-width: 0; }
.dt-row:last-child { border-bottom: 0; }
.dt-row:not(.dt-head):hover { background: var(--row-hover); }
.dt-head { color: var(--faint); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: var(--bg-2); padding-block: 7px; }
.dt-row.is-off > :not(:last-child):not(:nth-last-child(2)) { opacity: .5; }
.dt-row > * { min-width: 0; }
.cmd-cols { grid-template-columns: minmax(120px, 1.1fr) minmax(0, 2.2fr) 150px 90px 56px 52px 72px; }
.bi-cols { grid-template-columns: minmax(120px, 1fr) minmax(0, 2.4fr) 170px 82px 56px 52px; }
.lb-cols { grid-template-columns: 34px minmax(0, 1fr) 56px 70px 80px 80px; }
.shop-cols { grid-template-columns: 30px minmax(0, 1.2fr) 90px 90px minmax(0, 1.5fr) 52px 36px; }
.counter-cols { grid-template-columns: minmax(0, 1fr) auto auto; }
.vars-cols { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr); padding-inline: 0; }
.cell-name, .cell-resp { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cell-resp > span:first-child { color: #cfd5df; }
.alias-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.alias-chips code { font-size: 11px; padding: 0 5px; color: var(--muted); }
.alias-chips code.own { color: var(--accent); border-color: var(--accent); }
code.usage { font-size: 11.5px; color: var(--muted); background: var(--bg-2); align-self: flex-start; white-space: normal; word-break: break-word; }
.num { font-variant-numeric: tabular-nums; text-align: end; }
.rank { color: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.dt-row.top .rank { color: var(--warn); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.counter-v { min-width: 3ch; text-align: center; font-size: 15px; }
.dt-row select.input { width: 100%; }
.bi-cols select.input + select.input { margin-top: 4px; }

/* command editor */
.var-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: -6px; }
.chip.var { height: 24px; padding: 0 8px; font-family: var(--mono); font-size: 11.5px; direction: ltr; }
.chip.var:hover { border-color: var(--accent); color: var(--accent); }
.preview-wrap { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; border: 1px dashed var(--border-2); border-radius: var(--r-sm); background: var(--bg-2); }
.preview-bubble { padding: 7px 10px; border-radius: 8px; background: var(--surface-2); word-break: break-word; white-space: pre-wrap; }
.vars-help > summary { list-style: none; cursor: pointer; }
.vars-help > summary::-webkit-details-marker { display: none; }

/* settings rows (label left, control right) */
.set-rows { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-row .toggle-text { display: none; }

/* empty states */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 34px 18px; color: var(--muted); }
.empty-state .icon { color: var(--faint); }
.empty-state strong { color: var(--text); }
.empty-state p { max-width: 46ch; }

/* simple numbered lists (queues, quotes) */
.q-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; }
.q-list li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.q-list li:last-child { border-bottom: 0; }
.q-list .rank { min-width: 2.2em; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip-item { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border: 1px solid var(--border-2); border-radius: 6px; font-size: 12.5px; }
.cmd-help { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cmd-help li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: baseline; }
.cmd-help li:last-child { border-bottom: 0; }

/* ---------- songs ---------- */
.now { display: flex; gap: 12px; align-items: center; }
.now img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; flex: none; background: var(--bg-2); }
.now-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.now-text strong { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.song-q { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; }
.song-q li { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--border); }
.song-q li:last-child { border-bottom: 0; }
.q-num { color: var(--faint); min-width: 1.6em; font-variant-numeric: tabular-nums; }
.add-song { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.range-wrap.vol { gap: 8px; }
.range-wrap.vol .icon { color: var(--muted); }
.range-wrap.vol output { min-width: 42px; }
.range-wrap.vol.compact { width: 150px; }
.range { cursor: pointer; }
/* player dock: fixed, outside the page content, so it survives navigation */
.player-dock { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 60; width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: toast-in var(--t) var(--ease); }
.pd-video { aspect-ratio: 16 / 9; background: #000; display: none; }
.player-dock.expanded .pd-video { display: block; }
/* the YouTube iframe must stay in the page (hidden players are paused by some browsers), so collapsed = tiny, not removed */
.player-dock:not(.expanded) .pd-video { display: block; height: 1px; aspect-ratio: auto; opacity: 0; pointer-events: none; }
.pd-video iframe, .pd-video > div { width: 100%; height: 100%; display: block; }
.pd-bar { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 12px; }
.pd-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pd-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-text small { font-size: 11.5px; }
.pd-eq { display: inline-flex; gap: 2px; align-items: flex-end; width: 14px; height: 14px; flex: none; margin-inline-end: 4px; }
.pd-eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 1s ease-in-out infinite; }
.pd-eq i:nth-child(2) { animation-delay: -.3s; } .pd-eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
body:has(.player-dock:not([hidden])) .as-root { bottom: 96px; }   /* keep the assistant button above the player */

/* ---------- overlay catalog cards ---------- */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ov-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; min-width: 0; cursor: pointer; }
.ov-card:hover { border-color: #39424f; transform: translateY(-1px); }
.ov-card.off .ov-thumb { filter: grayscale(.9); opacity: .55; }
.ov-card.needs { border-color: rgba(242, 178, 62, .35); }
.ov-thumb-btn { position: relative; display: block; border: 0; padding: 0; background: none; cursor: zoom-in; border-bottom: 1px solid var(--border); }
.ov-thumb-btn:disabled { cursor: not-allowed; }
.ov-thumb-hover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: #fff; font-size: 13px; font-weight: 600; background: rgba(5, 8, 12, .55); opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.ov-thumb-btn:hover:not(:disabled) .ov-thumb-hover, .ov-thumb-btn:focus-visible .ov-thumb-hover { opacity: 1; }
.ov-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.ov-card-head { display: flex; align-items: center; gap: 8px; }
.ov-card-head .ov-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-card-head .toggle-text { display: none; }
.ov-ic { width: 26px; height: 26px; }
.ov-desc { min-height: 2.6em; }
.ov-pills { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ov-size { font-size: 11px; color: var(--faint); margin-inline-start: auto; }
.ov-card .ov-actions { margin-top: auto; justify-content: flex-start; padding-top: 4px; }
/* thumbnails: tiny abstract drawings on a checkerboard "stream" */
.ov-thumb { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #18202b, #11161e); overflow: hidden; }
.ov-thumb i { position: absolute; display: block; font-style: normal; }
.ov-thumb .tb { position: static; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .35); margin: 3px 0; }
.ov-thumb .tb.hi { background: var(--accent); }
.ov-thumb .tcard { left: 50%; top: 18%; transform: translateX(-50%); width: 56%; padding: 8px 10px; border-radius: 6px; background: rgba(13, 17, 23, .85); border-inline-start: 3px solid var(--accent); }
.ov-thumb .tcard.low { top: auto; bottom: 12%; }
.ov-thumb .tcard.r { left: auto; right: 8%; transform: none; width: 46%; }
.ov-thumb .tcard.wide { width: 80%; }
.ov-thumb .tchat { left: 7%; bottom: 10%; width: 44%; padding: 6px 8px; border-radius: 6px; background: rgba(13, 17, 23, .7); }
.ov-thumb .tchat.r { left: auto; right: 7%; top: 10%; bottom: auto; }
.ov-thumb .tgoal { left: 8%; top: 14%; width: 50%; padding: 8px; border-radius: 6px; background: rgba(13, 17, 23, .85); }
.ov-thumb .tgoal .tb { background: rgba(255, 255, 255, .15); height: 7px; }
.ov-thumb .tfill { position: absolute; left: 8px; bottom: 11px; height: 7px; border-radius: 4px; background: var(--accent); }
.ov-thumb .tbig, .ov-thumb .tstat { left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 6px 12px; border-radius: 6px; background: rgba(13, 17, 23, .85); color: #fff; font: 700 18px var(--mono); white-space: nowrap; }
.ov-thumb .tbig.sm, .ov-thumb .tstat { font-size: 14px; }
.ov-thumb .tlb { left: 8%; top: 10%; width: 46%; padding: 7px; border-radius: 6px; background: rgba(13, 17, 23, .85); }
.ov-thumb .tlb > i:not(.tb) { position: static; height: 6px; border-radius: 3px; margin: 3px 0; }
.ov-thumb .tlb .g { background: #ffc43d; width: 90%; } .ov-thumb .tlb .s { background: #cfd8e3; width: 75%; } .ov-thumb .tlb .b { background: #d68c54; width: 62%; }
.ov-thumb .tscene { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(13, 17, 23, .7); }
.ov-thumb .tscene .tb { width: 40%; height: 8px; }
.ov-thumb .tcoin { left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: var(--accent); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25); }
.ov-thumb .twheel { left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: conic-gradient(var(--accent) 0 25%, #7c9cff 0 50%, #f2b23e 0 75%, #f0566a 0); }
.ov-thumb .tbox { border: 1.5px dashed var(--accent); background: var(--accent-soft); border-radius: 3px; }
.ov-thumb .tbox.a { left: 25%; top: 8%; width: 50%; height: 26%; } .ov-thumb .tbox.b { left: 6%; bottom: 8%; width: 30%; height: 44%; } .ov-thumb .tbox.c { left: 32%; bottom: 8%; width: 36%; height: 18%; }

/* preview frame states */
.preview-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(11, 13, 17, .55); z-index: 2; }
.preview-loading, .preview-error { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border-2); }
.preview-error { color: #ffb3bb; }

/* ---------- All-in-One ---------- */
.canvas-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; pointer-events: none; }
.cv-item { touch-action: none; }
.cv-item:hover:not(.locked) { background: var(--accent-soft); }
.cv-item.dragging { opacity: .85; cursor: grabbing; outline: 2px solid var(--accent); }
.cv-item:focus-visible { box-shadow: none; outline: 2px solid #fff; outline-offset: 1px; }
.cv-handle { width: 16px; height: 16px; right: -7px; bottom: -7px; touch-action: none; }
.layer .btn.icon-only { width: 26px; }
.layer:hover { background: var(--row-hover); }
.add-widget { margin-top: 8px; align-self: flex-start; }
.add-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.add-item { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2); color: var(--text); cursor: pointer; text-align: start; font: inherit; }
.add-item:hover { border-color: var(--accent); background: var(--surface-2); }
.add-item .ov-thumb { width: 74px; border-radius: 5px; }
.add-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.add-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .cmd-cols, .bi-cols { grid-template-columns: minmax(0, 1fr) auto; }
  .cmd-cols > :nth-child(3), .cmd-cols > :nth-child(4), .cmd-cols > :nth-child(5), .bi-cols > :nth-child(4), .bi-cols > :nth-child(5) { display: none; }
  .cmd-cols > :nth-child(2), .bi-cols > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .bi-cols > :nth-child(3) { grid-row: 3; grid-column: 1; }
  .bi-cols > :nth-child(6) { grid-row: 1; grid-column: 2; }
  .cmd-cols > :nth-child(6) { grid-row: 1; grid-column: 2; }
  .cmd-cols > :nth-child(7) { grid-row: 3; grid-column: 1 / -1; justify-content: flex-start; }
  .dt-head.cmd-cols, .dt-head.bi-cols { display: none; }
  .lb-cols { grid-template-columns: 30px minmax(0, 1fr) 70px; }
  .lb-cols > :nth-child(3), .lb-cols > :nth-child(4), .lb-cols > :nth-child(5) { display: none; }
  .shop-cols { grid-template-columns: 26px minmax(0, 1fr) 80px 44px; }
  .shop-cols > :nth-child(4), .shop-cols > :nth-child(5), .shop-cols > :nth-child(7) { display: none; }
  .vars-cols { grid-template-columns: 130px minmax(0, 1fr); }
  .vars-cols > :nth-child(3) { display: none; }
}
@media (max-width: 560px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .player-dock { inset-inline: 8px; bottom: 8px; width: auto; }
  .range-wrap.vol.compact { width: 100px; }
  .pd-bar { flex-wrap: wrap; }
  .modal { max-height: calc(100vh - 16px); }
  .modal-back { padding: 8px; align-items: flex-end; }
  .cmd-help li { grid-template-columns: 96px minmax(0, 1fr); }
  .now img { width: 88px; }
}
@media (hover: none) {
  .ov-thumb-hover { opacity: 0 !important; }
  .cv-handle { width: 22px; height: 22px; right: -10px; bottom: -10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ov-card:hover, .btn:active { transform: none; }
}

/* toolbars: filters keep their natural width */
.toolbar > select.input, .toolbar > .input { width: auto; flex: 0 0 auto; min-width: 140px; }
.toolbar > .search { flex: 1 1 240px; }

/* tables adapt to the space they actually have (side menu, split screens), not only to the window */
.dt { container-type: inline-size; }
@container (max-width: 820px) {
  .cmd-cols, .bi-cols { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .cmd-cols > :nth-child(3), .bi-cols > :nth-child(3) { grid-row: 3; grid-column: 1; max-width: 220px; }
  .cmd-cols > :nth-child(4), .cmd-cols > :nth-child(5), .bi-cols > :nth-child(4), .bi-cols > :nth-child(5) { display: none; }
  .cmd-cols > :nth-child(2), .bi-cols > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .cmd-cols > :nth-child(6), .bi-cols > :nth-child(6) { grid-row: 1; grid-column: 2; }
  .cmd-cols > :nth-child(7) { grid-row: 3; grid-column: 2; }
  .dt-head.cmd-cols, .dt-head.bi-cols { display: none; }
}
@container (max-width: 560px) {
  .lb-cols { grid-template-columns: 30px minmax(0, 1fr) 70px; }
  .lb-cols > :nth-child(3), .lb-cols > :nth-child(4), .lb-cols > :nth-child(5) { display: none; }
  .shop-cols { grid-template-columns: 26px minmax(0, 1fr) 80px 44px; }
  .shop-cols > :nth-child(4), .shop-cols > :nth-child(5), .shop-cols > :nth-child(7) { display: none; }
}

/* a field directly in a vertical form takes its natural height (flex-basis 180px is meant for widths in rows) */
.form > .field, .modal-body > .field, .stack > .field, .stack-sm > .field { flex: 0 0 auto; }

/* ---------- overlay preview: the dashboard is color-scheme dark, the overlay page is not; without this the
   browser paints an opaque white backdrop. The overlay page is light by default, so the frame must say light too behind the transparent overlay ---------- */
.preview-frame iframe, iframe[src*="/o/"] { color-scheme: light; }

/* ---------- Moderator reminder ---------- */
.mod-cmd { display: flex; align-items: center; gap: 10px; margin: 10px 0; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--r-sm); }
.mod-cmd code { flex: 1; font-family: var(--mono); font-size: 16px; color: var(--accent); }

/* ---------- service-owner access ---------- */
.demo-banner.admin { background: var(--bad-soft); color: #ffc2ca; border-bottom-color: rgba(240, 86, 106, .35); }
.demo-banner.admin strong { color: #fff; }
.adm-cols { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 60px 110px 130px 80px; align-items: center; }
.admlog-cols { grid-template-columns: 130px 110px minmax(0, 1fr) minmax(0, 1.6fr) 64px; align-items: center; }
@media (max-width: 900px) {
  .adm-cols, .admlog-cols { grid-template-columns: minmax(0, 1fr) auto; }
  .adm-cols > :nth-child(n+3):not(:last-child), .admlog-cols > :nth-child(n+4) { display: none; }
}

/* ---------- public pages (privacy, terms, accessibility statement) ---------- */
.legal-page { min-height: 100vh; background: var(--bg); }
.legal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.legal-head .brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; }
.legal-main { max-width: 780px; margin: 0 auto; padding: 28px 24px 64px; }
.legal-main h1 { font-size: 26px; margin: 0 0 4px; }
.policy-box { margin-top: 18px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.policy-box h2 { font-size: 17px; margin: 0 0 8px; }
.policy-box p, .policy-box li { color: var(--muted); margin: 0; }
.policy-box ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 18px; font-size: 13px; }
.legal-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.legal-links a:hover { color: var(--text); }
.side-foot .legal-links { margin: 10px 6px 0; font-size: 12px; }
@media (max-width: 560px) { .legal-head, .legal-main { padding-inline: 14px; } }

/* ---------- sidebar: on hover the row is gently highlighted and its icon hops up once and back.
   Leaving the row returns both to normal. Off with the system's reduce-motion setting / "stop motion". ---------- */
.side .nav-item { transition: background .18s ease, color .18s ease; }
.side .nav-item:hover:not(.active) { background: #1d201b; color: var(--text); }
.side .nav-item .icon { transition: color .18s ease; }
.side .nav-item:hover .icon { color: var(--accent); animation: nav-hop .42s cubic-bezier(.3, .7, .4, 1) 1; }
@keyframes nav-hop { 0% { transform: translateY(0); } 40% { transform: translateY(-3px); } 100% { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .side .nav-item:hover .icon { animation: none; } }
body.contrast-light .side .nav-item:hover:not(.active) { background: #e6e9e2; color: #000; }

/* Draw & guess pad (dashboard): a white board like the one shown in OBS */
.draw-pad { display: block; width: 100%; max-width: 500px; aspect-ratio: 1; height: auto; background: #fbfbf8; border-radius: 8px; border: 1px solid var(--border-2); cursor: crosshair; touch-action: none; }

/* support tickets */
.tk-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.tk-row.sel { background: var(--tint, rgba(57,230,0,.08)); }
.tk-row.unread .grow { font-weight: 700; }
.tk-id { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 3.2em; }
.tk-thread { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; padding: 4px; }
.tk-msg { max-width: 85%; align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.tk-msg.me { align-self: flex-end; background: rgba(57,230,0,.10); border-color: rgba(57,230,0,.3); }
.tk-meta { display: flex; gap: 10px; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tk-body { white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; }

.hl-errors { margin: 8px 0 0; padding-inline-start: 18px; display: grid; gap: 6px; font-size: 13px; }
.hl-errors code { overflow-wrap: anywhere; }

/* Automatic reload after an update, and in-place redraw after an access change: a soft entrance */
.app-enter #app { animation: appEnter .55s cubic-bezier(.2, .8, .2, 1) both; }
.app-leave #app { transition: opacity .25s ease, transform .25s ease; opacity: 0; transform: scale(.985); }
.view-enter { animation: viewEnter .4s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes appEnter { from { opacity: 0; transform: translateY(10px) scale(.99); filter: blur(3px); } }
@keyframes viewEnter { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .app-enter #app, .view-enter { animation: none; } .app-leave #app { transition: none; } }

/* Entrance when the site opens: sidebar slides in, top bar drops in, then the page's cards rise one after another */
.site-enter .top { animation: siteTop .45s .05s cubic-bezier(.2, .8, .2, 1) both; }
.site-enter .nav-item, .site-enter .brand, .site-enter .platform-indicator, .site-enter .switcher { animation: siteNav .45s cubic-bezier(.2, .8, .2, 1) both; }
.site-enter .nav-item:nth-child(1) { animation-delay: .10s; } .site-enter .nav-item:nth-child(2) { animation-delay: .14s; }
.site-enter .nav-item:nth-child(3) { animation-delay: .18s; } .site-enter .nav-item:nth-child(4) { animation-delay: .22s; }
.site-enter .nav-item:nth-child(5) { animation-delay: .26s; } .site-enter .nav-item:nth-child(6) { animation-delay: .30s; }
.site-enter .nav-item:nth-child(7) { animation-delay: .34s; } .site-enter .nav-item:nth-child(8) { animation-delay: .38s; }
.site-enter .nav-item:nth-child(n+9) { animation-delay: .42s; }
.site-enter .side-foot { animation: viewEnter .5s .4s ease both; }
.site-enter .main > .view > *, .site-enter .demo-banner { animation: viewEnter .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: .2s; }
.site-enter .main > .view > :nth-child(2) { animation-delay: .28s; } .site-enter .main > .view > :nth-child(3) { animation-delay: .36s; }
.site-enter .main > .view > :nth-child(4) { animation-delay: .44s; } .site-enter .main > .view > :nth-child(n+5) { animation-delay: .52s; }
.site-enter .grid > *, .site-enter .cards > * { animation: viewEnter .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: inherit; }
#app > .site-enter:not(.layout) { animation: appEnter .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes siteTop { from { opacity: 0; transform: translateY(-10px); } }
@keyframes siteNav { from { opacity: 0; transform: translateX(var(--enter-x, 14px)); } }
[dir="ltr"] { --enter-x: -14px; }
@media (prefers-reduced-motion: reduce) { .site-enter *, .site-enter { animation: none !important; } }

/* Loading screen when the site opens: CashBot mark with dancing bars, a thin progress bar and a status line */
#splash { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: radial-gradient(60% 50% at 50% 45%, rgba(57, 230, 0, .06), transparent 70%), var(--bg, #10110f); transition: opacity .45s ease, visibility .45s; }
#splash.out { opacity: 0; visibility: hidden; }
#splash.out .splash-inner { transform: scale(1.04); }
.splash-inner { display: grid; justify-items: center; gap: 14px; transition: transform .45s ease; animation: splashIn .5s cubic-bezier(.2, .8, .2, 1) both; }
.splash-mark { filter: drop-shadow(0 8px 24px rgba(57, 230, 0, .25)); }
.splash-mark .sb { transform-box: fill-box; transform-origin: center; animation: splashBar 1s ease-in-out infinite; }
.splash-mark .sb2 { animation-delay: -.25s; } .splash-mark .sb3 { animation-delay: -.5s; } .splash-mark .sb4 { animation-delay: -.75s; }
.splash-word { font: 700 26px/1 var(--font, 'Rubik'), system-ui, sans-serif; letter-spacing: .02em; color: var(--text, #f2f4ee); direction: ltr; }
.splash-word span { color: var(--accent, #39e600); }
.splash-bar { width: 180px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 12%; border-radius: inherit; background: var(--accent, #39e600); box-shadow: 0 0 10px var(--accent, #39e600); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.splash-text { font: 500 13px/1 'JetBrains Mono', ui-monospace, monospace; color: var(--muted, #9aa197); letter-spacing: .03em; min-height: 1em; }
@keyframes splashIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes splashBar { 0%, 100% { transform: scaleY(.55); } 50% { transform: scaleY(1.15); } }
@media (prefers-reduced-motion: reduce) { .splash-inner, .splash-mark .sb { animation: none; } #splash, .splash-inner { transition: none; } }

/* The accessibility button waits for the loading screen to go: it then appears once, already in its final place
   (beside the sidebar), instead of starting at the screen edge and jumping over */
body:has(#splash) #a11y-button { opacity: 0; visibility: hidden; transition: none; }
