/* =============================================================================
   Ezylife v2 — design tokens (DESIGN-LOCKED)
   Source of truth: ~/Desktop/ezylife-portal-designs/*.dc.html — do not restyle.
   Light warm scheme: beige canvas, white cards, ink text, gold accent (admin).
   Midnight #080d1f is reserved for weighty confirms + scrims; #202D42 bubbles.
   Supplier portal loads the same file and flips --v2-accent* to teal via
   .v2-supplier. All v2 styles are scoped under .v2 so the old UI is untouched.
   ============================================================================ */

.v2 {
  /* Type */
  --v2-display: 'Ranade', sans-serif;
  --v2-body: 'Hind', -apple-system, sans-serif;

  /* Surfaces */
  --v2-canvas: #F4F1EA;         /* page background (warm beige) */
  --v2-surface: #FFFFFF;        /* cards, sheets, list panels */
  --v2-thread: #EFEAE0;         /* chat wallpaper base */
  --v2-thumb: #EADFC8;          /* photo placeholder tan */
  --v2-midnight: #080d1f;       /* weighty confirm boxes only */

  /* Ink tiers */
  --v2-ink: #202D42;
  --v2-ink-75: rgba(32,45,66,0.75);
  --v2-ink-65: rgba(32,45,66,0.65);
  --v2-ink-55: rgba(32,45,66,0.55);
  --v2-ink-45: rgba(32,45,66,0.45);
  --v2-ink-40: rgba(32,45,66,0.4);
  --v2-ink-35: rgba(32,45,66,0.35);
  --v2-cream: #F3EFE4;          /* light text on dark */
  --v2-cream-60: rgba(243,239,228,0.6);

  /* Hairlines */
  --v2-line: rgba(32,45,66,0.1);
  --v2-line-soft: rgba(32,45,66,0.08);
  --v2-line-softer: rgba(32,45,66,0.07);
  --v2-line-faint: rgba(32,45,66,0.06);

  /* Accent (admin = gold; supplier flips to teal below) */
  --v2-accent: #9C7A35;
  --v2-accent-strong: #D6AF74;  /* initials, highlights, weighty CTAs */
  --v2-accent-soft: rgba(156,122,53,0.12);
  --v2-accent-line: rgba(156,122,53,0.4);
  --v2-accent-dash: rgba(156,122,53,0.5);   /* dashed draft/queue borders */
  --v2-unread: #B98F3E;         /* unread dot */

  /* Status */
  --v2-success: #2E7D5B;
  --v2-success-soft: rgba(46,125,91,0.1);
  --v2-danger: #8A2740;
  --v2-danger-soft: rgba(138,39,64,0.08);
  --v2-danger-line: rgba(138,39,64,0.3);

  /* Channel badges */
  --v2-wa: #2E7D5B;
  --v2-ig: #8A2740;

  /* Overlay */
  --v2-scrim: rgba(10,14,24,0.55);

  /* Hover fills */
  --v2-hover-row: rgba(32,45,66,0.03);
  --v2-hover-card: #FBF9F4;

  /* Radii */
  --v2-r-card: 14px; --v2-r-mid: 12px; --v2-r-el: 10px; --v2-r-sm: 9px;
  --v2-r-sheet: 18px; --v2-r-pill: 999px;

  font-family: var(--v2-body);
  color: var(--v2-ink);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
.v2 *, .v2 *::before, .v2 *::after { box-sizing: border-box; }
.v2 ::selection { background: #202D42; color: #D6AF74; }
.v2 h1, .v2 h2, .v2 h3 { margin: 0; font-family: var(--v2-display); font-weight: 400; }
.v2 button { font-family: var(--v2-body); cursor: pointer; }
.v2 input, .v2 textarea { font-family: var(--v2-body); }
.v2 ::-webkit-scrollbar { width: 0; height: 0; }

/* Supplier portal: same system, teal accent (per design file). */
.v2.v2-supplier, .v2 .v2-supplier {
  --v2-accent: #2E8C81;
  --v2-accent-strong: #4BB3A6;
  --v2-accent-soft: rgba(75,179,166,0.12);
  --v2-accent-line: rgba(75,179,166,0.5);
  --v2-accent-dash: rgba(75,179,166,0.6);
  --v2-unread: #2E8C81;         /* unread dot is teal on supplier */
}

/* ---- Animations (exact set from the prototypes) ---- */
@keyframes v2In { from { opacity: 0; } to { opacity: 1; } }
@keyframes v2Up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* Centered-modal entrance: keyframes must carry the -50% centering, because an
   animating transform replaces the static one (fill-mode both). */
@keyframes v2UpC { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes v2Sheet { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes v2Rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes v2Toast { 0% { opacity: 0; transform: translateY(8px); } 10% { opacity: 1; transform: translateY(0); } 88% { opacity: 1; } 100% { opacity: 0; } }
.v2-anim-in { animation: v2In 0.3s ease both; }
.v2-anim-up { animation: v2Up 0.3s ease both; }
@keyframes v2QuoteFlash { 0%,100% { box-shadow: 0 0 0 0 rgba(156,122,53,0); } 25% { box-shadow: 0 0 0 3px rgba(156,122,53,0.45); } }
.v2-quote-flash { animation: v2QuoteFlash 1.2s ease both; }
.v2-anim-sheet { animation: v2Sheet 0.28s cubic-bezier(0.32,0.72,0.35,1) both; }
.v2-anim-rise { animation: v2Rise 0.3s cubic-bezier(0.32,0.72,0.35,1) both; }

/* =============================================================================
   Core layout — phone-first; ≥1024px the SAME components arrange around a
   left rail (216px) instead of the bottom tab bar. One UI, no fork.
   ============================================================================ */
.v2-app { position: fixed; inset: 0; background: var(--v2-canvas); display: flex; flex-direction: column; overflow: hidden; }
.v2-main { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; position: relative; }
/* overflow-x locked: screens NEVER pan sideways — wide tables scroll inside
   their own container (.v2-stk-scroll etc.), the page itself stays put.
   min-width:0 is load-bearing: without it a flex item defaults to min-width:auto
   and a wide inner table (e.g. the Stocklist sheet grid) stretches the whole
   screen past the viewport, clipping right-aligned header controls. */
.v2-screen { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 0 16px 96px; animation: v2In 0.3s ease both; }
/* Page NEVER pans sideways (iOS lets inner-scroller momentum chain to the
   body even with overflow-x:hidden on ancestors — contain it at both ends). */
html, body { overflow-x: hidden; }
.v2-stk-scroll { overscroll-behavior-x: contain; min-width: 0; }
.v2-h1 { font-family: var(--v2-display); font-weight: 400; font-size: 28px; color: var(--v2-ink); }
.v2-kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--v2-ink-45); }
.v2-label { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--v2-ink-45); }

/* Bottom nav (phone) */
.v2-nav { position: absolute; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px)); background: rgba(255,255,255,0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--v2-line); }
.v2-nav-item { flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; background: none; border: none; }
.v2-nav-ico { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--v2-ink-40); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--v2-ink-40); transition: all 0.2s ease; position: relative; }
.v2-nav-label { font-size: 10px; letter-spacing: 0.04em; color: var(--v2-ink-45); }
.v2-nav-item.is-active .v2-nav-ico { border-color: var(--v2-accent); color: var(--v2-accent); }
.v2-nav-item.is-active .v2-nav-label { color: var(--v2-accent); font-weight: 600; }
.v2-nav-badge { position: absolute; top: -6px; right: -8px; min-width: 16px; height: 16px; border-radius: 999px; background: var(--v2-accent); color: #fff; font-size: 9px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* Left rail (desktop ≥1024px) */
.v2-rail { display: none; }
@media (min-width: 1024px) {
  .v2-app { flex-direction: row; }
  .v2-nav { display: none; }
  .v2-rail { display: flex; flex-direction: column; flex-shrink: 0; width: 216px; background: var(--v2-surface); border-right: 1px solid var(--v2-line); }
  .v2-rail-head { padding: 22px 18px 18px; display: flex; align-items: center; gap: 10px; }
  .v2-rail-items { flex: 1; overflow-y: auto; padding: 6px 10px; }
  .v2-rail-item { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; margin-bottom: 1px; font-size: 13.5px; color: var(--v2-ink-75); background: none; border: none; text-align: left; transition: background 0.2s ease; }
  .v2-rail-item:hover { background: rgba(32,45,66,0.05); }
  .v2-rail-item.is-active { background: var(--v2-accent-soft); color: var(--v2-accent); font-weight: 600; }
  .v2-rail-badge { margin-left: auto; min-width: 18px; height: 18px; border-radius: 999px; background: var(--v2-accent); color: #fff; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
  .v2-rail-rule { border-top: 1px solid var(--v2-line-soft); margin: 8px 8px; }
  .v2-rail-user { padding: 14px 18px; border-top: 1px solid var(--v2-line-soft); display: flex; align-items: center; gap: 10px; }
  .v2-screen { padding: 28px 44px 48px 32px; }
  .v2-h1 { font-size: 26px; }
  /* Content screens sit in a centered column instead of hugging the left edge.
     860px for reading lists, 1160px for tables/boards — balanced margins both sides. */
  .v2-page { max-width: 860px; margin-inline: auto; }
  .v2-page.is-wide { max-width: 1160px; }
  /* Mount-level containers: every direct child of a capped screen centers itself. */
  .v2-screen.v2-cap > * { max-width: 860px; margin-inline: auto; }
  .v2-screen.v2-cap-wide > * { max-width: 1160px; margin-inline: auto; }
}

/* ---- Cards & rows ---- */
.v2-card { background: var(--v2-surface); border: 1px solid var(--v2-line); border-radius: var(--v2-r-card); overflow: hidden; }
.v2-card.is-pad { padding: 16px; overflow: visible; }
.v2-card.is-tap { cursor: pointer; transition: background 0.2s ease; }
.v2-card.is-tap:hover { background: var(--v2-hover-card); }
.v2-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 44px; cursor: pointer; transition: background 0.2s ease; border-top: 1px solid var(--v2-line-softer); }
.v2-row:first-child { border-top: none; }
.v2-row:hover { background: var(--v2-hover-row); }
.v2-ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Avatar + channel dot ---- */
.v2-avatar { position: relative; flex-shrink: 0; }
.v2-avatar-circle { border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-family: var(--v2-display); letter-spacing: 0.08em; color: var(--v2-accent-strong); }
.v2-avatar-dot { position: absolute; right: -2px; bottom: -2px; border-radius: 50%; border: 2px solid var(--v2-canvas); display: flex; align-items: center; justify-content: center; font-weight: 600; color: #fff; }

/* ---- Chips ---- */
.v2-chip { border-radius: var(--v2-r-pill); padding: 7px 13px; font-size: 12px; min-height: 32px; border: 1px solid rgba(32,45,66,0.2); background: transparent; color: rgba(32,45,66,0.6); transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; }
.v2-chip.is-active { background: var(--v2-accent); border-color: var(--v2-accent); color: #fff; font-weight: 600; }
.v2-chip.is-active-ink { background: var(--v2-ink); border-color: var(--v2-ink); color: #fff; font-weight: 600; }
.v2-tag { display: inline-block; border-radius: 6px; padding: 4px 9px; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; }
.v2-pilltag { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; }

/* ---- Buttons ---- */
.v2-btn { border: none; border-radius: var(--v2-r-mid); padding: 15px; min-height: 50px; font-size: 14px; font-weight: 600; letter-spacing: 0.1em; width: 100%; transition: all 0.2s ease; }
.v2-btn.is-accent { background: var(--v2-accent); color: #fff; }
.v2-btn.is-ink { background: var(--v2-ink); color: var(--v2-cream); }
.v2-btn.is-gold { background: var(--v2-accent-strong); color: var(--v2-midnight); }
.v2-btn.is-success { background: var(--v2-success); color: #fff; }
.v2-btn:disabled { background: rgba(32,45,66,0.12); color: var(--v2-ink-40); cursor: default; }
.v2-btn-sm { border-radius: var(--v2-r-sm); padding: 10px 14px; min-height: 40px; font-size: 12px; font-weight: 600; border: none; transition: all 0.2s ease; }
.v2-btn-sm.is-accent { background: var(--v2-accent); color: #fff; flex: 1; letter-spacing: 0.08em; }
.v2-btn-sm.is-ghost { background: none; border: 1px solid rgba(32,45,66,0.2); color: var(--v2-ink); font-weight: 400; }
.v2-btn-sm.is-danger { background: none; border: 1px solid var(--v2-danger-line); color: var(--v2-danger); font-weight: 400; }

/* ---- Form fields ---- */
.v2-input, .v2-textarea { width: 100%; background: var(--v2-canvas); border: 1px solid rgba(32,45,66,0.12); border-radius: var(--v2-r-el); padding: 12px 14px; font-size: 15px; color: var(--v2-ink); outline: none; transition: border-color 0.2s ease; }
.v2-input::placeholder, .v2-textarea::placeholder { color: var(--v2-ink-35); }
.v2-input:focus, .v2-textarea:focus { border-color: rgba(32,45,66,0.35); }
.v2-textarea { resize: vertical; line-height: 1.55; }
.v2-search { background: var(--v2-surface); }

/* ---- Sheets: bottom sheet on phone, centered modal on desktop ---- */
.v2-scrim { position: absolute; inset: 0; z-index: 40; background: var(--v2-scrim); animation: v2In 0.25s ease both; }
.v2-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86%; overflow-x: hidden; overscroll-behavior: contain; z-index: 41; background: var(--v2-surface); border-radius: var(--v2-r-sheet) var(--v2-r-sheet) 0 0; overflow-y: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); animation: v2Rise 0.3s cubic-bezier(0.32,0.72,0.35,1) both; }
/* Centered modal kicks in well below the rail breakpoint so split-screen
   desktop windows (700–1023px) never get a phone bottom-sheet. */
@media (min-width: 700px) {
  .v2-sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(520px, 94%); max-height: 84%; border-radius: 16px; animation: v2UpC 0.25s ease both; padding-bottom: 16px; box-shadow: 0 24px 64px rgba(8, 13, 31, 0.28); }
}
.v2-sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--v2-line-soft); background: var(--v2-surface); }
.v2-sheet-title { font-family: var(--v2-display); font-size: 19px; color: var(--v2-ink); }
.v2-sheet-x { background: none; border: none; font-size: 18px; color: var(--v2-ink-55); padding: 4px 8px; }
.v2-sheet-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }

/* ---- Toast ---- */
.v2-toast { position: absolute; left: 16px; right: 16px; bottom: 88px; z-index: 60; background: var(--v2-ink); color: var(--v2-cream); border-radius: var(--v2-r-mid); padding: 12px 16px; font-size: 13px; text-align: center; pointer-events: none; animation: v2Toast 2.4s ease both; }
@media (min-width: 1024px) { .v2-toast { left: 50%; right: auto; bottom: 28px; transform: translateX(-50%); white-space: nowrap; padding: 12px 22px; } }

/* ---- Thread (chat) ---- */
.v2-thread-bg { background: var(--v2-thread); position: relative; }
.v2-thread-wm { position: absolute; inset: 0; pointer-events: none; background-image: url('../../assets/monogram-ink.png'); background-size: 72px auto; background-repeat: repeat; opacity: 0.04; }
/* user-select/touch-callout off: long-press opens the message menu without the
   native blue text-selection handles firing (#4). Text is still copyable via the
   menu's Copy action. */
.v2-bubble { max-width: 78%; padding: 9px 13px; font-size: 14.5px; line-height: 1.5; }
/* #2 (2nd report): long-press must NOT start native blue text-selection. Scoping
   user-select:none to just the bubble missed the text/media/quote children — apply
   to the WHOLE thread scroll + every descendant. Text stays retrievable via the
   message menu's Copy. Inputs (none live in the thread) keep default selection. */
.v2-ib-scroll, .v2-ib-scroll * { -webkit-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; }
@media (min-width: 1024px) { .v2-bubble { max-width: 62%; } }
.v2-bubble.is-them { align-self: flex-start; background: var(--v2-surface); border: 1px solid var(--v2-line-soft); border-radius: 14px 14px 14px 4px; color: var(--v2-ink); }
.v2-bubble.is-us { align-self: flex-end; background: var(--v2-ink); border-radius: 14px 14px 4px 14px; color: var(--v2-cream); }
.v2-bubble.is-failed { align-self: flex-end; background: var(--v2-danger-soft); border: 1px solid rgba(138,39,64,0.35); border-radius: 14px 14px 4px 14px; color: var(--v2-ink); }
.v2-daysep { align-self: center; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(32,45,66,0.5); background: var(--v2-surface); border: 1px solid var(--v2-line-soft); border-radius: 999px; padding: 4px 12px; margin: 4px 0 2px; }

/* ---- Toggle / checkbox / radio ---- */
.v2-toggle { width: 48px; height: 28px; border-radius: 999px; padding: 3px; background: rgba(32,45,66,0.2); border: none; transition: background 0.25s ease; }
.v2-toggle.is-on { background: var(--v2-accent); }
.v2-toggle-knob { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.25s ease; }
.v2-toggle.is-on .v2-toggle-knob { transform: translateX(20px); }
.v2-check { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid rgba(32,45,66,0.3); background: transparent; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; transition: all 0.2s ease; flex-shrink: 0; }
.v2-check.is-on { background: var(--v2-success); border-color: var(--v2-success); }
.v2-radio { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid rgba(32,45,66,0.3); background: transparent; transition: all 0.2s ease; flex-shrink: 0; }
.v2-radio.is-on { background: var(--v2-accent); border-color: var(--v2-accent); }

/* ---- Skeleton ---- */
@keyframes v2Shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.v2-skel { border-radius: 8px; background: linear-gradient(90deg, rgba(32,45,66,0.06) 25%, rgba(32,45,66,0.1) 50%, rgba(32,45,66,0.06) 75%); background-size: 400px 100%; animation: v2Shimmer 1.4s linear infinite; }

/* ---- Empty state ---- */
.v2-empty { padding: 64px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.v2-empty-title { font-family: var(--v2-display); font-size: 19px; color: var(--v2-ink); }
.v2-empty-body { font-size: 13px; color: rgba(32,45,66,0.5); line-height: 1.7; max-width: 24em; }

/* ---- Stat card (Today glance) ---- */
.v2-stat-num { font-family: var(--v2-display); font-size: 26px; color: var(--v2-ink); }
.v2-stat-label { font-size: 12px; color: var(--v2-ink-55); margin-top: 2px; }
.v2-stat-cta { font-size: 11px; font-weight: 600; color: var(--v2-accent); margin-top: 6px; }

/* ---- Weighty confirm (midnight box) ---- */
.v2-weighty { background: var(--v2-midnight); border-radius: var(--v2-r-card); padding: 26px 22px; display: flex; flex-direction: column; align-items: center; gap: 13px; text-align: center; animation: v2Up 0.3s ease both; }
.v2-weighty-title { font-family: var(--v2-display); font-size: 20px; color: var(--v2-cream); }
.v2-weighty-kicker { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--v2-accent-strong); }
.v2-weighty-body { font-size: 13px; line-height: 1.7; color: var(--v2-cream-60); max-width: 26em; }
