/* ============================================================
   우리집사 — 공통 디자인 시스템 v1.0
   Notion-inspired · Mobile-first PWA
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;600;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

/* ────────────────────────────────────────
   1. 디자인 토큰 (CSS Variables)
──────────────────────────────────────── */
:root {
  /* 컬러 팔레트 */
  --white:        #FFFFFF;
  --bg:           #F7F6F3;
  --bg-card:      #FFFFFF;
  --text:         #37352F;
  --text-sub:     #6B6860;
  --text-mute:    #9B9891;
  --border:       #E8E6E0;
  --border-hover: #C8C5BE;

  /* 액센트 — 집사 그린 */
  --accent:       #3D6B4F;
  --accent-dark:  #2E5440;
  --accent-light: #EAF2EC;
  --accent-mute:  #C4DEC9;

  /* 상태 컬러 */
  --danger:       #E53935;
  --danger-light: #FDECEA;
  --warn:         #F57C00;
  --warn-light:   #FFF3E0;
  --ok:           #388E3C;
  --ok-light:     #E8F5E9;
  --info:         #1565C0;
  --info-light:   #E3F2FD;

  /* D-day 상태 (교체 임박) */
  --urgent:       #E53935;   /* D-3 이내 */
  --urgent-light: #FDECEA;
  --near:         #F57C00;   /* D-7 이내 */
  --near-light:   #FFF3E0;
  --safe:         #388E3C;   /* 여유 */
  --safe-light:   #E8F5E9;

  /* 타이포그래피 */
  --font-sans:    'Noto Sans KR', -apple-system, sans-serif;
  --font-serif:   'Noto Serif KR', Georgia, serif;

  /* 스페이싱 */
  --space-xs:     4px;
  --space-sm:     8px;
  --space-md:     16px;
  --space-lg:     24px;
  --space-xl:     32px;
  --space-2xl:    48px;

  /* 반경 */
  --radius-sm:    4px;
  --radius:       6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --radius-full:  999px;

  /* 그림자 */
  --shadow-sm:    0 1px 4px rgba(55,53,47,.06);
  --shadow:       0 2px 10px rgba(55,53,47,.08);
  --shadow-md:    0 4px 20px rgba(55,53,47,.10);
  --shadow-lg:    0 8px 32px rgba(55,53,47,.12);

  /* 레이아웃 */
  --header-h:     56px;
  --tabbar-h:     64px;
  --max-w:        480px;

  /* 전환 */
  --ease:         cubic-bezier(.25,.46,.45,.94);
  --dur-fast:     150ms;
  --dur:          250ms;
  --dur-slow:     400ms;
}

/* ────────────────────────────────────────
   2. 리셋 & 기본
──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 페이지 기본 여백 (헤더 + 탭바 고려) */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: calc(var(--header-h) + var(--space-md)) var(--space-md) calc(var(--tabbar-h) + var(--space-md));
  min-height: 100dvh;
}

/* 탭바 없는 페이지용 */
.page--no-tab {
  padding-bottom: var(--space-2xl);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

/* ────────────────────────────────────────
   3. 헤더
──────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--header-h);
  max-width: 100%;
  background: rgba(247,246,243,.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-sm);
}

.header__inner {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--text);
  transition: background var(--dur-fast);
  flex-shrink: 0;
}
.header__back:hover { background: var(--border); }
.header__back svg { width: 20px; height: 20px; }

.header__logo {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
  flex: 1;
}
.header__logo span { color: var(--accent); }

.header__title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* 알림 벨 버튼 — 모든 페이지 우측 상단 */
.btn-notify {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--dur-fast), color var(--dur-fast);
  border: 1px solid var(--accent-mute);
}
.btn-notify:hover { background: var(--accent-mute); }
.btn-notify svg { width: 15px; height: 15px; }
.btn-notify.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

/* 헤더 아이콘 버튼 */
.header__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--text);
  transition: background var(--dur-fast);
}
.header__btn:hover { background: var(--border); }
.header__btn svg { width: 20px; height: 20px; }

/* ────────────────────────────────────────
   4. 하단 탭바
──────────────────────────────────────── */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--tabbar-h);
  background: rgba(247,246,243,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar__inner {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 100%;
}

.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 400;
  transition: color var(--dur-fast);
  padding-bottom: 4px;
}
.tabbar__item svg { width: 22px; height: 22px; }
.tabbar__item:hover { color: var(--text-sub); }
.tabbar__item.active {
  color: var(--accent);
  font-weight: 500;
}

/* 가운데 + 버튼 */
.tabbar__add {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 400;
  transition: color var(--dur-fast);
  padding-bottom: 4px;
}
.tabbar__add-icon {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(61,107,79,.30);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
  margin-top: -6px;
}
.tabbar__add:hover .tabbar__add-icon {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(61,107,79,.38);
}
.tabbar__add svg { width: 20px; height: 20px; color: var(--white); }
.tabbar__add span { color: var(--text-mute); font-size: 11px; }

/* ────────────────────────────────────────
   5. 버튼
──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  line-height: 1;
  transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast), opacity var(--dur-fast);
  white-space: nowrap;
  cursor: pointer;
  border: none;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Primary */
.btn--primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(61,107,79,.22);
}
.btn--primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(61,107,79,.30);
}

/* Secondary */
.btn--secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--secondary:hover { border-color: var(--border-hover); background: var(--bg); }

/* Ghost */
.btn--ghost {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--bg); color: var(--text); }

/* Danger */
.btn--danger {
  background: var(--danger);
  color: var(--white);
}
.btn--danger:hover { background: #c62828; }

/* Danger ghost */
.btn--danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn--danger-ghost:hover { background: var(--danger-light); }

/* 쿠팡 */
.btn--coupang {
  background: #FF6000;
  color: var(--white);
  font-size: 13px;
  padding: 8px 14px;
}
.btn--coupang:hover { background: #e05500; }

/* 유튜브 */
.btn--youtube {
  background: #FF0000;
  color: var(--white);
  font-size: 13px;
  padding: 8px 14px;
}
.btn--youtube:hover { background: #cc0000; }

/* 크기 변형 */
.btn--sm { font-size: 12px; padding: 7px 12px; }
.btn--lg { font-size: 16px; padding: 14px 28px; }
.btn--full { width: 100%; }

/* 비활성 */
.btn:disabled, .btn--disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ────────────────────────────────────────
   6. 카드
──────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--dur), border-color var(--dur);
}
.card:hover { box-shadow: var(--shadow); }

.card--clickable {
  cursor: pointer;
}
.card--clickable:active { transform: scale(.99); }

.card__body { padding: var(--space-md); }
.card__body--sm { padding: var(--space-sm) var(--space-md); }

/* 기기 카드 (list.html) */
.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transition: transform var(--dur-fast), box-shadow var(--dur);
  touch-action: pan-y;
}
.device-card__content {
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-card);
  position: relative;
  z-index: 1;
  transition: transform var(--dur) var(--ease);
  cursor: pointer;
}
.device-card__icon {
  width: 44px;
  height: 44px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}
.device-card__info { flex: 1; min-width: 0; }
.device-card__name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.device-card__model {
  font-size: 12px;
  color: var(--text-mute);
}
.device-card__status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

/* iOS 스와이프 삭제 레이어 */
.device-card__delete-bg {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 80px;
  background: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  gap: 4px;
  flex-direction: column;
  z-index: 0;
}
.device-card__delete-bg svg { width: 18px; height: 18px; }
.device-card.swiped .device-card__content {
  transform: translateX(-80px);
}

/* ────────────────────────────────────────
   7. D-day 뱃지 & 상태 표시
──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}
.badge--urgent { background: var(--urgent-light); color: var(--urgent); }
.badge--near   { background: var(--near-light);   color: var(--near); }
.badge--safe   { background: var(--safe-light);   color: var(--safe); }
.badge--mute   { background: var(--bg);           color: var(--text-mute); border: 1px solid var(--border); }

/* 진행률 바 */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  width: 64px;
}
.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width .6s var(--ease);
}
.progress-bar__fill--urgent { background: var(--urgent); }
.progress-bar__fill--near   { background: var(--near); }
.progress-bar__fill--safe   { background: var(--safe); }

/* ────────────────────────────────────────
   8. 요약 대시보드 카드 (list.html 상단)
──────────────────────────────────────── */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.summary-card__label {
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 4px;
  font-weight: 500;
}
.summary-card__value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-family: var(--font-serif);
}
.summary-card__unit {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-sub);
  margin-left: 2px;
}
.summary-card--urgent .summary-card__value { color: var(--urgent); }

/* ────────────────────────────────────────
   9. 폼 요소
──────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-md);
}
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
}
.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-size: 15px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61,107,79,.12);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-mute); }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239B9891' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-hint {
  font-size: 12px;
  color: var(--text-mute);
}
.form-error {
  font-size: 12px;
  color: var(--danger);
}

/* 토글 스위치 */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background var(--dur-fast);
  cursor: pointer;
}
.toggle__track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--dur-fast);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); }

/* ────────────────────────────────────────
   10. 아코디언 (detail.html)
──────────────────────────────────────── */
.accordion { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.accordion__item { border-bottom: 1px solid var(--border); }
.accordion__item:last-child { border-bottom: none; }

.accordion__header {
  width: 100%;
  display: flex;
  align-items: center;
  padding: var(--space-md);
  gap: var(--space-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: background var(--dur-fast);
  text-align: left;
}
.accordion__header:hover { background: var(--bg); }

.accordion__chevron {
  width: 18px; height: 18px;
  color: var(--text-mute);
  transition: transform var(--dur) var(--ease);
  flex-shrink: 0;
  margin-left: auto;
}
.accordion__item.open .accordion__chevron { transform: rotate(180deg); }

.accordion__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-slow) var(--ease);
  background: var(--bg);
}
.accordion__item.open .accordion__body { max-height: 400px; }
.accordion__body-inner { padding: var(--space-md); }

/* 아코디언 내 액션 버튼 그룹 */
.accordion__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

/* ────────────────────────────────────────
   11. 다이얼로그 / 모달
──────────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(55,53,47,.4);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur);
}
.dialog-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.dialog {
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius) var(--radius);
  padding: var(--space-lg);
  width: 100%;
  max-width: var(--max-w);
  transform: translateY(20px);
  transition: transform var(--dur) var(--ease);
}
.dialog-overlay.show .dialog { transform: translateY(0); }
.dialog__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-sm);
}
.dialog__desc {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}
.dialog__actions {
  display: flex;
  gap: var(--space-sm);
}
.dialog__actions .btn { flex: 1; }

/* ────────────────────────────────────────
   12. 토스트 알림
──────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--space-md));
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  width: calc(100% - var(--space-lg) * 2);
  max-width: calc(var(--max-w) - var(--space-lg) * 2);
}
.toast {
  background: var(--text);
  color: var(--white);
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  box-shadow: var(--shadow-md);
  animation: toastIn var(--dur) var(--ease) forwards;
  pointer-events: all;
}
.toast.hide { animation: toastOut var(--dur) var(--ease) forwards; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast--success { background: var(--ok); }
.toast--error   { background: var(--danger); }
.toast--warn    { background: var(--warn); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ────────────────────────────────────────
   13. 로딩 스피너
──────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner--white {
  border-color: rgba(255,255,255,.3);
  border-top-color: var(--white);
}
.spinner--lg { width: 36px; height: 36px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* 로딩 상태 전체 화면 */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  gap: var(--space-md);
  color: var(--text-mute);
  font-size: 14px;
}

/* AI 검색 중 애니메이션 */
.ai-searching {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-md);
  gap: var(--space-md);
  text-align: center;
}
.ai-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ai-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: dotBounce .8s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: .15s; }
.ai-dot:nth-child(3) { animation-delay: .30s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(.8); opacity: .5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* ────────────────────────────────────────
   14. 빈 상태 (Empty State)
──────────────────────────────────────── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-md);
  text-align: center;
  gap: var(--space-md);
}
.empty__icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: var(--space-sm);
}
.empty__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-xs);
}
.empty__desc {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.7;
  max-width: 260px;
}

/* ────────────────────────────────────────
   15. 대화형 등록 (register.html)
──────────────────────────────────────── */
.chat-flow {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
}
.chat-bubble {
  max-width: 88%;
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.6;
  animation: bubbleIn var(--dur) var(--ease);
}
.chat-bubble--system {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
  align-self: flex-start;
  border-radius: var(--radius-sm) var(--radius-md) var(--radius-md) var(--radius-md);
}
.chat-bubble--user {
  background: var(--accent);
  color: var(--white);
  align-self: flex-end;
  border-radius: var(--radius-md) var(--radius-sm) var(--radius-md) var(--radius-md);
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 소모품 카드 (등록·상세 공통) */
.consumable-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.consumable-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: space-between;
}
.consumable-card__name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.consumable-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 13px;
  color: var(--text-sub);
}

/* ────────────────────────────────────────
   16. 섹션 헤더
──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.section-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .6px;
}

/* ────────────────────────────────────────
   17. 구분선
──────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}
.divider--dashed {
  background: none;
  border-top: 1px dashed var(--border);
}

/* ────────────────────────────────────────
   18. 페이지 전환 애니메이션
──────────────────────────────────────── */
.page-enter {
  animation: pageSlideIn var(--dur-slow) var(--ease) forwards;
}
@keyframes pageSlideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ────────────────────────────────────────
   19. 유틸리티
──────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.text-mute { color: var(--text-mute); font-size: 13px; }
.text-center { text-align: center; }
.font-serif { font-family: var(--font-serif); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }

/* ────────────────────────────────────────
   20. PWA / 모바일 최적화
──────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --space-md: 14px;
    --space-lg: 20px;
  }
}

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .tabbar {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }
  .page {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--space-md));
  }
}

/* 스크롤바 스타일 */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* 선택 영역 색상 */
::selection { background: var(--accent-mute); color: var(--text); }

/* 포커스 아웃라인 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
