/* Reset and page chrome. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--yu-font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--yu-ink);
  background: var(--yu-bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { font-family: var(--yu-font-display); font-weight: 800; margin: 0; line-height: 1.2; }
p { margin: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  /* 16px minimum: anything smaller makes iOS zoom on focus. */
  font-size: 16px;
}
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--yu-red);
  outline-offset: 2px;
  border-radius: 4px;
}

.yu-num { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- layout -- */
.yu-app { min-height: 100dvh; display: flex; flex-direction: column; }

.yu-main {
  flex: 1;
  padding: 16px var(--yu-gutter) calc(24px + var(--yu-safe));
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.yu-main--wide { max-width: 1180px; }
.yu-main--with-bottombar { padding-bottom: calc(var(--yu-bottombar) + 24px + var(--yu-safe)); }
.yu-main--with-cartbar   { padding-bottom: calc(96px + var(--yu-safe)); }

/* ---------------------------------------------------------------- topbar -- */
.yu-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--yu-topbar);
  padding: 0 var(--yu-gutter);
  background: var(--yu-red);
  color: var(--yu-cream);
}
.yu-topbar__logo { height: 26px; width: auto; flex: none; }
.yu-topbar__title {
  font-family: var(--yu-font-display); font-weight: 800; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0;
}
.yu-topbar__action {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; color: inherit; border-radius: var(--yu-r-sm);
  text-decoration: none;
}
.yu-topbar__action:active { background: rgba(0, 0, 0, .14); }
.yu-topbar__back { font-size: 20px; line-height: 1; }

/* ------------------------------------------------------------- bottombar -- */
.yu-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--yu-bottombar) + var(--yu-safe));
  padding-bottom: var(--yu-safe);
  background: var(--yu-paper);
  border-top: 1px solid var(--yu-line);
}
.yu-tabs__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--yu-ink-60); font-size: 11px; font-weight: 600;
}
.yu-tabs__item svg { width: 22px; height: 22px; }
.yu-tabs__item.is-active { color: var(--yu-red); }
.yu-tabs__badge {
  position: absolute; transform: translate(14px, -14px);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--yu-r-pill);
  background: var(--yu-red); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}

/* ----------------------------------------------------------------- cards -- */
.yu-card {
  background: var(--yu-paper);
  border: 1px solid var(--yu-line);
  border-radius: var(--yu-r);
  box-shadow: var(--yu-shadow-card);
  padding: 16px;
}
.yu-card + .yu-card { margin-top: 12px; }

.yu-h1 { font-size: 22px; }
.yu-h2 { font-size: 18px; }
.yu-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--yu-ink-60);
}
.yu-muted { color: var(--yu-ink-60); font-size: 14px; }
.yu-section-title { font-size: 13px; font-weight: 700; color: var(--yu-ink-60); margin: 24px 0 8px; }

/* --------------------------------------------------------------- buttons -- */
.btn-yu, .btn-outline-yu, .btn-ghost-yu, .btn-danger-yu {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: var(--yu-r); border: 1px solid transparent;
  font-family: var(--yu-font-display); font-weight: 800; font-size: 15px;
  text-decoration: none; text-align: center;
  transition: background-color .12s ease, transform .06s ease;
}
.btn-yu { background: var(--yu-red); color: #fff; }
.btn-yu:active { background: var(--yu-red-dark); transform: translateY(1px); }
.btn-outline-yu { background: var(--yu-paper); color: var(--yu-ink); border-color: var(--yu-line); }
.btn-outline-yu:active { background: var(--yu-bg); transform: translateY(1px); }
.btn-ghost-yu { background: none; color: var(--yu-ink-60); }
.btn-yu--lg { min-height: 56px; font-size: 16px; }
.btn-yu--block { display: flex; width: 100%; }
.btn-yu:disabled, .btn-yu[aria-disabled="true"] {
  background: var(--yu-ink-30); cursor: not-allowed; transform: none;
}
.btn-danger-yu { background: var(--yu-paper); color: var(--yu-danger); border-color: currentColor; }
.btn-danger-yu:active { background: #fdecef; transform: translateY(1px); }

/* ---------------------------------------------------------------- fields -- */
.yu-field { display: block; margin-bottom: 14px; }
.yu-field__label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.yu-input, .yu-select, .yu-textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--yu-line); border-radius: var(--yu-r-sm);
  background: var(--yu-paper);
}
.yu-textarea { min-height: 80px; resize: vertical; }
.yu-input:focus, .yu-select:focus, .yu-textarea:focus { border-color: var(--yu-red); outline-offset: 0; }

/* ----------------------------------------------------------------- pills -- */
.yu-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px; border-radius: var(--yu-r-pill);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.yu-pill--draft     { background: #efeae2; color: var(--yu-ink-60); }
.yu-pill--submitted { background: var(--yu-blue-tint);  color: var(--yu-blue); }
.yu-pill--validated { background: var(--yu-green-tint); color: var(--yu-green); }
.yu-pill--modified  { background: var(--yu-amber-tint); color: var(--yu-amber); }
.yu-pill--sent      { background: #dcece3; color: #14603e; }
.yu-pill--cancelled { background: var(--yu-paper); color: var(--yu-danger); box-shadow: inset 0 0 0 1px currentColor; }

/* ---------------------------------------------------------------- alerts -- */
.yu-note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--yu-r); font-size: 14px;
  border-left: 4px solid transparent;
}
.yu-note strong { font-weight: 700; }
.yu-note--info   { background: var(--yu-blue-tint);  border-color: var(--yu-blue);  color: #143f6b; }
.yu-note--ok     { background: var(--yu-green-tint); border-color: var(--yu-green); color: #145c3c; }
.yu-note--warn   { background: var(--yu-amber-tint); border-color: var(--yu-amber); color: #7a4a06; }
.yu-note--danger { background: #fdecef; border-color: var(--yu-danger); color: var(--yu-danger); }
.yu-note svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* ---------------------------------------------------------- empty states -- */
.yu-empty { text-align: center; padding: 48px 16px; }
.yu-empty svg { width: 56px; height: 56px; color: var(--yu-ink-30); margin: 0 auto 14px; }
.yu-empty__title { font-family: var(--yu-font-display); font-weight: 800; font-size: 18px; margin-bottom: 6px; }
.yu-empty__text { color: var(--yu-ink-60); font-size: 14px; margin-bottom: 18px; }

/* --------------------------------------------------------------- toasts --- */
.yu-toasts {
  position: fixed; left: 12px; right: 12px; z-index: 60;
  bottom: calc(96px + var(--yu-safe));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.yu-toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--yu-r);
  background: var(--yu-ink); color: var(--yu-cream);
  font-size: 14px; box-shadow: var(--yu-shadow-bar);
  animation: yu-toast-in .18s ease;
}
.yu-toast--error { background: var(--yu-danger); color: #fff; }
.yu-toast__action {
  margin-left: auto; background: none; border: 0; color: inherit;
  font-weight: 800; text-decoration: underline; padding: 4px 2px;
}
@keyframes yu-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* -------------------------------------------------------------- offline --- */
.yu-offline {
  position: fixed; left: 0; right: 0; top: var(--yu-topbar); z-index: 50;
  display: none; align-items: center; gap: 8px;
  padding: 9px var(--yu-gutter);
  background: var(--yu-amber); color: #fff; font-size: 13px; font-weight: 600;
}
body.is-offline .yu-offline { display: flex; }

/* -------------------------------------------------------------- sheets ---- */
.yu-sheet-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(26, 22, 20, .45);
  display: flex; align-items: flex-end;
}
.yu-sheet {
  width: 100%; background: var(--yu-paper);
  border-radius: var(--yu-r-lg) var(--yu-r-lg) 0 0;
  padding: 8px 0 calc(12px + var(--yu-safe));
  animation: yu-sheet-in .2s ease;
  max-height: 80dvh; overflow-y: auto;
}
.yu-sheet__handle { width: 40px; height: 4px; border-radius: 2px; background: var(--yu-ink-30); margin: 6px auto 10px; }
.yu-sheet__title { font-size: 13px; font-weight: 700; color: var(--yu-ink-60); padding: 0 20px 8px; }
.yu-sheet__item {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 20px; width: 100%;
  background: none; border: 0; text-align: left; text-decoration: none; font-size: 16px;
}
.yu-sheet__item:active { background: var(--yu-bg); }
.yu-sheet__item.is-current { font-weight: 700; color: var(--yu-red); }
.yu-sheet__check { margin-left: auto; }
@keyframes yu-sheet-in { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
