/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  min-height: 100vh; background: #f0f2f5;
  color: #1a1a1a; overflow-x: hidden; overflow-y: hidden;
}

/* === TOP BANNER === */
.top-banner {
  background: linear-gradient(90deg, #1a4b8c 0%, #f39200 100%);
  padding: 10px 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 100;
}
.banner-title {
  font-size: 13px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: #fff;
}
.banner-badge {
  background: rgba(255,255,255,0.2); padding: 3px 12px;
  border-radius: 20px; font-size: 11px; color: #fff; font-weight: 600;
}
.mood-logo {
  height: 28px; opacity: 0.9;
}
.mood-logo:hover { opacity: 1; }

/* === MAIN LAYOUT === */
.main-layout {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 16px;
  min-height: calc(100vh - 90px);
  overflow-x: auto;
  width: 100%;
}
/* === RESPONSIVE === */
@media (max-width: 1000px) {
  .dev-panel, .feed-panel { display: none !important; }
  .dev-panel.mobile-inline { display: flex !important; }
  .main-layout { gap: 12px; padding: 12px; }
}
/* Mobile tab bar */
.mobile-tabs {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: #111114; border-top: 1px solid #1e1e24;
  z-index: 150; padding: 6px 0;
}
.mobile-tabs-inner {
  display: flex; justify-content: center; gap: 4px; padding: 0 8px;
}
.mobile-tab {
  flex: 1; padding: 8px 4px; border: none; border-radius: 8px;
  background: transparent; color: #666; font-size: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: all 0.2s;
}
.mobile-tab.active { background: #1e1e24; color: #f39200; }
.mobile-tab-icon { font-size: 16px; }

/* Mobile panel overlay */
.mobile-panel-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 48px;
  background: #111114; z-index: 140;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
.mobile-panel-overlay.show { display: block; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* === MOBILE (<=700px) === */
@media (max-width: 700px) {
  body { overflow-y: auto !important; }

  .main-layout {
    flex-direction: column; align-items: center;
    padding: 8px 8px 12px; gap: 8px;
  }

  /* Remove iPhone frame completely */
  .iphone-wrapper { order: 1; width: 100%; display: flex; justify-content: center; }
  .iphone {
    width: 100% !important; max-width: 400px;
    height: 300px !important; min-height: 300px !important; max-height: 300px !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
    background: transparent !important;
    overflow: hidden !important;
  }
  .iphone.call-active {
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
  }
  .iphone::before, .iphone::after { display: none !important; }
  .dynamic-island { display: none !important; }
  .status-bar { display: none !important; }
  .home-indicator { display: none !important; }

  /* Screen: fixed height, no resizing */
  .screen {
    position: relative !important;
    border-radius: 16px !important;
    padding-top: 14px !important;
    padding-bottom: 10px;
    height: 300px !important; min-height: 300px !important; max-height: 300px !important;
    overflow: hidden !important;
  }
  .call-header { padding: 6px 16px 2px; }
  .pharmacy-icon { width: 46px; height: 46px; }
  .caller-name { font-size: 15px; margin-top: 6px; }
  .call-status { font-size: 12px; margin-top: 2px; }
  .call-timer { font-size: 15px; margin-top: 2px; }
  .inactive-hint { font-size: 11px; padding: 0 20px; margin-bottom: 6px; }
  .visualizer { height: 60px; min-height: 60px; max-height: 60px; padding: 10px; flex: 0 0 60px; }
  .bottom-area { padding: 4px 30px 8px; }
  .btn-call { width: 42px; height: 42px; }
  .btn-call svg { width: 20px; height: 20px; }

  /* Calling rings smaller */
  .calling-rings { transform: translate(-50%, -50%) scale(0.7); }

  /* Admin panel full width */
  .admin-panel {
    width: 100% !important; min-width: unset !important;
    height: auto !important; max-height: none;
    order: 2; border-radius: 12px;
  }

  /* Top banner compact */
  .top-banner {
    flex-direction: column; gap: 4px; text-align: center;
    padding: 6px 10px;
  }
  .top-banner > div { flex-wrap: wrap; justify-content: center; }
  .banner-title { font-size: 9px; letter-spacing: 1px; }
  .mood-logo { height: 18px; }
  .prompt-toggle { font-size: 8px; padding: 3px 8px; }

  /* Footer */
  .page-footer { flex-direction: column; gap: 4px; font-size: 10px; padding: 8px; }

  /* During call layout */
  .main-layout.in-call .iphone-wrapper { order: 0; }
  .main-layout.in-call .admin-panel { order: 3; }

  /* Feed panel hidden on mobile unless inline mode */
  .dev-panel.active { display: none !important; }
  .dev-panel.active.mobile-inline { display: flex !important; }

  /* Mobile call tabs */
  .mobile-call-tabs { order: 2; }
  .main-layout.in-call .dev-panel.mobile-inline { order: 3; }

  /* Transcript inline */
  .dev-panel.mobile-inline {
    display: flex !important;
    width: 100% !important; min-width: unset !important;
    height: 45vh !important;
    order: 3;
    border-radius: 12px;
    animation: none;
  }

  /* Modals full-screen */
  .modal-overlay { padding: 0; }
  .modal-card { width: 100%; max-width: 100%; max-height: 100vh; border-radius: 0; }
  .prompt-modal { padding: 0; }
  .prompt-content { width: 100%; max-width: 100%; max-height: 100vh; border-radius: 0; }
  .exec-grid { grid-template-columns: 1fr; }

  /* Ticket modal */
  .ticket-modal { padding: 10px; }
  .ticket { width: 100%; max-width: 340px; }

  /* Mobile tabs (old) */
  .mobile-tabs.show { display: block; }
}

/* === SMALL PHONES (<=430px) === */
@media (max-width: 430px) {
  .admin-section { padding: 10px; border-radius: 8px; }
  .admin-section-title { font-size: 9px; letter-spacing: 0.8px; margin-bottom: 8px; }
  .admin-header { padding: 10px 14px; }
  .admin-title { font-size: 10px; }
  .inv-name { font-size: 12px; }
  .inv-input { font-size: 10px; padding: 3px 5px; }
  .exec-table { font-size: 10px; display: block; overflow-x: auto; }
  .exec-section-title { font-size: 11px; }
  .exec-card-value { font-size: 18px; }
  .exec-list li { font-size: 11px; padding: 6px 8px; }
  .confirm-box { width: 280px; padding: 20px; }
  .confirm-text { font-size: 13px; }
}

/* === MOBILE CALL TABS === */
.mobile-call-tabs {
  display: none;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  order: 10;
  width: 100%;
}
.mobile-call-tabs.show { display: flex; }
.mobile-call-tab {
  flex: 1; max-width: 180px;
  padding: 10px 14px; border: 1px solid #2a2a2e; border-radius: 12px;
  background: #16161a; color: #888; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all 0.2s; text-align: center;
  letter-spacing: 0.3px;
}
.mobile-call-tab.active {
  background: linear-gradient(135deg, #2a1a00, #3a2000);
  color: #f39200; border-color: #f39200;
  box-shadow: 0 0 12px rgba(243,146,0,0.2);
}

/* Hide call tabs on desktop */
@media (min-width: 701px) {
  .mobile-call-tabs { display: none !important; }
}

/* === ACTIVITY FEED === */
.dev-panel,
.feed-panel {
  width: 280px; min-width: 280px; height: 560px;
  background: #111114; border: 1px solid #1e1e24;
  order: -1; flex-shrink: 0;
  display: none; flex-direction: column;
  border-radius: 16px; display: none; flex-direction: column;
  overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.dev-panel.active,
.feed-panel.active {
  display: flex;
  animation: slideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}
.dev-header,
.feed-header {
  background: #15151a; padding: 14px 18px;
  border-bottom: 1px solid #1e1e24;
  display: flex; justify-content: space-between; align-items: center;
}
.dev-title,
.feed-title {
  color: #1a4b8c; font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.dev-badge,
.feed-badge {
  background: #ff3b30; color: #fff; font-size: 10px;
  padding: 3px 10px; border-radius: 10px; font-weight: 600;
  animation: livePulse 2s infinite;
}
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.dev-transcript,
.feed-body {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.feed-body::-webkit-scrollbar { width: 4px; }
.feed-body::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

/* Feed Events */
.feed-event {
  display: flex; gap: 10px; padding: 6px 8px; border-radius: 8px;
  font-size: 12px; line-height: 1.5; animation: feedIn 0.25s ease;
  align-items: flex-start;
}
.feed-event:hover { background: rgba(255,255,255,0.03); }
@keyframes feedIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.feed-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.feed-time { color: #444; font-size: 10px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.feed-content { flex: 1; min-width: 0; }
.feed-text { word-wrap: break-word; }

.feed-event.ana .feed-text { color: #f39200; }
.feed-event.user .feed-text { color: #6db3f2; }
.feed-event.system .feed-text { color: #ff9f0a; font-size: 11px; }
.feed-event.thinking .feed-text { color: #555; font-size: 11px; }
.feed-event.thinking {
  max-height: 28px; overflow: hidden; cursor: pointer;
  transition: max-height 0.4s ease;
  border-left: 2px solid #2a2a2e; padding-left: 10px;
  min-height: 28px;
}
.feed-event.thinking .feed-text {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.feed-event.thinking:hover { background: rgba(255,255,255,0.05); border-left-color: #666; }
.feed-event.thinking.expanded { max-height: 500px; border-left-color: #f39200; }
.feed-event.thinking.expanded .feed-text { display: block; -webkit-line-clamp: unset; }
.feed-event.search .feed-text { color: #f39200; }
.feed-event.cart .feed-text { color: #5ac8fa; }
.feed-event.stock .feed-text { color: #ff9f0a; }
.feed-event.validate .feed-text { color: #30d158; }
.feed-event.error .feed-text { color: #ff3b30; }
.feed-event.order .feed-text { color: #30d158; font-weight: 600; }
.feed-event.security .feed-text { color: #ff3b30; }
.feed-event.data .feed-text { color: #8e8e93; }
.feed-event.cost .feed-text { color: #666; font-size: 10px; }

/* Feed Stats */
.dev-stats,
.feed-stats {
  background: #15151a; padding: 10px 16px;
  border-top: 1px solid #1e1e24;
  display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: #666;
}
.dev-stat span, .feed-stat span { color: #999; font-weight: 600; }
.dev-stat.tokens span, .feed-stat.tokens span { color: #ff9f0a; }

/* === iPHONE === */
.iphone-wrapper {
  position: relative; flex: 0 0 auto;
  order: 0;
}
.iphone {
  width: 270px; min-width: 270px; height: 560px;
  background: #1c1c1e;
  border-radius: 46px;
  position: relative; overflow: hidden;
  box-shadow:
    inset 0 0 0 2px #3a3a3c,
    0 0 0 1px #000,
    0 0 0 3px #2c2c2e,
    0 0 0 4px #000,
    0 20px 60px rgba(0,0,0,0.6);
  transition: box-shadow 0.5s;
}
.iphone.call-active {
  box-shadow:
    inset 0 0 0 2px #3a3a3c,
    0 0 0 1px #000,
    0 0 0 3px #2c2c2e,
    0 0 0 4px #000,
    0 20px 60px rgba(0,0,0,0.6),
    0 0 40px rgba(243,146,0,0.12);
}
/* Side buttons */
.iphone::before {
  content: ''; position: absolute;
  right: -3px; top: 120px;
  width: 3px; height: 50px;
  background: #2c2c2e; border-radius: 0 2px 2px 0;
}
.iphone::after {
  content: ''; position: absolute;
  left: -3px; top: 100px;
  width: 3px; height: 28px;
  background: #2c2c2e; border-radius: 2px 0 0 2px;
  box-shadow: 0 42px 0 #2c2c2e, 0 74px 0 #2c2c2e;
}
/* Dynamic Island */
.dynamic-island {
  width: 84px; height: 22px;
  background: #000; border-radius: 12px;
  position: absolute; top: 10px; left: 50%;
  transform: translateX(-50%); z-index: 10;
}

/* Status bar */
.status-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 24px 0; color: #fff; font-size: 13px;
  font-weight: 600; position: relative; z-index: 5;
  letter-spacing: 0.3px;
}
.status-bar-icons { display: flex; gap: 5px; align-items: center; }
.status-bar-icons svg { width: 16px; height: 16px; fill: #fff; }

/* Screen */
.screen {
  background: linear-gradient(180deg, #0d1f3c 0%, #080810 50%);
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  padding-top: 32px;
  border-radius: 46px;
  overflow: hidden;
}

/* Call header */
.call-header {
  text-align: center; padding: 10px 20px 4px; flex-shrink: 0;
}
.pharmacy-icon {
  width: 58px; height: 58px; border-radius: 50%;
  background: #1a4b8c;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 2;
  box-shadow: 0 4px 20px rgba(26,75,140,0.4);
  overflow: hidden; transition: box-shadow 0.3s, transform 0.3s;
  position: relative; z-index: 2;
}
.pharmacy-icon.speaking {
  box-shadow: 0 0 0 4px rgba(243,146,0,0.3), 0 0 30px rgba(243,146,0,0.4);
  animation: iconPulse 1.5s ease-in-out infinite;
}
@keyframes iconPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 4px rgba(243,146,0,0.3), 0 0 20px rgba(243,146,0,0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(243,146,0,0.15), 0 0 40px rgba(243,146,0,0.4); }
}
.caller-name {
  color: #fff; font-size: 18px; font-weight: 400;
  letter-spacing: -0.5px; margin-top: 10px;
}
.call-status {
  color: #8e8e93; font-size: 14px; margin-top: 4px;
  min-height: 20px;
}
.call-status.active { color: #f39200; }
.call-status.connecting { color: #ff9f0a; }
.call-timer {
  color: #8e8e93; font-size: 18px; margin-top: 6px;
  font-variant-numeric: tabular-nums; display: none;
}

/* Calling rings */
.calling-rings {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); display: none;
  pointer-events: none; z-index: 1;
}
.calling-rings.active { display: block; }
.calling-ring {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(243,146,0,0.4);
  border-radius: 50%; animation: ringExpand 2s ease-out infinite;
}
.calling-ring:nth-child(1) { animation-delay: 0s; }
.calling-ring:nth-child(2) { animation-delay: 0.5s; }
.calling-ring:nth-child(3) { animation-delay: 1s; }
@keyframes ringExpand {
  0% { width: 78px; height: 78px; opacity: 0.8; }
  100% { width: 180px; height: 180px; opacity: 0; }
}

/* Visualizer */
.visualizer {
  flex: 1; display: none; align-items: center;
  justify-content: center; gap: 3px; padding: 20px;
  max-height: 100px;
}
.visualizer .bar {
  width: 3px; background: #f39200; border-radius: 2px;
  transition: height 0.05s; min-height: 3px; opacity: 0.8;
}

/* Hint */
.inactive-hint {
  color: #8e8e93; font-size: 12px; text-align: center;
  padding: 0 30px; margin-top: auto;
}

/* Call buttons */
.bottom-area {
  padding: 2px 40px 4px; flex-shrink: 0;
  display: flex; justify-content: center;
}
.btn-call {
  width: 48px; height: 48px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-call.start { background: #30d158; }
.btn-call.start:hover { background: #2ab84d; transform: scale(1.05); }
.btn-call.end { background: #ff3b30; }
.btn-call.end:hover { background: #e6352b; }
.btn-call svg { width: 24px; height: 24px; fill: #fff; }

/* Home indicator */
.home-indicator {
  position: absolute; bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 4px;
  background: #555; border-radius: 3px;
}

/* === ADMIN PANEL === */
.admin-panel {
  width: 340px; min-width: 340px; height: 560px;
  background: linear-gradient(180deg, #131316 0%, #0e0e12 100%);
  order: 1; flex-shrink: 0;
  border: 1px solid #1e1e24;
  border-radius: 16px; display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
}
.admin-header {
  background: linear-gradient(90deg, #15151a 0%, #1a1520 100%);
  padding: 14px 18px;
  border-bottom: 1px solid #1e1e24;
  display: flex; justify-content: space-between; align-items: center;
}
.admin-title {
  color: #f39200; font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.admin-status {
  padding: 4px 12px 4px 18px; border-radius: 10px; font-size: 10px; font-weight: 600;
  letter-spacing: 0.5px;
}
.admin-status.idle {
  background: #1a1a1e; color: #444; border: 1px solid #252525;
  position: relative; overflow: hidden;
}
.admin-status.idle::before {
  content: ''; position: absolute; top: 50%; left: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #333; transform: translateY(-50%);
}
.admin-status.active {
  background: linear-gradient(135deg, #2a1a00, #3a2000);
  color: #f39200; border: 1px solid #f3920040;
  position: relative; overflow: hidden;
  animation: statusGlow 2s ease-in-out infinite;
}
.admin-status.active::before {
  content: ''; position: absolute; top: 50%; left: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #f39200; transform: translateY(-50%);
  animation: dotPulse 1.5s ease-in-out infinite;
}
@keyframes statusGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(243,146,0,0.2); }
  50% { box-shadow: 0 0 12px rgba(243,146,0,0.4); }
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50% { opacity: 0.5; transform: translateY(-50%) scale(0.7); }
}
.admin-body {
  flex: 1; overflow-y: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 10px;
}
.admin-body::-webkit-scrollbar { width: 4px; }
.admin-body::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
.admin-section {
  background: #16161a; border-radius: 12px; padding: 14px;
  border: 1px solid #1e1e24;
  transition: border-color 0.3s;
}
.admin-section:hover { border-color: #2a2a30; }
.admin-section-title {
  font-size: 10px; font-weight: 700; color: #555;
  text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

/* Inventory */
.inv-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px; margin: 0 -10px; border-radius: 8px;
  border-bottom: 1px solid #1a1a1e;
  transition: background 0.2s;
}
.inv-item:hover { background: rgba(255,255,255,0.02); }
.inv-item:last-child { border-bottom: none; }
.inv-name { color: #e0e0e0; font-size: 13px; font-weight: 600; }
.inv-controls {
  display: flex; gap: 6px; align-items: center; margin-top: 2px;
}
.inv-input {
  background: #0e0e12; border: 1px solid #2a2a2e; border-radius: 6px;
  color: #fff; padding: 4px 6px; font-size: 11px; width: 60px;
  text-align: center; transition: border-color 0.2s;
}
.inv-input:focus { border-color: #f39200; outline: none; box-shadow: 0 0 0 2px rgba(243,146,0,0.1); }
.inv-label { color: #555; font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; }
.stock-bar { height: 2px; border-radius: 1px; background: #1a1a1e; margin-top: 4px; }
.stock-bar-fill { height: 100%; border-radius: 1px; transition: width 0.5s ease; }
.stock-high { background: linear-gradient(90deg, #f39200, #f5a623); }
.stock-low { background: linear-gradient(90deg, #ff9f0a, #ff6b00); }
.stock-out { background: #ff3b30; }

/* Orders */
.order-item { padding: 10px 0; border-bottom: 1px solid #1e1e24; font-size: 12px; cursor: pointer; }
.order-item:last-child { border-bottom: none; }
.order-id { color: #f39200; font-weight: 600; }
.order-expanded {
  background: #111; border-radius: 8px; padding: 10px; margin-top: 6px;
  font-size: 11px; color: #888; display: none; line-height: 1.6;
}
.order-expanded.show { display: block; }
.order-expanded .order-label { color: #f39200; font-weight: 600; font-size: 10px; text-transform: uppercase; }
.no-orders { color: #444; font-size: 12px; text-align: center; padding: 12px; }

/* Prompt & modal buttons */
.prompt-panel { position: fixed; top: 10px; right: 10px; z-index: 100; }
.prompt-toggle {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); border-radius: 8px;
  color: #fff; padding: 6px 14px; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; backdrop-filter: blur(4px);
}
.prompt-toggle:hover { background: rgba(255,255,255,0.25); }

/* Generic modal */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75); z-index: 200;
  justify-content: center; align-items: center; padding: 30px;
  backdrop-filter: blur(6px);
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: #111114; border: 1px solid #1e1e24; border-radius: 20px;
  width: 800px; max-height: 85vh; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid #1e1e24;
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #15151a 0%, #1a1520 100%);
}
.modal-title {
  font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
}
.modal-close {
  background: #222; border: none; border-radius: 8px;
  color: #888; padding: 6px 14px; font-size: 12px; cursor: pointer;
  transition: all 0.2s;
}
.modal-close:hover { background: #333; color: #fff; }
.modal-body {
  flex: 1; overflow-y: auto; padding: 24px;
}
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* Prompt specific */
.prompt-modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.75); z-index: 200; justify-content: center; align-items: center; padding: 30px; backdrop-filter: blur(6px); }
.prompt-modal.show { display: flex; }
.prompt-content { background: #111114; border: 1px solid #1e1e24; border-radius: 20px; width: 800px; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,0.6); animation: modalIn 0.3s ease; }
.prompt-header { padding: 20px 24px; border-bottom: 1px solid #1e1e24; display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, #15151a 0%, #1a1520 100%); }
.prompt-header-title { color: #f39200; font-size: 14px; font-weight: 700; letter-spacing: 0.5px; }
.prompt-close { background: #222; border: none; border-radius: 8px; color: #888; padding: 6px 14px; font-size: 12px; cursor: pointer; }
.prompt-close:hover { background: #333; color: #fff; }
.prompt-body { flex: 1; overflow-y: auto; padding: 24px; font-size: 12px; color: #aaa; line-height: 1.8; white-space: pre-wrap; font-family: 'SF Mono', 'Consolas', 'Fira Code', monospace; background: #0a0a0e; }
.prompt-body::-webkit-scrollbar { width: 6px; }
.prompt-body::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* Executive summary */
.exec-section { margin-bottom: 24px; }
.exec-section-title { color: #f39200; font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #1e1e24; }
.exec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.exec-card { background: #16161a; border: 1px solid #1e1e24; border-radius: 12px; padding: 14px; }
.exec-card-title { font-size: 10px; color: #666; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.exec-card-value { font-size: 22px; font-weight: 700; }
.exec-card-subtitle { font-size: 11px; color: #555; margin-top: 4px; }
.exec-list { list-style: none; padding: 0; }
.exec-list li { padding: 8px 12px; border-bottom: 1px solid #1a1a1e; font-size: 12px; color: #bbb; display: flex; gap: 10px; align-items: flex-start; }
.exec-list li:last-child { border-bottom: none; }
.exec-list .icon { font-size: 16px; flex-shrink: 0; }
.exec-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.exec-table th { text-align: left; color: #666; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; padding: 8px 12px; border-bottom: 1px solid #1e1e24; }
.exec-table td { padding: 8px 12px; color: #bbb; border-bottom: 1px solid #1a1a1e; }
.exec-table tr:hover td { background: rgba(243,146,0,0.03); }
.exec-highlight { color: #f39200; font-weight: 600; }
.exec-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.exec-tag.green { background: #0a2a0a; color: #30d158; }
.exec-tag.orange { background: #2a1a00; color: #f39200; }
.exec-tag.blue { background: #0a1a2a; color: #5ac8fa; }

/* Footer */
.page-footer {
  text-align: center; padding: 14px 24px;
  color: #fff; font-size: 11px;
  background: linear-gradient(90deg, #1a4b8c 0%, #f39200 100%);
  display: flex; justify-content: space-between; align-items: center;
}
.page-footer a { color: #fff; text-decoration: none; font-weight: 600; opacity: 0.9; }
.page-footer a:hover { opacity: 1; }

/* Log area (hidden) */
.log-area { display: none; }

/* Custom confirm dialog */
.confirm-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 400;
  justify-content: center; align-items: center;
  backdrop-filter: blur(4px);
}
.confirm-overlay.show { display: flex; }
.confirm-box {
  background: #1a1a1e; border: 1px solid #2a2a2e; border-radius: 16px;
  padding: 24px; width: 320px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease;
}
.confirm-text { color: #ccc; font-size: 14px; margin-bottom: 20px; }
.confirm-buttons { display: flex; gap: 10px; justify-content: center; }
.confirm-btn {
  padding: 8px 24px; border-radius: 10px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.confirm-btn.cancel { background: #333; color: #999; }
.confirm-btn.cancel:hover { background: #444; color: #fff; }
.confirm-btn.danger { background: #ff3b30; color: #fff; }
.confirm-btn.danger:hover { background: #e6352b; }

/* === TICKET MODAL === */
.ticket-modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 300;
  justify-content: center; align-items: center; padding: 20px;
  backdrop-filter: blur(4px);
}
.ticket-modal.show { display: flex; }

.ticket {
  width: 340px;
  background: #faf8f5;
  border-radius: 4px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 1px rgba(0,0,0,0.2);
  font-family: 'Courier New', monospace;
  color: #333;
  animation: ticketIn 0.3s ease;
  /* Paper texture */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}
@keyframes ticketIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Zigzag top */
.ticket::before {
  content: '';
  position: absolute; top: -8px; left: 0; right: 0; height: 8px;
  background: linear-gradient(135deg, #faf8f5 33.33%, transparent 33.33%) 0 0,
              linear-gradient(225deg, #faf8f5 33.33%, transparent 33.33%) 0 0;
  background-size: 12px 8px;
}

/* Zigzag bottom */
.ticket::after {
  content: '';
  position: absolute; bottom: -8px; left: 0; right: 0; height: 8px;
  background: linear-gradient(315deg, #faf8f5 33.33%, transparent 33.33%) 0 0,
              linear-gradient(45deg, #faf8f5 33.33%, transparent 33.33%) 0 0;
  background-size: 12px 8px;
}

.ticket-header {
  text-align: center;
  padding: 24px 24px 16px;
  border-bottom: 2px dashed #ddd;
}
.ticket-logo {
  width: 50px; height: 50px; border-radius: 50%;
  margin: 0 auto 10px; object-fit: cover;
  border: 2px solid #eee;
}
.ticket-store {
  font-size: 14px; font-weight: 700; color: #1a4b8c;
  letter-spacing: 1px; text-transform: uppercase;
}
.ticket-subtitle {
  font-size: 10px; color: #999; margin-top: 2px;
}
.ticket-number {
  font-size: 18px; font-weight: 700; color: #f39200;
  margin-top: 8px; letter-spacing: 2px;
}

.ticket-body {
  padding: 16px 24px;
}
.ticket-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 12px;
}
.ticket-row.item { color: #444; }
.ticket-row.item .qty { color: #888; min-width: 30px; }
.ticket-row.item .price { font-weight: 600; color: #333; }
.ticket-separator {
  border: none; border-top: 1px dashed #ccc; margin: 8px 0;
}
.ticket-row.subtotal { color: #888; font-size: 11px; }
.ticket-row.total {
  font-size: 16px; font-weight: 700; color: #1a1a1a;
  padding: 8px 0; border-top: 2px solid #333; margin-top: 4px;
}

.ticket-customer {
  padding: 12px 24px; border-top: 2px dashed #ddd;
  font-size: 11px; color: #666; line-height: 1.8;
}
.ticket-customer-label {
  font-size: 9px; color: #bbb; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 4px;
}

.ticket-footer {
  padding: 12px 24px 20px; border-top: 2px dashed #ddd;
  text-align: center;
}
.ticket-status {
  display: inline-block; padding: 4px 16px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
}
.ticket-status.pendiente { background: #fff3e0; color: #f39200; }
.ticket-status.en_camino { background: #e3f2fd; color: #1a4b8c; }
.ticket-status.entregado { background: #e8f5e9; color: #2e7d32; }
.ticket-status.cancelado { background: #fce4ec; color: #c62828; }
.ticket-date {
  font-size: 10px; color: #bbb; margin-top: 8px;
}
.ticket-barcode {
  margin-top: 12px; text-align: center;
}
.ticket-barcode-lines {
  display: flex; justify-content: center; gap: 1px; height: 30px; align-items: flex-end;
}
.ticket-barcode-lines span {
  display: block; width: 2px; background: #333;
}
.ticket-barcode-text {
  font-size: 9px; color: #999; margin-top: 4px; letter-spacing: 3px;
}
.ticket-close {
  position: absolute; top: -12px; right: -12px;
  width: 28px; height: 28px; border-radius: 50%;
  background: #333; border: none; color: #fff;
  font-size: 14px; cursor: pointer; z-index: 10;
  display: flex; align-items: center; justify-content: center;
}
.ticket-close:hover { background: #555; }
