/* dashboard styles. Brand tokens and the report's components (.card, .ot tables, .chip, .tabs, .ramp, .ns) come from theme.css. */
.dwrap{max-width:1280px;margin:0 auto;padding:16px 16px 56px}
.dtop .dlogo svg{height:34px;width:auto;display:block}
.dtop h1{margin:0;font-size:22px;color:var(--brand);line-height:1.1;white-space:nowrap}
.dbar{position:sticky;top:0;z-index:6;background:var(--bg);padding:8px 0 6px;margin:0 -4px;border-bottom:1px solid var(--rule)}
.dctl{display:grid;grid-template-columns:1.2fr 1fr 1.2fr;gap:8px;padding:0 4px}
.dctl label{display:flex;flex-direction:column;gap:3px;font-size:11px;color:var(--muted);font-weight:600;letter-spacing:.03em;text-transform:uppercase}
.dctl select,.dctl input{font:inherit;font-size:14px;color:var(--ink);background:var(--surface);border:1px solid var(--rule);border-radius:10px;padding:9px 10px;width:100%;min-width:0;text-transform:none;letter-spacing:0;font-weight:500}
#custom{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:8px 4px 0}
#custom[hidden]{display:none}
.dbar .tabs{position:static;margin:8px 4px 0;box-shadow:none}
#ptext{margin:8px 4px 0;font-size:12px;color:var(--muted)}
.dsec{margin:22px 0 0}
.dsec>h2{margin:0 4px 4px;font-size:19px}
.dtiles{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin:16px 0 0}
.dt{background:var(--surface);border:1px solid var(--rule);border-radius:16px;padding:14px 14px 12px;display:flex;flex-direction:column;gap:4px}
.dtn{font-size:12px;font-weight:600;color:var(--muted);letter-spacing:.02em}
.dtv{font-size:24px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums}
.dts{font-size:12px;color:var(--muted)}
.dtx{font-size:11px;color:var(--muted)}
.dtd{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.dd{display:inline-flex;align-items:baseline;gap:4px;font-size:13px;font-weight:700;border-radius:8px;padding:2px 8px;background:color-mix(in srgb,var(--track) 70%,var(--surface));font-variant-numeric:tabular-nums}
.dd small{font-size:10px;font-weight:600;color:var(--muted)}
.dd.up{background:var(--upbg);color:var(--up)}
.dd.down{background:var(--downbg);color:var(--down)}
.upc{color:var(--up)} .downc{color:var(--down)} .flatc{color:inherit}
/* charts */
.dch{display:flex;flex-direction:column;gap:4px}
.dchb{position:relative;display:flex;align-items:flex-end;gap:2px;height:170px}
.dchb i{flex:1;background:var(--darkfill);opacity:.82;border-radius:3px 3px 0 0;min-width:2px}
.dchb i.l{background:var(--brand);opacity:1}
.dchb svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}
/* comparison line (Oct 16): solid gold with a dark outline and a dot per point, readable on the bars in both themes */
.dchb polyline{fill:none;stroke-linejoin:round;stroke-linecap:round}
.dchb polyline.lyh{stroke:var(--ink);stroke-width:6;opacity:.55}
.dchb polyline.lyl{stroke:var(--highlight);stroke-width:3}
.dchb line.lyd{stroke:var(--highlight);stroke-width:9;stroke-linecap:round}
.dchl{display:flex;gap:2px}
.dchl span{flex:1;font-size:10px;color:var(--muted);text-align:center;white-space:nowrap;overflow:visible}
.dhb{display:flex;flex-direction:column;gap:10px}
.dhr{display:grid;grid-template-columns:minmax(0,1.2fr) 1fr 72px 64px;gap:8px;align-items:center;font-size:13px}
.dhn{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dht{height:10px;background:var(--track);border-radius:6px;overflow:hidden}
.dht span{display:block;height:100%;background:var(--brand);border-radius:6px}
.dhv{text-align:right;font-weight:700;font-variant-numeric:tabular-nums}
.dhv small{display:block;font-size:10px;font-weight:500;color:var(--muted)}
.ddv{display:flex;gap:4px;align-items:stretch}
.ddc{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;min-width:0}
.ddl{font-size:10px;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
.ddb{position:relative;width:100%;height:120px}
.ddb b{position:absolute;left:0;right:0;top:50%;border-top:1px solid var(--rule)}
.ddb i{position:absolute;left:18%;right:18%;border-radius:3px}
.ddb i.g{background:var(--up)} .ddb i.r{background:var(--down)}
.ddx{font-size:10px;color:var(--muted);text-align:center;line-height:1.2}
.ddx small{display:block;font-size:9px}
.dgrid2{display:grid;grid-template-columns:1fr;gap:0 16px}
.dfacts{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-top:12px}
.dfacts small{display:block;font-size:11px;color:var(--muted)}
.dfacts b{font-size:14px}
.dlist>div{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--rule);font-size:14px}
.dlist>div:last-child{border-bottom:0}
.dlist small{color:var(--muted);font-size:11px;margin-left:6px}
.dlist b{text-align:right;font-weight:600}
.dwcard{display:grid;grid-template-columns:1fr;gap:0}
.dwc{padding:12px 0;border-bottom:1px solid var(--rule)}
.dwc:last-child{border-bottom:0}
.dwt{display:flex;justify-content:space-between;font-size:16px}
.dwm{display:flex;align-items:center;gap:8px;margin-top:6px}
.spk{display:inline-flex;align-items:flex-end;gap:2px;height:24px;margin-left:auto}
.spk i{width:6px;background:var(--darkfill);opacity:.6;border-radius:1px}
.spk i.l{background:var(--brand);opacity:1}
.slink{color:inherit;font-weight:600;text-decoration:underline;text-decoration-color:var(--rule);text-underline-offset:3px}
.dtab td small{display:block;font-size:11px;color:var(--muted)}
.placeholder{border-style:dashed;background:transparent}
.placeholder p{margin:0;font-size:14px;color:var(--muted)}
.dform{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:12px}
.dform input,.dform select{font:inherit;font-size:14px;padding:8px 10px;border:1px solid var(--rule);border-radius:10px;background:var(--surface);color:var(--ink)}
.dform label{display:flex;align-items:center;gap:6px;font-size:13px}
.dform.dred{display:grid;grid-template-columns:1fr;gap:10px}
.dform.dred label{justify-content:space-between}
.dform.dred input{width:110px}
.dform label.wide{flex:1 1 100%;flex-direction:column;align-items:stretch}
.btn{font:inherit;font-weight:600;font-size:14px;border:0;border-radius:10px;padding:9px 14px;background:var(--brand);color:#fff;cursor:pointer}
.dmsg{font-size:13px;color:var(--muted);margin:8px 0 0;min-height:1em}
#status{margin:16px 0}
details.card summary{cursor:pointer;font-size:15px}
@media (min-width:720px){
  .dtiles{grid-template-columns:repeat(4,1fr)}
  .dtiles.d3{grid-template-columns:repeat(3,1fr)}
  .dfacts{grid-template-columns:repeat(4,1fr)}
  .dform.dred{grid-template-columns:1fr 1fr}
}
@media (min-width:1000px){
  .dwrap{padding:22px 32px 64px}
  .dtiles{grid-template-columns:repeat(7,1fr)}
  .dtiles.d3{grid-template-columns:repeat(3,1fr)}
  .dgrid2{grid-template-columns:1fr 1fr}
  .dwcard{grid-template-columns:1fr 1fr;column-gap:40px}
  .dchb{height:220px}
  .dtv{font-size:22px}
}
@media (max-width:640px){
  .dctl{grid-template-columns:1fr 1fr}
  .dctl label:last-child{grid-column:1 / -1}
  .dtop h1{font-size:18px}
  .dhr{grid-template-columns:minmax(0,1fr) 70px 60px;}
  .dhr .dht{display:none}
  .dtv{font-size:20px}
}
@media print{
  .dbar .tabs,.dctl,#custom,.ctltoggle,.dform,.btn,.dfoot,.gear,.snapbtn{display:none!important}
  .dbar{position:static;border:0}
  .dtiles{grid-template-columns:repeat(4,1fr)!important}
  .dchb{height:140px}
}
@media (max-width:640px){
    }
/* column alignment (Oct 16): numbers right, words left, the header follows its column (app.js alignColumns); .card th would otherwise left-align every header */
.ot td.tl{white-space:normal;min-width:90px}
.ot td.wx{min-width:160px}
.card .ot.heat th,.ot.heat td{text-align:center;min-width:56px;font-weight:600}
.card .ot.heat tbody th,.card .ot.heat thead th:first-child{text-align:left}
/* Ops grid numbers open their detail */
.ot a.jmp{color:inherit;text-decoration:underline dotted;text-underline-offset:3px}
.ot a.jmp:hover,.ot a.jmp:focus-visible{text-decoration-style:solid}
.dsec.flash>h2{color:var(--brand)}
.dsec{scroll-margin-top:calc(var(--dbar-h,0px) + 78px)}
/* Drill-down back bar (Oct 16): stays under the sticky controls while you read the store's detail */
.backbar{position:sticky;top:calc(var(--dbar-h,0px) + env(safe-area-inset-top,0px) + 8px);z-index:5;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin:12px 0 0;padding:10px 14px;border:1px solid var(--brand);border-radius:12px;background:color-mix(in srgb,var(--brand) 8%,var(--surface));font-size:14px}
.backbar .backbtn{font-weight:700}
.dlist.behind>div{flex-direction:column;align-items:flex-start;gap:2px}
/* Weekly snapshot button in the header (Oct 16) */
.dhr{padding-right:6px}
.dt{padding-right:16px}

/* Header (Oct 16): logo + actions on one row, title and data date underneath; who / sign out / print live in the footer; Admin is a gear */
.dtop{display:grid;grid-template-columns:auto 1fr;grid-template-areas:"logo act" "title title";align-items:center;gap:10px 12px;margin:0 0 10px}
.dtop .dlogo{grid-area:logo}
.dtop .dact{grid-area:act;display:flex;justify-content:flex-end;align-items:center;gap:8px;min-width:0}
.dtop .dtitle{grid-area:title;display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;min-width:0}
.dtop .dthru{font-size:12px;color:var(--muted)}
.dtop .snapbtn{display:inline-block;padding:8px 14px;font-size:13px;border-radius:999px;text-decoration:none;white-space:nowrap}
.gear{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:999px;border:1px solid var(--rule);background:var(--surface);color:var(--muted);cursor:pointer}
.gear[hidden]{display:none}
.gear[aria-pressed="true"]{color:#fff;background:var(--brand);border-color:var(--brand)}
.gear:focus-visible{outline:3px solid var(--highlight);outline-offset:2px}
@media (min-width:900px){.dtop{grid-template-columns:auto 1fr auto;grid-template-areas:"logo title act"}}
.dfoot{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:10px 22px;margin:40px 0 0;padding:18px 0 4px;border-top:1px solid var(--rule);font-size:13px;color:var(--muted)}
.dfoot a{color:var(--muted);padding:8px 2px}
.dfoot .prl a{padding:8px 4px}
/* Admin people list (Oct 16): one line per person, tap to change */
.people{display:flex;flex-direction:column}
.person{border-bottom:1px solid var(--rule)}
.person:last-child{border-bottom:0}
.person summary{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 12px;padding:12px 4px;cursor:pointer;list-style:none}
.person summary::-webkit-details-marker{display:none}
.person summary::after{content:"Edit";font-size:12px;font-weight:600;color:var(--brand);margin-left:auto}
.person[open] summary::after{content:"Close"}
.person .pn{display:flex;flex-direction:column;min-width:0}
.person .pn small{color:var(--muted);font-size:12px;overflow-wrap:anywhere}
.person .pc{display:flex;flex-wrap:wrap;gap:6px}
.person .pform{display:flex;flex-wrap:wrap;align-items:end;gap:10px 16px;padding:4px 4px 14px}
.person .pform label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--muted);font-weight:600}
.person .pform label.ck{flex-direction:row;align-items:center;gap:6px;font-size:14px;color:var(--ink);font-weight:500;padding-bottom:8px}
.person .pform select{font:inherit;font-size:14px;padding:8px 10px;border:1px solid var(--rule);border-radius:10px;background:var(--surface);color:var(--ink)}
@media (max-width:640px){.dbar{position:static}} /* Oct 16: the controls took ~40% of a phone screen when sticky */
/* Collapsible controls (Oct 16) */
.ctltoggle{display:flex;width:calc(100% - 8px);margin:0 4px 8px;align-items:center;justify-content:space-between;gap:10px;font:inherit;font-size:13px;color:var(--ink);background:var(--surface);border:1px solid var(--rule);border-radius:10px;padding:9px 12px;cursor:pointer;text-align:left}
.ctltoggle .ctlv{color:var(--brand);font-weight:700;white-space:nowrap}
.ctltoggle:focus-visible{outline:3px solid var(--highlight);outline-offset:2px}
#ctlwrap[hidden]{display:none}
/* Admin view: only its own actions and a way back (Oct 16) */
body.adminmode .dbar{display:none}
.adminback{margin:12px 4px 0}
.adminback .btn{display:inline-block}
@media (max-width:640px){
  .backbar{flex-wrap:nowrap;gap:8px;padding:6px 8px 6px 12px;font-size:13px;border-radius:10px;box-shadow:0 2px 10px rgba(0,0,0,.12)}
  .backbar span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .backbar .backbtn{padding:7px 10px;font-size:13px;white-space:nowrap}
}
.backbar .bw{font-style:normal}
@media (max-width:640px){.backbar .bw{display:none}}
/* Daily red flags settings (Oct 16) */
.dstd fieldset{border:1px solid var(--rule);border-radius:12px;padding:10px 12px 12px;margin:4px 0 0;display:flex;flex-wrap:wrap;gap:10px 16px;align-items:end;width:100%;box-sizing:border-box}
.dstd legend{font-weight:700;font-size:13px;padding:0 4px;color:var(--ink)}
.dstd .ckrow{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;width:100%}
.dstd .ckrow>span{font-size:12px;color:var(--muted);font-weight:600;width:100%}
.dstd label.ck{display:flex;flex-direction:row;align-items:center;gap:6px;font-size:14px;color:var(--ink)}

/* demo mode label (demo-api.js) */
.demo-flag{position:sticky;top:0;z-index:50;text-align:center;font-size:12px;font-weight:600;letter-spacing:.04em;padding:6px 12px;background:var(--highlight);color:var(--ink)}
