/* ==========================================================================
   Taha Auto admin: the Analytics sheet (js/analytics.js), More → Analytics.
   Tokens only, so it follows every look and a picked accent; navy adds the
   approved card surfaces at the end. Each chart is one series: marks in the
   accent (--accent-ui is 3:1 on the page), words in the text tokens, a pale
   accent track, hairline axes. Bars grow in on open and on a new period,
   never with Reduce Motion.
   ========================================================================== */

/* ---------- the sheet: a computer gets a wide one with its own header ---------- */
.anx .anx__box { max-width: 980px; height: min(92dvh, 940px); padding-top: 0; gap: 0; align-content: start; }
.anx .anx__box:focus { outline: none; }
.anx .anx__head { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; grid-template-areas: "title view x" "seg seg seg"; align-items: center; gap: 12px; margin: 0 -24px; padding: 18px 24px 14px; background: inherit; border-bottom: 1px solid var(--line); }
.anx .anx__head h2 { grid-area: title; min-width: 0; margin: 0; }
.anx .anx__x { grid-area: x; display: grid; }
/* Shop | Website: a smaller switch beside the title (the periods under it are that view's own) */
.anx__view { grid-area: view; justify-self: end; display: grid; grid-template-columns: repeat(2, auto); gap: 2px; padding: 2px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.anx__view button { min-width: 64px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 650; white-space: nowrap; cursor: pointer; transition: background-color var(--dur-small) ease, color var(--dur-small) ease; }
.anx__view button:hover { color: var(--text); }
.anx__view button[aria-pressed="true"] { background: var(--text); color: var(--bg, #0B1520); }
.anx__view button:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 1px; }
.anx__seg { grid-area: seg; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; max-width: 560px; padding: 2px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.anx__seg button { min-width: 0; min-height: 44px; padding: 0 4px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: background-color var(--dur-small) ease, color var(--dur-small) ease; }
.anx__seg button:hover { color: var(--text); }
.anx__seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.anx__seg button:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 1px; }
.anx__body { display: grid; gap: 12px; padding: 16px 0 8px; min-width: 0; }
.anx-cards { display: grid; gap: 12px; min-width: 0; }
@media (min-width: 900px) {
  .anx-cards { display: block; columns: 2; column-gap: 12px; }
  .anx-cards > .anx-card { break-inside: avoid; margin-bottom: 12px; }
}

/* ---------- phone: the admin's bottom sheet, the period switch pinned under the title ---------- */
@media (max-width: 720px) {
  .anx .anx__box { max-width: none; height: 92vh; height: 92dvh; padding-top: 16px; }
  .anx .anx__head { top: -16px; grid-template-areas: "grab grab grab" "title view x" "seg seg seg"; column-gap: 12px; row-gap: 0; margin: -16px -16px 0; padding: 6px 12px 12px 16px; border-radius: inherit; touch-action: none; }
  .anx .anx__head .sheet__grab { grid-area: grab; }
  .anx__seg { margin-top: 8px; max-width: none; }
  .anx__seg button { font-size: clamp(13px, 3.7vw, 14px); }
}
/* a narrow phone (320–359): the four periods don't fit on one line each, so they wrap ("This / week") rather than cut off */
@media (max-width: 359px) {
  .anx .anx__head { grid-template-columns: minmax(0, 1fr) 44px; grid-template-areas: "grab grab" "title x" "view view" "seg seg"; }
  .anx__view { justify-self: stretch; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
  .anx__seg button { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.15; padding: 4px 2px; overflow-wrap: normal; }
  .anx__body { padding-top: 14px; }
}

/* ---------- money in: the one big number, its chart, and the days as a list ---------- */
.anx-hero, .anx-card, .anx-tile { background: var(--card); border: 1px solid var(--line); }
.anx-hero { min-width: 0; padding: 16px; border-radius: var(--r); }
.anx-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.anx-hero__k { margin: 12px 0 0; font-size: 15px; font-weight: 650; letter-spacing: 0; color: var(--text-2); }
.anx-hero__v { margin: 2px 0 0; font-size: clamp(40px, 12.5vw, 52px); font-weight: 800; line-height: 1.05; letter-spacing: -.035em; color: var(--text); overflow-wrap: anywhere; }
.anx-hero__s { margin: 6px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--text-2); }

.anx-chart { margin-top: 16px; border-radius: 8px; touch-action: pan-y; cursor: crosshair; -webkit-user-select: none; user-select: none; }
.anx-chart:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 6px; }
.anx-chart__top { height: 18px; border-bottom: 1px solid var(--line); font-size: 11px; line-height: 14px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.anx-chart__plot { display: flex; align-items: stretch; gap: 2px; height: 116px; border-bottom: 1px solid var(--line-2); }
.anx-col { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px 4px 0 0; transition: background-color var(--dur-small) ease; }
.anx-col i { display: block; width: 100%; max-width: 24px; height: var(--h); min-height: 3px; border-radius: 4px 4px 0 0; background: var(--accent-ui); transition: filter var(--dur-small) ease; }
.anx-col.is-sel { background: var(--accent-soft); }
.anx-col.is-sel i { filter: brightness(1.25); }
.anx-chart__axis { display: flex; gap: 2px; margin-top: 6px; }
.anx-chart__axis span { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; font-size: 11px; line-height: 1; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.anx-readout { min-height: 22px; margin: 10px 0 0; font-size: 14px; color: var(--text-2); }
.anx-readout b { color: var(--text); font-weight: 750; }
.anx-methods { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.anx-methods b { margin-left: 3px; font-weight: 650; color: var(--text); }

.anx-tbl { margin-top: 4px; }
.anx-tbl summary { min-height: 44px; display: flex; align-items: center; gap: 10px; color: var(--accent-text); font-size: 14px; font-weight: 650; list-style: none; cursor: pointer; }
.anx-tbl summary::-webkit-details-marker { display: none; }
.anx-tbl summary::before { content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur-small) var(--ease-out); }
.anx-tbl[open] summary::before { margin-bottom: 5px; transform: rotate(45deg); }
.anx-tbl summary:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 2px; border-radius: 6px; }
.anx-tbl table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.anx-tbl th, .anx-tbl td { padding: 9px 0; border-top: 1px solid var(--line); text-align: left; }
.anx-tbl th:not(:first-child), .anx-tbl td { text-align: right; }
.anx-tbl thead th { border-top: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.anx-tbl tbody th { font-weight: 500; color: var(--text-2); }

/* ---------- the headline numbers ---------- */
.anx-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
@media (min-width: 900px) { .anx-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.anx-tile { position: relative; min-width: 0; min-height: 96px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; border-radius: 14px; color: var(--text); font: inherit; text-align: left; }
.anx-tile__k { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.anx-tile__v { max-width: 100%; font-size: clamp(19px, 5.8vw, 23px); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; }
.anx-tile__s { font-size: 12.5px; line-height: 1.3; color: var(--text-3); }
.anx-tile--go { padding-right: 32px; cursor: pointer; transition: transform var(--dur-press) var(--ease-out), border-color var(--dur-small) ease; }
.anx-tile--go:hover { border-color: var(--line-2); }
.anx-tile--go:active { transform: scale(var(--press-scale)); }
.anx-tile--go:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 2px; }
.anx-tile__chev { position: absolute; top: 13px; right: 10px; width: 16px; height: 16px; color: var(--text-3); }

/* ---------- cards ---------- */
.anx-card { min-width: 0; padding: 14px 16px 16px; border-radius: var(--r); }
.anx-card__h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.anx-card__h h3 { min-width: 0; margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.anx-card__meta { flex: none; font-size: 12.5px; color: var(--text-3); }
.anx-none { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-3); }
.anx-foot { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-3); }
.anx-sub { margin: 14px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }

/* a row per thing: label, value, and a thin bar on one scale */
.anx-bars { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.anx-bar { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l v" "t t"; align-items: baseline; gap: 6px 12px; padding: 6px 0; background: none; border: 0; border-radius: 10px; color: var(--text); font: inherit; text-align: left; }
.anx-bar__l { grid-area: l; min-width: 0; overflow: hidden; font-size: 14px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.anx-bar__l small { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.anx-bar__v { grid-area: v; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.anx-bar__t { grid-area: t; display: block; height: 6px; overflow: hidden; border-radius: 3px; background: var(--accent-soft); }
.anx-bar__t i { display: block; width: var(--w); min-width: 3px; height: 100%; border-radius: 3px; background: var(--accent-ui); }
.anx-bar--go { min-height: 48px; grid-template-columns: minmax(0, 1fr) auto 16px; grid-template-areas: "l v c" "t t c"; margin: 0 -8px; padding: 6px 8px; width: calc(100% + 16px); cursor: pointer; transition: background-color var(--dur-small) ease; }
.anx-bar--go:hover { background: var(--accent-soft); }
.anx-bar--go:active { background: var(--accent-soft); }
.anx-bar--go:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: -2px; }
.anx-bar__chev { grid-area: c; align-self: center; width: 16px; height: 16px; color: var(--text-3); }
.anx-bars__more { padding-top: 6px; font-size: 13px; color: var(--text-3); }
.anx-low .anx-bar { grid-template-areas: "l v c"; align-items: center; }
.anx-low .anx-bar__l small { display: block; margin: 2px 0 0; }
.anx-low .st { grid-area: v; }

/* estimates: how many of the ones written were approved */
.anx-meter { height: 10px; overflow: hidden; border-radius: 5px; background: var(--accent-soft); }
.anx-meter i { display: block; width: var(--w); height: 100%; border-radius: 5px; background: var(--accent-ui); }
.anx-meter__l { margin: 8px 0 0; font-size: 14px; color: var(--text-2); }
.anx-meter__l b { color: var(--text); font-weight: 700; }
.anx-dl { margin: 12px 0 0; }
.anx-dl div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.anx-dl dt { font-size: 14px; color: var(--text-2); }
.anx-dl dd { margin: 0; font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* busiest days: the busiest in the accent, the rest a step back; the count on each cap */
.anx-wk { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.anx-wk__c { min-width: 0; display: grid; justify-items: center; gap: 6px; }
.anx-wk__bar { position: relative; width: 100%; max-width: 24px; height: 92px; margin-top: 20px; border-bottom: 1px solid var(--line-2); }
.anx-wk__bar i { position: absolute; left: 0; right: 0; bottom: 0; height: var(--h); min-height: 3px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--accent-ui) 42%, transparent); }
.anx-wk__bar b { position: absolute; left: -10px; right: -10px; bottom: calc(var(--h) + 4px); text-align: center; font-size: 13px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.anx-wk__c.is-top .anx-wk__bar i { background: var(--accent-ui); }
.anx-wk__c.is-top .anx-wk__bar b { color: var(--text); }
.anx-wk__d { font-size: 12px; font-weight: 600; color: var(--text-3); }
.anx-wk__c.is-top .anx-wk__d { color: var(--text); }

/* time on jobs: spent (the accent) against planned (grey), with a legend and the numbers written out */
.anx-time { margin: 0; font-size: 14px; line-height: 1.4; color: var(--text-2); }
.anx-time + .anx-foot { margin-top: 2px; }
.anx-time b { margin-right: 4px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.anx-legend { display: flex; gap: 16px; margin: 12px 0 6px; font-size: 12.5px; color: var(--text-3); }
.anx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.anx-key { display: inline-block; width: 14px; height: 6px; border-radius: 3px; background: var(--accent-ui); }
.anx-key--plan { background: var(--text-3); }

/* parts: the shop's cost (the accent) inside what was charged (the pale track is the margin) */
.anx-meter--cost { margin-top: 12px; }
.anx-legend--meter { margin: 8px 0 0; }
.anx-key--soft { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--line-2); }
.anx-foot b { font-weight: 700; color: var(--text); }
.anx-tpair { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.anx-tpair li { display: grid; gap: 6px; }
.anx-tpair__l { min-width: 0; overflow: hidden; font-size: 14px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.anx-tpair__l small { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.anx-tpair__r { display: grid; gap: 4px; }
.anx-tpair__row { display: grid; grid-template-columns: minmax(0, 1fr) 104px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.anx-tpair__row .anx-bar__t { grid-area: auto; }
.anx-tpair__row--plan .anx-bar__t { background: var(--panel-2); }
.anx-tpair__row--plan .anx-bar__t i { background: var(--text-3); }

.anx-link { width: 100%; min-height: 44px; margin-top: 12px; justify-content: center; }

/* nothing yet */
.anx-empty { display: grid; justify-items: center; gap: 6px; padding: 48px 20px; border: 1px solid var(--line); border-radius: var(--r); text-align: center; }
.anx-empty > svg { width: 44px; height: 44px; margin-bottom: 4px; padding: 11px; border-radius: 14px; color: var(--accent-text); background: var(--accent-soft); }
.anx-empty h3 { margin: 0; font-size: 17px; }
.anx-empty p { max-width: 32ch; margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-3); }

/* bars grow in (transform only), not with Reduce Motion */
@media (prefers-reduced-motion: no-preference) {
  .anx--grow .anx-col i, .anx--grow .anx-wk__bar i { transform-origin: 50% 100%; animation: anx-grow-y var(--dur-screen) var(--ease-out) both; }
  .anx--grow .anx-bar__t i, .anx--grow .anx-meter i { transform-origin: 0 50%; animation: anx-grow-x var(--dur-screen) var(--ease-out) both; }
}
@keyframes anx-grow-y { from { transform: scaleY(0); } }
@keyframes anx-grow-x { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  .anx__seg button, .anx__view button, .anx-col, .anx-col i, .anx-tile--go, .anx-bar--go, .anx-tbl summary::before { transition: none; }
}
/* forced colours (Windows high contrast): the marks keep a system colour */
@media (forced-colors: active) {
  .anx-col i, .anx-bar__t i, .anx-meter i, .anx-wk__bar i, .anx-key { background: CanvasText; forced-color-adjust: none; }
  .anx-key--soft { background: Canvas; box-shadow: inset 0 0 0 1px CanvasText; }
  .anx__seg button[aria-pressed="true"], .anx__view button[aria-pressed="true"] { outline: 2px solid Highlight; }
  .stx-svg rect, .stx-split i, .stx-key { fill: CanvasText; background: CanvasText; forced-color-adjust: none; }
}

/* ---------- navy: the job board's card surfaces ---------- */
body.theme-navy .anx-hero, body.theme-navy .anx-card, body.theme-navy .anx-tile { background: linear-gradient(135deg, #132230, #0F1B27); border-color: #203346; }
body.theme-navy .anx__seg, body.theme-navy .anx__view { background: #0C1721; border-color: #223445; }
body.theme-navy .anx__view button[aria-pressed="true"] { background: #E8EEF4; color: #0C1721; }
body.theme-navy .anx-tpair__row--plan .anx-bar__t { background: #172838; }
@media (max-width: 720px) {
  body.theme-navy .anx .anx__head { border-bottom-color: #203140; }
}

/* ==========================================================================
   Analytics → Website (js/site-traffic.js): the public site's visits. Same cards,
   tiles and bars as the shop's; its own pieces below are prefixed stx-.
   ========================================================================== */
.stx-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; }
.stx-sample { flex: none; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.stx-tiles { margin-top: -2px; }
@media (min-width: 900px) { .stx-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stx-tile { min-height: 104px; }
.stx-chg { color: var(--text-3); }
.stx-chg b { font-weight: 750; color: var(--text-2); white-space: nowrap; }
.stx-chg--up b { color: var(--ok-text, var(--text-2)); }
.stx-chg b span { font-size: 10px; }
.stx-now .anx-tile__k { display: inline-flex; align-items: center; gap: 7px; }
.stx-live { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.stx-live.is-on { background: var(--ok-text, #64DBA0); }
@media (prefers-reduced-motion: no-preference) {
  .stx-live.is-on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok-text, #64DBA0); opacity: 0; animation: stx-ping 2s var(--ease-out, ease-out) infinite; }
}
@keyframes stx-ping { 0% { transform: scale(.5); opacity: .8; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
.stx-sum { margin: 0; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--accent-soft); font-size: 14px; line-height: 1.45; color: var(--text-2); }
.stx-sum b { color: var(--text); font-weight: 700; }

/* the bars: inline SVG stretched to the card, one series in the accent */
.stx-chart { margin: 0; }
.stx-svg { display: block; width: 100%; height: 116px; border-bottom: 1px solid var(--line-2); overflow: visible; }
.stx-svg rect { fill: var(--accent-ui); }
.stx-axis { gap: 0; }
.stx-axis span { overflow: visible; }
.stx-chart .anx-readout { margin-top: 10px; }

/* phone vs computer: one split bar, its keys in the list under it */
.stx-split { display: flex; height: 12px; overflow: hidden; border-radius: 6px; background: var(--accent-soft); }
.stx-split i { display: block; width: var(--w); min-width: 2px; height: 100%; }
.stx-split i + i { border-left: 2px solid var(--card); }
.stx-split__a { background: var(--accent-ui); }
.stx-split__b { background: color-mix(in srgb, var(--accent-ui) 45%, var(--card)); }
.stx-split__c { background: var(--text-3); }
.stx-key { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; vertical-align: -1px; }

/* what's counted, and the switch for this device */
.stx-note__p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.stx-note__p b { color: var(--text); font-weight: 650; }
.stx-sw { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 64px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.stx-sw__txt { display: grid; gap: 3px; min-width: 0; }
.stx-sw__txt b { font-size: 15.5px; font-weight: 650; color: var(--text); }
.stx-sw__txt small { font-size: 13px; line-height: 1.4; color: var(--text-2); }

/* loading, nothing yet, couldn't load */
.stx-skel { display: grid; gap: 12px; }
.stx-skel i { display: block; height: 12px; border-radius: 6px; background: var(--panel-2); }
.stx-skel__tile i:first-child { width: 55%; }
.stx-skel__tile i:last-child { width: 40%; height: 24px; margin-top: 8px; }
.stx-skel__card { min-height: 150px; }
.stx-skel__card i:first-child { width: 40%; }
.stx-skel__card i:last-child { height: 96px; margin-top: 16px; }
@media (prefers-reduced-motion: no-preference) {
  .stx-skel i { animation: stx-pulse 1.4s ease-in-out infinite; }
}
@keyframes stx-pulse { 50% { opacity: .45; } }
.stx-state .stx-retry { min-height: 44px; margin-top: 10px; padding: 0 20px; }
.stx-state + .stx-note { margin-top: 0; }
body.theme-navy .stx-sum { background: color-mix(in srgb, var(--accent) 10%, #0F1B27); border-color: #203346; }
body.theme-navy .stx-skel i { background: #1A2B3B; }
