/* ============================================================
   홈 허브 — 디자인 시스템
   웜페이퍼 톤 · 고가독성 · 큰 터치 타깃 (40대+ 배려)
   ============================================================ */

:root {
  --bg: #F7F1E8;
  --bg-deep: #F2EADC;
  --surface: #FFFFFF;
  --ink: #2A1D10;
  --ink-2: #6E5F4C;
  --ink-3: #9A8A73;
  --line: #EAE0CF;
  --line-2: #E0D4BE;

  --primary: #B85C2E;
  --primary-deep: #9C4A22;
  --primary-ink: #8A3F1B;
  --primary-soft: #F8E8DB;
  --primary-soft-2: #F2D8C4;

  --green: #2F7D5B;
  --green-soft: #E4F0E8;
  --red: #C24029;
  --red-soft: #FBE6DF;
  --amber: #96650F;
  --amber-soft: #FBF0D8;
  --gray-soft: #EFE9DE;

  --radius: 18px;
  --radius-s: 12px;
  --shadow-1: 0 1px 2px rgba(42, 29, 16, 0.05), 0 10px 28px -14px rgba(42, 29, 16, 0.12);
  --shadow-2: 0 2px 6px rgba(42, 29, 16, 0.08), 0 18px 44px -16px rgba(42, 29, 16, 0.22);
  --rail-w: 236px;
  --tab-h: 66px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "맑은 고딕", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
/* 앱형 UI: 클래식 스크롤바가 고정 하단바/상단바와 폭을 나눠가지지 않도록 숨김
   (마우스휠·터치 스크롤은 그대로 동작, 모바일 브라우저와 동일한 화면) */
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar { display: none; width: 0; height: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 85% -10%, #FBEFE1 0%, transparent 60%),
    radial-gradient(900px 420px at -10% 20%, #F4ECDD 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.62;
  letter-spacing: -0.012em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--primary-soft-2); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
h1, h2, h3 { line-height: 1.3; font-weight: 800; letter-spacing: -0.02em; }

:focus-visible { outline: 2.5px solid rgba(184, 92, 46, 0.65); outline-offset: 2px; border-radius: 6px; }

/* ---------- 아이콘 ---------- */
.icn { width: 1.18em; height: 1.18em; display: inline-block; vertical-align: -0.22em; flex: none; }
.cat-tile { display: inline-flex; align-items: center; justify-content: center; border-radius: 32%; flex: none; }
.cat-tile-icn { width: 58%; height: 58%; }

/* ============================================================
   셸 (레일 / 모바일탑바 / 하단탭 / 뷰)
   ============================================================ */
.app { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 1fr; }

.rail { display: none; }
.mobile-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px calc(0px + env(safe-area-inset-top, 0px));
  background: rgba(247, 241, 232, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #CE7038, var(--primary-deep));
  color: #FFF4E9; box-shadow: 0 6px 14px -6px rgba(156, 74, 34, 0.55);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 17px; letter-spacing: -0.02em; }
.brand-text small { font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.brand-sm b { font-size: 16.5px; }
.mtop-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); border: 1px solid var(--line); background: var(--surface);
}
.mtop-btn .icn { width: 20px; height: 20px; }

.view { padding: 22px 16px calc(var(--tab-h) + 26px + env(safe-area-inset-bottom, 0px)); min-height: 70vh; }
.page { max-width: 860px; margin: 0 auto; }
.view-fade { animation: fadeUp .32s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: stretch;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(252, 248, 241, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 700; color: var(--ink-3); position: relative;
}
.tabbar a .tab-icn .icn { width: 23px; height: 23px; }
/* 숫자 뱃지는 아이콘 오른쪽 위 모서리에 겹치게 (세로 흐름에서 밀려나 깨지지 않도록) */
.tabbar a .nav-badge {
  position: absolute; top: 6px; left: calc(50% + 9px);
}
.tabbar a.on { color: var(--primary-deep); }
.tabbar a.on::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 4px 4px; background: var(--primary);
}
.tab-add { flex: 0.9 !important; }
.tab-add .tab-icn {
  width: 54px; height: 54px; margin-top: -26px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #CE7038, var(--primary-deep));
  color: #FFF4E9; box-shadow: 0 10px 20px -6px rgba(156, 74, 34, 0.5), 0 0 0 5px var(--bg);
}
.tab-add .tab-icn .icn { width: 25px; height: 25px; }
.tab-add:active .tab-icn { transform: scale(0.94); }

/* 뱃지 (탭/레일) */
.nav-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; font-style: normal;
}

/* ---------- 데스크톱 ---------- */
@media (min-width: 880px) {
  .app { grid-template-columns: var(--rail-w) 1fr; gap: 40px; }
  .mobile-top, .tabbar { display: none; }
  .view { padding: 44px 44px 90px; min-height: 100vh; }
  .rail {
    display: flex; flex-direction: column; gap: 8px;
    position: sticky; top: 0; height: 100vh; padding: 30px 14px 24px 22px;
  }
  .rail-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 26px; }
  .rail-nav a, .rail-cta {
    display: flex; align-items: center; gap: 13px;
    padding: 12px 14px; border-radius: 14px;
    font-weight: 700; font-size: 15.5px; color: var(--ink-2);
    position: relative; transition: background .15s, color .15s;
  }
  .rail-nav a:hover { background: rgba(255, 255, 255, 0.7); color: var(--ink); }
  .rail-nav a.on { background: var(--surface); color: var(--primary-ink); box-shadow: var(--shadow-1); }
  .rail-nav a.on::before {
    content: ""; position: absolute; left: -22px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--primary);
  }
  .rail-icn .icn { width: 21px; height: 21px; }
  .rail-nav .nav-badge { margin-left: auto; }
  .rail-cta {
    margin-top: 18px; justify-content: center;
    background: linear-gradient(145deg, #CE7038, var(--primary-deep));
    color: #FFF4E9; box-shadow: 0 10px 22px -8px rgba(156, 74, 34, 0.5);
  }
  .rail-cta:hover { filter: brightness(1.05); }
  .rail-cta:active { transform: scale(0.98); }
  .rail-foot { margin-top: auto; font-size: 12px; color: var(--ink-3); padding: 0 14px; line-height: 1.5; }
}

/* ============================================================
   페이지 공통
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-sub { color: var(--ink-2); font-size: 14.5px; margin-top: 3px; font-weight: 500; }
.page-head-actions { display: flex; gap: 8px; align-items: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 20px;
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h2 { font-size: 17.5px; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icn { color: var(--primary); width: 20px; height: 20px; }

.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
.link-more { font-size: 14px; font-weight: 700; color: var(--primary-ink); display: inline-flex; align-items: center; gap: 2px; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--radius-s); padding: 10px 16px;
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
  border: 1px solid transparent; transition: background .15s, transform .08s, box-shadow .15s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .icn { width: 17px; height: 17px; }

.btn-primary {
  background: linear-gradient(145deg, #C56736, var(--primary-deep));
  color: #FFF6EC; box-shadow: 0 8px 18px -8px rgba(156, 74, 34, 0.55);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-soft { background: #F4EBDD; color: #54422D; }
.btn-soft:hover { background: #EFE2CD; }
.btn-primary-soft { background: var(--primary-soft); color: var(--primary-ink); border-color: var(--primary-soft-2); }
.btn-primary-soft:hover { background: #F5DFCC; }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.75); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-ghost { background: #FDF2EE; color: #A93718; border-color: #F0CDC1; }
.btn-danger-ghost:hover { background: #FAE7DF; }
.btn-sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn-sm .icn { width: 15px; height: 15px; }
.btn-lg { padding: 14px 22px; font-size: 16.5px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); border: 1px solid transparent;
}
.icon-btn:hover { background: var(--gray-soft); color: var(--ink); }
.icon-btn .icn { width: 17px; height: 17px; }

/* ---------- 칩 / 배지 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3.5px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; letter-spacing: 0;
  background: var(--gray-soft); color: var(--ink-2); white-space: nowrap;
}
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-green-soft { background: var(--green-soft); color: var(--green); }

.bdg {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 8px;
  font-size: 12px; font-weight: 800; white-space: nowrap;
}
.bdg-amber { background: var(--amber-soft); color: var(--amber); }
.bdg-red { background: var(--red-soft); color: var(--red); }
.bdg-green, .bdg-green-soft { background: var(--green-soft); color: var(--green); }
.bdg-gray { background: var(--gray-soft); color: var(--ink-2); }

/* ---------- 폼 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 7px; }
.field input[type="text"], .field input[type="tel"], .field input[type="date"], .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-s);
  border: 1.5px solid var(--line-2); background: var(--surface);
  font: inherit; color: var(--ink);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3.5px rgba(184, 92, 46, 0.14); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ============================================================
   홈
   ============================================================ */
.hero {
  position: relative; overflow: hidden;
  border-radius: 22px; margin-bottom: 16px;
  background: linear-gradient(120deg, #FDF6EC 0%, #FAE9D6 55%, #F6DCC2 100%);
  border: 1px solid #F0DCC4;
  box-shadow: var(--shadow-1);
  padding: 26px 24px;
  display: flex; align-items: center; gap: 18px;
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 800; color: var(--primary-ink);
  background: rgba(255, 255, 255, 0.65); border: 1px solid #F0DCC4;
  padding: 4px 11px; border-radius: 999px; margin-bottom: 12px;
}
.hero-kicker .icn { width: 14px; height: 14px; }
.hero-title { font-size: 24px; white-space: pre-line; }
.hero-stats { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.hstat {
  background: rgba(255, 255, 255, 0.75); border: 1px solid #F0DCC4;
  border-radius: 14px; padding: 8px 15px; text-align: center; min-width: 74px;
}
.hstat b { display: block; font-size: 20px; color: var(--ink); }
.hstat span { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.hstat.warn b { color: var(--red); }
.hero-art { color: #B8845A; opacity: 0.8; margin-left: auto; display: none; }
@media (min-width: 640px) { .hero-art { display: block; width: 190px; flex: none; } }

.due-list li + li { border-top: 1px solid var(--line); }
.due-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; }
.due-link { display: flex; align-items: center; gap: 13px; flex: 1; min-width: 0; padding: 6px 8px 6px 6px; margin: -6px 0 -6px -6px; border-radius: 12px; }
.due-link:hover { background: var(--bg); }
.due-text { min-width: 0; }
.due-text b { display: block; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-text span { display: block; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.allclear {
  display: flex; align-items: center; gap: 14px;
  background: var(--green-soft); border: 1px solid #CFE5D8; border-radius: 14px;
  padding: 16px;
}
.allclear-icn {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center;
}
.allclear-icn .icn { width: 21px; height: 21px; }
.allclear b { display: block; color: #1F5C41; }
.allclear span { font-size: 13.5px; color: #3E7159; }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 540px) { .quick { grid-template-columns: 1fr; } }
.quick-btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-1);
  display: flex; align-items: center; gap: 12px; padding: 15px 16px;
  font-weight: 800; font-size: 15px; text-align: left;
  transition: transform .12s, box-shadow .15s;
}
.quick-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.quick-icn {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.quick-icn .icn { width: 20px; height: 20px; }
.qi-add { background: var(--primary-soft); color: var(--primary-ink); }
.qi-pro { background: #E4EDF7; color: #44689E; }
.qi-dl { background: var(--green-soft); color: var(--green); }

.mini-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; }
.mini-item {
  flex: none; width: 96px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 6px 10px; font-size: 12.5px; font-weight: 700; text-align: center;
  overflow: hidden;
}
.mini-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item:hover { border-color: var(--primary-soft-2); }

/* 온보딩(빈집) 카드 */
.onb-card { text-align: center; padding: 34px 22px; }
.onb-art { color: #C99A6B; width: 150px; margin: 0 auto 14px; }
.onb-title { font-size: 22px; margin-bottom: 10px; }
.onb-desc { color: var(--ink-2); margin-bottom: 22px; }
.onb-steps { text-align: left; display: flex; flex-direction: column; gap: 13px; margin-bottom: 24px; }
.onb-steps li { display: flex; gap: 13px; align-items: center; }
.onb-steps div b { display: block; font-size: 15.5px; }
.onb-steps div span { font-size: 13.5px; color: var(--ink-2); }

/* ============================================================
   보관함 목록
   ============================================================ */
.search-wrap { position: relative; margin-bottom: 12px; }
.search-icn {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none; width: 19px; height: 19px;
}
.search-input {
  width: 100%; height: 52px; border-radius: 14px;
  border: 1.5px solid var(--line-2); background: var(--surface);
  padding: 0 16px; font: inherit; font-size: 16px;
}
.search-input.has-icn, .search-wrap .search-input { padding-left: 48px; }
.search-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3.5px rgba(184, 92, 46, 0.14); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.fchip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.fchip-row::-webkit-scrollbar { display: none; }
.fchip-row.wrap { flex-wrap: wrap; overflow: visible; }
.fchip {
  flex: none; padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--line-2); background: var(--surface);
  font-weight: 700; font-size: 14px; color: var(--ink-2); white-space: nowrap;
  transition: background .12s, color .12s;
}
.fchip:hover { border-color: #D3BFA4; }
.fchip.on { background: var(--primary-deep); border-color: var(--primary-deep); color: #FFF3E8; }
.fchip.sm { padding: 6px 11px; font-size: 13px; }

.sort-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.sort-sel { height: 40px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--surface); font: inherit; font-size: 13.5px; padding: 0 8px; }

.item-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .item-grid { grid-template-columns: repeat(2, 1fr); } }
.item-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-1); padding: 15px 14px;
  transition: transform .12s, box-shadow .15s;
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.item-card-main { flex: 1; min-width: 0; }
.item-name { display: block; font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { display: block; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 1px 0 7px; }
.item-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.item-chev { color: var(--ink-3); width: 18px; height: 18px; }

.empty { text-align: center; padding: 46px 20px 54px; }
.empty-art {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 16px;
  background: #F1E7D6; color: #A98F6C;
  display: flex; align-items: center; justify-content: center;
}
.empty-icn, .empty-art .icn { width: 40px; height: 40px; }
.empty h3 { font-size: 18.5px; margin-bottom: 6px; }
.empty p { color: var(--ink-2); font-size: 14.5px; margin-bottom: 18px; }

/* ============================================================
   상세
   ============================================================ */
.back-btn { margin-bottom: 6px; }
.detail-head { padding: 22px 20px; }
.detail-id { display: flex; gap: 16px; align-items: center; }
.detail-id-text { min-width: 0; flex: 1; }
.detail-id h1 { font-size: 22px; }
.detail-model { color: var(--ink-2); font-size: 14px; margin: 3px 0 9px; word-break: break-all; }
.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-actions { display: flex; gap: 9px; margin-top: 17px; flex-wrap: wrap; }

.warr-bar { height: 10px; border-radius: 999px; background: #F0E6D5; overflow: hidden; }
.warr-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6FB08D, var(--green)); transition: width .4s; }
.warr-progress.expired .warr-bar i { background: linear-gradient(90deg, #D89A88, var(--red)); }
.warr-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.warr-state { font-size: 14.5px; }
.warr-state.ok { color: var(--green); }
.warr-state.soon { color: var(--amber); }
.warr-state.expired { color: var(--red); }

.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; margin-top: 16px; }
@media (max-width: 480px) { .info-grid { grid-template-columns: 1fr 1fr; } }
.info-grid > div { background: var(--bg); border-radius: 12px; padding: 10px 13px; }
.info-grid dt { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.info-grid dd { font-size: 14.5px; font-weight: 700; word-break: keep-all; }

.maint-list li + li { border-top: 1px solid var(--line); }
.maint-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; }
.maint-main { flex: 1; min-width: 0; }
.maint-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.maint-top b { font-size: 15.5px; }
.maint-sub { font-size: 13px; color: var(--ink-2); }
.maint-actions { display: flex; align-items: center; gap: 6px; }

.maint-form { border-top: 1.5px dashed var(--line-2); margin-top: 6px; padding-top: 16px; }
.maint-form h3 { font-size: 15px; margin-bottom: 12px; }

.photo-group + .photo-group { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.photo-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.photo-group-head b { display: block; font-size: 15px; }
.photo-group-head .muted { display: block; font-size: 12.5px; }
.thumb-row { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb {
  position: relative; width: 86px; height: 86px; border-radius: 13px; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--bg);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { display: block; width: 100%; height: 100%; }
.thumb.pdf button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--primary-ink); font-size: 11px; font-weight: 700;
}
.thumb.pdf .icn { width: 26px; height: 26px; }
.thumb-x {
  position: absolute !important; top: 4px; right: 4px; width: 24px !important; height: 24px !important;
  border-radius: 50%; background: rgba(30, 20, 10, 0.55); color: #fff;
  display: flex !important; align-items: center; justify-content: center;
}
.thumb-x .icn { width: 13px; height: 13px; }
.photo-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.repair-list li + li { border-top: 1px solid var(--line); }
.repair-row { display: flex; gap: 12px; padding: 12px 0; align-items: flex-start; }
.repair-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary-soft-2); border: 2.5px solid var(--primary); margin-top: 7px; flex: none; }
.repair-body { flex: 1; min-width: 0; }
.repair-date { font-size: 12.5px; font-weight: 800; color: var(--primary-ink); }
.repair-body p { font-size: 14.5px; color: var(--ink); word-break: keep-all; margin-top: 2px; }
.repair-form { margin-top: 12px; }
.repair-form-row { display: flex; gap: 8px; }
.repair-form-row input[name="date"] { flex: none; width: 145px; }
.repair-form-row input[name="text"] { flex: 1; min-width: 0; }
.repair-form-row input {
  height: 44px; padding: 0 12px; border-radius: 11px;
  border: 1.5px solid var(--line-2); font: inherit; font-size: 14.5px; background: var(--surface);
}
.repair-form-row input:focus { border-color: var(--primary); outline: none; }
@media (max-width: 560px) { .repair-form-row { flex-wrap: wrap; } .repair-form-row input[name="date"] { width: 100%; } .repair-form-row .btn { width: 100%; } }

.danger-zone { text-align: center; margin: 26px 0 8px; }

/* ============================================================
   추가 마법사
   ============================================================ */
.steps { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 86px; position: relative; }
.steps li:not(:last-child)::after {
  content: ""; position: absolute; top: 15px; left: calc(50% + 22px); width: calc(100% - 44px); height: 2px;
  background: var(--line-2); border-radius: 2px;
}
.steps li.done:not(:last-child)::after { background: var(--primary); }
.steps i {
  width: 31px; height: 31px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line-2); color: var(--ink-3); font-style: normal; font-weight: 800; font-size: 13.5px;
  background: var(--surface);
}
.steps li.done i, .steps li.now i { border-color: var(--primary); background: var(--primary); color: #fff; }
.steps li.done i .icn { width: 15px; height: 15px; }
.steps span { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.steps li.now span, .steps li.done span { color: var(--primary-ink); }

.add-q { font-size: 20px; margin-bottom: 5px; }
.model-input-wrap { position: relative; margin-top: 14px; }

.sugg-list {
  margin-top: 10px; border: 1.5px solid var(--primary-soft-2); border-radius: 14px;
  background: #FFFDF9; overflow: hidden;
}
.sugg-list li + li { border-top: 1px solid var(--line); }
.sugg { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 13px; text-align: left; }
.sugg:hover { background: var(--primary-soft); }
.sugg-text { flex: 1; min-width: 0; }
.sugg-text b { display: block; font-size: 15px; }
.sugg-text span { font-size: 12.5px; color: var(--ink-2); font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; }
.sugg-none { margin-top: 10px; }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--ink-3); font-size: 13px; font-weight: 700; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
@media (min-width: 560px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 760px) { .cat-grid { grid-template-columns: repeat(6, 1fr); } }
.cat-tile-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--surface);
  padding: 13px 4px 11px; font-size: 13px; font-weight: 700; color: var(--ink-2);
  transition: border-color .12s, background .12s, transform .1s;
}
.cat-tile-btn span { text-align: center; line-height: 1.3; word-break: keep-all; }
.cat-tile-btn:hover { border-color: #D3BFA4; }
.cat-tile-btn:active { transform: scale(0.96); }
.cat-tile-btn.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); box-shadow: 0 0 0 3px rgba(184, 92, 46, 0.13); }

.wizard-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; }
.wizard-nav .btn-primary { margin-left: auto; }

.chosen {
  display: flex; align-items: center; gap: 13px;
  background: var(--bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 18px;
}
.chosen > div { flex: 1; min-width: 0; }
.chosen b { display: block; font-size: 15.5px; }
.chosen span { font-size: 13px; color: var(--ink-2); word-break: break-all; }

.done-card { text-align: center; padding: 30px 22px; }
.done-check {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px -8px rgba(47, 125, 91, 0.55);
}
.done-check .icn { width: 30px; height: 30px; }
.done-title { font-size: 23px; margin-bottom: 4px; }
.review {
  display: flex; gap: 16px; align-items: flex-start; text-align: left;
  background: var(--bg); border-radius: 16px; padding: 16px; margin: 18px 0 14px;
}
.review dl { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.review dl > div { display: flex; gap: 10px; font-size: 14.5px; }
.review dt { color: var(--ink-3); font-weight: 700; width: 44px; flex: none; }
.review dd { font-weight: 700; word-break: keep-all; }
.auto-note {
  display: flex; gap: 9px; align-items: flex-start; text-align: left;
  background: var(--amber-soft); border: 1px solid #EFDFB4; color: #6B4A0C;
  border-radius: 13px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 6px;
}
.auto-note .icn { width: 17px; height: 17px; margin-top: 2px; flex: none; }

/* ============================================================
   수리업체
   ============================================================ */
.pro-list { display: grid; gap: 14px; }
@media (min-width: 720px) { .pro-list { grid-template-columns: repeat(2, 1fr); } }
.pro-card { margin-bottom: 0; display: flex; flex-direction: column; }
.pro-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pro-id { display: flex; gap: 12px; align-items: center; min-width: 0; }
.pro-avatar {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  background: #E4EDF7; color: #44689E; display: flex; align-items: center; justify-content: center;
}
.pro-avatar .icn { width: 22px; height: 22px; }
.pro-id b { font-size: 16.5px; display: block; }
.pro-cats { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.pro-hearts { display: flex; gap: 1.5px; color: #DACDB9; flex: none; }
.pro-hearts .heart { padding: 2px; color: inherit; cursor: default; }
.pro-hearts .heart .icn { width: 15px; height: 15px; }
.pro-hearts .heart.on { color: #DF4E33; }
.pro-memo { color: var(--ink-2); font-size: 14px; margin: 10px 0 13px; word-break: keep-all; }
.pro-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.pro-last { margin-left: auto; }
.pro-manage { display: flex; gap: 2px; flex: none; }
.hearts-row { display: flex; gap: 3px; }
.heart { padding: 3px; color: #DACDB9; border-radius: 8px; }
.heart:hover { color: #C9A98F; }
.heart .icn { width: 19px; height: 19px; }
.heart.on { color: #DF4E33; }
.heart.on:hover { color: #DF4E33; }
.heart.lg .icn { width: 23px; height: 23px; }

/* ============================================================
   설정
   ============================================================ */
.danger-card { border-color: #F0CDC1; background: #FFFBF9; }
.foot-note { text-align: center; color: var(--ink-3); font-size: 12.5px; margin: 30px 0 10px; line-height: 1.7; }

/* ============================================================
   수명 가이드 / OCR / 가족 공유 / 조인
   ============================================================ */
.life-meta { font-size: 14px; color: var(--ink-2); margin-bottom: 7px; }
.life-meta b { color: var(--ink); font-size: 15.5px; }
.life-bar { height: 12px; border-radius: 999px; background: #F0E6D5; overflow: hidden; position: relative; }
.life-bar i { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.life-bar.young i { background: linear-gradient(90deg, #6FB08D, var(--green)); }
.life-bar.mid i { background: linear-gradient(90deg, #8FBF9F, #5D9B77); }
.life-bar.late i { background: linear-gradient(90deg, #E5B45E, #C08A2D); }
.life-bar.replace i { background: linear-gradient(90deg, #D89A88, var(--red)); }
.life-msg { font-size: 14.5px; color: var(--ink-2); margin-top: 10px; word-break: keep-all; }

.calc-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.calc-nums > div { background: var(--bg); border-radius: 12px; padding: 10px 6px; }
.calc-nums b { display: block; font-size: 17px; }
.calc-nums span { font-size: 11.5px; color: var(--ink-3); font-weight: 700; }

.ocr-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.qr-box {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; max-width: 270px; margin: 0 auto 16px;
}
.qr-box svg { display: block; }
.qr-loading { text-align: center; color: var(--ink-3); font-size: 13.5px; padding: 30px 0; }

.join-card { text-align: center; padding: 30px 22px; }
.join-mark {
  width: 66px; height: 66px; border-radius: 22px; margin: 0 auto 14px;
  background: linear-gradient(145deg, #CE7038, var(--primary-deep));
  color: #FFF4E9; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 26px -10px rgba(156, 74, 34, 0.5);
}
.join-mark .icn { width: 30px; height: 30px; }
.join-title { font-size: 23px; margin-bottom: 5px; }
.join-card .mini-scroll { justify-content: center; margin: 16px 0; }
.join-card .onboard-actions { margin-top: 16px; }

/* ============================================================
   우리 집 이야기 (연대기)
   ============================================================ */
.tl-year { font-size: 19px; margin-bottom: 10px; color: var(--primary-ink); }
.tl { position: relative; }
.tl-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; position: relative; }
.tl-row:not(:last-child)::after {
  content: ""; position: absolute; left: 118px; top: 34px; bottom: -8px;
  width: 2px; background: var(--line-2); border-radius: 2px;
}
.tl-date { width: 86px; flex: none; font-size: 12.5px; font-weight: 700; color: var(--ink-3); text-align: right; }
.tl-dot {
  width: 13px; height: 13px; border-radius: 50%; flex: none; z-index: 1;
  border: 3px solid #fff; box-shadow: 0 0 0 1.5px currentColor;
}
.tl-dot.buy { color: var(--primary); background: var(--primary-soft); }
.tl-dot.repair { color: #44689E; background: #E4EDF7; }
.tl-dot.care { color: var(--green); background: var(--green-soft); }
.tl-dot.photo { color: #6558A8; background: #EAE7F7; }
.tl-dot.add { color: var(--ink-3); background: var(--gray-soft); }
.tl-body {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px;
  padding: 7px 9px 7px 7px; margin: -7px 0 -7px -7px; border-radius: 12px;
}
.tl-body:hover { background: var(--bg); }
.tl-text { flex: 1; min-width: 0; font-size: 14.5px; color: var(--ink); word-break: keep-all; }
.tl-text b { font-weight: 800; }
.tl-sub { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 600; margin-top: 1px; }
.story-row .tl-dot { margin-left: 4px; }

/* 공유 카드 */
.share-preview {
  width: 100%; max-height: 56vh; object-fit: contain; border-radius: 14px;
  border: 1px solid var(--line); display: block; margin-bottom: 14px;
}
.sheet .btn-block + .btn-block { margin-top: 10px; }

/* ============================================================
   토스트 / 모달 / 온보딩 / 스플래시
   ============================================================ */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px); z-index: 200;
  pointer-events: none; opacity: 0; transition: opacity .22s, transform .22s;
}
@media (min-width: 880px) { .toast { bottom: 34px; } }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-body {
  display: flex; align-items: center; gap: 9px;
  background: #312416; color: #FBF5EA;
  border-radius: 14px; padding: 12px 18px;
  font-weight: 700; font-size: 14.5px;
  box-shadow: var(--shadow-2); max-width: min(88vw, 430px);
}
.toast-icn { width: 18px; height: 18px; color: #F0BE8E; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(42, 28, 14, 0.44);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; transition: opacity .18s;
}
.modal-overlay.open { opacity: 1; }
.modal {
  background: var(--surface); border-radius: 22px;
  width: 100%; max-width: 500px; max-height: 88vh; overflow-y: auto;
  padding: 24px; position: relative;
  box-shadow: var(--shadow-2);
  transform: translateY(10px) scale(0.97); transition: transform .18s;
}
.modal-overlay.open .modal { transform: none; }
.modal-overlay.modal-wide .modal { max-width: 780px; padding: 14px; }
.modal-x {
  position: absolute; top: 13px; right: 13px; width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--ink-3); z-index: 2;
}
.modal-x:hover { background: var(--gray-soft); color: var(--ink); }
.modal-title { font-size: 18px; margin-bottom: 16px; }
.modal-content > :last-child { margin-bottom: 0; }

.confirm-box { text-align: center; padding: 8px 4px 4px; }
.confirm-icon {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 13px;
  background: var(--amber-soft); color: var(--amber);
  display: flex; align-items: center; justify-content: center;
}
.confirm-icon .icn { width: 24px; height: 24px; }
.confirm-icon.danger { background: var(--red-soft); color: var(--red); }
.confirm-title { font-size: 18px; margin-bottom: 7px; }
.confirm-body { color: var(--ink-2); font-size: 14.5px; margin-bottom: 20px; word-break: keep-all; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }

.viewer { text-align: center; }
.viewer img { max-height: 68vh; margin: 0 auto; border-radius: 12px; }
.viewer-bar { display: flex; justify-content: center; margin-top: 10px; }

/* 온보딩 */
.onboard {
  position: fixed; inset: 0; z-index: 300; overflow-y: auto;
  background:
    radial-gradient(900px 480px at 80% -8%, #FBEDDC 0%, transparent 58%),
    radial-gradient(700px 420px at -8% 88%, #F2E8D5 0%, transparent 55%),
    var(--bg);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .3s; padding: 28px 18px;
}
.onboard.open { opacity: 1; }
.onboard-inner { max-width: 420px; width: 100%; text-align: center; }
.onboard-logo {
  width: 74px; height: 74px; border-radius: 24px; margin: 0 auto 18px;
  background: linear-gradient(145deg, #CE7038, var(--primary-deep));
  color: #FFF4E9; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 16px 34px -10px rgba(156, 74, 34, 0.5);
  transform: rotate(-4deg);
}
.onboard-logo .icn { width: 36px; height: 36px; }
.onboard-kicker { font-weight: 800; color: var(--primary-ink); font-size: 14px; letter-spacing: 0.14em; }
.onboard-h1 { font-size: 31px; margin: 7px 0 13px; letter-spacing: -0.03em; }
.onboard-desc { color: var(--ink-2); font-size: 15.5px; margin-bottom: 24px; }
.onboard-points { text-align: left; display: flex; flex-direction: column; gap: 11px; margin-bottom: 26px; }
.onboard-points li {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 15px; font-size: 14.5px; color: var(--ink-2);
}
.onboard-points li .icn { width: 20px; height: 20px; color: var(--primary); flex: none; }
.onboard-points b { color: var(--ink); }
.onboard-actions { display: flex; flex-direction: column; gap: 10px; }
.onboard-foot { font-size: 12.5px; color: var(--ink-3); margin-top: 18px; }

/* 스플래시 */
.splash {
  position: fixed; inset: 0; z-index: 400;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  transition: opacity .3s; 
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-logo {
  width: 64px; height: 64px; border-radius: 20px;
  background: linear-gradient(145deg, #CE7038, var(--primary-deep));
  color: #FFF4E9; display: flex; align-items: center; justify-content: center;
  animation: pulse 1.4s ease-in-out infinite;
}
.splash-logo svg { width: 32px; height: 32px; }
.splash-text { color: var(--ink-2); font-size: 14px; font-weight: 600; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- 모션 배려 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
