/* ==========================================================================
   The app preview (/experience): a bar of choices above a full-width sketch of the visitor's
   app on a laptop and a phone, running live, then what it adds up to. The page follows the
   site theme; the sketched app is always a light business UI in the visitor's colour (--app,
   with --app-on for text on it). Inside each screen every size is in em, and the screen sets
   the em from its own width (cqw), so the whole app scales with the device.
   ========================================================================== */

/* The page's intro. (Not .ap-hero: that is the coloured card on the sketched phone.) */
.ap-intro { padding-bottom: clamp(40px, 5cqw, 60px); }
/* Opened at #studio (shared links, and the address after every change): the jump clears the
   fixed header with room to spare, and the intro above is far enough up to sit wholly under it. */
.ap-studio { padding: clamp(10px, 2vw, 20px) 0 clamp(64px, 8vw, 104px); background: var(--bg); scroll-margin-top: 92px; }
.ap-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- the choices ---------- */
.ap-controls { display: grid; gap: 12px; padding: 14px 16px; border-radius: 20px; border: 1px solid rgba(var(--ink), .12); background: var(--surface); }
.ap-ctl-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.ap-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 4px; border: 0; border-radius: 13px; background: rgba(var(--ink), .07); }
.ap-seg label { position: relative; }
.ap-seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ap-seg span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 10px; color: rgba(var(--ink), .72);
    font: 600 .88rem/1 var(--nav-font); white-space: nowrap; transition: background .2s, color .2s; }
.ap-seg span i { color: var(--accent-color); }
.ap-seg input:checked + span { background: var(--accent-fill); color: #fff; }
.ap-seg input:checked + span i { color: #fff; }
.ap-seg input:focus-visible + span { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.ap-name { flex: 1 1 200px; margin: 0; }
.ap-name input { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(var(--ink), .18); background: var(--bg);
    color: var(--heading-color); font: inherit; font-size: .95rem; transition: border-color .2s, box-shadow .2s; }
.ap-name input::placeholder { color: rgba(var(--ink), .45); }
.ap-name input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color), transparent 78%); }
.ap-kit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ap-logo-btn { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 13px; border-radius: 11px;
    border: 1px dashed rgba(var(--ink), .32); color: var(--heading-color); font: 600 .85rem/1 var(--nav-font); cursor: pointer; transition: border-color .2s; }
.ap-logo-btn:hover, .ap-logo-btn:focus-within { border-color: var(--accent-color); }
.ap-logo-btn i { color: var(--accent-color); }
.ap-logo-btn input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.ap-logo-btn.has-logo { border-style: solid; }
.ap-logo-x { display: grid; place-items: center; width: 26px; height: 26px; margin-left: -6px; border-radius: 50%; border: 0; background: rgba(var(--ink), .1);
    color: var(--heading-color); cursor: pointer; }
.ap-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; }
.ap-sw { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--sw); cursor: pointer;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22); transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.ap-sw:hover { transform: scale(1.1); }
.ap-sw input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.ap-sw:has(input:checked), .ap-sw-any.is-on { outline: 2px solid var(--heading-color); outline-offset: 3px; }
.ap-sw:has(input:focus-visible) { outline: 2px solid var(--accent-color); outline-offset: 3px; }
.ap-sw-any { background: conic-gradient(#e03131, #f08c00, #fcc419, #37b24d, #1c7ed6, #7048e8, #e03131); }
.ap-ctl-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 10px; margin: 0; padding: 10px 0 0; border: 0;
    border-top: 1px solid rgba(var(--ink), .08); }
.ap-ctl-row > legend { float: left; margin: 0; padding: 0; font: 700 .7rem/1 var(--nav-font); letter-spacing: .12em; text-transform: uppercase; color: rgba(var(--ink), .6); }
.ap-controls .chips { gap: 7px; }
.ap-controls .chip { gap: 7px; padding: 7px 12px; font-size: .84rem; }
.chip .ap-ic { color: var(--accent-color); font-size: 1rem; flex: none; }
.chip:has(input:checked) .ap-ic { color: #fff; }
.js-ap .ap-go { display: none; }
.ap-go { justify-self: start; }
.ap-try { display: flex; align-items: center; gap: 8px; margin: 14px 4px 0; color: rgba(var(--ink), .66); font-size: .9rem; }
.ap-try i { color: var(--accent-color); }

/* ---------- the stage ---------- */
.ap-stage-slot { margin-top: 16px; scroll-margin-top: 92px; view-transition-name: ap-stage; transition: opacity .2s; }
.ap-stage-slot.ap-busy { opacity: .85; }
.ap-stage { position: relative; isolation: isolate; overflow: hidden; perspective: 1900px; border-radius: 26px; border: 1px solid rgba(var(--ink), .1);
    padding: 14px clamp(14px, 2.4vw, 32px) clamp(46px, 4.5vw, 64px);
    background: radial-gradient(55% 70% at 70% 30%, color-mix(in srgb, var(--app), transparent 80%), transparent 72%), var(--bg-deep); }
.ap-stage::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background-image: radial-gradient(rgba(var(--ink), .09) 1px, transparent 1.6px); background-size: 22px 22px; }
.ap-stage-bar { position: relative; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: clamp(14px, 2vw, 24px); }
.ap-sample { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 7px 12px; border-radius: 99px; background: rgba(var(--ink), .08);
    color: rgba(var(--ink), .78); font: 700 .7rem/1 var(--nav-font); letter-spacing: .1em; text-transform: uppercase; }
.ap-live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.ap-stage.is-paused .ap-live-dot { background: rgba(var(--ink), .4); }
.ap-stage.is-paused .ap-live-dot::after { content: none; }
.ap-tools { display: flex; gap: 8px; }
.ap-tool { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; border: 1px solid rgba(var(--ink), .16);
    background: transparent; color: var(--heading-color); font: 600 .78rem/1 var(--nav-font); cursor: pointer; transition: border-color .2s; }
.ap-tool:hover, .ap-tool:focus-visible { border-color: var(--accent-color); }
.ap-tool[aria-pressed="true"] { background: rgba(var(--ink), .08); }

.ap-devices { position: relative; padding-right: 21%; transform-style: preserve-3d;
    transform: rotateX(var(--rx, 2deg)) rotateY(var(--ry, -4deg)); transition: transform .6s cubic-bezier(.16, 1, .3, 1); }
.ap-devices.ap-solo { padding-inline: 11%; }
.ap-lid { padding: 1.6% 1.6% 2%; border-radius: 18px 18px 6px 6px; background: linear-gradient(#1c211e, #0b0e0c);
    box-shadow: 0 46px 80px -40px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.ap-screen { aspect-ratio: 16 / 10; overflow: hidden; border-radius: 5px; background: #f4f6f5; container-type: inline-size; }
.ap-base { position: relative; height: 16px; margin: 0 -6%; border-radius: 0 0 18px 18px; background: linear-gradient(180deg, #e4e7e5, #a4aba6);
    box-shadow: 0 24px 36px -20px rgba(0, 0, 0, .55); }
.ap-base::before { content: ""; display: block; width: 15%; height: 5px; margin: 0 auto; border-radius: 0 0 8px 8px; background: rgba(0, 0, 0, .16); }
.ap-phone { position: absolute; right: 0; bottom: -5%; z-index: 2; width: 24%; aspect-ratio: 9 / 19.5; padding: .9%; border-radius: 15% / 7%;
    background: #0b0e0c; transform: translateZ(50px); box-shadow: 0 40px 70px -26px rgba(0, 0, 0, .7), inset 0 0 0 1.5px rgba(255, 255, 255, .12); }
.ap-phone-screen { height: 100%; overflow: hidden; border-radius: 12.5% / 5.8%; background: #f4f6f5; container-type: inline-size; }

/* Full screen: the stage alone, as large as the window allows. */
.ap-stage:fullscreen { display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; padding: 2vh 4vw 4vh; }
.ap-stage:fullscreen .ap-devices { width: min(100%, calc((100vh - 110px) * 1.72)); margin: 0 auto; }

/* ---------- the sketched web app ---------- */
.ap-app { --ap-ink: #17201b; --ap-soft: #66726b; --ap-line: #e3e8e5; --ap-ok: #17803d; --ap-warn: #925d00; --ap-bad: #bf2f2f;
    position: relative; display: grid; grid-template-columns: 12.5em minmax(0, 1fr); height: 100%; overflow: hidden; text-align: left;
    font: 400 1.5cqw/1.35 var(--heading-font); color: var(--ap-ink); background: #f4f6f5; }
.ap-app button { font: inherit; }
.ap-side { display: flex; flex-direction: column; gap: 1.3em; min-width: 0; padding: 1.3em .95em; background: color-mix(in srgb, var(--app) 14%, #0e1411); color: #dfe8e2; }
.ap-brand { display: flex; align-items: center; gap: .65em; min-width: 0; color: #fff; }
.ap-brand b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.ap-mono { flex: none; display: grid; place-items: center; width: 2.3em; height: 2.3em; border-radius: .7em; background: var(--app); color: var(--app-on);
    font-size: .88em; font-weight: 800; letter-spacing: .02em; }
.ap-logo { flex: none; width: 2.3em; height: 2.3em; border-radius: .6em; object-fit: contain; background: #fff; }
.has-logo .ap-mono { display: none; }
.ap-menu { display: grid; gap: .22em; }
.ap-app .ap-nav, .ap-app .ap-nav:hover { display: flex; align-items: center; gap: .7em; padding: .6em .72em; border-radius: .7em;
    color: rgba(223, 232, 226, .78); font-size: .93em; line-height: 1.2; text-decoration: none; transition: background .2s, color .2s; }
.ap-app .ap-nav:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.ap-app .ap-nav.is-on { background: var(--app); color: var(--app-on); }
.ap-nav i { width: 1.2em; font-size: 1.05em; text-align: center; }
.ap-nav small { display: block; font-size: .78em; opacity: .7; }
.ap-app[data-lang="en"] .ap-nav small { display: none; }
.ap-user { display: flex; align-items: center; gap: .6em; margin-top: auto; padding: .6em .7em; border-radius: .7em; background: rgba(255, 255, 255, .06); font-size: .88em; }
.ap-user i { font-size: 1.6em; }
.ap-user b { display: block; color: #fff; }
.ap-user small { display: block; font-size: .82em; opacity: .7; }

.ap-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.ap-bar { display: flex; align-items: center; gap: .7em; padding: .75em 1.3em; background: #fff; border-bottom: 1px solid var(--ap-line); }
.ap-search { flex: 0 1 13em; display: flex; align-items: center; gap: .5em; padding: .45em .8em; border-radius: .6em; background: #f1f4f2; color: #7a857f; font-size: .86em; }
.ap-sync { display: inline-flex; align-items: center; gap: .35em; color: var(--ap-ok); font-size: .76em; font-weight: 600; animation: ap-fade 2.6s ease both; }
.ap-chips { display: flex; align-items: center; gap: .4em; margin-left: auto; }
.ap-chip { display: inline-flex; align-items: center; gap: .35em; padding: .35em .65em; border-radius: 99px; border: 0; white-space: nowrap; font-size: .74em; font-weight: 600;
    background: color-mix(in srgb, var(--app) 11%, #fff); color: color-mix(in srgb, var(--app) 78%, #000); }
.ap-chip-wa { background: #e6f7ed; color: #12804a; }
.ap-lang { gap: .45em; cursor: pointer; }
.ap-lang b, .ap-lang span { opacity: .55; font-weight: 600; }
.ap-app[data-lang="en"] .ap-lang b, .ap-app[data-lang="ta"] .ap-lang span { opacity: 1; font-weight: 800; }
.ap-roles { display: inline-flex; padding: .15em; border-radius: .6em; background: #f1f4f2; }
.ap-roles button { padding: .32em .6em; border: 0; border-radius: .45em; background: transparent; color: var(--ap-soft); font-size: .72em; font-weight: 600; cursor: pointer; }
.ap-roles button[aria-pressed="true"] { background: #fff; color: var(--ap-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.ap-bell { position: relative; flex: none; color: var(--ap-soft); font-size: 1.05em; }
.ap-bell b { position: absolute; top: -.55em; right: -.75em; min-width: 1.45em; height: 1.45em; padding: 0 .3em; border-radius: 99px; background: #e04848; color: #fff;
    font-size: .58em; line-height: 1.45em; text-align: center; }
/* Roles extra: what each role is allowed to see. */
.ap-app[data-role="operator"] [data-min-role="manager"], .ap-app[data-role="operator"] [data-min-role="owner"],
.ap-app[data-role="manager"] [data-min-role="owner"] { display: none !important; }

.ap-view { display: flex; flex-direction: column; gap: .85em; flex: 1; min-height: 0; overflow: hidden; padding: 1.05em 1.3em; }
.ap-view[hidden], .ap-pview[hidden] { display: none; }
.ap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1em; }
.ap-app .ap-head h3 { margin: 0; font: 800 1.42em/1.15 var(--heading-font); letter-spacing: -.01em; color: var(--ap-ink); }
.ap-head p { margin: .2em 0 0; color: var(--ap-soft); font-size: .84em; }
.ap-live { display: inline-flex; align-items: center; gap: .45em; padding: .35em .7em; border-radius: 99px; background: #fff; border: 1px solid var(--ap-line);
    color: var(--ap-soft); font-size: .76em; font-weight: 600; white-space: nowrap; }
.ap-live > i { position: relative; width: .55em; height: .55em; border-radius: 50%; background: #22c55e; }
.ap-live b { color: var(--ap-ink); }
.ap-card { min-width: 0; overflow: hidden; padding: .85em .95em; border-radius: .9em; border: 1px solid var(--ap-line); background: #fff; }
.ap-app .ap-card h4 { display: flex; align-items: baseline; justify-content: space-between; gap: .5em; margin: 0 0 .7em; font: 700 .88em/1.2 var(--heading-font); color: var(--ap-ink); }
.ap-app .ap-card h4 span { color: var(--ap-soft); font-weight: 500; font-size: .9em; }
.ap-kpi { display: grid; gap: .15em; align-content: start; min-width: 0; padding: .8em .95em; border-radius: .9em; border: 1px solid var(--ap-line); background: #fff; }
.ap-kpi > span { color: var(--ap-soft); font-size: .78em; }
.ap-kpi > b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 1.4em; font-weight: 800; letter-spacing: -.01em; color: var(--ap-ink); }
.ap-kpi > b small { font-size: .55em; font-weight: 600; color: var(--ap-soft); }
.ap-kpi > small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .72em; color: var(--ap-soft); }
.ap-meter { height: .42em; overflow: hidden; border-radius: 99px; background: #edf1ee; }
.ap-meter i { display: block; height: 100%; border-radius: 99px; background: var(--app); transition: width .7s cubic-bezier(.16, 1, .3, 1); }
.ap-pill { display: inline-block; padding: .2em .6em; border-radius: 99px; font-size: .86em; font-weight: 600; white-space: nowrap; }
.ap-ok { background: #e4f5e9; color: var(--ap-ok, #17803d); }
.ap-warn { background: #fdf1d8; color: var(--ap-warn, #925d00); }
.ap-bad { background: #fde7e7; color: var(--ap-bad, #bf2f2f); }
.ap-idle { background: #edf0f2; color: #5c6870; }
.ap-mini { padding: .35em .8em; border-radius: .55em; border: 1px solid var(--app); background: #fff; color: color-mix(in srgb, var(--app) 85%, #000);
    font-size: .78em; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ap-mini:hover { background: color-mix(in srgb, var(--app) 8%, #fff); }
.ap-mini-fill, .ap-mini-fill:hover { background: var(--app); color: var(--app-on); }
.ap-mini[disabled] { border-color: var(--ap-line); background: #f1f4f2; color: var(--ap-soft); cursor: default; }
.is-bump { animation: ap-bump 1.1s ease; }

/* Toasts: what just happened, at the foot of the screen. */
.ap-toasts { position: absolute; right: 1em; bottom: 1em; z-index: 5; display: grid; justify-items: end; gap: .5em; pointer-events: none; }
.ap-toast { display: flex; align-items: center; gap: .55em; max-width: 24em; padding: .6em .85em; border-radius: .75em; background: #17201b; color: #fff;
    box-shadow: 0 .8em 2em rgba(0, 0, 0, .25); font-size: .8em; animation: ap-toast 4.6s cubic-bezier(.16, 1, .3, 1) both; }
.ap-toast i { color: #4ade80; }
.ap-toast.is-alert i { color: #fbbf24; }
.ap-toast.is-wa i { color: #25d366; }

/* Production */
.ap-prod-top { display: grid; grid-template-columns: 1.35fr .9fr .9fr 1.5fr; gap: .8em; }
.ap-kpi-big > b { font-size: 1.85em; }
.ap-kpi-big .ap-meter { margin: .25em 0 .1em; }
.ap-hourly { padding-bottom: .6em; }
.ap-hourly h4 { margin-bottom: .5em !important; }
.ap-bars { display: flex; gap: .55em; height: 9em; }
.ap-bars-sm { gap: .4em; height: 3.6em; }
.ap-bar-c { flex: 1; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: .3em; min-width: 0; }
.ap-bar-c i { align-self: end; height: var(--h); min-height: 3px; border-radius: .3em .3em .12em .12em; background: color-mix(in srgb, var(--app) 30%, #fff);
    transform-origin: bottom; transition: height .7s cubic-bezier(.16, 1, .3, 1); }
.ap-bar-c.is-top i, .ap-bar-c.is-now i { background: var(--app); }
.ap-bar-c em { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: center; font-size: .64em; font-style: normal; color: #7a857f; }
.ap-lines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75em; }
.ap-line { display: grid; gap: .32em; padding: .75em .85em; border-radius: .9em; border: 1px solid var(--ap-line); background: #fff; transition: border-color .3s; }
.ap-line-h { display: flex; align-items: center; justify-content: space-between; gap: .5em; }
.ap-line-h b { font-size: .92em; }
.ap-line-h .ap-pill { font-size: .7em; }
.ap-line p { margin: 0; color: var(--ap-soft); font-size: .78em; }
.ap-line-n b { font-size: 1.3em; font-weight: 800; }
.ap-line-n span { margin-left: .25em; color: var(--ap-soft); font-size: .78em; }
.ap-line small { color: var(--ap-soft); font-size: .72em; }
.ap-line-warn { border-color: #f1d6a0; }
.ap-line-warn .ap-meter i { background: #e0a100; }
.ap-line-idle { background: #fafbfa; }

/* Stock */
.ap-tabs-in { display: inline-flex; padding: .15em; border-radius: .6em; background: #e9eeea; }
.ap-tabs-in button { padding: .35em .7em; border: 0; border-radius: .45em; background: transparent; color: var(--ap-soft); font-size: .76em; font-weight: 600; cursor: pointer; }
.ap-tabs-in button b { margin-left: .25em; color: var(--ap-ink); }
.ap-tabs-in button[aria-pressed="true"] { background: #fff; color: var(--ap-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.ap-stock { padding: .4em .95em; }
.ap-stock-row { display: grid; grid-template-columns: 2.1fr 2fr 1.1fr .8fr 1fr; align-items: center; gap: .9em; padding: .62em 0; border-bottom: 1px solid #eef1ef; font-size: .86em; }
.ap-stock-row:last-child { border-bottom: 0; }
.ap-stock-th { padding: .45em 0; color: #7a857f; font-size: .76em; font-weight: 600; }
.ap-stock-name b { display: block; }
.ap-stock-name small { color: var(--ap-soft); font-size: .82em; }
.ap-level { position: relative; height: .6em; border-radius: 99px; background: #edf1ee; }
.ap-level i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--app); transition: width .7s cubic-bezier(.16, 1, .3, 1); }
.ap-level em { position: absolute; top: -.3em; bottom: -.3em; width: 2px; margin-left: -1px; border-radius: 2px; background: #c0392b; }
.is-low .ap-level i { background: #e0a100; }
.ap-stock[data-filter="low"] .ap-stock-row:not(.is-low):not(.ap-stock-th) { display: none; }

/* Machines */
.ap-floor { display: grid; grid-template-columns: minmax(0, 1fr) 13.5em; gap: .8em; min-height: 0; }
.ap-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55em; }
.ap-tile { display: grid; gap: .15em; padding: .5em .6em .45em; border-radius: .75em; border: 1px solid var(--ap-line); background: #fff; color: var(--ap-ink);
    text-align: left; cursor: pointer; transition: border-color .2s, background .3s; }
.ap-tile:hover { border-color: color-mix(in srgb, var(--app) 50%, #fff); }
.ap-tile.is-on { outline: 2px solid var(--app); outline-offset: 1px; }
.ap-tile-h { display: flex; align-items: center; justify-content: space-between; }
.ap-tile-h b { font-size: .82em; }
.ap-tile-n { color: var(--ap-soft); font-size: .7em; }
.ap-tile-f { display: flex; justify-content: space-between; gap: .4em; color: var(--ap-soft); font-size: .68em; }
.ap-tile-f span:first-child { color: var(--ap-ink); font-weight: 700; }
.ap-st-dot { position: relative; width: .6em; height: .6em; border-radius: 50%; background: #22a559; }
.ap-spark { display: block; width: 100%; height: 1.7em; }
.ap-spark polyline { fill: none; stroke: var(--app); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ap-st-idle .ap-st-dot { background: #9aa5ad; } .ap-st-idle .ap-spark polyline { stroke: #b6bfc4; }
.ap-st-warn { border-color: #f1d6a0; background: #fffaf0; } .ap-st-warn .ap-st-dot { background: #e0a100; } .ap-st-warn .ap-spark polyline { stroke: #e0a100; }
.ap-st-stop { border-color: #f3c4c4; background: #fff5f5; } .ap-st-stop .ap-st-dot { background: #e04848; }
.ap-st-stop .ap-spark polyline { stroke: #e04848; }
.ap-st-ack .ap-st-dot { background: #6f42c1; }
.ap-detail { display: flex; flex-direction: column; gap: .6em; }
.ap-detail h4 { margin: 0 !important; }
.ap-detail .ap-pill { align-self: start; font-size: .74em; }
.ap-detail dl { display: grid; gap: .55em; margin: 0; }
.ap-detail dt { color: var(--ap-soft); font-size: .74em; }
.ap-detail dd { margin: 0; font-weight: 700; font-size: .95em; }
.ap-detail .ap-mini { margin-top: auto; align-self: start; }

/* Orders */
.ap-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65em; flex: 1; min-height: 0; }
.ap-col { display: flex; flex-direction: column; gap: .55em; min-width: 0; padding: .6em; border-radius: .9em; background: #e9eeea; }
.ap-app .ap-col h4 { display: flex; align-items: center; justify-content: space-between; margin: 0 .15em; font: 700 .8em/1.2 var(--heading-font); color: var(--ap-ink); }
.ap-col h4 b { min-width: 1.6em; padding: .1em .45em; border-radius: 99px; background: #fff; color: var(--ap-soft); font-size: .9em; text-align: center; }
.ap-col-cards { display: grid; align-content: start; gap: .5em; min-height: 3em; }
.ap-order { position: relative; display: grid; gap: .12em; padding: .6em .65em .6em; border-radius: .7em; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.ap-order-h { display: flex; justify-content: space-between; gap: .4em; }
.ap-order-h b { font-size: .82em; }
.ap-order-h span { color: color-mix(in srgb, var(--app) 75%, #000); font-size: .76em; font-weight: 700; }
.ap-order p { margin: 0; font-size: .8em; padding-right: 1.6em; }
.ap-order small { color: var(--ap-soft); font-size: .72em; }
.ap-paid { justify-self: start; margin-top: .25em; font-size: .68em; }
.ap-move { position: absolute; right: .45em; bottom: .45em; display: grid; place-items: center; width: 1.75em; height: 1.75em; border-radius: 50%; border: 0;
    background: color-mix(in srgb, var(--app) 12%, #fff); color: color-mix(in srgb, var(--app) 85%, #000); font-size: .85em; cursor: pointer; transition: background .2s; }
.ap-move:hover { background: var(--app); color: var(--app-on); }
.ap-order.is-new { animation: ap-drop-in .7s cubic-bezier(.16, 1, .3, 1) both; }

/* Quality */
.ap-qgrid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: .8em; min-height: 0; }
.ap-checklist { display: grid; margin: 0; padding: 0; list-style: none; }
.ap-checklist li { display: flex; align-items: center; justify-content: space-between; gap: .6em; padding: .48em 0; border-bottom: 1px solid #eef1ef; font-size: .84em; }
.ap-pf { display: inline-flex; padding: .15em; border-radius: .55em; background: #eef1ef; }
.ap-pf button { padding: .28em .7em; border: 0; border-radius: .42em; background: transparent; color: var(--ap-soft); font-size: .82em; font-weight: 700; cursor: pointer; }
.ap-pf button[data-ap-pf="pass"][aria-pressed="true"] { background: #22a559; color: #fff; }
.ap-pf button[data-ap-pf="fail"][aria-pressed="true"] { background: #e04848; color: #fff; }
.ap-inspect-f { display: flex; align-items: center; justify-content: space-between; gap: .6em; margin-top: .7em; font-size: .82em; color: var(--ap-soft); }
.ap-inspect-f b { color: var(--ap-ink); }
.ap-inspect-f .ap-mini { font-size: .92em; }
.ap-qside { display: grid; gap: .8em; align-content: start; }
.ap-hbars { display: grid; gap: .42em; }
.ap-hbars div { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) 1.6em; align-items: center; gap: .5em; font-size: .78em; }
.ap-hbars i { height: .62em; border-radius: 99px; background: color-mix(in srgb, var(--app) 35%, #fff); transition: width .6s; }
.ap-hbars div:first-child i { background: var(--app); }
.ap-hbars b { text-align: right; }
.ap-batches { display: grid; margin: 0; padding: 0; list-style: none; }
.ap-batches li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; align-items: center; gap: .5em; padding: .4em 0; border-bottom: 1px solid #eef1ef; font-size: .8em; }
.ap-batches li:last-child { border-bottom: 0; }
.ap-batches span { color: var(--ap-soft); }
.ap-batches .ap-pill { font-size: .9em; }

/* Staff */
.ap-roster { padding: .3em .95em; }
.ap-roster-row { display: grid; grid-template-columns: 2fr .9fr 1.15fr 1.1fr .8fr; align-items: center; gap: .8em; padding: .44em 0; border-bottom: 1px solid #eef1ef; font-size: .84em; }
.ap-roster-row:last-child { border-bottom: 0; }
.ap-roster-th { padding: .45em 0; color: #7a857f; font-size: .74em; font-weight: 600; }
.ap-person { display: flex; align-items: center; gap: .55em; min-width: 0; }
.ap-person b { display: block; }
.ap-person small { display: block; color: var(--ap-soft); font-size: .82em; }
.ap-avatar { flex: none; display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%; background: color-mix(in srgb, var(--app) 14%, #fff);
    color: color-mix(in srgb, var(--app) 85%, #000); font-style: normal; font-weight: 800; }
.ap-week { display: flex; gap: .28em; }
.ap-week .ap-dot { width: .62em; height: .62em; }
.ap-roster-row .ap-pill { font-size: .86em; }

/* Retail: billing */
.ap-pos { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .8em; flex: 1; min-height: 0; }
.ap-pos-search { display: flex; align-items: center; gap: .5em; margin-bottom: .7em; padding: .55em .8em; border-radius: .6em; background: #f1f4f2; color: #7a857f; font-size: .84em; }
.ap-pos-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5em; }
.ap-pos-tile { display: grid; gap: .3em; align-content: start; min-height: 4.6em; padding: .7em .6em; border-radius: .7em; border: 1px solid var(--ap-line); background: #fafbfa;
    color: var(--ap-ink); text-align: left; cursor: pointer; transition: border-color .2s, transform .15s; }
.ap-pos-tile:hover { border-color: var(--app); }
.ap-pos-tile:active { transform: scale(.96); }
.ap-pos-tile b { font-size: .8em; line-height: 1.25; }
.ap-pos-tile span { color: color-mix(in srgb, var(--app) 80%, #000); font-size: .78em; font-weight: 700; }
.ap-pos-bill { display: flex; flex-direction: column; }
.ap-bill { display: grid; align-content: start; flex: 1; min-height: 0; margin: 0; padding: 0; overflow: hidden; list-style: none; }
.ap-bill li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .6em; padding: .45em 0; border-bottom: 1px dashed var(--ap-line); font-size: .82em; }
.ap-bill li span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ap-bill em { font-style: normal; color: var(--ap-soft); }
.ap-bill b { min-width: 3.6em; text-align: right; }
.ap-bill li.is-new { animation: ap-drop-in .5s cubic-bezier(.16, 1, .3, 1) both; }
.ap-bill-total { display: flex; align-items: baseline; justify-content: space-between; margin: .4em 0 .55em; padding-top: .55em; border-top: 2px solid var(--ap-ink); }
.ap-bill-total span { font-size: .84em; font-weight: 700; }
.ap-bill-total small { color: var(--ap-soft); font-size: .85em; font-weight: 400; }
.ap-bill-total b { font-size: 1.35em; font-weight: 800; }
.ap-paymode { display: flex; gap: .3em; margin-bottom: .55em; }
.ap-paymode button { flex: 1; padding: .45em; border-radius: .55em; border: 1px solid var(--ap-line); background: #fff; color: var(--ap-soft); font-size: .78em; font-weight: 700; cursor: pointer; }
.ap-paymode button[aria-pressed="true"] { border-color: var(--app); background: color-mix(in srgb, var(--app) 10%, #fff); color: color-mix(in srgb, var(--app) 85%, #000); }
.ap-wide { width: 100%; padding: .62em; font-size: .86em; }
.ap-two { display: grid; grid-template-columns: 1fr 1.4fr; gap: .45em; }
.ap-pbtn-line, .ap-pbtn-line:hover { border: 1px solid var(--ap-line); background: #fff; color: var(--ap-ink); }

/* Retail: online store */
.ap-shop { padding: .35em .95em; }
.ap-shop-row { display: grid; grid-template-columns: 1.4fr 1.3fr 1fr 1.7fr .9fr; align-items: center; gap: .8em; padding: .55em 0; border-bottom: 1px solid #eef1ef; font-size: .84em; }
.ap-shop-row:last-child { border-bottom: 0; }
.ap-shop-row b, .ap-shop-row small { display: block; }
.ap-shop-row small { color: var(--ap-soft); font-size: .82em; }
.ap-shop-row.is-new { animation: ap-drop-in .6s cubic-bezier(.16, 1, .3, 1) both; }
.ap-shop-th { padding: .45em 0; color: #7a857f; font-size: .74em; font-weight: 600; }
.ap-steps-in { display: flex; align-items: center; gap: .25em; }
.ap-steps-in i { width: 1.5em; height: .32em; border-radius: 99px; background: #e3e8e5; transition: background .3s; }
.ap-steps-in i.is-on { background: var(--app); }
.ap-steps-in em { margin-left: .45em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ap-soft); font-size: .8em; font-style: normal; }
.ap-banner { display: grid; gap: .1em; padding: .75em .85em; border-radius: 1em; background: linear-gradient(135deg, var(--app), color-mix(in srgb, var(--app) 55%, #000)); color: var(--app-on); }
.ap-banner span { font-size: .76em; opacity: .88; }
.ap-shelf { display: grid; gap: .4em; margin: 0; padding: 0; list-style: none; }
.ap-shelf li { display: flex; align-items: center; justify-content: space-between; gap: .5em; padding: .5em .5em .5em .75em; border-radius: .85em; border: 1px solid var(--ap-line); background: #fff; font-size: .8em; color: var(--ap-soft); }
.ap-shelf li b { display: block; color: var(--ap-ink); }
.ap-shelf button { display: grid; place-items: center; flex: none; width: 2.1em; height: 2.1em; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--app) 14%, #fff);
    color: color-mix(in srgb, var(--app) 85%, #000); font-size: 1.1em; cursor: pointer; }
.ap-shelf li.is-in { border-color: color-mix(in srgb, var(--app) 45%, #fff); }
.ap-pbtn.ap-cart { display: flex; align-items: center; justify-content: space-between; gap: .5em; margin-top: auto; text-align: left; }
.ap-pbtn.ap-cart span { font-weight: 500; opacity: .9; font-size: .92em; }

/* Retail: loyalty */
.ap-loy { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: .8em; }
.ap-offer { display: flex; flex-direction: column; gap: .45em; background: linear-gradient(135deg, color-mix(in srgb, var(--app) 13%, #fff), #fff 70%); }
.ap-offer-tag { align-self: start; padding: .25em .6em; border-radius: 99px; background: var(--app); color: var(--app-on); font-size: .68em; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ap-offer > b { font-size: 1.3em; font-weight: 800; line-height: 1.2; }
.ap-offer p { margin: 0; color: var(--ap-soft); font-size: .82em; line-height: 1.4; }
.ap-offer-f { display: flex; align-items: center; justify-content: space-between; gap: .6em; margin-top: auto; padding-top: .5em; color: var(--ap-soft); font-size: .8em; }
.ap-offer-f b { color: var(--ap-ink); }
.ap-offer-f .ap-mini { font-size: .98em; }
.ap-lcard { position: relative; display: grid; gap: .2em; min-height: 8.2em; padding: 1em; border-radius: 1.1em;
    background: linear-gradient(135deg, var(--app), color-mix(in srgb, var(--app) 50%, #000)); color: var(--app-on); box-shadow: 0 .7em 1.5em -.7em var(--app); }
.ap-lcard > span { font-size: .78em; opacity: .9; }
.ap-lcard-pts { margin-top: auto; font-size: 1.55em; font-weight: 800; }
.ap-lcard small { font-size: .72em; opacity: .85; }
.ap-qr { position: absolute; right: .9em; top: .9em; width: 3em; height: 3em; padding: .3em; border-radius: .4em; background: rgba(255, 255, 255, .92); fill: #17201b; }

/* Retail: purchase */
.ap-po { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: .8em; }
.ap-po-row { display: grid; grid-template-columns: 1.2fr 1.4fr auto; align-items: center; gap: .8em; padding: .55em 0; border-bottom: 1px solid #eef1ef; font-size: .84em; }
.ap-po-row:last-child { border-bottom: 0; }
.ap-po-row b, .ap-po-row small { display: block; }
.ap-po-row small { color: var(--ap-soft); font-size: .82em; }
.ap-po-bar { display: grid; gap: .3em; }
.ap-billsdue { display: grid; margin: 0; padding: 0; list-style: none; }
.ap-billsdue li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .6em; padding: .55em 0; border-bottom: 1px solid #eef1ef; font-size: .84em; }
.ap-billsdue li:last-child { border-bottom: 0; }
.ap-billsdue li span b, .ap-billsdue li span small { display: block; }
.ap-billsdue small { color: var(--ap-soft); font-size: .82em; }

/* Retail: reports */
.ap-rep { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .8em; }
.ap-days { display: flex; align-items: flex-end; gap: .22em; height: 12em; }
.ap-days span { position: relative; flex: 1; height: 100%; }
.ap-days i { position: absolute; bottom: 0; border-radius: .2em .2em 0 0; transition: height .6s cubic-bezier(.16, 1, .3, 1); }
.ap-days .ap-last { left: 0; right: 0; background: #e6ebe7; }
.ap-days .ap-this { left: 20%; right: 20%; background: color-mix(in srgb, var(--app) 55%, #fff); }
.ap-days span.is-now .ap-this { background: var(--app); }
.ap-days-x { display: flex; justify-content: space-between; margin-top: .35em; color: var(--ap-soft); font-size: .68em; }
.ap-key { display: inline-block; width: .7em; height: .7em; margin: 0 .25em 0 .6em; border-radius: .2em; background: color-mix(in srgb, var(--app) 55%, #fff); vertical-align: -.05em; }
.ap-key-last { background: #e3e8e5; }
.ap-rep-side { display: grid; align-content: start; gap: .8em; }
.ap-mix { display: flex; align-items: center; gap: 1em; }
.ap-donut { position: relative; flex: none; width: 6.4em; height: 6.4em; border-radius: 50%; }
.ap-donut::after { content: ""; position: absolute; inset: 27%; border-radius: 50%; background: #fff; }
.ap-mix ul { display: grid; gap: .3em; flex: 1; margin: 0; padding: 0; list-style: none; font-size: .78em; }
.ap-mix li { display: flex; align-items: center; gap: .45em; }
.ap-mix li i { flex: none; width: .7em; height: .7em; border-radius: .2em; }
.ap-mix li b { margin-left: auto; }
.ap-best { display: grid; margin: 0; padding: 0; list-style: none; }
.ap-best li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .7em; padding: .42em 0; border-bottom: 1px solid #eef1ef; font-size: .8em; }
.ap-best li:last-child { border-bottom: 0; }
.ap-best b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ap-best span { color: var(--ap-soft); white-space: nowrap; }
.ap-best span:last-child { color: var(--ap-ink); font-weight: 700; }

/* Agriculture: farmer register */
.ap-reg { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .8em; min-height: 0; }
.ap-find { display: flex; align-items: center; gap: .5em; margin-bottom: .45em; padding: .5em .75em; border-radius: .6em; background: #f1f4f2; color: #7a857f; font-size: .84em; }
.ap-find input { flex: 1; min-width: 0; padding: 0; border: 0; outline: none; background: transparent; color: var(--ap-ink); font: inherit; }
.ap-farmer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6em; width: 100%; padding: .42em .45em; border: 0; border-bottom: 1px solid #eef1ef;
    border-radius: .5em; background: transparent; color: var(--ap-ink); text-align: left; font-size: .84em; cursor: pointer; }
.ap-farmer:hover { background: #f6f8f7; }
.ap-farmer.is-on { background: color-mix(in srgb, var(--app) 9%, #fff); }
.ap-farmer.is-new { animation: ap-drop-in .6s cubic-bezier(.16, 1, .3, 1) both; }
.ap-farmer b, .ap-farmer small { display: block; }
.ap-farmer small { color: var(--ap-soft); font-size: .82em; }
.ap-farmer .ap-pill { font-size: .78em; }
.ap-profile { display: flex; flex-direction: column; align-items: flex-start; gap: .3em; }
.ap-avatar-lg { width: 2.8em; height: 2.8em; font-size: 1.1em; }
.ap-profile > b { font-size: 1.1em; }
.ap-profile > small { color: var(--ap-soft); font-size: .8em; }
.ap-profile dl { display: grid; gap: .5em; width: 100%; margin: .4em 0; }
.ap-profile dt { color: var(--ap-soft); font-size: .74em; }
.ap-profile dd { margin: 0; font-weight: 700; font-size: .9em; }
.ap-profile .ap-mini { margin-top: auto; }
.ap-formlist { display: grid; gap: .35em; margin: 0; padding: 0; list-style: none; }
.ap-formlist li { display: flex; justify-content: space-between; gap: .6em; padding: .55em .7em; border-radius: .75em; border: 1px solid var(--ap-line); background: #fff; font-size: .8em; }
.ap-formlist span { color: var(--ap-soft); }
.ap-formlist b { text-align: right; }
.ap-ok-text { color: #17803d; }

/* Agriculture: fields */
.ap-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .2em .7em; max-width: 24em; color: var(--ap-soft); font-size: .72em; }
.ap-legend span { display: inline-flex; align-items: center; gap: .3em; }
.ap-legend i { width: .75em; height: .75em; border-radius: .2em; background: var(--c); }
.ap-crop-0 { --c: #e3b23c; } .ap-crop-1 { --c: #86a1ea; } .ap-crop-2 { --c: #e0694a; } .ap-crop-3 { --c: #7d8c84; } .ap-crop-4 { --c: #b47ae0; }
.ap-fieldmap { display: grid; grid-template-columns: minmax(0, 1fr) 15.5em; gap: .8em; min-height: 0; }
.ap-plots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45em; }
.ap-plot { position: relative; display: grid; gap: .15em; align-content: start; min-height: 4.4em; padding: .6em .6em .55em .7em; border: 0; border-left: .45em solid var(--c); border-radius: .55em;
    background: color-mix(in srgb, var(--c) 20%, #fff); color: var(--ap-ink); text-align: left; cursor: pointer; }
.ap-plot.is-on { outline: 2px solid var(--app); outline-offset: 1px; }
.ap-plot b { font-size: .82em; }
.ap-plot span { color: var(--ap-soft); font-size: .7em; }
.ap-hdot { position: absolute; top: .6em; right: .6em; width: .62em; height: .62em; border-radius: 50%; background: #22a559; }
.ap-h-warn { background: #e0a100; } .ap-h-bad { background: #e04848; }
.ap-stagebar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .2em; margin: .2em 0; padding: 0; list-style: none; }
.ap-stagebar li { overflow: hidden; padding-top: .45em; border-top: .3em solid #e3e8e5; color: var(--ap-soft); font-size: .64em; white-space: nowrap; text-overflow: ellipsis; }
.ap-stagebar li.is-on { border-color: var(--app); color: var(--ap-ink); }

/* Agriculture: procurement */
.ap-weigh { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: .8em; }
.ap-scale { display: flex; flex-direction: column; gap: .55em; }
.ap-reading { display: block; padding: .35em .55em; border-radius: .5em; background: #0f1512; color: #7cf29a; text-align: right; letter-spacing: .04em;
    font: 700 2.3em/1.1 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.ap-reading small { font-size: .42em; color: #9fb5a6; }
.ap-scale dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5em; margin: 0; }
.ap-scale dt { color: var(--ap-soft); font-size: .72em; }
.ap-scale dd { margin: 0; font-weight: 700; font-size: .92em; }
.ap-slips { display: grid; margin: 0; padding: 0; list-style: none; }
.ap-slips li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .6em; padding: .5em 0; border-bottom: 1px solid #eef1ef; font-size: .82em; }
.ap-slips li:last-child { border-bottom: 0; }
.ap-slips li > span:first-child b, .ap-slips li > span:first-child small { display: block; }
.ap-slips small { color: var(--ap-soft); font-size: .84em; }

/* Agriculture: sensors */
.ap-gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7em; }
.ap-gauge-card { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; gap: .35em .8em; padding: .8em .9em;
    border-radius: .9em; border: 1px solid var(--ap-line); background: #fff; transition: background .3s, border-color .3s; }
.ap-gauge-card.is-dry { border-color: #f1d6a0; background: #fffaf0; }
.ap-gauge { --v: 50; position: relative; grid-row: span 2; display: grid; place-items: center; width: 4.6em; height: 4.6em; border-radius: 50%;
    background: conic-gradient(var(--g, var(--app)) calc(var(--v) * 1%), #e9eeea 0); }
.ap-gauge::before { content: ""; position: absolute; inset: .55em; border-radius: 50%; background: #fff; }
.ap-gauge b { position: relative; font-size: .95em; font-weight: 800; }
.is-dry .ap-gauge, .ap-gauge.is-dry { --g: #e0a100; }
.ap-gauge-t b, .ap-gauge-t small, .ap-gauge-t em { display: block; }
.ap-gauge-t small { color: var(--ap-soft); font-size: .74em; }
.ap-gauge-t em { margin-top: .2em; color: #17803d; font-size: .72em; font-style: normal; font-weight: 700; }
.is-dry .ap-gauge-t em { color: #925d00; }
.ap-switch { justify-self: start; display: inline-flex; align-items: center; gap: .45em; padding: 0; border: 0; background: none; color: var(--ap-soft); font-size: .76em; font-weight: 700; cursor: pointer; }
.ap-switch i { position: relative; width: 2.3em; height: 1.3em; border-radius: 99px; background: #cfd6d2; transition: background .2s; }
.ap-switch i::after { content: ""; position: absolute; top: .15em; left: .15em; width: 1em; height: 1em; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s; }
.ap-switch[aria-pressed="true"] { color: var(--ap-ink); }
.ap-switch[aria-pressed="true"] i { background: var(--app); }
.ap-switch[aria-pressed="true"] i::after { transform: translateX(1em); }
.ap-pgauge { display: flex; align-items: center; gap: .9em; padding: .3em .2em; font-size: .9em; }
.ap-pgauge small { color: var(--ap-soft); }
.ap-gauge-lg { width: 6em; height: 6em; font-size: 1.05em; }

/* Agriculture: godowns */
.ap-godowns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8em; }
.ap-godown { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: .35em .8em; }
.ap-godown h4 { grid-column: 1 / -1; margin-bottom: .2em !important; }
.ap-fill { position: relative; grid-row: 2 / 4; min-height: 5em; overflow: hidden; border-radius: .4em; background: #edf1ee; }
.ap-fill i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--app); transition: height .6s cubic-bezier(.16, 1, .3, 1); }
.is-full .ap-fill i { background: #e0a100; }
.ap-godown ul { display: grid; align-content: start; gap: .25em; margin: 0; padding: 0; list-style: none; font-size: .76em; }
.ap-godown li { display: flex; justify-content: space-between; gap: .4em; }
.ap-godown li span { color: var(--ap-soft); }
.ap-godown > small { color: var(--ap-soft); font-size: .72em; }
.ap-moves { display: grid; margin: 0; padding: 0; list-style: none; }
.ap-moves li { display: grid; grid-template-columns: 3.4em minmax(0, 1.3fr) minmax(0, 1.5fr) auto; align-items: center; gap: .6em; padding: .45em 0; border-bottom: 1px solid #eef1ef; font-size: .8em; }
.ap-moves li:last-child { border-bottom: 0; }
.ap-moves li.is-new { animation: ap-drop-in .6s cubic-bezier(.16, 1, .3, 1) both; }
.ap-moves span:not(.ap-pill), .ap-moves small { color: var(--ap-soft); }
.ap-moves .ap-pill { justify-self: start; font-size: .82em; }
.ap-seg-in { display: grid; grid-template-columns: 1fr 1fr; padding: .2em; border-radius: .8em; background: #e9eeea; }
.ap-seg-in button { padding: .5em; border: 0; border-radius: .6em; background: transparent; color: var(--ap-soft); font-size: .85em; font-weight: 700; cursor: pointer; }
.ap-seg-in button[aria-pressed="true"] { background: #fff; color: var(--ap-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Agriculture: advisory */
.ap-adv { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: .8em; }
.ap-compose { display: flex; flex-direction: column; gap: .6em; }
.ap-chipset { display: flex; flex-wrap: wrap; gap: .35em; }
.ap-chipset button { padding: .35em .7em; border-radius: 99px; border: 1px solid var(--ap-line); background: #fff; color: var(--ap-soft); font-size: .76em; font-weight: 600; cursor: pointer; }
.ap-chipset button[aria-pressed="true"] { border-color: var(--app); background: var(--app); color: var(--app-on); }
.ap-chipset button b { margin-left: .25em; opacity: .8; }
.ap-msg { padding: .7em .85em; border-radius: .8em; background: #f1f4f2; }
.ap-msg p { margin: 0 0 .3em; color: var(--ap-ink); font-size: .88em; line-height: 1.45; }
.ap-msg small { color: var(--ap-soft); font-size: .76em; }
.ap-sent { display: grid; margin: 0; padding: 0; list-style: none; }
.ap-sent li { display: grid; grid-template-columns: minmax(0, 1fr) 4.5em auto; align-items: center; gap: .6em; padding: .5em 0; border-bottom: 1px solid #eef1ef; font-size: .8em; }
.ap-sent li:last-child { border-bottom: 0; }
.ap-sent li.is-new { animation: ap-drop-in .6s cubic-bezier(.16, 1, .3, 1) both; }
.ap-sent b, .ap-sent small { display: block; }
.ap-sent small { color: var(--ap-soft); font-size: .84em; }
.ap-sent em { color: var(--ap-soft); font-size: .9em; font-style: normal; white-space: nowrap; }
.ap-chat { display: flex; flex-direction: column; justify-content: flex-end; gap: .5em; flex: 1; min-height: 0; overflow: hidden; padding: .5em; border-radius: 1em; background: #e6ede8; }
.ap-bubble { max-width: 94%; margin: 0; padding: .55em .7em; border-radius: .9em .9em .9em .25em; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); font-size: .76em; }
.ap-bubble span, .ap-bubble small, .ap-bubble em { display: block; }
.ap-bubble span { color: var(--ap-ink); line-height: 1.35; }
.ap-bubble small { margin-top: .25em; color: var(--ap-soft); font-size: .86em; }
.ap-bubble em { margin-top: .2em; color: #98a39c; font-size: .8em; font-style: normal; text-align: right; }
.ap-bubble.is-new { animation: ap-drop-in .6s cubic-bezier(.16, 1, .3, 1) both; }

/* The shared screen (modules without a design of their own yet) */
.ap-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8em; }
.ap-cards { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: .8em; }
.ap-table { width: 100%; border-collapse: collapse; font-size: .84em; }
.ap-table th { padding: 0 .7em .55em 0; border-bottom: 1px solid var(--ap-line); text-align: left; font-size: .9em; font-weight: 600; color: #7a857f; white-space: nowrap; }
.ap-table td { padding: .58em .7em .58em 0; border-bottom: 1px solid #eef1ef; color: var(--ap-ink); white-space: nowrap; }
.ap-table tr:last-child td { border-bottom: 0; }

/* ---------- the sketched phone app ---------- */
.ap-papp { --ap-ink: #17201b; --ap-soft: #66726b; --ap-line: #e3e8e5; position: relative; display: flex; flex-direction: column; height: 100%; text-align: left;
    font: 400 5.4cqw/1.3 var(--heading-font); color: var(--ap-ink); }
.ap-papp button { font: inherit; }
.ap-status { display: flex; align-items: center; justify-content: space-between; padding: .75em 1.25em .35em; font-size: .78em; font-weight: 700; }
.ap-notch { width: 5.5em; height: 1.5em; border-radius: 99px; background: #0b0e0c; }
.ap-sig { display: flex; align-items: flex-end; gap: .16em; }
.ap-sig i { width: .26em; border-radius: 1px; background: #17201b; }
.ap-sig i:nth-child(1) { height: .45em; } .ap-sig i:nth-child(2) { height: .7em; } .ap-sig i:nth-child(3) { height: .95em; }
.ap-net { display: inline-flex; align-items: center; gap: .3em; padding: .2em .55em; border: 0; border-radius: 99px; background: #e6f7ed; color: #12804a;
    font-size: .92em; font-weight: 700; cursor: pointer; }
.ap-net[aria-pressed="true"] { background: #fde7e7; color: #bf2f2f; }
.ap-wa-stack { position: absolute; top: 2.3em; left: .5em; right: .5em; z-index: 4; display: grid; gap: .4em; pointer-events: none; }
.ap-wa { display: flex; align-items: flex-start; gap: .55em; padding: .65em .75em; border-radius: 1em; background: rgba(255, 255, 255, .97);
    box-shadow: 0 .7em 1.8em rgba(0, 0, 0, .22); font-size: .74em; line-height: 1.3; color: #33403a; animation: ap-wa 5.5s cubic-bezier(.16, 1, .3, 1) both; }
.ap-wa i { flex: none; color: #25d366; font-size: 1.5em; line-height: 1; }
.ap-wa b { display: block; color: #17201b; }
.ap-queue { display: flex; align-items: center; gap: .4em; margin: .25em .9em 0; padding: .45em .7em; border-radius: .7em; background: #fff3d1; color: #835500;
    font-size: .72em; font-weight: 600; }
.ap-pview { display: flex; flex-direction: column; gap: .62em; flex: 1; min-height: 0; overflow: hidden; padding: .45em .9em .8em; }
.ap-phead { display: flex; align-items: center; gap: .6em; padding-top: .2em; font-size: 1.02em; }
.ap-phead b { font-weight: 800; }
.ap-phead .ap-mono, .ap-phead .ap-logo { width: 2em; height: 2em; font-size: .8em; }
.ap-hero { display: grid; gap: .1em; padding: .85em 1em; border-radius: 1em; background: var(--app); color: var(--app-on); box-shadow: 0 .7em 1.5em -.7em var(--app); }
.ap-hero span, .ap-hero small { font-size: .76em; opacity: .88; }
.ap-hero b { font-size: 1.6em; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.ap-hero-bad { background: #c0392b; color: #fff; box-shadow: 0 .7em 1.5em -.7em #c0392b; }
.ap-plist { display: grid; gap: .42em; margin: 0; padding: 0; list-style: none; }
.ap-plist li { display: flex; align-items: center; gap: .65em; padding: .58em .75em; border-radius: .85em; border: 1px solid var(--ap-line); background: #fff; font-size: .8em; color: var(--ap-soft); }
.ap-plist li > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ap-plist b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; color: var(--ap-ink); }
.ap-plist .ap-pay { border-color: #c3ead1; background: #e9f8ef; }
.ap-plist li.is-new { animation: ap-drop-in .6s cubic-bezier(.16, 1, .3, 1) both; }
.ap-dot { flex: none; width: .65em; height: .65em; border-radius: 50%; background: #c5ccc8; }
.ap-dot.ap-ok { background: #22a559; } .ap-dot.ap-warn { background: #e0a100; } .ap-dot.ap-bad { background: #e04848; } .ap-dot.ap-idle { background: #9aa5ad; }
.ap-pbtn { display: block; width: 100%; padding: .78em; border: 0; border-radius: .95em; background: var(--app); color: var(--app-on); text-align: center;
    font-size: .88em; font-weight: 700; cursor: pointer; transition: transform .15s, filter .2s; }
.ap-pbtn:hover { filter: brightness(1.08); }
.ap-pbtn:active { transform: scale(.97); }
.ap-pbtn.is-done { filter: saturate(.6); }
.ap-tabs { display: flex; justify-content: space-around; padding: .6em .4em .95em; border-top: 1px solid #e3e8e5; background: #fff; color: #8a958e; font-size: 1.05em; }
.ap-tabs i:first-child { color: var(--app); }

.ap-stepper { display: grid; grid-template-columns: 2.8em minmax(0, 1fr) 2.8em; align-items: center; padding: .3em; border-radius: 1em; border: 1px solid var(--ap-line); background: #fff; }
.ap-stepper button { height: 2.5em; border: 0; border-radius: .7em; background: #eef2ef; color: var(--ap-ink); font-size: 1.15em; font-weight: 700; cursor: pointer; }
.ap-stepper output { text-align: center; font-size: 1.45em; font-weight: 800; }
.ap-scan { position: relative; display: grid; place-items: center; height: 8.5em; overflow: hidden; border-radius: 1em; background: radial-gradient(circle at 50% 40%, #2a332e, #0d1210); }
.ap-scan-frame { position: relative; width: 70%; height: 56%; border-radius: .6em; border: 2px solid rgba(255, 255, 255, .7); }
/* The red line sweeps the frame by moving a box as tall as its run (12% to 82%) with the line on
   its top edge: a transform, which the compositor runs, where moving "top" relaid it every frame. */
.ap-scan-line { position: absolute; left: 6%; right: 6%; top: 12%; height: 70%; pointer-events: none; animation: ap-scan 1.8s ease-in-out infinite alternate; }
.ap-scan-line::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: #e04848; box-shadow: 0 0 .6em #e04848; }
.ap-scan-hint { position: absolute; bottom: .55em; color: rgba(255, 255, 255, .75); font-size: .68em; }
.ap-scan-result { display: grid; gap: .1em; padding: .55em .75em; border-radius: .85em; border: 1px solid #c3ead1; background: #e9f8ef; font-size: .8em; color: var(--ap-soft); }
.ap-scan-result b { color: var(--ap-ink); }
.ap-checks { display: grid; gap: .4em; margin: 0; padding: 0; list-style: none; }
.ap-checks li { display: flex; align-items: center; gap: .6em; padding: .5em .6em; border-radius: .8em; border: 1px solid var(--ap-line); background: #fff; font-size: .8em; }
.ap-checks button { display: grid; place-items: center; flex: none; width: 1.6em; height: 1.6em; padding: 0; border-radius: .45em; border: 1.5px solid #c5ccc8;
    background: #fff; color: transparent; cursor: pointer; }
.ap-checks button[aria-pressed="true"] { border-color: var(--app); background: var(--app); color: var(--app-on); }
.ap-photo { position: relative; overflow: hidden; border-radius: 1em; }
.ap-photo svg { display: block; width: 100%; height: auto; }
.ap-photo span { position: absolute; left: .55em; bottom: .45em; padding: .15em .55em; border-radius: 99px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .66em; }
.ap-pf-big { display: grid; grid-template-columns: 1fr 1fr; gap: .5em; padding: 0; background: none; }
.ap-pf-big button { padding: .8em; border: 0; border-radius: .95em; color: #fff; font-size: .88em; font-weight: 700; cursor: pointer; }
.ap-pf-big button[data-result="pass"] { background: #22a559; }
.ap-pf-big button[data-result="fail"] { background: #e04848; }
.ap-face { display: grid; place-items: center; padding: .5em 0 .2em; }
.ap-face-ring { position: relative; display: grid; place-items: center; width: 6.6em; height: 6.6em; border-radius: 50%; background: #e9eeea; }
.ap-face-ring i { color: #9aa5a0; font-size: 3.2em; }
.ap-face-ring::after { content: ""; position: absolute; inset: -.4em; border-radius: 50%; border: 3px solid var(--app); border-right-color: transparent; border-bottom-color: transparent;
    animation: ap-spin 1.5s linear infinite; }
.ap-face.is-done .ap-face-ring::after { animation: none; border-color: #22a559; }
.ap-face-name { display: grid; margin: 0; text-align: center; }
.ap-face-name span { color: var(--ap-soft); font-size: .78em; }

/* ---------- motion ---------- */
/* The live and alarm dots pulse with a ring that grows and fades behind them: transform and
   opacity only, so the compositor runs it (a growing box-shadow repainted every frame). */
.ap-live-dot::after, .ap-live > i::after, .ap-st-stop .ap-st-dot::after, .ap-h-bad::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
    background: rgba(34, 197, 94, .5); pointer-events: none; animation: ap-pulse 2s ease-out infinite; }
.ap-st-stop .ap-st-dot::after, .ap-h-bad::after { background: rgba(224, 72, 72, .55); animation-duration: 1.6s; }
.ap-st-ack .ap-st-dot::after { content: none; }
@keyframes ap-pulse { 0% { transform: none; opacity: 1; } 70%, 100% { transform: scale(2.7); opacity: 0; } }
@keyframes ap-bump { 0% { background: color-mix(in srgb, var(--app) 16%, #fff); } 100% { background: #fff; } }
@keyframes ap-toast { 0% { opacity: 0; transform: translateY(.8em); } 8%, 86% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-.3em); } }
@keyframes ap-wa { 0% { opacity: 0; transform: translateY(-120%); } 8%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-40%); } }
@keyframes ap-drop-in { from { opacity: 0; transform: translateY(-.6em) scale(.97); } }
@keyframes ap-fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ap-scan { to { transform: translateY(100%); } }
@keyframes ap-spin { to { transform: rotate(360deg); } }
@keyframes ap-grow { from { transform: scaleY(0); } }
@media (prefers-reduced-motion: no-preference) {
    .ap-bars .ap-bar-c i { animation: ap-grow .7s cubic-bezier(.16, 1, .3, 1) both; }
}
@media (prefers-reduced-motion: reduce) {
    .ap-live-dot::after, .ap-live > i::after, .ap-st-stop .ap-st-dot::after, .ap-h-bad::after { content: none; }
    .ap-scan-line, .ap-face-ring::after { animation: none; }
    .ap-devices, .ap-stage-slot, .ap-sw, .ap-app .ap-nav, .ap-meter i, .ap-level i, .ap-bar-c i { transition: none; }
}

/* ---------- what it adds up to ---------- */
.ap-sum { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 60px);
    margin-top: clamp(40px, 5vw, 64px); padding-top: clamp(32px, 4vw, 48px); border-top: 1px solid rgba(var(--ink), .12); }
.ap-eyebrow { margin: 0 0 12px; font: 700 .76rem/1 var(--nav-font); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-color); }
.ap-sum-title { margin: 0 0 12px; font-family: var(--display-font); font-weight: 400; text-transform: uppercase; font-size: clamp(1.6rem, 3.4vw, 2.6rem);
    line-height: 1; color: var(--heading-color); text-wrap: balance; overflow-wrap: anywhere; }
.ap-sum-line { max-width: 62ch; margin: 0 0 22px; color: rgba(var(--ink), .74); line-height: 1.6; }
.ap-mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 22px; padding: 0; list-style: none; }
.ap-mods li { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(var(--ink), .12); background: var(--surface); }
.ap-mods i { color: var(--accent-color); font-size: 1.2rem; line-height: 1.3; }
.ap-mods span { color: rgba(var(--ink), .72); font-size: .92rem; line-height: 1.5; }
.ap-mods b { display: block; color: var(--heading-color); font-size: .98rem; }
.ap-ext { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ap-ext li { display: flex; gap: 10px; color: rgba(var(--ink), .74); font-size: .93rem; line-height: 1.5; }
.ap-ext li > i, .ap-ext li > .ap-ic { flex: none; margin-top: .25em; color: var(--accent-color); }
.ap-ext b { color: var(--heading-color); }
.ap-h { margin: 0 0 14px; font: 700 .76rem/1 var(--nav-font); letter-spacing: .14em; text-transform: uppercase; color: rgba(var(--ink), .62); }
.ap-svc { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ap-svc a, .ap-svc a:hover { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 13px;
    border: 1px solid rgba(var(--ink), .12); background: var(--surface); color: var(--heading-color); text-decoration: none; transition: border-color .2s, transform .25s cubic-bezier(.16, 1, .3, 1); }
.ap-svc a:hover { border-color: var(--accent-color); transform: translateX(3px); }
.ap-svc-n { font-family: var(--display-font); color: var(--accent-color); }
.ap-svc-b strong { display: block; font-size: .96rem; }
.ap-svc-b span { display: block; color: rgba(var(--ink), .66); font-size: .84rem; line-height: 1.45; }
.ap-svc i { color: var(--accent-color); }
.ap-send { justify-content: center; width: 100%; margin-top: 18px; }
.ap-note { margin: 12px 0 0; color: rgba(var(--ink), .6); font-size: .86rem; line-height: 1.5; }

/* ---------- below the studio ---------- */
.ap-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; counter-reset: ap; }
.ap-steps li { padding: 22px; border-radius: 16px; border: 1px solid rgba(var(--ink), .12); background: var(--surface); counter-increment: ap; }
.ap-steps li::before { content: counter(ap, decimal-leading-zero); display: block; margin-bottom: 12px; font-family: var(--display-font); font-size: 1.4rem; color: var(--accent-color); }
.ap-steps b { display: block; margin-bottom: 6px; color: var(--heading-color); font-size: 1.05rem; }
.ap-steps span { color: rgba(var(--ink), .72); font-size: .94rem; line-height: 1.55; }
.ap-index { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.ap-index-col { display: flex; flex-direction: column; padding: 24px; border-radius: 18px; border: 1px solid rgba(var(--ink), .12); background: var(--surface); }
.ap-index h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 1.15rem; color: var(--heading-color); }
.ap-index h3 i { color: var(--accent-color); }
.ap-index ul { display: grid; gap: 12px; margin: 0 0 20px; padding: 0; list-style: none; }
.ap-index li { color: rgba(var(--ink), .72); font-size: .93rem; line-height: 1.5; }
.ap-index li b { display: block; color: var(--heading-color); }
.ap-index-try { margin-top: auto; font-weight: 600; text-decoration: none; }


/* ---------- smaller screens ---------- */
@media (max-width: 1099px) {
    .ap-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
    .ap-index { grid-template-columns: minmax(0, 1fr); }
    .ap-sum { grid-template-columns: minmax(0, 1fr); }
    .ap-ctl-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 760px) {
    /* Each row of choices is one line that scrolls sideways, so the sketch is near. */
    .ap-controls { gap: 10px; padding: 12px; }
    .ap-seg, .ap-controls .chips { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); }
    .ap-seg::-webkit-scrollbar, .ap-controls .chips::-webkit-scrollbar { display: none; }
    .ap-seg label, .ap-controls .chip { flex: none; }
    /* A fieldset is as wide as its content by default; these must shrink to the screen. */
    .ap-controls > *, .ap-ctl-top > *, .ap-seg, .ap-ctl-row, .ap-swatches { min-width: 0; }
    .ap-seg span { padding: 9px 12px; }
    .ap-name { flex-basis: 100%; }
    .ap-kit { gap: 8px; }
    .ap-sw { width: 28px; height: 28px; }
    .ap-ctl-row { padding-top: 8px; }
    /* The phone comes first and is the one to read; the laptop follows, whole. */
    .ap-devices { display: flex; flex-direction: column-reverse; align-items: center; gap: 22px; padding: 0; transform: none; }
    .ap-devices.ap-solo { padding: 0; }
    .ap-laptop { width: 94%; }
    .ap-phone { position: relative; right: auto; bottom: auto; width: min(280px, 78%); padding: 2.6%; transform: none; }
    .ap-mods { grid-template-columns: minmax(0, 1fr); }
    .ap-tool span { display: none; }
}
@media (max-width: 575px) {
    .ap-steps { grid-template-columns: minmax(0, 1fr); }
    .ap-stage { border-radius: 20px; }
}
