/* 틀 — 콘솔(사이드바 + 상단 바 + 본문)·가운데 상자(로그인) (includes/layout.php). 규칙서 §5: 모바일은 사이드바를 서랍으로. */

/* ── 브랜드 ── */
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand img { width: 32px; height: 32px; }
.brand-text { font-size: var(--text-lg); letter-spacing: -0.01em; color: var(--text-2); }
.brand-text strong { color: var(--text); font-weight: var(--weight-heavy); }

/* ── 콘솔 틀 ── */
.console { min-height: 100vh; min-height: 100dvh; }
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 70; width: min(84vw, var(--side-w));
  display: flex; flex-direction: column; background: var(--side-bg); border-right: 1px solid var(--side-border);
  transform: translateX(-102%); transition: transform .22s var(--ease); visibility: hidden;
}
.side.is-open { transform: none; visibility: visible; box-shadow: var(--shadow-2); }
.side-head { display: flex; align-items: center; min-height: var(--topbar-h); padding: 0 var(--space-5); }
.side-nav { flex: 1 1 auto; overflow-y: auto; padding: var(--space-2) var(--space-3) var(--space-4); overscroll-behavior: contain; }
.nav-group { padding: var(--space-4) var(--space-3) 6px; font-size: var(--text-xs); font-weight: var(--weight-bold); color: color-mix(in srgb, var(--side-text) 70%, transparent); letter-spacing: .04em; }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 42px; padding: 0 var(--space-3); border-radius: var(--r); color: var(--side-text); text-decoration: none; font-weight: var(--weight-medium); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.side-nav a svg { width: 19px; height: 19px; opacity: .85; }
.side-nav a:hover { background: var(--side-hover); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--side-active-bg); color: var(--side-active-text); font-weight: var(--weight-bold); box-shadow: var(--shadow-1); }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.side-nav a[aria-current="page"] svg { opacity: 1; }
.side-nav a.is-soon { color: color-mix(in srgb, var(--side-text) 72%, transparent); }
.soon { margin-left: auto; padding: 1px 6px; border-radius: var(--r-sm); font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--text-3); background: color-mix(in srgb, var(--side-text) 10%, transparent); }
.side-foot { padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); border-top: 1px solid var(--side-border); }
.side-user { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.side-user > span:last-child { display: grid; min-width: 0; line-height: 1.35; }
.side-user strong { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user small { font-size: var(--text-xs); color: var(--text-3); }
.side-back { position: fixed; inset: 0; z-index: 65; background: var(--overlay); animation: fade-in .2s var(--ease); }
@keyframes fade-in { from { opacity: 0; } }

.console-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: var(--space-2);
  min-height: var(--topbar-h); padding: 0 var(--space-3); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(12px); -webkit-backdrop-filter: saturate(1.3) blur(12px); border-bottom: 1px solid var(--border);
}
.topbar-brand .brand-text { font-size: var(--text-md); }
.topbar-brand .brand img { width: 28px; height: 28px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); }
.env-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: var(--text-xs); font-weight: var(--weight-bold); }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}

.page { width: 100%; max-width: calc(var(--page-max) + var(--gutter) * 2); margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-8); display: grid; gap: var(--space-5); align-content: start; }

@media (min-width: 960px) {
  .side { transform: none; visibility: visible; width: var(--side-w); box-shadow: none; }
  .side.is-open { box-shadow: none; }
  .side-back { display: none !important; }
  .console-main { margin-left: var(--side-w); }
  .side-btn, .topbar-brand { display: none; }
  .topbar { padding: 0 var(--gutter); }
  .page { padding-top: var(--space-6); gap: var(--space-6); }
}

/* ── 화면 머리 ── */
.page-head { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); align-items: flex-end; justify-content: space-between; }
.page-head-text { display: grid; gap: 6px; min-width: 0; max-width: 72ch; }
.page-head .eyebrow { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--primary-ink); letter-spacing: .04em; }
.page-head h1 { font-size: var(--text-2xl); font-weight: var(--weight-heavy); }
.page-head .lead { color: var(--text-2); font-size: var(--text-md); }
.page-head-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
@media (min-width: 960px) { .page-head h1 { font-size: 28px; } }
.crumb a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: var(--text-sm); font-weight: var(--weight-bold); text-decoration: none; color: var(--text-2); }
.crumb a:hover { color: var(--primary-ink); }
.crumb svg { width: 16px; height: 16px; }

/* ── 가운데 상자(로그인·첫 비밀번호) ── */
.simple { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--space-8) var(--gutter); }
.simple-box { width: 100%; max-width: 420px; display: grid; gap: var(--space-4); }
