:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee6;
  --brand: #155eef;
  --brand-dark: #0f3f9c;
  --green: #13855b;
  --amber: #b25e09;
  --danger: #b42318;
  --shadow: 0 16px 38px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

header {
  background: #101828;
  color: #fff;
  padding: 0 28px;
  border-bottom: 4px solid var(--brand);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 108px;
  height: 108px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 760;
}

.brand-text h1,
.admin-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.subtitle {
  color: #d0d5dd;
  font-size: 13px;
}

/* ---- Dropdown ---- */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.dropdown-toggle svg {
  flex-shrink: 0;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  z-index: 1000;
  padding: 6px;
  animation: dropdownIn 0.15s ease;
}

.dropdown-menu-right {
  left: auto;
  right: 0;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: #344054;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
  text-decoration: none;
}

.dropdown-item:hover {
  background: #f4f6fa;
}

#adminPanelBtn {
  font-weight: 650;
}

.dropdown-item-danger {
  color: #b42318;
}

.dropdown-item-danger:hover {
  background: #fef2f2;
}

.dropdown-divider {
  height: 1px;
  background: #edf0f3;
  margin: 4px 8px;
}

/* User dropdown header */
.user-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 12px;
}

.user-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #374151;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.dropdown-user-name {
  font-size: 14px;
  font-weight: 700;
  color: #101828;
}

.dropdown-user-email {
  font-size: 12px;
  color: #667085;
  margin-top: 1px;
}

.user-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #374151;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  transition: box-shadow 0.15s;
}

.user-dropdown-toggle:hover .user-avatar {
  box-shadow: 0 0 0 3px rgba(55,65,81,0.2);
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button, .ghost {
  border: 1px solid transparent;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

button.primary { background: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.secondary { background: #fff; color: #101828; border-color: #cbd5e1; }
button.secondary:hover { border-color: #98a2b3; }
button.outline-blue { background: transparent; color: var(--brand); border-color: var(--brand); }
button.outline-blue:hover { background: #eff6ff; }
button.danger { color: var(--danger); background: #fff; border-color: #f3b7b2; }
button.icon { width: 36px; min-height: 36px; padding: 0; border-color: #cbd5e1; background: #fff; color: #344054; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.export-action {
  min-width: 116px;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .08s ease;
}
button.export-action:active { transform: translateY(1px); }
button.export-action.is-loading,
button.export-action.is-loading:disabled {
  opacity: 1;
  cursor: progress;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
button.export-action.is-loading::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: btn-spin .75s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

button.is-loading svg:first-of-type {
  display: none !important;
}
button.is-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.75s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
button.is-loading {
  pointer-events: none;
  opacity: 0.8;
}

.admin-modal { width: min(1040px, 96vw); }

/* ---- Admin standalone page ---- */
body.admin-page {
  background: #f8fafc;
  min-height: 100vh;
  height: auto;
  overflow: auto;
}
html.admin-page {
  height: auto;
  overflow: auto;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}
.admin-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-back-link {
  font-size: 13px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.admin-back-link:hover { opacity: 0.8; }
.admin-header-title {
  font-size: 18px;
  font-weight: 700;
  color: #101828;
  margin: 0;
}

.app-version-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}
.admin-header-user {
  font-size: 13px;
  color: #475467;
}

/* Admin Layout Redesign */
.admin-container {
  display: flex;
  min-height: calc(100vh - 66px); /* Header height is ~66px */
  background: #f8fafc;
}
.admin-sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 24px 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: #475467;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  outline: none;
}
.sidebar-item:hover {
  background: #f1f5f9;
  color: #1e293b;
}
.sidebar-item.active {
  background: #e0f2fe;
  color: #0369a1;
}
.sidebar-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: #0284c7;
  border-radius: 0 4px 4px 0;
}
.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: #475467;
  transition: stroke 0.2s ease;
}
.sidebar-item:hover .sidebar-icon {
  stroke: #1e293b;
}
.sidebar-item.active .sidebar-icon {
  stroke: #0284c7;
}
.sidebar-badge {
  margin-left: auto;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
}
.tab-pane {
  display: none;
  animation: fadeInPane 0.25s ease-out;
}
.tab-pane.active {
  display: block;
}
@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.admin-page-title {
  margin-bottom: 24px;
}
.admin-page-title h2 {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
}
.admin-page-title p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}
.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}
.admin-filter-bar .filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 200px;
}
.admin-filter-bar .filter-item label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.admin-filter-bar .filter-item input,
.admin-filter-bar .filter-item select {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  background-color: #fff;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s ease;
  min-height: 38px;
  box-sizing: border-box;
}
.admin-filter-bar .filter-item input:focus,
.admin-filter-bar .filter-item select:focus {
  border-color: #3b82f6;
}
.admin-filter-bar .filter-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.admin-filter-bar .filter-actions button {
  height: 38px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.admin-dashboard-grid {
  margin-top: 24px;
}
.dashboard-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
}
.welcome-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px 0;
}
.welcome-card ul {
  padding-left: 20px;
  margin: 0;
  display: grid;
  gap: 12px;
}
.welcome-card li {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
}
.welcome-card li strong {
  color: #0f172a;
}
.admin-main {
  flex-grow: 1;
  max-width: 1200px;
  padding: 32px 40px;
  overflow-y: auto;
}
.admin-body {
  display: grid;
  gap: 16px;
  max-height: 72vh;
  overflow: auto;
  background: #f8fafc;
}
.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.admin-stat {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}
.admin-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.admin-stat span {
  display: block;
  font-size: 13px;
  color: #667085;
  margin-bottom: 6px;
  font-weight: 500;
}
.admin-stat strong {
  display: block;
  font-size: 32px;
  line-height: 1;
  color: #101828;
  font-weight: 800;
}
.admin-stat.is-warning {
  border-color: #fca5a5;
  background: #fffaf9;
}
.admin-stat.is-warning strong { color: #dc2626; }
.admin-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.admin-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf0f3;
  margin-bottom: 20px;
}
.admin-section h3 { margin: 0; font-size: 16px; font-weight: 700; color: #101828; }
.admin-section p { margin: 6px 0 0; color: #667085; font-size: 13px; }
.admin-list { display: grid; gap: 16px; }

/* Pending badge in header */
.pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #fecaca;
  border-radius: 20px;
  background: #fef2f2;
  color: #b42318;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  animation: pulse-badge 2s ease-in-out infinite;
}

.pending-badge:hover { background: #fee2e2; border-color: #fca5a5; }

.pending-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc2626;
  animation: blink-dot 1s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.2); }
  50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Pending user card - red left border */
.user-card.pending {
  border-color: #fecaca;
  border-left: 4px solid #ef4444;
  background: #fffbfa;
}

/* Deleted user card - gray with left border */
.user-card.deleted {
  opacity: 0.85;
  border-color: #cbd5e1;
  background: #f8fafc;
  border-left: 4px solid #94a3b8;
}

/* User card */
.user-card {
  position: relative;
  padding: 18px 24px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  transition: all 0.2s ease;
  min-height: 72px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.user-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.user-card-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #eef2ff;
  color: #4338ca;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-size: 14px; font-weight: 700; color: #101828; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-card-meta { font-size: 12px; color: #667085; margin-top: 2px; }

.user-card-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.user-tag {
  font-size: 11px;
  font-weight: 500;
  color: #4338ca;
  background: #eef2ff;
  padding: 1px 7px;
  border-radius: 4px;
}

.user-version-tag {
  color: #15803d;
  background: #f0fdf4;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.badge-active { background: #ecfdf3; color: #067647; }
.badge-pending { background: #fffaeb; color: #b25e09; }
.badge-rejected { background: #fef2f2; color: #b42318; }
.badge-role { background: #f4f6fa; color: #475467; }

.admin-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr .8fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}
.admin-row strong { display:block; color: var(--ink); }
.admin-row small { display:block; color: var(--muted); margin-top: 2px; }
.admin-actions {
  display:flex;
  gap:8px;
  justify-content:flex-start;
  flex-wrap:wrap;
  align-items:center;
  margin-top:14px;
  padding-top:14px;
  border-top: 1px dashed #e2e8f0;
}
.admin-actions button, .admin-actions select { min-height: 30px; font-size: 12px; }
.quote-card-amount {
  font-weight: 800;
  color: #0f172a;
  font-size: 15px;
  white-space: nowrap;
  margin-left: auto;
}
.quote-card .admin-actions {
  justify-content: flex-end;
}
.form-field { display:grid; gap:6px; margin-bottom:12px; font-size:13px; font-weight:650; }
.form-field input { min-height:36px; border:1px solid #d0d5dd; border-radius:6px; padding:0 10px; }
.password-field {
  position: relative;
  display: block;
}
.password-field input {
  padding-right: 42px;
}
.password-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #667085;
  cursor: pointer;
  font-size: 14px;
}
.password-eye svg {
  width: 17px;
  height: 17px;
  display: block;
  margin: auto;
}
.password-eye:hover {
  color: var(--brand);
  background: #f4f6fa;
  border-radius: 6px;
}

.sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.sync-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.sync-actions button {
  min-height: 36px;
  padding: 0 20px;
  font-size: 13px;
}

.sync-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 320px;
  max-width: min(460px, calc(100vw - 48px));
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(208,213,221,.9);
  box-shadow: 0 18px 50px rgba(16,24,40,.18);
  color: var(--ink);
  pointer-events: auto;
}

.sync-card strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.sync-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.sync-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(21,94,239,.18);
  border-top-color: var(--brand);
  animation: btn-spin .8s linear infinite;
  flex: 0 0 auto;
}

main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  max-width: 1680px;
  margin: 0 auto;
  padding: 22px 28px 36px;
  width: 100%;
}

.layout {
  display: grid;
  grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
  gap: 18px;
  height: 100%;
  box-sizing: border-box;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-title {
  font-size: 14px;
  font-weight: 760;
}

.toolbar {
  padding: 8px 18px 14px;
  border-bottom: 1px solid var(--line);
}

input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  min-height: 34px;
  padding: 6px 8px;
}

.date-input-group {
  display: flex;
  width: 100%;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-sizing: border-box;
}

.date-input-group input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  min-height: 0;
  border: none;
  border-radius: 0;
  outline: none;
  padding: 0 8px;
  background: transparent;
}

.date-picker-btn {
  flex: 0 0 34px;
  width: 34px;
  min-height: 0;
  height: 100%;
  border: none;
  border-radius: 0;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.date-picker-btn:hover {
  background: #1d4ed8;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.45;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(21, 94, 239, .18);
  border-color: var(--brand);
}

.library-count-card {
  margin: 16px 18px 8px;
  padding: 14px 16px;
  border: 1px solid rgba(21, 94, 239, .22);
  border-radius: 14px;
  background: linear-gradient(135deg, #eef4ff 0%, #ffffff 58%, #f8fafc 100%);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}

.library-count-label {
  color: #475467;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
}

.library-count-number {
  margin-top: 2px;
  color: var(--brand);
  font-size: 46px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.product-list {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.product-group {
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.product-group-head {
  width: 100%;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 1px solid #e2e8f0;
}

.product-group-head:hover {
  background: #eef4ff;
  color: var(--brand);
}

.product-group-chevron {
  width: 16px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.product-group-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
}

.product-group-count {
  margin-left: auto;
  min-width: 24px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e0e7ff;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.product-group-body {
  background: #fff;
}

.product {
  padding: 12px 18px;
  border-bottom: 1px solid #edf0f3;
  display: flex;
  gap: 10px;
}

.product-index {
  flex: 0 0 24px;
  width: 24px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  align-self: center;
  padding-top: 0;
}

.product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.product-controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
}

.product-group-body .product:last-child { border-bottom: 0; }

.product:last-child { border-bottom: 0; }

.product-title {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 760;
  text-align: left;
  justify-content: flex-start;
  white-space: normal;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.product-title:hover {
  color: var(--brand);
}

.product-action {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.product-action:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.12);
}

input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input {
  width: 40px;
  text-align: center;
  border: none;
  border-radius: 0;
  min-height: 28px;
  padding: 0 4px;
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  background: #fafbfc;
}

.qty-input:focus {
  outline: none;
  background: #fff;
}

.join-btn {
  border: none;
  border-radius: 0;
  border-left: 1px solid #cbd5e1;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  min-height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  white-space: nowrap;
}

.join-btn:hover {
  background: var(--brand-dark);
}

.join-btn:active {
  background: #0d3888;
}

.pill {
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  padding: 2px 8px;
  background: #f8fafc;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-category {
  font-size: 11px;
  font-weight: 650;
  border-color: #c0c8d4;
}

.pill-price,
.pill-price-zero,
.pill-price-edit {
  flex-shrink: 0;
}

.pill-price {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pill-price:hover {
  background: #eef4ff;
  border-color: var(--brand);
  color: var(--brand);
}

.pill-price-set {
  border-color: var(--brand);
  color: var(--brand);
}

.pill-price-set:hover {
  background: #eef4ff;
}

.pill-price-zero {
  font-size: 11px;
  color: #98a2b3;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
}

.pill-price-zero:hover {
  color: var(--brand);
}

.pill-price-edit input {
  width: 72px;
  min-height: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.metric {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child { border-right: 0; }

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.metric strong {
  font-size: 16px;
  line-height: 1.2;
}

.table-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
  font-size: 12px;
  table-layout: fixed;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4ff;
  color: #1d2939;
  text-align: left;
  font-weight: 760;
  border-bottom: 1px solid #b2c7f8;
  padding: 9px 10px;
  white-space: nowrap;
}

td {
  border-bottom: 1px solid #edf0f3;
  padding: 9px 10px;
  vertical-align: middle;
  background: #fff;
}

tbody tr:hover td { background: #fafcff; }

.section-sep td {
  padding: 12px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  background: #f8fafc;
  border-bottom: 2px solid #d0d5dd;
  border-top: 2px solid #d0d5dd;
}

.section-sep:hover td { background: #f8fafc; }

.add-aux-row td {
  padding: 10px;
  background: #fafbfc;
  border-bottom: 0;
}

.add-aux-row:hover td { background: #fafbfc; }

td.index { color: var(--muted); width: 52px; }
td.model { font-weight: 700; width: 170px; }
td.name { width: 150px; }
td.number { width: 90px; }
td.amount { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
td.ops { width: 42px; text-align: center; }

td.number input {
  width: 72px;
  min-width: 72px;
  min-height: 28px;
  padding-left: 8px;
  padding-right: 8px;
}

button.delete-row {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

button.delete-row:hover {
  background: transparent;
  border-color: #7a271a;
  color: #7a271a;
}

.empty {
  padding: 46px 22px;
  text-align: center;
  color: var(--muted);
}

.project {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.info-box {
  position: relative;
  border: 1px solid var(--brand);
  border-radius: 10px;
  padding: 16px 12px 12px;
  background: #fff;
}

.info-box-title {
  position: absolute;
  top: -9px;
  left: 12px;
  padding: 0 8px;
  background: #fff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.field-full {
  grid-column: 1 / -1;
}

#projectTitle {
  border-color: var(--brand);
}

.field label {
  display: block;
  color: #475467;
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 5px;
}

.note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 11000;
  animation: fadeIn 0.15s ease;
}

.modal {
  margin: auto;
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  width: min(620px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.18s ease;
}

.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-size: 14px;
  font-weight: 760;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  line-height: 1;
}

.modal-close:hover { color: var(--ink); }

.modal-body {
  padding: 18px 22px;
  overflow: auto;
  flex: 1;
}

.modal-body textarea {
  min-height: 200px;
}

.spec-check-all {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.spec-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-add-row {
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

.spec-add-controls {
  display: flex;
  gap: 8px;
}

.spec-add-controls input {
  flex: 1;
  min-height: 36px;
}

.spec-add-btn {
  min-height: 36px;
  padding: 0 16px;
  border: 2px dashed var(--brand);
  border-radius: 8px;
  background: transparent;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
}

.spec-add-btn:hover {
  background: #eff6ff;
}

.custom-spec-tag {
  display: inline-block;
  font-size: 10px;
  color: #fff;
  background: var(--brand);
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
}

.spec-del-btn {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.spec-del-btn:hover {
  color: var(--danger);
}

.spec-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.12s;
}

.spec-check:hover {
  background: #f4f6fa;
}

.spec-check input[type="checkbox"] {
  width: 17px;
  min-width: 17px;
  height: 17px;
  min-height: 17px;
  margin-top: 2px;
  accent-color: var(--brand);
  cursor: pointer;
}

.spec-check-label {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  user-select: none;
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#appUpdateModal {
  align-items: center;
  justify-content: center;
}

.app-update-modal {
  width: min(500px, 92vw);
  border-radius: 18px;
  overflow: hidden;
}

.app-update-modal .modal-head {
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 70%);
}

.app-update-version {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.app-update-body {
  padding: 20px 24px 18px;
}

.app-update-date {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.app-update-notes {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-size: 14px;
  line-height: 1.65;
}

.app-update-notes li::marker {
  color: #2563eb;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---- aux modal ---- */
.aux-modal-body {
  padding: 12px 22px 0;
}

.aux-toolbar {
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.aux-check-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  user-select: none;
}

.aux-check-all input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
  cursor: pointer;
}

.aux-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 50vh;
  overflow: auto;
}

.aux-row {
  transition: background 0.12s;
}

.aux-row:hover td {
  background: #f8fafc;
}

.aux-row-checked td {
  background: #eff6ff;
}

.aux-check {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.aux-check input[type="checkbox"] {
  width: 17px;
  min-width: 17px;
  height: 17px;
  margin-bottom: 6px;
  accent-color: var(--brand);
  cursor: pointer;
}

.aux-info {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.aux-info-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}

.aux-info-name-field { width: 120px; flex-shrink: 0; }
.aux-info-model-field { flex: 1; min-width: 120px; }
.aux-info-unit-field { width: 48px; flex-shrink: 0; }
.aux-param-field { flex: 1; min-width: 140px; }

.aux-name {
  font-weight: 650;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}

.aux-model {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aux-name-input,
.aux-model-input,
.aux-unit-input,
.aux-remark {
  width: 100%;
  min-height: 30px;
  padding: 3px 7px;
  font-size: 12px;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  background: #fff;
}

.aux-unit-input {
  text-align: center;
}

.aux-name-input:focus,
.aux-model-input:focus,
.aux-unit-input:focus,
.aux-remark:focus {
  outline: 2px solid rgba(21,94,239,.18);
  border-color: var(--brand);
}

.aux-inputs {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.aux-del-spacer {
  width: 28px;
  min-width: 28px;
  flex-shrink: 0;
}

.aux-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.aux-label {
  display: block;
  height: 12px;
  line-height: 12px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 650;
  text-align: center;
}

.aux-qty,
.aux-price {
  width: 64px;
  min-height: 30px;
  padding: 3px 6px;
  font-size: 13px;
  text-align: center;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.aux-param-field .aux-remark {
  width: 100%;
}

.aux-qty:focus,
.aux-price:focus {
  outline: 2px solid rgba(21,94,239,.18);
  border-color: var(--brand);
}

.aux-amount {
  width: 72px;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}

.aux-add-row {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.aux-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 2px dashed var(--brand);
  border-radius: 8px;
  background: transparent;
  color: var(--brand);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.aux-add-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: #eff6ff;
}

/* Aux table (in aux modal) */
.aux-table-wrap {
  overflow-x: auto;
}

.aux-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.aux-table th {
  background: #f2f4f7;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 6px;
  text-align: center;
  border-bottom: 1px solid #d0d5dd;
  white-space: nowrap;
}

.aux-table td {
  padding: 5px 4px;
  border-bottom: 1px solid #edf0f3;
}

.aux-table tr.aux-row-checked td {
  background: #eff6ff;
}

.aux-table td input[type="text"],
.aux-table td input[type="number"] {
  width: 100%;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #d0d5dd;
  border-radius: 3px;
  box-sizing: border-box;
}

.aux-table .aux-amount-cell {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}

/* product-aux card */
.product-aux {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}

.product-title-aux {
  cursor: pointer;
}

.product-title-aux:hover {
  color: #d97706;
}

.pill-aux {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.join-btn-aux {
  background: #f59e0b;
}

.join-btn-aux:hover {
  background: #d97706;
}

/* ---- custom tooltip ---- */
.tooltip-box {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #1e293b;
  background: #fff;
  border: 2px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}

.tooltip-box.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Login Overlay ---- */
.login-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
  padding: 40px 36px 36px;
  width: min(400px, 92vw);
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-title {
  font-size: 20px;
  font-weight: 760;
  color: #101828;
  margin: 0 0 6px;
  line-height: 1.3;
}

.login-desc {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  font-weight: 600;
  color: #344054;
}

.login-field input {
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.login-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.12);
}

.login-field input::placeholder {
  color: #98a2b3;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b42318;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.login-btn {
  flex: 1;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  margin-top: 4px;
  letter-spacing: 4px;
  transition: background 0.2s, opacity 0.2s;
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-btn-row {
  display: flex;
  gap: 8px;
}

.login-cancel {
  flex: 1;
  margin-top: 4px;
}

.login-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.login-footer a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.login-footer a:hover {
  text-decoration: underline;
}

.product-idx {
  color: #94a3b8;
  margin-right: 6px;
  font-weight: 600;
  font-size: 14px;
  display: inline-block;
}

/* ============================================================
   MOBILE VERSION — 手机版完整样式
   ============================================================ */

/* Mobile bottom navigation bar (hidden on desktop) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  z-index: 1000;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Mobile export bar (hidden on desktop) */
.mobile-export-bar {
  display: none;
}

.mobile-bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  color: #667085;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-item.active {
  color: var(--brand);
}

.mobile-bottom-nav .nav-icon {
  width: 22px;
  height: 22px;
}

.mobile-bottom-nav .nav-badge {
  position: absolute;
  top: 2px;
  margin-left: 14px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.mobile-bottom-nav .nav-item {
  position: relative;
}

/* Mobile header */
.mobile-header-actions {
  display: none;
}

/* Share button */
.share-btn {
  background: #07c160 !important;
  color: #fff !important;
  border: none !important;
}

.share-btn:hover {
  background: #06ad56 !important;
}

.share-btn svg {
  color: #fff;
}

/* ============================================================
   MEDIA QUERY: Mobile (max-width: 768px)
   ============================================================ */

@media (max-width: 768px) {
  .tooltip-box {
    display: none !important;
  }

  /* --- Global --- */
  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
    overflow-x: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
    padding-bottom: 56px;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0));
  }

  header {
    flex-shrink: 0;
  }

  main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Prevent form elements from breaking the viewport */
  input, select, textarea {
    max-width: 100%;
  }

  /* --- Hide desktop elements --- */
  header .brand-text h1 { font-size: 14px; }
  .app-version-badge {
    margin-left: 0;
    padding: 1px 5px;
    font-size: 10px;
  }
  header .brand-text .subtitle { display: none; }
  header .logo { width: 36px; height: 36px; }
  header .brand { gap: 6px; min-width: 0; flex-shrink: 1; }
  header .brand-text { min-width: 0; overflow: hidden; }

  header {
    padding: 6px 10px;
    border-bottom-width: 3px;
  }

  .topbar {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .topbar .actions {
    gap: 4px;
    flex-wrap: nowrap;
    flex-shrink: 0;
    margin-left: auto;
  }

  .user-avatar {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .user-dropdown-toggle svg:last-child { display: none; }

  .dropdown-toggle span {
    display: none;
  }

  .dropdown-toggle {
    min-width: 36px;
    justify-content: center;
    padding: 0 8px;
  }

  button {
    font-size: 12px;
    min-height: 34px;
    padding: 0 10px;
  }

  button.primary {
    min-height: 36px;
    font-size: 13px;
  }

  .pending-badge {
    font-size: 11px;
    padding: 4px 8px;
  }

  .pending-badge span {
    display: none;
  }

  .pending-badge .pending-dot {
    margin-right: 2px;
  }

  /* --- Mobile bottom nav --- */
  .mobile-bottom-nav {
    display: flex;
  }

  /* --- Main layout: convert to tab panels --- */
  main {
    padding: 0;
    margin: 0;
    flex: 1;
    overflow: hidden;
    max-width: 100%;
  }

  .layout {
    display: block;
    height: 100%;
    overflow: hidden;
    position: relative;
  }

  /* Each panel becomes a full-screen tab */
  .panel {
    display: none;
    position: absolute;
    inset: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);
  }

  .panel.active {
    display: flex;
    flex-direction: column;
  }

  /* ---- Product Library Tab ---- */
  .panel:nth-child(1) {
    /* left panel - becomes library tab */
  }

  .panel:nth-child(1) .panel-head {
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .panel:nth-child(1) .panel-title {
    font-size: 16px;
  }

  .panel:nth-child(1) .note {
    display: none;
  }

  .library-count-card {
    margin: 8px 12px;
    padding: 8px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fbff;
  }

  .library-count-label {
    font-size: 12px;
    letter-spacing: 0;
  }

  .library-count-number {
    margin: 0;
    font-size: 22px;
  }

  .toolbar {
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 49px;
    z-index: 9;
  }

  .toolbar input {
    font-size: 15px;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f2f4f7;
    border: none;
  }

  .toolbar input:focus {
    background: #fff;
    border: 1.5px solid var(--brand);
    outline: none;
  }

  .product-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .product-group-head {
    min-height: 38px;
    padding: 0 12px;
  }

  .product-group-title {
    font-size: 13px;
  }

  .product {
    padding: 6px 12px;
    overflow: hidden;
    gap: 8px;
  }

  .product-index {
    flex-basis: 22px;
    width: 22px;
    font-size: 12px;
    line-height: 1.25;
  }

  .product-info {
    gap: 2px;
  }

  .product-controls {
    min-height: 0;
    gap: 3px;
  }

  .product-title {
    font-size: 13px;
    line-height: 1.25;
    min-width: 0;
    white-space: nowrap; /* 强力禁止在空格处折行，保持单行平铺 */
    overflow: hidden; /* 超出部分隐藏 */
    text-overflow: ellipsis; /* 超出部分显示优雅的省略号 */
    display: block; /* 确保省略号与不折行布局在 flex 内生效 */
    width: 100%; /* 撑满左侧的全部可用空间，使左侧视觉更宽 */
  }

  .product-info .pill-price,
  .product-info .pill-price-zero,
  .product-info .pill-price-edit {
    align-self: flex-start;
    margin-top: 0;
    font-size: 12px;
    padding: 3px 9px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
  }

  .product-info .pill-price-edit input {
    width: 58px;
    font-size: 12px;
  }

  .product-action {
    flex-shrink: 0;
    border-radius: 6px;
    margin-left: auto;
  }

  .qty-input {
    width: 34px;
    min-height: 24px;
    font-size: 12px;
  }

  .join-btn {
    min-height: 24px;
    padding: 0 8px;
    font-size: 11px;
  }

  .pill {
    font-size: 10px;
    padding: 1px 6px;
    max-width: 55vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pill-price-edit input {
    width: 48px;
    font-size: 10px;
  }

  .product-aux {
    margin: 8px 10px;
    border: 1px solid #fcd34d;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    background: #fffbeb;
  }

  .product-aux .product-title {
    font-size: 14px;
    font-weight: 800;
  }

  .product-aux .product-controls {
    min-height: 0;
  }

  .join-btn-aux {
    min-width: 62px;
    border-radius: 6px;
  }

  /* ---- Quote Tab ---- */
  .panel:nth-child(2) {
    /* right panel - becomes quote tab */
  }

  .panel:nth-child(2) .panel-head {
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    flex-shrink: 0;
  }

  .panel:nth-child(2) .panel-head .panel-title {
    font-size: 16px;
  }

  .panel:nth-child(2) .panel-head .note {
    display: none;
  }

  /* Project info - collapsible on mobile */
  .project {
    padding: 12px 20px;
    gap: 8px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
  }

  .project .field-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .project .field {
    min-width: 0;
  }

  .project .field label {
    font-size: 11px;
  }

  .project .field input,
  .project .field select {
    font-size: 14px;
    min-height: 36px;
    padding: 8px 10px;
    min-width: 0;
  }

  .project .field .date-input-group {
    height: 36px;
  }

  .project .field .date-input-group input {
    min-height: 0;
    height: 100%;
    border: none;
    border-radius: 0;
    padding: 0 6px;
  }

  .project .field .date-picker-btn {
    flex-basis: 36px;
    width: 36px;
  }

  #quoteDate,
  #taxRate {
    font-size: 12px;
    padding-left: 6px;
    padding-right: 6px;
  }

  .info-box {
    padding: 14px 10px 10px;
    border-radius: 8px;
  }

  .info-box-title {
    font-size: 11px;
    top: -8px;
  }

  /* Summary bar - compact */
  .summary {
    grid-template-columns: 1fr 1fr;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
  }

  .metric {
    padding: 10px 20px;
    border-right: 1px solid #f2f4f7;
    border-bottom: 1px solid #f2f4f7;
  }

  .metric:nth-child(even) { border-right: 0; }

  .metric span {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .metric strong {
    font-size: 15px;
  }

  /* Table - flows with page, horizontal scroll only for table itself */
  .table-wrap {
    flex: none;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    background: #fff;
  }

  table {
    width: 100%;
    min-width: 0 !important;
    font-size: 11px;
    table-layout: auto;
  }

  /* Mobile quote table: compact adaptive columns */
  th {
    padding: 5px 3px;
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
  }

  td {
    padding: 4px 3px;
    font-size: 11px;
    text-align: center;
    vertical-align: middle;
  }

  /* Override fixed colgroup widths from JS on mobile */
  colgroup col {
    width: auto !important;
  }

  td.index {
    width: 1% !important;
    white-space: nowrap;
  }

  td.name {
    width: auto !important;
    white-space: normal;
  }

  td.model {
    width: auto !important;
    min-width: 0;
    font-size: 10px;
    font-weight: 700;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* 品牌、单位列没有 class，用列序号控制 */
  tbody td:nth-child(3),
  tbody td:nth-child(5) {
    width: 1% !important;
    white-space: nowrap;
  }

  td.number {
    width: 1% !important;
    white-space: nowrap;
  }

  td.number input {
    text-align: center;
    font-size: 11px;
  }

  /* 数量列最多 4 位数，单独缩窄；单价列保留原宽 */
  tbody td:nth-child(6).number input {
    width: 42px;
    min-width: 42px;
    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
  }

  td.amount {
    width: 1% !important;
    font-size: 11px;
    white-space: nowrap;
  }

  td.ops {
    width: 1% !important;
    white-space: nowrap;
  }

  button.delete-row {
    width: 28px;
    min-height: 28px;
    padding: 0;
    font-size: 16px;
  }

  /* Empty state */
  .empty {
    padding: 48px 20px;
    font-size: 13px;
  }

  /* --- Mobile Export Bar --- */
  .mobile-export-bar {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 12px 20px 16px;
    gap: 8px;
    flex-shrink: 0;
  }

  .export-bar-label {
    font-size: 11px;
    color: #667085;
    text-align: center;
    font-weight: 500;
  }

  .export-bar-buttons {
    display: flex;
    gap: 8px;
  }

  .export-bar-buttons button {
    flex: 1;
    min-height: 44px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 10px;
    gap: 6px;
    border: none;
    color: #fff;
  }

  .export-bar-buttons .btn-export-param,
  .export-bar-buttons .btn-share-wechat {
    background: #07c160;
  }

  .export-bar-buttons .btn-export-param:hover,
  .export-bar-buttons .btn-share-wechat:hover {
    background: #06ad56;
  }

  /* Desktop export dropdown - hide on mobile */
  #exportDropdown {
    display: none !important;
  }

  #projectDropdown {
    display: none !important;
  }

  /* --- Modals - top sheet on mobile, avoids keyboard covering fields --- */
  .modal-backdrop {
    align-items: flex-start;
    overflow-x: hidden;
    padding-top: env(safe-area-inset-top, 0);
  }

  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px));
    border-radius: 0 0 16px 16px;
    margin: 0;
    box-sizing: border-box;
    animation: mobileSlideDown 0.18s ease;
  }

  #appUpdateModal {
    align-items: center;
    padding: 16px;
  }

  #appUpdateModal .app-update-modal {
    width: min(92vw, 500px) !important;
    max-width: 92vw !important;
    border-radius: 18px;
    animation: slideUp 0.18s ease;
  }

  .modal-head {
    padding: 14px 18px;
  }

  .modal-body {
    padding: 14px 18px;
    overflow-x: hidden;
  }

  .modal-foot {
    padding: 12px 18px;
  }

  @keyframes mobileSlideDown {
    from { transform: translateY(-12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  /* Aux modal - table layout with horizontal scroll */
  .aux-toolbar {
    padding-bottom: 8px;
  }

  .aux-list {
    overflow: visible;
  }

  .aux-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -18px;
    padding: 0 18px;
  }

  .aux-table {
    width: max-content;
    min-width: 0;
    table-layout: auto;
    font-size: 12px;
    border-collapse: collapse;
  }

  .aux-table th {
    background: #f2f4f7;
    color: #344054;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 4px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid #d0d5dd;
  }

  .aux-table td {
    padding: 4px 3px;
    border-bottom: 1px solid #edf0f3;
    vertical-align: middle;
  }

  .aux-table .aux-check-col {
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    text-align: center;
    vertical-align: middle;
    padding-left: 2px;
    padding-right: 2px;
  }

  .aux-table .aux-check-col input[type="checkbox"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0 auto;
    display: block;
    accent-color: var(--brand);
  }

  .aux-table td input[type="text"],
  .aux-table td input[type="number"] {
    min-height: 28px;
    padding: 3px 5px;
    font-size: 12px;
    border: 1px solid #d0d5dd;
    border-radius: 3px;
    box-sizing: border-box;
  }

  .aux-table .aux-name-input { width: 9ch; min-width: 9ch; }
  .aux-table td:nth-child(3) input { width: 7ch; min-width: 7ch; }
  .aux-table td:nth-child(4) input { width: 14ch; min-width: 14ch; }
  .aux-table .aux-unit-input { width: 4ch; min-width: 4ch; text-align: center; }
  .aux-table td:nth-child(6) input { width: 14ch; min-width: 14ch; }

  .aux-table td:nth-child(7),
  .aux-table td:nth-child(8) {
    width: 1% !important;
    white-space: nowrap;
  }

  .aux-table .aux-qty {
    width: 5ch !important;
    min-width: 5ch !important;
    max-width: 5ch !important;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
  }

  .aux-table .aux-price {
    width: 6ch !important;
    min-width: 6ch !important;
    max-width: 6ch !important;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
  }

  .aux-table .aux-amount-cell {
    text-align: right;
    font-weight: 700;
    font-size: 12px;
    color: var(--brand);
    white-space: nowrap;
    padding-right: 6px;
  }

  .aux-table td:first-child,
  .aux-table th:first-child {
    text-align: center;
  }

  .aux-table td:last-child {
    text-align: center;
  }

  /* "添加器材" "添加耗材" - stick to viewport, no horizontal scroll */
  .add-aux-row td {
    padding: 8px 0;
    background: #fff;
  }

  .add-aux-row .aux-add-btn {
    position: sticky;
    left: 20px;
    right: 20px;
    width: calc(100vw - 40px);
    margin: 0;
    border-color: var(--brand);
  }
  .spec-check-label {
    font-size: 13px;
  }

  /* Avatar crop - fit mobile screen */
  .crop-container {
    width: 260px;
    height: 260px;
  }

  .crop-circle-mask {
    top: 40px;
    left: 40px;
    width: 180px;
    height: 180px;
  }

  .avatar-preview-circle {
    width: 72px;
    height: 72px;
  }

  .avatar-upload-placeholder {
    font-size: 11px;
  }

  /* Login overlay - centered card */
  .login-overlay {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .login-card {
    padding: 28px 20px 24px;
    width: calc(100vw - 32px);
    max-width: 360px;
    border-radius: 14px;
    max-height: none;
    overflow-y: visible;
    margin: 20px auto;
  }

  .login-brand {
    margin-bottom: 20px;
  }

  .login-title {
    font-size: 18px;
  }

  .login-desc {
    font-size: 13px;
  }

  .login-form {
    gap: 14px;
  }

  .login-field input {
    font-size: 16px;
    padding: 10px 12px;
  }

  .login-btn {
    font-size: 15px;
    min-height: 46px;
    letter-spacing: 2px;
  }

  .login-btn-row {
    gap: 8px;
  }

  .login-tabs {
    margin-bottom: 16px;
  }

  .login-tab {
    font-size: 13px;
    padding: 6px 8px;
  }

  /* Admin layout (when on mobile) */
  .admin-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 12px 14px;
    gap: 10px;
    background: #fff;
  }

  .admin-header-left {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  .admin-back-link {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
  }

  .admin-header-title {
    font-size: 18px;
    font-weight: 800;
    text-align: left;
  }

  .admin-header-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid #eef2f6;
  }

  .admin-header-user {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #667085;
  }

  .admin-header-right button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px !important;
    border-radius: 999px;
  }

  .admin-container {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 12px;
    overflow-x: hidden;
    flex-shrink: 0;
  }

  .admin-sidebar-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .sidebar-item {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 12px;
    white-space: normal;
    flex-shrink: 1;
    gap: 6px;
    justify-content: center;
    text-align: center;
  }

  .sidebar-item.active::before {
    display: none;
  }

  .sidebar-icon {
    width: 14px;
    height: 14px;
  }

  .sidebar-badge {
    font-size: 9px;
    min-width: 14px;
    padding: 1px 4px;
  }

  .admin-main {
    padding: 16px 14px;
  }

  .admin-summary {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .admin-stat {
    padding: 14px 16px;
  }

  .admin-stat strong {
    font-size: 24px;
  }

  /* User cards */
  .user-card {
    padding: 14px 16px;
  }

  .user-card-main {
    gap: 10px;
  }

  .admin-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .admin-actions button,
  .admin-actions select {
    font-size: 11px;
    min-height: 28px;
    padding: 0 8px;
  }

  /* Quote records table */
  .admin-filter-bar {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 10px;
    padding: 12px;
  }

  .admin-filter-bar .filter-item {
    flex: none;
    width: 100%;
  }

  .admin-filter-bar .filter-item.filter-item-half {
    width: calc(50% - 5px) !important;
  }
}

/* --- iPhone notch / dynamic island safe areas --- */
@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 768px) {
    header {
      padding-top: calc(6px + env(safe-area-inset-top));
    }
  }
}

.modal.modal-danger {
  border: 2px solid var(--danger) !important;
}
.text-danger {
  color: var(--danger) !important;
  font-weight: 700;
}

/* Login registration tabs */
.login-tabs {
  display: flex;
  background: #f2f4f7;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}

.login-tab {
  flex: 1;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: #475467;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.login-tab.active {
  background: #fff;
  color: #101828;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
}

/* Avatar Upload Preview styles */
.avatar-upload-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px auto 25px;
}

.avatar-preview-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #f2f4f7;
  border: 2px dashed #d0d5dd;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.avatar-preview-circle:hover {
  border-color: var(--brand);
  background: #f8f9fc;
}

.avatar-preview-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-upload-placeholder {
  font-size: 13px;
  color: #475467;
  font-weight: 500;
  text-align: center;
  padding: 4px;
}

/* Avatar Cropper Modal styles */
.crop-container {
  width: 300px;
  height: 300px;
  background: #000;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  border-radius: 8px;
  user-select: none;
  touch-action: none;
}

.crop-image {
  position: absolute;
  top: 50%;
  left: 50%;
  cursor: move;
  cursor: grab;
  max-width: none;
  max-height: none;
}

.crop-image:active {
  cursor: grabbing;
}

.crop-circle-mask {
  position: absolute;
  top: 50px;
  left: 50px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  box-sizing: border-box;
}

.crop-zoom-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
  padding: 0 10px;
}

.crop-zoom-label {
  font-size: 14px;
  color: #344054;
  font-weight: 500;
  white-space: nowrap;
}

.crop-zoom-slider {
  flex: 1;
  height: 6px;
  background: #eaecf0;
  border-radius: 3px;
  outline: none;
  accent-color: var(--brand);
  cursor: pointer;
}

/* 隐藏具体产品 input 关联 datalist 时浏览器自带的默认下拉小三角 */
#filterProduct::-webkit-calendar-picker-indicator {
  display: none !important;
}

/* 用户角色下拉：自定义菜单，跟报价单记录筛选下拉保持一致 */
.admin-actions .custom-select-wrapper {
  position: relative;
  display: inline-flex;
  flex: 0 0 168px;
  width: 168px;
  height: 36px;
  overflow: visible;
  background: transparent;
  box-sizing: border-box;
  align-items: center;
  vertical-align: middle;
}

.admin-actions .role-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: none;
  width: 100%;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 42px 0 12px !important;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-sizing: border-box;
  color: #334155;
  cursor: pointer;
  text-align: left;
}

.admin-actions .role-select-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 400;
}

.admin-actions .role-select-trigger::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 36px;
  height: 100%;
  background: #2563eb;
  pointer-events: none;
  transition: background 0.2s;
}

.admin-actions .role-select-trigger:hover::after {
  background: #1d4ed8;
}

.admin-actions .custom-select-wrapper .select-arrow {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #fff;
  display: flex;
  align-items: center;
  z-index: 2;
}

.admin-actions .role-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  padding: 4px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  z-index: 9999;
  box-sizing: border-box;
}

.admin-actions .role-dropdown-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 0 8px !important;
  border: none;
  border-radius: 5px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.admin-actions .role-dropdown-option:hover,
.admin-actions .role-dropdown-option.is-active {
  background: #eff6ff;
  color: #1d4ed8;
}

.admin-actions .role-dropdown-check {
  font-weight: 800;
}

.admin-actions button {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.user-card .admin-actions > button {
  flex: 0 0 116px;
  width: 116px;
}

.user-card .admin-actions > button.danger {
  flex-basis: 116px;
}

.admin-actions .role-select-trigger,
.admin-actions .role-dropdown-option {
  flex: none;
  text-align: left;
}

/* 针对窄屏/移动端下的操作按钮间距进行微调，防止任何按钮折行挤出多余空间 */
@media (max-width: 540px) {
  .admin-actions {
    gap: 6px !important;
  }
  .admin-actions button {
    padding: 0 4px !important;
    font-size: 11px !important;
  }
  .user-card .admin-actions > button {
    flex: 1 1 0 !important;
    width: auto !important;
  }
  .admin-actions .custom-select-wrapper {
    flex: 0 0 124px !important;
    width: 124px !important;
    min-width: 124px !important;
  }
  .admin-actions .role-select-trigger {
    padding: 0 38px 0 10px !important;
  }
  .admin-actions .role-select-label,
  .admin-actions .role-dropdown-option {
    font-size: 12px !important;
  }
  .admin-actions .role-dropdown-option {
    min-height: 32px !important;
    padding: 0 8px !important;
  }
}


