/* =========================================================
   Estoque Flow — design system mobile-first
   Alvos de toque grandes, contraste alto, uso com uma mão.
   ========================================================= */

:root {
  --brand: #0f766e;
  --brand-600: #0d9488;
  --brand-700: #115e59;
  --brand-50: #ecfdf5;
  --brand-100: #ccfbf1;

  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --ink-4: #94a3b8;

  --surface: #ffffff;
  --bg: #f4f6f8;
  --line: #e2e8f0;
  --line-2: #eef2f6;

  --ok: #15803d;
  --ok-bg: #dcfce7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --info: #1d4ed8;
  --info-bg: #dbeafe;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --sh-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --sh-2: 0 4px 12px rgba(15, 23, 42, .08);
  --sh-3: 0 12px 32px rgba(15, 23, 42, .16);

  --tap: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body { overscroll-behavior-y: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-700); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px calc(24px + var(--safe-b));
  background:
    radial-gradient(circle at 15% 8%, rgba(13, 148, 136, .28), transparent 45%),
    radial-gradient(circle at 85% 92%, rgba(15, 118, 110, .22), transparent 45%),
    linear-gradient(165deg, #0b3b38 0%, #0f2b2a 55%, #0b1220 100%);
  color: #fff;
}
.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-xl);
  padding: 28px 22px 24px;
  box-shadow: var(--sh-3);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.login-logo .mark {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand-600), var(--brand-700));
  color: #fff;
  box-shadow: 0 6px 16px rgba(13, 148, 136, .35);
}
.login-logo h1 { font-size: 1.35rem; }
.login-logo small { display: block; color: var(--ink-3); font-weight: 500; font-size: .78rem; letter-spacing: .02em; }

.login-card .lead { color: var(--ink-3); font-size: .92rem; margin: 10px 0 20px; }

.demo-users {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 8px;
}
.demo-users p { font-size: .78rem; color: var(--ink-3); margin-bottom: 2px; }
.demo-pill {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: #fbfcfd;
  font-size: .85rem;
  cursor: pointer;
  text-align: left;
}
.demo-pill:active { background: var(--brand-50); }
.demo-pill b { font-weight: 650; }
.demo-pill span { color: var(--ink-3); font-size: .78rem; }

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

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  min-height: 58px;
}
.topbar .brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar .mark {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand-600), var(--brand-700));
  color: #fff;
}
.topbar .brand b { font-size: 1rem; letter-spacing: -.02em; white-space: nowrap; }
.topbar .brand small { display: block; font-size: .68rem; color: var(--ink-3); line-height: 1.1; }
.topbar .spacer { flex: 1; }
.avatar-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 700; font-size: .85rem;
  cursor: pointer;
  display: grid; place-items: center;
}

main.view {
  flex: 1;
  padding: 16px 16px calc(96px + var(--safe-b));
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + var(--safe-b));
}
.nav-item {
  border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 7px 2px;
  border-radius: 12px;
  color: var(--ink-3);
  font-size: .68rem; font-weight: 600;
  min-height: 54px;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--brand-700); background: var(--brand-50); }
.nav-item:active { transform: scale(.97); }

/* ---------- Tipografia de seção ---------- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 22px 0 10px;
}
.section-head h2 { font-size: 1.02rem; }
.section-head .link { font-size: .82rem; font-weight: 650; color: var(--brand-700); background: none; border: 0; cursor: pointer; }

.page-title { margin: 2px 0 4px; font-size: 1.45rem; }
.page-sub { color: var(--ink-3); font-size: .87rem; margin-bottom: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-1);
}
.card + .card { margin-top: 12px; }
.card-title { font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: .8rem; color: var(--ink-3); margin-top: 2px; }

/* ---------- Ações principais (dashboard) ---------- */
.action-grid { display: grid; gap: 10px; }
@media (min-width: 700px) { .action-grid { grid-template-columns: repeat(3, 1fr); } }

.action-btn {
  width: 100%;
  border: 0;
  border-radius: var(--r-lg);
  padding: 18px 16px;
  display: flex; align-items: center; gap: 14px;
  text-align: left;
  cursor: pointer;
  min-height: 76px;
  color: #fff;
  box-shadow: var(--sh-2);
  transition: transform .12s ease, box-shadow .12s ease;
}
.action-btn:active { transform: scale(.985); box-shadow: var(--sh-1); }
.action-btn .ico {
  width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .18);
}
.action-btn .ico svg { width: 24px; height: 24px; }
.action-btn strong { display: block; font-size: 1.02rem; letter-spacing: -.01em; }
.action-btn small { display: block; font-size: .78rem; opacity: .88; font-weight: 500; margin-top: 1px; }
.action-btn .chev { margin-left: auto; opacity: .7; }

.action-count { background: linear-gradient(140deg, #0f766e, #134e4a); }
.action-in    { background: linear-gradient(140deg, #15803d, #14532d); }
.action-out   { background: linear-gradient(140deg, #b45309, #7c2d12); }

/* ---------- Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 14px;
  box-shadow: var(--sh-1);
  min-width: 0;
}
.stat .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; }
.stat .val { font-size: 1.6rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.15; margin-top: 2px; }
.stat .hint { font-size: .74rem; color: var(--ink-3); margin-top: 1px; }
.stat.danger .val { color: var(--danger); }
.stat.warn .val { color: var(--warn); }
.stat.ok .val { color: var(--ok); }

/* ---------- Alertas ---------- */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font-size: .86rem;
}
.alert + .alert { margin-top: 8px; }
.alert .a-ico { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 1px; }
.alert strong { display: block; font-size: .87rem; }
.alert span { color: inherit; opacity: .82; font-size: .79rem; }
.alert.critical { background: var(--danger-bg); border-color: #fecaca; color: #7f1d1d; }
.alert.warning  { background: var(--warn-bg); border-color: #fde68a; color: #78350f; }
.alert.info     { background: var(--info-bg); border-color: #bfdbfe; color: #1e3a8a; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font-weight: 650;
  font-size: .95rem;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  transition: transform .1s ease, filter .12s ease;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 19px; height: 19px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(15, 118, 110, .22); }
.btn-primary:active { background: var(--brand-700); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-success { background: var(--ok); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { border-color: var(--line); background: var(--surface); color: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--brand-700); }
.btn-block { width: 100%; }
.btn-lg { min-height: 58px; font-size: 1rem; border-radius: var(--r-lg); }
.btn-sm { min-height: 38px; padding: 0 13px; font-size: .82rem; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ---------- Formulários (mobile-first: campos grandes) ---------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: .01em;
}
.field .help { font-size: .74rem; color: var(--ink-3); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, .12);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 17px;
  padding-right: 40px;
}
.qty-input {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  min-height: 62px;
}

.search-box { position: relative; }
.search-box svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--ink-4); pointer-events: none;
}
.search-box .input { padding-left: 44px; min-height: 54px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .row-2 { grid-template-columns: 1fr; } }

/* ---------- Chips / filtros ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .7; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.active .dot { background: #fff; opacity: .9; }

/* ---------- Listas ---------- */
.list { display: grid; gap: 8px; }
.row-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  min-height: 66px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .12s;
}
.row-card:active { background: #f8fafc; }
.row-card .info { flex: 1; min-width: 0; }
.row-card .name {
  font-weight: 650; font-size: .93rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-card .meta { font-size: .75rem; color: var(--ink-3); margin-top: 1px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.row-card .right { text-align: right; flex: 0 0 auto; }
.row-card .qty { font-size: 1.05rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.row-card .qty small { font-size: .7rem; font-weight: 600; color: var(--ink-3); margin-left: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: #f1f5f9; color: var(--ink-3); }

.cat-ico {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center;
  color: #fff;
}
.cat-ico svg { width: 20px; height: 20px; }

/* ---------- Progresso ---------- */
.progress { height: 8px; border-radius: 999px; background: #e8edf2; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-600), var(--brand)); border-radius: 999px; transition: width .3s ease; }

/* ---------- Tabela responsiva ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 520px; }
thead th {
  text-align: left;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3); font-weight: 750;
  padding: 11px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:active { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.diff-neg { color: var(--danger); font-weight: 750; }
.diff-pos { color: var(--info); font-weight: 750; }
.diff-zero { color: var(--ok); font-weight: 750; }

/* ---------- Estoque baixo / barra ---------- */
.stock-bar { height: 5px; border-radius: 999px; background: #eef2f6; margin-top: 6px; overflow: hidden; }
.stock-bar > i { display: block; height: 100%; border-radius: 999px; }

/* ---------- Bottom sheet / modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(22px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 18px calc(20px + var(--safe-b));
  max-height: 92dvh;
  overflow-y: auto;
  box-shadow: var(--sh-3);
  animation: slideUp .22s cubic-bezier(.22, 1, .36, 1);
}
.sheet-grab { width: 42px; height: 4px; border-radius: 999px; background: #d7dee7; margin: 4px auto 14px; }
.sheet h3 { font-size: 1.1rem; margin-bottom: 4px; }
.sheet .sheet-sub { font-size: .82rem; color: var(--ink-3); margin-bottom: 16px; }
@media (min-width: 640px) {
  .overlay { align-items: center; }
  .sheet { border-radius: var(--r-xl); max-height: 86dvh; }
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + var(--safe-b));
  z-index: 120;
  display: grid; gap: 8px;
  width: min(92vw, 460px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px;
  border-radius: var(--r);
  background: #0f172a;
  color: #fff;
  font-size: .88rem;
  box-shadow: var(--sh-3);
  animation: slideUp .2s ease;
}
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }
.toast.warn { background: #78350f; }
.toast svg { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.toast b { display: block; font-size: .88rem; }
.toast span { font-size: .78rem; opacity: .85; }

/* ---------- Carrinho (lançamento) ---------- */
.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item .cname { flex: 1; min-width: 0; }
.cart-item .cname b { display: block; font-size: .9rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item .cname small { font-size: .74rem; color: var(--ink-3); }
.cart-item .cqty { font-weight: 750; font-variant-numeric: tabular-nums; font-size: .95rem; white-space: nowrap; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-3);
  flex: 0 0 auto;
}
.icon-btn:active { background: #f1f5f9; }
.icon-btn svg { width: 18px; height: 18px; }

.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: calc(66px + var(--safe-b));
  z-index: 44;
  padding: 10px 16px;
  background: linear-gradient(to top, var(--bg) 55%, rgba(244, 246, 248, 0));
  pointer-events: none;
}
.sticky-bar .inner {
  pointer-events: auto;
  max-width: 1080px; margin: 0 auto;
  display: flex; gap: 10px; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  box-shadow: var(--sh-2);
}
.sticky-bar .sum { flex: 1; min-width: 0; }
.sticky-bar .sum b { display: block; font-size: .88rem; }
.sticky-bar .sum small { font-size: .74rem; color: var(--ink-3); }

/* ---------- Contagem ---------- */
.count-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 9px;
}
.count-row.filled { border-color: #a7f3d0; background: #f7fffd; }
.count-row.diverged { border-color: #fecaca; background: #fffbfb; }
.count-row .top { display: flex; align-items: flex-start; gap: 10px; }
.count-row .cname { flex: 1; min-width: 0; }
.count-row .cname b { font-size: .93rem; font-weight: 650; display: block; }
.count-row .cname small { font-size: .75rem; color: var(--ink-3); }
.count-row .expected {
  font-size: .78rem; color: var(--ink-3);
  background: #f1f5f9; padding: 3px 9px; border-radius: 999px;
  font-weight: 650; white-space: nowrap;
}
.count-row .bottom { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.count-row .bottom .input { min-height: 54px; font-size: 1.25rem; font-weight: 700; text-align: center; flex: 1; font-variant-numeric: tabular-nums; }
.count-row .diff-box {
  min-width: 92px; text-align: center;
  border-radius: var(--r); padding: 7px 10px;
  font-weight: 750; font-size: .92rem;
  font-variant-numeric: tabular-nums;
  background: #f1f5f9; color: var(--ink-3);
}
.count-row .diff-box.neg { background: var(--danger-bg); color: var(--danger); }
.count-row .diff-box.pos { background: var(--info-bg); color: var(--info); }
.count-row .diff-box.zero { background: var(--ok-bg); color: var(--ok); }

/* ---------- Misc ---------- */
.empty {
  text-align: center;
  padding: 36px 18px;
  color: var(--ink-3);
}
.empty .e-ico {
  width: 60px; height: 60px; border-radius: 20px;
  background: #eef2f6; color: var(--ink-4);
  display: grid; place-items: center; margin: 0 auto 12px;
}
.empty .e-ico svg { width: 28px; height: 28px; }
.empty b { display: block; color: var(--ink-2); font-size: .95rem; margin-bottom: 3px; }
.empty span { font-size: .84rem; }

.skeleton { background: linear-gradient(90deg, #eef2f6 25%, #f8fafc 37%, #eef2f6 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--r); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 16px; margin-bottom: 10px; }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--ink-3); }
.tiny { font-size: .76rem; }
.bold { font-weight: 700; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }
.mb12 { margin-bottom: 12px; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }

.summary-strip {
  display: flex; gap: 0;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.summary-strip > div { flex: 1; padding: 11px 8px; text-align: center; border-right: 1px solid var(--line-2); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip b { display: block; font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.summary-strip small { font-size: .68rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; font-weight: 650; }

.seg {
  display: flex; gap: 4px; padding: 4px;
  background: #eef2f6; border-radius: 12px;
}
.seg button {
  flex: 1; border: 0; background: none; cursor: pointer;
  padding: 9px 6px; border-radius: 9px;
  font-size: .8rem; font-weight: 650; color: var(--ink-3);
  min-height: 40px;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* Desktop: sidebar-ish layout */
@media (min-width: 900px) {
  main.view { padding-bottom: 32px; }
  .bottom-nav {
    position: sticky; bottom: auto; top: 58px;
    grid-template-columns: 1fr; gap: 2px;
    border-top: 0; border-right: 1px solid var(--line);
    background: var(--surface);
    padding: 12px 10px;
    width: 210px; height: calc(100dvh - 58px);
    align-self: flex-start;
  }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 11px; padding: 12px 14px; font-size: .87rem; min-height: 46px; }
  .nav-item.active { background: var(--brand-50); }
  .app-shell.layout-desktop { flex-direction: row; }
  .app-shell.layout-desktop .shell-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  .sticky-bar { left: 210px; bottom: 0; }
  .toast-stack { left: auto; right: 24px; transform: none; bottom: 24px; }
}

@media print {
  .topbar, .bottom-nav, .sticky-bar, .btn, .chips, .toast-stack { display: none !important; }
  main.view { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  table { min-width: 0; font-size: 10pt; }
  body { background: #fff; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
