/* ============================================
   山海车服 · 宝马专修 · 报价系统 v4
   Design: Apple-inspired · 克制 · 精致 · 流畅
   Designer-grade SaaS Management System
   ============================================ */

:root {
  /* Brand - 深海碧玉 */
  --brand-deep: #061220;
  --brand-navy: #0b1a33;
  --brand-teal: #0d9488;
  --brand-teal-light: #14b8a6;
  --brand-teal-muted: #ccfbf1;
  --brand-gold: #b8943c;
  --brand-gold-light: #fef3c7;
  --brand-amber: #d97706;

  /* Surfaces - Apple 风格色阶 */
  --bg-root: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --bg-sidebar: #080f1c;
  --bg-sidebar-top: #060d18;
  --bg-sidebar-hover: rgba(255,255,255,.06);
  --bg-sidebar-active: rgba(13,148,136,.15);
  --bg-input: #f9fafb;
  --bg-input-focus: #ffffff;
  --bg-table-header: #f8fafb;
  --bg-table-stripe: #fbfcfd;
  --bg-table-hover: #f0fdf9;
  --bg-modal-overlay: rgba(6,18,32,.55);
  --bg-tooltip: #1e293b;

  /* Borders */
  --border-subtle: #eef0f2;
  --border-input: #e2e5e9;
  --border-card: #eaecf0;
  --border-focus: #0d9488;
  --border-focus-ring: rgba(13,148,136,.15);

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #64748b;
  --text-quaternary: #94a3b8;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #5eead4;
  --text-sidebar-dim: #5a6d86;
  --text-sidebar-muted: #3b4f6b;
  --text-inverse: #f8fafc;

  /* Feedback */
  --green: #10b981;
  --green-light: #d1fae5;
  --green-bg: #ecfdf5;
  --green-dark: #059669;
  --red: #ef4444;
  --red-light: #fee2e2;
  --red-bg: #fef2f2;
  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --amber-bg: #fffbeb;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --blue-bg: #eff6ff;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;

  /* Radii */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Shadows - Apple 风格多层次阴影 */
  --s-none: 0 0 0 0 transparent;
  --s-xs: 0 1px 2px rgba(0,0,0,.04);
  --s-sm: 0 1px 3px rgba(0,0,0,.04), 0 2px 12px rgba(0,0,0,.03);
  --s-md: 0 2px 8px rgba(0,0,0,.04), 0 4px 20px rgba(0,0,0,.04);
  --s-lg: 0 4px 16px rgba(0,0,0,.05), 0 8px 40px rgba(0,0,0,.04);
  --s-xl: 0 8px 32px rgba(0,0,0,.06), 0 16px 64px rgba(0,0,0,.05);
  --s-2xl: 0 16px 48px rgba(0,0,0,.08), 0 24px 80px rgba(0,0,0,.05);
  --s-card: 0 1px 3px rgba(0,0,0,.03), 0 4px 16px rgba(0,0,0,.04);
  --s-card-hover: 0 2px 8px rgba(0,0,0,.04), 0 8px 32px rgba(0,0,0,.06);

  /* Transitions - Apple 风格缓动 */
  --t-fast: .15s cubic-bezier(.25,.1,.25,1);
  --t-base: .2s cubic-bezier(.25,.1,.25,1);
  --t-slow: .3s cubic-bezier(.25,.1,.25,1);
  --t-spring: .4s cubic-bezier(.175,.885,.32,1.275);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg-root);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -.01em;
  overflow-x: hidden;
}

/* Apple-style scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

::selection { background: var(--brand-teal-muted); color: var(--brand-teal); }

.page { display: none; }
.page.active { display: flex; }

/* ============================================
   LOGIN PAGE — 深海渐变 + 磨砂玻璃
   ============================================ */
#loginPage {
  justify-content: center; align-items: center; min-height: 100vh;
  background: linear-gradient(165deg, #040b16 0%, #081420 25%, #0b1a2f 50%, #0c253e 75%, #0a1e30 100%);
  position: relative; overflow: hidden;
}
#loginPage::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(20,184,166,.07) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 75% 30%, rgba(184,148,60,.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 35% at 50% 70%, rgba(59,130,246,.04) 0%, transparent 50%);
  animation: loginGlow 8s ease-in-out infinite alternate;
}
@keyframes loginGlow {
  0% { opacity: .8; }
  100% { opacity: 1; }
}
.login-container {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(60px) saturate(1.4);
  -webkit-backdrop-filter: blur(60px) saturate(1.4);
  border-radius: var(--r-xl);
  padding: 56px 52px;
  width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.1);
  text-align: center;
  position: relative;
  z-index: 1;
  animation: loginIn .5s cubic-bezier(.22,.61,.36,1);
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo { max-width: 200px; margin-bottom: 8px; filter: drop-shadow(0 4px 12px rgba(0,0,0,.08)); }
.login-subtitle {
  font-size: 13px; color: var(--text-tertiary); margin-bottom: 40px;
  letter-spacing: 3.5px; font-weight: 500;
}
.login-form .form-group { margin-bottom: 22px; text-align: left; }
.login-form label {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  letter-spacing: .8px; margin-bottom: 8px; display: block; text-transform: uppercase;
}
.login-form input {
  width: 100%; padding: 15px 16px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-sm);
  font-size: 15px; font-weight: 450;
  transition: all var(--t-base);
  background: var(--bg-input);
  color: var(--text-primary);
}
.login-form input:focus {
  outline: none; border-color: var(--brand-teal);
  box-shadow: 0 0 0 4px var(--border-focus-ring); background: #fff;
}
.login-form .btn {
  width: 100%; padding: 15px; font-size: 15px; font-weight: 600;
  letter-spacing: .8px; margin-top: 8px;
  border-radius: var(--r-sm);
}
.login-hint {
  text-align: center; margin-top: 24px;
  color: var(--text-quaternary); font-size: 11px;
}

/* ============================================
   LAYOUT
   ============================================ */
#mainPage { flex-direction: row; min-height: 100vh; }

/* ---- Sidebar · 深海暗色 ---- */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #060d18 0%, #0a1525 40%, #0e1a30 100%);
  color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,.04);
  box-shadow: 2px 0 24px rgba(0,0,0,.2);
}
.sidebar-header {
  padding: 30px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: center;
}
.sidebar-logo {
  max-width: 145px; display: block; margin: 0 auto;
  filter: brightness(1.1) contrast(1.05) drop-shadow(0 2px 8px rgba(0,0,0,.3));
  transition: transform var(--t-slow);
}
.sidebar-logo:hover { transform: scale(1.03); }
.sidebar-header p {
  font-size: 10px; color: var(--text-sidebar-muted);
  margin-top: 14px; letter-spacing: 1.2px; font-weight: 500;
}

.nav-menu {
  list-style: none; flex: 1; padding: 10px 0; overflow-y: auto;
}
/* Collapsible section header */
.nav-section-header {
  padding: 16px 20px 6px;
  color: var(--text-sidebar-dim);
  font-size: 10.5px; letter-spacing: 2px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  user-select: none;
  transition: all var(--t-fast);
  text-transform: uppercase;
}
.nav-section-header:hover { color: #bcc8da; }
.nav-section-chevron {
  font-size: 10px; transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  display: inline-block; opacity: .6;
}
.nav-section-header:not(.collapsed) .nav-section-chevron {
  transform: rotate(90deg); opacity: .9;
}
.nav-section-header.collapsed .nav-section-chevron {
  transform: rotate(0deg); opacity: .6;
}

/* Collapsible children */
.nav-children {
  display: block !important;
  list-style: none;
  padding: 0 !important;
  margin: 0 !important;
  max-height: 600px;
  overflow: hidden;
  opacity: 1;
  transition: max-height .35s cubic-bezier(.4,0,.2,1), opacity .2s ease, margin .35s ease;
}
.nav-children.collapsed {
  display: none !important;
}

.nav-children {
  display: block;
  overflow: hidden;
  transition: all 0.3s ease;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; margin: 1px 10px;
  border-radius: var(--r-xs);
  color: var(--text-sidebar);
  text-decoration: none;
  transition: all var(--t-fast);
  font-size: 13.5px; font-weight: 450;
  cursor: pointer;
  position: relative;
  letter-spacing: .1px;
}
.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #d4dce8;
  transform: translateX(2px);
}
.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-teal-light);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--text-sidebar-active);
  display: none;
}

.nav-group-label {
  padding: 10px 22px 4px;
  color: var(--text-sidebar-muted);
  font-size: 10.5px; letter-spacing: 1px;
  font-weight: 700; text-transform: uppercase;
}
.nav-sub {
  padding-left: 40px !important;
  padding-top: 7px !important; padding-bottom: 7px !important;
  font-size: 12.5px !important;
  opacity: .8;
}
.nav-sub:hover { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ---- Content ---- */
.content {
  flex: 1; margin-left: 240px; padding: 0;
  min-height: 100vh; background: var(--bg-root);
}

.content-page {
  display: none; width: 100%;
  padding: 40px 48px 72px; max-width: 1400px;
  animation: pageIn .35s cubic-bezier(.22,.61,.36,1);
}
.content-page.active { display: block; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   PAGE HEADERS
   ============================================ */
.content-page > h2 {
  font-size: 28px; font-weight: 750; color: var(--text-primary);
  margin: 0 0 10px 0; line-height: 1.15; letter-spacing: -.5px;
}
.content-page > h2 + * { margin-top: 20px; }

/* === Page Title Bar === */
.page-title-bar {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 28px; padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.page-title-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-teal-muted), #e0f2fe);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.page-title-text h2 {
  font-size: 26px; font-weight: 750; color: var(--text-primary);
  margin: 0; line-height: 1.15;
}
.page-title-text p {
  font-size: 13px; color: var(--text-tertiary); margin: 3px 0 0;
}
.page-back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; margin-right: 10px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  background: var(--bg-tertiary); border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm); cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
  flex-shrink: 0;
}
.page-back-btn:hover {
  color: var(--text-primary); background: var(--bg-secondary);
  border-color: var(--border-default);
}
.page-back-btn svg { flex-shrink: 0; }
@media print { .page-back-btn { display: none !important; } }

/* ============================================
   STATS CARDS · 精装数据卡片
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  box-shadow: var(--s-card);
  display: flex; align-items: center; gap: 18px;
  transition: all var(--t-base);
  border: 1px solid var(--border-subtle);
  cursor: default;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-teal), var(--brand-teal-light));
  opacity: 0;
  transition: opacity var(--t-base);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--s-card-hover);
  border-color: var(--border-card);
}
.stat-card:hover::before { opacity: 1; }
.stat-icon {
  width: 50px; height: 50px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-size: 28px; font-weight: 750; color: var(--text-primary);
  letter-spacing: -.5px; line-height: 1.1;
}
.stat-label {
  font-size: 12.5px; color: var(--text-tertiary);
  font-weight: 500; margin-top: 4px;
}

/* ---- Quick Actions ---- */
.quick-actions {
  display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap;
}
.quick-actions .btn { padding: 10px 24px; font-size: 13.5px; }

/* ============================================
   TOOLBAR / FILTER BAR
   ============================================ */
.toolbar, .filter-bar {
  display: flex; gap: 12px; margin-bottom: 20px; align-items: center;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-xs);
}
.search-input {
  padding: 10px 16px; border: 1.5px solid var(--border-input);
  border-radius: var(--r-sm); font-size: 13.5px; min-width: 220px;
  transition: all var(--t-fast); background: var(--bg-input);
  color: var(--text-primary);
}
.search-input::placeholder { color: var(--text-quaternary); }
.search-input:focus {
  outline: none; border-color: var(--brand-teal);
  box-shadow: 0 0 0 4px var(--border-focus-ring); background: #fff;
}
.filter-bar select, .filter-bar input {
  padding: 10px 16px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-sm);
  font-size: 13.5px; transition: var(--t-fast);
  background: var(--bg-input);
}
.filter-bar select:focus, .filter-bar input:focus {
  outline: none; border-color: var(--brand-teal);
  box-shadow: 0 0 0 4px var(--border-focus-ring);
}

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; margin-bottom: 7px;
  font-weight: 600; color: var(--text-secondary);
  font-size: 12.5px; letter-spacing: .2px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 430;
  transition: all var(--t-fast);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
}
.form-group input::placeholder { color: #bcc1c8; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--brand-teal);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 4px var(--border-focus-ring);
}
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.form-row { display: flex; gap: 18px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 24px; }

.quote-header-form {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-card);
}
.quote-section {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-card);
  margin-top: 20px;
}
.quote-section h3 {
  font-size: 17px; font-weight: 650; color: var(--text-primary);
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.quote-section h3 .btn { font-size: 12.5px; }

/* ============================================
   BUTTONS · Apple 风格按压反馈
   ============================================ */
.btn {
  padding: 10px 22px; border: none; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13.5px; font-weight: 580;
  transition: all var(--t-fast);
  display: inline-flex; align-items: center; gap: 7px;
  letter-spacing: .1px; white-space: nowrap;
  user-select: none;
  position: relative;
}
.btn:active { transform: scale(.965); }

.btn-primary {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #fff;
  box-shadow: 0 1px 4px rgba(13,148,136,.3), 0 4px 16px rgba(13,148,136,.15);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0f766e, #115e59);
  box-shadow: 0 2px 8px rgba(13,148,136,.35), 0 6px 24px rgba(13,148,136,.2);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 1px 4px rgba(16,185,129,.25), 0 4px 16px rgba(16,185,129,.1);
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 1px 4px rgba(245,158,11,.25), 0 4px 16px rgba(245,158,11,.1);
}
.btn-warning:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 1px 4px rgba(239,68,68,.2), 0 4px 16px rgba(239,68,68,.08);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
}

.btn-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 1px 4px rgba(59,130,246,.25);
}
.btn-info:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

.btn-outline {
  background: #fff; color: var(--text-secondary);
  border: 1.5px solid var(--border-input);
  font-weight: 500;
}
.btn-outline:hover {
  background: #f8fafc; border-color: var(--brand-teal);
  color: var(--brand-teal);
}

.btn-ghost {
  background: transparent; color: var(--text-tertiary);
}
.btn-ghost:hover { background: #f1f5f9; color: var(--text-primary); }

.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 18px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-xs { padding: 5px 14px; font-size: 11px; border-radius: 7px; font-weight: 600; }

/* ============================================
   TABLES · 精致数据表格
   ============================================ */
.data-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-xs);
}
.data-table thead th {
  background: var(--bg-table-header);
  padding: 14px 18px; text-align: left;
  font-weight: 650; color: var(--text-tertiary);
  font-size: 11.5px; letter-spacing: .4px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 0 var(--border-subtle);
}
.data-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13.5px; color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-table-hover); }
.data-table tbody tr:nth-child(even) { background: var(--bg-table-stripe); }
.data-table tbody tr:nth-child(even):hover { background: var(--bg-table-hover); }

.table-scroll {
  overflow-x: auto; overflow-y: auto; max-height: 70vh;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-xs);
  background: var(--bg-card);
}

/* ---- Quote Table ---- */
.quote-table {
  font-size: 12px;
  border-radius: var(--r-lg);
}
.quote-table thead th {
  font-size: 10.5px; padding: 10px 6px; text-align: center;
  letter-spacing: .3px; font-weight: 650;
}
.quote-table tbody td { padding: 8px 5px; text-align: center; }

.col-active {
  background: #ecfdf5 !important;
  border-left: 3px solid var(--brand-teal);
}
.col-active .col-price { color: #0d9488; font-weight: 700; }
.col-dim {
  background: #fffbeb !important;
  border-left: 3px solid #f59e0b;
  opacity: 1;
}
.col-label {
  font-size: 9px; color: var(--text-quaternary);
  font-weight: 600; letter-spacing: .3px;
}
.col-price { font-weight: 700; font-size: 13px; }
.td-seq { font-weight: 700; color: var(--brand-teal); }
.td-total { font-weight: 700; font-size: 13.5px; color: var(--text-primary); }

.input-cell {
  width: 100%; padding: 7px 10px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-xs); font-size: 12px;
  text-align: center; transition: all var(--t-fast);
  background: var(--bg-input);
  font-weight: 430;
}
.input-cell:focus {
  outline: none; border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px var(--border-focus-ring);
  background: #fff;
}
.input-sm { font-size: 10px; width: 80px; }
.select-cell {
  padding: 6px 8px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-xs); font-size: 11.5px;
  background: var(--bg-input);
}

.text-pending { color: var(--amber); font-weight: 600; }
.text-muted { color: var(--text-quaternary); }
.lowest-info { font-size: 10px; color: var(--green); font-weight: 700; }

.confirm-table thead th { font-size: 11.5px; }
.confirm-table tbody td { font-size: 12.5px; }

/* ============================================
   QUOTE CARDS (Supplier)
   ============================================ */
.quote-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 22px 28px; margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px; transition: all var(--t-base);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-xs);
}
.quote-card:hover {
  box-shadow: var(--s-md);
  border-color: rgba(13,148,136,.12);
  transform: translateY(-2px);
}
.quote-info h4 { font-size: 15.5px; color: var(--text-primary); margin-bottom: 4px; font-weight: 650; }
.quote-info p { color: var(--text-tertiary); font-size: 12.5px; margin: 2px 0; }

/* ============================================
   MODALS · 磨砂玻璃质感
   ============================================ */
.modal {
  position: fixed; inset: 0;
  background: var(--bg-modal-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000;
}
.modal-content {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  padding: 36px 40px;
  width: 600px; max-height: 82vh; overflow-y: auto;
  box-shadow: var(--s-2xl);
  animation: modalIn .3s cubic-bezier(.22,.61,.36,1);
  border: 1px solid var(--border-subtle);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.94) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-sm { width: 460px; }
.modal-content h3 {
  font-size: 19px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 24px;
}
.modal-actions {
  margin-top: 28px; display: flex; gap: 14px; justify-content: flex-end;
}

/* Search Results Dropdown */
.search-result-item {
  cursor: pointer; padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px; transition: all var(--t-fast);
  display: flex; justify-content: space-between; align-items: center;
}
.search-result-item:hover { background: #f0fdfa; }
.search-result-item:last-child { border-bottom: none; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-block; padding: 4px 12px;
  border-radius: var(--r-full); font-size: 11px; font-weight: 600;
  letter-spacing: .2px;
}
.badge-pending { background: var(--amber-bg); color: #92400e; }
.badge-responded { background: var(--green-bg); color: #065f46; }
.badge-draft { background: #f3f4f6; color: var(--text-tertiary); }
.badge-confirmed { background: var(--blue-bg); color: #1e40af; }

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed; top: 28px; right: 28px;
  padding: 16px 28px; border-radius: var(--r-md);
  color: #fff; font-size: 13.5px; font-weight: 600;
  z-index: 2000; opacity: 0;
  transform: translateY(-16px);
  transition: all var(--t-slow);
  pointer-events: none;
  box-shadow: var(--s-lg);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: linear-gradient(135deg, #10b981, #059669); }
.toast.error { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast.info { background: linear-gradient(135deg, #3b82f6, #2563eb); }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex; gap: 8px; justify-content: center; margin-top: 24px;
}
.pagination button {
  padding: 8px 16px;
  border: 1.5px solid var(--border-input);
  background: #fff; border-radius: var(--r-xs);
  cursor: pointer; font-size: 13.5px; font-weight: 500;
  transition: all var(--t-fast);
  color: var(--text-secondary);
}
.pagination button:hover {
  background: #f0fdfa; border-color: var(--brand-teal);
  color: var(--brand-teal);
}
.pagination button.active {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #fff; border-color: var(--brand-teal);
  font-weight: 600;
}

/* ============================================
   QUOTE LOOKUP DROPDOWN
   ============================================ */
.quote-lookup-drop {
  position: absolute; top: 100%; left: 0; z-index: 50;
  background: #fff; border: 1px solid var(--border-input);
  border-radius: var(--r-sm);
  box-shadow: var(--s-lg);
  min-width: 280px; max-height: 260px; overflow-y: auto;
  margin-top: 2px;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  @page { size: A4; margin: 10mm; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body > *:not(#printOverlay) { display: none !important; }
  #printOverlay { 
    display: block !important; position: static !important; 
    width: 100% !important; height: auto !important;
    padding: 0 !important; overflow: visible !important;
    background: #fff !important;
  }
  #printOverlay button { display: none !important; }
  #printOverlay table { font-size: 10px !important; }
  #printOverlay th, #printOverlay td { padding: 3px 2px !important; }

  .sidebar, .btn, .toolbar, .nav-menu, .sidebar-footer,
  .modal, .toast, .stats-grid, .quick-actions, .pagination,
  #addItemModal, #sqModal, #partFormModal, #laborFormModal, #userFormModal,
  #logoutBtn, .sidebar-header, .sidebar-footer, .filter-bar,
  .page-title-bar { display: none !important; }
  .content { margin-left: 0 !important; width: 100% !important; }
  .content-page { padding: 0 !important; display: block !important; }
  .content-page:not(.active) { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 11px !important; line-height: 1.4 !important; }
  .data-table, .quote-section, .quote-header-form {
    box-shadow: none !important; border: 1px solid #ccc !important;
  }
  .data-table thead th { background: #f5f5f5 !important; border-bottom: 1px solid #999 !important; color: #000 !important; }
  .data-table tbody td { border-bottom: 1px solid #ddd !important; }
  .data-table tbody tr:hover { background: transparent !important; }
  .data-table tbody tr:nth-child(even) { background: transparent !important; }
  .col-active { background: #ecfdf5 !important; border-left: 0 !important; }
  .col-dim { opacity: 1 !important; background: #fffbeb !important; border-left: 0 !important; }
  .input-cell, .select-cell { border: none !important; background: transparent !important; padding: 2px !important; }
  .quote-table thead th, .quote-table tbody td { padding: 4px 6px !important; font-size: 10px !important; }
  h2 { font-size: 16px !important; margin-bottom: 10px !important; }
  h3 { font-size: 13px !important; }
  .td-total { font-size: 12px !important; }
  .col-price { font-size: 11px !important; }
  .td-action, .td-select button, .td-select .badge { display: none !important; }
  .data-table, .quote-section { page-break-inside: avoid; }
  tr { page-break-inside: avoid; }
}

/* ============================================
   MISC
   ============================================ */
.hidden { display: none !important; }
.full-width { grid-column: 1 / -1; }

#addItemSearchResults {
  max-height: 240px; overflow-y: auto;
  border: 1px solid var(--border-input);
  border-radius: var(--r-sm); background: #fff;
  box-shadow: var(--s-lg);
}

.quote-card-form {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-xs);
}

.modal-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: none; font-size: 22px;
  cursor: pointer; color: var(--text-quaternary);
  transition: color var(--t-fast);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
}
.modal-close:hover { color: var(--text-primary); background: #f1f5f9; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
  .content-page { padding: 32px 32px 56px; }
}
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-page { padding: 28px 24px 48px; }
}
@media (max-width: 768px) {
  .sidebar { width: 210px; }
  .content { margin-left: 210px; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .content-page { padding: 24px 20px 40px; }
  .content-page > h2 { font-size: 24px; }
}

/* ============================================
   BIZ DASHBOARD · Apple Design System v2
   ============================================ */

.biz-dash-root { padding: 36px 48px 72px !important; max-width: 100% !important; }

/* --- Header --- */
.biz-dash-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 36px; padding-bottom: 28px;
  border-bottom: 1px solid var(--border-subtle);
}
.biz-dash-title {
  font-size: 32px; font-weight: 800; color: var(--text-primary);
  letter-spacing: -.7px; margin: 0; line-height: 1.1;
}
.biz-dash-title .biz-dash-dot {
  color: var(--brand-teal); margin: 0 6px; font-weight: 400;
}
.biz-dash-sub {
  font-size: 13.5px; color: var(--text-quaternary); margin: 6px 0 0; font-weight: 450;
}
.biz-dash-meta { display: flex; align-items: center; gap: 20px; }
.biz-dash-time { font-size: 12.5px; color: var(--text-quaternary); font-weight: 500; }

/* --- KPI Row --- */
.biz-kpi-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 1fr 1fr 1fr;
  gap: 18px; margin-bottom: 36px;
}

.biz-kpi-apple {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-card);
  display: flex; flex-direction: column;
  gap: 8px;
  transition: all var(--t-base);
  position: relative; overflow: hidden;
}
.biz-kpi-apple::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent, var(--brand-teal)), var(--brand-teal-light));
  border-radius: 0 0 2px 2px;
  transform: scaleX(0); transform-origin: left;
  transition: transform .45s ease;
}
.biz-kpi-apple:hover {
  box-shadow: var(--s-card-hover);
  transform: translateY(-3px);
}
.biz-kpi-apple:hover::after { transform: scaleX(1); }

.biz-kpi-apple-label {
  font-size: 11.5px; font-weight: 650; color: var(--text-quaternary);
  text-transform: uppercase; letter-spacing: .9px;
}
.biz-kpi-apple-value {
  font-size: 30px; font-weight: 800; color: var(--text-primary);
  letter-spacing: -.5px; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis;
}
.biz-kpi-apple-trend {
  font-size: 11.5px; font-weight: 650; color: var(--accent, var(--brand-teal));
  background: var(--bg, #f0fdfa);
  padding: 3px 10px; border-radius: var(--r-full); align-self: flex-start;
  letter-spacing: .1px;
}

/* --- Panel --- */
.biz-panel {
  background: var(--bg-card); border-radius: var(--r-lg);
  padding: 28px 32px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--s-card);
  transition: box-shadow var(--t-base);
}
.biz-panel:hover { box-shadow: var(--s-md); }
.biz-panel-hd {
  display: flex; align-items: center; gap: 12px;
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 1px solid #f3f4f6;
  letter-spacing: -.2px;
}
.biz-panel-hd small { font-size: 11.5px; color: var(--text-quaternary); font-weight: 450; margin-left: auto; }
.biz-panel-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .8px;
  background: #f3f4f6; color: var(--text-tertiary);
  padding: 4px 10px; border-radius: var(--r-xs);
  text-transform: uppercase;
}

/* Dual chart */
.biz-dual-chart { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.biz-chart-area { padding: 6px 0; }

/* Triple grid */
.biz-triple-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; margin-bottom: 28px; }

/* Bottom grid */
.biz-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.biz-panel-alert { border-left: 4px solid var(--red); }

/* --- Apple Bar Chart --- */
.bar-apple-row {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 0;
  transition: all var(--t-fast);
  border-radius: var(--r-xs);
}
.bar-apple-row:hover { background: var(--bg-table-hover); padding-left: 8px; padding-right: 8px; }

.bar-apple-rank {
  width: 28px; text-align: center; font-size: 13.5px;
  font-weight: 650; color: var(--text-quaternary); flex-shrink: 0;
}
.bar-apple-rank.top { color: var(--brand-teal); font-size: 14.5px; font-weight: 700; }

.bar-apple-name {
  width: 110px; flex-shrink: 0; font-size: 13px;
  font-weight: 600; color: var(--text-primary); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; line-height: 1.3;
}
.bar-apple-name i {
  display: block; font-style: normal; font-size: 10.5px;
  color: var(--text-quaternary); font-weight: 450;
}

.bar-apple-track {
  flex: 1; height: 24px; background: #f3f4f6;
  border-radius: var(--r-full); overflow: hidden; min-width: 40px;
}
.bar-apple-fill {
  height: 100%; border-radius: var(--r-full); min-width: 4px;
  transition: width .9s cubic-bezier(.22,1,.36,1);
  animation: barSlide .9s ease;
  position: relative;
}
.bar-apple-fill::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0;
  width: 24px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25));
}
@keyframes barSlide { from { width: 0 !important; } }

.bar-apple-val {
  width: 90px; text-align: right; flex-shrink: 0;
  font-size: 13.5px; font-weight: 700; color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.bar-apple-extra {
  width: 52px; text-align: right; flex-shrink: 0;
  font-size: 11.5px; font-weight: 600; color: var(--text-tertiary);
}
.bar-apple-orders {
  width: 52px; text-align: right; flex-shrink: 0;
  font-size: 11.5px; font-weight: 600; color: #0d9488;
}

.biz-empty { text-align:center; color:var(--text-quaternary); padding:32px; font-size:13.5px; }

/* --- Mini tables --- */
.biz-mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.biz-mini-table th {
  font-size: 10.5px; font-weight: 650; color: var(--text-quaternary);
  padding: 8px 12px; border-bottom: 1px solid #f3f4f6;
  text-transform: uppercase; letter-spacing: .4px;
}
.biz-mini-table th.r, .biz-mini-table td.r { text-align: right; }
.biz-mini-table td {
  padding: 9px 12px; border-bottom: 1px solid #f9fafb;
  color: var(--text-secondary); white-space: nowrap;
}
.biz-mini-table tr:hover td { background: var(--bg-table-hover); }
.biz-tr-group td { background: #f9fafb; }
.biz-mini-table cite {
  display: inline; font-style: normal; font-size: 10.5px; color: var(--text-quaternary); margin-left: 4px;
}

/* Sticky header for all scrollable tables */
div[style*="overflow-y:auto"] table thead,
div[style*="overflow:auto"] table thead,
div[style*="overflow-y: auto"] table thead,
.biz-scroll-wrap table thead {
  position: sticky; top: 0; z-index: 5;
}
div[style*="overflow-y:auto"] table thead th,
div[style*="overflow:auto"] table thead th,
div[style*="overflow-y: auto"] table thead th,
.biz-scroll-wrap table thead th {
  background: #f9fafb; backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.biz-spark {
  height: 4px; background: #f3f4f6; border-radius: 2px;
  overflow: hidden; min-width: 40px;
}
.biz-spark div {
  height: 100%; border-radius: 2px; min-width: 2px;
  transition: width .6s ease;
}

/* --- Negative profit --- */
.biz-clean { text-align:center; color:var(--green); padding:36px 20px; font-size:34px; line-height:1.4; }
.biz-alert-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid #fee2e2;
}
.biz-alert-item:last-child { border-bottom: none; }
.biz-alert-item cite { display:block; font-size:10.5px; color:var(--text-quaternary); font-style:normal; }
.biz-alert-num { color:var(--red); font-weight:700; font-size:14.5px; }

/* --- Summary grid --- */
.biz-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.biz-sum-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 14px; background: #f8fafc;
  border-radius: var(--r-sm);
}
.biz-sum-item span { font-size: 10.5px; color: var(--text-quaternary); font-weight: 500; }
.biz-sum-item strong { font-size: 17px; color: var(--text-primary); font-weight: 700; }

/* --- Tight table variant --- */
.biz-tight-table .data-table { font-size: 12px; }
.biz-tight-table .data-table thead th { font-size: 10px; padding: 8px 12px; }
.biz-tight-table .data-table tbody td { font-size: 11.5px; padding: 8px 12px; }

/* --- Responsive --- */
@media (max-width: 1500px) {
  .biz-kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1400px) {
  .biz-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .biz-triple-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .biz-dual-chart, .biz-triple-grid, .biz-bottom-grid { grid-template-columns: 1fr; }
  .biz-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .biz-dash-root { padding: 24px 20px 48px !important; }
  .biz-kpi-apple-value { font-size: 26px; }
}

/* ============================================
   4-Chart Grid
   ============================================ */
.ol-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 12px;
}
.ol-chart-wrap {
  width: 100%;
  min-height: 240px;
}
@media (max-width: 1200px) {
  .ol-chart-grid { grid-template-columns: 1fr; }
}

/* ===== Quote lookup dropdown ===== */
.quote-lookup-drop {
  position: absolute; top: 100%; left: 0; z-index: 500;
  background: #fff; border: 1px solid var(--border-input);
  border-radius: var(--r-sm); box-shadow: var(--s-lg);
  min-width: 280px; max-height: 260px; overflow-y: auto;
}
.quote-lookup-drop .search-result-item {
  padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  font-size: 12.5px; transition: background .12s;
}
.quote-lookup-drop .search-result-item:last-child { border-bottom: none; }

/* Date input styling */
input[type="date"] {
  padding: 10px 14px; border: 1.5px solid #e1e4e8; border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--text-primary);
  background: #fff; cursor: pointer; min-width: 140px;
}
input[type="date"]:focus {
  border-color: var(--brand-teal); outline: none;
  box-shadow: 0 0 0 3px rgba(13,148,136,.1);
}
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: .6; cursor: pointer; padding: 4px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
