/* ============================================================
   WineBuddy · 酒伴 — CSS
   Normcore / Minimalist Aesthetic + Mobile-First
   v2.3: SVG icons, region tree, AI valuation
   ============================================================ */
:root {
  --bg: #F5F5F0;
  --surface: #FFFFFF;
  --surface-hover: #FAFAF8;
  --text: #1A1A1A;
  --text-secondary: #888883;
  --text-tertiary: #B0B0A8;
  --border: #E4E4DF;
  --border-light: #F0F0EB;
  --accent: #722F37;
  --accent-light: #F5EDEE;
  --accent-muted: rgba(114,47,55,0.08);
  --accent-hover: #5C252C;
  --green: #5B7B5E;
  --green-light: #EDF2ED;
  --red: #B85450;
  --gold: #9A8B6E;
  --radius: 6px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 24px;
  --font: 'Inter', 'PingFang SC', -apple-system, sans-serif;
  --nav-width: 200px;
  --fs-title: 22px;
  --fs-stat: 26px;
  --fs-card-title: 16px;
  --fs-body: 14px;
  --fs-small: 12px;
  --shadow-card: 0 2px 12px rgba(114,47,55,0.06);
  --shadow-hover: 0 4px 16px rgba(114,47,55,0.15);
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
::selection { background: var(--accent-muted); }
input,textarea,select,button { font-family: inherit; font-size: inherit; }
input:focus,textarea:focus,select:focus { outline: none; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== Splash Screen ===== */
.splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  animation: splash-fade-out 0.6s ease 2.5s forwards;
}
.splash-inner { text-align: center; animation: splash-bounce 1s ease; }
.splash-icon { margin-bottom: 12px; }
.splash-brand { font-size: 32px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }
.splash-subtitle { font-size: 16px; color: rgba(255,255,255,0.7); margin-top: 4px; }

@keyframes splash-fade-out { to { opacity: 0; pointer-events: none; } }
@keyframes splash-bounce {
  0% { transform: scale(0.6); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== Page Animations ===== */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
/* 数字滚动动画 */
@keyframes stat-roll {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.stat-value.rolling {
  animation: stat-roll 0.4s ease;
}
.page-fade-in { animation: page-fade-in 0.3s ease; }
.modal { animation: modal-in 0.25s ease; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed; left:0; top:0; bottom:0;
  width: var(--nav-width);
  background: var(--surface);
  border-right:1px solid var(--border);
  padding: 32px 0;
  display: flex; flex-direction: column;
  z-index: 100;
}
.sidebar-brand { padding: 0 24px 32px; border-bottom: 1px solid var(--border); }
.sidebar-brand .brand-icon { margin-bottom: 6px; }
.sidebar-brand h1 { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.sidebar-brand p { font-size: 11px; color: var(--text-secondary); margin-top:2px; }
.sidebar-nav { flex:1; padding: 16px 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 24px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer; transition: 0.15s;
  border-left: 3px solid transparent;
  user-select: none;
}
.nav-item:hover { color: var(--text); background: var(--surface-hover); }
.nav-item.active {
  color: var(--accent);
  background: var(--accent-muted);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
}
.nav-item.active .nav-svg { stroke: var(--accent); }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-tertiary); }

/* ===== Main ===== */
.main { margin-left: var(--nav-width); flex:1; padding: 40px 48px; min-height: 100vh; }

/* ===== Mobile Nav ===== */
.mobile-nav {
  display: none; position: fixed; bottom:0; left:0; right:0;
  background: var(--surface); border-top:1px solid var(--border);
  z-index: 100; padding: 6px 0 env(safe-area-inset-bottom,6px) 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.mobile-nav-inner { display: flex; }
.mobile-nav-item {
  flex:1; text-align: center; padding: 4px 0;
  font-size: 10px; color: var(--text-secondary);
  cursor: pointer; transition: 0.15s;
}
.mobile-nav-item .m-svg {
  display: block; margin: 0 auto 2px;
  width: 20px; height: 20px;
  stroke: currentColor;
}
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item.active .m-svg { stroke: var(--accent); }

/* ===== Utility ===== */
.desktop-only { display: inline-flex; }

/* ===== Pages ===== */
.page { display: none; }
.page.active { display: block; animation: page-fade-in 0.3s ease; }
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: var(--fs-title); font-weight: 600; letter-spacing: -0.4px; }
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; font-size: 13px; font-weight: 500;
  border:1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  cursor: pointer; transition: 0.15s; line-height: 1.4;
}
.btn:hover { border-color: var(--text-secondary); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-outline-accent { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline-accent:hover { background: var(--accent-muted); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Inputs ===== */
.input-group { margin-bottom: 16px; }
.input-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.input-field {
  width: 100%; padding: 10px 14px;
  border:1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: 14px; color: var(--text); transition: 0.15s;
}
.input-field:focus { border-color: var(--text-secondary); }
.input-field::placeholder { color: var(--text-tertiary); }
textarea.input-field { resize: vertical; min-height: 80px; line-height: 1.6; }
select.input-field { cursor: pointer; }

/* ===== Modal ===== */
.modal-overlay {
  display: none; position: fixed; inset:0;
  background: rgba(0,0,0,0.3); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 90%; max-width: 540px; max-height: 90vh;
  overflow-y: auto; padding: 28px 32px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ===== Card ===== */
.card { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }

/* ===== Badge ===== */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 100px; font-size: 11px; font-weight: 500; }
.badge-accent { background: var(--accent-muted); color: var(--accent); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: #F8EDED; color: var(--red); }
.badge-gold { background: #F5F0E8; color: var(--gold); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-tertiary); }
.empty-state .icon { font-size: 64px; margin-bottom: 12px; color: #D4D4C8; }
.empty-state p { font-size: 14px; }
.empty-state .sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.empty-state .btn { margin-top: 16px; }
.empty-state .mobile-quick-links { display: none; margin-top: 20px; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ===== Hot Chip Regions ===== */
.empty-hot-regions { margin-top: 20px; }
.hot-label { font-size: 11px; color: var(--text-tertiary); display: block; margin-bottom: 8px; }
.hot-scroll { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
.hot-scroll::-webkit-scrollbar { display: none; }
.hot-chip {
  flex-shrink: 0; padding: 6px 14px;
  border:1px solid var(--border); border-radius: 100px;
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer; transition: 0.15s; white-space: nowrap; background: var(--surface);
}
.hot-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }

/* ===== Dashboard ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 32px; }
.stat-card {
  background: var(--surface); border:1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat-card .stat-icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.stat-card .stat-body { flex: 1; min-width: 0; }
.stat-card .stat-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px; }
.stat-card .stat-value { font-size: var(--fs-stat); font-weight: 600; letter-spacing: -0.5px; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.stat-card.stat-accent { border-left: 2px solid var(--accent); }
.stat-card.stat-green { border-left: 2px solid var(--green); }
.dashboard-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.activity-dot.accent { background: var(--accent); }
.activity-dot.green { background: var(--green); }
.activity-dot.gold { background: var(--gold); }
.activity-text { flex:1; }
.activity-text strong { font-weight: 500; }
.activity-time { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }

/* ===== Cellar Subtabs ===== */
.cellar-subtabs {
  display: flex; gap: 0; margin-bottom: 16px;
  background: var(--surface); border:1px solid var(--border);
  border-radius: var(--radius-lg); overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cellar-subtabs::-webkit-scrollbar { display: none; }
.subtab {
  flex-shrink: 0; padding: 10px 20px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
  transition: 0.15s; white-space: nowrap; user-select: none;
}
.subtab:hover { color: var(--text); background: var(--surface-hover); }
.subtab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== Cellar Toolbar ===== */
.cellar-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.cellar-toolbar .search-wrap { flex:1; min-width: 200px; position: relative; }
.cellar-toolbar .search-wrap input { width: 100%; padding: 9px 14px 9px 36px; border:1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.cellar-toolbar .search-wrap input:focus { border-color: var(--text-secondary); }
.cellar-toolbar .search-wrap .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--text-tertiary); }
.filter-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-btn { padding: 5px 14px; font-size: 12px; font-weight: 500; border:1px solid var(--border); border-radius: 100px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.filter-btn:hover { border-color: var(--text-secondary); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== Region Tree View ===== */
.region-tree-view {
  display: none;
  background: var(--surface);
  border:1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 24px;
}
.region-tree-view.active { display: block; }

.tree-container {
  display: flex; height: 500px;
  overflow: hidden;
}

/* 左侧树状导航 */
.tree-nav {
  width: 280px; flex-shrink: 0;
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  background: var(--surface);
}

.tree-nav-header {
  padding: 14px 18px;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 8px;
}
.tree-nav-header .tree-back-btn {
  display: none;
  background: none; border: none;
  font-size: 16px; cursor: pointer;
  color: var(--accent); padding: 0;
}
.tree-nav-header .tree-back-btn.show { display: inline; }

.tree-empty {
  padding: 40px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

.tree-country {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.tree-country:hover { background: var(--surface-hover); }
.tree-country.open { background: var(--accent-muted); }

.tree-country-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 13px;
  transition: 0.1s;
}
.tree-country-header:hover { color: var(--text); }
.tree-country-header .flag { font-size: 18px; flex-shrink: 0; }
.tree-country-header .name { flex: 1; font-weight: 500; }
.tree-country-header .count {
  font-size: 11px; color: #fff;
  background: var(--accent);
  border-radius: 100px;
  padding: 1px 8px;
  flex-shrink: 0;
}
/* 空国家（0瓶）灰度隐藏 */
.tree-country.empty .tree-country-header { opacity: 0.4; pointer-events: none; }
.tree-country.empty .tree-country-header .count { background: var(--text-tertiary); }
.tree-country-header .chevron {
  font-size: 10px; color: var(--text-tertiary);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.tree-country.open > .tree-country-header .chevron { transform: rotate(90deg); }

.tree-region-list {
  display: none;
  padding: 4px 0;
}
.tree-country.open > .tree-region-list { display: block; }

.tree-region {
  font-size: 13px;
  transition: 0.1s;
  color: var(--text-secondary);
}
.tree-region-row {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px 8px 40px;
  cursor: pointer;
  transition: 0.1s;
}
.tree-region-row:hover { background: var(--accent-muted); color: var(--accent); }
.tree-region.active > .tree-region-row {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 500;
  border-left: 3px solid var(--accent);
}
.tree-region .region-chevron {
  font-size: 8px; color: var(--text-tertiary);
  width: 12px; flex-shrink: 0;
}
.tree-region .region-name { flex: 1; }
.tree-region .region-count { font-size: 11px; color: var(--text-tertiary); }
/* 子产区嵌套 */
.tree-subregion-list {
  padding: 0;
}

/* 右侧酒款列表 */
.tree-wines {
  flex: 1; overflow-y: auto;
  padding: 16px;
  min-width: 0;
}
.tree-wines-placeholder {
  padding: 60px 20px; text-align: center;
  color: var(--text-tertiary); font-size: 14px;
}
.tree-wines-header {
  font-size: 14px; font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.tree-wines-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; margin-bottom: 8px;
}
.tree-wines-breadcrumb .bread-link {
  color: var(--accent); cursor: pointer;
  text-decoration: none;
}
.tree-wines-breadcrumb .bread-link:hover { text-decoration: underline; }
.tree-wines-breadcrumb .bread-sep {
  color: var(--text-tertiary); font-size: 14px;
}
.tree-wines-breadcrumb .bread-current {
  color: var(--text-secondary); font-weight: 500;
}
.tree-summary-stats {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.stat-chip {
  font-size: 12px; color: var(--text-secondary);
  background: var(--surface-hover);
  border-radius: 100px;
  padding: 3px 12px;
}
.stat-chip strong { color: var(--accent); }
.tree-wine-price {
  font-size: 11px; color: var(--accent);
  font-weight: 600; flex-shrink: 0;
}
.tree-wines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.tree-wine-card {
  background: var(--surface);
  border:1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: 0.15s;
}
.tree-wine-card:hover { border-color: var(--accent); }
.tree-wine-card .wine-img {
  width: 100%; height: 140px;
  background: var(--border-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--text-tertiary);
  overflow: hidden;
}
.tree-wine-card .wine-img img { width: 100%; height: 100%; object-fit: cover; }
.tree-wine-card .wine-body { padding: 12px 14px; }
.tree-wine-card .wine-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-wine-card .wine-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.tree-wine-card .wine-footer { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-light); }
.tree-wine-card .wine-rating { font-size: 11px; font-weight: 600; color: var(--gold); }
.tree-wine-card .wine-stock { font-size: 11px; color: var(--text-secondary); }

/* 移动端：树状图全屏 + 二级页面 */
@media (max-width: 768px) {
  .tree-container { flex-direction: column; height: auto; }
  .tree-nav { width: 100%; max-height: 50vh; }
  .tree-wines { padding: 12px; }
  .tree-wines-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tree-wine-card .wine-img { height: 100px; }
}

/* ===== Wine Grid ===== */
.wine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.wine-card { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: 0.15s; }
.wine-card:hover { border-color: var(--accent); }
.wine-card-image { width: 100%; height: 180px; background: var(--border-light); display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--text-tertiary); overflow: hidden; }
.wine-card-image img { width: 100%; height: 100%; object-fit: cover; }
.wine-card-body { padding: 14px 16px; }
.wine-card-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wine-card-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.wine-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-light); }
.wine-card-rating { font-size: 12px; font-weight: 600; color: var(--gold); }
.wine-card-stock { font-size: 12px; color: var(--text-secondary); }

/* ===== Detail Panel ===== */
.detail-panel-overlay { display: none; position: fixed; inset:0; background: rgba(0,0,0,0.2); z-index: 150; }
.detail-panel-overlay.show { display: block; }
.detail-panel {
  position: fixed; top:0; right:-480px;
  width: 480px; max-width: 100vw; height: 100vh;
  background: var(--surface); border-left:1px solid var(--border);
  z-index: 151; transition: right 0.3s cubic-bezier(0.22,1,0.36,1);
  overflow-y: auto; padding: 32px;
}
.detail-panel.open { right:0; }
.detail-panel .modal-close { position: absolute; top: 20px; right: 20px; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); }
.detail-panel-header { margin-bottom: 24px; }
.detail-panel-header h3 { font-size: 20px; font-weight: 600; }
.detail-panel-header .sub { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.detail-section { margin-bottom: 20px; }
.detail-section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-secondary); margin-bottom: 8px; }
.detail-row { display: flex; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border-light); }
.detail-row:last-child { border-bottom: none; }
.detail-row .label { width: 100px; color: var(--text-secondary); flex-shrink: 0; }
.detail-row .value { flex:1; }
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { padding: 3px 10px; border-radius: 100px; font-size: 11px; background: var(--accent-muted); color: var(--accent); }

/* ===== AI Search / Sommelier ===== */
.info-complete-card {
  background: var(--surface); border:1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px;
}
.info-complete-body {
  padding-left: 44px; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.info-complete-body .input-group { flex:1; min-width:200px; margin-bottom:0; }

.sommelier-card {
  background: var(--surface); border:1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.sommelier-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.sommelier-icon { flex-shrink: 0; line-height: 1; }
.sommelier-header h3 { font-size: 16px; font-weight: 600; }
.sommelier-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }

.sommelier-config-warning,
.sommelier-empty-warning {
  background: var(--accent-muted); border:1px solid var(--accent);
  border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 16px; font-size: 13px; color: var(--accent);
}
.config-warning-content { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sommelier-empty-warning span { display: block; }

.sommelier-tags {
  display: flex; gap: 8px; margin-bottom: 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 4px;
}
.sommelier-tags::-webkit-scrollbar { display: none; }
.sommelier-tag {
  flex-shrink: 0; padding: 6px 16px;
  border:1px solid var(--accent); border-radius: 100px;
  font-size: 13px; color: var(--accent);
  cursor: pointer; transition: 0.15s; white-space: nowrap; background: transparent; user-select: none;
}
.sommelier-tag:hover { background: var(--accent); color: #fff; }

/* 底部固定输入栏 */
.sommelier-input-bar {
  position: relative; margin-top: 16px;
  display: flex; gap: 8px; align-items: flex-end;
}
.sommelier-input-bar .sommelier-textarea { flex:1; min-height: 44px; max-height: 88px; }
.sommelier-input-bar .sommelier-send-btn {
  flex-shrink: 0; width: 40px; height: 40px;
  border-radius: var(--radius-lg);
}

.sommelier-textarea {
  width: 100%; min-height: 72px; max-height: 132px;
  padding: 12px 16px; border:1px solid #E0E0D8;
  border-radius: var(--radius); background: var(--surface);
  font-size: 14px; color: var(--text); line-height: 1.6;
  resize: none; transition: border-color 0.2s; font-family: var(--font);
}
.sommelier-textarea:focus { border-color: var(--accent); outline: none; }
.sommelier-send-btn {
  position: absolute; bottom: 10px; right: 10px;
  width: 34px;   height: 34px; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: 0.15s;
}
.sommelier-send-btn:hover { background: var(--accent-hover); }
.sommelier-send-btn:disabled { background: var(--border); cursor: not-allowed; }

/* 加载动画 */
.sommelier-loading { display: flex; align-items: center; gap: 12px; padding: 20px 16px; background: #FAFAF7; border-radius: var(--radius); }
.loading-dots { display: flex; gap: 4px; }
.loading-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: pulse-dot 1.4s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse-dot {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.loading-text { font-size: 14px; color: var(--text-secondary); }

/* AI 回复 */
.sommelier-result { margin-top: 4px; }
.sommelier-msg {
  background: #FAFAF7; border-left: 3px solid #E8E8E0;
  padding: 16px 20px; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px; line-height: 1.8; color: var(--text-secondary);
}
.sommelier-msg.sommelier-error { border-left-color: var(--red); color: var(--red); }

.sommelier-user-msg {
  display: flex; gap: 10px; margin-bottom: 12px; justify-content: flex-end;
}
.sommelier-user-label {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  align-self: flex-end; flex-shrink: 0;
}
.sommelier-user-text {
  background: var(--accent-muted); border:1px solid rgba(114,47,55,0.2);
  border-radius: 12px 4px 12px 12px; padding: 10px 16px;
  font-size: 13px; line-height: 1.6; color: var(--text); max-width: 85%;
}
.conv-sep { height:1px; background: var(--border-light); margin: 16px 0; }

/* 清空对话按钮栏 */
.sommelier-clear-bar { display: none; justify-content: center; margin-top: 8px; }

/* 详情面板 AI 推荐理由 */
.ai-rec-section { border-left: 3px solid var(--accent); padding-left: 14px; margin-top: 20px; }
.ai-rec-content p { font-size: 13px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 6px; }
.ai-rec-content p:last-child { margin-bottom: 0; }

.wine-mini-card {
  flex-shrink: 0; width: 200px;
  background: #FFF8F8; border:1px solid #F0E0E0;
  border-radius: var(--radius); padding: 12px;
  cursor: pointer; transition: 0.15s;
  display: flex; flex-direction: column; gap: 6px;
}
.wine-mini-card:hover { border-color: var(--accent); }
.wine-mini-color { display:none; }

.wine-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px dashed var(--accent);
  transition: 0.15s;
}
.wine-link:hover {
  background: var(--accent-muted);
  border-bottom-style: solid;
}

/* ===== Tasting Notes ===== */
.note-card { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 10px; }
.note-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.note-card-wine { font-size: 14px; font-weight: 600; }
.note-card-date { font-size: 12px; color: var(--text-tertiary); }
.note-card-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.note-card-meta span { font-size: 12px; color: var(--text-secondary); }
.note-card-text { font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.note-card-tags { margin-top: 8px; }
.aroma-select-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; margin-bottom: 16px; }
.aroma-tag { padding: 6px 10px; text-align: center; font-size: 12px; border:1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: 0.15s; user-select: none; background: var(--surface); }
.aroma-tag:hover { border-color: var(--text-secondary); }
.aroma-tag.selected { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); font-weight: 500; }

/* ===== Settings / Accordion ===== */
.setting-accordion { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 10px; overflow: hidden; }
.accordion-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; font-size: 14px; font-weight: 500; cursor: pointer;
  user-select: none; transition: 0.15s;
}
.accordion-header:hover { background: var(--surface-hover); }
.accordion-arrow { font-size: 12px; color: var(--text-tertiary); transition: transform 0.2s; }
.setting-accordion.open .accordion-arrow { transform: rotate(180deg); }
.accordion-body { display: none; padding: 0 18px 16px; border-top: 1px solid var(--border-light); padding-top: 12px; }
.setting-accordion.open .accordion-body { display: block; }

.setting-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--bg);
  border:1px solid var(--border-light); border-radius: var(--radius);
  margin-bottom: 6px;
}
.setting-item .setting-label { font-size: 13px; }
.setting-item .setting-desc { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.toggle { width: 36px; height: 20px; border-radius: 10px; background: var(--border); cursor: pointer; position: relative; transition: 0.2s; flex-shrink: 0; }
.toggle.on { background: var(--accent); }
.toggle::after { content:''; position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:50%; background:#fff; transition:0.2s; }
.toggle.on::after { left:18px; }

/* ===== Confirm Modal ===== */
#confirmModal .modal { max-width: 360px; text-align: center; }
#confirmText { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; }

/* ===== File input hidden ===== */
.hidden-input { display: none; }

/* ===== AI Scan ===== */
.ai-scan-area { margin-bottom: 16px; }
.ai-scan-area .scan-status { font-size: 12px; color: var(--text-secondary); }
.scan-loading { opacity: 0.6; pointer-events: none; }

/* ===== Wine Label Upload ===== */
.wine-label-upload { display: flex; gap: 12px; align-items: flex-start; }
.label-preview {
  width: 80px; height: 80px; border:1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--border-light); font-size: 28px; color: var(--text-tertiary); flex-shrink: 0;
}
.label-preview img { width: 100%; height: 100%; object-fit: contain; }
.label-upload-actions { display: flex; flex-direction: column; gap: 6px; }

/* ===== Detail Panel Image ===== */
.detail-label-image { width: 100%; max-height: 240px; overflow: hidden; border-radius: var(--radius-lg); margin-bottom: 20px; background: var(--border-light); }
.detail-label-image img { width: 100%; height: auto; max-height: 240px; object-fit: contain; display: block; }
.detail-label-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; min-height: 140px; }

/* ===== Notification Banner ===== */
.notif-banner {
  display: none; position: fixed;
  top: 0; left: var(--nav-width); right: 0;
  align-items: center; gap: 10px;
  padding: 10px 24px;
  background: var(--accent); color: #fff;
  font-size: 13px; z-index: 90; cursor: pointer;
  transition: opacity 0.3s; min-height: 42px;
}
.notif-banner.dismissed { display: none !important; }
.notif-icon { flex-shrink: 0; display: flex; }
.notif-text-wrap { flex:1; overflow: hidden; white-space: nowrap; }
.notif-text { display: inline-block; animation: notif-marquee 15s linear infinite; padding-left: 100%; white-space: nowrap; }
@keyframes notif-marquee {
  0% { transform: translateX(0); }
  10% { transform: translateX(0); }
  90% { transform: translateX(-100%); }
  100% { transform: translateX(-100%); }
}
.notif-text:hover { animation-play-state: paused; }
.notif-close {
  background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 16px; cursor: pointer; padding: 2px 6px; flex-shrink: 0; line-height: 1;
}
.notif-close:hover { color: #fff; }

/* ===== Grape View ===== */
.grape-group { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 12px; overflow: hidden; }
.grape-group-header { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border-light); }
.grape-group-icon { font-size: 18px; }
.grape-group-header h3 { font-size: 14px; font-weight: 600; }
.grape-group-count { font-size: 11px; color: var(--text-tertiary); margin-left: auto; }
.grape-wine-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: 0.1s; }
.grape-wine-row:last-child { border-bottom: none; }
.grape-wine-row:hover { background: var(--surface-hover); }
.grape-wine-thumb { width: 36px; height: 36px; border-radius: 4px; background: var(--border-light); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; overflow: hidden; }
.grape-wine-thumb img { width: 100%; height: 100%; object-fit: cover; }
.grape-wine-info { flex:1; min-width:0; }
.grape-wine-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grape-wine-meta { font-size: 11px; color: var(--text-tertiary); margin-top:1px; }
.grape-wine-stock { font-size: 12px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.grape-group-more { padding: 10px 18px; text-align: center; font-size: 12px; color: var(--accent); cursor: pointer; border-top: 1px solid var(--border-light); }
.grape-group-more:hover { background: var(--accent-muted); }

/* ===== Mobile Drawer ===== */
.mobile-drawer-overlay {
  display: none; position: fixed; inset:0;
  background: rgba(0,0,0,0.25); z-index: 180;
}
.mobile-drawer-overlay.show { display: block; }
.mobile-drawer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-radius: 16px 16px 0 0;
  z-index: 181; transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.22,1,0.36,1);
  max-height: 55vh; display: flex; flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}
.mobile-drawer.show { transform: translateY(0); }
.drawer-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 10px auto 6px; flex-shrink: 0; }
.drawer-header { padding: 8px 20px 12px; border-bottom: 1px solid var(--border-light); display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.drawer-header h3 { font-size: 16px; font-weight: 600; }
.drawer-count { font-size: 12px; color: var(--text-secondary); }
.drawer-body { flex:1; overflow-y: auto; padding: 8px 0 16px; -webkit-overflow-scrolling: touch; }
.drawer-wine-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; cursor: pointer; transition: 0.1s; }
.drawer-wine-item:hover { background: var(--accent-muted); }
.drawer-wine-img { width: 40px; height: 40px; border-radius: 4px; background: var(--border-light); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; overflow: hidden; }
.drawer-wine-img img { width: 100%; height: 100%; object-fit: cover; }
.drawer-wine-info { flex:1; min-width:0; }
.drawer-wine-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-wine-meta { font-size: 12px; color: var(--text-tertiary); margin-top:1px; }
.drawer-footer { padding: 8px 20px 0; }

/* ===== Responsive ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  .main { padding: 32px 28px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-nav { display: block; }
  .main { margin-left: 0; padding: 20px 16px 80px 16px; }
  .detail-panel { width: 100vw; }
  .wine-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .wine-card:hover { border-color: var(--border); }
  .stat-card:hover { transform: none; box-shadow: var(--shadow-card); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dashboard-bottom { grid-template-columns: 1fr; gap: 12px; }
  .modal { padding: 20px; }
  .desktop-only { display: none !important; }

  /* 移动端：酒窖子标签溢出滚动 */
  /* 侍酒师：固定底部输入栏 */
  .sommelier-input-bar {
    position: fixed; bottom: 56px; left: 0; right: 0;
    background: var(--surface); border-top:1px solid var(--border);
    padding: 10px 16px calc(env(safe-area-inset-bottom,0px) + 10px) 16px;
    z-index: 95; box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  }
  .sommelier-card { padding: 16px; margin-bottom: 80px; }
  .sommelier-tags { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px; overflow-x: visible; }

  .notif-banner { left: 0; padding: 10px 16px; font-size: 12px; min-height: 36px; }
  .notif-text { animation: notif-marquee 12s linear infinite; }

  /* 手风琴在移动端更紧凑 */
  .accordion-header { padding: 12px 14px; font-size: 13px; }
  .accordion-body { padding: 0 14px 12px; }
}
@media (max-width: 420px) {
  .wine-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; }
}
