/* === Components v4.0 === */
/* Modern component library with glass morphism and glow effects */

/* ── Layout ── */
.app { display: none; }
.app.active { display: block; }

/* ── Header ── */
.header {
  background: var(--bg-surface);
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-primary) 100%);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  backdrop-filter: blur(10px);
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.header h1 {
  font-size: 18px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 0 20px var(--accent-glow);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header h1::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
  animation: glow 2s ease-in-out infinite;
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 12px;
  color: var(--text-secondary);
}

.header-user button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.header-user button:hover { 
  color: var(--red); 
  border-color: var(--red);
  background: var(--red-dim);
}

/* ── Server Selector ── */
.server-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-family);
  transition: all var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300ff88' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.server-select:focus { 
  border-color: var(--accent); 
  outline: none;
  box-shadow: var(--border-glow);
}

/* ── Navigation Tabs ── */
.tabs {
  display: flex;
  background: var(--bg-surface);
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-md);
  gap: var(--space-xs);
}

.tabs::-webkit-scrollbar { height: 0; }

.tab {
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-normal);
  position: relative;
  margin-bottom: -1px;
}

.tab::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition-normal);
}

.tab:hover { 
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab.active { 
  color: var(--accent); 
}

.tab.active::before {
  width: 60%;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ── Pages ── */
.pages { 
  max-width: 1400px; 
  margin: 0 auto; 
  padding: var(--space-xl); 
}

.page { 
  display: none; 
  animation: fadeInUp 0.3s ease-out;
}

.page.active { display: block; }

/* ── Cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  border: 1px solid var(--border);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md), 0 0 20px var(--accent-dim);
}

.card .label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.card .value {
  font-size: 28px;
  font-weight: 700;
  margin: var(--space-xs) 0;
  line-height: 1.2;
}

.card .value.green { color: var(--green); }
.card .value.red { color: var(--red); }
.card .value.gold { color: var(--gold); }
.card .value.accent { color: var(--accent); }

/* Metric Card variant */
.metric-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
}

.metric-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.metric-card.green::before { background: var(--green); }
.metric-card.red::before { background: var(--red); }
.metric-card.gold::before { background: var(--gold); }
.metric-card.cyan::before { background: var(--cyan); }

/* ── Section ── */
.section {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  border: 1px solid var(--border);
  margin-bottom: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
}

.section h3 {
  color: var(--accent);
  margin-bottom: var(--space-md);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.3px;
}

/* Glass section variant */
.section.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
}

/* ── Forms ── */
.form-group { margin-bottom: var(--space-lg); }

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-family);
  transition: all var(--transition-fast);
}

.form-group input:hover,
.form-group select:hover {
  border-color: var(--border-hover);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Inline validation */
.form-error {
  font-size: 11px;
  color: var(--red);
  margin-top: var(--space-xs);
  display: none;
}

.form-error.show { display: block; }

/* Form row (multi-column) */
.frow { 
  display: flex; 
  gap: var(--space-sm); 
  margin-bottom: var(--space-sm); 
  flex-wrap: wrap; 
  align-items: end; 
}

.fcol { 
  display: flex; 
  flex-direction: column; 
  gap: var(--space-xs); 
}

.fcol label { 
  font-size: 11px; 
  color: var(--text-secondary); 
  font-weight: 500; 
}

.fcol input, .fcol select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-family);
  transition: all var(--transition-fast);
}

.fcol input:hover, .fcol select:hover {
  border-color: var(--border-hover);
}

.fcol input:focus, .fcol select:focus { 
  border-color: var(--accent); 
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Input sizes */
.input-sm {
  padding: var(--space-xs) var(--space-sm) !important;
  font-size: 12px !important;
}

.input-lg {
  padding: var(--space-md) var(--space-lg) !important;
  font-size: 16px !important;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xl);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 40px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover { 
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn:active { 
  transform: scale(0.98); 
}

.btn:disabled { 
  opacity: 0.5; 
  cursor: not-allowed; 
  transform: none;
}

.btn:disabled::before { display: none; }

/* Primary button */
.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Danger button */
.btn-danger { 
  border-color: var(--red);
  color: var(--red);
}

.btn-danger:hover { 
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* Success button */
.btn-success { 
  border-color: var(--green);
  color: var(--green);
}

.btn-success:hover { 
  background: var(--green);
  color: #000;
  border-color: var(--green);
}

/* Ghost button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Button sizes */
.btn-sm { 
  padding: var(--space-xs) var(--space-md); 
  font-size: 12px; 
  min-height: 32px;
}

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

.btn-lg {
  padding: var(--space-md) var(--space-2xl);
  font-size: 15px;
  min-height: 48px;
}

.btn-icon {
  padding: var(--space-sm);
  min-width: 40px;
  width: auto;
  aspect-ratio: 1;
}

/* Button loading spinner */
.btn .spinner {
  display: none;
  width: 14px; 
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { display: none; }

/* Button group */
.btn-group {
  display: flex;
  gap: var(--space-xs);
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Tables ── */
.table-wrap { 
  overflow-x: auto; 
  max-height: 500px; 
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table { 
  width: 100%; 
  border-collapse: collapse; 
  font-size: 13px;
}

th {
  background: var(--bg-elevated);
  color: var(--accent);
  padding: var(--space-md) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td { 
  padding: var(--space-md); 
  border-bottom: 1px solid var(--border); 
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td { 
  background: var(--bg-hover);
}

td strong { color: var(--text-primary); }

/* Row animations */
tr.row-new { animation: rowHighlight 1.5s ease-out; }

@keyframes rowHighlight {
  0% { background: var(--accent-dim); }
  100% { background: transparent; }
}

tr.row-deleted { animation: rowFadeOut 0.4s ease-out forwards; }

@keyframes rowFadeOut {
  to { background: var(--red-dim); opacity: 0; transform: translateX(20px); }
}

/* ── Sniping ── */
.bargain-red { 
  background: var(--red-dim) !important; 
  border-left: 3px solid var(--red);
}

.bargain-yellow { 
  background: var(--gold-dim) !important; 
  border-left: 3px solid var(--gold);
}

/* Sniping result cards */
.snipe-cards { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
  gap: var(--space-md); 
}

.snipe-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  position: relative;
  transition: all var(--transition-normal);
}

.snipe-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.snipe-card.bargain { 
  border-color: var(--red);
  animation: pulseBorder 2s ease-out 3; 
}

.snipe-card.imported { 
  opacity: 0.6; 
  border-color: var(--green);
}

.snipe-card.imported::after {
  content: '✓ 已入库';
  position: absolute;
  top: var(--space-sm); 
  right: var(--space-sm);
  font-size: 10px;
  color: var(--green);
  font-weight: 700;
  background: var(--green-dim);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

@keyframes pulseBorder {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 71, 87, 0); }
}

/* ── Screen Share ── */
.screen-area { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: var(--space-lg); 
}

.screen-preview {
  background: #000;
  border-radius: var(--radius-md);
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  position: relative;
  overflow: hidden;
}

.screen-preview video { 
  max-width: 100%; 
  max-height: 400px; 
  display: none; 
}

.screen-preview video.active { display: block; }

.capture-wrap {
  position: relative;
  display: inline-block;
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: crosshair;
}

.capture-wrap canvas { 
  max-width: 100%; 
  max-height: 300px; 
  display: block; 
}

.bargain-overlay { 
  position: absolute; 
  pointer-events: none; 
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius);
  z-index: var(--z-toast);
  display: none;
  font-size: 13px;
  font-weight: 500;
  animation: slideInRight var(--transition-slow) ease-out;
  border: 1px solid var(--green);
  box-shadow: var(--shadow-lg);
  max-width: 350px;
}

.toast.show { display: flex; align-items: center; gap: var(--space-sm); }

.toast::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
}

.toast.error { 
  border-color: var(--red);
  background: var(--red-dim);
}

.toast.error::before { content: '✕'; color: var(--red); }

.toast.info { 
  border-color: var(--accent);
  background: var(--accent-dim);
}

.toast.info::before { content: 'ℹ'; color: var(--accent); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-normal);
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  max-width: 600px;
  width: 90%;
  border: 1px solid var(--border);
  max-height: 85vh;
  overflow-y: auto;
  animation: scaleIn var(--transition-normal) ease-out;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.modal h3 {
  color: var(--accent);
  margin-bottom: var(--space-lg);
  font-size: 16px;
  font-weight: 600;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 0%, var(--bg-elevated) 50%, var(--bg-surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

.skeleton-text { height: 14px; margin-bottom: var(--space-sm); width: 80%; }
.skeleton-text.short { width: 50%; }
.skeleton-value { height: 28px; margin-bottom: var(--space-xs); width: 60%; }
.skeleton-card { height: 80px; }
.skeleton-row { height: 32px; margin-bottom: var(--space-xs); }
.skeleton-chart { height: 300px; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-4xl) var(--space-xl);
  color: var(--text-secondary);
}

.empty-state .empty-icon { 
  font-size: 56px; 
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state h3 { 
  color: var(--text-primary); 
  margin-bottom: var(--space-sm); 
  font-size: 18px;
}

.empty-state p { 
  margin-bottom: var(--space-xl); 
  font-size: 14px; 
  color: var(--text-tertiary);
}

.empty-state .btn { 
  display: inline-flex; 
  width: auto; 
}

/* ── Error State ── */
.error-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
  border: 1px dashed var(--red);
  border-radius: var(--radius-md);
  background: var(--red-dim);
}

.error-state p { margin-bottom: var(--space-md); color: var(--red); }

/* ── Tag ── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 20px;
  height: 20px;
}

.badge-success { background: var(--green-dim); color: var(--green); }
.badge-danger { background: var(--red-dim); color: var(--red); }
.badge-warning { background: var(--gold-dim); color: var(--gold); }
.badge-info { background: var(--blue-dim); color: var(--blue); }

/* ── Toggle ── */
.toggle { 
  position: relative; 
  width: 44px; 
  height: 24px; 
  display: inline-block; 
}

.toggle input { 
  opacity: 0; 
  width: 0; 
  height: 0; 
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  transition: var(--transition-normal);
  border: 1px solid var(--border);
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px; 
  width: 18px;
  left: 3px; 
  bottom: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition-normal);
}

.toggle input:checked + .toggle-slider { 
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before { 
  transform: translateX(20px); 
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ── Auth Pages ── */
.auth-page {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: var(--space-xl);
}

.auth-page.active { 
  display: flex; 
}

.auth-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-3xl);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.auth-card h1 { 
  color: var(--accent); 
  text-align: center; 
  margin-bottom: var(--space-xs); 
  font-size: 24px;
  font-weight: 700;
}

.auth-card .subtitle { 
  text-align: center; 
  color: var(--text-secondary); 
  margin-bottom: var(--space-2xl); 
  font-size: 13px; 
}

.auth-link { 
  text-align: center; 
  margin-top: var(--space-xl); 
  font-size: 13px; 
  color: var(--text-secondary); 
}

.auth-link a { 
  color: var(--accent); 
  cursor: pointer; 
  font-weight: 600; 
}

.auth-link a:hover { text-decoration: underline; }

/* ── Donate ── */
.donate-qr { 
  display: flex; 
  gap: var(--space-2xl); 
  justify-content: center; 
  flex-wrap: wrap; 
  margin-top: var(--space-lg); 
}

.donate-item { 
  text-align: center; 
}

.donate-item img { 
  width: 180px; 
  height: 180px; 
  background: #fff; 
  border-radius: var(--radius-md); 
  padding: var(--space-sm);
  border: 1px solid var(--border);
}

.donate-item p { 
  font-size: 12px; 
  color: var(--text-secondary); 
  margin-top: var(--space-sm); 
  font-weight: 500; 
}

/* ── Chart ── */
.chart-container {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  margin-bottom: var(--space-lg);
  position: relative;
  min-height: 350px;
}

.chart-container canvas { 
  width: 100% !important; 
  height: 300px !important; 
}

/* ── Dropdown ── */
.item-dd {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  display: none;
  animation: fadeInDown var(--transition-fast) ease-out;
}

.item-dd.show { display: block; }

.item-dd div { 
  padding: var(--space-sm) var(--space-md); 
  cursor: pointer; 
  font-size: 13px; 
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.item-dd div:hover { 
  background: var(--accent-dim); 
  color: var(--text-primary); 
}

.item-search-wrap { position: relative; }

/* ── Banner ── */
.banner {
  padding: var(--space-sm) var(--space-lg);
  background: var(--red-dim);
  border-bottom: 1px solid var(--red);
  color: var(--red);
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  display: none;
}

.banner.show { display: block; }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-tertiary);
  font-size: 11px;
  border-top: 1px solid var(--border);
  margin-top: var(--space-3xl);
  letter-spacing: 0.5px;
}

.footer span { color: var(--accent); }

/* ── Median Toggle ── */
.median-toggle { 
  display: flex; 
  gap: 2px; 
  background: var(--bg-elevated); 
  border-radius: var(--radius);
  padding: 2px;
  border: 1px solid var(--border);
}

.median-toggle span { 
  padding: var(--space-xs) var(--space-md); 
  cursor: pointer; 
  font-size: 12px; 
  font-weight: 500;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
}

.median-toggle span.active { 
  background: var(--accent); 
  color: #000;
}

.median-toggle span:not(.active) { 
  color: var(--text-secondary);
}

.median-toggle span:not(.active):hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── Box Opener ── */
.box-skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.box-skill-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
}

.box-skill-card:hover { 
  border-color: var(--accent);
  transform: translateY(-2px);
}

.box-skill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.box-skill-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.box-skill-pool {
  font-size: 11px;
  color: var(--text-tertiary);
}

.box-skill-inputs {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ── Forecast Cards ── */
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.forecast-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.forecast-card:hover { 
  border-color: var(--accent);
  transform: translateY(-2px);
}

.forecast-card.retail { 
  border-left: 3px solid var(--accent);
}

.forecast-card.wholesale { 
  border-left: 3px solid var(--text-tertiary);
  opacity: 0.85;
}

.forecast-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 0 2px 0 0;
  transition: width 0.3s ease;
}

.forecast-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.forecast-qty {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.forecast-card.wholesale .forecast-qty {
  color: var(--text-secondary);
}

.forecast-pct {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: var(--space-xs) 0 var(--space-sm);
}

.forecast-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
}

/* ── Metric components ── */
.metric-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-value.accent { color: var(--accent); }
.metric-value.green { color: var(--green); }
.metric-value.red { color: var(--red); }

/* ── Strategy Page ── */

/* Data count badge */
.badge-data {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-data.high { background: var(--green-dim); color: var(--green); }
.badge-data.medium { background: var(--gold-dim); color: var(--gold); }
.badge-data.low { background: var(--red-dim); color: var(--red); }

/* Strategy mode badge */
.badge-strategy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-strategy.speed { 
  background: var(--accent-dim); 
  color: var(--accent); 
  border: 1px solid var(--accent);
}

.badge-strategy.balance { 
  background: var(--blue-dim); 
  color: var(--blue); 
  border: 1px solid var(--blue);
}

.badge-strategy.profit { 
  background: var(--gold-dim); 
  color: var(--gold); 
  border: 1px solid var(--gold);
}

/* Strategy legend */
.strategy-legend {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Suggested price cell */
.suggested-price {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  text-align: right;
}

.expected-profit {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
}

/* Strategy summary cards */
.strategy-summary .cards {
  grid-template-columns: repeat(4, 1fr);
}

.strategy-summary .metric-icon {
  font-size: 20px;
  margin-bottom: var(--space-xs);
}

.strategy-summary .metric-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.strategy-summary .metric-value {
  font-size: 24px;
  font-weight: 700;
}

/* Price range inline */
.price-range {
  font-size: 10px;
  color: var(--text-tertiary);
  display: block;
}

/* ── Progress Bar ── */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar.success { background: var(--green); }
.progress-bar.warning { background: var(--gold); }
.progress-bar.danger { background: var(--red); }

/* ── Tooltip ── */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  border: 1px solid var(--border);
  z-index: var(--z-tooltip);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-8px);
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

.divider-vertical {
  width: 1px;
  background: var(--border);
  margin: 0 var(--space-lg);
}

/* ── Avatar ── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid var(--accent);
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

/* ── Alert ── */
.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius);
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.alert-success {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}

.alert-danger {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}

.alert-warning {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

.alert-info {
  background: var(--blue-dim);
  border-color: var(--blue);
  color: var(--blue);
}

/* ── Responsive ── */
@media (max-width: 1023px) {
  .screen-area { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .header { padding: var(--space-sm) var(--space-md); }
  .header h1 { font-size: 16px; }
  .pages { padding: var(--space-lg); }
}

@media (max-width: 767px) {
  .box-skills-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: var(--space-sm) var(--space-md); font-size: 12px; }
  .header { flex-wrap: wrap; gap: var(--space-sm); }
  .header h1 { font-size: 14px; }
  .pages { padding: var(--space-md); }
  .section { padding: var(--space-lg); }
  .card { padding: var(--space-md); }
  .modal { padding: var(--space-lg); width: 95%; }
  .snipe-cards { grid-template-columns: 1fr; }
  .frow { flex-direction: column; }
  .table-wrap { max-height: 350px; }
  .forecast-grid { grid-template-columns: 1fr; }
  .strategy-summary .cards { grid-template-columns: repeat(2, 1fr); }
  .strategy-legend { flex-direction: column; gap: var(--space-sm); }
  .toast {
    left: var(--space-md);
    right: var(--space-md);
    bottom: var(--space-md);
    top: auto;
    transform: none;
  }
}
