/* ==========================================================================
   ThaDigital Enterprise - live demo application shell
   A self-contained UI theme so the demos read as real software, not a webpage.
   Scoped to .app so it never leaks into the marketing pages.
   ========================================================================== */

.app{
  /* light (default) application theme */
  --a-bg:#F2F3F1;
  --a-surface:#FFFFFF;
  --a-surface-2:#F7F8F6;
  --a-surface-3:#EDEFEB;
  --a-chrome:#14171B;
  --a-chrome-tx:#E9ECEF;
  --a-chrome-tx-dim:#98A0AB;
  --a-line:#DFE2DC;
  --a-line-strong:#C6CAC2;
  --a-tx:#14171B;
  --a-tx-soft:#576069;
  --a-tx-faint:#676D75;
  --a-accent:#8F631C;
  --a-accent-bg:rgba(226,163,60,.13);
  --a-accent-line:rgba(184,127,37,.35);
  --a-good:#287B46;
  --a-good-bg:#E7F4EC;
  --a-warn:#96610C;
  --a-warn-bg:#FBF1DE;
  --a-bad:#B93A31;
  --a-bad-bg:#FBECEA;
  --a-info:#31709E;
  --a-info-bg:#E9F1F7;
  --a-shadow:0 1px 2px rgba(20,23,27,.07),0 4px 14px rgba(20,23,27,.06);
  --a-shadow-lg:0 8px 34px rgba(20,23,27,.16);
  --a-r:6px;

  background:var(--a-bg);
  color:var(--a-tx);
  border:1px solid var(--line-dark-strong);
  border-radius:var(--r-xl);
  overflow:hidden;
  box-shadow:var(--shadow-dark);
  font-size:14px;
  line-height:1.5;
  display:flex;
  flex-direction:column;
  height:min(78vh,790px);
  min-height:600px;
  position:relative;
}

.app[data-app-theme="dark"]{
  --a-bg:#0F1114;
  --a-surface:#16191E;
  --a-surface-2:#1B1F25;
  --a-surface-3:#22272E;
  --a-chrome:#080A0C;
  --a-chrome-tx:#E9ECEF;
  --a-chrome-tx-dim:#8A929C;
  --a-line:#262B32;
  --a-line-strong:#39404A;
  --a-tx:#E7EAEE;
  --a-tx-soft:#A2AAB4;
  --a-tx-faint:#888F97;
  --a-accent:#E2A33C;
  --a-accent-bg:rgba(226,163,60,.12);
  --a-accent-line:rgba(226,163,60,.32);
  --a-good:#4FBB74;
  --a-good-bg:rgba(79,187,116,.13);
  --a-warn:#E0A93C;
  --a-warn-bg:rgba(224,169,60,.13);
  --a-bad:#E2685D;
  --a-bad-bg:rgba(226,104,93,.13);
  --a-info:#5AA0D0;
  --a-info-bg:rgba(90,160,208,.13);
  --a-shadow:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.3);
  --a-shadow-lg:0 8px 34px rgba(0,0,0,.55);
}

.app *{box-sizing:border-box;}
/* Deliberately no `color:inherit` here. `.app button` is a class+element
   selector, so it outranks .abtn-primary / .abtn-good / .abtn-dark and would
   stop those variants colouring their own text - which washed the primary
   button out in dark mode. core.css already resets button colour globally
   at a low enough specificity for the variants to win. */
.app button{font:inherit;}

/* ---------- app chrome (title bar) ---------------------------------------- */

.app-chrome{
  display:flex;align-items:center;gap:14px;
  padding:0 14px;height:50px;flex:none;
  background:var(--a-chrome);color:var(--a-chrome-tx);
  border-bottom:1px solid rgba(255,255,255,.08);
}
.app-id{display:flex;align-items:center;gap:10px;min-width:0;flex:1;}
.app-id > div{min-width:0;}
.app-id .glyph{
  width:26px;height:26px;flex:none;border-radius:5px;
  background:var(--amber);color:#0B0C0E;
  display:flex;align-items:center;justify-content:center;
  font-family:var(--font-display);font-weight:700;font-size:.78rem;
}
.app-id .nm{
  font-family:var(--font-display);font-weight:600;font-size:.88rem;letter-spacing:-.01em;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.app-id .sub{
  font-family:var(--font-mono);font-size:.63rem;letter-spacing:.1em;
  color:var(--a-chrome-tx-dim);text-transform:uppercase;
}
.app-chrome-spacer{flex:none;}
.app-chrome-actions{display:flex;align-items:center;gap:6px;flex:none;}

.chip-btn{
  display:inline-flex;align-items:center;gap:6px;
  height:31px;padding:0 11px;border-radius:5px;
  border:1px solid rgba(255,255,255,.14);
  color:var(--a-chrome-tx);
  font-size:.775rem;font-weight:500;white-space:nowrap;
  transition:background-color .15s var(--ease),border-color .15s var(--ease);
}
.chip-btn:hover{background:rgba(255,255,255,.09);}
.chip-btn svg{width:14px;height:14px;flex:none;}
.chip-btn.is-on{background:var(--amber);border-color:var(--amber);color:#0B0C0E;}

.app-clock{
  font-family:var(--font-mono);font-size:.72rem;color:var(--a-chrome-tx-dim);
  letter-spacing:.04em;white-space:nowrap;
}

/* ---------- workspace ------------------------------------------------------ */

.app-body{display:flex;flex:1;min-height:0;}

.app-rail{
  width:196px;flex:none;
  background:var(--a-surface);border-right:1px solid var(--a-line);
  display:flex;flex-direction:column;padding:10px 8px;gap:2px;
  overflow-y:auto;
}
.rail-label{
  font-family:var(--font-mono);font-size:.605rem;letter-spacing:.15em;
  text-transform:uppercase;color:var(--a-tx-faint);
  padding:14px 10px 7px;
}
.rail-btn{
  display:flex;align-items:center;gap:10px;
  padding:9px 10px;border-radius:5px;width:100%;text-align:left;
  font-size:.845rem;font-weight:500;color:var(--a-tx-soft);
  transition:background-color .15s var(--ease),color .15s var(--ease);
}
.rail-btn svg{width:16px;height:16px;flex:none;opacity:.8;}
.rail-btn:hover{background:var(--a-surface-3);color:var(--a-tx);}
.rail-btn.is-active{background:var(--a-accent-bg);color:var(--a-accent);font-weight:600;}
.rail-btn.is-active svg{opacity:1;}
.rail-btn .count{
  margin-left:auto;font-family:var(--font-mono);font-size:.68rem;
  background:var(--a-surface-3);padding:1px 6px;border-radius:20px;color:var(--a-tx-faint);
}

.app-main{flex:1;min-width:0;display:flex;flex-direction:column;overflow:hidden;}
.app-scroll{flex:1;overflow-y:auto;overflow-x:hidden;padding:18px;}

.app-aside{
  width:322px;flex:none;
  background:var(--a-surface);border-left:1px solid var(--a-line);
  display:flex;flex-direction:column;min-height:0;
}

/* ---------- panel ---------------------------------------------------------- */

.panel{
  background:var(--a-surface);border:1px solid var(--a-line);
  border-radius:var(--a-r);overflow:hidden;
}
.panel + .panel{margin-top:14px;}
.panel-head{
  display:flex;align-items:center;gap:10px;
  padding:11px 14px;border-bottom:1px solid var(--a-line);
  background:var(--a-surface-2);
}
.panel-head h3{
  font-family:var(--font-body);font-size:.82rem;font-weight:600;letter-spacing:.005em;
  color:var(--a-tx);margin:0;
}
.panel-head .sp{flex:1;}
.panel-body{padding:14px;}
.panel-body.flush{padding:0;}

/* ---------- toolbar -------------------------------------------------------- */

.app-toolbar{
  display:flex;align-items:center;gap:9px;flex-wrap:wrap;
  padding:11px 18px;flex:none;
  background:var(--a-surface);border-bottom:1px solid var(--a-line);
}
.app-toolbar h2{
  font-family:var(--font-display);font-size:1rem;font-weight:600;
  margin:0;letter-spacing:-.015em;color:var(--a-tx);
}
.app-toolbar .sp{flex:1;}

/* ---------- app buttons ---------------------------------------------------- */

.abtn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  height:34px;padding:0 13px;border-radius:5px;
  border:1px solid var(--a-line-strong);
  background:var(--a-surface);color:var(--a-tx);
  font-size:.83rem;font-weight:500;white-space:nowrap;
  transition:background-color .15s var(--ease),border-color .15s var(--ease),
             color .15s var(--ease),transform .12s var(--ease);
}
.abtn:hover{background:var(--a-surface-3);border-color:var(--a-tx-faint);}
.abtn:active{transform:translateY(1px);}
.abtn svg{width:15px;height:15px;flex:none;}
.abtn:disabled{opacity:.42;cursor:not-allowed;transform:none;}

.abtn-primary{background:var(--amber);border-color:var(--amber);color:#0B0C0E;font-weight:600;}
.abtn-primary:hover{background:var(--amber-bright);border-color:var(--amber-bright);}
.abtn-dark{background:var(--a-chrome);border-color:var(--a-chrome);color:#fff;}
.abtn-dark:hover{background:#22262C;border-color:#22262C;}
.abtn-good{background:var(--a-good);border-color:var(--a-good);color:#fff;font-weight:600;}
.abtn-good:hover{filter:brightness(1.08);}
.abtn-bad{color:var(--a-bad);border-color:var(--a-bad);}
.abtn-bad:hover{background:var(--a-bad-bg);}
.abtn-lg{height:42px;padding:0 18px;font-size:.9rem;}
.abtn-sm{height:28px;padding:0 9px;font-size:.775rem;}
.abtn-icon{width:34px;padding:0;}
.abtn-block{width:100%;}

/* ---------- app inputs ----------------------------------------------------- */

.ainput,.aselect,.atextarea{
  width:100%;height:34px;padding:0 11px;
  background:var(--a-surface);
  border:1px solid var(--a-line-strong);border-radius:5px;
  color:var(--a-tx);font-size:.855rem;
  transition:border-color .15s var(--ease),box-shadow .15s var(--ease);
}
.atextarea{height:auto;min-height:70px;padding:9px 11px;resize:vertical;line-height:1.55;}
.ainput:focus,.aselect:focus,.atextarea:focus{
  outline:none;border-color:var(--amber);box-shadow:0 0 0 3px var(--a-accent-bg);
}
.ainput::placeholder,.atextarea::placeholder{color:var(--a-tx-faint);}
.ainput[readonly]{background:var(--a-surface-3);color:var(--a-tx-soft);}
.aselect{
  appearance:none;padding-right:30px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858d96' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 9px center;background-size:15px;
}
.ainput-lg{height:44px;font-size:.98rem;padding:0 14px;}
.afield{display:flex;flex-direction:column;gap:5px;}
.afield > label{
  font-size:.735rem;font-weight:600;color:var(--a-tx-faint);
  letter-spacing:.03em;text-transform:uppercase;
}
.afield-row{display:grid;gap:10px;}
.afr-2{grid-template-columns:repeat(2,minmax(0,1fr));}
.afr-3{grid-template-columns:repeat(3,minmax(0,1fr));}
@media (max-width:560px){.afr-3{grid-template-columns:repeat(2,minmax(0,1fr));}}

.aswitch{display:inline-flex;align-items:center;gap:9px;cursor:pointer;font-size:.83rem;}
.aswitch input{position:absolute;opacity:0;width:0;height:0;}
.aswitch .track{
  width:36px;height:20px;border-radius:20px;flex:none;
  background:var(--a-line-strong);position:relative;
  transition:background-color .18s var(--ease);
}
.aswitch .track::after{
  content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;
  background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.3);
  transition:transform .18s var(--ease);
}
.aswitch input:checked + .track{background:var(--a-good);}
.aswitch input:checked + .track::after{transform:translateX(16px);}
.aswitch input:focus-visible + .track{outline:2px solid var(--amber);outline-offset:2px;}

/* ---------- data table ----------------------------------------------------- */

.atable-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;}
.atable{width:100%;border-collapse:collapse;font-size:.83rem;}
.atable thead th{
  position:sticky;top:0;z-index:2;
  background:var(--a-surface-2);
  text-align:left;font-weight:600;font-size:.7rem;
  letter-spacing:.07em;text-transform:uppercase;color:var(--a-tx-faint);
  padding:9px 12px;border-bottom:1px solid var(--a-line);white-space:nowrap;
}
.atable tbody td{
  padding:9px 12px;border-bottom:1px solid var(--a-line);
  color:var(--a-tx);vertical-align:middle;
}
.atable tbody tr:last-child td{border-bottom:none;}
.atable tbody tr.is-hoverable:hover{background:var(--a-surface-2);cursor:pointer;}
.atable tbody tr.is-selected{background:var(--a-accent-bg);}
.atable .num{
  text-align:right;font-family:var(--font-mono);font-size:.79rem;
  font-variant-numeric:tabular-nums;white-space:nowrap;
}
.atable .mono{font-family:var(--font-mono);font-size:.775rem;}
.atable tfoot td{
  padding:11px 12px;border-top:2px solid var(--a-line-strong);
  font-weight:600;background:var(--a-surface-2);
}
.atable .sub-line td{
  padding-top:0;font-size:.735rem;color:var(--a-tx-faint);border-bottom:1px solid var(--a-line);
}

.empty-state{
  padding:44px 20px;text-align:center;color:var(--a-tx-faint);
}
.empty-state svg{width:34px;height:34px;margin:0 auto 12px;opacity:.4;}
.empty-state p{font-size:.85rem;margin:0;}

/* ---------- badges --------------------------------------------------------- */

.badge{
  display:inline-flex;align-items:center;gap:5px;
  padding:2px 8px;border-radius:20px;
  font-size:.7rem;font-weight:600;letter-spacing:.02em;white-space:nowrap;
  background:var(--a-surface-3);color:var(--a-tx-soft);
}
.badge-good{background:var(--a-good-bg);color:var(--a-good);}
.badge-warn{background:var(--a-warn-bg);color:var(--a-warn);}
.badge-bad{background:var(--a-bad-bg);color:var(--a-bad);}
.badge-info{background:var(--a-info-bg);color:var(--a-info);}
.badge-accent{background:var(--a-accent-bg);color:var(--a-accent);}
.badge .dot{width:5px;height:5px;border-radius:50%;background:currentColor;flex:none;}

/* ---------- KPI tiles ------------------------------------------------------ */

.kpis{display:grid;gap:10px;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));}
.kpi{
  background:var(--a-surface);border:1px solid var(--a-line);
  border-radius:var(--a-r);padding:13px 15px;
}
.kpi .lbl{
  font-size:.685rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;
  color:var(--a-tx-faint);margin-bottom:7px;display:flex;align-items:center;gap:6px;
}
.kpi .val{
  font-family:var(--font-display);font-size:1.42rem;font-weight:600;
  letter-spacing:-.025em;line-height:1.1;font-variant-numeric:tabular-nums;
}
.kpi .val.pos{color:var(--a-good);}
.kpi .val.neg{color:var(--a-bad);}
.kpi .val.acc{color:var(--a-accent);}
.kpi .delta{font-size:.735rem;color:var(--a-tx-faint);margin-top:5px;}

/* ---------- receipt / document preview ------------------------------------- */

.receipt{
  background:#fff;color:#111;
  font-family:var(--font-mono);font-size:11.5px;line-height:1.62;
  padding:16px 15px;border-radius:4px;
  box-shadow:var(--a-shadow);
  max-width:330px;margin-inline:auto;
  border:1px solid #E2E2DE;
}
.receipt hr{border:none;border-top:1px dashed #B9B9B4;margin:8px 0;}
.receipt .c{text-align:center;}
.receipt .b{font-weight:700;}
.receipt .lg{font-size:14px;letter-spacing:.09em;}
.receipt .rr{display:flex;justify-content:space-between;gap:10px;}
.receipt .rr .r{text-align:right;white-space:nowrap;}
.receipt .item{margin-bottom:3px;}
.receipt .barcode{
  height:38px;margin:9px auto 3px;display:block;
}

/* ---------- label preview -------------------------------------------------- */

.label-preview{
  background:#fff;color:#000;border:1px dashed #A9A9A4;
  border-radius:3px;padding:9px 10px;
  font-family:var(--font-body);
  display:flex;flex-direction:column;justify-content:space-between;
  box-shadow:var(--a-shadow);
}

/* ---------- toast ---------------------------------------------------------- */

.toast-host{
  position:absolute;left:50%;bottom:16px;transform:translateX(-50%);
  z-index:60;display:flex;flex-direction:column;gap:8px;align-items:center;
  pointer-events:none;width:calc(100% - 32px);max-width:420px;
}
.toast{
  display:flex;align-items:center;gap:10px;
  padding:10px 15px;border-radius:6px;
  background:var(--a-chrome);color:#fff;
  font-size:.83rem;box-shadow:var(--a-shadow-lg);
  animation:toastIn .22s var(--ease);
  pointer-events:auto;max-width:100%;
}
.toast svg{width:16px;height:16px;flex:none;}
.toast.ok svg{color:#5FCB84;}
.toast.warn svg{color:var(--amber);}
.toast.bad svg{color:#E8776D;}
.toast.is-out{animation:toastOut .2s var(--ease) forwards;}
@keyframes toastIn{from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:none;}}
@keyframes toastOut{to{opacity:0;transform:translateY(8px);}}

/* ---------- modal ---------------------------------------------------------- */

.amodal-host{
  position:absolute;inset:0;z-index:70;
  display:none;align-items:center;justify-content:center;
  padding:20px;background:rgba(8,10,12,.62);
  backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);
}
.amodal-host.is-open{display:flex;}
.amodal{
  background:var(--a-surface);border:1px solid var(--a-line);
  border-radius:9px;box-shadow:var(--a-shadow-lg);
  width:100%;max-width:540px;max-height:100%;
  display:flex;flex-direction:column;overflow:hidden;
  animation:modalIn .2s var(--ease);
}
.amodal.wide{max-width:760px;}
@keyframes modalIn{from{opacity:0;transform:translateY(12px) scale(.985);}to{opacity:1;transform:none;}}
.amodal-head{
  display:flex;align-items:center;gap:12px;
  padding:14px 16px;border-bottom:1px solid var(--a-line);flex:none;
}
.amodal-head h3{font-family:var(--font-display);font-size:1rem;margin:0;flex:1;}
.amodal-body{padding:16px;overflow-y:auto;flex:1;}
.amodal-foot{
  display:flex;gap:9px;justify-content:flex-end;flex-wrap:wrap;
  padding:13px 16px;border-top:1px solid var(--a-line);
  background:var(--a-surface-2);flex:none;
}

/* ---------- mobile tab bar ------------------------------------------------- */

.app-tabbar{display:none;}

@media (max-width:900px){
  .app{height:min(80vh,700px);min-height:520px;border-radius:var(--r-lg);}
  .app-rail{display:none;}
  .app-aside{
    position:absolute;top:50px;right:0;bottom:0;width:min(340px,88%);
    z-index:40;box-shadow:var(--a-shadow-lg);
    transform:translateX(102%);transition:transform .24s var(--ease);
  }
  .app-aside.is-open{transform:none;}
  .app-tabbar{
    display:flex;flex:none;
    border-top:1px solid var(--a-line);background:var(--a-surface);
    overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;
  }
  .app-tabbar::-webkit-scrollbar{display:none;}
  .tab-btn{
    flex:1 0 auto;min-width:76px;
    display:flex;flex-direction:column;align-items:center;gap:4px;
    padding:9px 12px;font-size:.68rem;font-weight:600;
    color:var(--a-tx-faint);white-space:nowrap;
    border-top:2px solid transparent;margin-top:-1px;
  }
  .tab-btn svg{width:18px;height:18px;}
  .tab-btn.is-active{color:var(--a-accent);border-top-color:var(--a-accent);}
  .app-scroll{padding:13px;}
}

@media (max-width:620px){
  .app{font-size:13.5px;height:min(84vh,660px);min-height:470px;}
  .app-chrome{height:46px;padding:0 10px;gap:9px;}
  .app-id .sub,.app-clock{display:none;}
  .chip-btn span{display:none;}
  .chip-btn.keep-label span{display:inline;}
  .chip-btn{padding:0 8px;}
  .chip-btn.keep-label{padding:0 10px;}
  .app-toolbar{padding:9px 13px;}
}

/* ---------- demo page framing ---------------------------------------------- */

.demo-stage{
  padding-top:calc(var(--header-h) + 26px);
  padding-bottom:clamp(40px,6vw,70px);
  background:
    radial-gradient(ellipse 100% 80% at 50% -10%,rgba(226,163,60,.09),transparent 60%),
    var(--ink-850);
}
.demo-head{
  display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;
  gap:20px;margin-bottom:22px;
}
.demo-head h1{font-size:clamp(1.5rem,3.2vw,2.15rem);margin-bottom:11px;}
.demo-head .lede{font-size:1rem;max-width:60ch;}

.demo-switcher{
  display:flex;gap:7px;overflow-x:auto;padding-bottom:4px;
  scrollbar-width:none;margin-bottom:20px;
}
.demo-switcher::-webkit-scrollbar{display:none;}
.demo-switcher a{
  display:inline-flex;align-items:center;gap:8px;flex:none;
  padding:8px 14px;border-radius:100px;
  border:1px solid var(--line-dark-strong);
  font-size:.83rem;font-weight:500;color:var(--tx-on-dark-soft);
  transition:all .16s var(--ease);white-space:nowrap;
}
.demo-switcher a:hover{border-color:var(--amber-line);color:var(--amber);}
.demo-switcher a[aria-current="page"]{
  background:var(--amber);border-color:var(--amber);color:#0B0C0E;font-weight:600;
}

.demo-hint{
  display:flex;align-items:flex-start;gap:11px;
  padding:13px 16px;margin-bottom:18px;
  border:1px solid var(--amber-line);background:var(--amber-wash);
  border-radius:var(--r);font-size:.855rem;line-height:1.6;
  color:var(--tx-on-dark-soft);
}
.demo-hint svg{width:17px;height:17px;color:var(--amber);flex:none;margin-top:2px;}
.demo-hint strong{color:var(--tx-on-dark);}

.demo-foot{
  margin-top:26px;display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:16px;
}
.demo-foot .card{padding:20px;}
.demo-foot h4,.demo-foot .card-h{font-size:.9rem;margin-bottom:8px;}
.demo-foot p{font-size:.85rem;color:var(--tx-on-dark-soft);line-height:1.6;}

/* ---------- misc app helpers ------------------------------------------------ */

.a-row{display:flex;align-items:center;gap:9px;}
.a-row-wrap{flex-wrap:wrap;}
.a-sp{flex:1;}
.a-stack{display:flex;flex-direction:column;}
.a-gap-6{gap:6px;} .a-gap-10{gap:10px;} .a-gap-14{gap:14px;} .a-gap-18{gap:18px;}
.a-muted{color:var(--a-tx-soft);}
.a-faint{color:var(--a-tx-faint);}
.a-mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;}
.a-num{font-family:var(--font-mono);font-variant-numeric:tabular-nums;text-align:right;}
.a-sec-title{
  font-size:.685rem;font-weight:700;letter-spacing:.1em;text-transform:uppercase;
  color:var(--a-tx-faint);margin-bottom:9px;
}
.a-divider{height:1px;background:var(--a-line);margin:12px 0;}
.a-scroll-y{overflow-y:auto;}

.bar-track{height:6px;border-radius:6px;background:var(--a-surface-3);overflow:hidden;}
.bar-fill{height:100%;border-radius:6px;background:var(--a-accent);transition:width .4s var(--ease);}
.bar-fill.good{background:var(--a-good);}
.bar-fill.warn{background:var(--a-warn);}
.bar-fill.bad{background:var(--a-bad);}

/* keypad */
.keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;}
.keypad button{
  height:46px;border-radius:6px;border:1px solid var(--a-line-strong);
  background:var(--a-surface);font-family:var(--font-mono);font-size:1.05rem;font-weight:500;
  transition:background-color .12s var(--ease),transform .1s var(--ease);
}
.keypad button:hover{background:var(--a-surface-3);}
.keypad button:active{transform:scale(.96);}
.keypad button.wide{grid-column:span 2;}
.keypad button.act{background:var(--a-accent-bg);border-color:var(--a-accent-line);color:var(--a-accent);}

/* search result list */
.res-list{display:flex;flex-direction:column;max-height:290px;overflow-y:auto;}
.res-item{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;
  padding:9px 12px;border-bottom:1px solid var(--a-line);text-align:left;width:100%;
  transition:background-color .12s var(--ease);
}
.res-item:hover,.res-item.is-cursor{background:var(--a-accent-bg);}
.res-item:last-child{border-bottom:none;}
.res-item .t{font-size:.84rem;font-weight:500;color:var(--a-tx);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.res-item .s{font-size:.72rem;color:var(--a-tx-faint);font-family:var(--font-mono);}
.res-item .p{font-family:var(--font-mono);font-size:.82rem;font-weight:600;color:var(--a-accent);}

/* print document host - off-screen until printing */
.printdoc-host{position:fixed;left:-10000px;top:0;width:210mm;}

/* ==========================================================================
   Small-screen notice on demo pages
   Injected by DK.shell(). Says the honest thing - a dense business screen
   has more room on a computer - and then turns that into the point we
   actually want to make: phone screens are designed for the phone, not
   squeezed onto it.
   ========================================================================== */

.device-note{
  display:none;
  gap:12px;
  padding:14px 16px;
  margin-bottom:14px;
  border:1px solid var(--line-dark-strong);
  border-left:3px solid var(--amber);
  border-radius:var(--r);
  background:linear-gradient(100deg,rgba(226,163,60,.10),rgba(226,163,60,.03));
  font-size:.855rem;line-height:1.6;
  color:var(--tx-on-dark-soft);
}
.device-note.is-shown{display:flex;}
.device-note svg{width:18px;height:18px;color:var(--amber);flex:none;margin-top:2px;}
.device-note strong{color:var(--tx-on-dark);}
.device-note .dn-body{flex:1;min-width:0;}
.device-note a{color:var(--amber);font-weight:600;text-decoration:underline;
  text-underline-offset:3px;text-decoration-color:var(--amber-line);}
.device-note a:hover{text-decoration-color:var(--amber);}
.device-note .dn-close{
  flex:none;width:26px;height:26px;border-radius:var(--r-sm);
  display:flex;align-items:center;justify-content:center;
  color:var(--tx-on-dark-faint);border:1px solid var(--line-dark);
}
.device-note .dn-close:hover{color:var(--tx-on-dark);}
.device-note .dn-close svg{width:13px;height:13px;color:currentColor;margin:0;}

/* ==========================================================================
   Phone companion - a phone-first screen shown inside a device frame on a
   desktop, and full-bleed when the visitor is already holding a phone.
   ========================================================================== */

.phone-stage{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:22px;align-items:start;
}
@media (max-width:1040px){.phone-stage{grid-template-columns:minmax(0,1fr);}}

.phone-frame{
  width:330px;flex:none;margin-inline:auto;
  background:#0A0B0D;
  border:9px solid #1A1D22;
  border-radius:34px;
  box-shadow:0 18px 50px rgba(0,0,0,.42),0 0 0 1px rgba(255,255,255,.05) inset;
  overflow:hidden;
  position:relative;
}
.phone-notch{
  position:absolute;top:0;left:50%;transform:translateX(-50%);
  width:104px;height:19px;background:#1A1D22;
  border-radius:0 0 11px 11px;z-index:5;
}
.phone-status{
  display:flex;align-items:center;justify-content:space-between;
  padding:7px 15px 5px;
  background:var(--a-surface);
  font-family:var(--font-mono);font-size:.62rem;color:var(--a-tx-faint);
}
.phone-screen{
  background:var(--a-bg);
  height:558px;overflow-y:auto;-webkit-overflow-scrolling:touch;
}
.phone-home{
  height:4px;width:96px;margin:5px auto 7px;
  background:var(--a-line-strong);border-radius:4px;
}

/* on a real phone the frame is pointless - show the screen itself */
@media (max-width:640px){
  .phone-frame{
    width:auto;border:none;border-radius:var(--a-r);
    box-shadow:none;border:1px solid var(--a-line);
  }
  .phone-notch,.phone-home{display:none;}
  .phone-screen{height:auto;max-height:none;overflow:visible;}
}

.wifi-card{
  border:1px solid var(--a-line);border-radius:var(--a-r);
  background:var(--a-surface);overflow:hidden;
}
.wifi-url{
  display:flex;align-items:center;gap:10px;
  padding:12px 14px;background:var(--a-surface-3);
  font-family:var(--font-mono);font-size:.9rem;font-weight:600;
  color:var(--a-accent);word-break:break-all;
}
.wifi-url svg{width:17px;height:17px;flex:none;}

.count-row{
  display:grid;grid-template-columns:minmax(0,1fr) 66px;
  gap:10px;align-items:center;
  padding:11px 13px;border-bottom:1px solid var(--a-line);
}
.count-row:last-child{border-bottom:none;}
.count-row .cn{font-size:.85rem;font-weight:600;line-height:1.3;}
.count-row .cs{font-size:.71rem;color:var(--a-tx-faint);font-family:var(--font-mono);margin-top:2px;}
.count-row input{
  width:100%;height:38px;text-align:center;
  border:1.5px solid var(--a-line-strong);border-radius:6px;
  background:var(--a-surface);color:var(--a-tx);
  font-family:var(--font-mono);font-size:1rem;font-weight:600;
}
.count-row input:focus{outline:none;border-color:var(--amber);box-shadow:0 0 0 3px var(--a-accent-bg);}
.count-row.is-over input{border-color:var(--a-good);background:var(--a-good-bg);}
.count-row.is-short input{border-color:var(--a-bad);background:var(--a-bad-bg);}
.count-row .var{
  grid-column:1/-1;font-size:.74rem;font-weight:600;font-family:var(--font-mono);
}

/* ==========================================================================
   Pill tabs - used by the POS category strip and the warehouse aisle picker
   ========================================================================== */

.cat-tabs{display:flex;gap:6px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none;}
.cat-tabs::-webkit-scrollbar{display:none;}
.cat-tab{
  flex:none;padding:6px 12px;border-radius:100px;
  border:1px solid var(--a-line-strong);background:var(--a-surface);
  font-size:.78rem;font-weight:500;color:var(--a-tx-soft);white-space:nowrap;
  transition:background-color .14s var(--ease),border-color .14s var(--ease),color .14s var(--ease);
}
.cat-tab:hover{border-color:var(--a-accent-line);color:var(--a-accent);}
.cat-tab.is-active{background:var(--a-accent);border-color:var(--a-accent);color:#fff;font-weight:600;}
.app[data-app-theme="dark"] .cat-tab.is-active{color:#0B0C0E;}

/* a loose icon inside a flex row still gets a sane ceiling */
.app .a-row > svg,.app li > svg,.app .panel-body > svg{flex:none;}

/* ==========================================================================
   Label designer layout
   Was an inline grid, which no media query could ever override - so on a
   phone the controls and the preview stayed jammed into two columns.
   ========================================================================== */

.lbl-grid{
  display:grid;
  grid-template-columns:minmax(0,320px) minmax(0,1fr);
  gap:14px;
}
@media (max-width:900px){
  .lbl-grid{grid-template-columns:minmax(0,1fr);}
}

/* ==========================================================================
   Mobile tab bar - six tabs do not fit across a phone, so it scrolls.
   Make that obvious and keep the active tab in view.
   ========================================================================== */

@media (max-width:900px){
  .app-tabbar{
    position:relative;
    box-shadow:0 -6px 16px rgba(0,0,0,.07);
    -webkit-mask-image:linear-gradient(90deg,transparent 0,#000 14px,#000 calc(100% - 22px),transparent 100%);
    mask-image:linear-gradient(90deg,transparent 0,#000 14px,#000 calc(100% - 22px),transparent 100%);
  }
  .app[data-app-theme="dark"] .app-tabbar{box-shadow:0 -6px 16px rgba(0,0,0,.4);}
  .tab-btn{
    min-width:70px;
    padding:9px 10px;
    font-size:.665rem;
    letter-spacing:-.01em;
  }
}
@media (max-width:420px){
  .tab-btn{min-width:62px;padding:8px 7px;font-size:.62rem;gap:3px;}
  .tab-btn svg{width:17px;height:17px;}
}


/* ---------- small square icon button ---------------------------------------
   Quantity steppers, row removers, dialog controls. Defined here rather than
   in one demo's page styles, because several demos use it. */
.qbtn{
  width:26px;height:26px;border-radius:4px;
  border:1px solid var(--a-line-strong);
  display:inline-flex;align-items:center;justify-content:center;flex:none;
  color:var(--a-tx-soft);
  transition:background-color .14s var(--ease),color .14s var(--ease);
}
.qbtn:hover{background:var(--a-surface-3);color:var(--a-tx);}
.qbtn svg{width:13px;height:13px;}
.qv{min-width:2.4ch;text-align:center;font-weight:600;color:var(--a-tx);}

/* ==========================================================================
   Touch targets inside the demo apps
   These screens are deliberately dense, but a 23px +/- button is not
   hittable with a thumb. Grow them where the screen is narrow; leave the
   desktop layout exactly as it is.
   ========================================================================== */

@media (max-width:640px), (pointer:coarse){
  .app .qbtn{width:32px;height:32px;}
  .app .qbtn svg{width:14px;height:14px;}
  .abtn-sm{height:34px;padding:0 12px;}
  .abtn-icon{width:36px;}
  .dn-close{width:34px;height:34px;flex:none;}
  .cat-tab{padding:9px 14px;}
  .ex-chip{padding:9px 13px;}
  .res-item{padding:12px;}
  .tick{width:30px;height:30px;}
}
