* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --apple-blue: #007AFF;
  --apple-blue-hover: #0063D1;
  --apple-blue-light: rgba(0, 122, 255, 0.08);
  --apple-blue-medium: rgba(0, 122, 255, 0.12);
  --bg: #F5F5F7;
  --sidebar-bg: rgba(245, 245, 247, 0.92);
  --sidebar-border: rgba(0, 0, 0, 0.08);
  --card-bg: #FFFFFF;
  --border: #D2D2D7;
  --border-light: #E8E8ED;
  --text: #1D1D1F;
  --text-secondary: #86868B;
  --text-tertiary: #AEAEB2;
  --fill-tertiary: rgba(118, 118, 128, 0.12);
  --fill-quaternary: rgba(118, 118, 128, 0.08);
  --success: #34C759;
  --success-bg: rgba(52, 199, 89, 0.1);
  --warning: #FF9500;
  --warning-bg: rgba(255, 149, 0, 0.1);
  --danger: #FF3B30;
  --danger-bg: rgba(255, 59, 48, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Sidebar — macOS Sonoma style ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid var(--sidebar-border);
  padding: 20px 0;
  flex-shrink: 0;
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.logo {
  padding: 4px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}
.logo h2 {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.logo span {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

.nav-menu {
  list-style: none;
  margin-top: 12px;
  padding: 0 12px;
  flex: 1;
  overflow-y: auto;
}
.nav-item {
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-item:hover {
  background: var(--fill-quaternary);
}
.nav-item.active {
  background: var(--apple-blue);
  color: #FFFFFF;
}

.nav-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 8px 4px;
  list-style: none;
}

/* ===== Content ===== */
.content {
  flex: 1;
  margin-left: 240px;
  padding: 40px 48px;
  max-width: 1200px;
}
.page { display: none; }
.page.active { display: block; }
.page-desc {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 14px;
  font-weight: 400;
}

/* ===== Page titles ===== */
.content h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 8px;
}

/* ===== Steps ===== */
.step { margin-bottom: 32px; }
.step-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

/* ===== Upload ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 44px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--card-bg);
}
.upload-area:hover,
.upload-area.dragover {
  border-color: var(--apple-blue);
  background: var(--apple-blue-light);
}
.upload-icon {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-icon svg {
  width: 36px;
  height: 36px;
  color: var(--text-tertiary);
  stroke-width: 1.5;
}
.upload-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* Upload grid */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.upload-card { position: relative; }
.upload-area-sm { padding: 24px 16px; }
.upload-area-sm .upload-icon svg {
  width: 28px;
  height: 28px;
}
.upload-area-sm p { font-size: 13px; font-weight: 500; color: var(--text); }
.upload-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  min-height: 20px;
}
.upload-done .upload-area {
  border-color: var(--success);
  border-style: solid;
  background: var(--success-bg);
  pointer-events: none;
  opacity: 0.9;
}
.upload-done .upload-area .upload-icon svg { color: var(--success); }
.upload-done .upload-status {
  color: var(--success);
  font-weight: 600;
}

.upload-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--apple-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.upload-card.upload-loading {
  position: relative;
  pointer-events: none;
}
.upload-card.upload-loading .upload-area {
  border-color: var(--apple-blue);
  background: var(--apple-blue-light);
}
.upload-card.upload-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  pointer-events: none;
}

/* ===== Price config ===== */
.price-config {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.price-config h3 {
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 600;
}
.price-grid {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}
.price-group h4 {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: none;
}
.price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.price-row label {
  width: 34px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.price-row input {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  text-align: right;
  background: var(--card-bg);
  transition: border-color var(--transition);
  font-family: inherit;
}
.price-row input:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.price-row span { font-size: 12px; color: var(--text-tertiary); }

/* ===== Items section ===== */
.items-section {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.items-header h3 {
  font-size: 15px;
  font-weight: 600;
}
.toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toggle-label input {
  accent-color: var(--apple-blue);
  margin: 0;
}

/* ===== Table ===== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 1;
}
th:first-child { border-radius: var(--radius-xs) 0 0 0; }
th:last-child { border-radius: 0 var(--radius-xs) 0 0; }
tr:hover { background: var(--fill-quaternary); }
tr:last-child td { border-bottom: none; }
tr.zero-row { opacity: 0.35; }
tr.special-row { background: var(--warning-bg); }
tr.special-row:hover { background: rgba(255, 149, 0, 0.15); }

/* ===== Buttons ===== */
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--apple-blue);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: var(--apple-blue-hover);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: var(--radius-xs);
}
.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
}
.btn-danger:hover { background: #E0352B; }
.btn-warning {
  background: var(--warning);
  color: #FFFFFF;
}
.btn-warning:hover { background: #E08600; }
.btn-outline {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--fill-quaternary);
  border-color: var(--text-tertiary);
}

/* ===== Badge ===== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--fill-tertiary);
  color: var(--text-secondary);
}

/* ===== Result ===== */
.result-preview {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.total-row td {
  background: var(--bg);
  border-top: 2px solid var(--text);
  font-weight: 600;
}
.section-header td {
  background: var(--bg);
  font-weight: 700;
  font-size: 14px;
  padding-top: 16px;
}

/* Special price input */
.special-input {
  width: 68px;
  padding: 4px 8px;
  border: 1px solid var(--warning);
  border-radius: var(--radius-xs);
  font-size: 13px;
  text-align: right;
  background: var(--warning-bg);
  font-family: inherit;
  transition: border-color var(--transition);
}
.special-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 149, 0, 0.2);
}

/* ===== Info card ===== */
.info-card {
  background: var(--apple-blue-light);
  border: 1px solid rgba(0, 122, 255, 0.15);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 14px;
}
.info-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}
.info-card p {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ===== Section divider ===== */
.section-divider {
  height: 1px;
  background: var(--border-light);
  margin: 28px 0;
}

/* ===== Result tabs — Apple segmented control style ===== */
.result-tabs {
  display: flex;
  gap: 0;
  background: var(--fill-tertiary);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 4px;
}
.tab-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  font-family: inherit;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  background: var(--card-bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.tab-subtotal {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--fill-tertiary);
  padding: 1px 8px;
  border-radius: 10px;
}
.tab-btn.active .tab-subtotal {
  background: var(--apple-blue-light);
  color: var(--apple-blue);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Grand total */
.grand-total-section {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.grand-total-row td {
  padding: 20px 24px;
  font-size: 20px;
  border: none;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.grand-total-row td:last-child { text-align: right; }

/* ===== Scan warnings ===== */
.scan-warnings {
  background: var(--warning-bg);
  border: 1px solid rgba(255, 149, 0, 0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
}
.scan-warnings h4 {
  color: #9A6700;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}
.scan-warnings ul { list-style: none; padding: 0; }
.scan-warnings li {
  color: #9A6700;
  font-size: 13px;
  padding: 2px 0;
}

.result-preview h3 {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* Box size select */
.box-size-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  background: var(--card-bg);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--transition);
}
.box-size-select:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* Grouped rowspan label */
td.group-label {
  vertical-align: middle;
  text-align: center;
  border-right: 1px solid var(--border-light);
  font-weight: 600;
  color: var(--text-secondary);
}

/* ===== Vendor selection ===== */
.vendor-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.vendor-card {
  background: var(--card-bg);
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 15px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.vendor-card:hover {
  border-color: var(--apple-blue);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.vendor-card.selected {
  border-color: var(--apple-blue);
  background: var(--apple-blue-light);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.vendor-card .vendor-icon {
  width: 40px;
  height: 40px;
  background: var(--fill-tertiary);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.vendor-card .vendor-icon svg {
  width: 22px;
  height: 22px;
  color: var(--text-secondary);
}
.vendor-card.selected .vendor-icon {
  background: var(--apple-blue-medium);
}
.vendor-card.selected .vendor-icon svg {
  color: var(--apple-blue);
}

/* ===== iOS-style toggle switch ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--fill-tertiary);
  border-radius: 24px;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Shipping table visual */
#shipping-table tr.row-zero td { color: var(--border); }
#shipping-table tr.region-main td.group-label { background: rgba(0, 122, 255, 0.05); }
#shipping-table tr.region-island td.group-label { background: rgba(255, 149, 0, 0.06); }
#shipping-table tr.group-sep-carrier > td { border-top: 3px solid #475569; }
#shipping-table tr.group-sep-region > td { border-top: 2px solid #94a3b8; }

tr.box-row-disabled td {
  opacity: 0.4;
  background: var(--bg);
}

tr.platform-row-selected td { background: var(--success-bg); }
tr.platform-row-selected:hover td { background: rgba(52, 199, 89, 0.15); }

/* ===== Detail Panel — macOS sheet style ===== */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
}
.detail-overlay.open { display: block; }

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}
.detail-panel.open { transform: translateX(0); }

.detail-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--card-bg);
}
.detail-panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.detail-close-btn {
  background: var(--fill-tertiary);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  transition: all var(--transition);
}
.detail-close-btn:hover {
  background: var(--fill-tertiary);
  color: var(--text);
}

.detail-panel-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
}

.detail-formula {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.detail-breakdown {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  margin-bottom: 20px;
}
.detail-breakdown th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-light);
  background: none;
  position: static;
}
.detail-breakdown td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.detail-breakdown td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.detail-breakdown tr.detail-total td {
  font-weight: 700;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.detail-source {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* PE bag adjust buttons */
.pe-adj-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--fill-tertiary);
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  margin-left: 3px;
  vertical-align: middle;
  transition: all var(--transition);
}
.pe-adj-btn:hover {
  background: var(--apple-blue);
  color: #FFFFFF;
}
.pe-adj-btn:active { transform: scale(0.9); }

tr.manual-row td:last-child {
  color: var(--danger);
  font-weight: 600;
}

.detail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: none;
  border: 1.5px solid var(--text-tertiary);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  transition: all var(--transition);
}
.detail-btn:hover {
  background: var(--apple-blue);
  border-color: var(--apple-blue);
  color: #FFFFFF;
}

/* ===== Management pages ===== */

.manage-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--apple-blue-light);
  border: 1px solid rgba(0, 122, 255, 0.15);
  border-radius: var(--radius);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.form-input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-family: inherit;
  background: var(--card-bg);
  transition: border-color var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.form-input-full {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-family: inherit;
  background: var(--card-bg);
  transition: border-color var(--transition);
}
.form-input-full:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.form-error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
}
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-msg {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.form-msg.success {
  background: var(--success-bg);
  color: #1B7A36;
  border: 1px solid rgba(52, 199, 89, 0.2);
}
.form-msg.error {
  background: var(--danger-bg);
  color: #C62828;
  border: 1px solid rgba(255, 59, 48, 0.2);
}

/* Password toggle */
.password-wrap { position: relative; }
.eye-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-tertiary);
  transition: color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.eye-toggle:hover { color: var(--text-secondary); }
.eye-toggle svg {
  width: 18px;
  height: 18px;
}

/* Inline edit */
.inline-edit-input {
  padding: 5px 10px;
  border: 1px solid var(--apple-blue);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-family: inherit;
  width: 200px;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* Action buttons */
.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.action-btn:hover {
  background: var(--fill-tertiary);
  color: var(--text);
}

/* ===== Sub-tabs ===== */
.sub-tabs {
  display: flex;
  gap: 0;
  background: var(--fill-tertiary);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 20px;
  width: fit-content;
}
.sub-tab-btn {
  padding: 6px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  font-family: inherit;
}
.sub-tab-btn:hover { color: var(--text); }
.sub-tab-btn.active {
  background: var(--card-bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.sub-tab-panel { display: none; }
.sub-tab-panel.active { display: block; }

/* Price compare table */
.price-compare-table th,
.price-compare-table td { text-align: center; }
.price-compare-table th:first-child,
.price-compare-table td:first-child { text-align: left; }
.price-zone-header td {
  background: var(--bg);
  font-weight: 700;
  font-size: 13px;
  padding-top: 14px;
}

/* Platform chips */
.platform-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.platform-chip {
  display: inline-block;
  padding: 4px 12px;
  background: var(--apple-blue-light);
  color: var(--apple-blue);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

/* Vendor blocks */
.vendor-block {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.vendor-block h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
.vendor-block .prefix {
  color: var(--text-tertiary);
  font-size: 12px;
  margin-left: 8px;
  font-weight: 400;
}

/* ===== Toast — macOS notification style ===== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 360px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.toast.success {
  background: rgba(52, 199, 89, 0.95);
  color: #FFFFFF;
}
.toast.error {
  background: rgba(255, 59, 48, 0.95);
  color: #FFFFFF;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Confirm dialog — macOS alert style ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm-dialog {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px;
  min-width: 380px;
  box-shadow: var(--shadow-lg);
}
.confirm-dialog h3 {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
}
.confirm-dialog p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ===== Login — Apple sign-in style ===== */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 56px 48px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  min-width: 380px;
}
.login-card h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
  letter-spacing: -0.5px;
}
.login-card p {
  color: var(--text-secondary);
  margin-bottom: 36px;
  font-size: 15px;
}
.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}
.btn-google:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.btn-google:active { transform: translateY(0); }
.login-error {
  margin-top: 24px;
  padding: 12px 18px;
  background: var(--danger-bg);
  border: 1px solid rgba(255, 59, 48, 0.2);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

/* ===== Sidebar user info ===== */
.nav-user-info {
  padding: 14px 16px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 12px;
}
.nav-user-email {
  color: var(--text-secondary);
  margin-bottom: 10px;
  word-break: break-all;
  line-height: 1.4;
  font-size: 12px;
}
.nav-logout-btn { width: 100%; }

/* Role badge */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.role-badge.admin {
  background: rgba(175, 82, 222, 0.12);
  color: #AF52DE;
}
.role-badge.operator {
  background: var(--success-bg);
  color: var(--success);
}

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.status-badge.enabled {
  background: var(--success-bg);
  color: #1B7A36;
}
.status-badge.disabled {
  background: var(--danger-bg);
  color: var(--danger);
}

.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .content { margin-left: 200px; padding: 24px; }
  .upload-grid { grid-template-columns: 1fr; }
  .price-grid { gap: 24px; }
  .vendor-list { grid-template-columns: 1fr 1fr; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
