/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #f59e0b;
  --warning-bg: #fef9c3;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --tab-height: 64px;
  --header-height: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

#app {
  height: 100%;
  position: relative;
}

/* ===== Pages ===== */
.page {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  background: var(--gray-50);
  z-index: 1;
}

.page.active {
  display: flex;
  z-index: 2;
}

/* ===== Header ===== */
.page-header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 16px;
  padding-top: var(--safe-top);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  gap: 8px;
  z-index: 10;
}

.page-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.btn-back {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 8px 4px 0;
  line-height: 1;
}

/* ===== Page Content ===== */
.page-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
}

/* ===== Buttons ===== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-large {
  padding: 18px 24px;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-icon {
  font-size: 22px;
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:active {
  background: var(--gray-100);
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
}

.btn-danger {
  background: white;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn-photo-search {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
}

.btn-photo-search:active {
  background: linear-gradient(135deg, #6d28d9, #1d4ed8);
}

.btn-full {
  width: 100%;
  margin-bottom: 10px;
}

/* ===== Home ===== */
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

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

.stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ===== Sections ===== */
.section {
  margin-bottom: 20px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 10px;
}

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--gray-400);
  font-size: 14px;
}

/* ===== Search ===== */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-box input {
  flex: 1;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  background: white;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-search {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* ===== Chips / Filters ===== */
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
}

.chip {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
}

.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.chip-divider {
  color: var(--gray-300);
  font-size: 14px;
}

.filter-advanced {
  margin-bottom: 16px;
}

.filter-group {
  margin-bottom: 12px;
}

.filter-group label {
  display: block;
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 6px;
  font-weight: 500;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-row input {
  flex: 1;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--gray-700);
  padding: 6px 0;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.hidden {
  display: none;
}

/* ===== Keyword list ===== */
.keyword-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.keyword-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.keyword-item:active {
  background: var(--gray-100);
}

.keyword-text {
  font-size: 14px;
  color: var(--gray-700);
}

.keyword-date {
  font-size: 12px;
  color: var(--gray-400);
}

/* ===== Results Summary ===== */
.results-summary {
  margin-bottom: 12px;
}

.summary-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-row + .summary-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}

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

.summary-label {
  font-size: 11px;
  color: var(--gray-500);
  display: block;
}

.summary-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
}

/* ===== Purchase Input Bar ===== */
.purchase-input-bar {
  background: white;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.purchase-input-bar label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  display: block;
}

.purchase-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.purchase-currency {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-700);
  flex-shrink: 0;
}

.purchase-input-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 16px;
  font-weight: 600;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.purchase-input-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-recalc {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-rate-update {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 8px;
}

/* ===== Sort Bar ===== */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sort-bar select {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  background: white;
  color: var(--gray-700);
  outline: none;
}

.result-count {
  font-size: 13px;
  color: var(--gray-500);
}

/* ===== Product List / Cards ===== */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.product-card:active {
  box-shadow: var(--shadow-md);
}

.product-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--gray-400);
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.product-meta-item {
  font-size: 12px;
  color: var(--gray-500);
}

.product-meta-item strong {
  color: var(--gray-800);
  font-weight: 600;
}

.product-profit {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.profit-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.profit-positive {
  background: var(--success-bg);
  color: var(--success);
}

.profit-high {
  background: var(--success);
  color: white;
  font-size: 14px;
}

.profit-negative {
  background: var(--danger-bg);
  color: var(--danger);
}

.profit-neutral {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ===== Barcode Scanner ===== */
.barcode-capture-area {
  text-align: center;
  padding: 40px 20px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 2px dashed var(--gray-300);
  margin-bottom: 16px;
}

.barcode-capture-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.barcode-capture-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
}

.barcode-capture-area .btn-large {
  max-width: 280px;
  margin: 0 auto 12px;
}

.barcode-capture-sub {
  font-size: 13px;
  color: var(--gray-500);
}

.barcode-capture-sub.success {
  color: var(--success);
  font-weight: 600;
}

.barcode-capture-sub.error {
  color: var(--danger);
  font-weight: 600;
}

.barcode-preview-img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 12px;
}

.camera-container {
  margin-bottom: 16px;
}

.camera-preview {
  position: relative;
  background: var(--gray-900);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  width: 70%;
  height: 40%;
  border: 2px solid rgba(255,255,255,0.7);
  border-radius: 12px;
  z-index: 2;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.4);
}

.scan-hint {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  font-size: 14px;
  z-index: 3;
}

.barcode-actions {
  display: flex;
  gap: 8px;
}

.barcode-actions .btn-secondary {
  flex: 1;
  text-align: center;
  font-size: 13px;
  padding: 12px 8px;
}

.barcode-page-content {
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
}

#barcode-scanner {
  position: relative;
}

#barcode-scanner video,
#barcode-scanner canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

#barcode-scanner canvas.drawingBuffer {
  display: none;
}

.scan-result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--primary);
}

.scan-result-bar.hidden {
  display: none;
}

#scan-result-code {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  font-family: monospace;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  width: auto;
}

.manual-entry {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  box-shadow: var(--shadow);
}

.manual-entry.hidden {
  display: none;
}

.scan-hint.success {
  color: #22c55e;
  font-weight: 600;
}

/* ===== Detail Page ===== */
.detail-images {
  margin: -16px -16px 16px -16px;
}

.image-slider {
  background: var(--gray-100);
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
}

.image-placeholder {
  color: var(--gray-400);
  font-size: 14px;
}

.detail-info {
  margin-bottom: 16px;
}

.detail-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.badge {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.detail-code {
  font-size: 13px;
  color: var(--gray-500);
}

.detail-tags {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-500);
}

.detail-section {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.detail-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.price-item {
  display: flex;
  flex-direction: column;
}

.price-label {
  font-size: 11px;
  color: var(--gray-500);
}

.price-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-800);
}

.price-value.highlight {
  color: var(--primary);
  font-size: 20px;
}

.chart-placeholder {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  overflow: hidden;
}

.chart-placeholder canvas {
  width: 100%;
  height: 100%;
}

.period-tabs {
  display: flex;
  gap: 6px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.analysis-item {
  display: flex;
  flex-direction: column;
}

.analysis-label {
  font-size: 11px;
  color: var(--gray-500);
}

.analysis-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
}

.detail-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-actions-row {
  display: flex;
  gap: 10px;
}

.detail-actions-row .btn-secondary {
  flex: 1;
  text-align: center;
}

/* ===== Calc Page ===== */
.calc-result-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  text-align: center;
  margin-bottom: 20px;
  border-top: 4px solid var(--gray-300);
}

.calc-result-card.positive {
  border-top-color: var(--success);
}

.calc-result-card.negative {
  border-top-color: var(--danger);
}

.calc-profit {
  font-size: 36px;
  font-weight: 800;
  color: var(--gray-800);
}

.calc-result-card.positive .calc-profit {
  color: var(--success);
}

.calc-result-card.negative .calc-profit {
  color: var(--danger);
}

.calc-result-card.high-profit {
  border-top-color: var(--success);
  background: linear-gradient(180deg, #dcfce7 0%, white 40%);
}

.calc-result-card.high-profit .calc-profit {
  color: var(--success);
  font-size: 42px;
}

.rate-great {
  color: var(--success) !important;
  font-weight: 800 !important;
}

.rate-good {
  color: var(--warning) !important;
}

.rate-bad {
  color: var(--danger) !important;
}

.calc-profit-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.calc-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

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

.calc-label {
  font-size: 11px;
  color: var(--gray-500);
  display: block;
}

.calc-value {
  font-size: 15px;
  font-weight: 600;
}

.calc-breakeven {
  font-size: 13px;
  color: var(--gray-600);
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}

.calc-inputs {
  margin-bottom: 16px;
}

.calc-inputs h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin: 16px 0 10px;
}

.calc-inputs h3:first-child {
  margin-top: 0;
}

.input-group {
  margin-bottom: 10px;
}

.input-group label {
  display: block;
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 4px;
  font-weight: 500;
}

.input-group input,
.input-group select {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
  background: white;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.calc-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* ===== Settings ===== */
.settings-section {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
}

.settings-info {
  font-size: 13px;
  color: var(--gray-500);
}

/* ===== History item extra ===== */
.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.history-date {
  font-size: 12px;
  color: var(--gray-400);
}

.history-type {
  font-size: 11px;
  background: var(--gray-100);
  color: var(--gray-500);
  padding: 1px 8px;
  border-radius: 10px;
}

.history-note {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
  font-style: italic;
}

/* ===== Favorites extras ===== */
.fav-price-change {
  font-size: 13px;
  font-weight: 600;
}

.price-up {
  color: var(--success);
}

.price-down {
  color: var(--danger);
}

/* ===== Tab Bar ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-height);
  padding-bottom: var(--safe-bottom);
  background: white;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  gap: 2px;
  min-width: 56px;
  transition: color 0.2s;
}

.tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--gray-400);
}

.tab.active .tab-label {
  color: var(--primary);
  font-weight: 600;
}

/* ===== Utilities ===== */
@media (prefers-color-scheme: dark) {
  /* Future: dark mode support */
}

/* Prevent pull-to-refresh on iOS */
body {
  overscroll-behavior-y: contain;
}

/* ===== Auth Modal ===== */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal.hidden {
  display: none;
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-app-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.auth-app-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form.hidden {
  display: none;
}

.auth-input {
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 12px 14px;
  width: 100%;
  font-size: 16px;
  outline: none;
  background: white;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-error {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

.auth-error.hidden {
  display: none;
}

.auth-submit {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-submit:active {
  background: var(--primary-dark);
}

/* ===== User Info Card (Settings) ===== */
.user-info-card {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border-left: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-info-row {
  font-size: 14px;
  color: var(--gray-700);
}

/* ===== Plan Card ===== */
.plan-card {
  border: 2px solid var(--primary);
  border-radius: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #eff6ff, #f0f4ff);
}
.plan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.plan-card-header h4 {
  font-size: 18px;
  color: var(--primary);
}
.plan-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}
.plan-price small {
  font-size: 14px;
  font-weight: 400;
}
.plan-features {
  list-style: none;
  margin-bottom: 16px;
}
.plan-features li {
  padding: 4px 0;
  font-size: 14px;
  color: var(--gray-700);
}

/* ===== Legal Pages (Terms & Privacy) ===== */
.legal-content {
  padding: 4px 0 32px;
}
.legal-content .legal-updated {
  font-size: 13px;
  color: var(--gray-400);
  margin-bottom: 20px;
}
.legal-content h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  margin-top: 24px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gray-200);
}
.legal-content h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-top: 12px;
  margin-bottom: 6px;
}
.legal-content p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--gray-600);
  margin-bottom: 8px;
}
.legal-content ul {
  margin: 8px 0 12px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--gray-600);
}
.legal-content ul li {
  margin-bottom: 4px;
}
.legal-content a {
  color: var(--primary);
  text-decoration: none;
}
.legal-content a:hover {
  text-decoration: underline;
}
.legal-content .legal-contact {
  margin-top: 32px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
}
.legal-content .legal-contact h3 {
  margin-top: 0;
  border-bottom: none;
}
