/* OD-LAYOUT-PRIMITIVES v1 — structure only: display, flex/grid, overflow, wrapping, ratio, geometry. */
@layer od-layout {
  :where(.od-stack,.od-row,.od-row-top,.od-cluster,.od-grid,.od-field,.od-stat,.od-cell,.od-tile) > :where(*) { min-width: 0; }

  /* containers */
  .od-stack   { display: flex; flex-direction: column; gap: var(--od-gap, 8px); }
  .od-row     { display: flex; align-items: center; gap: var(--od-gap, 8px); }
  .od-row-top { display: flex; align-items: flex-start; gap: var(--od-gap, 8px); }
  .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); }
  .od-fill    { flex: 1 1 0; min-width: 0; }
  .od-fixed   { flex: none; }
  .od-grid    { display: grid; gap: var(--od-gap, 12px); grid-template-columns: repeat(var(--od-cols, 3), minmax(0, 1fr)); }

  /* stacked information */
  .od-stat, .od-field, .od-cell { display: grid; gap: var(--od-gap, 2px); }
  :where(.od-stat,.od-field,.od-cell) > :where(*) { display: block; }
  .od-tile { display: grid; grid-template-rows: auto 1fr; }
  :where(.od-tile) > :where(*) { display: block; }

  .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); }
  .od-media-cover { object-fit: cover; }

  .od-icon { display: inline-block; inline-size: var(--od-icon-size, 1.25em); block-size: var(--od-icon-size, 1.25em); flex: none; vertical-align: middle; }

  .od-truncate { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .od-clamp-2, .od-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .od-clamp-2 { -webkit-line-clamp: 2; }
  .od-clamp-3 { -webkit-line-clamp: 3; }
  .od-lines-2 { min-height: calc(2 * 1.4em); }
  .od-nowrap  { white-space: nowrap; }
  .od-keep    { word-break: keep-all; overflow-wrap: anywhere; }

  .od-screen { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; height: 100%; }
  .od-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }

  .od-rail { display: flex; gap: var(--od-gap, 8px); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
             padding-inline: var(--od-rail-pad, 14px); scroll-padding-inline: var(--od-rail-pad, 14px); }
  .od-rail::-webkit-scrollbar { display: none; }
  :where(.od-rail) > :where(*) { flex: none; scroll-snap-align: start; }
  :where(.od-rail) > :where(:last-child) { margin-inline-end: var(--od-rail-pad, 14px); }

  .od-spacer { flex: none; visibility: hidden; pointer-events: none; }
  .od-touch  { min-width: 44px; min-height: 44px; }
}
/* /OD-LAYOUT-PRIMITIVES v1 */

/* Product Design Tokens */
:root {
  --wa-teal: #075E54;
  --wa-teal-dark: #054d44;
  --wa-light-green: #25D366;
  --wa-check-blue: #34B7F1;
  --wa-chat-bg: #EFEAE2;
  --wa-bubble-in: #FFFFFF;
  --wa-bubble-out: #E7FFDB;
  --wa-text-main: #111B21;
  --wa-text-muted: #667781;
  --wa-pill-bg: #F0F2F5;

  --navy-brand: #14284B;
  --navy-accent: #0F3F8A;
  --orange-brand: #ED7D31;
  --panel-bg: #1A2332;
  --panel-card: #242F42;
  --panel-border: rgba(255, 255, 255, 0.12);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --phone-screen-width: 412px;
  --phone-screen-height: 840px;
  --phone-bezel: 10px;
  --phone-outer-radius: 46px;
  --phone-screen-radius: 36px;
  --phone-safe-top: 48px;
  --phone-safe-bottom: 24px;
  --phone-system-fg: #17181a;
  --phone-screen-bg: #EFEAE2;
  --phone-stage-bg: #0D1424;
}

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

body {
  font-family: var(--font-family);
  background: var(--phone-stage-bg);
  color: #F0F2F5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Top Header Toolbar ── */
.app-toolbar {
  background: var(--navy-brand);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-badge {
  background: var(--orange-brand);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.brand-title {
  display: flex;
  flex-direction: column;
}
.brand-title strong {
  font-size: 15px;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}
.brand-title span {
  font-size: 11px;
  color: #A0B0C8;
}

/* Scenario Switcher Buttons */
.scenario-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.scenario-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 6px 12px;
  color: #E2E8F0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.scenario-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}
.scenario-btn.active {
  background: var(--orange-brand);
  border-color: var(--orange-brand);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(237, 125, 49, 0.4);
}
.sc-badge {
  background: rgba(0,0,0,0.25);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}
.sc-label {
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Language Switcher Pill in Top Toolbar */
.lang-switch-group {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}
.lang-pill-btn {
  background: transparent;
  border: none;
  color: #A0B0C8;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
}
.lang-pill-btn:hover {
  color: #FFFFFF;
}
.lang-pill-btn.active {
  background: var(--orange-brand);
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Language Badge inside WhatsApp Header */
.wa-lang-toggle {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 4px;
  padding: 3px 6px !important;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
}
.wa-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}
.wa-lang-text {
  color: #FFFFFF;
  font-family: var(--font-mono);
}

.tool-toggle-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #E2E8F0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.tool-toggle-btn:hover {
  background: rgba(255,255,255,0.2);
}
.tool-toggle-btn.active {
  background: #0F3F8A;
  border-color: #34B7F1;
  color: #FFFFFF;
}

/* ── Workspace Split Layout ── */
.workspace-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 36px;
  padding: 24px;
  flex: 1;
  max-width: 1480px;
  margin: 0 auto;
  width: 100%;
}

/* ── Android Handset Shell Styles ── */
.phone-frame {
  position: relative;
  width: calc(var(--phone-screen-width) + var(--phone-bezel) * 2);
  height: calc(var(--phone-screen-height) + var(--phone-bezel) * 2);
  padding: var(--phone-bezel);
  border-radius: var(--phone-outer-radius);
  background:
    linear-gradient(145deg, rgba(255,255,255,.2), transparent 18%),
    linear-gradient(155deg, #383B40 0%, #1E2024 44%, #0A0B0E 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.14),
    inset 0 0 0 2px rgba(0,0,0,.85),
    0 30px 65px -18px rgba(0,0,0,.7),
    0 10px 24px -10px rgba(0,0,0,.45);
  isolation: isolate;
  flex: none;
}

.hardware-button {
  position: absolute;
  right: -3px;
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, #08090b, #2d3036 62%, #08090b);
  box-shadow: inset 0 1px rgba(255,255,255,.1);
}
.hardware-button.volume { top: 180px; height: 80px; }
.hardware-button.power { top: 280px; height: 60px; background: linear-gradient(90deg, #08090b, #3c424c 62%, #08090b); }

.phone-screen {
  position: relative;
  width: var(--phone-screen-width);
  height: var(--phone-screen-height);
  overflow: hidden;
  border-radius: var(--phone-screen-radius);
  background: var(--phone-screen-bg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

.punch-hole {
  position: absolute;
  z-index: 40;
  top: 12px;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #283343 0 10%, #090b0f 30%, #000 72%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), inset 0 0 3px #000;
  pointer-events: none;
}

.status-bar {
  position: absolute;
  z-index: 30;
  inset: 0 0 auto;
  height: var(--phone-safe-top);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  align-items: center;
  padding: 0 18px;
  color: #FFFFFF;
  background: var(--wa-teal);
  pointer-events: none;
}
.status-time {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}
.status-cutout-zone { width: 64px; }
.status-icons {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.status-icons svg { fill: currentColor; }
.status-icons .wifi { width: 14px; height: 11px; }
.status-icons .cellular { width: 13px; height: 11px; }
.status-icons .battery { width: 9px; height: 13px; }

.gesture-indicator {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 6px;
  width: 104px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 99px;
  background: #17181a;
  opacity: .5;
  pointer-events: none;
}

.phone-content {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding-top: var(--phone-safe-top);
  padding-bottom: var(--phone-safe-bottom);
  background: var(--wa-chat-bg);
}

/* ── WhatsApp Inside Screen ── */
.wa-screen {
  background:
    radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--wa-chat-bg);
  position: relative;
}

/* WhatsApp Header */
.wa-header {
  background: var(--wa-teal);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  z-index: 20;
}
.wa-header-back {
  cursor: pointer;
  display: flex;
  align-items: center;
  color: #FFFFFF;
}
.wa-avatar-wrap {
  position: relative;
  flex: none;
}
.wa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.wa-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #25D366;
  border: 2px solid var(--wa-teal);
  border-radius: 50%;
}
.wa-header-info {
  flex: 1;
  min-width: 0;
}
.wa-header-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
}
.wa-header-name span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-verified-badge {
  --od-icon-size: 14px;
  flex: none;
}
.wa-header-status {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wa-icon-btn {
  background: none;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Outlet Context Info Banner */
.wa-outlet-banner {
  background: #E1E8EE;
  border-bottom: 1px solid #D1D9E0;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #2D3748;
}
.outlet-info strong {
  display: block;
  font-weight: 700;
  color: #14284B;
}
.outlet-info span {
  font-size: 10px;
  color: #4A5568;
}
.outlet-tag {
  background: #14284B;
  color: #FFFFFF;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* Chat Body */
.wa-chat-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.wa-system-pill {
  align-self: center;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  color: #54656F;
  text-align: center;
  max-width: 90%;
  margin-bottom: 6px;
  box-shadow: 0 1px 1px rgba(11,20,26,.13);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.35;
}
.wa-system-pill .od-icon {
  --od-icon-size: 14px;
  color: #667781;
}

/* Message Bubbles */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: fadeInMsg 0.25s ease-out;
}
@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.inbound {
  align-self: flex-start;
}
.msg-row.outbound {
  align-self: flex-end;
}

.msg-bubble {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.38;
  color: var(--wa-text-main);
  position: relative;
  box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
  word-wrap: break-word;
}
.msg-row.inbound .msg-bubble {
  background: var(--wa-bubble-in);
  border-top-left-radius: 0;
}
.msg-row.outbound .msg-bubble {
  background: var(--wa-bubble-out);
  border-top-right-radius: 0;
}

.msg-time {
  float: right;
  font-size: 10px;
  color: #667781;
  margin-left: 8px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.msg-time .check-icon {
  width: 14px;
  height: 14px;
  fill: var(--wa-check-blue);
}

/* Voice Note Bubble Component */
.voice-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}
.voice-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #25D366;
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  transition: transform 0.15s ease;
}
.voice-play-btn:hover { transform: scale(1.05); }
.voice-wave {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
}
.wave-bar {
  width: 3px;
  background: #A0B0BC;
  border-radius: 2px;
  transition: all 0.2s ease;
}
.wave-bar.active { background: #075E54; }
.voice-duration {
  font-size: 11px;
  color: #667781;
  font-family: var(--font-mono);
}
.voice-transcript-box {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.04);
  border-left: 3px solid #1F7A8C;
  border-radius: 4px;
  font-size: 11.5px;
  color: #2D3748;
}
.transcript-badge {
  font-weight: 700;
  color: #0F3F8A;
  font-size: 10px;
  display: block;
  margin-bottom: 2px;
}

/* Rich Card in WhatsApp (Order Preview & Report) */
.wa-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  margin-top: 6px;
  overflow: hidden;
}
.wa-card-header {
  background: #F8FAFC;
  padding: 6px 10px;
  border-bottom: 1px solid #E2E8F0;
  font-size: 11.5px;
  font-weight: 700;
  color: #14284B;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wa-card-body {
  padding: 8px 10px;
  font-size: 12px;
}
.wa-item-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed #E2E8F0;
}
.wa-item-line:last-child { border-bottom: none; }
.wa-item-title { font-weight: 600; color: #1A202C; }
.wa-item-sku { font-size: 10.5px; color: #718096; }
.wa-item-total { font-weight: 700; color: #0F3F8A; }

.wa-card-total-box {
  background: #EDF2F7;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 12.5px;
  color: #1A202C;
}
.wa-card-actions {
  display: flex;
  border-top: 1px solid #E2E8F0;
}
.wa-card-btn {
  flex: 1;
  background: #FFFFFF;
  border: none;
  border-right: 1px solid #E2E8F0;
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #075E54;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.wa-card-btn:last-child { border-right: none; }
.wa-card-btn:hover { background: #F7FAFC; }
.wa-card-btn.primary { color: #128C7E; background: #E7FFDB; }

/* Photo / Image bubble */
.wa-photo-thumb {
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
  border: 1px solid #CBD5E0;
}
.wa-photo-thumb img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

/* Quick Action Suggestion Rail */
.wa-quick-replies {
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid #E2E8F0;
  padding: 8px 12px;
}
.quick-chip {
  background: #FFFFFF;
  border: 1px solid #25D366;
  color: #075E54;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.quick-chip:hover {
  background: #E7FFDB;
  transform: translateY(-1px);
}
.quick-chip.promo-chip {
  border-color: #ED7D31;
  color: #C05621;
  background: #FFFAF0;
}

/* Footer & Input */
.wa-footer {
  background: #F0F2F5;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid #E2E8F0;
}
.wa-input-pill {
  flex: 1;
  background: #FFFFFF;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 2px 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}
.wa-input-icon {
  background: none;
  border: none;
  color: #54656F;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wa-text-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  padding: 6px 4px;
  font-family: inherit;
  color: #111B21;
}
.wa-mic-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #00A884;
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.18);
  transition: all 0.2s ease;
}
.wa-mic-btn:hover { background: #069476; }
.wa-mic-btn.recording {
  background: #E53E3E;
  animation: pulseRec 1s infinite alternate;
}
@keyframes pulseRec {
  from { transform: scale(1); }
  to { transform: scale(1.1); box-shadow: 0 0 12px rgba(229,62,62,0.6); }
}

/* ── PIN Authentication Modal ── */
.pin-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 30, 0.75);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.pin-modal-card {
  background: #FFFFFF;
  border-radius: 16px;
  width: 100%;
  max-width: 310px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}
.pin-lock-icon {
  width: 44px;
  height: 44px;
  background: #EEF3F8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}
.pin-modal-header h3 {
  font-size: 15px;
  color: #14284B;
  margin-bottom: 4px;
}
.pin-modal-header p {
  font-size: 11.5px;
  color: #5A6270;
  line-height: 1.35;
  margin-bottom: 14px;
}
.pin-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #CBD5E0;
  transition: all 0.15s ease;
}
.pin-dot.filled {
  background: #0F3F8A;
  border-color: #0F3F8A;
  transform: scale(1.15);
}
.pin-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.numpad-btn {
  background: #F7FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #1A202C;
  cursor: pointer;
  transition: background 0.15s;
}
.numpad-btn:hover { background: #EDF2F7; }
.numpad-btn.secondary {
  background: #EDF2F7;
  font-size: 13px;
  color: #4A5568;
}

/* ── Interactive Product Catalog Modal (CPG Dairy SKUs) ── */
.catalog-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 30, 0.78);
  backdrop-filter: blur(4px);
  z-index: 55;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}
.catalog-modal-sheet {
  background: #FFFFFF;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  height: 90%;
  max-height: 740px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.3);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.catalog-header {
  padding: 14px 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #E2E8F0;
  background: #F8FAFC;
}
.catalog-badge {
  background: #14284B;
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 4px;
}
.catalog-title-wrap h3 {
  font-size: 15px;
  color: #14284B;
  font-weight: 700;
  margin-bottom: 2px;
}
.catalog-title-wrap p {
  font-size: 11px;
  color: #64748B;
  line-height: 1.3;
}
.catalog-close-btn {
  background: #EDF2F7;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4A5568;
  flex: none;
  transition: background 0.15s;
}
.catalog-close-btn:hover { background: #CBD5E0; color: #1A202C; }

/* Filter Tabs */
.catalog-filter-rail {
  padding: 8px 12px;
  background: #FFFFFF;
  border-bottom: 1px solid #EDF2F7;
  gap: 6px;
}
.filter-tab {
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.filter-tab:hover { background: #E2E8F0; }
.filter-tab.active {
  background: #075E54;
  border-color: #075E54;
  color: #FFFFFF;
}

/* Product Cards in Catalog List */
.catalog-list {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F8FAFC;
  overflow-y: auto;
}
.sku-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sku-card.has-qty {
  border-color: #25D366;
  background: #FAFFF8;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.15);
}
.sku-media-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: #EDF2F7;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #E2E8F0;
}
.sku-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sku-info {
  flex: 1;
  min-width: 0;
}
.sku-tag {
  font-size: 9px;
  font-weight: 700;
  color: #ED7D31;
  text-transform: uppercase;
  margin-bottom: 2px;
  display: inline-block;
}
.sku-name {
  font-size: 13px;
  font-weight: 700;
  color: #1E293B;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sku-spec {
  font-size: 11px;
  color: #64748B;
  margin-top: 2px;
}
.sku-price-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
}
.sku-price {
  font-size: 12.5px;
  font-weight: 700;
  color: #0F3F8A;
}
.sku-unit {
  font-size: 10px;
  color: #94A3B8;
}

/* Quantity Stepper Control */
.sku-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F1F5F9;
  border: 1px solid #CBD5E0;
  border-radius: 6px;
  padding: 2px 4px;
}
.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #0F3F8A;
  transition: background 0.1s;
}
.qty-btn:hover { background: #EDF2F7; }
.qty-val {
  font-size: 12.5px;
  font-weight: 700;
  color: #1E293B;
  min-width: 20px;
  text-align: center;
  font-family: var(--font-mono);
}

/* Catalog Footer */
.catalog-footer {
  padding: 10px 14px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.catalog-summary {
  display: flex;
  flex-direction: column;
}
.summary-count {
  font-size: 10.5px;
  color: #64748B;
}
.summary-price {
  font-size: 14px;
  color: #0F3F8A;
  font-weight: 800;
}
.catalog-submit-btn {
  background: #00A884;
  border: none;
  color: #FFFFFF;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 168, 132, 0.3);
  transition: all 0.15s ease;
}
.catalog-submit-btn:hover:not(:disabled) {
  background: #069476;
  transform: translateY(-1px);
}
.catalog-submit-btn:disabled {
  background: #CBD5E0;
  color: #718096;
  cursor: not-allowed;
  box-shadow: none;
}
.catalog-submit-btn .od-icon {
  --od-icon-size: 14px;
}

/* ── Live DMS & Azure Inspector Panel ── */
.dms-inspector-panel {
  flex: 1;
  min-width: 380px;
  max-width: 580px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
}

.dms-panel-header {
  background: #111A29;
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dms-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dms-status-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 10px #10B981;
  animation: pulseStatus 1.6s infinite;
}
@keyframes pulseStatus {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}
.dms-header-title h3 {
  font-size: 13.5px;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}
.dms-header-title p {
  font-size: 11px;
  color: #94A3B8;
}
.dms-env-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10B981;
  color: #34D399;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.dms-panel-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(var(--phone-screen-height) + 10px);
}

/* DMS Telemetry Stats Grid */
.dms-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.dms-stat-card {
  background: var(--panel-card);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stat-label {
  font-size: 10.5px;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 13.5px;
  color: #FFFFFF;
  font-weight: 700;
}
.stat-value.text-green { color: #34D399; }
.stat-value.text-blue { color: #60A5FA; }
.stat-sub {
  font-size: 10px;
  color: #64748B;
}

/* Log Stream Section */
.dms-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dms-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #E2E8F0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dms-section-title .od-icon {
  --od-icon-size: 14px;
  color: var(--orange-brand);
}
.log-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  color: #94A3B8;
}

.dms-log-stream {
  background: #0B111C;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px;
  max-height: 220px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-entry {
  border-left: 2px solid #3B82F6;
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.log-entry.sync-in { border-color: #10B981; }
.log-entry.sync-out { border-color: #F59E0B; }
.log-time {
  font-size: 9.5px;
  color: #64748B;
}
.log-msg {
  color: #E2E8F0;
  line-height: 1.35;
}
.log-payload {
  background: rgba(255,255,255,0.04);
  padding: 4px 6px;
  border-radius: 4px;
  color: #93C5FD;
  font-size: 10px;
  overflow-x: auto;
}

/* Order Queue */
.dms-order-queue {
  background: var(--panel-card);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.queue-item.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  color: #64748B;
  font-size: 11.5px;
  font-style: italic;
}
.queue-order-card {
  background: #111A29;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.queue-order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.queue-order-id {
  font-weight: 700;
  color: #60A5FA;
  font-size: 11.5px;
}
.queue-status-tag {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid #F59E0B;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
}
.queue-status-tag.approved {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border-color: #10B981;
}
.queue-btn-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.queue-action-btn {
  flex: 1;
  background: #0F3F8A;
  border: none;
  color: #FFFFFF;
  padding: 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.queue-action-btn:hover { background: #1F7A8C; }

/* Architecture Footnote */
.dms-architecture-footnote {
  background: rgba(0,0,0,0.25);
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px;
}
.footnote-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.fn-title {
  font-size: 10px;
  color: var(--orange-brand);
  font-weight: 700;
  text-transform: uppercase;
}
.footnote-grid p {
  font-size: 10px;
  color: #94A3B8;
  line-height: 1.3;
  margin-top: 2px;
}

/* ── Responsive Scaling ── */
@media (max-width: 1080px) {
  .workspace-layout {
    flex-direction: column;
    align-items: center;
  }
  .dms-inspector-panel {
    width: 100%;
    max-width: var(--phone-screen-width);
  }
}

@media (max-width: 480px) {
  body { padding: 0; }
  .app-toolbar { padding: 8px 12px; }
  .brand-title span { display: none; }
  .workspace-layout { padding: 0; }
  .phone-frame {
    width: 100%;
    height: 100dvh;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .phone-screen {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .hardware-button, .punch-hole { display: none; }
  .dms-inspector-panel { display: none; }
}
