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

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-bg: #eff6ff;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --white: #ffffff;
  --header-h: 56px;
  --subheader-h: 0px;
  --nav-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  /* カテゴリカラー */
  --cat-材料: #e11d48;
  --cat-材料-bg: #fff1f2;
  --cat-材料冷凍: #0284c7;
  --cat-材料冷凍-bg: #e0f2fe;
  --cat-調味料: #d97706;
  --cat-調味料-bg: #fffbeb;
  --cat-消耗品: #64748b;
  --cat-消耗品-bg: #f1f5f9;
  --cat-飲料品: #0891b2;
  --cat-飲料品-bg: #ecfeff;
  --cat-弁当箱: #7c3aed;
  --cat-弁当箱-bg: #f5f3ff;
  --cat-包装資材: #92400e;
  --cat-包装資材-bg: #fef3c7;
  --cat-衛生品: #059669;
  --cat-衛生品-bg: #ecfdf5;

  /* 鮮度カラー */
  --fresh-0: #059669;
  --fresh-1: #2563eb;
  --fresh-2: #d97706;
  --fresh-3: #ea580c;
  --fresh-4: #dc2626;
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  position: relative;
  box-shadow: var(--shadow-lg);
}

/* ===== HEADER ===== */
.app-header {
  height: var(--header-h);
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { font-size: 24px; }
.header-title { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.header-clock { font-size: 11px; opacity: .75; font-variant-numeric: tabular-nums; margin-top: 1px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.urgent-badge {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.6; } }

/* ===== SUBHEADER ===== */
.subheader {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.search-wrap {
  padding: 10px 14px 4px;
}
.search-input {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 99px;
  font-size: 14px;
  outline: none;
  background: var(--gray-50);
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--primary-light); background: white; }
.filter-bar {
  display: flex;
  gap: 6px;
  padding: 6px 14px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 5px 13px;
  border-radius: 99px;
  border: 1.5px solid var(--gray-300);
  background: white;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all .15s;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.chip.cat-材料.active     { background: var(--cat-材料);     border-color: var(--cat-材料); }
.chip.cat-材料冷凍.active { background: var(--cat-材料冷凍); border-color: var(--cat-材料冷凍); }
.chip.cat-調味料.active   { background: var(--cat-調味料);   border-color: var(--cat-調味料); }
.chip.cat-消耗品.active   { background: var(--cat-消耗品);   border-color: var(--cat-消耗品); }
.chip.cat-飲料品.active   { background: var(--cat-飲料品);   border-color: var(--cat-飲料品); }
.chip.cat-弁当箱.active   { background: var(--cat-弁当箱);   border-color: var(--cat-弁当箱); }
.chip.cat-包装資材.active { background: var(--cat-包装資材); border-color: var(--cat-包装資材); }
.chip.cat-衛生品.active   { background: var(--cat-衛生品);   border-color: var(--cat-衛生品); }

.sort-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 14px 8px;
  gap: 6px;
}
.sort-label { font-size: 11px; color: var(--gray-500); }
.sort-select {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  color: var(--gray-700);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--gray-50);
}
.main-content::-webkit-scrollbar { display: none; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  height: var(--nav-h);
  background: white;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}
.nb {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: none;
  background: none;
  color: var(--gray-500);
  cursor: pointer;
  transition: color .15s;
}
.nb.active { color: var(--primary); }
.nb-ico { font-size: 20px; }
.nb-lbl { font-size: 10px; font-weight: 600; }
.nb-center { position: relative; }
.nb-plus {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: white;
  font-weight: 300;
  box-shadow: 0 4px 12px rgba(30,64,175,.4);
  margin-top: -12px;
}
.nb-center .nb-lbl { color: var(--primary); font-weight: 700; }

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin: 0 12px 10px;
}
.card:first-child { margin-top: 12px; }

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 14px 14px 6px;
}

/* ===== PRODUCT LIST ===== */
.product-card {
  background: white;
  display: flex;
  align-items: stretch;
  padding: 13px 14px;
  margin: 0 12px 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  gap: 12px;
}
.product-card:first-child { margin-top: 12px; }
.product-card:active { transform: scale(.98); box-shadow: none; }

.card-main { flex: 1; min-width: 0; }
.product-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.product-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.cat-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}
.cat-badge.材料     { background: var(--cat-材料-bg);     color: var(--cat-材料); }
.cat-badge.材料冷凍 { background: var(--cat-材料冷凍-bg); color: var(--cat-材料冷凍); }
.cat-badge.調味料   { background: var(--cat-調味料-bg);   color: var(--cat-調味料); }
.cat-badge.消耗品   { background: var(--cat-消耗品-bg);   color: var(--cat-消耗品); }
.cat-badge.飲料品   { background: var(--cat-飲料品-bg);   color: var(--cat-飲料品); }
.cat-badge.弁当箱   { background: var(--cat-弁当箱-bg);   color: var(--cat-弁当箱); }
.cat-badge.包装資材 { background: var(--cat-包装資材-bg); color: var(--cat-包装資材); }
.cat-badge.衛生品   { background: var(--cat-衛生品-bg);   color: var(--cat-衛生品); }

.store-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}

.best-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.best-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.best-price .yen { font-size: 12px; font-weight: 600; }
.unit-price-small {
  font-size: 11px;
  color: var(--gray-500);
  line-height: 1.45;
}

.card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  min-width: 80px;
}

/* ===== FRESHNESS INDICATOR ===== */
.freshness-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.fresh-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.freshness-0 { background: var(--success-bg); color: var(--success); }
.freshness-0 .fresh-dot { background: var(--success); }
.freshness-1 { background: var(--primary-bg); color: var(--primary-light); }
.freshness-1 .fresh-dot { background: var(--primary-light); }
.freshness-2 { background: var(--warning-bg); color: var(--warning); }
.freshness-2 .fresh-dot { background: var(--warning); }
.freshness-3 { background: var(--orange-bg); color: var(--orange); }
.freshness-3 .fresh-dot { background: var(--orange); }
.freshness-4 { background: var(--danger-bg); color: var(--danger); }
.freshness-4 .fresh-dot { background: var(--danger); }

.update-timestamp {
  font-size: 10px;
  color: var(--gray-500);
  text-align: right;
  line-height: 1.4;
}
.update-timestamp .ts-date { font-weight: 600; color: var(--gray-700); }

.no-price-badge {
  font-size: 10px;
  background: var(--gray-100);
  color: var(--gray-500);
  padding: 3px 8px;
  border-radius: 99px;
}

/* ===== COMPARE TAB ===== */
.compare-header {
  padding: 14px 14px 0;
}
.compare-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}
.product-select-wrap {
  padding: 12px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
}
.product-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: white;
  color: var(--gray-900);
}
.compare-card {
  background: white;
  border-radius: var(--radius);
  margin: 12px 12px 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.compare-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  letter-spacing: .8px;
  padding: 12px 14px 8px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}
.compare-row {
  display: flex;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  gap: 10px;
  transition: background .1s;
}
.compare-row:last-child { border-bottom: none; }
.compare-row.cheapest { background: #f0fdf4; }
.compare-row.cheapest-unit { background: #eff6ff; }
.compare-store {
  min-width: 92px;
  flex-shrink: 0;
}
.compare-prices { flex: 1; }
.compare-price-main {
  font-size: 17px;
  font-weight: 800;
  color: var(--gray-900);
}
.compare-qty {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 1px;
  line-height: 1.45;
}
.compare-unit-price {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  margin-top: 4px;
  display: inline-block;
}
.compare-unit-price.best { background: var(--primary-bg); color: var(--primary); }
.compare-unit-price.normal { background: var(--gray-100); color: var(--gray-500); }

.compare-ts-col {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.compare-ts-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-700);
}
.compare-ts-time {
  font-size: 10px;
  color: var(--gray-500);
}
.cheapest-label {
  font-size: 9px;
  font-weight: 800;
  background: #16a34a;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .5px;
}

/* 履歴チャート */
.history-section {
  padding: 14px;
  background: white;
  border-radius: var(--radius);
  margin: 10px 12px 0;
  box-shadow: var(--shadow);
}
.history-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  letter-spacing: .8px;
  margin-bottom: 10px;
}
.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bar-label {
  font-size: 11px;
  font-weight: 700;
  min-width: 92px;
  text-align: left;
  flex-shrink: 0;
}
.bar-track {
  flex: 1;
  height: 22px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  transition: width .4s ease;
  min-width: 30px;
}
.bar-fill span { font-size: 11px; font-weight: 700; color: white; white-space: nowrap; }
.bar-value { font-size: 12px; font-weight: 700; min-width: 40px; color: var(--gray-700); }

/* 価格履歴 */
.history-timeline { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
}
.history-date { font-size: 11px; color: var(--gray-500); min-width: 60px; }
.history-price { font-size: 14px; font-weight: 800; line-height: 1.4; }
.history-store {}
.history-change {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}
.history-change.up { background: #fee2e2; color: #dc2626; }
.history-change.down { background: #dcfce7; color: #16a34a; }
.history-change.same { background: var(--gray-100); color: var(--gray-500); }

/* 追加ボタン */
.add-for-product-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 24px);
  margin: 10px 12px 12px;
  padding: 13px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

/* ===== ADD FORM ===== */
.add-form { padding: 0 0 20px; }
.timestamp-display {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 60%, #2563eb 100%);
  color: white;
  padding: 18px 20px;
  margin-bottom: 4px;
}
.ts-header { font-size: 11px; font-weight: 700; opacity: .75; letter-spacing: .8px; margin-bottom: 4px; }
.ts-datetime {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}
.ts-note { font-size: 11px; opacity: .65; margin-top: 4px; }

.form-section { padding: 0 14px; margin-top: 14px; }
.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  letter-spacing: .6px;
  margin-bottom: 6px;
  display: block;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
  background: white;
}
.form-input:focus { border-color: var(--primary-light); }
.form-input.error { border-color: var(--danger); }

.category-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-chip {
  padding: 8px 16px;
  border-radius: 99px;
  border: 2px solid var(--gray-200);
  background: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.cat-chip.active-材料     { background: var(--cat-材料-bg);     border-color: var(--cat-材料);     color: var(--cat-材料); }
.cat-chip.active-材料冷凍 { background: var(--cat-材料冷凍-bg); border-color: var(--cat-材料冷凍); color: var(--cat-材料冷凍); }
.cat-chip.active-調味料   { background: var(--cat-調味料-bg);   border-color: var(--cat-調味料);   color: var(--cat-調味料); }
.cat-chip.active-消耗品   { background: var(--cat-消耗品-bg);   border-color: var(--cat-消耗品);   color: var(--cat-消耗品); }
.cat-chip.active-飲料品   { background: var(--cat-飲料品-bg);   border-color: var(--cat-飲料品);   color: var(--cat-飲料品); }
.cat-chip.active-弁当箱   { background: var(--cat-弁当箱-bg);   border-color: var(--cat-弁当箱);   color: var(--cat-弁当箱); }
.cat-chip.active-包装資材 { background: var(--cat-包装資材-bg); border-color: var(--cat-包装資材); color: var(--cat-包装資材); }
.cat-chip.active-衛生品   { background: var(--cat-衛生品-bg);   border-color: var(--cat-衛生品);   color: var(--cat-衛生品); }
.tax-rate-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.tax-chip {
  padding: 8px 18px;
  border-radius: 99px;
  border: 2px solid var(--gray-200);
  background: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.tax-chip.active {
  background: var(--primary-bg);
  border-color: var(--primary-light);
  color: var(--primary);
}

.store-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  outline: none;
  background: white;
  color: var(--gray-900);
}
.store-select:focus { border-color: var(--primary-light); }

.store-select-note {
  font-size: 11px;
  color: var(--gray-500);
}
.store-select-note { margin-top: 8px; }

.store-pick-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.store-pick-btn:active { transform: scale(.99); }
.store-pick-btn.empty { border-style: dashed; }
.store-pick-btn.selected {
  background: var(--store-bg);
  border-color: var(--store-color);
  box-shadow: 0 6px 14px rgba(59,130,246,.12);
}
.store-pick-btn.selected .store-pick-label { color: var(--store-muted-text-color); }
.store-pick-btn.selected .store-pick-value { color: var(--store-text-color); }
.store-pick-btn.selected .store-pick-arrow { color: var(--store-muted-text-color); }
.store-pick-label {
  grid-column: 1;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  letter-spacing: .6px;
}
.store-pick-value {
  grid-column: 1;
  font-size: 16px;
  font-weight: 800;
  color: var(--gray-900);
}
.store-pick-btn.empty .store-pick-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
}
.store-pick-arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 22px;
  color: var(--gray-300);
}

.store-choice-screen {
  padding: 14px 12px 20px;
}
.store-choice-header {
  padding: 6px 2px 14px;
}
.store-choice-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-900);
}
.store-choice-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--gray-500);
}
.store-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.store-choice-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 15px 16px;
  border: 1.5px solid var(--store-color);
  border-radius: var(--radius);
  background: var(--store-bg);
  cursor: pointer;
  text-align: left;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.store-choice-btn:active { transform: scale(.99); }
.store-choice-btn.selected {
  box-shadow: 0 0 0 2px var(--store-color) inset, 0 8px 18px rgba(15,23,42,.06);
}
.store-choice-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--store-text-color);
}
.store-choice-meta {
  font-size: 12px;
  color: var(--store-muted-text-color);
}
.store-choice-back-btn {
  width: 100%;
  margin-top: 14px;
  padding: 13px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.price-qty-row { display: flex; gap: 10px; }
.price-qty-row .form-section { flex: 1; padding: 0; margin-top: 0; }
.price-input-wrap { position: relative; }
.price-yen {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-500);
  pointer-events: none;
}
.price-input-wrap .form-input { padding-left: 28px; }
.unit-select {
  width: 100%;
  padding: 11px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
}

.prev-price-box {
  margin: 12px 14px 0;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-light);
}
.prev-price-label { font-size: 10px; font-weight: 700; color: var(--gray-500); letter-spacing: .6px; }
.prev-price-value { font-size: 14px; font-weight: 700; color: var(--gray-700); margin-top: 2px; }

.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 28px);
  margin: 20px 14px 0;
  padding: 15px;
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(30,64,175,.35);
}
.submit-btn:active { transform: scale(.98); }

/* ===== RANK TAB ===== */
.rank-section { margin: 12px 12px 0; }
.rank-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 10px;
}
.rank-card-header {
  padding: 12px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rank-item {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-100);
  gap: 10px;
  cursor: pointer;
}
.rank-item:last-child { border-bottom: none; }
.rank-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
.rank-num.r1 { background: #fef3c7; color: #d97706; }
.rank-num.r2 { background: var(--gray-100); color: var(--gray-500); }
.rank-num.r3 { background: #fce7f3; color: #be185d; }
.rank-name { flex: 1; font-size: 14px; font-weight: 600; }
.rank-right { text-align: right; }
.rank-total { font-size: 15px; font-weight: 800; color: var(--primary); line-height: 1.4; }
.rank-count { font-size: 10px; color: var(--gray-500); line-height: 1.4; }

.urgent-item {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-100);
  gap: 8px;
  cursor: pointer;
}
.urgent-item:last-child { border-bottom: none; }
.urgent-name { flex: 1; font-size: 13px; font-weight: 600; }
.urgent-days {
  font-size: 11px;
  font-weight: 700;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 3px 8px;
  border-radius: 99px;
}
.urgent-date { font-size: 10px; color: var(--gray-500); min-width: 50px; text-align: right; }

.recent-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  gap: 8px;
}
.recent-item:last-child { border-bottom: none; }
.recent-product { flex: 1; }
.recent-name { font-size: 13px; font-weight: 700; }
.recent-meta { font-size: 11px; color: var(--gray-500); margin-top: 1px; line-height: 1.4; }
.recent-ts { font-size: 10px; color: var(--gray-500); text-align: right; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 50;
  backdrop-filter: blur(2px);
}
.modal-overlay.active { display: block; }
.modal-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: white;
  border-radius: 20px 20px 0 0;
  z-index: 51;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,.15);
}
.modal-sheet.active { display: block; }
.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 99px;
  margin: 10px auto 4px;
}
.modal-body { padding: 4px 0 30px; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: white;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; font-weight: 600; }
.empty-state-sub { font-size: 12px; margin-top: 4px; }

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--gray-100); margin: 8px 0; }

/* ===== SCROLLABLE LIST PADDING ===== */
.list-pad { padding-bottom: 20px; }

/* ===== COMPARE PLACEHOLDER ===== */
.compare-placeholder {
  text-align: center;
  padding: 40px 20px;
}
