/* =========================================================
   Inesitas · gestión del negocio
   Interfaz mobile-first, sin dependencias.
   ========================================================= */

:root {
  --bg: #f5f7fb;
  --bg-deep: #e9eef8;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #f1f4f9;
  --surface-tint: #f4f7fc;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #3157d5;
  --accent-deep: #2342ad;
  --accent-soft: #e9efff;
  --accent-border: #c7d6ff;
  --green: #0f766e;
  --green-soft: #e6f6f3;
  --amber: #b45309;
  --amber-soft: #fff5e6;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --white: #ffffff;
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: var(--font-sans);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 44px rgba(15, 23, 42, 0.14);
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --container: 1140px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -8%, rgba(49, 87, 213, 0.12), transparent 32rem),
    radial-gradient(circle at 102% 2%, rgba(15, 118, 110, 0.06), transparent 28rem),
    var(--bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  display: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--accent);
}

img,
svg {
  display: block;
}

::selection {
  color: var(--white);
  background: var(--accent);
}

:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.38);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-150%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid rgba(203, 213, 225, 0.72);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px) saturate(1.25);
}

.header-inner {
  display: flex;
  width: min(100%, calc(var(--container) + 48px));
  min-height: 68px;
  margin: 0 auto;
  padding: 10px 20px;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  color: #ffffff;
  background:
    linear-gradient(145deg, #547cff, #2447c9);
  box-shadow:
    0 5px 12px rgba(49, 87, 213, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  place-items: center;
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.brand-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.135em;
  text-transform: uppercase;
}

.desktop-nav {
  display: none;
  margin-left: 24px;
  padding: 4px;
  border: 1px solid rgba(203, 213, 225, 0.68);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.5);
  align-items: center;
  gap: 2px;
}

.desktop-nav-item {
  display: inline-flex;
  min-height: 36px;
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 650;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.desktop-nav-item .icon {
  width: 17px;
  height: 17px;
}

.desktop-nav-item:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
}

.desktop-nav-item.is-active {
  color: var(--accent-deep);
  background: var(--accent-soft);
  box-shadow: none;
}

.header-actions {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 8px;
}

.ghost-chip {
  position: relative;
  display: inline-flex;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 650;
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}

.ghost-chip:hover {
  border-color: #cbd5e1;
  background: var(--surface);
}

.ghost-chip .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.sample-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Layout ---------- */

.app-main {
  width: min(100%, calc(var(--container) + 48px));
  margin: 0 auto;
  padding: 26px 16px calc(102px + env(safe-area-inset-bottom));
}

.view {
  animation: view-in 0.38s var(--ease) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-heading {
  display: flex;
  margin-bottom: 22px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.view-heading-copy {
  min-width: 0;
  max-width: 660px;
}

.eyebrow {
  display: flex;
  margin-bottom: 5px;
  color: var(--accent);
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow-mark {
  display: inline-block;
  width: 16px;
  height: 1px;
  background: var(--accent);
}

.view h1 {
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 7vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.view-heading-copy > p:last-child {
  max-width: 570px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.view-heading > .btn {
  flex: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  min-height: 43px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--ink);
  background: transparent;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.48;
}

.btn-primary {
  border-color: var(--accent);
  color: var(--white);
  background: var(--accent);
  box-shadow: 0 5px 14px rgba(49, 87, 213, 0.18);
}

.btn-primary:hover:not(:disabled) {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  box-shadow: 0 7px 18px rgba(49, 87, 213, 0.23);
  transform: translateY(-1px);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #ffffff;
}

.btn-ghost {
  border-color: transparent;
  color: var(--ink-soft);
  background: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-soft);
}

.btn-danger {
  border-color: #fecaca;
  color: var(--danger);
  background: var(--danger-soft);
}

.btn-danger:hover:not(:disabled) {
  border-color: #fca5a5;
  background: #fee2e2;
}

.btn-sm {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.75;
}

.btn.is-loading::before {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  flex: none;
  place-items: center;
  transition:
    color 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.icon-button:hover {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-soft);
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

/* ---------- KPIs ---------- */

.kpi-grid {
  display: grid;
  margin-bottom: 23px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  display: flex;
  min-width: 0;
  min-height: 108px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
  align-items: flex-start;
  gap: 11px;
  box-shadow: var(--shadow-xs);
}

.kpi-icon {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  flex: none;
  place-items: center;
}

.kpi-icon .icon {
  width: 17px;
  height: 17px;
}

.kpi-icon--green {
  color: var(--green);
  background: var(--green-soft);
}

.kpi-icon--amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.kpi-icon--ink {
  color: var(--ink-soft);
  background: var(--surface-soft);
}

.kpi-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.kpi-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.085em;
  line-height: 1.25;
  text-transform: uppercase;
}

.kpi-value {
  overflow: hidden;
  margin-bottom: 3px;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4.8vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-note {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi--wide {
  grid-column: span 2;
}

.kpi--alert {
  border-color: var(--line);
  background: var(--surface);
}

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.segmented {
  display: flex;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented button {
  display: inline-flex;
  min-height: 36px;
  padding: 7px 11px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  transition:
    color 0.17s ease,
    background 0.17s ease,
    box-shadow 0.17s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.is-active {
  color: var(--white);
  background: var(--accent);
  box-shadow: 0 3px 9px rgba(49, 87, 213, 0.2);
}

.segment-count {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.07);
  place-items: center;
  font-size: 9.5px;
  font-weight: 750;
  line-height: 1;
}

.segmented button.is-active .segment-count {
  color: var(--white);
  background: rgba(255, 255, 255, 0.17);
}

.search-field {
  display: flex;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
  flex: 1 1 220px;
  align-items: center;
  gap: 8px;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.search-field:focus-within {
  border-color: #8ea9f7;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.09);
}

.search-field .icon {
  width: 17px;
  height: 17px;
  flex: none;
}

.search-field input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.search-field input::placeholder {
  color: #94a3b8;
}

.search-field input::-webkit-search-cancel-button {
  cursor: pointer;
}

.toolbar-tools {
  display: flex;
  min-width: 0;
  flex: 1 1 320px;
  align-items: center;
  gap: 8px;
}

.toolbar--stock .toolbar-tools .search-field {
  min-width: 140px;
}

.filter-toggle {
  display: inline-flex;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
  flex: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  transition:
    color 0.17s ease,
    border-color 0.17s ease,
    background 0.17s ease;
}

.filter-toggle .icon {
  width: 15px;
  height: 15px;
}

.filter-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

.filter-toggle.is-active {
  border-color: #fde68a;
  color: var(--amber);
  background: var(--amber-soft);
}

.edit-hint {
  display: flex;
  margin: 0;
  color: var(--muted);
  align-items: center;
  gap: 7px;
  font-size: 12px;
  line-height: 1.4;
}

.edit-hint .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

/* ---------- Pedidos ---------- */

.special-orders {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.86));
}

.special-orders-head {
  display: flex;
  margin-bottom: 11px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.special-orders-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.special-orders-count,
.special-orders-head .eyebrow {
  margin-bottom: 0;
}

.special-orders-count {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.72);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.special-orders-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.special-order-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease;
}

.special-order-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.special-order-card.is-high {
  border-left-color: var(--danger);
}

.special-order-top,
.special-order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.special-order-top {
  margin-bottom: 7px;
}

.priority-pill {
  padding: 3px 7px;
  border-radius: 5px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.priority-pill.is-high {
  color: var(--danger);
  background: var(--danger-soft);
}

.special-delivery {
  display: inline-flex;
  color: var(--ink-soft);
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}

.special-delivery .icon {
  width: 12px;
  height: 12px;
}

.special-delivery.is-overdue {
  color: var(--danger);
}

.special-order-card h3 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.special-order-items {
  overflow: hidden;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.special-order-foot strong {
  font-size: 14px;
  font-weight: 750;
}

.special-stock-state {
  color: var(--green);
  font-size: 9.5px;
  font-weight: 700;
}

.special-stock-state.is-missing {
  color: var(--amber);
}

.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
}

.order-card {
  position: relative;
  display: flex;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  flex-direction: column;
  gap: 13px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition:
    transform 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    border-color 0.22s ease;
}

.order-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.order-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-customer {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.avatar {
  display: grid;
  width: 39px;
  height: 39px;
  border: 1px solid rgba(49, 87, 213, 0.1);
  border-radius: 50%;
  color: var(--accent-deep);
  background:
    radial-gradient(circle at 30% 25%, #eff4ff, transparent 55%),
    var(--accent-soft);
  flex: none;
  place-items: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.order-customer-copy {
  min-width: 0;
}

.order-customer h3 {
  overflow: hidden;
  margin: 0 0 2px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-meta {
  display: flex;
  color: var(--muted);
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.3;
}

.order-meta .separator {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #94a3b8;
}

.channel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.channel-abbr {
  display: inline-grid;
  min-width: 18px;
  height: 15px;
  padding: 0 3px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  place-items: center;
}

.channel--WhatsApp .channel-abbr {
  color: #0f766e;
  background: #e6f6f3;
}

.channel--Instagram .channel-abbr {
  color: #c13584;
  background: #e9efff;
}

.channel--Presencial .channel-abbr {
  color: #334155;
  background: #e8edf5;
}

.status {
  display: inline-flex;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  flex: none;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status--pendiente {
  color: var(--amber);
  background: var(--amber-soft);
}

.status--entregado {
  color: var(--green);
  background: var(--green-soft);
}

.status--cancelado {
  color: #64748b;
  background: #f1f4f9;
}

.order-location-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-deep);
}

.order-card.is-special {
  border-color: var(--accent-border);
}

.order-special-meta {
  display: flex;
  margin-top: 5px;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.order-special-meta .special-delivery {
  font-size: 9px;
}

.order-production-mark {
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--amber);
  background: var(--amber-soft);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.order-discount-note {
  display: block;
  margin-bottom: 2px;
  color: var(--green);
  font-size: 9px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.order-location-tag .icon {
  width: 11px;
  height: 11px;
}

.order-items-preview {
  display: flex;
  min-height: 59px;
  padding: 10px 11px;
  border-radius: 10px;
  background: #f4f7fc;
  flex-direction: column;
  gap: 4px;
}

.order-item-line {
  display: flex;
  overflow: hidden;
  color: var(--ink-soft);
  align-items: baseline;
  gap: 7px;
  font-size: 12px;
  line-height: 1.4;
}

.order-item-line .qty {
  min-width: 18px;
  color: var(--accent);
  flex: none;
  font-size: 10.5px;
  font-weight: 800;
}

.order-item-line .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-items-more {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.order-card-foot {
  display: flex;
  margin-top: auto;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.order-card-total {
  margin-left: auto;
  text-align: right;
}

.order-foot-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.order-id {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.order-foot-note {
  overflow: hidden;
  max-width: 210px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-total {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}

.order-chevron {
  display: grid;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-soft);
  flex: none;
  place-items: center;
}

.order-chevron .icon {
  width: 12px;
  height: 12px;
}

.sample-mark {
  display: inline-flex;
  width: max-content;
  margin-top: 4px;
  padding: 2px 6px;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  align-items: center;
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

/* ---------- Stock ---------- */

.stock-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
}

.product-card {
  display: flex;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  flex-direction: column;
  gap: 13px;
  box-shadow: var(--shadow-xs);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.product-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.product-card.is-low {
  border-color: #fde68a;
  background:
    linear-gradient(135deg, rgba(255, 245, 230, 0.32), rgba(255, 255, 255, 0.9) 64%);
}

.product-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.product-name-wrap {
  min-width: 0;
}

.product-category {
  display: flex;
  margin-bottom: 4px;
  color: var(--muted);
  align-items: center;
  gap: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.35;
  text-transform: uppercase;
}

.product-category .sample-mark {
  margin-top: 0;
}

.product-card h3 {
  margin: 0 0 2px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.product-sku {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.stock-alert {
  display: inline-flex;
  padding: 5px 7px;
  border-radius: 7px;
  color: var(--amber);
  background: var(--amber-soft);
  flex: none;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.stock-alert .icon {
  width: 11px;
  height: 11px;
}

.stock-now {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.stock-figure {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.stock-figure strong {
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.9;
}

.stock-figure span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.stock-min {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.stock-min strong {
  color: var(--ink-soft);
  font-weight: 700;
}

.stock-bar {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1f4f9;
}

.stock-bar-fill {
  display: block;
  width: var(--stock-level, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.4s var(--ease);
}

.product-card.is-low .stock-bar-fill {
  background: #d97706;
}

.stock-locations {
  display: flex;
  margin-top: -3px;
  flex-wrap: wrap;
  gap: 5px;
}

.stock-location-chip {
  display: inline-flex;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-tint);
  align-items: center;
  gap: 6px;
  font-size: 10px;
  line-height: 1;
}

.stock-location-chip strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
}

.stock-bar-threshold {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 1px;
  background: rgba(15, 23, 42, 0.24);
}

.product-bottom {
  display: flex;
  padding-top: 1px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.product-price {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.product-price strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.product-price span {
  color: var(--muted);
  font-size: 10px;
}

.margin-pill {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-soft);
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.margin-pill.is-low {
  color: var(--danger);
  background: var(--danger-soft);
}

.card-actions {
  display: flex;
  padding-top: 12px;
  border-top: 1px solid rgba(226, 232, 240, 0.7);
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.card-actions .btn {
  flex: 1 1 auto;
}

.card-actions-icons {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 3px;
}

.card-actions .icon-button {
  margin-left: 0;
}

.card-actions .product-delete:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ---------- Movimientos ---------- */

.panel-heading {
  display: flex;
  margin: 2px 1px 13px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-count {
  color: var(--muted);
  flex: none;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.movements-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.movement-day-label {
  padding: 10px 15px 7px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  color: var(--muted);
  background: #f4f7fc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.movement-row {
  display: flex;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.68);
  align-items: center;
  gap: 11px;
}

.movement-row:last-child {
  border-bottom: 0;
}

.movement-icon {
  display: grid;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  flex: none;
  place-items: center;
}

.movement-icon .icon {
  width: 16px;
  height: 16px;
}

.movement-icon--ingreso,
.movement-icon--devolucion {
  color: var(--green);
  background: var(--green-soft);
}

.movement-icon--venta {
  color: var(--accent);
  background: var(--accent-soft);
}

.movement-icon--ajuste {
  color: var(--amber);
  background: var(--amber-soft);
}

.movement-main {
  min-width: 0;
  flex: 1;
}

.movement-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.movement-line strong {
  overflow: hidden;
  max-width: 100%;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.movement-type {
  display: inline-flex;
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.05em;
  line-height: 1.35;
  text-transform: uppercase;
}

.movement-detail {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.movement-delta {
  min-width: 45px;
  flex: none;
  font-size: 13px;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.movement-delta.is-positive {
  color: var(--green);
}

.movement-delta.is-negative {
  color: var(--accent);
}

/* ---------- Precios ---------- */

.price-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.price-table-head {
  display: none;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #f4f7fc;
  align-items: center;
  gap: 13px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.price-rows {
  display: flex;
  flex-direction: column;
}

.price-form {
  display: grid;
  padding: 14px 15px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  align-items: center;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.price-form:last-child {
  border-bottom: 0;
}

.price-form.is-dirty {
  background: linear-gradient(90deg, rgba(233, 239, 255, 0.24), transparent 60%);
}

.price-product {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  grid-column: 1 / -1;
}

.price-product-copy {
  min-width: 0;
}

.price-category {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.price-product h3 {
  overflow: hidden;
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-product-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.price-product-tags {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
}

.price-product .sample-mark {
  flex: none;
  margin-top: 0;
}

.price-remove-button {
  width: 30px;
  height: 30px;
}

.price-remove-button .icon {
  width: 14px;
  height: 14px;
}

.price-remove-button:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.price-removed-mark {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-soft);
  flex: none;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.price-form.is-removed {
  background: #fafbfd;
}

.price-form.is-removed .price-product {
  grid-column: 1 / -1;
}

.price-static {
  display: flex;
  min-height: 40px;
  color: var(--ink-soft);
  align-items: center;
  font-size: 13px;
  font-weight: 650;
}

.price-removed-toggle {
  flex: none;
}

.price-removed-count {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  color: var(--white);
  background: var(--accent);
  place-items: center;
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
}

.price-removed-toggle.is-active {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.price-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.price-field-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.input-money {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
}

.input-money > span {
  position: absolute;
  left: 10px;
  z-index: 1;
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

.input-money input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 8px 9px 8px 22px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: #ffffff;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.input-money input:hover {
  border-color: var(--line-strong);
}

.input-money input:focus {
  border-color: #8ea9f7;
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.09);
}

.input-money input::-webkit-outer-spin-button,
.input-money input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.input-money input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.price-form.is-dirty .input-money input {
  border-color: #9db7ff;
  background: #ffffff;
}

.price-gain-control {
  display: flex;
  min-height: 40px;
  align-items: stretch;
  gap: 3px;
}

.price-gain-control > button {
  width: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--accent-deep);
  background: var(--surface);
  font-size: 18px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
}

.price-gain-control > button:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.price-gain-control label {
  display: flex;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  align-items: center;
  flex: 1;
  gap: 3px;
}

.price-gain-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: right;
  font-size: 13px;
  font-weight: 650;
}

.price-gain-control input:focus {
  outline: 0;
}

.price-gain-control label:focus-within {
  border-color: #8ea9f7;
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.09);
}

.price-gain-control label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.price-readonly {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-tint);
  justify-content: flex-end;
  font-size: 14px;
}

.readonly-field-value {
  display: flex;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: var(--surface-tint);
  align-items: center;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.price-form.is-dirty .price-gain-control > button,
.price-form.is-dirty .price-gain-control label {
  border-color: #9db7ff;
}

.price-margin {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.price-margin > span {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.price-margin strong {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-soft);
  align-items: center;
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.price-margin strong.is-negative {
  color: var(--danger);
  background: var(--danger-soft);
}

.price-margin strong.is-neutral {
  color: var(--muted);
  background: var(--surface-soft);
}

.price-submit {
  width: 100%;
}

.price-submit .icon {
  width: 14px;
  height: 14px;
}

/* ---------- Empty and loading states ---------- */

.empty-state,
.loading-card,
.error-card {
  grid-column: 1 / -1;
  border-radius: var(--radius-lg);
}

.empty-state {
  display: flex;
  padding: 38px 22px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.58);
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 51px;
  height: 51px;
  margin-bottom: 13px;
  border: 1px solid rgba(49, 87, 213, 0.1);
  border-radius: 15px;
  color: var(--accent);
  background: var(--accent-soft);
  place-items: center;
}

.empty-icon .icon {
  width: 23px;
  height: 23px;
}

.empty-state h3 {
  margin: 0 0 5px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.empty-state p {
  max-width: 390px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.empty-state .btn {
  min-height: 39px;
}

.empty-state--compact {
  padding: 28px 20px;
}

.empty-state--compact .empty-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
}

.empty-state--compact h3 {
  font-size: 18px;
}

.empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.movements-list--empty {
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.movements-list--empty .empty-state {
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.58);
}

.loading-card {
  display: flex;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  flex-direction: column;
  gap: 12px;
}

.skeleton {
  border-radius: 7px;
  background: linear-gradient(90deg, #e8edf5 25%, #f8fafc 50%, #e8edf5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.35s infinite linear;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.skeleton-line {
  width: 100%;
  height: 12px;
}

.skeleton-line--short {
  width: 45%;
}

.skeleton-line--medium {
  width: 68%;
}

.skeleton-circle {
  width: 39px;
  height: 39px;
  border-radius: 50%;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skeleton-box {
  width: 100%;
  height: 56px;
  border-radius: 10px;
}

.kpi-skeleton {
  min-height: 108px;
}

.error-card {
  display: flex;
  padding: 24px;
  border: 1px solid #fecaca;
  background: var(--danger-soft);
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.error-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.025em;
}

.error-card p {
  margin: 0;
  color: #b91c1c;
  font-size: 12.5px;
}

/* ---------- Error banner ---------- */

.app-error {
  display: flex;
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.app-error strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.app-error p {
  margin: 0;
  color: #b91c1c;
  font-size: 12px;
}

.app-error .btn {
  flex: none;
}

/* ---------- Footer ---------- */

.app-footer {
  display: flex;
  margin-top: 40px;
  padding: 18px 2px 0;
  border-top: 1px solid rgba(203, 213, 225, 0.55);
  color: var(--muted);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 10.5px;
}

.app-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.local-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

#footerBrand {
  font-family: var(--font-display);
  font-size: 12px;
  font-style: italic;
}

/* ---------- Bottom navigation ---------- */

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(203, 213, 225, 0.8);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -8px 25px rgba(15, 23, 42, 0.055);
  backdrop-filter: blur(18px) saturate(1.2);
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
}

.nav-item {
  display: flex;
  min-height: 53px;
  padding: 4px 8px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 650;
  transition:
    color 0.17s ease,
    background 0.17s ease;
}

.nav-item .icon {
  width: 20px;
  height: 20px;
}

.nav-icon-wrap {
  position: relative;
  display: grid;
  width: 42px;
  height: 27px;
  border-radius: 9px;
  place-items: center;
  transition: background 0.17s ease;
}

.nav-item.is-active {
  color: var(--accent-deep);
}

.nav-item.is-active .nav-icon-wrap {
  background: var(--accent-soft);
}

.nav-badge {
  position: absolute;
  top: -4px;
  right: 2px;
  display: grid;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  color: var(--white);
  background: var(--accent);
  place-items: center;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.nav-badge--warn {
  background: #b45309;
}

/* ---------- Dialog ---------- */

.app-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: min(90vh, 900px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: var(--radius-xl);
  color: var(--ink);
  background: transparent;
}

.app-dialog--wide {
  width: min(700px, calc(100vw - 32px));
}

.app-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}

.app-dialog[open] {
  animation: dialog-in 0.27s var(--ease) both;
}

html.keyboard-open .app-dialog[open] {
  inset: calc(var(--visual-viewport-top, 0px) + 8px) 0 auto;
  max-height: calc(var(--visual-viewport-height, 100dvh) - 16px);
  margin: 0 auto;
}

html.keyboard-open .dialog-card {
  max-height: calc(var(--visual-viewport-height, 100dvh) - 16px);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dialog-card {
  display: flex;
  max-height: min(90vh, 900px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  flex-direction: column;
}

.dialog-header {
  display: flex;
  padding: 21px 21px 13px;
  flex: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.dialog-eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.3;
  text-transform: uppercase;
}

.dialog-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.dialog-close {
  margin: -4px -4px 0 0;
  background: var(--surface-soft);
}

.dialog-content {
  padding: 3px 21px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 100px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.dialog-content::-webkit-scrollbar {
  width: 5px;
}

.dialog-content::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: var(--line-strong);
}

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
}

.form-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.field--full {
  grid-column: 1 / -1;
}

.field-label,
.fieldset-label {
  display: flex;
  color: var(--ink-soft);
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
}

.field-label small,
.fieldset-label small {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.form-input {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: #ffffff;
  font-size: 13.5px;
  line-height: 1.4;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #94a3b8;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #cbd5e1;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #8ea9f7;
  background: var(--surface-strong);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.09);
}

.field input:disabled {
  color: var(--muted);
  background: var(--surface-soft);
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.field-hint strong {
  color: var(--ink-soft);
}

.input-with-prefix {
  position: relative;
}

.input-with-prefix > span {
  position: absolute;
  top: 50%;
  left: 11px;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-with-prefix input {
  padding-left: 22px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.fieldset-label {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
}

.channel-options {
  display: grid;
  margin-top: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.channel-option {
  position: relative;
}

.channel-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.channel-option span {
  display: flex;
  min-height: 41px;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: #ffffff;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 650;
  transition:
    border-color 0.16s ease,
    color 0.16s ease,
    background 0.16s ease;
}

.channel-option span::before {
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: 0.45;
}

.channel-option:hover span {
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.channel-option input:checked + span {
  border-color: #93c5fd;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-weight: 750;
}

.channel-option input:focus-visible + span {
  outline: 3px solid rgba(49, 87, 213, 0.28);
  outline-offset: 2px;
}

.form-divider {
  height: 1px;
  margin: 3px 0;
  border: 0;
  background: var(--line);
}

.form-section-head {
  display: flex;
  margin-bottom: 8px;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.form-section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.form-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
}

.form-error {
  display: flex;
  margin-top: 13px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 9px;
  color: #991b1b;
  background: var(--danger-soft);
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.5;
}

.form-error .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: none;
}

.modal-actions {
  display: flex;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-actions .btn {
  min-height: 42px;
}

.modal-actions .modal-actions-spacer {
  flex: 1;
}

.modal-copy {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.modal-copy strong {
  color: var(--ink);
}

.detail-callout {
  display: flex;
  margin: 13px 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.55;
}

.detail-callout .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--accent);
  flex: none;
}

/* ---------- Order picker ---------- */

.order-form {
  margin: 0;
}

.order-form .form-grid {
  gap: 14px;
}

.special-toggle-card {
  display: flex;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-tint);
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.special-toggle-card input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex: none;
}

.special-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.special-toggle-copy strong {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
}

.special-toggle-copy small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.special-order-fields {
  display: grid;
  padding: 12px;
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  background: var(--accent-soft);
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 560px) {
  .special-order-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.product-picker {
  margin-top: 16px;
}

.picker-search {
  margin-bottom: 8px;
}

.order-product-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.order-product-row {
  display: flex;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.68);
  align-items: center;
  gap: 10px;
  transition: background 0.14s ease;
}

.order-product-row:last-child {
  border-bottom: 0;
}

.order-product-row.is-selected {
  background: rgba(233, 239, 255, 0.46);
}

.order-product-row.is-unavailable {
  opacity: 0.6;
}

.picker-product-copy {
  min-width: 0;
  flex: 1;
}

.picker-product-copy strong {
  display: block;
  overflow: hidden;
  margin-bottom: 1px;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-product-meta {
  display: flex;
  margin: 0;
  color: var(--muted);
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 10px;
  line-height: 1.4;
}

.picker-stock {
  color: var(--muted);
}

.picker-stock.is-low {
  color: var(--amber);
  font-weight: 650;
}

.picker-stock.is-empty {
  color: var(--danger);
  font-weight: 650;
}

.quantity-stepper {
  display: flex;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  flex: none;
  align-items: center;
}

.step-btn {
  display: grid;
  width: 31px;
  height: 32px;
  padding: 0;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  place-items: center;
  transition: background 0.14s ease;
}

.step-btn:hover:not(:disabled) {
  background: var(--surface-soft);
}

.step-btn:disabled {
  color: #cbd5e1;
}

.step-btn .icon {
  width: 13px;
  height: 13px;
}

.step-value {
  display: grid;
  min-width: 25px;
  height: 32px;
  color: var(--ink);
  place-items: center;
  font-size: 11.5px;
  font-weight: 750;
}

.step-add {
  height: 32px;
  padding: 0 11px;
  border: 0;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 750;
}

.step-add:hover:not(:disabled) {
  background: #e9efff;
}

.step-add:disabled {
  color: var(--muted);
  background: var(--surface-soft);
}

.order-product-empty {
  padding: 22px 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.checkout-bar {
  position: sticky;
  z-index: 2;
  bottom: -22px;
  display: flex;
  margin: 17px -21px -22px;
  padding: 13px 21px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.04);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(8px);
}

.checkout-total {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.checkout-total span {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.checkout-total strong {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.checkout-discount {
  color: var(--green);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.4;
}

.checkout-bar .btn {
  min-height: 43px;
  flex: none;
}

/* ---------- Order detail ---------- */

.detail-topline {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-order-id {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-meta-grid {
  display: grid;
  margin-bottom: 15px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.detail-meta-item {
  min-width: 0;
}

.detail-meta-label {
  display: flex;
  margin-bottom: 3px;
  color: var(--muted);
  align-items: center;
  gap: 4px;
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-meta-label .icon {
  width: 11px;
  height: 11px;
}

.detail-meta-value {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.detail-note {
  margin: 0 0 15px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent-soft);
  color: var(--ink-soft);
  background: #f4f7fc;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-line;
}

.detail-items {
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.detail-item {
  display: flex;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.68);
  align-items: flex-start;
  gap: 9px;
}

.detail-item:last-child {
  border-bottom: 0;
}

.detail-item-qty {
  display: grid;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border-radius: 7px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  flex: none;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
}

.detail-item-copy {
  min-width: 0;
  flex: 1;
}

.detail-item-copy strong {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.4;
}

.detail-item-copy span {
  color: var(--muted);
  font-size: 10px;
}

.detail-item-subtotal {
  flex: none;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.detail-discount-line {
  display: flex;
  padding: 3px 0;
  color: var(--muted);
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.detail-discount-line strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.detail-total {
  display: flex;
  padding: 12px 1px 2px;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.detail-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-total strong {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.detail-actions {
  margin-top: 17px;
}

.detail-actions .btn {
  flex: 1;
}

.detail-timeline {
  display: flex;
  margin: 4px 0 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  flex-direction: column;
  gap: 7px;
}

.timeline-item {
  display: flex;
  color: var(--muted);
  align-items: flex-start;
  gap: 8px;
  font-size: 10.5px;
  line-height: 1.5;
}

.timeline-item .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  flex: none;
}

.timeline-item.is-highlight {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---------- Confirm / samples / sharing ---------- */

.confirm-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: 13px;
  color: var(--amber);
  background: var(--amber-soft);
  place-items: center;
}

.confirm-icon.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.confirm-icon .icon {
  width: 21px;
  height: 21px;
}

.samples-panel {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.samples-summary {
  display: flex;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(233, 239, 255, 0.45), rgba(255, 255, 255, 0.9));
  align-items: flex-start;
  gap: 11px;
}

.samples-summary .empty-icon {
  width: 38px;
  height: 38px;
  margin: 0;
  border-radius: 10px;
  flex: none;
}

.samples-summary .empty-icon .icon {
  width: 18px;
  height: 18px;
}

.samples-summary h3 {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
}

.samples-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.samples-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.samples-count {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
}

.samples-count strong {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.samples-count span {
  color: var(--muted);
  font-size: 9.5px;
}

.samples-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.samples-note strong {
  color: var(--ink-soft);
}

.backup-row {
  display: flex;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffff;
  align-items: center;
  gap: 10px;
}

.backup-row .empty-icon {
  width: 37px;
  height: 37px;
  margin: 0;
  border-radius: 10px;
  flex: none;
}

.backup-row .empty-icon .icon {
  width: 17px;
  height: 17px;
}

.backup-copy {
  min-width: 0;
  flex: 1;
}

.backup-copy h3 {
  margin: 0 0 2px;
  font-size: 12.5px;
  font-weight: 700;
}

.backup-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.backup-row .btn {
  flex: none;
}

@media (max-width: 520px) {
  .backup-row {
    flex-wrap: wrap;
  }

  .backup-row .btn {
    width: 100%;
  }
}

.share-preview {
  position: relative;
  max-height: min(48vh, 420px);
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(203, 213, 225, 0.22) 22px 23px);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.75;
  overflow-wrap: break-word;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
  white-space: pre-wrap;
  word-break: break-word;
}

.share-preview::-webkit-scrollbar {
  width: 5px;
}

.share-preview::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: var(--line-strong);
}

.share-actions {
  display: grid;
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.share-actions .btn {
  width: 100%;
}

.share-actions .btn-primary {
  grid-column: 1 / -1;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  z-index: 100;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  width: max-content;
  max-width: calc(100vw - 28px);
  padding: 11px 14px 11px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #ffffff;
  background: #0f172a;
  box-shadow: 0 10px 35px rgba(15, 23, 42, 0.25);
  align-items: center;
  gap: 9px;
  transform: translateX(-50%);
  animation: toast-in 0.25s var(--ease) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.toast-icon {
  display: grid;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #d9f0df;
  background: rgba(128, 185, 143, 0.18);
  flex: none;
  place-items: center;
}

.toast-icon .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.toast p {
  margin: 0;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.45;
}

.toast.is-error {
  background: #111827;
}

.toast.is-error .toast-icon {
  color: #ffd9d1;
  background: rgba(225, 124, 110, 0.2);
}

/* ---------- Responsive ---------- */

@media (min-width: 560px) {
  .app-main {
    padding-right: 22px;
    padding-left: 22px;
  }

  .header-inner {
    padding-right: 22px;
    padding-left: 22px;
  }

  .order-grid,
  .stock-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi {
    padding: 17px;
  }

  .modal-actions .btn {
    min-width: 110px;
  }

  .app-main {
    padding-top: 32px;
  }
}

@media (min-width: 700px) {
  .view-heading {
    margin-bottom: 28px;
  }

  .view-heading-copy > p:last-child {
    font-size: 14.5px;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .kpi--wide {
    grid-column: auto;
  }

  .kpi-grid--stock {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .kpi-grid--prices .kpi {
    grid-column: auto;
  }

  .order-grid {
    gap: 15px;
  }

  .order-card {
    padding: 18px;
  }

  .stock-grid {
    gap: 15px;
  }

  .product-card {
    padding: 18px;
  }

  .price-table-head {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(80px, 0.72fr) minmax(90px, 0.78fr) minmax(62px, 0.55fr) 88px;
  }

  .price-form {
    padding: 12px 16px;
    grid-template-columns: minmax(0, 1.75fr) minmax(80px, 0.72fr) minmax(90px, 0.78fr) minmax(62px, 0.55fr) 88px;
    gap: 13px;
  }

  .price-form .price-product {
    grid-column: auto;
  }

  .price-form.is-removed .price-product {
    grid-column: auto;
  }

  .price-field-label {
    display: none;
  }

  .price-margin {
    justify-content: flex-start;
  }

  .price-margin > span {
    display: none;
  }

  .price-submit {
    width: auto;
  }

  .share-actions {
    display: flex;
    justify-content: flex-end;
  }

  .share-actions .btn {
    width: auto;
  }

  .share-actions .btn-primary {
    grid-column: auto;
    margin-right: auto;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid--one {
    grid-template-columns: minmax(0, 1fr);
  }

  .dialog-header {
    padding: 24px 24px 15px;
  }

  .dialog-content {
    padding: 4px 24px 25px;
  }

  .checkout-bar {
    bottom: -25px;
    margin: 19px -24px -25px;
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (min-width: 861px) {
  .desktop-nav {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .app-main {
    padding: 42px 24px 34px;
  }

  .header-inner {
    min-height: 74px;
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .view-heading {
    align-items: center;
  }

  .view h1 {
    font-size: 3.4rem;
  }

  .order-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toast {
    bottom: 24px;
  }

  .app-footer {
    margin-top: 50px;
  }

  .kpi {
    min-height: 113px;
  }
}

@media (min-width: 1020px) {
  .kpi-grid--orders {
    grid-template-columns: 0.9fr 0.9fr 1.2fr;
  }

  .kpi-grid--prices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kpi-grid--stock {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stock-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .order-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .order-items-preview {
    min-height: 61px;
  }
}

@media (max-width: 699px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .segmented--filters {
    width: 100%;
  }

  .segmented--filters button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .toolbar > .search-field {
    width: 100%;
    flex-basis: 42px;
  }

  .toolbar--stock .toolbar-tools {
    flex: 1 1 auto;
    flex-wrap: wrap;
  }

  .toolbar--stock .toolbar-tools .search-field {
    flex: 1 1 160px;
  }

  .product-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .edit-hint {
    margin-bottom: 2px;
  }
}

@media (max-width: 639px) {
  .app-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 94dvh;
    margin: 0;
    inset: auto 0 0;
    border-radius: 22px 22px 0 0;
  }

  html.keyboard-open .app-dialog[open] {
    inset: auto 0 var(--keyboard-inset, 0px);
    max-height: calc(var(--visual-viewport-height, 94dvh) - 8px);
    margin: 0;
  }

  html.keyboard-open .dialog-card {
    max-height: calc(var(--visual-viewport-height, 94dvh) - 8px);
  }

  .app-dialog--wide {
    width: 100%;
  }

  .dialog-card {
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
  }

  .app-dialog[open] {
    animation: sheet-in 0.29s var(--ease) both;
  }

  @keyframes sheet-in {
    from {
      opacity: 0.75;
      transform: translateY(24px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .dialog-header {
    padding: 17px 18px 10px;
  }

  .dialog-header h2 {
    font-size: 24px;
  }

  .dialog-content {
    padding: 4px 18px calc(20px + env(safe-area-inset-bottom));
  }

  .checkout-bar {
    bottom: calc(-20px - env(safe-area-inset-bottom));
    margin: 16px -18px calc(-20px - env(safe-area-inset-bottom));
    padding: 12px 18px calc(13px + env(safe-area-inset-bottom));
  }

  .view-heading {
    margin-bottom: 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .view-heading > .btn {
    width: 100%;
  }

  .view h1 {
    font-size: 2.5rem;
  }

  .view-heading-copy > p:last-child {
    font-size: 13px;
  }

  .kpi {
    min-height: 98px;
    padding: 13px;
    gap: 9px;
  }

  .kpi-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .kpi-icon .icon {
    width: 15px;
    height: 15px;
  }

  .kpi-value {
    font-size: 1.25rem;
  }

  .kpi-note {
    font-size: 10px;
  }

  .order-card {
    padding: 15px;
  }

  .brand-copy span {
    display: none;
  }

  .brand-copy strong {
    font-size: 21px;
  }

  .ghost-chip-label {
    display: none;
  }

  .ghost-chip {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .header-inner {
    min-height: 62px;
    gap: 10px;
  }

  .desktop-nav {
    display: none;
  }

  .segmented button {
    font-size: 12px;
  }

  .segment-count {
    display: none;
  }

  .app-error {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-error .btn {
    width: 100%;
  }

  .price-table-head {
    display: none;
  }

  .dialog-content .modal-actions {
    margin-top: 16px;
  }

  .form-grid--two {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-product-list {
    max-height: 220px;
  }

  .checkout-total strong {
    font-size: 21px;
  }

  .checkout-bar .btn {
    padding-right: 12px;
    padding-left: 12px;
    font-size: 12.5px;
  }

  .app-footer {
    margin-top: 30px;
    padding-bottom: 3px;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
  }
}

@media (max-width: 350px) {
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .kpi--wide {
    grid-column: auto;
  }

  .kpi {
    min-height: 84px;
  }

  .channel-abbr {
    display: none;
  }

  .order-meta {
    gap: 4px;
  }

  .order-meta .separator {
    display: none;
  }

  .channel {
    gap: 0;
  }

  .checkout-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .checkout-bar .btn {
    width: 100%;
  }
}

/* ---------- Costos ---------- */

.kpi-grid--costs .kpi:last-child {
  grid-column: span 2;
}

.rate-strip {
  display: flex;
  margin-bottom: 18px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(233, 239, 255, 0.6), rgba(255, 255, 255, 0.8));
  align-items: center;
  gap: 11px;
}

.rate-strip-icon {
  display: grid;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(49, 87, 213, 0.1);
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  flex: none;
  place-items: center;
}

.rate-strip-icon .icon {
  width: 17px;
  height: 17px;
}

.rate-strip-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.rate-strip-copy > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rate-strip-copy strong {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.rate-strip-copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.cost-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
}

.cost-card {
  display: flex;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  flex-direction: column;
  gap: 13px;
  box-shadow: var(--shadow-xs);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.cost-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.cost-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cost-card h3 {
  margin: 0 0 2px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.cost-card .product-category {
  margin-bottom: 4px;
}

.cost-state {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-soft);
  flex: none;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cost-state.is-ready {
  color: var(--green);
  background: var(--green-soft);
}

.cost-breakdown {
  display: grid;
  padding: 10px;
  border-radius: 10px;
  background: #f4f7fc;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.cost-part {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.cost-part span {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-part strong {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
}

.cost-prices {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.cost-price-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cost-price-main span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cost-price-main strong {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.cost-price-main.is-suggested strong {
  color: var(--accent);
}

.cost-price-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.cost-price-side span {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.cost-price-side strong {
  font-size: 14px;
  font-weight: 650;
}

.cost-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.cost-pill {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 9px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

.cost-pill.is-neutral {
  color: var(--muted);
  background: var(--surface-soft);
}

.cost-pill .icon {
  width: 11px;
  height: 11px;
  margin-right: 3px;
  vertical-align: -1px;
}

.material-list .empty-state {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.material-cost-preview {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 9px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.material-cost-preview.is-error {
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 500;
}

.price-form input:disabled {
  color: var(--muted);
  background: var(--surface-soft);
  cursor: not-allowed;
}

#hourlyRateForm > .field + .field {
  margin-top: 14px;
}

.cost-empty-copy {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.cost-empty-copy strong {
  color: var(--ink-soft);
}

.cost-card .card-actions {
  margin-top: auto;
}

.recipe-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
}

.recipe-card {
  display: flex;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  flex-direction: column;
  gap: 13px;
}

.recipe-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.recipe-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.recipe-meta {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.recipe-assigned,
.recipe-unassigned {
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-align: right;
  text-transform: uppercase;
}

.recipe-assigned {
  color: var(--green);
  background: var(--green-soft);
}

.recipe-unassigned {
  color: var(--muted);
  background: var(--surface-soft);
}

.recipe-costs {
  display: grid;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-tint);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.recipe-costs div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.recipe-costs span {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.recipe-costs strong {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.recipe-card .card-actions {
  margin-top: auto;
  flex-wrap: wrap;
}

.product-recipe {
  display: inline-flex;
  margin-top: 4px;
  color: var(--accent-deep);
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 650;
}

.product-recipe .icon {
  width: 12px;
  height: 12px;
}

.recipe-materials-head {
  display: flex;
  margin-top: 18px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.recipe-materials-head h3 {
  margin: 0 0 2px;
  font-size: 13px;
}

.recipe-materials-head p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
}

.recipe-material-list {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

@media (min-width: 700px) {
  .recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.material-list {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  flex-direction: column;
  box-shadow: var(--shadow-xs);
}

.material-card {
  display: flex;
  padding: 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  align-items: center;
  gap: 11px;
}

.material-card:last-child {
  border-bottom: 0;
}

.material-icon {
  display: grid;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--amber);
  background: var(--amber-soft);
  flex: none;
  place-items: center;
}

.material-icon .icon {
  width: 17px;
  height: 17px;
}

.material-copy {
  min-width: 0;
  flex: 1;
}

.material-copy h3 {
  overflow: hidden;
  margin: 0 0 1px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.material-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.material-price strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.material-price span {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.material-copy p + p {
  margin-top: 2px;
}

.material-actions {
  display: flex;
  align-items: center;
  gap: 1px;
}

.history-heading {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  gap: 10px;
}

.history-heading > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.history-heading strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-heading span {
  color: var(--muted);
  font-size: 11px;
}

.history-list,
.price-update-list {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  flex-direction: column;
}

.history-item,
.price-update-item {
  display: flex;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-item:last-child,
.price-update-item:last-child {
  border-bottom: 0;
}

.history-copy,
.price-update-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.history-copy strong,
.price-update-copy strong {
  font-size: 12px;
  font-weight: 700;
}

.history-copy span,
.price-update-copy span {
  color: var(--muted);
  font-size: 10px;
}

.history-pct,
.price-update-pct {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-soft);
  flex: none;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.price-update-pct {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.material-actions .icon-button {
  width: 33px;
  height: 33px;
}

.material-actions .icon-button .icon {
  width: 15px;
  height: 15px;
}

/* ---------- Recipe modal ---------- */

.recipe-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.recipe-materials {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipe-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.recipe-section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.recipe-materials-list {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffff;
  flex-direction: column;
}

.recipe-material-row {
  display: grid;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 84px auto 30px;
  gap: 7px;
}

.recipe-material-row:last-child {
  border-bottom: 0;
}

.recipe-material-row select,
.recipe-material-row input {
  width: 100%;
  min-width: 0;
  height: 37px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}

.recipe-material-row select:focus,
.recipe-material-row input:focus {
  border-color: #8ea9f7;
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.09);
}

.recipe-qty-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.recipe-qty-wrap input {
  padding-right: 34px;
  font-variant-numeric: tabular-nums;
}

.recipe-qty-wrap span {
  position: absolute;
  right: 8px;
  overflow: hidden;
  max-width: 28px;
  color: var(--muted);
  font-size: 9px;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-line-cost {
  min-width: 54px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.recipe-row-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.recipe-row-remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.recipe-row-remove .icon {
  width: 14px;
  height: 14px;
  margin: auto;
}

.recipe-empty-materials {
  padding: 14px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.recipe-summary {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f7fc;
}

.recipe-summary-line {
  display: flex;
  padding: 3px 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.recipe-summary-line strong {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.recipe-summary-total {
  margin-top: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.recipe-summary-total strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.recipe-suggested {
  display: flex;
  margin-top: 7px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.recipe-suggested > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.recipe-suggested span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.recipe-suggested strong {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.recipe-suggested .btn {
  min-height: 33px;
  color: var(--accent-deep);
  border-color: #c7d6ff;
  background: var(--accent-soft);
  font-size: 10.5px;
}

.recipe-margin-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

@media (min-width: 700px) {
  .kpi-grid--costs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .kpi-grid--costs .kpi:last-child {
    grid-column: auto;
  }

  .cost-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipe-material-row {
    grid-template-columns: minmax(0, 1.5fr) 100px 62px 32px;
  }
}

@media (max-width: 520px) {
  .cost-breakdown {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recipe-material-row {
    grid-template-columns: minmax(0, 1fr) 78px 30px;
  }

  .recipe-line-cost {
    display: none;
  }

  .material-card {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .material-copy {
    flex: 1 1 calc(100% - 100px);
  }

  .material-actions {
    margin-left: auto;
  }

  .material-price {
    align-items: flex-start;
    order: 4;
    width: 100%;
    padding-left: 47px;
  }

  .material-actions {
    order: 3;
  }
}

@media (min-width: 1020px) {
  .cost-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- Login ---------- */

.auth-page {
  display: grid;
  min-height: 100dvh;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 0%, rgba(49, 87, 213, 0.15), transparent 34rem),
    radial-gradient(circle at 95% 100%, rgba(15, 118, 110, 0.1), transparent 28rem),
    var(--bg);
  place-items: center;
}

.auth-shell {
  width: min(100%, 420px);
}

.auth-card {
  position: relative;
  padding: 28px 24px 24px;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.85);
  border-radius: 24px;
  background: var(--surface);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.12),
    0 2px 0 rgba(255, 255, 255, 0.7) inset;
}

.auth-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #60a5fa 55%, transparent);
  content: "";
}

.auth-brand {
  display: flex;
  margin-bottom: 28px;
  align-items: center;
  gap: 11px;
}

.auth-brand .brand-mark {
  width: 42px;
  height: 42px;
}

.auth-brand .brand-copy strong {
  font-size: 23px;
}

.auth-brand .brand-copy span {
  display: block;
}

.auth-heading {
  margin-bottom: 20px;
}

.auth-heading h1 {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 9vw, 2.7rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
}

.auth-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.auth-password-control {
  position: relative;
}

.auth-password-control input {
  padding-right: 70px;
}

.auth-show-password {
  position: absolute;
  top: 50%;
  right: 5px;
  min-height: 33px;
  padding: 5px 9px;
  border: 0;
  border-radius: 7px;
  color: var(--accent-deep);
  background: transparent;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.02em;
  transform: translateY(-50%);
  transition: background 0.16s ease;
}

.auth-show-password:hover {
  background: var(--accent-soft);
}

.auth-submit {
  min-height: 46px;
  margin-top: 4px;
}

.auth-submit.is-loading {
  opacity: 0.82;
}

.auth-form .form-error {
  margin-top: 0;
}

.auth-note {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  text-align: center;
}

.auth-foot {
  display: flex;
  margin: 16px 0 0;
  color: var(--muted);
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 11px;
  font-style: italic;
}

.header-action-button {
  color: var(--muted);
  text-decoration: none;
}

.header-action-button:hover {
  color: var(--ink);
}

@media (max-width: 639px) {
  .auth-page {
    padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  }

  .auth-card {
    padding: 24px 19px 20px;
    border-radius: 21px;
  }

  .auth-brand {
    margin-bottom: 23px;
  }

  .auth-heading {
    margin-bottom: 17px;
  }

  .header-actions {
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

