/* Analytics and Dashboards (2.4.9). Calm by default; edit mode is the one bold moment: the 12-column snap grid shows
   as a faint array of cells and drop targets are outlined in Solar Gain gold. Chart colors are the validated
   categorical order from the dataviz method (light and dark steps), assigned in fixed order, never cycled. */
.an {
  --an-s1: #2a78d6; --an-s2: #eb6834; --an-s3: #1baf7a; --an-s4: #eda100; --an-s5: #e87ba4; --an-s6: #008300; --an-s7: #6250d6; --an-s8: #e34948;
  --an-q1: #a6c8f0; --an-q2: #5f9be3; --an-q3: #2a78d6; --an-q4: #184f96;
  --an-ink: var(--ink); --an-muted: var(--muted); --an-grid: #ebe6e2; --an-surface: var(--surface-overlay, #fff); --an-other: #a8adb5;
  --an-cell: #eef2f7; --an-cell-edge: #dde5ef; --an-gold: var(--accent, #f5b428); --an-gold-ink: var(--accent-text, #7a5300);
  --an-card-line: var(--line-2); --an-ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] .an {
  --an-s1: #3987e5; --an-s2: #d95926; --an-s3: #199e70; --an-s4: #c98500; --an-s5: #d55181; --an-s6: #008300; --an-s7: #9085e9; --an-s8: #e66767;
  --an-q1: #1f4f8c; --an-q2: #2f6dc0; --an-q3: #4f8fe0; --an-q4: #8dbbf2;
  --an-grid: #3a352e; --an-other: #7d776f; --an-cell: #26231e; --an-cell-edge: #353029;
}
.an-page { padding: var(--sp-4) var(--sp-5, 20px) 40px; }
.an-gate { max-width: 520px; margin: 12vh auto; text-align: center; color: var(--muted); }
.an-gate h1 { color: var(--ink); font-size: 1.25rem; margin: 12px 0 6px; }

/* ---------------------------------------------------------------- header */
.an-head { display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.an-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 260px; }
.an-tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--top); color: var(--an-gold); flex: none; }
.an-title h1 { font-size: 1.125rem; font-weight: 650; margin: 0; letter-spacing: -.005em; line-height: 1.25; }
.an-sub { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.an-refresh { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); }
.an-filters { display: flex; gap: 8px; align-items: center; }
.an-sel select { width: auto; min-height: 30px; padding: 0 28px 0 10px; border-radius: 8px; font-weight: 600; }
.an-chip { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--an-surface); color: var(--ink); font: inherit; font-size: var(--fs-base); font-weight: 600; cursor: pointer; }
.an-chip[aria-pressed="true"], .an-chip.on { background: var(--top); color: var(--on-top); border-color: var(--top); }
.an-chip.on { height: 24px; padding: 0 4px 0 10px; font-size: var(--fs-sm); }
.an-chip.on button { border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; }
.an-chip.add { height: 24px; padding: 0 9px; font-size: var(--fs-sm); color: var(--muted); border-style: dashed; }
.an-acts { display: flex; gap: 8px; align-items: center; }
.an-customize { height: 32px; padding: 0 14px; border-radius: 8px; }
.an-redo svg { transform: scaleX(-1); }
.an-saved { font-size: var(--fs-sm); color: var(--muted); min-width: 58px; text-align: right; }
.an-saved.s-error { color: var(--bad); font-weight: 600; }
.an-flag select { font-weight: 500; color: var(--muted); }

/* ---------------------------------------------------------------- body: canvas + side panel */
.an-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.an.has-side .an-body { grid-template-columns: minmax(0, 1fr) 330px; }
.an-canvas { position: relative; min-height: 200px; transition: height .2s var(--an-ease); }
.an-cells { position: absolute; inset: 0; pointer-events: none; border-radius: 10px;
  background: linear-gradient(to right, var(--an-cell) calc(100% - var(--gap)), transparent 0) 0 0 / calc((100% + var(--gap)) / var(--cols)) 100%;
  -webkit-mask: linear-gradient(to bottom, #000 calc(100% - var(--gap)), transparent 0) 0 0 / 100% calc(var(--row) + var(--gap));
  mask: linear-gradient(to bottom, #000 calc(100% - var(--gap)), transparent 0) 0 0 / 100% calc(var(--row) + var(--gap));
  animation: an-cells-in .24s var(--an-ease); }
@keyframes an-cells-in { from { opacity: 0; } to { opacity: 1; } }
.an-drop { position: absolute; border-radius: 12px; border: 2px dashed var(--an-gold); background: color-mix(in srgb, var(--an-gold) 10%, transparent); pointer-events: none; transition: left .14s var(--an-ease), top .14s var(--an-ease), width .14s var(--an-ease), height .14s var(--an-ease); z-index: 1; }
.an-ghost { position: absolute; left: 0; top: 0; z-index: 9; display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 10px; background: var(--top); color: var(--on-top); font-weight: 600; box-shadow: var(--sh-pop); pointer-events: none; white-space: nowrap; }
.an-empty { position: absolute; inset: 40px 0 auto; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- widgets */
.an-w { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; background: var(--an-surface); border: 1px solid var(--an-card-line); border-radius: 12px; overflow: hidden;
  transition: transform .18s var(--an-ease), width .18s var(--an-ease), height .18s var(--an-ease), box-shadow .15s ease; z-index: 2; }
.an-w.lifted { transition: box-shadow .15s ease; z-index: 8; box-shadow: var(--sh-pop); cursor: grabbing; }
.an-w.sel { border-color: var(--an-gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--an-gold) 45%, transparent); }
.an-w:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.an-wh { display: flex; align-items: center; gap: 6px; padding: 10px 12px 2px 14px; min-height: 36px; }
.an-wh h2 { margin: 0; font-size: var(--fs-md); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; letter-spacing: 0; }
.an-pin { color: var(--muted); display: inline-grid; }
.an-mini { width: 26px; height: 26px; border: 0; background: none; color: var(--muted); border-radius: 6px; display: grid; place-items: center; cursor: pointer; flex: none; }
.an-mini:hover, .an-mini[aria-pressed="true"] { background: var(--hover); color: var(--ink); }
.an-grip { border: 0; background: none; color: var(--muted); cursor: grab; touch-action: none; padding: 2px; margin-left: -6px; border-radius: 6px; display: grid; }
.an-grip:hover { color: var(--an-gold-ink); background: color-mix(in srgb, var(--an-gold) 18%, transparent); }
.an-wb { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 2px 14px 12px; }
.an-resize { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 52%, var(--an-gold) 52%, var(--an-gold) 60%, transparent 60%, transparent 70%, var(--an-gold) 70%, var(--an-gold) 78%, transparent 78%); opacity: .85; }
.is-editing .an-w { cursor: default; }
.is-editing .an-wb { pointer-events: none; }
.is-editing .an-wb textarea { pointer-events: auto; }

.an-kpi { all: unset; display: flex; flex-direction: column; justify-content: center; gap: 4px; flex: 1; cursor: default; }
.an-kpi-v { font-size: 2.125rem; font-weight: 650; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.an-kpi-v small { font-size: .875rem; font-weight: 600; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.an-kpi-sub { font-size: var(--fs-sm); color: var(--muted); }
.an-meter { display: block; height: 6px; border-radius: 3px; background: var(--an-grid); overflow: hidden; max-width: 220px; }
.an-meter span { display: block; height: 100%; background: var(--an-s1); border-radius: 3px; }
.an-chart { flex: 1; min-height: 0; width: 100%; }
.an-tablewrap { flex: 1; min-height: 0; overflow: auto; margin: 0 -4px; }
.an-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.an-table th { position: sticky; top: 0; background: var(--an-surface); text-align: left; font-weight: 600; color: var(--muted); font-size: var(--fs-sm); padding: 6px 6px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.an-table td { padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.an-table .num { text-align: right; }
.an-table tbody tr { cursor: pointer; }
.an-table tbody tr:hover, .an-table tbody tr:focus-visible { background: var(--row-hover); outline: none; }
.an-t1 { font-weight: 600; }
.an-msg, .an-quiet { margin: auto 0; color: var(--muted); font-size: var(--fs-base); }
.an-msg { color: var(--bad); }
.an-note { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--warn); }
.an-skel { flex: 1; border-radius: 8px; background: linear-gradient(90deg, var(--soft) 0, var(--hover) 50%, var(--soft) 100%); background-size: 200% 100%; animation: an-shine 1.2s linear infinite; min-height: 30px; }
.an-skel.sm { width: 56px; height: 36px; flex: none; min-height: 0; }
@keyframes an-shine { to { background-position: -200% 0; } }
.an-notes { flex: 1; resize: none; border: 1px dashed var(--line-3); border-radius: 8px; background: var(--note-bg); min-height: 0; }
.an-notes-v { margin: 0; white-space: pre-wrap; color: var(--ink-2); overflow: auto; }

/* ---------------------------------------------------------------- side panel: drawer and settings */
.an-side { position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - 28px); overflow: auto; background: var(--an-surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; animation: an-slide .22s var(--an-ease); z-index: 3; }
@keyframes an-slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.an-side h3 { margin: 0; font-size: var(--fs-lg); font-weight: 650; }
.an-sh { display: flex; align-items: center; justify-content: space-between; }
.an-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; color: var(--muted); }
.an-search input { border: 0; padding: 0; min-height: 32px; background: transparent; }
.an-search input:focus { outline: none; }
.an-search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.an-presets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.an-presets li { display: flex; align-items: stretch; gap: 4px; }
.an-preset { flex: 1; display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line-2); background: var(--an-surface); border-radius: 10px; padding: 8px; cursor: grab; font: inherit; color: var(--ink); touch-action: pan-y; min-width: 0; }
.an-preset:hover { border-color: var(--line-3); background: var(--soft); }
.an-preset:active { cursor: grabbing; }
.an-pv { width: 60px; height: 42px; flex: none; border-radius: 8px; background: var(--soft); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.an-pv-n { font-size: 1.05rem; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.an-pv-n.sm { font-size: var(--fs-sm); color: var(--muted); }
.an-spark { display: flex; align-items: flex-end; gap: 2px; width: 46px; height: 28px; }
.an-spark i { flex: 1; background: var(--an-s1); border-radius: 2px 2px 0 0; min-height: 2px; }
.an-pt { display: flex; flex-direction: column; min-width: 0; }
.an-pt b { font-weight: 600; font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-pt small { color: var(--muted); font-size: var(--fs-sm); }
.an-add { width: 34px; border: 1px solid var(--line-2); background: var(--an-surface); border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.an-add:hover { background: var(--hover); }
.an-hint { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.an-f { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-base); }
.an-f > span { font-weight: 600; color: var(--ink-2); }
.an-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.an-seg button { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--an-surface); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; color: var(--ink); }
.an-seg button[aria-pressed="true"] { background: var(--top); color: var(--on-top); border-color: var(--top); }
.an-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.an-check { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); color: var(--ink-2); }
.an-check input { width: auto; min-height: 0; margin-top: 2px; }
.an-danger { color: var(--bad); align-self: flex-start; }

/* ---------------------------------------------------------------- edit mode dims the rest of Command Center */
html.an-editing .topbar, html.an-editing .nv-reports, html.an-editing .nav-rail, html.an-editing .sun-dot, html.an-editing .mail-dock { opacity: .42; filter: saturate(.5); transition: opacity .2s ease, filter .2s ease; }
html.an-editing .an-head .an-title, html.an-editing .an-filters { opacity: .7; }

/* ---------------------------------------------------------------- phones: one column; side panel becomes a sheet */
@media (max-width: 720px) {
  .an-page { padding: 12px 12px 90px; }
  .an.has-side .an-body { grid-template-columns: minmax(0, 1fr); }
  .an-side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 62vh; border-radius: 16px 16px 0 0; z-index: var(--z-sheet, 30); box-shadow: var(--sh-pop); animation-name: an-sheet; }
  @keyframes an-sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .an-filters { order: 3; width: 100%; }
  .an-acts { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .an-w, .an-drop, .an-canvas, .an-side, .an-cells, html.an-editing .topbar { transition: none !important; animation: none !important; }
  .an-skel { animation: none; }
}

/* the Reports tabs gained Analytics: on phones they scroll sideways instead of wrapping */
@media (max-width: 720px) { .nv-reports .nv-seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; } .nv-reports .nv-seg a { white-space: nowrap; } }

/* ---------------------------------------------------------------- the Service Board on the grid (2.4.9) */
.an-board { margin-top: 4px; }
.an-boardbar { display: flex; align-items: center; gap: 8px; min-height: 34px; margin-bottom: 8px; }
.an-board .an-w.blk .an-wb { padding: 0; }
.an-board .an-w.blk { border-color: var(--cb-line, var(--line-2)); border-radius: 8px; }
.an-board .an-w.blk .cb-metric { width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; }
.an-board .an-w.blk .cb-chart.fill, .an-board .an-w.blk .cb-list.fill { height: 100%; display: flex; flex-direction: column; border: 0; border-radius: 0; margin: 0; max-height: none; min-height: 0; }
.an-board .cb-chart.fill .cb-canvas { flex: 1; min-height: 60px; }
.an-board .cb-list.fill ul { flex: 1; overflow: auto; }
.an-board.is-editing .an-w.blk .an-wh { padding: 6px 8px 0 12px; min-height: 28px; }
.an-board.is-editing .an-w.blk .cb-chart.fill > h3 { display: none; }

/* ================================================================ 2.6.0 phases 2-4 */
/* several dashboards: a quiet row of tabs above the header; shared ones carry their owner */
.an-dtabs { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; border-bottom: 1px solid var(--line); }
.an-dtabs-list { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.an-dtabs-list::-webkit-scrollbar { display: none; }
.an-dtabs-list a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px 9px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--fs-base); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0; }
.an-dtabs-list a:hover { color: var(--ink); background: var(--hover); }
.an-dtabs-list a.on { color: var(--ink); border-bottom-color: var(--an-gold); }
.an-dtabs-list a small { font-weight: 500; color: var(--muted); }
.an-dtabs-list a.sh { font-weight: 500; }
.an-dtabs-sep { width: 1px; align-self: stretch; margin: 8px 6px; background: var(--line-2); flex: none; }
.an-dtabs-new { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px dashed var(--line-3); background: none; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; margin-bottom: 4px; }
.an-dtabs-new:hover { background: var(--hover); color: var(--ink); }
.an-shared { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-xs); font-weight: 600; color: var(--an-gold-ink); background: color-mix(in srgb, var(--an-gold) 16%, transparent); padding: 2px 7px; border-radius: 999px; vertical-align: 2px; margin-left: 4px; }
.an-ro { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--soft); color: var(--ink-2); font-size: var(--fs-sm); }
.an-clear { display: inline-flex; align-items: center; gap: 3px; }
.an-filters { flex-wrap: wrap; }
.an-ask-btn svg { color: var(--an-gold); }

/* dashboard menu */
.an-menu { position: relative; }
.an-menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 250px; padding: 6px; border-radius: 10px; background: var(--surface-overlay, #fff); border: 1px solid var(--line-2); box-shadow: var(--sh-pop); display: flex; flex-direction: column; }
.an-menu-pop button { all: unset; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: var(--fs-base); color: var(--ink); }
.an-menu-pop button:hover, .an-menu-pop button:focus-visible { background: var(--hover); }
.an-menu-pop button.bad { color: var(--bad); }

/* new dashboard: start-from choices */
.an-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 12px; }
.an-pick { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; position: relative; }
.an-pick input { position: absolute; opacity: 0; pointer-events: none; }
.an-pick small { color: var(--muted); font-size: var(--fs-sm); }
.an-pick.on { border-color: var(--an-gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--an-gold) 40%, transparent); }
.an-pick:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

/* type-ahead field picker */
.an-fp { position: relative; }
.an-fp input { width: 100%; padding-right: 28px; }
.an-fp-caret { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: grid; }
.an-fp-list { position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 25; max-height: 240px; overflow: auto; margin: 0; padding: 4px; list-style: none; border-radius: 9px; background: var(--surface-overlay, #fff); border: 1px solid var(--line-2); box-shadow: var(--sh-pop); }
.an-fp-list li { padding: 6px 9px; border-radius: 6px; cursor: pointer; font-size: var(--fs-base); display: flex; justify-content: space-between; gap: 8px; }
.an-fp-list li.hi { background: var(--hover); }
.an-fp-list li.cur { font-weight: 600; }
.an-fp-cur { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.an-fp-none { color: var(--muted); cursor: default !important; }

/* filter builder */
.an-fa { width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px dashed var(--line-3); border-radius: 10px; }
.an-fa-date { display: flex; gap: 6px; flex-wrap: wrap; }
.an-fa-date select, .an-fa-date input { flex: 1 1 120px; }
.an-chip.ro { padding: 0 10px; }

/* drill-down: the records behind a number */
.an:not(.is-editing) .an-kpi { cursor: pointer; border-radius: 8px; }
.an-kpi:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.an-drillrow { cursor: pointer; }
.an-drillrow:hover, .an-drillrow:focus-visible { background: var(--row-hover); outline: none; }
.an-drill { gap: 10px; }
.an-drill .an-sh h3 { outline: none; overflow-wrap: anywhere; }
.an-drill .an-tablewrap { max-height: none; margin: 0; }
.an-drill .an-table td { max-width: 150px; }
.an-rowside { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.an-rowside h4 { margin: 2px 0 0; font-size: var(--fs-md); }
.an-cust { width: 100%; margin-top: 6px; padding: 12px; border-radius: 10px; background: var(--soft); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.an-cust h5 { margin: 0; display: flex; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.an-cust-n { margin: 0; font-weight: 650; font-size: var(--fs-md); }
.an-cust dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: var(--fs-sm); }
.an-cust dt { color: var(--muted); }
.an-cust dd { margin: 0; overflow-wrap: anywhere; }

/* Ask Sunny */
.an-ask .row { display: flex; gap: 8px; }
.an-ask .row input { flex: 1; }
.an-ask .an-chips { margin-top: 10px; }
.an-ask-out { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.an-ask-out h4 { margin: 0; font-size: var(--fs-md); }
.an-used { margin: 0; padding-left: 18px; font-size: var(--fs-sm); display: flex; flex-direction: column; gap: 2px; }
.an-ask-pv { height: 220px; display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.an-ask-out .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* tab groups inside one widget */
.an-wtabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 1; }
.an-wtabs::-webkit-scrollbar { display: none; }
.an-wtabs button { all: unset; cursor: pointer; padding: 4px 9px; border-radius: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.an-wtabs button:hover { color: var(--ink); background: var(--hover); }
.an-wtabs button[aria-selected="true"] { color: var(--ink); background: var(--soft); box-shadow: inset 0 -2px 0 var(--an-gold); }
.an-wtabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.an-tablist { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-base); }
.an-tablist li.on button { font-weight: 700; color: var(--ink); }
.an-tabacts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.an-embed-h { margin: 6px 0 0; font-size: var(--fs-base); font-weight: 650; padding-top: 10px; border-top: 1px solid var(--line); }
.an-embed { display: flex; flex-direction: column; gap: 12px; }
.an-dtab { margin-top: -4px; }

/* drag a field onto a chart */
.an-shelf { display: flex; flex-direction: column; gap: 10px; }
.an-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.an-field { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px 0 6px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--an-surface); font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); cursor: grab; touch-action: none; user-select: none; }
.an-field svg { color: var(--muted); }
.an-field:hover { border-color: var(--an-gold); }
.an-fghost { position: fixed; left: 0; top: 0; z-index: 60; display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px; background: var(--top); color: var(--on-top); font-weight: 600; font-size: var(--fs-sm); box-shadow: var(--sh-pop); pointer-events: none; white-space: nowrap; }
.an-fghost.ok { background: var(--an-gold); color: #1d1606; }
.an.is-fdrag, .an.is-fdrag * { cursor: grabbing !important; user-select: none; }
.an-w.drop-on { border-color: var(--an-gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--an-gold) 45%, transparent); }

/* 3D columns */
.an-3d { position: relative; flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.an-3d-host { position: relative; flex: 1; min-height: 0; touch-action: none; }
.an-3d-canvas { position: absolute; inset: 0; display: block; cursor: grab; }
.an-3d-labels { position: absolute; inset: 0 0 22px; pointer-events: none; overflow: hidden; }
.an-3d-labels span { position: absolute; left: 0; top: 0; font-size: var(--fs-xs); font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--an-surface) 82%, transparent); padding: 0 4px; border-radius: 4px; white-space: nowrap; }
.an-3d-keys { display: flex; flex-direction: column; gap: 1px; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-3d-keys span { overflow: hidden; text-overflow: ellipsis; }
.an-3d-fallback { flex: 1; display: flex; flex-direction: column; min-height: 0; }

@media (max-width: 720px) {
  .an-dtabs { margin-top: 0; }
  .an-filters .an-sel { flex: 1 1 140px; }
  .an-filters .an-sel select { width: 100%; }
  .an-drill { max-height: 82vh; }
  .an-menu-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; min-width: 0; }
  .an-ask .row { flex-direction: column; }
  .an-picks { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .an-fghost { transition: none; } }
.an-3d-labels span.ax { background: none; color: var(--muted); font-weight: 600; }
.an-3d-labels span.ax.dep { color: var(--ink-2); font-style: italic; }
