:root{color-scheme:light;--brand:#087563;--brand-soft:#edf8f4;--canvas:#f5f7f8;--text:#111827;--muted:#7a8593;--border:#e6e9ed;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;background:var(--canvas);color:var(--text);-webkit-text-size-adjust:100%}
[hidden]{display:none!important}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button,a{touch-action:manipulation}button{cursor:pointer}button:disabled{opacity:.4;cursor:default}a{color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
button{border:1px solid var(--border);background:white;border-radius:12px;min-height:44px;padding:9px 12px;color:inherit;line-height:1.4}
h1,h2,h3,p{margin:0}h2{font-size:16px;line-height:1.4}h3{font-size:14px;line-height:1.5}small,.muted{color:var(--muted)}
input,select,textarea{border:1px solid var(--border);border-radius:10px;padding:10px;max-width:100%;min-width:0;background:white;color:inherit;min-height:44px;font-size:16px}label{display:grid;gap:7px}.primary{color:white;background:var(--brand);border-color:var(--brand)}
#workspace{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:10px;background:white;border-bottom:1px solid var(--border);padding:calc(9px + env(safe-area-inset-top)) 12px 9px}
#workspace img{width:40px;height:40px;flex:none;border-radius:10px}
#store-switch{position:relative;display:grid;text-align:left;gap:2px;min-width:0;max-width:calc(100vw - 126px);padding:7px 36px 7px 12px;background:var(--brand-soft);border-color:color-mix(in srgb,var(--brand) 25%,white);border-radius:15px}
#store-switch small{font-size:10px;font-weight:600}#store-switch b{font-size:17px;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#store-switch span{position:absolute;right:12px;top:50%;transform:translateY(-50%)}
#app-status{font-size:10px;min-height:26px;padding:4px 13px;color:var(--muted);background:white;line-height:1.8}#app-status.warning{color:#9a5c13;background:#fff8eb}#app-status.error{color:#b91c1c;background:#fef2f2}#app-status button{min-height:22px;padding:0 6px;font-size:10px;border:0;background:transparent;color:var(--brand)}
main{max-width:650px;margin:auto;padding:12px 12px calc(100px + env(safe-area-inset-bottom));min-height:calc(100dvh - 120px);overflow-wrap:anywhere}
.card{background:white;border:1px solid var(--border);border-radius:16px;padding:13px;margin-bottom:14px;min-width:0}
.toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 12px}.toolbar button{font-size:12px;flex:none}.toolbar h2{flex:1;min-width:0}
.today-toolbar{display:grid;grid-template-columns:44px minmax(0,1fr)74px 42px 44px;gap:5px}.today-toolbar button{padding:4px;min-height:42px;font-size:11px}.today-toolbar h2{font-size:15px;white-space:nowrap}.today-toolbar .day-step{font-size:10px}.day-step{display:grid;align-content:center;line-height:1.4;text-align:center;font-size:10px}.day-step i{font-style:normal;font-size:18px;line-height:16px}
.day-input{position:relative;display:grid;place-items:center;height:42px;border:1px solid var(--border);border-radius:12px;background:white;font-size:12px;white-space:nowrap}.day-input input{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer;padding:0;min-height:0}
/* Fixed label/value/comparison slots keep all KPI cards equal, including missing comparisons. */
.metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin-bottom:16px}
.metric{display:grid;grid-template-rows:18px 30px 16px;align-content:center;gap:3px;border:1px solid var(--border);border-radius:14px;padding:8px;text-align:left;height:96px;min-width:0;container-type:inline-size}
.metric small{display:block;font-size:11px;line-height:18px;white-space:nowrap}.metric strong{display:block;align-self:center;color:var(--brand);font-size:clamp(10px,calc(145cqw / var(--metric-digits,9)),22px);line-height:1.2;font-weight:800;white-space:nowrap;font-variant-numeric:tabular-nums;letter-spacing:-.3px}
.metric em{display:block;font-size:10px;line-height:16px;font-style:normal;color:var(--muted);white-space:nowrap}.metric .down{color:#b91c1c}.metric .up{color:var(--brand)}
.pills{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:5px;margin:10px 0}.pills button{min-width:0;min-height:36px;font-size:11px;padding:6px 4px;white-space:nowrap}.pills .active{background:var(--brand-soft);color:var(--brand);border-color:var(--brand);font-weight:700}
.category-row{display:block;width:100%;border-radius:14px;margin:8px 0;padding:10px;text-align:left}.category-row:last-child{margin-bottom:0}.category-head{display:flex;align-items:baseline;gap:5px;font-size:11px;flex-wrap:wrap}.category-head b{font-size:14px;margin-right:auto;min-width:0;overflow-wrap:anywhere}.category-head strong{font-size:13px;white-space:nowrap;font-variant-numeric:tabular-nums}.category-head em{font-style:normal;font-size:10px;color:var(--muted);white-space:nowrap}.category-head small{white-space:nowrap}.category-head .chevron{font-size:10px;color:var(--brand);margin-left:auto;white-space:nowrap}.track{height:6px;background:#f0f3f6;border-radius:5px;margin-top:9px;overflow:hidden}.track i{display:block;height:100%;background:var(--brand);border-radius:5px}
.chart-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}.chart-header h2{min-width:0}.chart-header button{font-size:12px;min-height:36px;padding:5px 10px;flex:none}.legend{display:flex;gap:7px;font-size:10px;white-space:nowrap;color:var(--muted)}.legend i{display:inline-block;border-radius:50%;width:7px;height:7px;margin-right:3px;background:var(--brand)}.legend .prior{background:#94a3b8}.chart{width:100%;height:auto;display:block;overflow:visible}.chart [role=button]{cursor:pointer}.chart [role=button]:focus{outline:none;stroke:#111827;stroke-width:1}.analysis{display:flex;justify-content:flex-end;margin-top:0}.analysis button{color:var(--brand);border-color:var(--brand);border-radius:24px;font-weight:750;padding:10px 20px}
#navigation{position:fixed;bottom:0;left:0;right:0;z-index:25;display:flex;justify-content:center;gap:2px;padding:6px 8px calc(7px + env(safe-area-inset-bottom));background:white;border-top:1px solid var(--border)}#navigation button{display:flex;flex:1;min-width:0;max-width:130px;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:5px 2px;border:0;border-radius:15px;color:var(--muted);font-size:12px;min-height:56px}#navigation svg{width:24px;height:24px}#navigation .active{color:var(--brand);background:var(--brand-soft);font-weight:750}
.tools{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px 8px;padding-top:14px}.tools button{display:grid;grid-template-rows:40px 34px;justify-items:center;align-content:start;gap:8px;padding:2px 0;border:0;background:transparent;font-size:11px;line-height:17px;min-width:0;min-height:86px}.tools .icon{display:grid;place-items:center;border-radius:11px;background:#eef4ff;color:#3377ef;width:40px;height:40px}.tools svg{width:24px;height:24px}.tools.teal .icon{background:#e8faf8;color:#13b7b7}.tools.violet .icon{background:#f0eeff;color:#7a69ff}.tools button>span:last-child{max-width:100%;text-align:center;overflow-wrap:anywhere}
.list{border:1px solid var(--border);border-radius:15px;background:white;overflow:hidden;margin-bottom:14px}.row{display:flex;width:100%;gap:10px;align-items:center;min-height:56px;padding:14px;text-align:left;border:0;border-radius:0;border-bottom:1px solid var(--border);font-size:13px}.row:last-child{border-bottom:0}.row>.grow{flex:1;min-width:0;overflow-wrap:anywhere}.row strong{font-size:14px}.row .arrow{color:var(--muted);flex:none}.row small{display:block;font-size:11px;margin-top:4px}.row svg{width:20px;height:20px;flex:none;color:var(--muted)}
.profile{display:flex;align-items:center;gap:12px}.profile .avatar{border-radius:50%;background:var(--brand-soft);color:var(--brand);padding:13px;flex:none}.profile svg{width:25px;height:25px;display:block}.profile h2{font-size:17px;overflow-wrap:anywhere}.profile small{display:block;margin-top:4px}
.empty{padding:45px 15px;text-align:center;color:var(--muted);font-size:13px;line-height:1.8}.center-message{min-height:calc(100dvh - 225px);display:flex;flex-direction:column;justify-content:center}.center-message .empty{padding:0 15px 16px}.send{display:flex;justify-content:center;margin-top:16px}.send button{min-width:120px;color:var(--brand)}.message{width:100%;text-align:left;padding:14px}.message h3{display:flex;align-items:baseline;gap:6px;overflow-wrap:anywhere}.message .dot{width:6px;height:6px;flex:none;border-radius:50%;background:#ef4444}.message p{margin-top:8px;font-size:12px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere}.message small{display:block;margin-top:5px;font-size:10px}
.search{display:flex;gap:8px;margin:0 0 12px}.search input{width:100%;min-width:0}.search button{flex:none}.pagination{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;padding:8px 0}.pagination span{min-width:0;text-align:center}.report-groups h3{color:var(--muted);margin:16px 0 8px}.report-groups h3:first-child{margin-top:0}.date-range{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;font-size:11px;margin-bottom:12px}.date-range input{width:100%;font-size:13px}
.data-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0}.data-summary>div{display:flex;flex-direction:column;justify-content:space-between;gap:5px;border-radius:10px;padding:10px;background:var(--brand-soft);font-size:11px;min-height:64px;min-width:0}.data-summary b{display:block;font-size:16px;line-height:1.4;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.data-row{padding:14px 0;border-bottom:1px solid var(--border)}.data-row:last-child{border-bottom:0}.data-row h3{margin-bottom:10px;overflow-wrap:anywhere}.data-row dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0;font-size:12px;line-height:1.5}.data-row dl>div{min-width:0}.data-row dt{color:var(--muted);margin-bottom:3px}.data-row dd{margin:0;overflow-wrap:anywhere}
.hint{font-size:11px;color:var(--muted);line-height:1.6;margin:10px 0}.error-text{font-size:12px;color:#b91c1c;line-height:1.7}.form{display:grid;gap:14px;font-size:13px}.checkboxes{display:grid;gap:6px;max-height:210px;overflow:auto}.checkboxes label{display:flex;align-items:center;gap:8px;padding:5px}.checkboxes input{min-height:0;flex:none}.password-form input{width:100%}
dialog{position:fixed;inset:auto 0 0;width:100%;max-width:650px;max-height:88dvh;margin:0 auto;padding:0;border:1px solid var(--border);border-radius:23px 23px 0 0;background:white;color:inherit;overflow:auto;padding-bottom:env(safe-area-inset-bottom)}dialog::backdrop{background:#11182766;backdrop-filter:blur(3px)}dialog>header{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;background:white;padding:12px 14px;border-bottom:1px solid var(--border)}dialog>header h2{min-width:0;overflow-wrap:anywhere}dialog>header button{font-size:22px;padding:0;min-height:40px;width:40px;flex:none}#detail-content{padding:14px;min-height:100px;overflow-wrap:anywhere}.breadcrumbs{display:flex;align-items:center;gap:4px;flex-wrap:wrap;margin-bottom:12px}.breadcrumbs button{font-size:11px;min-height:36px;padding:5px 8px}.selected-store{background:var(--brand-soft);color:var(--brand)}
@media(min-width:651px){#workspace{justify-content:center}main{padding-top:18px}}
@media(max-width:350px){.today-toolbar{grid-template-columns:42px minmax(0,1fr)70px 38px 42px;gap:4px}.today-toolbar h2{font-size:14px}.chart-header h2{font-size:14px}.category-head{gap:4px}.category-head strong{font-size:12px}.category-head .chevron{font-size:9px}}
@media(prefers-reduced-motion:no-preference){button:active{transform:translateY(1px)}}

#header-refresh{margin-left:auto;width:44px;flex:none;font-size:22px;padding:0;color:var(--brand)}
.calendar-scroller{max-height:350px;overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none}.calendar-scroller:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}.calendar-load{font-size:10px;color:var(--muted);padding-top:5px}.calendar-load button{font-size:10px;min-height:25px;padding:2px 6px}.calendar-layout.is-expanded .sales-calendar{flex:1;min-height:0;display:flex;flex-direction:column}.calendar-layout.is-expanded .calendar-scroller{flex:1;min-height:0;max-height:none}.calendar-layout.is-expanded .calendar-header,.calendar-layout.is-expanded .calendar-weekdays{flex:none}
.calendar-layout.is-expanded{height:var(--calendar-height);display:flex;flex-direction:column;gap:10px}.calendar-layout.is-expanded>.card{margin-bottom:0}.calendar-layout.is-expanded .sales-calendar{flex:1;min-height:0;display:flex;flex-direction:column;padding:10px}.calendar-layout.is-expanded .calendar-day{padding:2px 1px;gap:2px}.calendar-layout.is-expanded .calendar-day span{font-size:11px}.calendar-layout.is-expanded .calendar-week-open{min-height:24px;padding:3px 6px}.calendar-layout.is-expanded .calendar-week-open strong{font-size:11px}.calendar-layout.is-expanded .calendar-header{margin-bottom:6px}.calendar-layout.is-expanded .calendar-week-detail{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain}.calendar-detail-header{display:flex;align-items:center;justify-content:flex-end;margin-bottom:6px}.calendar-detail-header button{min-height:32px;padding:4px 8px;font-size:11px}
.calendar-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}.calendar-controls{display:flex;align-items:center;gap:5px;font-size:12px}.calendar-controls button{font-size:12px;min-height:36px;padding:4px 9px}.calendar-controls b{font-weight:600;white-space:nowrap}.calendar-weekdays,.calendar-days{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}.calendar-weekdays{text-align:center;color:var(--muted);font-size:11px;padding-bottom:6px}.calendar-day{container-type:inline-size;min-width:0;text-align:center;padding:7px 1px;display:flex;flex-direction:column;gap:5px;font-variant-numeric:tabular-nums}.calendar-day span{font-size:12px}.calendar-day b{display:block;width:100%;min-height:28px;line-height:28px;font-size:22px;font-weight:800;letter-spacing:-.3px;white-space:nowrap;color:var(--brand)}.calendar-day.adjacent{color:var(--muted)}.calendar-day.adjacent b{color:var(--muted)}.calendar-day.future{color:var(--muted)}.calendar-day.today span{font-weight:800;color:var(--brand)}.calendar-week{border-top:1px solid var(--border)}.calendar-week.selected{background:var(--brand-soft);border-radius:10px}.calendar-week-open{display:flex;justify-content:space-between;align-items:center;width:100%;min-height:36px;border:0;border-radius:8px;padding:6px 8px;background:transparent;font-size:11px;color:var(--muted)}.calendar-week-open strong{color:var(--brand);font-size:12px}.calendar-week-detail{padding:12px 8px;border-top:1px solid var(--border);background:white}.calendar-week-detail h3{margin:0 0 9px}.calendar-detail-tables .calendar-table{margin-bottom:0}.calendar-summary tbody th{font-size:12px;font-weight:500;color:var(--muted)}.calendar-summary tbody td{font-size:14px;color:var(--brand)}.calendar-table{width:100%;table-layout:fixed;border-collapse:collapse;font-size:11px;font-variant-numeric:tabular-nums;margin-bottom:15px}.calendar-table th,.calendar-table td{text-align:right;padding:9px 3px;border-bottom:1px solid var(--border);overflow-wrap:anywhere}.calendar-table thead th{background:var(--brand-soft);font-size:10px;font-weight:600;color:var(--muted)}.calendar-table th:first-child,.calendar-table td:first-child{text-align:left}.calendar-table th{font-weight:600}.calendar-table .calendar-core-quantity{font-size:13px;font-weight:800;color:var(--text)}.sales-calendar .empty{padding:20px 4px}.sales-calendar .empty button{display:block;margin:8px auto 0}
.category-heading{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.category-heading small{font-size:10px;font-weight:400}
.category-head .core-quantity{font-size:18px;font-weight:800;color:var(--text);font-variant-numeric:tabular-nums;line-height:1.35}
.category-toolbar h2{min-width:0;flex:1}.category-toolbar button{margin-left:auto}.category-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;font-size:11px;margin-bottom:14px}.category-filters select{width:100%;font-size:13px}.category-table-scroll{max-width:100%;overflow:auto;border:1px solid var(--border);border-radius:12px}.category-table{border-collapse:separate;border-spacing:0;min-width:640px;width:100%;font-size:12px;font-variant-numeric:tabular-nums}.category-table th,.category-table td{padding:0 10px;height:46px;text-align:right;white-space:nowrap;border-bottom:1px solid var(--border);background:white}.category-table th{background:var(--brand-soft);font-size:11px}.category-table th button{border:0;background:transparent;font-size:inherit;border-radius:0;padding:0;white-space:nowrap;width:100%;text-align:inherit}.category-table tr:last-child td{border-bottom:0}.category-table th:first-child,.category-table td:first-child{position:sticky;left:0;z-index:1;min-width:130px;max-width:180px;text-align:left;border-right:1px solid var(--border)}.category-table .category-name{padding:4px 0;border:0;background:transparent;border-radius:0;font-size:12px;max-width:170px;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--brand)}
