/* ─────────────────────────────────────────
   Reset & Base
───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { font-size: 16px; height: 100%; }

body {
  font-family: 'Zen Maru Gothic', -apple-system, BlinkMacSystemFont, 'Hiragino Sans',
    'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(160deg, #F0E2E9 0%, #ECE3EA 55%, #E9E2E8 100%);
  color: #4A2E3A;
  height: 100%;
  overflow: hidden;
}

/* ─────────────────────────────────────────
   Variables
───────────────────────────────────────── */
:root {
  --bg: #F8F0F4;
  --surface: #FFFFFF;
  --primary: #CE8499;
  --primary-light: #F2E6EA;
  --primary-dark: #B06A82;
  --accent: #B98DA8;
  --accent-light: #EFE7EC;
  --success: #52B788;
  --warning: #E0A23E;
  --danger: #E05A6E;
  --text: #4A2E3A;
  --text-muted: #A98797;
  --text-light: #D2B9C4;
  --border: #EEDCE4;
  --shadow: 0 4px 24px rgba(198,112,140,0.12);
  --shadow-sm: 0 2px 12px rgba(198,112,140,0.08);
  --shadow-lg: 0 8px 40px rgba(198,112,140,0.16);
  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 10px;
  --nav-height: 68px;
  --header-height: 56px;
}

/* ─────────────────────────────────────────
   App Shell
───────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background:
    radial-gradient(circle at 85% -5%, rgba(178,128,162,0.14) 0%, transparent 45%),
    radial-gradient(circle at -10% 30%, rgba(198,112,140,0.10) 0%, transparent 40%),
    linear-gradient(175deg, #F7EDF1 0%, #F5ECF1 55%, #F2ECF1 100%);
  position: relative;
}

/* Header */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: rgba(255,248,251,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(248,226,234,0.7);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(198,112,140,0.06);
}

.header-side { width: 40px; }
.header-right { display: flex; justify-content: flex-end; }

#header-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  flex: 1;
  text-align: center;
  background: linear-gradient(90deg, #CE8499 20%, #B98DA8 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  color: var(--primary);
  font-weight: 700;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--primary-light); }

.hidden { display: none !important; }

/* Main */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + 64px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

/* Bottom Nav */
#bottom-nav {
  display: flex;
  height: var(--nav-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.9);
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 452px;
  z-index: 100;
  border-radius: 34px;
  padding: 6px;
  gap: 4px;
  box-shadow: 0 10px 36px rgba(198,112,140,0.20), 0 2px 8px rgba(178,128,162,0.12);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  transition: color 0.2s, background 0.2s;
  padding: 6px 4px;
  border-radius: 28px;
  font-family: inherit;
}
.nav-item.active {
  color: var(--primary-dark);
  background: linear-gradient(135deg, #F2E6EA, #EFE7EC);
}
.nav-item.active .nav-icon { transform: scale(1.15); }
.nav-icon { font-size: 23px; transition: transform 0.2s; display: block; }
.nav-label { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; }

/* ─────────────────────────────────────────
   Common Components
───────────────────────────────────────── */

/* Card */
.card {
  background: rgba(255,255,255,0.82);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.9);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.card-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: #F5F5F5;
  padding: 3px 8px;
  border-radius: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, #D597A6 0%, #BE96B6 100%);
  color: white;
  box-shadow: 0 6px 18px rgba(198,112,140,0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #CE8499 0%, #B98DA8 100%);
  box-shadow: 0 6px 22px rgba(198,112,140,0.45);
}
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-xs { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-full { width: 100%; }

/* Tabs */
.tab-bar {
  display: flex;
  background: rgba(238,227,223,0.5);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 14px;
  gap: 4px;
  border: 1px solid var(--border);
}
.tab {
  flex: 1;
  padding: 9px 10px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  font-family: inherit;
}
.form-input:focus { border-color: var(--primary); }
.form-select {
  width: 100%;
  padding: 11px 36px 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239B9B9B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  font-family: inherit;
  cursor: pointer;
}
.form-select:focus { border-color: var(--primary); outline: none; }
.form-textarea { min-height: 80px; resize: none; line-height: 1.5; }
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.input-row { display: flex; align-items: center; gap: 8px; }
.input-suffix { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.form-actions { margin-top: 8px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty-state p { font-size: 14px; }

/* ─────────────────────────────────────────
   Dashboard
───────────────────────────────────────── */
.page { padding: 16px; }

.greeting-card {
  background: linear-gradient(135deg, #D597A6 0%, #C98BAC 50%, #BE96B6 100%);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 12px;
  color: white;
  box-shadow: 0 8px 30px rgba(198,112,140,0.38);
  position: relative;
  overflow: hidden;
}
.greeting-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.10);
  border-radius: 50%;
}
.greeting-card::after {
  content: '';
  position: absolute;
  bottom: -20px; left: 30px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
}
.date-text { font-size: 12px; opacity: 0.80; margin-bottom: 6px; letter-spacing: 0.3px; }
.greeting-sub { font-size: 17px; font-weight: 700; letter-spacing: 0.2px; }

.score-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 20px;
}

.metrics-row { display: flex; gap: 6px; }
.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.metric-emoji { font-size: 16px; }
.metric-dots { display: flex; gap: 2px; }
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #E8E8E8;
}
.metric-label { font-size: 9px; color: var(--text-muted); text-align: center; }
.entry-notes {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  background: #FAF8F8;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
}

.routine-steps { display: flex; flex-direction: column; gap: 7px; }
.routine-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: linear-gradient(145deg, #FFF5F8, #F5F1FD);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-info { flex: 1; min-width: 0; }
.step-brand { font-size: 10px; color: var(--text-muted); display: block; }
.step-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.step-cat { font-size: 16px; flex-shrink: 0; }

.warning-card { border-color: #FDE68A; background: #FFFBEB; }
.expiring-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #F5EDD0;
}
.expiring-item:last-child { border-bottom: none; }
.expiring-info { flex: 1; min-width: 0; }
.expiring-brand { font-size: 10px; color: var(--text-muted); display: block; }
.expiring-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.expiring-days { font-size: 13px; font-weight: 700; color: var(--warning); flex-shrink: 0; margin-left: 8px; }
.expiring-days.danger { color: var(--danger); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  background: linear-gradient(145deg, #FFF5F8, #F3EEFD);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.stat-num { font-size: 24px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 10px; color: var(--text-muted); margin-top: 3px; letter-spacing: 0.2px; }

.empty-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.text-muted { color: var(--text-muted); font-size: 13px; }

/* ─────────────────────────────────────────
   Inventory
───────────────────────────────────────── */
.category-scroll {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  font-family: inherit;
}
.cat-chip.active { background: var(--primary); color: white; border-color: var(--primary); }

.result-count { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.product-list { display: flex; flex-direction: column; gap: 10px; }

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.product-card-main {
  display: flex;
  align-items: flex-start;
  padding: 14px;
  gap: 12px;
}
.product-cat-icon { font-size: 28px; display: block; margin-top: 2px; }
.product-info { flex: 1; min-width: 0; }
.product-brand { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.product-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 7px; line-height: 1.35; }
.product-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.status-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.status-badge.opened { background: #EDFAF3; color: #1A7A4A; }
.status-badge.unopened { background: #F3F4F6; color: #7B8494; }

.pao-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.pao-badge.ok { background: #EDFAF3; color: #1A7A4A; }
.pao-badge.warning { background: rgba(201,151,106,0.15); color: #8B5E2E; }
.pao-badge.danger { background: rgba(196,80,96,0.12); color: #9A3048; }
.pao-badge.expired { background: #2C1A17; color: #F7EAED; }

.days-badge { font-size: 10px; padding: 2px 8px; border-radius: 20px; background: rgba(183,104,120,0.10); color: var(--primary); font-weight: 700; }

.product-actions { flex-shrink: 0; }
.fav-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #E0B8BE;
  transition: all 0.15s;
  padding: 2px;
  line-height: 1;
}
.fav-btn.active { color: var(--primary); transform: scale(1.1); }

.product-card-footer {
  display: flex;
  gap: 6px;
  padding: 0 14px 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Add / Edit Product */
.add-product { padding-bottom: 32px; }

/* ─────────────────────────────────────────
   Diary
───────────────────────────────────────── */
.metric-form-group { margin-bottom: 18px; }
.metric-form-label { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; display: block; }
.star-rating { display: flex; gap: 3px; }
.star-btn {
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 3px;
  transition: transform 0.1s;
  line-height: 1;
}
.star-btn:hover { transform: scale(1.15); }

.diary-history { margin-top: 4px; }

.diary-entry-card {}
.diary-entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.diary-date { font-size: 13px; font-weight: 700; color: var(--text); }
.diary-actions { display: flex; align-items: center; gap: 8px; }
.diary-avg { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 2px 8px; border-radius: 20px; }
.icon-btn-sm { background: none; border: none; font-size: 13px; color: var(--text-light); cursor: pointer; padding: 4px; }

.metrics-mini { display: flex; gap: 12px; flex-wrap: wrap; }
.metric-mini-item { display: flex; align-items: center; gap: 4px; }
.mini-dots { display: flex; gap: 2px; }
.mini-dot { width: 6px; height: 6px; border-radius: 50%; background: #E8E8E8; }

.diary-notes { margin-top: 8px; font-size: 12px; color: var(--text-muted); font-style: italic; background: #FAF8F8; padding: 7px 10px; border-radius: var(--radius-xs); }

/* Chart */
.chart-wrap { margin: 8px 0; overflow: hidden; }
.chart-wrap svg { display: block; max-width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ─────────────────────────────────────────
   Routine
───────────────────────────────────────── */
.routine-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.routine-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 0;
}
.routine-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.routine-product-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.routine-cat-icon { font-size: 22px; flex-shrink: 0; }
.routine-brand { font-size: 10px; color: var(--text-muted); }
.routine-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.routine-controls { display: flex; gap: 4px; flex-shrink: 0; }
.order-btn {
  background: none;
  border: 1.5px solid var(--border);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}
.order-btn:hover { border-color: var(--primary); color: var(--primary); }
.order-btn-placeholder { width: 28px; height: 28px; display: inline-block; }
.remove-btn {
  background: none;
  border: 1.5px solid #FCA5A5;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  cursor: pointer;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}
.remove-btn:hover { background: #FEE2E2; }
.add-routine-card { margin-top: 4px; }
.mb8 { margin-bottom: 8px; }
.mt8 { margin-top: 8px; }

/* ─────────────────────────────────────────
   Toast
───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: slideUp 0.25s ease;
}
.toast-success { background: #166534; color: white; }
.toast-error   { background: #991B1B; color: white; }
.toast-info    { background: #1E3A5F; color: white; }

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(16px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ─────────────────────────────────────────
   Diagnosis Banner (Dashboard)
───────────────────────────────────────── */
.diagnosis-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(198,112,140,0.12) 0%, rgba(178,128,162,0.12) 100%);
  border: 1.5px solid rgba(198,112,140,0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
}
.diagnosis-banner:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.diagnosis-banner-left { display: flex; align-items: center; gap: 12px; }
.diagnosis-icon { font-size: 28px; }
.diagnosis-title { font-size: 14px; font-weight: 700; color: var(--primary-dark); margin-bottom: 2px; letter-spacing: 0.1px; }
.diagnosis-sub { font-size: 11px; color: var(--text-muted); }
.diagnosis-arrow { font-size: 18px; color: var(--primary); font-weight: 700; }

/* ─────────────────────────────────────────
   Diagnosis Page
───────────────────────────────────────── */
.concerns-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.concern-chip {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 10px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all 0.2s; font-family: inherit;
  box-shadow: var(--shadow-sm);
}
.concern-chip:hover { border-color: rgba(198,112,140,0.4); background: var(--primary-light); transform: translateY(-1px); }
.concern-chip.active {
  border-color: rgba(198,112,140,0.55);
  background: linear-gradient(135deg, #F2E6EA, #EFE7EC);
  box-shadow: 0 6px 18px rgba(198,112,140,0.22);
  transform: translateY(-1px);
}
.concern-chip.active .concern-label { color: var(--primary-dark); font-weight: 700; }
.concern-emoji { font-size: 26px; }
.concern-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-align: center; line-height: 1.3; }

.photo-area { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.photo-upload-area {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 100%; padding: 24px;
  border: 2px dashed rgba(198,112,140,0.35); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
  background: linear-gradient(145deg, #FFF5F8, #F5F1FD);
}
.photo-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.photo-upload-icon { font-size: 32px; }
.photo-upload-text { font-size: 13px; color: var(--text-muted); text-align: center; line-height: 1.5; }
.skin-photo-preview {
  width: 100%; max-height: 240px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}

.result-header-card {
  background: linear-gradient(135deg, #D597A6 0%, #C98BAC 55%, #BE96B6 100%);
  border-radius: var(--radius); padding: 18px; margin-bottom: 12px; color: white;
  box-shadow: 0 8px 26px rgba(198,112,140,0.35);
  position: relative; overflow: hidden;
}
.result-header-card::after {
  content: '✨';
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 36px; opacity: 0.25;
}
.result-concern-label { font-size: 11px; opacity: 0.85; margin-bottom: 4px; }
.result-title { font-size: 15px; font-weight: 700; }

.result-product-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #FAF0F0;
}
.result-product-row:last-child { border-bottom: none; }
.result-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.result-cat { font-size: 18px; flex-shrink: 0; }
.result-info { flex: 1; min-width: 0; }
.result-brand { font-size: 10px; color: var(--text-muted); display: block; }
.result-name { font-size: 13px; font-weight: 600; display: block; line-height: 1.3; }
.result-status { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 20px; flex-shrink: 0; }
.result-status.opened { background: #DCFCE7; color: #166534; }
.result-status.unopened { background: #F3F4F6; color: #6B7280; }

.mask-result-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #FAF0F0; }
.mask-result-item:last-child { border-bottom: none; }
.mask-freq { font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 3px 8px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
.mask-info { flex: 1; min-width: 0; }
.mask-brand { font-size: 10px; color: var(--text-muted); display: block; }
.mask-name { font-size: 13px; font-weight: 600; display: block; }

.caution-card { background: linear-gradient(135deg, #F8F5FF, #FDF2F7); border-color: rgba(178,128,162,0.3); }
.caution-title { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.caution-list { padding-left: 16px; }
.caution-list li { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; line-height: 1.6; }

/* ─────────────────────────────────────────
   Diary photo
───────────────────────────────────────── */
.diary-photo-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.diary-skin-thumb {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm); border: 2px solid var(--primary-light);
  cursor: pointer; flex-shrink: 0;
}
.diary-photo-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; background: #FAF8F8;
  transition: all 0.15s; flex-shrink: 0;
}
.diary-photo-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.diary-photo-hint { flex: 1; }

/* ─────────────────────────────────────────
   Ingredient Conflicts & Timing
───────────────────────────────────────── */
.conflict-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.conflict-item {
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.conflict-item.conflict-high   { background: #FEF2F2; border-left: 3px solid #EF4444; }
.conflict-item.conflict-low    { background: #FFFBEB; border-left: 3px solid #F59E0B; }
.conflict-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.conflict-name { font-size: 13px; font-weight: 700; color: var(--text); }
.conflict-tip  { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 0; }
.conflict-ok   { font-size: 13px; color: #10B981; font-weight: 600; padding: 8px 0; }

.timing-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px; margin-left: 4px; vertical-align: middle;
}
.timing-badge.am { background: #FEF9C3; color: #854D0E; }
.timing-badge.pm { background: #EDE9FE; color: #5B21B6; }

/* ─────────────────────────────────────────
   Expiry / OCR
───────────────────────────────────────── */
.expiry-input-row {
  display: flex; align-items: center; gap: 8px;
}
.expiry-input-row .form-input { flex: 1; }
.ocr-camera-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--primary-light); border: 1.5px solid var(--border);
  font-size: 20px; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
.ocr-camera-btn:hover { background: #f5d5db; }
.ocr-camera-btn.loading { opacity: 0.6; pointer-events: none; animation: pulse 1s infinite; }
.ocr-status {
  margin-top: 6px; font-size: 12px; min-height: 16px;
}
.ocr-status.loading  { color: var(--text-muted); }
.ocr-status.success  { color: #10B981; font-weight: 600; }
.ocr-status.error    { color: #EF4444; }

.expiry-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.expiry-badge.ok      { background: #ECFDF5; color: #059669; }
.expiry-badge.warning { background: #FEF3C7; color: #D97706; }
.expiry-badge.expired { background: #FEF2F2; color: #DC2626; }

/* ─────────────────────────────────────────
   Scrollbar & Desktop
───────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

@media (min-width: 480px) {
  body { background: linear-gradient(160deg, #F6DCE7 0%, #ECE3F6 60%, #E2DFF8 100%); }
  #app { box-shadow: 0 0 48px rgba(180,100,160,0.18); }
}

/* ─────────────────────────────────────────
   Profile & Skin Photo Analysis
───────────────────────────────────────── */
.profile-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.profile-field { display: flex; flex-direction: column; gap: 4px; }
.profile-field span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.profile-field select {
  padding: 10px 12px; font-size: 14px; color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); appearance: none;
}

.skin-analysis { margin-top: 12px; }
.meter { margin: 10px 0; }
.meter-labels {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 600; margin-bottom: 4px;
}
.meter-bar {
  height: 10px; border-radius: 20px; background: var(--primary-light); overflow: hidden;
}
.meter-fill {
  height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.6s ease;
}
.analysis-note { font-size: 11px; color: var(--text-light); line-height: 1.6; margin-top: 8px; }

/* ── 製品写真（フォーム & 在庫カード） ── */
.product-photo-area { margin-top: 4px; }
.product-photo-upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 22px 12px; cursor: pointer;
  border: 1.5px dashed var(--primary); border-radius: var(--radius-md);
  background: var(--primary-light); text-align: center;
}
.product-photo-upload .photo-upload-icon { font-size: 30px; }
.product-photo-upload .photo-upload-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.product-photo-upload small { color: var(--text-light); font-size: 11px; }
.product-form-photo {
  width: 100%; max-height: 240px; object-fit: cover;
  border-radius: var(--radius-md); display: block;
}
.product-photo-actions { display: flex; gap: 8px; margin-top: 10px; }
.product-thumb {
  width: 52px; height: 52px; flex-shrink: 0;
  object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.photo-saved-note {
  font-size: 12px; font-weight: 600; color: var(--accent);
  margin: 8px 0 4px; text-align: center;
}

/* ── スキンケア / メイク 切り替えトグル ── */
.kind-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.kind-btn {
  flex: 1; padding: 12px; border: none; cursor: pointer;
  border-radius: var(--radius-md); background: var(--surface);
  color: var(--text-muted); font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 10px rgba(198,112,140,0.08);
}
.kind-btn.active {
  background: linear-gradient(135deg, #D597A6 0%, #BE96B6 100%);
  color: #fff; box-shadow: 0 4px 16px rgba(198,112,140,0.28);
}

/* ── 並び替えバー ── */
.sort-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 2px 10px;
}
.sort-row .result-count { margin: 0; }
.sort-select {
  padding: 7px 30px 7px 12px; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 20px;
  appearance: none; cursor: pointer;
  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='%23CE8499' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}

/* ── カードに効果メモを表示 ── */
.product-notes {
  margin: 2px 14px 0; padding: 9px 12px;
  background: var(--primary-light); border-radius: 12px;
  font-size: 12px; line-height: 1.65; color: var(--text);
}
/* ── 使い切りボタン・使い切り済み表示 ── */
.btn-finish {
  background: #F1E8EC; color: #B06A82; border: 1.5px solid #E6C6D2;
}
.btn-finish:active { background: #ECE0E6; }
.status-badge.usedup { background: #E5E1DB; color: #6B6B6B; }
.product-card.used-up { opacity: 0.6; }
.product-card.used-up .product-notes { background: #F1EFE9; }

/* ── 1週間プラン ── */
.week-card { padding: 14px 16px; }
.week-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.week-day {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #D597A6, #BE96B6); color: #fff;
  border-radius: 50%; font-size: 14px; font-weight: 700;
}
.week-focus { font-size: 14px; font-weight: 700; color: var(--text); }
.week-routines { display: flex; gap: 10px; }
.week-routine {
  flex: 1; min-width: 0; background: var(--primary-light);
  border-radius: 12px; padding: 10px 12px;
}
.week-rt-title { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.week-steps { margin: 0; padding-left: 18px; }
.week-steps li { font-size: 11.5px; line-height: 1.65; color: var(--text); margin-bottom: 2px; }
.week-tip { font-size: 12px; color: var(--text-light); line-height: 1.6; margin-top: 10px; }

/* ── ハート系ナビアイコン（SVG） ── */
.nav-icon svg { width: 24px; height: 24px; display: block; }

/* ── 統計をタップ可能に＋お気に入りフィルタチップ ── */
button.stat-item {
  font-family: inherit; border: none; cursor: pointer;
  width: 100%; text-align: center; transition: transform 0.12s;
}
button.stat-item:active { transform: scale(0.95); }
.fav-filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 12px; font-weight: 700; padding: 8px 14px;
  border-radius: 20px; margin-bottom: 10px; cursor: pointer;
}
