/* ══════════════════════════════════════════════════════════════
   GeroFortune — 프론트엔드 디자인 시스템
   Pretendard · 금빛 액센트 · 신비로운 밤하늘 · 부드러운 모션
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg: #fbf9f3;
  --bg-soft: #f6f3ea;
  --bg-elevated: #f0ece0;
  --border: #e7e1d3;
  --border-strong: #ddd5c2;
  --text-primary: #1a140a;
  --text-secondary: #5c5445;
  --text-tertiary: #938b78;
  --accent: #B8860B;
  --accent-2: #d4a017;
  --accent-3: #f6d98c;
  --accent-bg: #fdf6e0;
  --success: #0f8f5f;
  --success-bg: #eafaf1;
  --danger: #c0392b;
  --danger-bg: #fdf0ee;
  --warning: #c77d0a;
  --warning-bg: #fdf6e7;
  --blue: #2b6cb0;
  --blue-bg: #eef4fb;
  --purple: #7c3aed;
  --ink: #120e1e;
  --ink-2: #1c1730;
  --wood: #4a9d5b; --fire: #d9534f; --earth: #c99a3f; --metal: #c9a227; --water: #2b6cb0;
  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 24px;
  --shadow: 0 2px 8px rgba(30,20,5,.06), 0 1px 3px rgba(30,20,5,.05);
  --shadow-md: 0 8px 26px rgba(30,20,5,.10), 0 2px 8px rgba(30,20,5,.06);
  --shadow-lg: 0 24px 60px rgba(20,14,5,.20), 0 8px 22px rgba(20,14,5,.12);
  --sidebar-w: 252px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-soft);
  color: var(--text-primary);
  line-height: 1.6;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent-bg); }

svg.icon { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.icon-sm { width: 16px !important; height: 16px !important; }
.icon-lg { width: 34px !important; height: 34px !important; }
.icon-xl { width: 42px !important; height: 42px !important; }
svg { max-width: 100%; }

/* ══════════════════════════ 스플래시 ══════════════════════════ */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(130% 100% at 50% 30%, #2b2010 0%, #17110a 46%, #0d0a05 100%);
  overflow: hidden;
  transition: opacity .55s ease, transform .55s cubic-bezier(.4,0,.2,1);
}
.splash--out { opacity: 0; transform: scale(1.05); pointer-events: none; }
.splash__aura {
  position: absolute; width: 150vmax; height: 150vmax; left: 50%; top: 34%;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side, rgba(212,160,23,.22), transparent 68%),
    conic-gradient(from 0deg, rgba(212,160,23,.14), rgba(124,58,237,.10), rgba(43,108,176,.11), rgba(212,160,23,.14));
  filter: blur(28px); opacity: .9; animation: splashAura 22s linear infinite;
}
@keyframes splashAura { to { transform: translate(-50%,-50%) rotate(360deg); } }
.splash__stars { position: absolute; inset: 0; }
.splash__stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px 1px rgba(255,236,190,.9); animation: twinkle 3.6s ease-in-out infinite; }
.splash__stars i:nth-child(1){left:12%;top:24%;animation-delay:.2s}.splash__stars i:nth-child(2){left:80%;top:30%;animation-delay:1.1s}
.splash__stars i:nth-child(3){left:24%;top:70%;animation-delay:.7s}.splash__stars i:nth-child(4){left:68%;top:66%;animation-delay:1.7s}
.splash__stars i:nth-child(5){left:44%;top:16%;animation-delay:2.2s}.splash__stars i:nth-child(6){left:88%;top:52%;animation-delay:.5s}
.splash__stars i:nth-child(7){left:8%;top:52%;animation-delay:1.4s}.splash__stars i:nth-child(8){left:56%;top:80%;animation-delay:2.6s}
.splash__stars i:nth-child(9){left:34%;top:40%;animation-delay:.9s}.splash__stars i:nth-child(10){left:74%;top:14%;animation-delay:1.9s}
.splash__stars i:nth-child(11){left:18%;top:86%;animation-delay:3.1s}.splash__stars i:nth-child(12){left:92%;top:78%;animation-delay:.3s}
@keyframes twinkle { 0%,100% { opacity: 0; transform: scale(.4); } 45% { opacity: .95; transform: scale(1.2); } }
.splash__logo { position: relative; width: 172px; height: 172px; display: grid; place-items: center;
  animation: splashLogoIn .9s cubic-bezier(.2,.8,.25,1) both; }
.splash__logo img { width: 160px; height: auto; filter: drop-shadow(0 6px 26px rgba(212,160,23,.5));
  animation: splashSpin 26s linear infinite; }
@keyframes splashSpin { to { transform: rotate(360deg); } }
.splash__ring { position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(212,160,23,.5); opacity: 0; animation: splashRing 2.8s ease-out infinite; }
.splash__ring--d { animation-delay: 1.4s; border-color: rgba(124,58,237,.45); }
@keyframes splashRing { 0% { transform: scale(.7); opacity: .7; } 80%,100% { transform: scale(1.75); opacity: 0; } }
@keyframes splashLogoIn { 0% { opacity: 0; transform: scale(.68); filter: blur(6px); } 100% { opacity: 1; transform: scale(1); filter: blur(0); } }
.splash__word { font-size: 30px; font-weight: 800; letter-spacing: -.01em; z-index: 2;
  background: linear-gradient(92deg, #f6d98c, #d4a017 58%, #f6d98c);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #f4d585;
  animation: splashUp .7s .22s var(--ease) both; }
.splash__word span { -webkit-text-fill-color: transparent; }
.splash__tag { font-size: 13px; color: #b9a98a; letter-spacing: .04em; margin-top: -6px; z-index: 2;
  animation: splashUp .7s .38s var(--ease) both; }
@keyframes splashUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.splash__bar { width: 170px; height: 3px; border-radius: 3px; overflow: hidden; z-index: 2;
  background: rgba(255,255,255,.08); margin-top: 6px; animation: splashUp .7s .5s var(--ease) both; }
.splash__bar i { display: block; width: 40%; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #d4a017, #f6d98c, #d4a017, transparent);
  animation: splashBar 1.25s cubic-bezier(.5,0,.4,1) infinite; }
@keyframes splashBar { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
@media (prefers-reduced-motion: reduce) { .splash * { animation: none !important; } }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: .55; transform: scale(.98); } 50% { opacity: 1; transform: scale(1); } }

/* ══════════════════════════ 레이아웃 ══════════════════════════ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #fffdf8, var(--bg));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 16px; z-index: 40;
  transition: transform .32s var(--ease);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; cursor: pointer; white-space: nowrap; }
.brand img { width: 56px; height: 56px; border-radius: 13px; object-fit: contain; flex: none; transition: transform .5s var(--ease-spring); }
.brand:hover img { transform: rotate(180deg); }
.brand__name { font-weight: 900; font-size: 32px; letter-spacing: -.03em; line-height: 1.02; }
.brand__name span { color: var(--accent); }
.brand__tag { font-size: 13px; color: var(--text-tertiary); font-weight: 700; margin-top: 3px; letter-spacing: -.01em; }
.sidebar__collapse { position: absolute; top: 20px; right: -13px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer;
  display: grid; place-content: center; box-shadow: var(--shadow); z-index: 2; }
.sidebar__collapse:hover { background: var(--accent-bg); color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav__link { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-weight: 600; font-size: 14.5px; cursor: pointer; position: relative; overflow: hidden;
  transition: background .2s var(--ease), color .2s var(--ease); }
.nav__link svg { width: 19px; height: 19px; flex: none; stroke-width: 1.9; }
.nav__link:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav__link.active { background: var(--accent-bg); color: var(--accent); }
.nav__link.active::before { content: ""; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px; border-radius: 3px;
  background: var(--accent); animation: growbar .3s var(--ease-spring); }
@keyframes growbar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.sidebar__footer { padding: 14px 10px 4px; font-size: 11px; color: var(--text-tertiary); }
.sidebar__footer b { color: var(--text-secondary); }
.nav-admin { margin-top: 8px; padding: 10px 13px; display: flex; align-items: center; gap: 10px; font-size: 12.5px;
  font-weight: 700; color: var(--text-tertiary); border-radius: var(--radius-sm); cursor: pointer; transition: background .2s, color .2s; }
.nav-admin:hover { background: var(--bg-elevated); color: var(--accent); }
.nav-credit { display: flex; align-items: center; gap: 9px; margin: 0 6px 10px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--accent-bg); border: 1px solid var(--accent-border); color: var(--accent); font-size: 12.5px; font-weight: 800; cursor: pointer; }
.nav-credit[hidden] { display: none; }
.nav-credit:hover { background: #fbefc8; }
.nav-credit svg { flex: none; }
.layout.collapsed .nav-credit span { display: none; }
.layout.collapsed .nav-credit { justify-content: center; }

.layout.collapsed { --sidebar-w: 74px; }
.layout.collapsed .sidebar { padding: 22px 12px; }
.layout.collapsed .brand { justify-content: center; padding: 4px 0 20px; }
.layout.collapsed .brand__text { display: none; }
.layout.collapsed .brand img { width: 48px; height: 48px; }
.layout.collapsed .nav__link { justify-content: center; padding: 11px 0; }
.layout.collapsed .nav__link span, .layout.collapsed .nav-admin span,
.layout.collapsed .sidebar__footer, .layout.collapsed .kst-clock__time, .layout.collapsed .kst-clock__tz { display: none; }
.layout.collapsed .nav-admin { justify-content: center; }
.layout.collapsed .kst-clock { justify-content: center; padding: 9px 0; }
.layout.collapsed .sidebar__collapse svg { transform: rotate(180deg); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar img { width: 50px; height: 50px; border-radius: 11px; }
.topbar__name { font-weight: 900; font-size: 20px; letter-spacing: -.02em; }
.hamburger { margin-left: auto; width: 40px; height: 40px; border: 1px solid var(--border); background: var(--bg);
  border-radius: 10px; display: grid; place-content: center; cursor: pointer; }
.hamburger svg { width: 20px; height: 20px; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(10,8,4,.45); z-index: 35; opacity: 0; transition: opacity .3s var(--ease); }
.scrim.show { display: block; opacity: 1; }

.view { padding: 32px 26px 80px; max-width: 1180px; width: 100%; margin: 0 auto; }
.view-enter { animation: viewIn .42s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════ 타이포 ══════════════════════════ */
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 6px; }
.page-head p { color: var(--text-secondary); margin: 0; font-size: 15px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--text-tertiary); text-transform: uppercase; margin: 0 0 14px; }

/* ══════════════════════════ 카드 ══════════════════════════ */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card--pad-lg { padding: 30px; }
.card-hover { transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s var(--ease); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease), transform .6s var(--ease); }

/* ══════════════════════════ 히어로 (신비로운 밤하늘) ══════════════════════════ */
.hero { position: relative; overflow: hidden; isolation: isolate; border-radius: var(--radius-lg);
  padding: 52px 46px; color: #fff; background: radial-gradient(130% 120% at 15% 0%, #3a2a12 0%, #1d1710 46%, #120d07 100%);
  box-shadow: var(--shadow-lg); margin-bottom: 28px; }
.hero__glow { position: absolute; z-index: 0; top: -40%; left: 50%; width: 110vmax; height: 110vmax;
  transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(212,160,23,.16), transparent 62%),
    conic-gradient(from 0deg, rgba(212,160,23,.10), rgba(124,58,237,.08), rgba(43,108,176,.09), rgba(212,160,23,.10));
  filter: blur(30px); animation: heroSpin 44s linear infinite; }
@keyframes heroSpin { to { transform: translateX(-50%) rotate(360deg); } }
.hero__stars { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.hero__stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 5px 1px rgba(255,236,190,.9); animation: twinkle 4s ease-in-out infinite; }
.hero__inner { position: relative; z-index: 3; max-width: 640px; }
.hero__eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-3); }
/* 배너 배경 사진 (대시보드) — 켄번스 줌 + 가독성 스크림 */
.hero--photo { background: #14100a; }
.hero__photo { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("/background.jpg") center center / cover no-repeat;
  opacity: .5; transform: scale(1.08); animation: heroKen 30s ease-in-out infinite alternate; will-change: transform; }
.hero--photo::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg, rgba(15,10,5,.92) 0%, rgba(28,20,10,.72) 46%, rgba(60,44,16,.42) 100%); }
@keyframes heroKen { 0% { transform: scale(1.08) translate(1%, 0.6%); } 100% { transform: scale(1.16) translate(-1.6%, -1.2%); } }
.hero__eyebrow--lg { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; letter-spacing: .1em;
  padding: 7px 16px; border-radius: 100px; background: rgba(212,160,23,.16); border: 1px solid rgba(236,217,143,.4);
  color: #f4d585; text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.hero h1 { font-size: 38px; font-weight: 800; letter-spacing: -.035em; margin: 14px 0 12px; line-height: 1.14; }
.hero p { font-size: 16px; color: rgba(255,255,255,.82); margin: 0 0 26px; max-width: 540px; }

/* ══════════════════════════ 버튼 ══════════════════════════ */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); font-weight: 700; font-size: 14.5px; cursor: pointer;
  border: 1px solid transparent; background: var(--bg-elevated); color: var(--text-primary);
  transition: transform .12s var(--ease), box-shadow .22s var(--ease), background .2s, opacity .2s;
  white-space: nowrap; -webkit-user-select: none; user-select: none; }
.btn svg { width: 18px; height: 18px; }
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: scale(.965); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: #fff; box-shadow: 0 4px 14px rgba(184,134,11,.32); }
.btn--primary:hover { box-shadow: 0 8px 22px rgba(184,134,11,.42); }
.btn--ghost { background: transparent; border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--bg-elevated); }
.btn--danger { background: var(--danger-bg); color: var(--danger); }
.btn--danger:hover { background: #f8dcd7; }
.btn--light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.24); backdrop-filter: blur(4px); }
.btn--light:hover { background: rgba(255,255,255,.24); }
.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--lg { padding: 14px 26px; font-size: 15.5px; }
.btn--block { width: 100%; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255,255,255,.45); pointer-events: none; animation: ripple .6s var(--ease); }
.btn--ghost .ripple, .btn:not(.btn--primary):not(.btn--light) .ripple { background: rgba(120,110,80,.22); }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ══════════════════════════ 폼 ══════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.field .hint { font-size: 12px; color: var(--text-tertiary); }
.input, .select, textarea.input {
  width: 100%; padding: 11px 13px; font-size: 14.5px; font-family: inherit;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-primary); transition: border-color .2s, box-shadow .2s; outline: none; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184,134,11,.14); }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23938b78' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.input { resize: vertical; min-height: 72px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

.segmented { display: inline-flex; background: var(--bg-elevated); border-radius: 12px; padding: 4px; gap: 2px; position: relative; }
.segmented button { position: relative; z-index: 2; border: none; background: transparent; cursor: pointer; padding: 8px 18px;
  border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--text-secondary); transition: color .25s var(--ease); }
.segmented button.active { color: #fff; }
.segmented__thumb { position: absolute; z-index: 1; top: 4px; bottom: 4px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow);
  transition: transform .32s var(--ease-spring), width .32s var(--ease-spring); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.switch input { display: none; }
.switch__track { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .25s var(--ease); flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: transform .28s var(--ease-spring); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch__label { font-size: 14px; font-weight: 600; color: var(--text-secondary); }

/* ══════════════════════════ 통계 카드 ══════════════════════════ */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--accent); }
.stat.green::before { background: var(--success); } .stat.blue::before { background: var(--blue); } .stat.purple::before { background: var(--purple); }
.stat__label { font-size: 12px; color: var(--text-tertiary); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat__value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 4px; }
.stat__sub { font-size: 13px; color: var(--text-secondary); }

/* ══════════════════════════ pill / badge ══════════════════════════ */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill--gold { background: var(--accent-bg); color: var(--accent); }
.pill--green { background: var(--success-bg); color: var(--success); }
.pill--blue { background: var(--blue-bg); color: var(--blue); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; background: var(--bg-elevated); color: var(--text-secondary); }
.badge--accent { background: var(--accent-bg); color: var(--accent); }

/* ── 오행 배지 ── */
.el { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.el-wood { background: #edf7ef; color: #2f7d40; } .el-fire { background: #fdf0ef; color: #b53c38; }
.el-earth { background: #fbf6ea; color: #8a6a1f; } .el-metal { background: #faf7e6; color: #8a6d0f; }
.el-water { background: #eef4fb; color: #22558c; }

/* ══════════════════════════ 명식 미리보기 ══════════════════════════ */
.mingsik { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 10px; }
.ms-pillar { text-align: center; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px 6px; }
.ms-pillar__label { font-size: 11px; font-weight: 700; color: var(--text-tertiary); margin-bottom: 8px; }
.ms-gz { border-radius: 9px; padding: 8px 2px; margin-bottom: 5px; }
.ms-gz .han { font-size: 26px; font-weight: 800; line-height: 1.1; display: block; }
.ms-gz .kr { font-size: 11px; font-weight: 600; opacity: .75; display: block; }
.ms-bg-wood { background: #edf7ef; color: #2f7d40; } .ms-bg-fire { background: #fdf0ef; color: #b53c38; }
.ms-bg-earth { background: #fbf6ea; color: #8a6a1f; } .ms-bg-metal { background: #faf7e6; color: #8a6d0f; }
.ms-bg-water { background: #eef4fb; color: #22558c; }
.ms-god { font-size: 10px; font-weight: 700; color: var(--accent); }

/* ══════════════════════════ 가족 구성원 빌더 ══════════════════════════ */
.member-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: relative; animation: viewIn .35s var(--ease) both; }
.member-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.member-card__num { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-bg); color: var(--accent); font-weight: 800; display: grid; place-content: center; font-size: 14px; }
.member-card__title { font-weight: 800; font-size: 15px; flex: 1; }
.member-remove { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--text-tertiary); cursor: pointer; display: grid; place-content: center; }
.member-remove:hover { background: var(--danger-bg); color: var(--danger); }

/* ══════════════════════════ 리포트 리스트 ══════════════════════════ */
.report-item { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow); }
.report-item__ico { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-bg); color: var(--accent); display: grid; place-content: center; flex: none; }
.report-item__ico svg { width: 22px; height: 22px; }
.report-item__body { flex: 1; min-width: 0; }
.report-item__title { font-weight: 700; font-size: 15px; }
.report-item__meta { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; }
.report-item__actions { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text-secondary); cursor: pointer; display: grid; place-content: center; transition: background .2s, color .2s, transform .1s; }
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.icon-btn:active { transform: scale(.9); }
.icon-btn--danger:hover { background: var(--danger-bg); color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; }

.empty { text-align: center; padding: 64px 24px; }
.empty__ico { width: 78px; height: 78px; margin: 0 auto 20px; border-radius: 24px; background: var(--accent-bg); color: var(--accent); display: grid; place-content: center; animation: pulse 2.6s var(--ease) infinite; }
.empty__ico svg { width: 38px; height: 38px; }
.empty h3 { font-size: 19px; font-weight: 800; margin: 0 0 6px; }
.empty p { color: var(--text-secondary); margin: 0 auto 22px; max-width: 400px; }

/* ══════════════════════════ 생성(SSE) ══════════════════════════ */
.gen-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.timeline { position: relative; }
.tl-step { display: flex; gap: 14px; padding-bottom: 22px; position: relative; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step__dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--bg); flex: none; display: grid; place-content: center; z-index: 2; transition: all .35s var(--ease-spring); }
.tl-step__dot svg { width: 14px; height: 14px; opacity: 0; transition: opacity .3s; }
.tl-step:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: var(--border); z-index: 1; }
.tl-step.active .tl-step__dot { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(184,134,11,.14); }
.tl-step.active .tl-step__dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
.tl-step.done .tl-step__dot { border-color: var(--success); background: var(--success); }
.tl-step.done .tl-step__dot svg { opacity: 1; color: #fff; }
.tl-step__label { font-weight: 700; font-size: 14px; padding-top: 3px; color: var(--text-tertiary); transition: color .3s; }
.tl-step.active .tl-step__label, .tl-step.done .tl-step__label { color: var(--text-primary); }
.gen-progressbar { height: 10px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; margin-bottom: 8px; box-shadow: inset 0 1px 2px rgba(20,15,5,.08); }
.gen-progressbar__fill { height: 100%; border-radius: 999px; width: 0%; transition: width .5s var(--ease);
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 50%, var(--blue)); background-size: 200% 100%; animation: progGrad 3s ease infinite; }
@keyframes progGrad { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.gen-status { font-size: 14px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.gen-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-bg); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.narrative-stream { font-size: 14.5px; line-height: 1.8; color: var(--text-secondary); white-space: pre-wrap; max-height: 340px; overflow-y: auto; }
.narrative-stream h5 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin: 16px 0 6px; font-weight: 800; }
.cursor { display: inline-block; width: 2px; height: 1.1em; background: var(--accent); margin-left: 2px; vertical-align: text-bottom; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ══════════════════════════ 리포트 뷰어 ══════════════════════════ */
.report-view { display: flex; flex-direction: column; height: calc(100vh - 40px); }
.report-view__bar { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; flex-wrap: wrap; }
.report-view__frame { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); background: #fff; min-height: 400px; }
.report-view__frame iframe { width: 100%; height: 100%; border: none; display: block; }

/* ══════════════════════════ 챗봇 ══════════════════════════ */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 40px); max-width: 860px; margin: 0 auto; }
.chat-ctxbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.chat-report-sel { width: auto; min-width: 200px; max-width: 340px; padding: 8px 34px 8px 12px; font-size: 14px; font-weight: 600; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 8px 4px 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; animation: viewIn .3s var(--ease) both; align-items: flex-start; }
.msg__ava { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-content: center; }
.msg__col { display: flex; flex-direction: column; gap: 6px; max-width: 78%; min-width: 0; }
.msg--user { flex-direction: row-reverse; }
.msg--user .msg__col { align-items: flex-end; }
.msg--user .msg__ava { background: var(--accent); color: #fff; }
.msg--bot .msg__ava { background: var(--ink); color: var(--accent-3); }
.msg__copy { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text-tertiary); font-size: 12px; font-weight: 700; cursor: pointer;
  opacity: 0; transition: opacity .2s, color .2s, border-color .2s; }
.msg:hover .msg__copy { opacity: 1; }
.msg__copy:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }
.msg__copy.copied { color: var(--success); border-color: var(--success); background: var(--success-bg); opacity: 1; }
.msg__copy svg { width: 14px; height: 14px; }
.msg__bubble { padding: 13px 16px; border-radius: 14px; font-size: 14.5px; line-height: 1.7; }
.msg--user .msg__bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg--bot .msg__bubble { background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg__bubble p { margin: 0 0 8px; } .msg__bubble p:last-child { margin: 0; }
.msg__bubble strong { font-weight: 700; }
.chat-input { display: flex; gap: 10px; padding: 12px 0 0; border-top: 1px solid var(--border); }
.chat-input textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border-strong); font-family: inherit; font-size: 14.5px; outline: none; }
.chat-input textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184,134,11,.14); }
.chat-empty { text-align: center; padding: 40px 20px; color: var(--text-tertiary); }
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: center; }
.suggest-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg); font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all .2s; animation: chipIn .3s var(--ease-spring) both; }
.suggest-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
@keyframes chipIn { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }

/* ── 모달(히스토리 등) ── */
.modal-scrim { position: fixed; inset: 0; z-index: 200; background: rgba(15,10,4,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; animation: viewIn .22s var(--ease); }
.modal { width: 100%; max-width: 480px; max-height: 80vh; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: modalPop .3s var(--ease-spring); }
@keyframes modalPop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal__head b { flex: 1; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.modal__head b svg { color: var(--accent); }
.modal__body { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.hist-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; transition: border-color .2s, background .2s; }
.hist-item:hover { border-color: var(--accent-2); background: var(--bg-soft); }
.hist-item__ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-bg); color: var(--accent); display: grid; place-content: center; flex: none; }
.hist-item__ico svg { width: 19px; height: 19px; }
.hist-item__body { flex: 1; min-width: 0; }
.hist-item__title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-item__meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.hist-del { opacity: 0; transition: opacity .2s; }
.hist-item:hover .hist-del { opacity: 1; }

/* ══════════════════════════ 관리자 / 설정 ══════════════════════════ */
.admin-lock { width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 18px; background: var(--accent-bg); color: var(--accent); display: grid; place-content: center; }
.admin-lock svg { width: 28px; height: 28px; }
.test-result { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; animation: viewIn .35s var(--ease) both; }
.test-result--ok { background: var(--success-bg); color: var(--success); }
.test-result--fail { background: var(--danger-bg); color: var(--danger); }
.local-badge { display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700; }
.local-badge--secure { background: var(--success-bg); color: var(--success); border: 1px solid #a7e8c8; }
.local-badge--warn { background: var(--warning-bg); color: var(--warning); border: 1px solid #f2dda0; }

.divider { height: 1px; background: var(--border); border: none; margin: 6px 0; }
.mut { color: var(--text-secondary); } .small { font-size: 12.5px; } .center { text-align: center; }

/* KST 시계 */
.kst-clock { display: flex; align-items: center; gap: 8px; margin: 2px 10px 14px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--bg-soft); border: 1px solid var(--border); }
.kst-clock svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.kst-clock__time { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.kst-clock__tz { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--accent); background: var(--accent-bg); padding: 1px 5px; border-radius: 5px; margin-left: auto; }
.topbar .kst-clock { display: none; margin: 0 10px 0 0; padding: 6px 10px; }

/* ══════════════════════════ PWA 설치 버튼 ══════════════════════════ */
.pwa-install-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 1200;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: 14.5px; font-weight: 800; box-shadow: 0 10px 26px rgba(184,134,11,.42);
  animation: fabIn .5s var(--ease-spring) both;
}
.pwa-install-fab svg { width: 18px; height: 18px; }
.pwa-install-fab:hover { box-shadow: 0 14px 32px rgba(184,134,11,.55); transform: translateY(-1px); }
.pwa-install-fab:active { transform: scale(.96); }
.pwa-install-fab:disabled { opacity: .6; }
@keyframes fabIn { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .pwa-install-fab { right: 14px; bottom: 76px; } }

/* ══════════════════════════ 토스트 ══════════════════════════ */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .4s var(--ease-spring); max-width: 90vw; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast--success { background: #0b4d34; } .toast--success svg { color: #34d399; }
.toast--error { background: #6b1f18; } .toast--error svg { color: #fca5a5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }

/* ══════════════════════════ 반응형 ══════════════════════════ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .topbar { display: flex; }
  .topbar .kst-clock { display: inline-flex; } .topbar .kst-clock__tz { display: none; }
  .sidebar__collapse { display: none; }
  .gen-wrap { grid-template-columns: 1fr; }
  .hero { padding: 40px 26px; } .hero h1 { font-size: 30px; }
}
@media (max-width: 640px) {
  .view { padding: 22px 16px 70px; }
  .form-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .msg__bubble { max-width: 88%; }
}
