/* =====================================================================
   에드에플릭스 · layout.css — 리셋 · 셸 · 사이드바 · 상단바 · 드로어 · 반응형
   tokens.css 의존.
   ===================================================================== */
/* =====================================================================
   에드에플릭스 (ADAFFLIX) · Components + Layout
   tokens.css 의존. 셸 / 사이드바 / 톱바 / 카드 / 버튼 / 뱃지 / 폼 / 칩 ...
   ===================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: var(--lh-normal);
  background:
    radial-gradient(58vw 48vh at 10% -8%, rgba(44,196,136,0.12), transparent 60%),
    radial-gradient(52vw 46vh at 108% 6%, rgba(220,179,95,0.11), transparent 58%),
    radial-gradient(46vw 52vh at 92% 108%, rgba(208,100,64,0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
a { color: inherit; text-decoration: none; }
[data-theme="dark"] body { background: #14151a !important; }
[data-theme="dark"] .shell-scroll, [data-theme="dark"] .shell, [data-theme="dark"] .shell-main { background: #14151a; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--brand-soft); color: var(--brand-ink); }

*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 11px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

.num { font-family: var(--font-num); font-feature-settings: 'tnum' 1; letter-spacing: -0.01em; }
.disp { font-family: var(--font-display); font-weight: var(--fw-bold); letter-spacing: -0.022em; }

/* ── Shell ─────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.shell-main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.shell-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.page-wrap { max-width: var(--content-max); margin: 0 auto; padding: var(--space-7) var(--space-7) var(--space-11); }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: var(--space-5) var(--space-4) var(--space-4);
  gap: var(--space-5);
  z-index: var(--z-drawer);
}
.brand { display: flex; align-items: center; gap: 11px; padding: var(--space-2) var(--space-2) 0; cursor: pointer; }
.brand-mark { width: 40px; height: 40px; flex-shrink: 0; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(140deg, var(--brand-strong), var(--brand)); box-shadow: var(--shadow-brand); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand.logo-only { padding: var(--space-2) var(--space-2) var(--space-1); }
.brand-name { font-family: var(--font-display); font-size: 23px; font-weight: var(--fw-black); color: var(--brand-ink); letter-spacing: -0.045em; line-height: 1; }
.brand-name::after { content: '.'; color: var(--money-bright); }
.brand-tag { font-size: 11px; font-weight: var(--fw-bold); color: var(--brand); letter-spacing: var(--tracking-wide); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.sidebar-search { display: flex; align-items: center; gap: 9px; background: var(--surface-sunk); padding: 10px 13px; border-radius: var(--radius-sm); color: var(--ink-faint); border: 1px solid transparent; transition: all var(--dur-fast) var(--ease); }
.sidebar-search:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: var(--shadow-focus); }
.sidebar-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink); font-size: var(--fs-14); }
.nav-label { font-size: var(--fs-12); font-weight: var(--fw-bold); color: var(--ink-faint); letter-spacing: var(--tracking-wide); padding: var(--space-3) var(--space-3) var(--space-2); }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px var(--space-3);
  font-size: var(--fs-15); font-weight: var(--fw-medium);
  color: var(--ink-soft); border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  position: relative; text-align: left; width: 100%;
}
.nav-item .emoji { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: var(--fw-bold); }
.nav-item.active::before { content: ''; position: absolute; left: -4px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--brand); }
.nav-item .nav-badge { margin-left: auto; font-family: var(--font-num); font-size: 11px; font-weight: var(--fw-bold); padding: 2px 7px; border-radius: var(--radius-full); background: var(--pop-soft); color: var(--pop-ink); }

.sidebar-foot { margin-top: auto; }
.level-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-800) 100%);
  border-radius: var(--radius-md); padding: var(--space-4);
  color: #fff; display: flex; flex-direction: column; gap: var(--space-2);
  box-shadow: var(--shadow-brand);
}
.level-card .lvl-top { display: flex; align-items: center; gap: 8px; }
.level-card .lvl-emoji { font-size: 22px; }
.level-card .lvl-name { font-weight: var(--fw-bold); font-size: var(--fs-15); }
.level-card .lvl-sub { font-size: var(--fs-12); color: rgba(255,255,255,0.72); margin-left: auto; }
.level-card .lvl-bar { height: 7px; border-radius: 7px; background: rgba(255,255,255,0.25); overflow: hidden; }
.level-card .lvl-fill { height: 100%; border-radius: 7px; background: var(--amber-400); }
.level-card .lvl-meta { font-size: var(--fs-12); color: rgba(255,255,255,0.85); }
.level-card .lvl-meta b { font-family: var(--font-num); color: #fff; }

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 var(--space-6); display: flex; align-items: center; gap: var(--space-4);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.hamburger { display: none; }
.crumb { display: flex; align-items: center; gap: 9px; font-size: var(--fs-15); color: var(--ink-faint); flex: 1; min-width: 0; overflow: hidden; }
.crumb > span { white-space: nowrap; }
.crumb .now { color: var(--ink); font-weight: var(--fw-bold); }
.crumb .sep { opacity: 0.5; }
.topbar-search {
  display: flex; align-items: center; gap: 9px; background: var(--surface-sunk);
  padding: 9px 14px; border-radius: var(--radius-full); min-width: 260px;
  color: var(--ink-faint); border: 1px solid transparent; transition: all var(--dur-fast) var(--ease);
}
.topbar-search:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: var(--shadow-focus); }
.topbar-search input { flex: 1; background: none; border: 0; outline: 0; color: var(--ink); font-size: var(--fs-14); }
.topbar-actions { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--ink-soft); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); position: relative; }
.icon-btn:hover { background: var(--bg-hover); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--pop); border: 2px solid var(--surface); }
.profile-btn { display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border-radius: var(--radius-full); background: var(--surface-sunk); transition: background var(--dur-fast) var(--ease); }
.profile-btn:hover { background: var(--bg-active); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: var(--fw-bold); font-size: var(--fs-14); color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-800)); flex-shrink: 0; }
.profile-btn .pname { font-size: var(--fs-14); font-weight: var(--fw-bold); white-space: nowrap; }


/* ── Mobile drawer scrim ───────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: calc(var(--z-drawer) - 1); animation: fade var(--dur) var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 86%; max-width: 320px; transform: translateX(-101%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-lg); z-index: var(--z-drawer); }
  .sidebar.open { transform: translateX(0) !important; }
  .hamburger { display: grid; }
  .topbar-search { display: none; }
  .page-wrap { padding: var(--space-5) var(--space-5) var(--space-10); }
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .ph-title { font-size: var(--fs-28); }
  .page-wrap { padding: var(--space-4) var(--space-4) var(--space-9); }
  .topbar { padding: 0 var(--space-4); }
  .profile-btn .pname { display: none; }
}
