﻿/* ================================================================
   ML_Order 订单交易系统 - 青蓝色卡片主题
   ================================================================ */

/* ====== 主题变量 ====== */
:root {
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --primary-light: #ecfeff;
  --primary-ultralight: #f0fdff;
  --bg-body: #f0f9ff;
  --bg-card: #ffffff;
  --bg-surface: #ecfeff;
  --bg-input: #f8fafc;
  --bg-hover: #ecfeff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #cffafe;
  --border-light: #ecfeff;
  --danger: #f43f5e;
  --danger-bg: #fff1f2;
  --danger-text: #9f1239;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-text: #78350f;
  --info: #0ea5e9;
  --info-bg: #f0f9ff;
  --info-text: #075985;
  --shadow-sm: 0 2px 4px rgba(6,182,212,0.08);
  --shadow: 0 4px 12px rgba(6,182,212,0.1);
  --shadow-md: 0 8px 24px rgba(6,182,212,0.12);
  --shadow-lg: 0 16px 40px rgba(6,182,212,0.15);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --brand-bg: #fce7f3;
  --brand-color: #db2777;
  --rx-bg: #ecfeff;
  --rx-color: #0891b2;
  --login-bg: linear-gradient(135deg, #0c4a6e 0%, #0891b2 50%, #06b6d4 100%);
  --th-bg: #f0f9ff;
  --card-pending-bg: #fef9c3;
  --card-pending-text: #713f12;
  --card-processing-bg: #dbeafe;
  --card-processing-text: #1e40af;
  --card-unpaid-bg: #fff1f2;
  --card-unpaid-text: #9f1239;
}

/* ── 版本二：深蓝专业 ── */

/* ── 版本三：暖色琥珀 ── */

/* ================================================================
   基础重置 & 全局
   ================================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* ── 容器 ── */
.container {
  max-width: 800px;
  margin: 0 auto;
}
.main-page {
  max-width: 800px;
  margin: 0 auto;
}

/* ── 标题 ── */
h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 12px;
  font-size: 1.3rem;
  font-weight: bold;
}

/* ================================================================
   右上角工具栏
   ================================================================ */
.header-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.user-info {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 回收站入口 */
.trash-link {
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s;
  display: inline-block;
}
.trash-link:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* 打印入口 */
.print-link {
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s;
  display: inline-block;
}
.print-link:hover {
  background: #f0fdf4;
  color: #16a34a;
}

/* 风格切换下拉 */
.theme-switcher {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.theme-switcher:focus {
  border-color: var(--primary);
}

/* 客户搜索框 */
#customer-search-input::placeholder {
  color: #bbb;
}

/* ================================================================
   统计徽章行
   ================================================================ */
.stats-row {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.stats-mini {
  display: flex;
  gap: 8px;
}
.stat-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  border: 2px solid transparent;
}
.stat-badge:hover {
  background: var(--primary) !important;
  color: #fff !important;
  opacity: 1 !important;
}
.stat-badge:active {
  transform: scale(0.96);
}
.stat-badge.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.stat-badge.pending {
  background: var(--card-pending-bg);
  color: var(--card-pending-text);
}
.stat-badge.processing {
  background: var(--card-processing-bg);
  color: var(--card-processing-text);
}
.stat-badge.processed {
  background: #ede9fe;
  color: #8b5cf6;
}
.stat-badge.waiting_process {
  background: #ffedd5;
  color: #f97316;
}
.stat-badge.waiting_pickup {
  background: #cffafe;
  color: #06b6d4;
}
.stat-badge.unpaid {
  background: var(--card-unpaid-bg);
  color: var(--card-unpaid-text);
}
.stat-badge.trial {
  background: #f3e8ff;
  color: #a855f7;
}
.stat-badge.after_sale {
  background: #fee2e2;
  color: #ef4444;
}

/* ================================================================
   按钮系统
   ================================================================ */
.btn,
.btn-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: all 0.15s;
  font-weight: 400;
}
.btn:hover,
.btn-tool:hover {
  opacity: 0.8;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary,
.btn-new {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover,
.btn-new:hover {
  background: var(--primary-hover);
  opacity: 1;
}
.btn-outline {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: none;
}
.btn-outline:hover {
  opacity: 0.8;
}
.btn-danger-outline {
  color: var(--danger);
  background: var(--bg-surface);
}
.btn-danger-outline:hover {
  background: var(--danger-bg);
  opacity: 1;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  font-weight: 500;
  border: none;
}
.btn-danger:hover {
  background: var(--danger-text);
  opacity: 1;
}
.btn-sm,
.btn-small {
  padding: 5px 10px;
  font-size: 12px;
}
.btn-xs,
.btn-tiny {
  padding: 3px 6px;
  font-size: 12px;
}
.btn-block {
  width: 100%;
}

#logout-btn {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: none;
  font-size: 12px;
}
#logout-btn:hover {
  opacity: 0.8;
}

/* ================================================================
   登录页
   ================================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--login-bg);
}
.login-card {
  background: #fff;
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 380px;
  max-width: 90vw;
}
.login-logo {
  font-size: 48px;
  text-align: center;
  margin-bottom: 8px;
}
.login-card h1 {
  text-align: center;
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
  text-align: center;
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ================================================================
   高级筛选面板
   ================================================================ */
.advanced-filter {
  background: transparent;
  border-bottom: none;
  padding: 0;
  box-shadow: none;
}
.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px 20px;
  align-items: end;
}
.filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-item label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.filter-item-chips {
  grid-column: 1 / -1;
}
.filter-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-range input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-primary);
}
.filter-range input[type="number"] {
  width: 100%;
}
.filter-range span {
  color: var(--text-secondary);
  font-size: 13px;
  flex-shrink: 0;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  background: var(--bg-card);
  transition: all 0.15s;
  user-select: none;
}
.chip-label:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.chip-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}
.filter-item select {
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-card);
  min-width: 0;
  width: 100%;
  color: var(--text-primary);
}
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 2px;
}

/* ================================================================
   Tab 导航
   ================================================================ */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  padding: 6px 6px 0;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
}
.tab-btn {
  padding: 10px 22px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: none;
  margin-bottom: 0;
  transition: all 0.2s;
}
.tab-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.tab-btn.active {
  color: var(--primary);
  font-weight: bold;
  background: var(--bg-body);
}
.tab-spacer {
  flex: 1;
}
.tab-search-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  margin-left: auto;
  border: none;
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: opacity 0.15s;
}
.tab-search-btn:hover {
  opacity: 0.8;
}
.tab-search-btn .search-icon {
  font-size: 16px;
}

/* ================================================================
   内容区
   ================================================================ */
.content {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ================================================================
   订单列表
   ================================================================ */
.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.list-toolbar-top {
  margin-bottom: 10px;
}
.order-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.order-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.order-search-wrap input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  transition: border-color 0.15s;
  background: var(--bg-card);
  color: var(--text-primary);
  box-sizing: border-box;
}
.order-search-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.list-toolbar-bottom {
  justify-content: flex-end;
  margin-top: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.list-info {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  align-items: center;
  padding-left: 12px;
}
.stats-range-select {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  outline: none;
  margin-left: 4px;
}
.stats-range-select:hover {
  border-color: var(--primary);
}
.result-sum {
  font-weight: 500;
  color: var(--text-primary);
}
.list-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.page-size-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}
.page-size-select:focus {
  outline: none;
  border-color: var(--accent);
}

.sort-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ── 订单卡片 ── */
.order-card {
  background: var(--bg-surface);
  border-style: solid;
  border-color: var(--border-light);
  border-width: 1px 1px 1px 5px;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: background 0.2s, border-color 0.15s;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.order-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 5px;
  border-radius: 0 4px 4px 0;
  background: transparent;
  transition: background 0.25s, box-shadow 0.25s;
}
.order-card:hover {
}
.order-card:hover::before {
  /* 效果在 index.html 内联中 */
}
.order-status {
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.order-status.status-cancelled {
  text-decoration: line-through;
  opacity: 0.6;
}
.order-status:hover {
  cursor: pointer;
  opacity: 0.85;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.1);
}
.order-status.active-filter {
  box-shadow: 0 0 0 2px rgba(0,0,0,0.2);
}
.order-time {
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.order-card-body {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  padding: 4px 0;
}
.order-customer {
  display: flex;
  align-items: center;
  gap: 8px;
}
.order-customer strong {
  font-size: 15px;
  color: var(--text-primary);
}
.order-customer .phone {
  color: var(--text-secondary);
  margin-left: 8px;
  font-size: 13px;
}
.order-products {
  color: var(--text-secondary);
  font-size: 13px;
  flex: 1;
  min-width: 180px;
}
.order-info-row {
  display: contents;
}
.order-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.order-amount {
  font-weight: 600;
  color: var(--primary-hover);
  font-size: 15px;
}
.order-amount.unpaid-amount {
  color: var(--danger);
}
.order-amount-mob {
  display: none;
}

.order-cancelled {
  filter: grayscale(100%);
  opacity: 0.55;
}
.order-cancelled .order-amount {
  text-decoration: line-through;
}
.order-processor {
  font-size: 12px;
  color: var(--text-secondary);
}
.order-salesperson {
  font-size: 12px;
  color: var(--text-secondary);
}
.order-delivery {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}
.order-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  align-items: center;
}
/* 可编辑标签（备注/加工师/销售员） */
.editable-tag {
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 4px;
}
.editable-tag:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* PC端：状态/编辑/打印按钮 */
@media (min-width: 769px) {
  .order-card-actions .btn {
    font-size: 12px;
    padding: 5px 8px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .order-card-actions .btn:hover {
    background: var(--primary);
    color: #fff;
    opacity: 1;
  }
}
/* 红色金额可点击 */
.order-amount.unpaid-amount {
  cursor: pointer;
  transition: all 0.15s;
  padding: 2px 6px;
  border-radius: 6px;
}
.order-amount.unpaid-amount:hover {
  background: var(--danger-bg);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.order-card-actions .order-time {
  margin-left: auto;
}
.remark-badge {
  font-size: 12px;
  color: var(--primary);
  cursor: default;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.remark-badge:hover {
  background: var(--primary-light);
}
.unpaid-badge {
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.empty-state {
  text-align: center;
  padding: 60px 0;
  color: var(--text-secondary);
  font-size: 16px;
}

/* ── 分页 ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ================================================================
   新建订单表单（核心优化区域）
   ================================================================ */
.order-form {
  max-width: 960px;
  margin: 0 auto;
}

.form-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s;
}
.form-section:hover {
  box-shadow: var(--shadow-sm);
}
.form-section h3 {
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 模块渐进显示 */
.form-section.fade-in,
.form-actions.fade-in {
  animation: sectionFadeIn 0.35s ease-out both;
}
@keyframes sectionFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-start;
}
.form-row .form-group {
  flex: 1;
  min-width: 160px;
  margin-bottom: 0;
}

/* ================================================================
   客户搜索 & 信息
   ================================================================ */
.customer-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.customer-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.customer-search-wrap input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.15s;
  background: var(--bg-card);
  color: var(--text-primary);
}
.customer-search-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.customer-orders-row {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #065985;
  background: #f0f9ff;
  border-radius: var(--radius);
  border: 1px dashed #93c5fd;
}
.customer-orders-row:hover {
  background: #dbeafe;
}
.customer-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 12px 16px;
  background: var(--primary-light);
  border-radius: var(--radius);
  margin-bottom: 12px;
  align-items: center;
  border-left: 3px solid var(--primary);
}
.customer-info-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}
.customer-info-item label {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}
.customer-info-item span {
  color: var(--text-primary);
  font-weight: 500;
}
.vision-date-item {
  margin-left: auto;
}
.vision-date-item select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

/* 验光信息 */
.prescription-section {
  margin-top: 6px;
}
.prescription-section h4 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.prescription-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.prescription-table th {
  background: var(--th-bg);
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.prescription-table td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.prescription-table tr:last-child td {
  border-bottom: none;
}
.eye-label {
  font-weight: 600;
  color: var(--primary);
  text-align: left !important;
}
.rx-pd-info {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.rx-pd-info span {
  color: var(--text-primary);
}
.rx-pd-info #rx-pd {
  font-weight: 600;
}
.rx-pd-info input {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 64px;
  text-align: center;
}

/* ADD 列：无数据时隐藏 */
.prescription-section.hide-add [data-col="add"],
.prescription-section.hide-add th[data-col="add"] {
  display: none;
}

/* ================================================================
   商品明细区域
   ================================================================ */
.oi-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}
.oi-header h3 {
  margin: 0;
  white-space: nowrap;
  padding-bottom: 0;
  border-bottom: none;
}
.oi-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}
.oi-inline-sel {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-card);
  max-width: 100px;
}
.oi-inline-date {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  width: 120px;
  color: var(--text-primary);
  background: var(--bg-card);
}

.order-items-wrap {
  margin-top: 10px;
}

.order-items-empty {
  text-align: center;
  padding: 28px 20px;
  color: var(--text-muted);
  font-size: 14px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.order-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.order-items-table th {
  background: var(--th-bg);
  padding: 9px 10px;
  text-align: center;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.order-items-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  text-align: center;
  color: var(--text-primary);
}
.order-items-table tr:last-child td {
  border-bottom: none;
}
.order-items-table tr:hover td {
  background: var(--primary-ultralight);
}
.order-items-table .oi-name {
  font-weight: 600;
  text-align: center;
}
.order-items-table input[type="number"] {
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  background: var(--bg-card);
  color: var(--text-primary);
  width: 52px;
}
.order-items-table input[type="number"]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-light);
}
.order-items-table .oi-price {
  width: 72px;
}
.order-items-table .oi-subtotal {
  font-weight: 600;
  color: var(--primary-hover);
}

/* ── 金额/支付栏 ── */
.oi-summary {
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 10px;
}
.oi-amount-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}
.oi-amount-row .form-group {
  margin-bottom: 0;
  flex: 1;
}
.oi-amount-row .form-group label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: 10px;
}
.oi-amount-row .form-group input,
.oi-amount-row .form-group select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  width: 100%;
  background: var(--bg-card);
  color: var(--text-primary);
}
.oi-amount-row .form-group input:focus,
.oi-amount-row .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.oi-amount-row #total-amount {
  font-weight: 600;
  color: var(--danger);
}
.oi-amount-row #paid-amount {
  width: 100%;
}
.oi-amount-row #deposit-amount {
  width: 100%;
}
.oi-amount-row #payment-status {
  width: 100%;
}
.oi-amount-row .amount-label-group {
  flex: 0 0 auto;
  min-width: auto;
}
.oi-amount-row .amount-label-group input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: auto;
  background: var(--bg-card);
  color: var(--text-primary);
  box-sizing: border-box;
}

/* 商品表格行内元素 */
.order-items-table .oi-seq {
  position: relative;
  text-align: center;
}
.order-items-table .oi-del {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  transition: color 0.15s;
  line-height: 1;
  padding: 2px 4px;
}
.order-items-table .oi-del:hover {
  color: var(--danger);
}
.oi-name .pt-sku {
  display: block;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
}
.oi-name .pt-code {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
/* 商品名称点击可查看大图 */
.oi-name[data-img] {
  cursor: pointer;
}

/* 图片缩放弹窗 */
.img-zoom-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: zoomFadeIn 0.2s ease-out;
}
@keyframes zoomFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.img-zoom-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 22px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.img-zoom-close:hover {
  background: rgba(255,255,255,0.3);
}
.img-zoom-container {
  width: 90vw;
  height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.img-zoom-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
  will-change: transform;
}

/* ================================================================
   提交按钮区
   ================================================================ */
.form-actions {
  text-align: center;
  margin-top: 20px;
  padding-bottom: 40px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.form-actions .btn {
  min-width: 100px;
  font-size: 14px;
  padding: 10px 20px;
}

.btn-save {
  background: var(--primary);
  color: #fff;
  border: none;
  width: 100%;
  padding: 12px;
  font-size: 15px;
  cursor: pointer;
  margin-top: 12px;
  border-radius: var(--radius);
  font-weight: 600;
}
.btn-save:hover {
  opacity: 0.9;
}

/* ================================================================
   搜索下拉 & 标签
   ================================================================ */
.searchable-input {
  position: relative;
}
.searchable-input input {
  width: 100%;
}
.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  max-height: 360px;
  overflow-y: auto;
}
.dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  transition: background 0.15s;
}
.dropdown-item:hover {
  background: var(--bg-hover);
}
.dropdown-item strong {
  color: var(--text-primary);
}
.dropdown-item span {
  color: var(--text-secondary);
  font-size: 12px;
}
.dropdown-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.gender-tag {
  background: var(--bg-surface);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 12px;
}
.rx-tag {
  background: var(--rx-bg);
  color: var(--rx-color);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 11px;
}
.brand-tag {
  background: var(--brand-bg);
  color: var(--brand-color);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 11px;
}
.price-tag {
  color: var(--danger);
  font-weight: 600;
}
.stock-tag {
  color: var(--text-secondary);
}

/* ================================================================
   弹窗通用
   ================================================================ */
.modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90vw;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
}
/* 二维码弹窗 */
.qr-modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  width: 300px;
  max-width: 85vw;
  text-align: center;
}
.qr-modal-header {
  font-size: 15px;
  font-weight: 700;
  padding: 16px 16px 0;
  color: #333;
}
#qr-code-container {
  display: flex;
  justify-content: center;
  padding: 16px;
}
.modal-sm {
  max-width: 380px;
}
.modal-lg {
  max-width: 860px;
}
#adult-rx-modal .modal-box {
  max-width: 740px;
}
.modal-xl {
  max-width: 920px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 5;
}
.modal-header h3 {
  font-size: 17px;
  color: var(--text-primary);
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}
.modal-body {
  padding: 20px;
}

/* 客户选择弹窗 */
.modal-md {
  max-width: 520px;
}
.select-hint {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
}
.customer-select-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.customer-select-card:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}
.customer-select-card .cs-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  min-width: 70px;
}
.customer-select-card .cs-info {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
}
.customer-select-card .cs-record {
  font-size: 12px;
  color: var(--primary);
  white-space: nowrap;
}

/* ================================================================
   商品选择弹窗
   ================================================================ */
#product-modal {
  z-index: 1100;
}
.modal-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.product-modal-selected {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 12px;
}
.product-modal-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.product-modal-filters select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  min-width: 140px;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}
.product-modal-filters input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
  flex: 1;
  min-width: 200px;
}
@media screen and (max-width: 850px) {
  .product-modal-filters input[type="text"] {
    flex: 1;
    min-width: 0;
  }
}
.product-modal-filters input[type="text"]:focus {
  border-color: var(--color-main);
}
.product-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-left: auto;
}
.filter-search-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.product-modal-filters.wrap-search .filter-search-group {
  flex: 1 1 100%;
}
.product-card-list {
  max-height: 480px;
  min-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  z-index: 0;
}
.product-cards-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* 商品卡片 */
.product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
  background: var(--bg-card);
}
.product-card:last-child {
  border-bottom: none;
}
.product-card:hover {
  background: var(--bg-hover);
}
.product-card.selected {
  background: var(--primary-light);
}
.product-card.selected:hover {
  background: var(--primary-ultralight);
}

.product-card-code {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  flex: 1;
  min-width: 0;
}
.product-card-brand-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  flex: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-brand {
  font-weight: normal;
}
.pc-name {
  font-weight: 600;
}
.product-card-sku {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  text-align: left;
  flex: 1;
  min-width: 0;
}
.product-card-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
  text-align: left;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}
.product-card-stock {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: left;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}
.product-card-stock.low {
  color: var(--danger);
  font-weight: 500;
}
.product-card-btn {
  padding: 4px 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.product-card-btn:hover {
  opacity: 0.85;
}
.product-card-btn.added {
  background: var(--primary-hover);
  cursor: default;
}
.product-card-check {
  font-size: 18px;
  color: var(--primary);
  min-width: 24px;
  text-align: center;
  font-weight: 700;
}

/* ================================================================
   详情弹窗
   ================================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin-bottom: 16px;
}
.detail-group {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.detail-group label {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 60px;
}
.detail-group span {
  font-size: 14px;
  color: var(--text-primary);
}
.detail-table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.detail-table th {
  background: var(--th-bg);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.detail-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.empty-cell {
  text-align: center;
  color: var(--text-secondary);
}
.detail-amount-row {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
}
.detail-amount-row strong {
  color: var(--danger);
  font-size: 16px;
}

/* ================================================================
   搜索弹窗
   ================================================================ */
#search-modal .modal-content {
  max-width: 680px;
}
.search-modal-body {
  padding: 20px;
}
.search-modal-input-wrap {
  position: relative;
  margin-bottom: 16px;
}
.search-modal-input-wrap input {
  width: 100%;
  padding: 10px 44px 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  transition: border-color 0.15s;
  background: var(--bg-card);
  color: var(--text-primary);
}
.search-modal-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.search-modal-input-wrap .search-submit-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-modal-input-wrap .search-submit-btn:hover {
  opacity: 0.85;
}
.search-modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.search-modal-tab {
  padding: 8px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.search-modal-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.search-modal-section {
  display: none;
}
.search-modal-section.active {
  display: block;
}

/* ================================================================
   SKU 弹窗
   ================================================================ */
.sku-product-info {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius);
}
.sku-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sku-lens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sku-lens-table th {
  background: var(--th-bg);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
  z-index: 1;
}
.sku-lens-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  text-align: left;
}
.sku-lens-table tr.sku-row {
  cursor: pointer;
  transition: background 0.15s;
}
.sku-lens-table tr.sku-row:hover {
  background: var(--bg-hover);
}
.sku-lens-table tr.sku-row.selected {
  background: var(--primary-light);
}
.sku-lens-table .sku-check {
  width: 24px;
  text-align: center;
  color: var(--primary);
  font-weight: bold;
}
.sku-lens-table .sku-stock-low {
  color: var(--danger);
  font-weight: 600;
}
.sku-inline-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card);
  padding: 8px 0 1px;
}
.sku-inline-breadcrumb {
  font-size: 14px;
  color: var(--text-secondary);
}
.sku-inline-breadcrumb strong {
  color: var(--text-primary);
}
/* SKU 镜架网格 */
.sku-frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 4px;
}
.sku-frame-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  border: 2px solid var(--border-light);
}
.sku-frame-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.sku-frame-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.sku-frame-img-wrap {
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: zoom-in;
}
.sku-frame-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sku-frame-no-img {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}
.sku-frame-no-img .no-img-icon {
  font-size: 32px;
}
.sku-frame-stock-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  z-index: 1;
  z-index: 5;
}
.sku-frame-pr-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 16px;
  z-index: 5;
  cursor: help;
}
.sku-frame-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  z-index: 5;
}
.sku-frame-card.selected .sku-frame-check {
  display: flex;
}
.sku-frame-img-count {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 8px;
  z-index: 5;
}
.sku-card-img-dots {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 6;
}
.sku-card-img-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 0 0 4px transparent;
}
.sku-card-img-dot.active {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}
.sku-frame-info {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sku-frame-info .sku-model {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  display: block;
}
.sku-frame-info .sku-color {
  margin-top: 2px;
}

/* SKU 单品列表 */
.sku-single-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}
.sku-single-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}
.sku-single-item:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}
.sku-single-item.selected {
  background: var(--primary-light);
  border-color: var(--primary);
}
.sku-single-item .sku-single-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}
.sku-single-item .sku-single-stock {
  font-size: 12px;
  color: var(--text-secondary);
}
.sku-single-item .sku-single-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.sku-single-item.selected .sku-single-check {
  display: flex;
}

/* ================================================================
   Toast & Loading
   ================================================================ */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.toast.show {
  opacity: 1;
}
.toast.error {
  background: var(--danger);
}

.loading-mask {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bg-surface);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ================================================================
   响应式：平板端 ≤ 1024px
   ================================================================ */
@media (max-width: 1024px) {
  .product-card-sku {
    display: block;
  }
  .prescription-table th {
    font-size: 13px;
  }
  .prescription-table td {
    font-size: 12px;
    padding: 6px 6px;
  }
  .order-items-table th:first-child,
  .order-items-table td:first-child {
  }
  .product-card {
    padding: 8px 10px;
    gap: 8px;
  }
  .product-modal-filters {
    flex-wrap: wrap;
    gap: 8px;
  }
  .product-card-list {
    max-height: 420px;
  }
  .prescription-table th[data-short]:not([data-short=""]) {
    font-size: 0;
  }
  .prescription-table th[data-short]:not([data-short=""])::after {
    content: attr(data-short);
    font-size: 12px;
    font-weight: 600;
  }
  .eye-label[data-short] {
    font-size: 0;
  }
  .eye-label[data-short]::after {
    content: attr(data-short);
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
  }
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .filter-item-chips {
    grid-column: 1 / -1;
  }
}

/* ================================================================
   响应式：手机端 ≤ 768px
   ================================================================ */
@media screen and (max-width: 768px) {
  .new-order-label { display: none; }
  .mh-icon { display: none; }
  #clear-draft-btn { display: none !important; }
  #new-rx-btn { display: none !important; }
  .mobile-clear-btn { display: inline-block !important; }
  .mobile-new-rx-btn { display: inline-block !important; }
  #clear-draft-btn .btn-icon-text { display: none; }
  #clear-draft-btn {
    background: none !important;
    border: none !important;
    color: #999 !important;
    font-size: 12px !important;
    padding: 2px 6px !important;
    min-width: auto !important;
    margin-left: auto;
  }
  body {
    padding: 6px;
    font-size: 14px;
  }
  .container,
  .main-page {
    max-width: 100%;
  }

  /* 顶部工具栏 */
  .header-bar {
    margin-bottom: 6px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .user-info {
    font-size: 11px;
  }
  .theme-switcher {
    font-size: 11px;
    padding: 3px 6px;
  }

  /* 标题 */
  h1 {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  /* 统计徽章 */
  .stats-row {
    margin-bottom: 8px;
  }
  .stats-mini {
    gap: 6px;
  }
  .stat-badge {
    padding: 3px 10px;
    font-size: 12px;
  }
  .btn-sm,
  .btn-small {
    padding: 6px 12px;
    font-size: 13px;
  }

  /* Tab 导航 */
  .tab-bar {
    padding: 5px 4px 0;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tab-btn {
    padding: 10px 14px;
    font-size: 13px;
    white-space: nowrap;
  }
  .tab-search-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* 内容区 */
  .content {
    padding: 10px 8px;
  }

  /* 筛选面板 */
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .filter-item-chips {
    grid-column: 1;
  }
  .advanced-filter {
    padding: 10px 12px;
  }

  /* 列表工具栏 */
  .list-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .list-info {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
  }
  .list-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* 订单卡片 */
  .order-card {
    padding: 10px;
  }
  .order-card-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .order-customer {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .order-customer strong {
    font-size: 14px;
  }
  .order-amount-pc {
    display: none;
  }
  .order-amount-mob {
    display: inline;
    margin-left: 4px;
    font-size: 14px;
  }
  .order-info-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    width: 100%;
  }
  .order-products {
    font-size: 12px;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .order-meta {
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
    margin-left: auto;
    flex-shrink: 0;
  }
  .order-processor,
  .order-delivery {
    font-size: 12px;
  }
  .order-card-actions {
    gap: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }
  .order-card-actions .btn {
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1;
    min-height: 0;
    height: auto;
  }
  .remark-badge {
    font-size: 12px;
  }
  .order-delivery[data-short]:not([data-short=""]) {
    font-size: 0;
  }
  .order-delivery[data-short]:not([data-short=""])::after {
    content: attr(data-short);
    font-size: 12px;
  }

  /* 表单 */
  .order-form {
    max-width: 100%;
  }
  .form-section {
    padding: 12px;
    margin-bottom: 8px;
  }
  .form-section h3 {
    font-size: 13px;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  .form-row {
    flex-direction: column;
  }
  .form-row .form-group {
    min-width: 100%;
    margin-bottom: 12px;
  }
  .form-row .form-group:last-child {
    margin-bottom: 0;
  }
  .form-group label {
    font-size: 12px;
    margin-bottom: 2px;
  }
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 12px;
    font-size: 15px;
  }

  /* 客户信息 */
  .customer-info-row {
    flex-wrap: nowrap;
    gap: 6px 10px;
    padding: 8px 10px;
    font-size: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .customer-info-item {
    font-size: 12px;
    gap: 2px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  #phone-item { display: none; }
  .customer-info-item label {
    display: none;
  }
  .vision-date-item {
    margin-left: 0;
    flex-shrink: 1;
  }
  .vision-date-item label[data-short] {
    display: inline;
    font-size: 0;
  }
  .vision-date-item label[data-short]::after {
    content: attr(data-short);
    font-size: 11px;
  }
  #c-info-birth {
    font-size: 0;
  }
  #c-info-birth::after {
    content: attr(data-age);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
  }

  /* 验光信息 */
  .prescription-table {
    font-size: 12px;
  }
  .prescription-table th {
    padding: 6px 4px;
    font-size: 11px;
  }
  .prescription-table td {
    padding: 5px 4px;
    font-size: 12px;
  }
  .prescription-table th[data-short]:not([data-short=""]) {
    font-size: 0;
  }
  .prescription-table th[data-short]:not([data-short=""])::after {
    content: attr(data-short);
    font-size: 11px;
    font-weight: 600;
  }
  .eye-label[data-short] {
    font-size: 0;
  }
  .eye-label[data-short]::after {
    content: attr(data-short);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
  }
  .rx-pd-info {
    font-size: 12px;
  }
  .rx-pd-info input {
    font-size: 13px !important;
    width: 56px !important;
  }

  /* 商品明细工具栏 */
  .oi-header {
    flex-wrap: wrap;
    gap: 6px;
  }
  .oi-inline-sel {
    font-size: 12px;
    padding: 6px 8px;
    max-width: 80px;
  }
  .oi-toolbar {
    gap: 4px;
  }
  .oi-toolbar .btn-sm {
    font-size: 12px;
    padding: 7px 12px;
  }

  /* 商品明细表格 */
  .order-items-table {
    font-size: 12px;
  }
  .order-items-table th {
    padding: 7px 5px;
    font-size: 11px;
  }
  .order-items-table td {
    padding: 7px 5px;
  }
  .order-items-table th:first-child,
  .order-items-table td:first-child {
  }
  .order-items-table input[type="number"] {
    width: 48px;
    padding: 5px 4px;
    font-size: 13px;
  }
  .oi-name {
    font-size: 12px;
  }
  .oi-name .pt-code {
    display: none;
  }

  /* 金额栏：手机端两行排列 */
  .oi-summary {
    padding: 10px 12px;
  }
  .oi-amount-row {
    gap: 6px;
    flex-wrap: wrap;
  }
  .oi-amount-row .form-group {
    flex: 1 1 auto;
    min-width: 120px;
  }
  .oi-amount-row .form-group label {
    font-size: 10px;
  }
  .oi-amount-row .form-group input,
  .oi-amount-row .form-group select {
    padding: 7px 6px;
    font-size: 13px;
    width: 100%;
    min-width: 60px;
  }
  .oi-amount-row #total-amount,
  .oi-amount-row #paid-amount,
  .oi-amount-row #deposit-amount {
    width: 100%;
  }
  .oi-amount-row #payment-status {
    width: 100%;
  }
  .oi-amount-row #unpaid-display {
    font-size: 13px !important;
  }
  .oi-amount-row .amount-label-group {
    flex: 0 0 auto;
  }
  .oi-amount-row .amount-label-group span {
    padding: 7px 8px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
  }

  /* 扩展信息 */
  #section-ext-info .form-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 8px;
  }
  #section-ext-info .form-group {
    flex: 1 1 42%;
    min-width: 120px;
  }
  #section-ext-info .form-group label {
    font-size: 10px;
  }
  #section-ext-info .form-group input,
  #section-ext-info .form-group select,
  #section-ext-info .form-group textarea {
    padding: 7px 8px;
    font-size: 13px;
  }

  /* 提交按钮 */
  .form-actions {
    padding-bottom: 24px;
    gap: 8px;
  }
  .form-actions .btn {
    min-width: 80px;
    font-size: 13px;
    padding: 10px 16px;
  }

  /* 商品弹窗 */
  .modal-xl {
    max-width: 96vw;
  }
  .product-card-list {
    max-height: 360px;
  }
  .product-card {
    padding: 8px 10px;
    gap: 6px;
    font-size: 13px;
  }
  .product-card-code {
    display: none;
  }
  .product-card-brand-name {
    font-size: 12px;
    flex: 1;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  .order-items-table th:first-child { display: none; }
  .product-card-price {
    font-size: 13px;
  }
  .product-card-sku {
    text-align: right;
    width: 42px;
    flex: none;
  }
  .product-card-price {
    width: 45px;
    flex: none;
  }
  .product-card-stock {
    width: 36px;
    flex: none;
  }
  .product-card-check {
    min-width: 14px;
    font-size: 12px;
  }
  .product-modal-filters select {
    font-size: 13px;
    padding: 8px 10px;
  }

  /* 弹窗通用 */
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .modal-content {
    width: 96vw;
    max-width: 96vw;
  }
  .modal-lg {
    max-width: 96vw;
  }
  .modal-body {
    padding: 14px;
  }

  /* 分页 */
  .pagination {
    flex-wrap: wrap;
    gap: 3px;
    font-size: 12px;
  }
  .pagination .btn {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 32px;
  }

  /* 保存按钮 */
  .btn-save {
    padding: 14px;
    font-size: 16px;
  }

  /* 登录页 */
  .login-card {
    padding: 32px 24px 24px;
    width: 90vw;
    max-width: 340px;
  }
  .login-card h1 {
    font-size: 22px;
  }
  .login-subtitle {
    font-size: 13px;
    margin-bottom: 28px;
  }
  .form-group input {
    padding: 12px 14px;
    font-size: 16px;
    border-radius: var(--radius);
    min-height: 46px;
  }
  #login-btn {
    padding: 14px;
    font-size: 17px;
    border-radius: var(--radius);
    margin-top: 18px;
    min-height: 48px;
  }

  /* SKU 网格 */
  .sku-frame-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  /* Toast */
  .toast {
    font-size: 15px;
    padding: 12px 24px;
    bottom: 30px;
  }
}

/* ≤360px 极小屏 */
@media (max-width: 360px) {
  .sku-frame-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ================================================================
   触摸交互增强
   ================================================================ */
@media (hover: none) and (pointer: coarse) {
  .tab-btn:active,
  .order-card:active,
  .btn:active,
  .btn-tool:active,
  .btn-save:active,
  .product-card:active,
  .dropdown-item:active,
  .customer-select-card:active,
  #login-btn:active {
    opacity: 0.7;
    transform: scale(0.97);
    transition: transform 0.1s;
  }

  .order-card:hover,
  .product-card:hover,
  .dropdown-item:hover,
  .customer-select-card:hover,
  .tab-btn:hover {
    background: inherit;
  }
}

/* ================================================================
   安全区域适配
   ================================================================ */
@supports (padding: env(safe-area-inset-bottom)) {
  @media screen and (max-width: 768px) {
    body {
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
      padding-bottom: env(safe-area-inset-bottom);
    }
    .toast {
      bottom: calc(30px + env(safe-area-inset-bottom));
    }
  }
}

/* ================================================================
   打印内容区 - 默认隐藏
   ================================================================ */
#printArea { display: none; }

/* ================================================================
   打印样式（统一） — 同时支持订单小票(#printArea)和文本编辑器(#print-print-area)
   ================================================================ */
@media print {
  @page { size: 80mm auto; margin: 0; }

  /* 隐藏所有非打印元素 */
  body * {
    visibility: hidden !important;
  }

  body {
    background: #fff;
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    font-size: 13px;
    color: #000;
  }

  /* 隐藏页面UI结构（加快渲染+彻底隐藏） */
  .container, .main-page, .top-bar, .header-bar, .tab-bar, .tabs,
  .list-toolbar, .toast, .loading-mask, .modal-overlay, .tab-search-btn,
  .pagination, .stats-mini, .login-page,
  #search-modal, #detail-modal, #status-modal,
  #customer-select-modal, #product-modal, #sku-modal,
  .theme-switcher, .content {
    display: none !important;
  }

  /* ====== 旧打印：订单小票 ====== */
  #printArea, #printArea * {
    visibility: visible !important;
  }
  #printArea {
    display: block !important;
    width: 80mm;
    padding: 2mm;
    box-sizing: border-box;
    font-family: sans-serif !important;
    font-size: 13px;
    line-height: 1.6;
    color: #000;
  }
  /* 订单小票内部样式 */
  #printArea .divider { border-top: 1px dashed #000; margin: 6px 0; }
  #printArea .center { text-align: center; }
  #printArea .title { font-size: 20px; font-weight: bold; padding: 6px 0; letter-spacing: 1px; }
  #printArea .customer-name, #printArea .customer-phone { font-size: 14px; font-weight: bold; }
  #printArea table { width: 100%; border-collapse: collapse; margin: 6px 0; }
  #printArea .rx-table { border: 1px solid #000; }
  #printArea .rx-table th { padding: 5px 8px; font-size: 15px; text-align: center; border: 1px solid #000; }
  #printArea .rx-table td { padding: 5px 8px; font-size: 18px; text-align: center; border: 1px solid #000; }
  #printArea .item-table td, #printArea .item-table th { padding: 4px 6px; font-size: 13px; text-align: center; border-bottom: 1px dotted #ccc; }
  #printArea .item-table td:nth-child(2),
  #printArea .item-table td:nth-child(3) { font-size: 16px; }
  #printArea th { font-weight: 600; }
  #printArea .info-line { display: flex; gap: 16px; padding: 3px 0; font-size: 12px; flex-wrap: wrap; line-height: 1.5; }
  #printArea .footer { text-align: center; font-size: 11px; padding: 8px 0 0; }
  #printArea .print-time { text-align: center; font-size: 10px; padding: 2px 0 4px; color: #666; }
  #printArea .amount-row { display: flex; justify-content: space-between; font-size: 14px; }
  #printArea .order-info { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }

  /* ====== 新打印：文本编辑器（热敏纸 80mm） ====== */
  #print-print-area, #print-print-area * {
    visibility: visible !important;
  }
  #print-print-area {
    position: fixed;
    left: 0;
    top: 0;
    width: 80mm;
    padding: 8mm 4mm;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #000;
    font-family: "Microsoft YaHei", "SimHei", sans-serif;
  }
}
/* ================================================================
   ██    ██ ███████ ██████  ███████ ██  ██████  ███    ██  ██   ██ 
   ██    ██ ██      ██   ██ ██      ██ ██       ████   ██  ██   ██ 
   ██    ██ █████   ██████  ███████ ██ ██   ███ ██ ██  ██  ███████ 
    ██  ██  ██      ██   ██      ██ ██ ██    ██ ██  ██ ██       ██ 
     ████   ███████ ██   ██ ███████ ██  ██████  ██   ████       ██ 

   版本四：极简现代风 (Clean Modern)
   设计理念 — 少即是多。让信息自己说话，去掉一切装饰。
   亮点：下划线Tab + 填色输入框 + 透明卡片 + 底部固定提交栏
   ================================================================ */


/* ── V4: 下划线Tab ── */

/* ── V4: 内容区无背景 ── */

/* ── V4: 表单-透明卡片步骤引导 ── */

/* ── V4: 填色输入框 (filled input) ── */


/* ── V4: 客户信息行-简洁 ── */

/* ── V4: 订单卡片-扁平 ── */

/* ── V4: 按钮-微妙 ── */

/* ── V4: 金额栏 ── */

/* ── V4: 表格-极简 ── */

/* ── V4: 登录页 ── */

/* ── V4: 弹窗 ── */

/* ── V4: 手机端 ── */
@media screen and (max-width: 768px) {
  /* 手机端下拉框全宽 */
}


/* ================================================================
   ██    ██ ███████ ██████  ███████ ██  ██████  ███    ██ ███████ 
   ██    ██ ██      ██   ██ ██      ██ ██       ████   ██ ██      
   ██    ██ █████   ██████  ███████ ██ ██   ███ ██ ██  ██ █████   
    ██  ██  ██      ██   ██      ██ ██ ██    ██ ██  ██ ██ ██      
     ████   ███████ ██   ██ ███████ ██  ██████  ██   ████ ███████ 

   版本五：大胆卡片风 (Bold Cards)
   设计理念 — 每一块内容都是独立的卡片，有存在感和呼吸空间。
   亮点：阴影卡片 + 彩色顶边 + 胶囊按钮 + 渐变点缀
   ================================================================ */


/* ── 版本六：卡片-紫罗兰 (Card Violet) ── */

/* ── 版本七：卡片-琥珀 (Card Amber) ── */

/* ── 版本八：卡片-薄荷 (Card Mint) ── */

/* ── V5: 胶囊Tab ── */
[data-card] .tab-bar {
  background: transparent;
  padding: 4px;
  gap: 4px;
  border-radius: 0;
}
[data-card] .tab-btn {
  border-radius: var(--radius-xl);
  padding: 10px 22px;
  font-weight: 500;
  background: var(--bg-card);
  border: 2px solid transparent;
}
[data-card] .tab-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ── V5: 内容区 ── */
[data-card] .content {
  background: transparent;
  padding: 12px 0;
}

/* ── V5: 表单-阴影卡片 ── */
[data-card] .form-section {
  background: var(--bg-card);
  border: none;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  border-top: 3px solid var(--primary);
}
[data-card] .form-section h3 {
  font-size: 16px;
  color: var(--text-primary);
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
[data-card] .form-section h3::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* ── V5: 突出输入框 ── */
[data-card] .form-group input,
[data-card] .form-group select,
[data-card] .form-group textarea {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  background: var(--bg-card);
  transition: all 0.2s;
}
[data-card] .form-group input:focus,
[data-card] .form-group select:focus,
[data-card] .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* ── V5: 客户信息行-渐变 ── */
[data-card] .customer-info-row {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-ultralight));
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 18px;
}

/* ── V5: 按钮-胶囊 ── */
[data-card] .btn {
  border-radius: var(--radius-xl);
  font-weight: 500;
  padding: 8px 18px;
  transition: all 0.2s;
}
[data-card] .btn-primary,
[data-card] .btn-new {
  box-shadow: 0 4px 12px rgba(6,182,212,0.3);
}
[data-card] .btn-primary:hover,
[data-card] .btn-new:hover {
  box-shadow: 0 6px 20px rgba(6,182,212,0.4);
  transform: translateY(-1px);
}
[data-card] .btn-sm {
  border-radius: var(--radius-xl);
  padding: 6px 14px;
}

/* ── V5: 订单卡片 ── */
[data-card] .order-card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: all 0.2s;
}
[data-card] .order-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── V5: 表格-斑马纹 ── */
[data-card] .order-items-table {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
[data-card] .order-items-table th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-bottom: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  padding: 10px;
}
[data-card] .order-items-table td {
  padding: 10px;
}
[data-card] .order-items-table tr:nth-child(even) td {
  background: var(--bg-surface);
}
[data-card] .order-items-table tr:hover td {
  background: var(--primary-light);
}
[data-card] .prescription-table th {
  background: var(--primary);
  color: #fff;
  border-bottom: none;
}
[data-card] .prescription-table {
  border-radius: var(--radius);
  overflow: hidden;
  border: none;
}

/* ── V5: 金额栏-渐变 ── */
[data-card] .oi-summary {
  background: linear-gradient(135deg, var(--primary-ultralight), var(--bg-card));
  border: 2px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ── V5: 登录页 ── */
[data-card] .login-card {
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 80px rgba(6,182,212,0.25);
  border: 1px solid rgba(255,255,255,0.2);
}

/* ── V5: 弹窗 ── */
[data-card] .modal-content {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
[data-card] .modal-overlay {
  backdrop-filter: blur(6px);
}

/* ── V5: 手机端 ── */
@media screen and (max-width: 768px) {
  [data-card] body {
    padding: 4px;
    background: var(--bg-body);
  }
  [data-card] .content {
    padding: 6px 0;
  }
  [data-card] .tab-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
  [data-card] .form-section {
    padding: 14px;
    margin: 0 4px 10px;
    border-radius: var(--radius);
  }
  [data-card] .form-group input,
  [data-card] .form-group select {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 44px;
  }
  [data-card] .order-card {
    margin: 0 4px 8px;
    border-radius: var(--radius);
  }
  [data-card] .oi-amount-row {
    gap: 8px;
  }
  [data-card] .oi-amount-row .form-group {
    flex: 1 1 45%;
    min-width: 120px;
  }
  [data-card] .oi-amount-row .form-group input,
  [data-card] .oi-amount-row .form-group select {
    font-size: 15px;
    padding: 10px 8px;
    min-height: 40px;
    width: 100%;
  }
  [data-card] .form-actions {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding: 14px;
    margin: 4px;
    border-radius: var(--radius);
    box-shadow: 0 -4px 20px rgba(6,182,212,0.15);
    z-index: 10;
  }
  [data-card] .btn {
    border-radius: var(--radius-xl);
  }
}

/* ====== 成人验光弹窗 ====== */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 1000;
  display: flex; justify-content: center; align-items: center;
}
#customer-select-modal { z-index: 1100; }
.modal-box { background: var(--bg-card); border-radius: 12px; width: 90%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.modal-sm { max-width: 420px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 36px 20px 16px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-secondary); padding: 0 4px; }
.modal-body { padding: 16px 20px; }
.modal-footer { display: flex; justify-content: center; gap: 12px; padding: 16px 20px 39px; border-top: 1px solid var(--border); }

/* ====== 完整建档弹窗（ML风格） ====== */
.adr-block { background: var(--bg-input, #f1f5f9); padding: 12px 14px; border-radius: 8px; margin-bottom: 10px; }
.adr-block-title { font-size: 13px; color: var(--primary, #2196f3); font-weight: 600; margin-bottom: 10px; }
/* 基本信息行 */
.adr-row { display: flex; align-items: center; margin-bottom: 8px; gap: 0; }
.adr-row:last-child { margin-bottom: 0; }
.adr-label { width: 30px; min-width: 30px; font-size: 12px; color: #888; flex-shrink: 0; }
.adr-label .req { color: var(--danger, #e74c3c); }
.adr-input, .adr-sel { flex: 1; min-width: 0; padding: 7px 8px; border: none; border-radius: 6px; font-size: 13px; background: #fff; color: var(--text-primary, #333); }
.dark .adr-input, .dark .adr-sel { background: var(--bg-card); }
.adr-input[readonly] { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.dark .adr-input[readonly] { background: #2a2a2a; color: #777; }
.adr-input:focus, .adr-sel:focus { outline: none; box-shadow: 0 0 0 2px var(--primary-light, rgba(33,150,243,.2)); }
.adr-label-r { width: 30px; min-width: 30px; font-size: 12px; color: #888; flex-shrink: 0; margin-left: 4px; }
.adr-date { min-width: 110px; }
/* 表格 */
.adult-section-toggle { font-size: 13px; font-weight: 600; color: var(--primary, #2196f3); cursor: pointer; user-select: none; padding: 6px 0; display: inline-flex; align-items: center; gap: 3px; }
.adult-section-toggle:hover { opacity: 0.8; }
.adult-section-body { padding: 4px 0; }
.adult-rx-table-wrap { overflow-x: auto; }
.adult-rx-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.adult-rx-table thead th { padding: 6px 4px; font-size: 11px; color: var(--text-muted, #888); font-weight: 500; text-align: center; border-bottom: 2px solid var(--primary, #2196f3); background: transparent; }
.adult-rx-table tbody td { padding: 4px 3px; text-align: center; border-bottom: 1px solid var(--border, #e2e8f0); }
.adult-rx-table tbody tr:last-child td { border-bottom: none; }
.ath-label, .atd-label { width: 30px; min-width: 30px; max-width: 30px; font-weight: 600; font-size: 12px; color: var(--text-primary, #333); }
.ath-add, .atd-add { display: none; }
.adult-rx-sel { width: 100%; padding: 5px 2px; border: 1px solid var(--border, #e2e8f0); border-radius: 4px; font-size: 12px; background: var(--bg-card, #fff); color: var(--text-primary, #333); text-align: center; box-sizing: border-box; }
.adult-rx-sel:focus { outline: none; border-color: var(--primary, #2196f3); }
.adr-pre-row { display: flex; gap: 2px; align-items: center; }
.adr-pre-row select { flex: 1; min-width: 0; padding: 5px 1px; border: 1px solid var(--border, #e2e8f0); border-radius: 4px; font-size: 11px; background: var(--bg-card, #fff); color: var(--text-primary, #333); text-align: center; }
.adr-pre-row select:focus { outline: none; border-color: var(--primary, #2196f3); }
.adr-axis-inp { width: 40px; flex: none !important; padding: 5px 1px; border: 1px solid var(--border, #e2e8f0); border-radius: 4px; font-size: 11px; background: var(--bg-card, #fff); color: var(--text-primary, #333); text-align: center; }
.adr-axis-inp:focus { outline: none; border-color: var(--primary, #2196f3); }
.btn-xs { padding: 1px 8px; font-size: 10px; border-radius: 10px; }
.adr-img-upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#adr-img-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border, #e2e8f0); cursor: pointer; }
.adr-img-thumb { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.adr-img-thumb img { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border, #e2e8f0); cursor: pointer; }
.adr-img-thumb .thumb-del { position: absolute; top: -6px; right: -6px; background: #e74c3c; color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 20px; text-align: center; padding: 0; }
.adr-remark { width: 100%; min-height: 60px; padding: 10px; border: none; border-radius: 6px; font-size: 13px; resize: vertical; background: #fff; color: var(--text-primary, #333); }
.dark .adr-remark { background: var(--bg-card); }
.adr-remark:focus { outline: none; box-shadow: 0 0 0 2px var(--primary-light, rgba(33,150,243,.2)); }
.modal-body { padding: 14px 18px; background: var(--bg-card, #fff); }

.cs-new-btn {
  display: block; width: 100%; padding: 8px; border: 1px dashed var(--border);
  background: var(--bg-card); color: var(--text-secondary); border-radius: 6px;
  font-size: 13px; cursor: pointer; margin-top: 10px;
}
.cs-new-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ─── 建档弹窗：视力/度数选择单元格 ─────────── */
#adult-rx-modal .rx-vision-cel {
  cursor: pointer; min-height: 28px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border, #e2e8f0); border-radius: 4px;
  background: var(--bg-card, #fff); padding: 4px; font-size: 12px;
  color: var(--text-primary, #333); transition: border-color .2s;
}
#adult-rx-modal .rx-vision-cel:hover { border-color: var(--primary, #06b6d4); }
.rx-vis-val { font-weight: 600; }
.rx-hidden-sel { display: none; }

/* ─── ADD 开关按钮 ──────────────────── */
#adult-rx-modal .rx-add-toggle {
  display: inline-block; padding: 2px 10px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 12px;
  background: var(--bg-card, #fff); color: var(--text-muted, #888);
  font-size: 11px; cursor: pointer; vertical-align: middle; transition: all .2s;
}
#adult-rx-modal .rx-add-toggle.active { background: var(--primary, #06b6d4); color: #fff; border-color: var(--primary, #06b6d4); }



/* ─── 戴镜数据折叠块 ──────────────────── */
.adr-collapse-block { overflow: hidden; }
.adr-collapse-block > .adult-rx-table-wrap { display: none; }
.adr-collapse-block:not(.collapsed) > .adult-rx-table-wrap { display: block; }
.adr-block-title-clickable {
  cursor: pointer; user-select: none; display: flex; align-items: center;
  font-size: 13px; color: var(--primary, #06b6d4); font-weight: 600; margin-bottom: 10px;
}
.adr-block-title-clickable::before {
  content: '▸'; font-size: 10px; margin-right: 4px; transition: transform .3s;
}
.adr-block-title-clickable.expanded::before { content: '▾'; }

/* ─── 度数选择弹窗 ──────────────────── */
.adr-popup-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,.45); z-index: 4000; justify-content: center; align-items: center;
}
.adr-popup-overlay.active { display: flex; }
.adr-popup-card {
  background: var(--bg-card, #fff); border-radius: 12px; padding: 16px 20px;
  width: 94%; max-width: 460px; box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.adr-popup-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary, #333);
  text-align: center; margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.adr-popup-body { display: flex; flex-direction: column; gap: 10px; }
.vp-row { display: flex; align-items: center; gap: 10px; }
.vp-label { width: 32px; font-size: 12px; color: var(--text-muted, #888); flex-shrink: 0; }
.vp-sel {
  flex: 1; background: var(--bg-input, #f8fafc); border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px; padding: 8px; font-size: 14px; color: var(--text-primary, #333);
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.vp-sign-group { display: flex; gap: 6px; flex: 1; }
.vp-sign-btn {
  flex: 1; padding: 8px 0; border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px; background: var(--bg-card, #fff); color: var(--text-primary, #333);
  font-size: 13px; cursor: pointer; text-align: center; transition: all .15s;
}
.vp-sign-btn:hover { background: var(--bg-input, #f8fafc); }
.vp-sign-btn.sel { background: var(--primary, #06b6d4); color: #fff; border-color: var(--primary, #06b6d4); }
.adr-popup-foot { display: flex; gap: 8px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border, #e2e8f0); }
.vp-btn-clear {
  flex: 1; padding: 8px; border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px; background: var(--bg-card, #fff); color: var(--text-muted, #888);
  font-size: 13px; cursor: pointer;
}
.vp-btn-ok {
  flex: 2; padding: 8px; border: none; border-radius: 6px;
  background: var(--primary, #06b6d4); color: #fff;
  font-size: 13px; cursor: pointer; font-weight: 600;
}
.vp-btn-ok:disabled { background: #ccc; color: #999; cursor: not-allowed; }

/* ─── 度数弹窗轴位输入 ──────────────────── */
#adult-rx-modal .rx-inp, .adr-popup-card .rx-inp { width: 100%; box-sizing: border-box; background: var(--bg-input, #f8fafc); border: 1px solid var(--border, #e2e8f0); border-radius: 6px; color: var(--text-primary, #333); padding: 8px; font-size: 14px; }

/* ─── 手机端适配 ──────────────────── */
@media (max-width: 768px) {
  #adult-rx-modal .rx-vision-cel { font-size: 11px; min-height: 24px; padding: 3px 1px; }
  .adr-popup-card { min-width: 220px; max-width: 280px; padding: 12px 14px; }
  .adult-rx-sel { padding: 3px 1px; font-size: 11px; }
  #adult-rx-modal .modal-box { width: 94%; max-width: none; }
}

/* ====== 手机端按钮修复（文件末尾，最高优先级） ====== */
@media screen and (max-width: 768px) {
  .order-card-actions .btn {
    padding: 7px 10px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    min-height: 0 !important;
    height: auto !important;
  }
}

/* ── 搜索SKU高亮 ── */
.sku-match-highlight {
  outline: 3px solid #f59e0b;
  outline-offset: -3px;
  border-radius: 12px;
  background: #fffbeb;
}

/* ====== 打印面板 ====== */
.print-modal-content {
  max-width: 700px !important;
  max-height: 90vh !important;
  display: flex;
  flex-direction: column;
}
.print-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
/* 工具栏 */
.print-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.print-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.print-toolbar-group label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.print-toolbar-group select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  min-width: 60px;
}
/* 编辑区 */
.print-editor {
  width: 100%;
  min-height: 120px;
  max-height: 200px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: monospace;
  resize: vertical;
  background: var(--bg-input);
  color: var(--text-primary);
  box-sizing: border-box;
  margin-bottom: 12px;
}
.print-editor:focus {
  outline: none;
  border-color: var(--primary);
}
/* 预览区 */
.print-preview-wrap {
  margin-bottom: 16px;
}
.print-preview-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.print-paper {
  width: 80mm;
  max-width: 100%;
  min-height: 40px;
  padding: 8mm 4mm;
  background: #fff;
  border: 1px dashed #ccc;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #000;
  font-family: "Microsoft YaHei", "SimHei", sans-serif;
  box-sizing: border-box;
}
/* 历史记录 */
.print-history-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.print-history-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}
.print-history-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: normal;
}
.print-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.print-history-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12px;
  line-height: 1.4;
}
.print-history-item:hover {
  background: var(--bg-hover);
}
.print-history-item-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}
.print-history-item-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.print-history-del {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
}
.print-history-del:hover {
  background: var(--danger-bg);
  color: var(--danger);
}
.print-history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px 0;
}
