/* MyLoaf driver PWA layout layer. Sits on tokens.css + house.css (brand pack): only the
   shop-door flow lives here. Phone-first, big targets, logical properties (RTL safe). */

body { margin: 0; }

.wrap { max-width: 560px; margin-inline: auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }

/* Top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--card-border); }
.top__logo { width: 28px; height: 28px; }
.top__title { font-weight: 800; font-size: var(--text-body); margin-inline-end: auto; }
.top__link { border: 0; background: none; color: var(--accent); font-weight: 700;
  font-size: var(--text-sm); padding: 8px; cursor: pointer; font-family: inherit; }
.sync { border: 1px solid var(--card-border); border-radius: var(--r-pill); background: var(--surface);
  color: var(--success-500); font-weight: 700; font-size: var(--text-sm); padding: 6px 12px;
  cursor: pointer; font-family: inherit; min-height: 36px; }
.sync--pending { background: var(--warning-50); color: var(--ink); border-color: var(--warning-500); }

/* Route head */
.routehead { padding: 16px 0 8px; }
.routehead__title { margin: 0; font-size: var(--text-h2); font-weight: 800; }
.routehead__meta { color: var(--ink-2); font-size: var(--text-sm); margin-top: 4px; }
.progress { height: 8px; border-radius: var(--r-pill); background: var(--accent-soft-bg); margin-top: 10px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width .3s var(--ease); }

/* Stop list */
.stops { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.stop { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  border: 1px solid var(--card-border); border-radius: var(--r-lg); background: var(--surface);
  padding: 14px; cursor: pointer; font-family: inherit; color: inherit; min-height: 76px; }
.stop--next { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.stop--captured { background: var(--color-bg-2, var(--surface)); border-style: dashed; }
.stop--captured .stop__name { color: var(--ink-2); }
.stop--captured .stop__order { background: transparent; border: 1.5px solid var(--card-border); color: var(--ink-2); }
.stop__order { flex: 0 0 36px; height: 36px; display: grid; place-items: center;
  background: var(--accent-soft-bg); color: var(--accent-text); font-weight: 800; border-radius: 50%; }
.stop__body { flex: 1 1 auto; min-width: 0; }
.stop__name { font-weight: 700; font-size: var(--text-body-lg); }
.stop__sub { color: var(--ink-2); font-size: var(--text-xs); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Capture */
.capturehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 8px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: var(--text-body-lg);
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--card-border);
  border-radius: var(--r-pill); padding: 6px 14px; }
.timer--over { color: var(--danger-500); border-color: var(--danger-500); }
.lines { display: flex; flex-direction: column; gap: 12px; }
.line { padding: 14px; }
.line__head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.line__name { font-weight: 800; font-size: var(--text-body-lg); }
.line__hint { color: var(--ink-2); font-size: var(--text-xs); }
.line__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); }
.num { width: 100%; box-sizing: border-box; border: 1.5px solid var(--card-border); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 800; font-size: 22px;
  text-align: center; padding: 12px 4px; min-height: 56px; font-variant-numeric: tabular-nums; }
.num:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.seg__btn { border: 1.5px solid var(--card-border); background: var(--surface); color: var(--ink-2);
  border-radius: var(--r-pill); padding: 10px; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; }
.seg__btn.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-text, #fff); }
.seg__btn.is-on { color: #fff; }

/* Save bar */
.savebar { position: fixed; inset-inline: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--color-bg) 70%, transparent); }
.savebar .btn { max-width: 560px; margin-inline: auto; display: block; width: 100%; box-sizing: border-box; }
.btn--big { min-height: 56px; font-size: var(--text-body-lg); }

/* Summary */
.donemark { width: 72px; height: 72px; margin: 28px auto 12px; display: grid; place-items: center;
  background: var(--accent-soft-bg); color: var(--accent-text); border-radius: 50%; font-size: 34px; font-weight: 800; }
.stackgap { display: flex; flex-direction: column; gap: 10px; }
div.card.stackgap { margin-top: 16px; padding: 16px; }
.sumline { display: flex; justify-content: space-between; gap: 10px; font-size: var(--text-sm); }
.sumline--total { border-top: 1px solid var(--card-border); padding-top: 10px; font-size: var(--text-body); font-weight: 700; }

/* Empty + login */
.empty { text-align: center; padding: 32px 16px; margin-top: 16px; }
.empty__title { font-weight: 800; font-size: var(--text-body-lg); }
.empty__sub { color: var(--ink-2); font-size: var(--text-sm); margin-top: 6px; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; box-sizing: border-box; }
.login__card { width: 100%; max-width: 400px; padding: 24px; box-sizing: border-box; }
.login__logo { width: 44px; height: 44px; margin-inline: auto; display: block; }
.msg { color: var(--success-500); font-weight: 700; font-size: var(--text-sm); margin: 0; text-align: center; }

/* Chips + toast (house.css ships badges; the driver uses the ops chip idiom) */
.chip { display: inline-flex; align-items: center; border-radius: var(--r-pill); padding: 5px 10px;
  font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.chip--ok { background: var(--success-50); color: #256641; } /* success-500 is 4.46:1 on success-50 at 12px; this passes AA */
.chip--warn { background: var(--warning-50); color: var(--ink); }
.chip--plain { background: var(--accent-soft-bg); color: var(--ink-2); }

.toast { position: fixed; bottom: calc(88px + env(safe-area-inset-bottom)); inset-inline: 16px;
  margin-inline: auto; max-width: 420px; z-index: 50; background: var(--ink); color: var(--surface);
  border-radius: var(--r-md); padding: 12px 16px; font-size: var(--text-sm); font-weight: 600;
  text-align: center; box-shadow: 0 8px 24px rgb(43 33 24 / .25); }
.toast--danger { background: var(--danger-500); color: #fff; }

@media (min-width: 561px) {
  .btn--big { min-height: 52px; }
}
