:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --sub: #8b8b8b;
  --primary: #4d6bfe;
  --primary-soft: #eef2ff;
  --primary-dark: #3b5bdb;
  --warn: #e67700;
  --danger: #e03131;
  --border: #ececec;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --drawer-w: min(86vw, 320px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: "PingFang SC", "Helvetica Neue", "Microsoft YaHei UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  overscroll-behavior: none;
}

#app { height: 100%; display: flex; flex-direction: column; position: relative; }
.screen { display: none; flex: 1; min-height: 0; flex-direction: column; background: var(--bg); overflow: hidden; }
.screen.active { display: flex; }
.hidden { display: none !important; }

.login-wrap {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: calc(40px + var(--safe-top)) 24px 24px;
}
.login-split {
  flex: 1; display: flex; min-height: 0; width: 100%; overflow: hidden;
}
.login-brand {
  flex: 1.05; position: relative; min-width: 0;
  background: linear-gradient(145deg, #eef2ff 0%, #ecfeff 55%, #f0f9ff 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.login-hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 88% center; opacity: 0.88;
}
.login-brand-overlay {
  position: relative; z-index: 1; text-align: center; padding: 28px 20px;
}
.login-logo {
  width: 72px; height: 72px; border-radius: 18px;
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.28);
  object-fit: cover;
}
.login-brand h1 {
  margin: 14px 0 4px; font-size: 28px; font-weight: 800; letter-spacing: 0.02em;
  background: linear-gradient(90deg, #4f46e5, #0891b2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-en {
  margin: 0 0 10px; font-size: 12px; font-weight: 700; color: #6366f1;
  letter-spacing: 0.18em; text-transform: uppercase;
}
.brand-tag {
  margin: 0; font-size: 13px; color: #475569; line-height: 1.65; max-width: 260px;
}
.login-panel {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: calc(20px + var(--safe-top)) 24px 28px; background: #fff; min-width: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.login-panel-inner { width: 100%; max-width: 360px; }
.login-panel-inner h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; color: var(--text); }
.login-panel-sub { margin: 0 0 22px; font-size: 13px; color: var(--sub); }
.login-version-line { margin: 0 0 8px; font-size: 12px; color: var(--sub); text-align: left; }
.login-minimal { background: var(--bg); }
.login-hero { text-align: center; margin-bottom: 28px; }
.logo-ring {
  width: 64px; height: 64px; margin: 0 auto 14px;
  background: var(--primary-soft); border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
}
.logo { font-size: 32px; }
.login-hero h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; }
.login-hero p { margin: 0; color: var(--sub); font-size: 14px; }
.login-card { max-width: 400px; margin: 0; width: 100%; }
@media (max-width: 720px) {
  .login-split { flex-direction: column; }
  .login-brand { flex: 0 0 auto; min-height: 40vh; max-height: 44vh; }
  .login-brand h1 { font-size: 24px; }
  .login-panel { flex: 1; padding-top: 16px; }
}
@media (min-width: 721px) and (orientation: landscape) {
  .login-brand { max-width: 52%; }
}
.mode-logo-img { border-radius: 12px; display: block; object-fit: cover; }
.field { display: block; margin-bottom: 14px; }
.field.compact { margin-bottom: 10px; }
.field-label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.field input, .field select, .inbound-text, .detail-search {
  display: block; width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 14px;
  font-size: 16px; background: var(--surface);
}
.field input:focus, .field select:focus, .inbound-text:focus { outline: none; border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 18px; border-radius: 14px; border: none;
  font-size: 15px; font-weight: 600; cursor: pointer; width: 100%;
  transition: transform 0.15s var(--ease), opacity 0.15s;
}
.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: #fff5f5; color: var(--danger); border: 1px solid #ffc9c9; margin-top: 10px; }
.btn-lg { padding: 14px; font-size: 16px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; text-align: center; }
.link-btn { border: none; background: none; color: var(--primary); font-size: 13px; font-weight: 600; padding: 0; cursor: pointer; text-decoration: none; }
.hint { color: var(--sub); font-size: 12px; }
.hint.left { text-align: left; margin: 0 0 10px; }

.icon-btn {
  width: 40px; height: 40px; border: none; border-radius: 12px;
  background: transparent; color: var(--text); font-size: 20px; cursor: pointer;
}
.icon-btn.ghost:active { background: var(--surface); }

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; padding-top: max(6px, var(--safe-top));
  background: var(--bg); min-height: 44px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.chat-title {
  flex: 1; margin: 0; font-size: 16px; font-weight: 700;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-title-wrap { flex: 1; min-width: 0; text-align: center; }
.chat-title-wrap .chat-title { flex: unset; }
.chat-version { display: block; font-size: 10px; color: var(--sub); font-weight: 500; line-height: 1.2; }
.app-update-banner {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  margin: 0 12px 6px; padding: 8px 10px; border-radius: 10px;
  background: #eff6ff; border: 1px solid #bfdbfe; font-size: 12px;
}
.app-update-banner.hidden { display: none !important; }
.app-update-banner .btn-sm { flex-shrink: 0; }
.chat-header-spacer { flex: 1; }
.chat-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.mode-hero {
  padding: 12px 20px 8px; text-align: center; flex-shrink: 0;
  transition: opacity 0.2s var(--ease);
}
.mode-hero.collapsed { display: none !important; }
.mode-logo { font-size: 28px; margin-bottom: 6px; }
.mode-welcome { margin: 0 0 12px; font-size: 15px; color: var(--text); font-weight: 600; }
.mode-tabs {
  display: inline-flex; background: var(--surface);
  border-radius: 999px; padding: 4px; gap: 2px;
}
.mode-tab {
  border: none; background: transparent; color: var(--sub);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s;
}
.mode-tab.active { background: var(--bg); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.mode-tab.hidden { display: none; }
.mode-icon { font-size: 14px; }
.mode-desc { margin: 10px 0 0; font-size: 12px; color: var(--sub); }

.chat-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden; position: relative;
}
.chat-messages {
  flex: 1 1 0; height: 0; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 8px 16px 12px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.chat-typing { flex-shrink: 0; }
.chat-context-bar {
  flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px 12px 0; align-items: center;
}
.ctx-pill {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--sub);
}
.ctx-pill.ctx-link { color: var(--primary); border-color: rgba(26,86,142,0.25); cursor: pointer; }
.product-card.interactive { border-color: rgba(26,86,142,0.2); }
.product-card-actions { display: flex; gap: 8px; margin-top: 8px; }
.card-action-btn {
  font-size: 12px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.card-action-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.bot-suggested-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bot-hint { font-size: 12px; margin-top: 8px; }
.cursor-blink { animation: blink 0.8s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg-action-menu {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  z-index: 200; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; min-width: 140px;
}
.msg-action-menu button {
  display: block; width: 100%; text-align: left; padding: 12px 16px;
  border: none; background: none; font-size: 14px;
}
.msg-action-menu button + button { border-top: 1px solid var(--border); }
.composer-icon.active { background: rgba(26,86,142,0.15); color: var(--primary); }
.nc-link.muted { color: var(--sub); font-size: 12px; }
.msg {
  max-width: 88%; margin-bottom: 14px; padding: 12px 14px;
  border-radius: 18px; font-size: 15px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  animation: msgIn 0.28s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.msg.user {
  margin-left: auto; background: var(--primary); color: #fff;
  border-bottom-right-radius: 6px;
}
.msg.bot {
  background: var(--surface); color: var(--text);
  border-bottom-left-radius: 6px;
}
.msg.bot.bot-rich { white-space: normal; padding: 10px 12px; max-width: 92%; }
.msg.bot pre, .sheet-pre {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px; white-space: pre-wrap; margin: 0;
}
.bot-text { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: var(--text); }
.bot-text:last-child { margin-bottom: 0; }
.product-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.product-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px;
}
.product-card-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 6px; line-height: 1.35;
}
.product-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.product-card-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--sub); background: var(--surface);
  padding: 4px 8px; border-radius: 8px;
}
.product-card-tag em { font-style: normal; color: var(--sub); opacity: 0.85; }
.product-card-tag.tag-stock { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.product-card-tag.tag-warn { color: var(--warn); background: #fff4e6; font-weight: 600; }
.product-card-tag.tag-price { color: #2b8a3e; background: #ebfbee; font-weight: 600; }
.category-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.category-group { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.category-title { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.category-title small { font-weight: 500; color: var(--sub); }
.category-item {
  font-size: 14px; padding: 6px 0; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 8px;
}
.category-item:first-of-type { border-top: none; }
.category-item-name { flex: 1; min-width: 0; }
.category-item-stock { flex-shrink: 0; color: var(--sub); font-size: 13px; }

.confirm-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 900; opacity: 0; transition: opacity 0.22s var(--ease);
}
.confirm-backdrop.visible { opacity: 1; }
.confirm-dialog {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.96);
  width: min(88vw, 320px); background: var(--bg); border-radius: 16px;
  padding: 20px 18px 16px; z-index: 910; box-shadow: var(--shadow);
  opacity: 0; transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
.confirm-dialog.open { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.confirm-message { margin: 0 0 18px; font-size: 15px; line-height: 1.55; color: var(--text); text-align: center; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; padding: 11px 12px; font-size: 15px; }
.amount-dialog .amount-title { margin-bottom: 8px; font-weight: 700; }
.amount-hint {
  margin: 0 0 12px; font-size: 12px; color: var(--sub); text-align: center;
  line-height: 1.45; white-space: pre-line;
}
.amount-field { display: block; margin: 0 0 16px; text-align: left; }
.amount-field .field-label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--sub); }
.amount-field input {
  width: 100%; box-sizing: border-box; padding: 12px 14px; font-size: 20px; font-weight: 700;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
}
.amount-preview {
  margin: -4px 0 14px; font-size: 12px; color: var(--primary-dark); text-align: center; line-height: 1.45;
}
.msg.card-msg {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px;
}
.msg-action {
  display: inline-block; margin-top: 10px; padding: 8px 14px;
  border-radius: 999px; border: none; background: var(--primary);
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}

.chat-typing {
  display: flex; align-items: center; gap: 6px;
  padding: 0 16px 8px; color: var(--sub); font-size: 12px;
}
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--sub);
  animation: blink 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
.chat-typing em { font-style: normal; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.quote-suggest {
  padding: 6px 12px 8px; background: var(--primary-soft);
  border-top: 1px solid #dbe4ff;
  animation: slideUp 0.25s var(--ease);
  touch-action: pan-y;
}
.quote-suggest-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  border: none; background: transparent; padding: 4px 2px; font-size: 12px;
  font-weight: 700; color: var(--primary); cursor: pointer;
}
.quote-suggest-chevron { font-size: 11px; color: var(--sub); }
.quote-suggest-body { padding-top: 4px; }
.quote-suggest-body.collapsed { display: none; }
.quote-suggest-title { font-size: 12px; color: var(--primary); font-weight: 700; margin-bottom: 6px; }
.chip-btn {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-size: 12px; font-weight: 600; color: var(--text);
  margin: 0 6px 6px 0; cursor: pointer;
}
.chip-btn.primary { background: var(--primary-soft); border-color: #c7d2fe; color: var(--primary); }

.composer-wrap {
  flex-shrink: 0;
  padding: 4px 10px calc(6px + var(--safe-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
}
.composer-tools {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px;
  scrollbar-width: none;
}
.composer-tools::-webkit-scrollbar { display: none; }
.tool-pill {
  flex-shrink: 0; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: 12px; color: var(--sub); font-weight: 600; cursor: pointer;
}
.composer-bar {
  display: flex; align-items: flex-end; gap: 8px;
}
.composer {
  flex: 1; min-width: 0;
  background: var(--surface); border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.composer-row {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px 4px 4px;
  margin: 0;
}
.composer textarea {
  flex: 1; min-width: 0; border: none; background: transparent; resize: none;
  font-size: 15px; line-height: 20px; height: 36px; max-height: 36px;
  overflow: hidden; font-family: inherit; color: var(--text); padding: 8px 0;
}
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: #b0b0b0; }
.composer-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin-top: 6px;
}
.composer-icon {
  flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg); font-size: 22px; color: var(--sub); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.composer-mic {
  flex-shrink: 0;
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: transparent; font-size: 20px; color: var(--sub); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.composer-mic:active { background: rgba(0,0,0,0.04); }
.composer-send {
  flex-shrink: 0;
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 18px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s var(--ease), opacity 0.15s;
}
.composer-send:active { transform: scale(0.92); }
.composer-bar.voice-mode .composer-send { visibility: hidden; pointer-events: none; }
.hold-talk {
  display: none;
  flex: 1; min-width: 0; height: 36px; border: none; border-radius: 999px;
  background: transparent; color: var(--text); font-size: 16px; font-weight: 600;
  font-family: inherit; cursor: pointer; user-select: none;
  -webkit-user-select: none; touch-action: none;
  align-items: center; justify-content: center;
  letter-spacing: 0.04em;
  transition: background 0.12s var(--ease), color 0.12s, transform 0.12s;
}
.composer-row.voice-mode textarea { display: none !important; }
.composer-row.voice-mode .hold-talk { display: flex !important; }
.composer-row.voice-mode { padding-right: 12px; }
.hold-talk.recording {
  color: var(--primary);
  background: rgba(26, 86, 142, 0.08);
  transform: scale(0.99);
}
.voice-recording-mask {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.voice-recording-panel {
  width: min(72vw, 260px);
  padding: 28px 20px 24px;
  border-radius: 18px;
  background: rgba(40,40,40,0.92);
  color: #fff; text-align: center;
}
.voice-recording-icon {
  font-size: 42px; line-height: 1; margin-bottom: 12px;
  animation: voice-pulse 1s ease-in-out infinite;
}
.voice-recording-hint { margin: 0; font-size: 16px; font-weight: 600; }
.voice-recording-partial {
  margin: 10px 0 0; font-size: 13px; color: rgba(255,255,255,0.75);
  min-height: 1.2em; word-break: break-all;
}
@keyframes voice-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  z-index: 400; opacity: 0; transition: opacity 0.28s var(--ease);
}
.drawer-backdrop.visible { opacity: 1; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--drawer-w);
  background: var(--bg); z-index: 401;
  display: flex; flex-direction: column;
  transform: translateX(-105%); transition: transform 0.32s var(--ease);
  padding-top: var(--safe-top); box-shadow: var(--shadow);
}
.drawer.open { transform: translateX(0); }
.drawer-search-wrap { position: relative; padding: 14px 16px 8px; }
.drawer-search-icon {
  position: absolute; left: 28px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: 0.5; pointer-events: none;
}
.drawer-search-wrap input {
  width: 100%; padding: 10px 12px 10px 36px;
  border: none; border-radius: 12px; background: var(--surface); font-size: 15px;
}
.drawer-search-wrap input:focus { outline: none; box-shadow: 0 0 0 2px var(--primary-soft); }
.drawer-history {
  flex: 1; overflow-y: auto; padding: 4px 8px 12px;
  -webkit-overflow-scrolling: touch;
}
.drawer-group-title {
  font-size: 12px; color: var(--sub); padding: 10px 12px 4px; font-weight: 600;
}
.drawer-item {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 11px 12px; border-radius: 10px; font-size: 14px; color: var(--text);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer-item:active, .drawer-item.active { background: var(--surface); }
.drawer-empty { padding: 20px 16px; color: var(--sub); font-size: 13px; text-align: center; }
.drawer-clear-btn {
  display: block; width: calc(100% - 32px); margin: 4px 16px 8px;
  padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px;
  background: transparent; color: var(--sub); font-size: 13px; text-align: center;
}
.drawer-clear-btn:active { background: var(--surface); color: #c0392b; border-color: #f0c4c4; }
.drawer-nav { padding: 8px 12px; border-top: 1px solid var(--border); }
.drawer-nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: transparent; padding: 12px; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer; text-align: left;
}
.drawer-nav-item:active { background: var(--surface); }
.drawer-nav-item span:first-child { font-size: 18px; width: 24px; text-align: center; }
.drawer-profile {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; border-top: 1px solid var(--border); background: var(--bg);
  padding: 14px 16px calc(14px + var(--safe-bottom)); cursor: pointer; text-align: left;
}
.drawer-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.drawer-profile-text { flex: 1; min-width: 0; }
.drawer-profile-text strong { display: block; font-size: 14px; }
.drawer-profile-text small {
  display: block; font-size: 12px; color: var(--sub); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drawer-more { color: var(--sub); font-size: 18px; letter-spacing: 2px; }

#attach-backdrop { z-index: 440; }
.attach-menu {
  position: fixed; left: 12px; right: 12px; bottom: calc(56px + var(--safe-bottom));
  background: var(--bg); border-radius: 16px; padding: 8px;
  box-shadow: var(--shadow); z-index: 450;
  animation: popIn 0.22s var(--ease);
}
.attach-menu button {
  display: block; width: 100%; border: none; background: transparent;
  padding: 14px 16px; text-align: left; font-size: 15px; border-radius: 12px; cursor: pointer;
}
.attach-menu button:active { background: var(--surface); }
.attach-menu button.muted { color: var(--sub); text-align: center; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 420; opacity: 0; transition: opacity 0.28s var(--ease);
}
.sheet-backdrop.visible { opacity: 1; }
.bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 78vh; background: var(--bg);
  border-radius: 20px 20px 0 0; z-index: 421;
  padding: 8px 16px calc(16px + var(--safe-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(105%); transition: transform 0.34s var(--ease);
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet.open.sheet-dragging { transform: translateY(var(--pull-y, 0)); transition: none; }
.bottom-sheet-tall { max-height: 88vh; }
.sheet-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 4px auto 12px;
}
.bottom-sheet h3, .bottom-sheet h4 { margin: 0 0 10px; font-size: 17px; }
.sheet-head-row { display: flex; align-items: center; justify-content: space-between; }
.sheet-pre {
  max-height: 36vh; overflow-y: auto; background: var(--surface);
  padding: 12px; border-radius: 12px; margin-bottom: 12px;
}
.inbound-text {
  min-height: 160px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px;
}
.sheet-actions { display: flex; gap: 10px; margin: 12px 0; }
.sheet-actions .btn { flex: 1; margin: 0; }
.sheet-section { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.metric {
  background: var(--surface); border-radius: 14px; padding: 12px; text-align: left;
  border: none; cursor: pointer; width: 100%; transition: transform 0.12s;
}
.metric:active { transform: scale(0.98); }
.metric-label { font-size: 11px; color: var(--sub); font-weight: 600; }
.metric-value { font-size: 20px; font-weight: 800; color: var(--primary); margin-top: 4px; }
.metric-value small { font-size: 11px; font-weight: 600; color: var(--sub); }
.metric-hint { font-size: 10px; color: var(--primary); margin-top: 6px; opacity: 0.8; }
.metric.warn .metric-value { color: var(--warn); }
.card.section.compact { background: var(--surface); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.section-head h4 { margin: 0; }
.section-sub { font-size: 12px; color: var(--sub); flex-shrink: 1; text-align: right; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.list li:last-child { border-bottom: none; }
.list .sub { color: var(--sub); font-size: 12px; margin-top: 2px; }
.list .empty { color: var(--sub); text-align: center; }

.search-bar { position: relative; margin-bottom: 10px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none; }
.search-bar input {
  width: 100%; padding: 11px 12px 11px 36px; border-radius: 12px;
  border: 1px solid var(--border); font-size: 16px; background: var(--surface);
}
.product-item { background: var(--surface); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.product-item.tappable { cursor: pointer; }
.product-item.tappable:active { opacity: 0.85; }
.product-item .name { font-weight: 700; font-size: 15px; }
.product-item .meta { font-size: 12px; color: var(--sub); margin-top: 4px; }
.product-item .stock { color: var(--primary); font-weight: 700; margin-top: 6px; font-size: 13px; }
.product-item .edit-hint { font-size: 11px; color: var(--sub); margin-top: 4px; }
.supplier-store-meta { font-size: 13px; color: var(--sub); margin-bottom: 10px; }
.ops-list { list-style: none; padding: 0; margin: 0; }
.ops-list li { background: var(--surface); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.ops-list .ops-time { font-size: 11px; color: var(--sub); }
.ops-list .ops-title { font-weight: 700; margin-top: 4px; font-size: 14px; }
.ops-list .ops-sub { font-size: 12px; color: var(--sub); margin-top: 4px; }
.ops-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ops-filter button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 12px; }
.ops-filter button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.nc-link.store { margin-left: 8px; }
.product-edit-form { max-height: calc(88vh - 120px); overflow-y: auto; padding-bottom: 8px; }
.pe-batches-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pe-batch-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.pe-batch-row input[type="date"] { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.pe-batch-row .qty { color: var(--sub); white-space: nowrap; }
.empty-state { text-align: center; padding: 32px 16px; color: var(--sub); }
.empty-state .emoji { font-size: 36px; margin-bottom: 8px; }

.quote-cart { margin: 8px 0; }
.quote-cart-summary {
  margin: 4px 0 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #dbeafe;
  border-radius: 14px;
}
.quote-cart-summary.hidden { display: none; }
.quote-cart-summary-customer {
  font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 6px;
}
.quote-cart-summary-main {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.quote-cart-summary-meta { font-size: 13px; color: var(--sub); }
.quote-cart-summary-total { font-size: 14px; color: var(--text); }
.quote-cart-summary-total strong { font-size: 20px; font-weight: 800; color: var(--primary); }
.quote-cart-summary-profit {
  margin-top: 6px; font-size: 12px; font-weight: 600; text-align: right;
}
.quote-cart-summary-profit.pos { color: #059669; }
.quote-cart-summary-profit.neg { color: #dc2626; }
.customer-field-wrap { position: relative; margin-bottom: 4px; }
.customer-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% - 2px); z-index: 20;
  max-height: 200px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.dropdown-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; padding: 10px 14px; border: none; background: transparent;
  text-align: left; font-size: 14px; border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:active { background: var(--surface); }
.dropdown-item-name { font-weight: 600; color: var(--text); }
.dropdown-item-meta { font-size: 12px; color: var(--sub); }
.dropdown-empty { padding: 12px 14px; font-size: 13px; color: var(--sub); text-align: center; }
.quote-line { padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.quote-line-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.quote-line-head strong { flex: 1; min-width: 0; }
.quote-cost-tag {
  font-size: 12px; color: var(--sub); background: var(--surface);
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
}
.quote-hist-hint {
  display: block;
  width: 100%;
  margin: 6px 0 2px;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.quote-hist-hint:active { background: #dbeafe; }
.quote-hist-empty {
  margin: 6px 0 2px;
  padding: 4px 2px;
  color: var(--sub);
  font-size: 12px;
}
.customer-recent-prices {
  margin: 8px 0 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
}
.recent-price-title {
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 6px;
}
.recent-price-empty {
  font-size: 12px;
  color: var(--sub);
}
.recent-price-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.recent-price-chip {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-price-chip:active { background: #dbeafe; }
.quote-net-tag {
  font-size: 12px; color: #5b4fc7; background: #f0edff;
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
}
.quote-line-network { border-left: 3px solid #7c6cf0; padding-left: 10px; }
.quote-rm { margin-left: auto; font-size: 13px; }
.quote-line-fields { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qty-stepper {
  display: inline-flex; align-items: center; border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; background: var(--card);
}
.qty-btn {
  width: 36px; height: 36px; border: none; background: var(--surface);
  font-size: 18px; color: var(--primary); font-weight: 600;
}
.qty-btn:active { background: var(--primary-soft); }
.qty-input {
  width: 52px; padding: 6px 4px; border: none; border-left: 1px solid var(--border);
  border-right: 1px solid var(--border); text-align: center; font-size: 15px;
  background: var(--card);
}
.price-field { font-size: 12px; color: var(--sub); display: inline-flex; align-items: center; gap: 4px; }
.price-field input {
  width: 72px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.quote-line-summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 6px; font-size: 12px; color: var(--sub);
}
.quote-line-summary strong { color: var(--text); font-weight: 700; }
.quote-profit.pos { color: #2b8a3e; font-weight: 600; }
.quote-profit.neg { color: var(--danger); font-weight: 600; }
.quote-line label { display: inline-block; margin-right: 8px; font-size: 12px; color: var(--sub); }
.quote-line input { width: 64px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 8px; }
.quote-list { display: flex; flex-direction: column; gap: 8px; }
.quote-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.quote-item .sub { color: var(--sub); font-size: 12px; margin-top: 2px; }
.quote-item-actions { display: flex; gap: 8px; margin-top: 8px; }

.profile-card.compact { text-align: center; padding: 8px 0 16px; }
.avatar {
  width: 52px; height: 52px; margin: 0 auto 8px; background: var(--surface);
  border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.profile-card h2 { margin: 0 0 4px; font-size: 18px; }
.profile-card p { margin: 3px 0; color: var(--sub); font-size: 13px; }
.profile-ai { font-size: 12px !important; }
.profile-billing { font-size: 12px !important; color: var(--accent, #2563eb); margin-top: 4px !important; }
.service-pause-banner {
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 12px;
  border-bottom: 1px solid #fde68a;
}
.reg-type-toggle { margin-bottom: 12px; }
.notify-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}
.version-line { text-align: center; color: var(--sub); font-size: 11px; margin: 8px 0 12px; }

.full-panel {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg); display: flex; flex-direction: column;
  padding-top: var(--safe-top);
  overflow: hidden;
  animation: panelIn 0.28s var(--ease);
}
#detail-backdrop { z-index: 490; }
#detail-backdrop.visible { opacity: 1; pointer-events: auto; }
@keyframes panelIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { flex: 1; margin: 0; font-size: 17px; text-align: center; }
.panel-spacer { width: 40px; }
.panel-body {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 14px; padding-bottom: calc(14px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td { border: 1px solid var(--border); padding: 8px 6px; white-space: nowrap; }
.data-table th { background: var(--surface); font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.88); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 600; max-width: 90vw; text-align: center;
  animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

.login-switch { text-align: center; margin: 14px 0 0; font-size: 14px; }
.login-switch .link-btn { font-size: 14px; }
#reg-industry { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 15px; background: #fff; }

.scope-toggle {
  display: flex; gap: 8px; padding: 0 12px 8px;
}
.scope-toggle-hero {
  justify-content: center; padding: 10px 16px 4px; max-width: 360px; margin: 0 auto;
}
.mode-hero.collapsed .scope-toggle-hero { display: none; }
.scope-pill {
  flex: 1; border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 6px 10px; font-size: 13px; color: var(--sub);
}
.scope-pill.active {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600;
}

.network-cards.compact,
.network-cards-compact { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.network-catalog-list { margin-top: 4px; padding-bottom: 24px; }
.network-catalog-list .network-brand-group { margin-bottom: 14px; }
.network-catalog-list .network-brand-title {
  font-size: 13px; font-weight: 700; color: var(--text); margin: 0 0 6px;
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.network-catalog-brands { margin: 8px 0 4px; max-height: 72px; overflow-y: auto; }
.network-catalog-brands .chip-btn.active {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600;
}
.msg.bot .network-card-mini,
.network-card-mini {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 8px; font-size: 12px; line-height: 1.25;
}
.network-card-mini .nc-line {
  display: block; margin-bottom: 3px; line-height: 1.3;
}
.network-card-mini .nc-name {
  font-weight: 700; font-size: 13px; color: var(--text); margin-right: 6px;
}
.network-card-mini .nc-meta { color: var(--sub); font-size: 11px; }
.network-card-mini .nc-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; line-height: 1.2;
}
.nc-link {
  border: none; background: none; padding: 0; font-size: 11px; color: var(--sub);
  text-decoration: underline; cursor: pointer;
}
.nc-link.primary { color: var(--primary); font-weight: 600; text-decoration: none; }
.nc-contact { font-size: 11px; color: var(--primary-dark); }
.sheet-hint { margin: 0 16px 10px; font-size: 12px; color: var(--sub); }
.network-order-list { padding: 0 16px 16px; overflow-y: auto; max-height: 55vh; }

.quote-customer-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.section-label { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--sub); }
.dropdown-item.dropdown-create { color: var(--primary-dark); font-weight: 600; }
.compact-actions { margin-top: 8px; margin-bottom: 8px; }
.compact-actions .btn { margin: 0; }
.customer-mgmt-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.customer-mgmt-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; cursor: pointer;
}
.customer-mgmt-item .name { font-weight: 700; font-size: 15px; }
.customer-mgmt-item .meta { font-size: 12px; color: var(--sub); margin-top: 4px; }
.customer-mgmt-item .edit-hint { font-size: 11px; color: var(--primary); margin-top: 6px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.network-order-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px;
  background: var(--surface); cursor: pointer;
}
.network-order-card:active { background: var(--primary-soft); }
.network-order-title { font-weight: 700; margin-bottom: 4px; }
.network-order-meta { font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.network-order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.network-order-detail { padding: 4px 0 12px; font-size: 14px; line-height: 1.55; }
.network-order-detail .row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.network-order-detail .row span:first-child { color: var(--sub); flex-shrink: 0; }
.network-order-detail .row span:last-child { text-align: right; font-weight: 600; word-break: break-all; }
.finance-order-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px;
  background: var(--surface);
}
.finance-order-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.finance-order-kind { font-weight: 700; font-size: 14px; }
.finance-order-status {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: #f1f5f9; color: var(--sub);
}
.finance-order-status.receivable,
.finance-order-status.payable { background: #fff7ed; color: #c2410c; }
.finance-order-status.partial { background: #eff6ff; color: #1d4ed8; }
.finance-order-status.received,
.finance-order-status.paid { background: #ecfdf5; color: #047857; }
.finance-order-no { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.finance-order-meta { font-size: 12px; color: var(--sub); line-height: 1.45; }
.finance-order-amount { font-size: 15px; font-weight: 700; margin-top: 6px; }
.finance-order-actions { display: flex; gap: 8px; margin-top: 10px; }
.network-tabs { display: flex; gap: 8px; padding: 0 16px 12px; }
.network-tabs button {
  flex: 1; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--sub); font-size: 13px;
}
.network-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.network-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.network-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
.network-card-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.network-card-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--sub); margin-bottom: 8px; }
.network-card-meta em { font-style: normal; color: var(--text); font-weight: 600; }
.network-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.network-card-actions .btn { flex: 1; min-width: 120px; padding: 8px 10px; font-size: 13px; }
.network-contact { margin-top: 8px; font-size: 13px; color: var(--primary-dark); }
.nearby-shop-list { padding: 0 0 16px; }
.nearby-shop-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px;
  background: var(--surface);
}
.nearby-shop-title { font-weight: 700; margin-bottom: 4px; }
.nearby-shop-meta { font-size: 12px; color: var(--sub); margin-bottom: 4px; }
.nearby-shop-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.presence-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.presence-dot.online { background: #22c55e; }
.presence-dot.offline { background: #94a3b8; }
.admin-user-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.admin-tabs-scroll { overflow-x: auto; flex-wrap: nowrap; }
.admin-tabs-scroll button { flex: 0 0 auto; min-width: 72px; }
.loading {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(255,255,255,0.75);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { margin: 12px 0 0; color: var(--sub); font-size: 14px; }
.file-input { display: none; }

.home-shortcuts { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin:8px 0 4px; }
.home-shortcuts button { border:1px solid var(--border); background:var(--surface); border-radius:12px; padding:8px 12px; font-size:12px; }
.home-cta-btn {
  display: block;
  margin: 10px auto 4px;
  border: none;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  border-radius: 14px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}
.home-cta-btn:active { transform: scale(0.98); }
.home-cta-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted, #64748b);
  margin: 0 16px 4px;
  line-height: 1.4;
}
.mode-hero.collapsed .home-cta-btn,
.mode-hero.collapsed .home-cta-hint { display: none; }

/* ── 轮胎专版 2.0 首页 ── */
.product-line-tire #mode-hero {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 8px 12px 0;
  text-align: left;
}
.product-line-tire .mode-logo,
.product-line-tire .mode-welcome,
.product-line-tire .mode-tabs,
.product-line-tire #home-shortcuts,
.product-line-tire .mode-desc,
.product-line-tire #btn-view-suppliers,
.product-line-tire #view-suppliers-hint { display: none !important; }
.product-line-tire .home-catalog-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.product-line-tire .home-catalog-panel.hidden { display: none !important; }
.product-line-tire .home-catalog-search-bar,
.product-line-tire #home-catalog-brands { display: none !important; }
.product-line-tire .home-catalog-meta { flex-shrink: 0; margin: 0 0 6px; font-size: 11px; }
.product-line-tire .home-catalog-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.product-line-tire .scope-toggle-hero {
  flex-shrink: 0;
  order: 10;
  max-width: none;
  margin: 10px 0 6px;
  padding: 0 4px 4px;
}
.product-line-tire .scope-toggle-hero .scope-pill {
  padding: 10px 12px;
  font-size: 14px;
}
.product-line-tire .chat-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.product-line-tire #mode-hero {
  flex: 1;
  min-height: 0;
}
.product-line-tire .chat-body {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 32vh;
  border-top: 1px solid var(--border);
}
.product-line-tire .chat-body.tire-chat-empty {
  display: none;
}
.product-line-tire .chat-messages {
  max-height: 28vh;
}
.product-line-tire .composer-wrap {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.product-line-tire #composer-tools { display: none !important; }
.product-line-tire .home-local-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.product-line-tire .home-local-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
}
.product-line-tire .drawer-nav-item[data-panel="dashboard"] { display: none; }

.dash-actions { margin-bottom:12px; }
.dash-actions .action-item { background:var(--surface); border-radius:12px; padding:10px 12px; margin-bottom:8px; font-size:13px; border-left:4px solid var(--primary); }
.dash-actions .action-item.warn { border-left-color:#f59e0b; }
.dash-actions .action-item.ok { border-left-color:#22c55e; }
.frequent-chips { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.profile-sync { font-size:12px; color:var(--sub); margin:8px 0; }
.profile-sync.sync-error { color:#b42318; }
.profile-sync.sync-pending { color:#b54708; }

/* IM 私信 · 微信式固定底栏 */
#sheet-im.im-sheet {
  display: flex;
  flex-direction: column;
  height: 88vh;
  max-height: 88vh;
  overflow: hidden;
  padding: 6px 0 calc(8px + var(--safe-bottom));
}
#sheet-im.im-sheet .sheet-handle { flex-shrink: 0; }
.im-list-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 8px;
}
.im-list-view.hidden { display: none !important; }
.im-directory { display:flex; flex-direction:column; gap:6px; margin:8px 0 12px; max-height:140px; overflow:auto; }
.im-user-row, .im-conv-row {
  display:flex; align-items:center; gap:10px; padding:10px 12px;
  border:1px solid var(--border); border-radius:12px; background:var(--surface); text-align:left; width:100%;
}
.im-user-row:active, .im-conv-row:active { opacity:0.85; }
.im-avatar {
  width:40px; height:40px; border-radius:12px; background:#e8f1ff; color:#1d4ed8;
  display:flex; align-items:center; justify-content:center; font-weight:700; flex-shrink:0;
}
.im-meta { flex:1; min-width:0; }
.im-meta strong { display:block; font-size:14px; }
.im-meta small { display:block; color:var(--sub); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.im-unread {
  min-width:18px; height:18px; padding:0 5px; border-radius:9px; background:#ef4444; color:#fff;
  font-size:11px; line-height:18px; text-align:center; flex-shrink:0;
}
.im-conv-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }

.im-chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: auto;
}
.im-chat-view.hidden { display: none !important; }
.im-chat-head {
  flex-shrink: 0;
  display:flex; align-items:center; gap:8px;
  padding: 4px 12px 10px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.im-chat-titles { flex:1; min-width:0; }
.im-chat-titles strong { display:block; font-size:16px; }
.im-chat-titles small { color:var(--sub); font-size:12px; }
.im-messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 12px 16px;
  background: #ededed;
  border-radius: 0;
}
.im-bubble {
  max-width:78%; padding:8px 12px; border-radius:8px; font-size:15px; line-height:1.45;
  word-break:break-word; white-space:pre-wrap;
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}
.im-bubble.peer { align-self:flex-start; background:#fff; border:none; }
.im-bubble.mine { align-self:flex-end; background:#95ec69; color:#0f172a; }
.im-bubble.media { padding:4px; background:transparent; box-shadow:none; }
.im-bubble.mine.media { background:transparent; }
.im-bubble.peer.media { background:transparent; }
.im-bubble time { display:block; margin-top:4px; font-size:10px; color:rgba(0,0,0,0.35); }
.im-bubble-img {
  display:block; max-width:min(200px, 62vw); max-height:200px; border-radius:6px;
  object-fit:cover; background:#d4d4d4; cursor:zoom-in;
}
.im-voice-btn {
  display:inline-flex; align-items:center; gap:8px; min-width:88px; max-width:180px;
  border:none; background:#95ec69; padding:8px 12px; font-size:14px; color:#0f172a;
  cursor:pointer; border-radius:6px;
}
.im-bubble.peer .im-voice-btn { background:#fff; }
.im-voice-btn .im-voice-wave {
  width:12px; height:12px; border-radius:50%; background:currentColor; opacity:0.75;
  flex-shrink:0;
}
.im-voice-btn.playing .im-voice-wave { animation: imPulse 0.9s ease-in-out infinite; }
.im-voice-expired, .im-media-expired {
  font-size:13px; color:var(--sub); padding:8px 10px; background:#fff; border-radius:6px;
}
.im-bubble.mine .im-voice-expired,
.im-bubble.mine .im-media-expired { background:#95ec69; }
@keyframes imPulse { 0%,100% { transform:scale(1); opacity:0.7; } 50% { transform:scale(1.25); opacity:1; } }

.im-dock {
  flex-shrink: 0;
  background: #f7f7f7;
  border-top: 1px solid #e5e5e5;
  padding: 8px 10px;
}
.im-composer {
  display:flex; gap:6px; margin:0; align-items:center;
}
.im-composer input[type="text"] {
  flex:1; border:1px solid #e5e5e5; border-radius:6px; padding:10px 12px; font-size:15px;
  background:#fff;
}
.im-tool-btn {
  border:1px solid #e5e5e5; background:#fff; border-radius:6px;
  padding:8px 8px; font-size:12px; color:var(--text); flex-shrink:0; min-width:40px;
}
.im-voice-panel {
  display:flex; align-items:center; gap:10px; margin:0;
}
.im-voice-panel.hidden { display:none !important; }
.im-composer.hidden { display:none !important; }
.im-voice-hold {
  flex:1; border:none; border-radius:6px; padding:12px; font-size:15px; font-weight:700;
  background:#fff; color:#111; border:1px solid #e5e5e5;
}
.im-voice-hold.recording { background:#fee2e2; color:#b91c1c; border-color:#fecaca; }
.im-dock-side {
  border:none; background:transparent; color:#576b95; font-size:14px; padding:8px 4px; flex-shrink:0;
}

.im-lightbox {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(48px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}
.im-lightbox.hidden { display: none !important; }
.im-lightbox img {
  max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 4px;
}
.im-lightbox-close {
  position: absolute; top: calc(12px + var(--safe-top)); right: 14px;
  border: none; background: rgba(255,255,255,0.18); color: #fff;
  border-radius: 999px; padding: 8px 16px; font-size: 14px;
}
.im-lightbox-hint {
  margin-top: 14px; color: rgba(255,255,255,0.55); font-size: 12px;
}
.btn.compact { padding:10px 14px; }
.quote-share-img { width:100%; border-radius:12px; margin:12px 0; border:1px solid var(--border); }
.quote-share-manage { margin-bottom: 4px; }
#quote-share-manage-hint { margin: 0 0 10px; }
#btn-todos { position:relative; }
#btn-todos .notify-badge { position:absolute; top:2px; right:2px; font-size:10px; }
