/* ============================================================
   실리콘밸리 마스터 — Design System
   Apple HIG · Glassmorphism · Dark Mode · Mobile First
   ============================================================ */

:root {
  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text',
          'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR', sans-serif;

  /* iOS system palette */
  --blue:   #0a84ff;
  --green:  #30d158;
  --orange: #ff9f0a;
  --red:    #ff453a;
  --purple: #bf5af2;
  --pink:   #ff375f;
  --teal:   #64d2ff;
  --indigo: #5e5ce6;
  --yellow: #ffd60a;
  --mint:   #66d4cf;

  /* Layout */
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --header-h: 64px;
  --tabbar-h: 76px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --spring: cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* ---------- Theme tokens ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a12;
  --bg-grad-1: rgba(10, 132, 255, 0.16);
  --bg-grad-2: rgba(191, 90, 242, 0.13);
  --bg-grad-3: rgba(48, 209, 88, 0.10);
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.64);
  --text-3: rgba(235, 235, 245, 0.38);
  --card: rgba(255, 255, 255, 0.065);
  --card-strong: rgba(28, 28, 36, 0.86);
  --card-hover: rgba(255, 255, 255, 0.11);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  --glass-blur: saturate(180%) blur(22px);
  --input-bg: rgba(255, 255, 255, 0.07);
  --chip-bg: rgba(255, 255, 255, 0.09);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f7;
  --bg-grad-1: rgba(10, 132, 255, 0.16);
  --bg-grad-2: rgba(191, 90, 242, 0.12);
  --bg-grad-3: rgba(48, 209, 88, 0.12);
  --text: #16161d;
  --text-2: rgba(30, 30, 40, 0.62);
  --text-3: rgba(30, 30, 40, 0.38);
  --card: rgba(255, 255, 255, 0.62);
  --card-strong: rgba(255, 255, 255, 0.92);
  --card-hover: rgba(255, 255, 255, 0.85);
  --stroke: rgba(20, 20, 40, 0.08);
  --stroke-strong: rgba(20, 20, 40, 0.14);
  --shadow: 0 12px 32px rgba(30, 40, 90, 0.12);
  --glass-blur: saturate(180%) blur(22px);
  --input-bg: rgba(255, 255, 255, 0.75);
  --chip-bg: rgba(20, 20, 40, 0.06);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  transition: background 0.35s ease, color 0.35s ease;
}

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

/* 아이콘 기본 크기 — flex 컨테이너에서 늘어나지 않도록 고정.
   더 구체적인 클래스 규칙(.btn svg 등)이 이 값을 덮어쓴다. */
svg { width: 18px; height: 18px; flex: none; }
.progress-ring { width: auto; height: auto; }

/* ---------- Background blobs ---------- */
.bg-decor { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.9; }
.blob-1 { width: 46vh; height: 46vh; top: -12vh; right: -14vh; background: var(--bg-grad-1); animation: drift1 26s ease-in-out infinite alternate; }
.blob-2 { width: 40vh; height: 40vh; bottom: 6vh; left: -16vh; background: var(--bg-grad-2); animation: drift2 32s ease-in-out infinite alternate; }
.blob-3 { width: 34vh; height: 34vh; top: 42vh; right: -10vh; background: var(--bg-grad-3); animation: drift1 38s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(-8vh, 7vh) scale(1.12); } }
@keyframes drift2 { to { transform: translate(9vh, -6vh) scale(1.08); } }

/* ---------- Glass surfaces ---------- */
.glass {
  background: var(--card);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke);
}
.glass-strong {
  background: var(--card-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke);
}

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  padding-top: var(--safe-top);
  border-width: 0 0 1px 0;
  border-radius: 0;
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  max-width: 760px; margin: 0 auto;
}
.header-title-wrap { flex: 1; min-width: 0; }
.header-title-wrap h1 {
  font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-title-wrap p {
  font-size: 11.5px; color: var(--text-3); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--chip-bg); border: 1px solid var(--stroke);
  transition: transform 0.15s var(--spring), background 0.2s;
}
.icon-btn:active { transform: scale(0.88); background: var(--card-hover); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- Main ---------- */
.app-main {
  max-width: 760px; margin: 0 auto;
  padding: calc(var(--header-h) + var(--safe-top) + 14px) 16px
           calc(var(--tabbar-h) + var(--safe-bottom) + 90px);
  animation: viewIn 0.34s var(--spring);
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view-enter { animation: viewIn 0.34s var(--spring); }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  border-width: 1px 0 0 0; border-radius: 0;
  padding: 6px 8px calc(var(--safe-bottom) + 6px);
  display: grid; grid-template-columns: repeat(5, 1fr);
  max-width: 760px; margin: 0 auto;
}
@media (min-width: 760px) {
  .tabbar { border-radius: 22px 22px 0 0; border-width: 1px 1px 0 1px; }
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; border-radius: 14px; color: var(--text-3);
  font-size: 10.5px; font-weight: 600; letter-spacing: -0.01em;
  transition: color 0.2s, transform 0.15s var(--spring);
}
.tab-item svg { width: 22px; height: 22px; transition: transform 0.25s var(--spring); }
.tab-item.active { color: var(--blue); }
.tab-item.active svg { transform: translateY(-1px) scale(1.08); }
.tab-item:active { transform: scale(0.92); }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 18px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  width: 56px; height: 56px; border-radius: 19px; z-index: 39;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  color: #fff; box-shadow: 0 10px 26px rgba(10, 132, 255, 0.42);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s var(--spring), box-shadow 0.2s;
}
.fab svg { width: 24px; height: 24px; }
.fab:active { transform: scale(0.9) rotate(90deg); }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.16s var(--spring), background 0.2s, border-color 0.2s;
}
.card.pressable:active { transform: scale(0.975); background: var(--card-hover); }
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 17px; height: 17px; }

.section-label {
  font-size: 12.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 22px 4px 10px; display: flex; align-items: center; gap: 6px;
}
.section-label svg { width: 14px; height: 14px; }
.section-label:first-child { margin-top: 4px; }

/* ---------- Hero (dashboard D-Day) ---------- */
.hero {
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  background: linear-gradient(140deg, rgba(10,132,255,0.32), rgba(94,92,230,0.26) 55%, rgba(191,90,242,0.22));
  border: 1px solid var(--stroke-strong);
  position: relative; overflow: hidden;
  margin-bottom: 14px;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 85% -10%, rgba(255,255,255,0.16), transparent 55%);
  pointer-events: none;
}
.hero-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.hero-dday { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; margin: 4px 0 2px; }
.hero-dday small { font-size: 18px; font-weight: 700; color: var(--text-2); margin-left: 6px; }
.hero-sub { font-size: 13px; color: var(--text-2); font-weight: 500; }
.hero-count {
  display: flex; gap: 8px; margin-top: 16px;
}
.count-cell {
  flex: 1; text-align: center; padding: 10px 4px;
  background: rgba(255,255,255,0.10); border: 1px solid var(--stroke);
  border-radius: 14px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.count-cell b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.count-cell span { font-size: 10.5px; color: var(--text-2); font-weight: 600; }

/* ---------- Stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.stat-card { padding: 14px; border-radius: var(--radius); }
.stat-card .stat-icon {
  width: 34px; height: 34px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.stat-card .stat-icon svg { width: 18px; height: 18px; }
.stat-card b { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-card span { display: block; font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-top: 1px; }

/* ---------- Progress ---------- */
.progress-track {
  height: 8px; border-radius: 99px; background: var(--chip-bg);
  overflow: hidden; margin-top: 8px;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  transition: width 0.7s var(--spring);
}
.progress-fill.green { background: linear-gradient(90deg, #2ebd59, var(--green)); }
.progress-fill.orange { background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.progress-fill.purple { background: linear-gradient(90deg, var(--indigo), var(--purple)); }

.progress-ring { transform: rotate(-90deg); }
.progress-ring .ring-bg { stroke: var(--chip-bg); }
.progress-ring .ring-fg { stroke: var(--blue); transition: stroke-dashoffset 0.8s var(--spring); stroke-linecap: round; }

/* ---------- Rows / list items ---------- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--stroke);
  margin-bottom: 8px;
  transition: transform 0.15s var(--spring), background 0.2s, opacity 0.3s;
}
.row:active { transform: scale(0.98); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.row-sub { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.row.done .row-title { text-decoration: line-through; color: var(--text-3); }
.row.done { opacity: 0.6; }

/* Checkbox */
.checkbox {
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  border: 1.8px solid var(--stroke-strong);
  display: flex; align-items: center; justify-content: center;
  color: transparent; transition: all 0.2s var(--spring);
  background: transparent;
}
.checkbox svg { width: 14px; height: 14px; stroke-width: 3; }
.checkbox.on { background: var(--green); border-color: var(--green); color: #fff; transform: scale(1.04); }
.checkbox.blue.on { background: var(--blue); border-color: var(--blue); }

/* Star */
.star-btn { color: var(--text-3); transition: transform 0.2s var(--spring), color 0.2s; padding: 4px; }
.star-btn svg { width: 19px; height: 19px; }
.star-btn.on { color: var(--yellow); }
.star-btn.on svg { fill: var(--yellow); }
.star-btn:active { transform: scale(1.3) rotate(18deg); }

/* ---------- Chips / badges ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

/* 가로 스크롤 여부 표시 — 오른쪽 페이드 + 화살표 버튼 */
.chip-scroll { position: relative; }
.chip-scroll.more .chip-row {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent 100%);
}
.chip-next {
  position: absolute; right: 0; top: 0; bottom: 10px;
  width: 30px; height: 30px; margin: auto 0;
  border-radius: 50%;
  background: var(--card-strong);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--stroke-strong);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.15s var(--spring);
}
.chip-next svg { width: 15px; height: 15px; }
.chip-scroll.more .chip-next { opacity: 1; pointer-events: auto; animation: nudge 2.4s ease-in-out 3; }
.chip-next:active { transform: scale(0.85); }
@keyframes nudge {
  0%, 82%, 100% { transform: translateX(0); }
  88% { transform: translateX(3px); }
  94% { transform: translateX(0); }
}
.chip {
  flex: none; padding: 7px 14px; border-radius: 99px;
  background: var(--chip-bg); border: 1px solid var(--stroke);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  transition: all 0.2s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.chip svg { width: 13px; height: 13px; }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px;
  letter-spacing: 0.01em; white-space: nowrap;
}
.badge svg { width: 11px; height: 11px; }

/* Type colors (일정) */
.t-company  { background: rgba(10,132,255,0.16);  color: #6ab6ff; }
.t-tour     { background: rgba(48,209,88,0.16);   color: #5cd97a; }
.t-move     { background: rgba(255,159,10,0.16);  color: #ffb340; }
.t-hotel    { background: rgba(191,90,242,0.16);  color: #cf8af5; }
.t-meal     { background: rgba(255,55,95,0.16);   color: #ff7597; }
.t-flight   { background: rgba(100,210,255,0.16); color: #7cd8ff; }
.t-activity { background: rgba(94,92,230,0.16);   color: #9c9af0; }
[data-theme="light"] .t-company  { color: #0063cc; }
[data-theme="light"] .t-tour     { color: #1a8f42; }
[data-theme="light"] .t-move     { color: #b36b00; }
[data-theme="light"] .t-hotel    { color: #8e2fc4; }
[data-theme="light"] .t-meal     { color: #d1275a; }
[data-theme="light"] .t-flight   { color: #0077b3; }
[data-theme="light"] .t-activity { color: #4a48c9; }

/* Priority */
.p-high { background: rgba(255,69,58,0.16); color: #ff6b62; }
.p-mid  { background: rgba(255,159,10,0.16); color: #ffb340; }
.p-low  { background: rgba(142,142,147,0.18); color: var(--text-2); }
[data-theme="light"] .p-high { color: #d42a20; }
[data-theme="light"] .p-mid { color: #b36b00; }

/* ---------- Timeline (일정 상세) ---------- */
.day-nav { position: sticky; top: calc(var(--header-h) + var(--safe-top) + 2px); z-index: 10; margin: 0 -16px 12px; padding: 8px 16px; }
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, var(--blue), var(--purple));
  opacity: 0.35;
}
.tl-item { position: relative; margin-bottom: 12px; }
.tl-dot {
  position: absolute; left: -24px; top: 18px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 2.5px solid var(--blue);
  transition: all 0.25s var(--spring);
}
.tl-item.done .tl-dot { background: var(--green); border-color: var(--green); }
.tl-time { font-size: 12px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- Inputs ---------- */
.input, .textarea, .select {
  width: 100%; padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  font-size: 14.5px; color: var(--text);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none; appearance: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.22);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.field { margin-bottom: 12px; }
.field-label { font-size: 12px; font-weight: 700; color: var(--text-2); margin: 0 2px 6px; display: block; }

/* Search bar */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 14px;
  background: var(--input-bg); border: 1px solid var(--stroke);
  margin-bottom: 12px;
}
.searchbar svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.searchbar input { flex: 1; background: none; border: none; outline: none; font-size: 14.5px; color: var(--text); min-width: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 18px; border-radius: 14px;
  font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em;
  background: var(--blue); color: #fff;
  transition: transform 0.15s var(--spring), opacity 0.2s, background 0.2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.95); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--chip-bg); color: var(--text); border: 1px solid var(--stroke); }
.btn.danger { background: rgba(255,69,58,0.14); color: var(--red); border: 1px solid rgba(255,69,58,0.28); }
.btn.green { background: var(--green); }
.btn.small { padding: 8px 13px; font-size: 12.5px; border-radius: 11px; }

/* ---------- Sheet (bottom sheet) ---------- */
.sheet-backdrop, .modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.48);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity 0.28s ease;
}
.sheet-backdrop.show, .modal-backdrop.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  max-width: 760px; margin: 0 auto;
  border-radius: 26px 26px 0 0;
  border-width: 1px 1px 0 1px;
  padding: 10px 18px calc(var(--safe-bottom) + 22px);
  transform: translateY(105%);
  transition: transform 0.36s var(--spring);
  max-height: 86dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet.show { transform: translateY(0); }
.sheet-grabber { width: 40px; height: 4.5px; border-radius: 99px; background: var(--stroke-strong); margin: 4px auto 14px; }
.sheet h3 { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 14px; }

/* More-menu grid inside sheet */
.more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.more-cell {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 4px 11px; border-radius: 16px;
  background: var(--chip-bg); border: 1px solid var(--stroke);
  font-size: 11px; font-weight: 600; color: var(--text-2);
  transition: transform 0.15s var(--spring), background 0.2s;
}
.more-cell:active { transform: scale(0.9); }
.more-cell.active { color: var(--blue); border-color: rgba(10,132,255,0.5); }
.more-cell .mc-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.more-cell .mc-icon svg { width: 19px; height: 19px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; z-index: 61;
  left: 50%; top: 50%;
  width: min(92vw, 560px);
  max-height: 82dvh; overflow-y: auto;
  border-radius: var(--radius-lg);
  padding: 20px;
  transform: translate(-50%, -46%) scale(0.92); opacity: 0;
  pointer-events: none;
  transition: transform 0.32s var(--spring), opacity 0.24s ease;
  -webkit-overflow-scrolling: touch;
}
.modal.show { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h3 { flex: 1; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; left: 0; right: 0; z-index: 80;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-strong);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke-strong);
  color: var(--text); font-size: 13.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 99px;
  box-shadow: var(--shadow);
  animation: toastIn 0.34s var(--spring);
}
.toast svg { width: 16px; height: 16px; color: var(--green); }
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(0.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(0.94); } }

/* ---------- Segmented control ---------- */
.segment {
  display: flex; background: var(--chip-bg); border-radius: 13px;
  padding: 3px; border: 1px solid var(--stroke); margin-bottom: 14px;
  overflow-x: auto; scrollbar-width: none;
}
.segment::-webkit-scrollbar { display: none; }
.segment button {
  flex: 1; padding: 8px 10px; border-radius: 10px;
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
  transition: all 0.22s; white-space: nowrap;
}
.segment button.active { background: var(--card-strong); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.18); }

/* ---------- Company cards ---------- */
.co-card { overflow: hidden; position: relative; }
.co-logo {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  overflow: hidden;
}
/* 워드마크 타일 — 공식 마크를 구할 수 없는 기업용 */
.co-mark {
  font-weight: 800; letter-spacing: -0.02em; text-align: center;
  line-height: 1.05; padding: 0 3px; word-break: break-word;
}
/* 사용자가 직접 올린 로고 이미지 */
.co-logo-img { background: #fff; padding: 4px; }
.co-logo-img img { width: 100%; height: 100%; object-fit: contain; }
.co-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.rating { display: inline-flex; gap: 2px; }
.rating button { padding: 2px; color: var(--text-3); }
.rating button svg { width: 22px; height: 22px; }
.rating button.on { color: var(--yellow); }
.rating button.on svg { fill: var(--yellow); }

/* ---------- English phrase card ---------- */
.phrase-en { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.45; }
.phrase-ko { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.phrase-tip { font-size: 12px; color: var(--teal); margin-top: 6px; display: flex; gap: 5px; align-items: flex-start; }
.phrase-tip svg { width: 13px; height: 13px; flex: none; margin-top: 2px; }

/* Quiz */
.quiz-option {
  width: 100%; text-align: left; padding: 14px 16px; margin-bottom: 9px;
  border-radius: 14px; background: var(--card); border: 1.5px solid var(--stroke);
  font-size: 14.5px; font-weight: 600;
  transition: all 0.2s;
}
.quiz-option:active { transform: scale(0.98); }
.quiz-option.correct { background: rgba(48,209,88,0.18); border-color: var(--green); }
.quiz-option.wrong { background: rgba(255,69,58,0.16); border-color: var(--red); animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* ---------- Markdown preview ---------- */
.md-preview { font-size: 14px; line-height: 1.7; }
.md-preview h1 { font-size: 19px; margin: 14px 0 8px; letter-spacing: -0.02em; }
.md-preview h2 { font-size: 16.5px; margin: 13px 0 7px; letter-spacing: -0.02em; }
.md-preview h3 { font-size: 15px; margin: 12px 0 6px; }
.md-preview p { margin-bottom: 8px; }
.md-preview ul, .md-preview ol { margin: 6px 0 10px 20px; }
.md-preview ul { list-style: disc; }
.md-preview ol { list-style: decimal; }
.md-preview li { margin-bottom: 3px; }
.md-preview code {
  font-family: 'SF Mono', ui-monospace, monospace; font-size: 12.5px;
  background: var(--chip-bg); padding: 2px 6px; border-radius: 6px;
}
.md-preview blockquote {
  border-left: 3px solid var(--blue); padding: 4px 12px; margin: 8px 0;
  color: var(--text-2); background: var(--chip-bg); border-radius: 0 10px 10px 0;
}
.md-preview strong { font-weight: 700; }
.md-preview hr { border: none; border-top: 1px solid var(--stroke); margin: 12px 0; }

/* ---------- Diary ---------- */
.mood-row { display: flex; gap: 8px; justify-content: space-between; }
.mood-btn {
  flex: 1; font-size: 26px; padding: 10px 0; border-radius: 14px;
  background: var(--chip-bg); border: 1.5px solid var(--stroke);
  transition: all 0.2s var(--spring); filter: grayscale(0.7); opacity: 0.72;
}
.mood-btn.on { filter: none; opacity: 1; transform: scale(1.1); border-color: var(--blue); background: rgba(10,132,255,0.12); }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.photo-grid .ph {
  aspect-ratio: 1; border-radius: 12px; overflow: hidden; position: relative;
  border: 1px solid var(--stroke);
}
.photo-grid .ph img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid .ph .ph-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.photo-grid .ph .ph-del svg { width: 12px; height: 12px; }
.photo-add {
  aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--stroke-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-3); font-size: 11px; font-weight: 600;
  transition: all 0.2s;
}
.photo-add svg { width: 20px; height: 20px; }
.photo-add:active { transform: scale(0.94); border-color: var(--blue); color: var(--blue); }

/* ---------- Budget ---------- */
.money-big { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.money-pos { color: var(--green); }
.money-neg { color: var(--red); }
.exch-box { display: flex; align-items: center; gap: 10px; }
.exch-box .input { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.exch-mid { flex: none; color: var(--text-3); }
.exch-mid svg { width: 18px; height: 18px; }

/* ---------- 기능 소개 (첫 실행 2페이지) ---------- */
.intro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.intro-cell {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 11px; border-radius: 14px;
  background: var(--chip-bg); border: 1px solid var(--stroke);
  flex-wrap: wrap;
}
.intro-cell .ic {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 132, 255, 0.16); color: var(--blue);
}
.intro-cell .ic svg { width: 15px; height: 15px; }
.intro-cell b { font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
.intro-cell span {
  width: 100%; font-size: 10.5px; color: var(--text-3);
  font-weight: 500; line-height: 1.3;
}
.intro-hint {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--chip-bg); color: var(--blue);
}
.intro-hint svg { width: 14px; height: 14px; }
/* 내용이 길어져도 버튼이 항상 보이도록 하단에 고정 */
.intro-actions {
  position: sticky; bottom: -20px; z-index: 1;
  margin: 14px -20px -20px; padding: 4px 20px 20px;
  background: linear-gradient(to bottom, transparent, var(--card-strong) 22%);
}
.intro-dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 12px; }
.intro-dots span {
  width: 6px; height: 6px; border-radius: 99px;
  background: var(--stroke-strong); transition: all 0.3s var(--spring);
}
.intro-dots span.on { width: 18px; background: var(--blue); }

/* ---------- 홈 화면 추가 배너 ---------- */
.install-banner {
  position: fixed; z-index: 50;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  max-width: 736px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 18px;
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow);
  transform: translateY(140%); opacity: 0;
  transition: transform 0.5s var(--spring), opacity 0.4s ease;
}
.install-banner.show { transform: translateY(0); opacity: 1; }
.install-banner .ib-icon {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue), var(--indigo)); color: #fff;
}
.install-banner .ib-text { flex: 1; min-width: 0; line-height: 1.35; }
/* 자식 선택자 — 안내 문구 안에 중첩된 <b>까지 블록이 되지 않도록 */
.install-banner .ib-text > b { display: block; font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
.install-banner .ib-text > span {
  display: flex; align-items: center; gap: 3px;
  font-size: 11.5px; color: var(--text-2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.install-banner .ib-text > span svg { width: 13px; height: 13px; color: var(--blue); }
.install-banner .icon-btn { width: 30px; height: 30px; border-radius: 9px; }
.install-banner .icon-btn svg { width: 15px; height: 15px; }
/* 배너가 떠 있는 동안 FAB·토스트를 위로 밀어 겹치지 않게 한다 */
body.has-install-banner .fab { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 84px); }
body.has-install-banner .toast-wrap { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 88px); }

.ib-step {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue); color: #fff; font-size: 12px; font-weight: 700;
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 44px 20px; color: var(--text-3);
}
.empty svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.5; }
.empty p { font-size: 14px; font-weight: 600; }
.empty small { font-size: 12px; }

/* ---------- Detail rows ---------- */
.kv { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--stroke); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv b { flex: none; width: 92px; color: var(--text-2); font-weight: 600; }
.kv span { flex: 1; }

/* ---------- Misc ---------- */
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.muted-3 { color: var(--text-3); }
.small { font-size: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.flex { display: flex; } .flex-1 { flex: 1; min-width: 0; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tabular { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 스크롤바 최소화 */
::-webkit-scrollbar { width: 0; height: 0; }

/* 리스트 아이템 등장 애니메이션 */
.stagger > * { animation: viewIn 0.4s var(--spring) backwards; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.08s; }
.stagger > *:nth-child(4) { animation-delay: 0.11s; }
.stagger > *:nth-child(5) { animation-delay: 0.14s; }
.stagger > *:nth-child(6) { animation-delay: 0.17s; }

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