/* ============================================================
   APP VIEWS on the feature pages: parts of the new admin panel and terminal rebuilt in HTML,
   with the apps' own colours, radii and type scale. Each view plays a short scene while it is on
   screen and replays it from the start (features.js); without motion it shows the last frame.
   ============================================================ */
.app-ui {
  --a-bg: #e3e8e4;
  --a-fg: #141f18;
  --a-card: #fafbfa;
  --a-primary: #1b8835;
  --a-muted: #eef3ee;
  --a-muted-fg: #4a6358;
  --a-accent: #e6f4eb;
  --a-red: #c0392b;
  --a-red-bg: #fbeceb;
  --a-warn: #b45309;
  --a-warn-bg: #fbf0e3;
  --a-border: #c7d0c9;
  --a-input: #bdc7c0;
  --a-chart2: #8ec4a0;
  --a-chart3: #0f6faf;
  --a-chart4: #4e6b5a;
  font-size: 12px;
  line-height: 1.35;
  color: var(--a-fg);
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.app-ui *, .app-ui *::before, .app-ui *::after { box-sizing: border-box; }
.app-ui p { color: inherit; }

/* the small view on top of a capability card */
.app-snip {
  background: var(--a-bg);
  border-radius: 12px;
  padding: 12px;
  height: 148px;
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* the big view in a window frame */
.app-window {
  background: var(--a-bg);
  border: 1px solid var(--a-border);
  border-radius: 16px;
  box-shadow: var(--sh-lg);
  overflow: hidden;
  position: relative;
}
.app-window-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--a-card);
  border-bottom: 1px solid var(--a-border);
  font-weight: 600;
}
.app-window-bar > i { width: 9px; height: 9px; border-radius: 50%; background: var(--a-border); flex-shrink: 0; }
.app-window-bar > span { margin-left: 8px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-window-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* building blocks */
.app-card { background: var(--a-card); border: 1px solid var(--a-border); border-radius: 8px; padding: 10px 12px; }
.app-table { background: var(--a-card); border: 1px solid var(--a-border); border-radius: 8px; overflow: hidden; position: relative; }
.app-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--a-card);
  border-bottom: 1px solid var(--a-muted);
}
.app-table > .app-row:last-child { border-bottom: 0; }
.app-row.cols-3 { grid-template-columns: minmax(0, 1fr) auto auto; }
.app-row.cols-4 { grid-template-columns: minmax(0, 1fr) 52px 58px 46px; }
.app-row.cols-4 > :not(:first-child), .app-row.cols-3 > :not(:first-child) { text-align: right; }
.app-row.head { font-size: 10.5px; font-weight: 600; color: var(--a-muted-fg); background: var(--a-muted); }
.app-flex { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.app-gap { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.app-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sub { font-size: 10.5px; color: var(--a-muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-label { font-size: 11px; color: var(--a-muted-fg); }
.app-num { font-weight: 600; white-space: nowrap; }
.app-big { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.app-big small, .app-num small { font-size: 0.6em; font-weight: 500; color: var(--a-muted-fg); }
.app-green { color: var(--a-primary); }
.app-red { color: var(--a-red); }
.app-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.app-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(27, 136, 53, .1);
  color: var(--a-primary);
}
.app-pill.warn { background: var(--a-warn-bg); color: var(--a-warn); }
.app-pill.red { background: var(--a-red-bg); color: var(--a-red); }
.app-pill.gray { background: var(--a-muted); color: var(--a-muted-fg); }
.app-pill.outline { background: var(--a-card); border: 1px solid var(--a-border); color: var(--a-fg); }
.app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--a-primary);
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}
.app-btn.secondary { background: var(--a-card); border: 1px solid var(--a-border); color: var(--a-fg); }
.app-input {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 44px;
  padding: 3px 7px;
  border: 1px solid var(--a-input);
  border-radius: 6px;
  background: #fff;
  font-weight: 600;
  white-space: nowrap;
}
.app-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--a-input);
  border-radius: 6px;
  background: var(--a-card);
  color: var(--a-muted-fg);
  white-space: nowrap;
  overflow: hidden;
}
.app-search b { color: var(--a-fg); font-weight: 500; }
.app-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--a-muted);
  color: var(--a-muted-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.app-who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.app-who > div { min-width: 0; }
.app-toggle {
  width: 26px;
  height: 15px;
  border-radius: 999px;
  background: var(--a-primary);
  position: relative;
  flex-shrink: 0;
}
.app-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 13px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
}
.app-toggle.off { background: var(--a-border); }
.app-toggle.off::after { left: 2px; }
.app-tile { border: 1px solid var(--a-border); border-radius: 8px; padding: 6px 8px; background: var(--a-card); min-width: 0; }
.app-tile.on { border-color: var(--a-primary); background: var(--a-accent); }
.app-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.app-tabs { display: inline-flex; gap: 2px; padding: 2px; border-radius: 7px; background: var(--a-muted); font-size: 10.5px; font-weight: 500; }
.app-tabs > span { padding: 3px 8px; border-radius: 5px; color: var(--a-muted-fg); white-space: nowrap; }
.app-tabs > span.on { background: var(--a-card); color: var(--a-fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.app-kpis { display: grid; grid-template-columns: repeat(var(--kpis, 2), minmax(0, 1fr)); gap: 8px; }
.app-bars { display: flex; align-items: flex-end; gap: 6px; height: var(--bars-h, 84px); }
.app-bars > i { flex: 1; height: var(--h); background: var(--a-chart4); border-radius: 3px 3px 0 0; transform-origin: bottom; }
.app-bars > i.best { background: var(--a-primary); }
.app-bar-labels { display: flex; gap: 6px; font-size: 10px; color: var(--a-muted-fg); }
.app-bar-labels > span { flex: 1; text-align: center; }
.app-meter { height: 5px; border-radius: 999px; background: var(--a-muted); overflow: hidden; }
.app-meter > i { display: block; height: 100%; width: var(--w); background: var(--c, var(--a-primary)); border-radius: inherit; transform-origin: left; }
.app-chart { width: 100%; height: auto; display: block; overflow: visible; }
.app-swap { display: inline-grid; }
.app-swap > * { grid-area: 1 / 1; justify-self: end; }
.app-swap.start { display: grid; }
.app-swap.start > * { justify-self: start; }
.app-swap > .a-first, .app-swap > .h-first { opacity: 0; }
.app-scan { position: relative; }
.app-receipt {
  background: #fff;
  border-radius: 6px;
  padding: 10px;
  font-size: 10.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.app-receipt hr { border: 0; border-top: 1px dashed var(--a-border); margin: 3px 0; }
.app-sms {
  align-self: flex-end;
  max-width: 88%;
  background: #fff;
  border-radius: 12px 12px 2px 12px;
  padding: 8px 10px;
  font-size: 11px;
  white-space: pre-line;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.app-tg {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: min(250px, calc(100% - 24px));
  background: #fff;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 10.5px;
  white-space: pre-line;
  box-shadow: var(--sh-md);
  border-left: 3px solid #2aabee;
}
.app-move-track { position: relative; height: 22px; margin: 2px 0; }
.app-move-track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--a-border); }
.app-move-track > i { position: absolute; top: 1px; left: calc(100% - 20px); color: var(--a-primary); font-size: 16px; }
.app-split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 10px; align-items: start; }

.app-big.sm { font-size: 16px; margin: 2px 0 4px; }
.app-snip .app-row { padding: 4px 9px; min-height: 28px; }
.app-snip .app-avatar { width: 20px; height: 20px; }
.app-snip .app-card { padding: 7px 10px; }
.app-snip .app-big { font-size: 17px; }
.app-window-bar em { font-style: normal; }
.app-row.shifts { grid-template-columns: minmax(0, 1fr) 78px 46px 34px 70px 76px; font-size: 11.5px; }
.app-row.shifts > :nth-child(n+4) { text-align: right; }
.app-abc { display: grid; grid-template-columns: 16px repeat(3, minmax(0, 1fr)); gap: 4px; text-align: center; }
.app-abc > b { font-size: 10.5px; color: var(--a-muted-fg); align-self: center; }
.app-abc > span:not(:empty) { background: var(--a-card); border: 1px solid var(--a-border); border-radius: 6px; padding: 4px 0; font-weight: 600; }
.app-abc > span.hot { background: var(--a-accent); border-color: var(--a-primary); color: var(--a-primary); }

/* the big view replaces the icon box of the benefits block */
.split-visual .app-window { width: 100%; }

@media (max-width: 640px) {
  .app-hide-sm { display: none !important; }
  .app-split { grid-template-columns: 1fr; }
  .app-row.cols-4 { grid-template-columns: minmax(0, 1fr) 48px 54px 40px; }
  .app-row.shifts { grid-template-columns: minmax(0, 1fr) 46px 70px 76px; }
  .app-kpis { gap: 6px; }
  .app-kpis .app-card { padding: 8px; }
  .app-big.sm { font-size: 13px; }
}

/* ============================================================
   HOME HERO: one app window going through a sale, the dashboard, the stock, a supply, the client debts
   and the shifts. Each scene has a 4s slot of the 24s loop (--i), its steps start --d into the slot and hide again
   4s later, after the scene has gone, so a scene starts from its first frame every time it comes round.
   ============================================================ */
.app-hero-body { display: grid; grid-template-columns: 126px minmax(0, 1fr); }
.app-hero-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  background: var(--a-card);
  border-right: 1px solid var(--a-border);
}
.app-hero-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.app-hero-tab i { width: 14px; flex-shrink: 0; text-align: center; opacity: .7; }
.app-hero-tab.on { background: var(--a-accent); color: var(--a-primary); }
.app-hero-scenes { position: relative; min-height: 286px; }
.app-hero-scene { position: absolute; inset: 0; padding: 14px; display: flex; flex-direction: column; gap: 10px; opacity: 0; }
.app-hero-scene.first { opacity: 1; }
.hero-visual.with-app .app-hero-window { width: 100%; }

/* on big screens the window grows past its column into the page margin, which the hero clips */
@media (min-width: 1200px) {
  .hero-visual.with-app .app-hero-window { width: calc(100% + min(160px, (100vw - 1100px) / 2)); font-size: 13px; }
  .hero-visual.with-app .hero-float-2 { right: calc(-16px - min(160px, (100vw - 1100px) / 2)); }
  .app-hero-body { grid-template-columns: 146px minmax(0, 1fr); }
  .app-hero-scenes { min-height: 336px; }
  .app-hero-scene { padding: 18px; gap: 12px; }
  .app-hero-window .app-row { padding: 9px 12px; }
  .app-hero-window .app-big { font-size: 24px; }
  .app-hero-window .app-big.sm { font-size: 20px; }
  .app-hero-window .app-bars { height: 92px; }
}
@media (max-width: 900px) {
  .hero-visual.with-app { display: block; }
  .hero-visual.with-app .hero-float { display: none; }
}
@media (max-width: 640px) {
  .app-hero-body { grid-template-columns: 1fr; }
  .app-hero-nav { flex-direction: row; padding: 6px; border-right: 0; border-bottom: 1px solid var(--a-border); }
  .app-hero-tab { flex: 1; justify-content: center; padding: 7px 2px; font-size: 13px; }
  .app-hero-tab > span { display: none; }
  .app-hero-scenes { min-height: 268px; }
}

@media (prefers-reduced-motion: no-preference) {
  .app-hero-scene { animation: hero-scene 24s calc(var(--i) * 4s) infinite both; }
  .app-hero-tab { animation: hero-tab 24s calc(var(--i) * 4s) infinite both; }
  .app-hero-scene .h-in { animation: hero-in 24s calc(var(--i) * 4s + var(--d, 0s)) infinite both; }
  .app-hero-scene .h-then { animation: hero-then 24s calc(var(--i) * 4s + var(--d, 0s)) infinite both; }
  .app-hero-scene .h-first { animation: hero-first 24s calc(var(--i) * 4s + var(--d, 0s)) infinite both; }
  .app-hero-scene .h-grow { animation: hero-grow 24s calc(var(--i) * 4s + var(--d, 0s)) infinite both; }
  .app-hero-scene .h-press { animation: hero-press 24s calc(var(--i) * 4s + var(--d, 0s)) infinite both; }
}
/* six scenes of 4s: a slot is 16.67% of the loop; .32s is 1.33%, .48s 2%, .96s 4% */
@keyframes hero-scene {
  0% { opacity: 0; transform: translateY(6px); }
  1.33%, 15.33% { opacity: 1; transform: none; }
  16.67%, 100% { opacity: 0; transform: none; }
}
@keyframes hero-tab {
  0%, 16.67%, 100% { background: transparent; color: var(--a-fg); }
  1%, 15.67% { background: var(--a-accent); color: var(--a-primary); }
}
@keyframes hero-in {
  0% { opacity: 0; transform: translateY(6px); }
  2%, 16.67% { opacity: 1; transform: none; }
  16.75%, 100% { opacity: 0; transform: none; }
}
@keyframes hero-then {
  0% { opacity: 0; }
  1.33%, 16.67% { opacity: 1; }
  16.75%, 100% { opacity: 0; }
}
@keyframes hero-first {
  0% { opacity: 1; }
  1.33%, 16.67% { opacity: 0; }
  16.75%, 100% { opacity: 1; }
}
@keyframes hero-grow {
  0% { transform: scaleY(0); }
  4%, 16.67% { transform: none; }
  16.75%, 100% { transform: scaleY(0); }
}
@keyframes hero-press {
  0%, 2.67%, 100% { transform: none; box-shadow: 0 0 0 0 rgba(27, 136, 53, 0); }
  1.33% { transform: scale(.93); box-shadow: 0 0 0 5px rgba(27, 136, 53, .25); }
}

/* ============================================================
   SCENES of the feature page views: features.js adds .play to a view when it shows and replays it
   from its first frame every 8s (.rewind fades the content out first), so every run starts like
   the first one. --d delays a step from the start of the run. Without motion the views keep the
   last frame their markup describes.
   ============================================================ */
.app-snip > *, .app-window-body { transition: opacity .3s; }
.app-snip.rewind > *, .app-window.rewind .app-window-body { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .app-ui.play .a-in { animation: app-in .48s var(--d, 0s) both; }
  .app-ui.play .a-show { animation: app-show .4s var(--d, 0s) both; }
  .app-ui.play .a-pop { animation: app-pop .56s var(--d, 0s) both; }
  .app-ui.play .a-press { animation: app-press 1.44s var(--d, 0s) both; }
  .app-ui.play .a-first { animation: app-hide .32s calc(3.68s + var(--d, 0s)) both; }
  .app-ui.play .a-then { animation: app-show .32s calc(3.68s + var(--d, 0s)) both; }
  .app-ui.play .a-flip { animation: app-flip .32s calc(3.68s + var(--d, 0s)) both; }
  .app-ui.play .a-flip::after { animation: app-flip-knob .32s calc(3.68s + var(--d, 0s)) both; }
  .app-ui.play .a-on { animation: app-on .32s calc(3.68s + var(--d, 0s)) both; }
  .app-ui.play .a-dim { animation: app-dim .48s calc(3.2s + var(--d, 0s)) both; }
  .app-ui.play .a-hl { animation: app-hl 1.6s var(--d, 0s) both; }
  .app-ui.play .a-grow { animation: app-grow .9s var(--d, 0s) cubic-bezier(.2, .8, .2, 1) both; }
  .app-ui.play .a-grow-x { animation: app-grow-x .9s var(--d, 0s) cubic-bezier(.2, .8, .2, 1) both; }
  .app-ui.play .a-draw { stroke-dasharray: 100; animation: app-draw 1.8s var(--d, 0s) ease-out both; }
  .app-ui.play .a-type { animation: app-type 2.4s var(--d, 0s) steps(var(--n, 12)) both; }
  .app-ui.play .a-move { animation: app-move 2.56s calc(.64s + var(--d, 0s)) ease-in-out both; }
  .app-ui.play .app-scan::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--a-primary);
    box-shadow: 0 0 8px var(--a-primary);
    opacity: .55;
    animation: app-scan 2.6s ease-in-out infinite;
  }
  .a-type { display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom; }
}
@keyframes app-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes app-show { from { opacity: 0; } to { opacity: 1; } }
@keyframes app-hide { from { opacity: 1; } to { opacity: 0; } }
@keyframes app-pop {
  0% { opacity: 0; transform: scale(.6); }
  60% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: none; }
}
@keyframes app-press {
  0%, 55%, 100% { transform: none; box-shadow: 0 0 0 0 rgba(27, 136, 53, 0); }
  72% { transform: scale(.93); box-shadow: 0 0 0 5px rgba(27, 136, 53, .25); }
}
@keyframes app-flip { from { background: var(--a-border); } to { background: var(--a-primary); } }
@keyframes app-flip-knob { from { left: 2px; } to { left: 13px; } }
@keyframes app-on {
  from { border-color: var(--a-border); background: var(--a-card); }
  to { border-color: var(--a-primary); background: var(--a-accent); }
}
@keyframes app-dim { from { opacity: 1; } to { opacity: .25; } }
@keyframes app-hl {
  0%, 20% { background: var(--a-card); }
  40% { background: var(--a-accent); }
  100% { background: var(--a-card); }
}
@keyframes app-grow { from { transform: scaleY(0); } to { transform: none; } }
@keyframes app-grow-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes app-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes app-type { from { max-width: 0; } to { max-width: calc(var(--n, 12) * 1ch); } }
@keyframes app-move { from { left: 0; } to { left: calc(100% - 20px); } }
@keyframes app-scan {
  0% { top: 0; }
  50% { top: calc(100% - 2px); }
  100% { top: 0; }
}

/* ============================================================
   FEATURE PAGES and the home feature cards
   ============================================================ */
.text-link { display: inline-block; align-self: flex-start; color: var(--brand); font-weight: 600; }
.feature-breadcrumbs { margin-bottom: 12px; }
.feature-hero-actions { justify-content: center; margin-top: 28px; }
.feature-faq { max-width: 720px; }
.feature-card-link { display: block; background: var(--bg); }
