/* Allure Essence – v1.3 live dashboard and Cash on Hand. Builds on the warm glass theme in app.css.
   Motion is short and one-off (figure change, new sale, branch switch); nothing loops. All of it is switched off
   under prefers-reduced-motion. Nested surfaces use plain translucency (no extra blur) to stay fast on phones. */
:root { --m-sales: #2b2723; --m-profit: #b8683a; --m-bottles: #4f7d8c; --m-cash: #8a6a1f;
  --glass-hi: linear-gradient(145deg, rgba(255, 255, 255, .62) 0%, rgba(255, 255, 255, .16) 42%, rgba(255, 255, 255, 0) 70%); }

/* ---------- status bar */
.dash-bar { align-items: center; }
.dash-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 10px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .6); border: 1px solid var(--line); color: var(--ink-2); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(44, 122, 75, .16); }
.conn.retry i { background: var(--warn); box-shadow: 0 0 0 3px rgba(154, 100, 0, .16); }
.conn.off i { background: var(--bad); box-shadow: 0 0 0 3px rgba(165, 43, 34, .16); }
.conn.off, .conn.retry { color: var(--ink); }
.stale { flex-basis: 100%; font-size: .84rem; color: var(--ink); background: var(--warn-soft); border: 1px solid rgba(154, 100, 0, .35);
  border-radius: 12px; padding: 8px 12px; }
.warn-text { color: var(--warn); font-weight: 600; } .bad-text { color: var(--bad); }
.unavail { padding: 18px 12px; text-align: center; color: var(--ink-2); background: rgba(255, 255, 255, .45); border: 1px dashed var(--line-strong); border-radius: 12px; }

/* ---------- hero figures */
.hero-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hero { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 12px; text-decoration: none; color: var(--ink);
  text-align: left; font: inherit; cursor: pointer; overflow: hidden; isolation: isolate; min-height: 138px;
  background: rgba(255, 255, 255, .58); border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 14px 34px rgba(60, 40, 20, .13), 0 2px 6px rgba(60, 40, 20, .07);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.hero::before { content: ""; position: absolute; inset: 0; background: var(--glass-hi); z-index: -1; pointer-events: none; }
.hero::after { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); opacity: .85; }
.hero:hover, .hero:focus-visible { transform: translateY(-2px); border-color: rgba(176, 105, 60, .45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .85) inset, 0 18px 40px rgba(60, 40, 20, .17), 0 2px 6px rgba(60, 40, 20, .08); }
.hero:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hero.m-sales { --accent: var(--m-sales); } .hero.m-profit { --accent: var(--m-profit); }
.hero.m-cash { --accent: var(--m-cash); } .hero.m-bottles { --accent: var(--m-bottles); }
.h-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.h-label { font-size: .8rem; font-weight: 650; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.h-value { font-size: 1.75rem; font-weight: 750; letter-spacing: -.4px; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 2px; color: #1c1a16; }
.h-sub { font-size: .8rem; color: var(--ink-2); }
.h-delta { font-size: .78rem; color: var(--ink-2); margin-top: auto; padding-top: 6px; }
.h-split { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(70, 52, 34, .12); font-size: .78rem; }
.h-split span { display: inline-flex; gap: 6px; align-items: baseline; } .h-split i { font-style: normal; color: var(--ink-2); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; border-radius: 999px; padding: 1px 8px; background: rgba(255, 255, 255, .6); color: var(--ink-2); }
.delta.up { color: var(--ok); background: var(--ok-soft); } .delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.none { font-weight: 500; color: var(--muted); background: transparent; padding-left: 0; }
.spark { width: 84px; height: 30px; flex: 0 1 84px; min-width: 40px; color: var(--accent, var(--ink)); }
.spark.none { width: 0; }
.spark .sp-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark .sp-area { fill: currentColor; opacity: .1; } .spark .sp-dot { fill: currentColor; stroke: #fff; stroke-width: 1.2; }
.hero.changed { animation: fig-flash 1.5s ease-out 1; }
@keyframes fig-flash { 0% { box-shadow: 0 0 0 3px rgba(184, 104, 58, .55), 0 14px 34px rgba(60, 40, 20, .13); background: rgba(255, 246, 232, .92); }
  100% { box-shadow: 0 0 0 0 rgba(184, 104, 58, 0), 0 14px 34px rgba(60, 40, 20, .13); background: rgba(255, 255, 255, .58); } }

/* ---------- layout */
.g-top { align-items: start; } .col-stack { grid-template-columns: minmax(0, 1fr); }
.h-label { white-space: nowrap; flex-wrap: nowrap; min-width: 0; }
/* ---------- attention + secondary */
.g-attn { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; }
.sec-grid { align-content: start; }
.attn-card { border-color: rgba(176, 105, 60, .32); }
.count-badge { background: var(--bad); color: #fff; font-weight: 750; font-size: .78rem; min-width: 24px; height: 24px; border-radius: 999px; display: inline-grid; place-items: center; padding: 0 7px; }
.lrow.att { border-left: 3px solid transparent; }
.lrow.att.bad { border-left-color: var(--bad); } .lrow.att.warn { border-left-color: #c58a1c; } .lrow.att.info { border-left-color: rgba(47, 93, 138, .45); }
.card-sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px 6px; border-top: 1px solid rgba(70, 52, 34, .1); margin-top: 4px; }
.card-sub-head h3 { font-size: .86rem; display: inline-flex; gap: 6px; align-items: center; }

/* ---------- interactive chart */
.chart-wrap { position: relative; }
.chart-wrap.m-sales { --accent: var(--m-sales); } .chart-wrap.m-profit { --accent: var(--m-profit); } .chart-wrap.m-bottles { --accent: var(--m-bottles); }
.chart-total { margin-bottom: 4px; } .chart-total b { font-size: 1.15rem; }
.live-chart .bar { fill: var(--accent); opacity: .86; transition: opacity .15s; }
.live-chart .bar.zero { opacity: .25; }
.live-chart .hit { fill: transparent; }
.live-chart .bar-g { cursor: pointer; outline: none; }
.live-chart .bar-g:hover .hit, .live-chart .bar-g:focus-visible .hit { fill: rgba(70, 52, 34, .07); }
.live-chart .bar-g:hover .bar, .live-chart .bar-g:focus-visible .bar { opacity: 1; }
.live-chart .bar-g.sel .hit { fill: rgba(184, 104, 58, .14); }
.live-chart .bar-g.sel .bar { opacity: 1; stroke: #fff; stroke-width: 1.5; }
.live-chart .grid-line { stroke: rgba(70, 52, 34, .1); }
.chart-tip { position: absolute; top: 34px; background: #1f1c18; color: #fff; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; pointer-events: none; z-index: 2; }
.bar-detail { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .55); border: 1px solid var(--line); animation: rise .22s ease-out 1; }
.bar-detail .lrow { padding: 8px 4px; }
button.lrow { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.lrow:hover { background: rgba(255, 255, 255, .5); }
.seg button { font-size: .82rem; padding: 4px 12px; min-height: 32px; }

/* ---------- peak-hours heatmap (one hue, light to dark) */
.heat-grid { display: grid; grid-template-columns: 34px repeat(var(--cols), minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat-grid .hh { font-size: .66rem; color: var(--muted); text-align: left; }
.heat-grid .hd { font-size: .74rem; color: var(--ink-2); font-weight: 600; }
.hc { display: block; width: 100%; aspect-ratio: 1.25; min-height: 18px; border-radius: 5px; border: 0; padding: 0; background: rgba(70, 52, 34, .06); cursor: pointer; }
.hc.l1 { background: #f0d9c6; } .hc.l2 { background: #e2b592; } .hc.l3 { background: #cf8f62; } .hc.l4 { background: #b0683c; } .hc.l5 { background: #7c4421; }
.hc:hover, .hc:focus-visible { outline: 2px solid #1f1c18; outline-offset: 1px; }
.heat-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-top: 10px; min-height: 20px; }
.heat-key { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.heat-key .hc { display: inline-block; width: 14px; min-height: 0; height: 12px; aspect-ratio: auto; cursor: default; }

/* ---------- products */
.prow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 16px; text-decoration: none; color: inherit; border-top: 1px solid rgba(70, 52, 34, .08); }
.prow:first-child { border-top: 0; } .prow:hover { background: rgba(255, 255, 255, .45); }
.prow .thumb { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 2px 8px rgba(60, 40, 20, .12); }
.p-main { display: flex; flex-direction: column; min-width: 0; }
.p-main .l-title { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-main .l-sub { font-size: .78rem; color: var(--muted); }
.p-main .track { height: 5px; background: rgba(70, 52, 34, .1); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.p-main .fill { display: block; height: 100%; background: var(--m-profit); border-radius: 3px; transition: width .4s ease; }
.p-side { text-align: right; font-size: .84rem; white-space: nowrap; }

/* ---------- new sale highlight, branch switch */
.new-tag { font-size: .64rem; font-weight: 750; letter-spacing: .4px; text-transform: uppercase; color: #fff; background: var(--m-profit); border-radius: 4px; padding: 1px 5px; vertical-align: 1px; }
tr.row-new { animation: row-new 2.6s ease-out 1; }
@keyframes row-new { 0% { background: rgba(214, 138, 88, .42); } 100% { background: transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dash.branch-switch > * { animation: rise .34s ease-out both; }
.dash.branch-switch > *:nth-child(4) { animation-delay: .04s; } .dash.branch-switch > *:nth-child(5) { animation-delay: .08s; }
.dash.branch-switch > *:nth-child(6) { animation-delay: .12s; } .dash.branch-switch > *:nth-child(n+7) { animation-delay: .16s; }

/* ---------- Cash on Hand dialog */
.cash-total { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: flex-end; justify-content: space-between; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .85), rgba(246, 239, 223, .7)); border: 1px solid var(--line); }
.ct-val { font-size: 1.7rem; font-weight: 750; letter-spacing: -.3px; } .ct-note { max-width: 300px; }
.cash-drawer { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .5); display: grid; gap: 8px; }
.cd-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.cd-bal { text-align: right; display: grid; } .cd-bal b { font-size: 1.2rem; }
.cd-formula { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 10px; font-size: .86rem; }
.cd-formula span { display: grid; } .cd-formula i { font-style: normal; font-size: .72rem; color: var(--muted); } .cd-formula .op { font-weight: 700; color: var(--muted); padding-bottom: 1px; }
.cd-moves summary { cursor: pointer; font-size: .82rem; color: var(--gold-ink); font-weight: 600; }
.cd-moves .lrow { padding: 6px 0; } .cd-moves .in { color: var(--ok); } .cd-moves .out { color: var(--bad); }
.cd-count { font-size: .84rem; padding: 8px 10px; border-radius: 10px; background: rgba(246, 239, 223, .7); }
.cd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cash-form { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(176, 105, 60, .45); border-radius: 14px; background: rgba(255, 255, 255, .75); }
.ok-note { border-color: rgba(44, 122, 75, .4); background: var(--ok-soft); margin-bottom: 10px; }
.modal:has([data-testid="cash-modal"]) { max-width: 720px; }

@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-attn { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .hero-grid { gap: 8px; }
  .hero { padding: 11px 12px 10px; min-height: 0; box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 6px 16px rgba(60, 40, 20, .1); }
  .hero.m-cash { grid-column: 1 / -1; }
  .h-value { font-size: 1.3rem; } .h-label { font-size: .74rem; } .h-sub, .h-delta { font-size: .74rem; }
  .spark { width: 64px; height: 24px; }
  .hero .help { display: none; }
  .dash-status { justify-content: flex-start; }
  .prow { padding: 8px 12px; } .heat-grid { gap: 2px; grid-template-columns: 30px repeat(var(--cols), minmax(0, 1fr)); }
  .hc { min-height: 16px; border-radius: 4px; }
  .cd-head { flex-direction: column; } .cd-bal { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .hero, .p-main .fill, .live-chart .bar { transition: none; }
  .hero:hover, .hero:focus-visible { transform: none; }
  .hero.changed, tr.row-new, .bar-detail, .dash.branch-switch > * { animation: none; }
  .hero.changed { outline: 2px solid var(--m-profit); }
}
@media (prefers-reduced-transparency: reduce) { .hero { background: #fbf7f1; } .hero::before { display: none; } }

.modal td.r, .cd-formula b { white-space: nowrap; }

/* ======================================================================================================
   v1.3.1 – clearly frosted glass. A richer warm backdrop (so the blur has something to show), more transparent
   cards with a bright rim and an inner highlight, deeper soft shadows, a dark-glass Cash on Hand tile, and a
   visible build chip. Colours and surfaces only; text stays dark on light glass (white on the dark tile).
   ====================================================================================================== */
:root { --surface: rgba(255, 251, 245, .42); --surface-2: rgba(255, 255, 255, .34); --line: rgba(255, 255, 255, .72);
  --muted: #564d44; --ink-2: #352f29;
  --glass-blur: blur(26px) saturate(170%);
  --shadow: 0 1px 0 rgba(255, 255, 255, .85) inset, 0 -1px 0 rgba(120, 84, 54, .08) inset, 0 18px 44px rgba(74, 46, 22, .18), 0 2px 6px rgba(74, 46, 22, .10); }
html, body { background:
    radial-gradient(46vw 44vw at 6% 2%, rgba(255, 255, 255, .92), transparent 62%),
    radial-gradient(48vw 42vw at 96% 6%, rgba(214, 122, 66, .62), transparent 66%),
    radial-gradient(40vw 40vw at 58% 40%, rgba(247, 214, 176, .75), transparent 68%),
    radial-gradient(46vw 44vw at 86% 82%, rgba(122, 82, 50, .58), transparent 64%),
    radial-gradient(48vw 44vw at 8% 92%, rgba(190, 142, 92, .66), transparent 66%),
    radial-gradient(30vw 28vw at 34% 66%, rgba(232, 168, 120, .45), transparent 70%),
    linear-gradient(155deg, #f3e8da 0%, #e2cdb3 52%, #cbac88 100%) fixed; background-color: #e2cdb3; }
.card, .sidebar, .topbar, .bottombar, .scan-card {
  background-color: var(--surface);
  background-image: linear-gradient(140deg, rgba(255, 255, 255, .62) 0%, rgba(255, 255, 255, .14) 38%, rgba(255, 255, 255, 0) 62%);
  border: 1px solid rgba(255, 255, 255, .72); }
.card-head { border-bottom: 1px solid rgba(255, 255, 255, .6); box-shadow: 0 1px 0 rgba(120, 84, 54, .08); }
.modal, .sheet, .login-card { background-color: rgba(255, 250, 244, .9); background-image: linear-gradient(140deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 55%); }
.modal .m-head { background: rgba(255, 250, 244, .96); }
.lrow { border-top-color: rgba(120, 84, 54, .12); }
.t th { background: rgba(255, 255, 255, .3); }
.kpi .k-value, .h-value { text-shadow: 0 1px 0 rgba(255, 255, 255, .55); }
.kpi { transition: transform .18s ease, box-shadow .18s ease, border-color .15s; }
a.kpi:hover { transform: translateY(-2px); }

/* headline tiles: glassier, bigger figures; Cash on Hand is the dark tile */
.hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
.hero { background: rgba(255, 252, 247, .36); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, .8); border-radius: 20px; padding: 16px 18px 14px; min-height: 150px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 22px 48px rgba(74, 46, 22, .2), 0 3px 8px rgba(74, 46, 22, .1); }
.hero::before { background: linear-gradient(140deg, rgba(255, 255, 255, .75) 0%, rgba(255, 255, 255, .18) 40%, rgba(255, 255, 255, 0) 66%); }
.hero::after { height: 4px; left: 18px; right: auto; width: 44px; top: 0; }
.h-value { font-size: 2rem; letter-spacing: -.6px; }
.hero.m-cash { background: rgba(33, 27, 21, .78); border-color: rgba(255, 255, 255, .22); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 24px 52px rgba(40, 24, 10, .38), 0 3px 8px rgba(40, 24, 10, .2); --accent: #e9b872; }
.hero.m-cash::before { background: linear-gradient(140deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, .04) 42%, rgba(255, 255, 255, 0) 66%); }
.hero.m-cash .h-value { color: #fff; text-shadow: none; font-size: 2.15rem; }
.hero.m-cash .h-label, .hero.m-cash .h-sub, .hero.m-cash .h-delta, .hero.m-cash .h-split i { color: rgba(255, 255, 255, .82); }
.hero.m-cash .h-split { border-top-color: rgba(255, 255, 255, .2); } .hero.m-cash .h-split b { color: #fff; }
.hero.m-cash .kind.now { color: #2a2016; background: #e9b872; }
.hero.m-cash .help { color: #fff; border-color: rgba(255, 255, 255, .5); background: transparent; }
.hero.m-cash .bad-text { color: #ffb4a8; } .hero.m-cash .warn-text { color: #f3cf8e; }
.hero.m-cash .spark .sp-dot { stroke: #211b15; }
.hero.m-cash:hover, .hero.m-cash:focus-visible { border-color: rgba(233, 184, 114, .7); }
.hero.m-cash.changed { animation: cash-flash 1.5s ease-out 1; }
@keyframes cash-flash { 0% { box-shadow: 0 0 0 3px rgba(233, 184, 114, .8), 0 24px 52px rgba(40, 24, 10, .38); } 100% { box-shadow: 0 0 0 0 rgba(233, 184, 114, 0), 0 24px 52px rgba(40, 24, 10, .38); } }
.cash-cta { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: .76rem; font-weight: 700; color: #2a2016; background: #e9b872; border-radius: 999px; padding: 3px 10px; align-self: flex-start; }
.attn-card { background-color: rgba(255, 248, 240, .5); border-color: rgba(255, 255, 255, .8); }
.live-chart .grid-line { stroke: rgba(70, 52, 34, .14); }
.bar-detail, .cash-drawer, .unavail { background: rgba(255, 255, 255, .5); }

/* build chip */
.build-chip { font: inherit; font-size: .7rem; font-weight: 700; letter-spacing: .3px; color: var(--ink-2); background: rgba(255, 255, 255, .6);
  border: 1px solid rgba(70, 52, 34, .18); border-radius: 999px; padding: 2px 9px; cursor: pointer; white-space: nowrap; }
.build-chip.stale { color: #fff; background: var(--bad); border-color: var(--bad); }
.login-card .build-chip { display: inline-block; margin: 6px 0 0 6px; cursor: default; }

@media (max-width: 1100px) { .hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { :root { --glass-blur: blur(14px) saturate(150%); } }
@media (max-width: 760px) {
  .hero-grid { gap: 9px; } .hero { padding: 12px 13px 11px; min-height: 0; border-radius: 16px; }
  .h-value { font-size: 1.35rem; } .hero.m-cash .h-value { font-size: 1.7rem; }
  .hero.m-cash { grid-column: 1 / -1; order: -1; }
  .build-chip { font-size: .64rem; padding: 1px 7px; }
}
@media (prefers-reduced-motion: reduce) { .kpi, a.kpi:hover { transition: none; transform: none; } .hero.m-cash.changed { animation: none; outline: 2px solid #e9b872; } }
@media (prefers-reduced-transparency: reduce) {
  .hero { background: #fbf7f1; -webkit-backdrop-filter: none; backdrop-filter: none; } .hero.m-cash { background: #211b15; }
  .card, .sidebar, .topbar, .bottombar { background-image: none; }
}
@media (max-width: 760px) {
  .h-top { flex-wrap: wrap; row-gap: 2px; } .h-label { white-space: normal; }
  .hero:not(.m-cash) .spark { flex: 1 0 100%; width: 100%; height: 22px; order: 3; }
  .hero.m-bottles { grid-column: 1 / -1; }
}
