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

/* ── 브랜드 ── */
.brand { display: inline-flex; align-items: center; gap: 9px; min-height: 40px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 6px; }
/* 다크: 먹색 심볼이 바탕에 묻히지 않게 얇은 테두리 */
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .login-brand img { box-shadow: 0 0 0 1px var(--border-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand img, :root:not([data-theme="light"]) .login-brand img { box-shadow: 0 0 0 1px var(--border-strong); } }
.brand-text { font-size: var(--text-lg); letter-spacing: -0.02em; color: var(--text-2); font-weight: var(--weight-medium); }
.brand-text strong { color: var(--text); font-weight: var(--weight-bold); }

/* ── 콘솔 틀 ── */
.console { min-height: 100vh; min-height: 100dvh; }
/* 사이드바 = 바깥(배경·경계선 — PC 에선 그리드 칸이라 페이지 끝까지 늘어남) + 안쪽(.side-inner — 화면 높이에 붙어 있음).
   휴대폰·태블릿(<960)은 바깥이 화면에 고정된 서랍. */
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 70; width: min(84vw, var(--side-w));
  background: var(--side-bg); border-right: 1px solid var(--side-border);
  transform: translateX(-102%); transition: transform .22s var(--ease); visibility: hidden;
}
.side-inner { display: flex; flex-direction: column; height: 100%; }
.side.is-open { transform: none; visibility: visible; box-shadow: var(--shadow-2); }
.side-head { display: flex; align-items: center; gap: var(--space-2); min-height: var(--topbar-h); padding: 0 var(--space-4); }
.side-nav { flex: 1 1 auto; overflow-y: auto; padding: var(--space-1) 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-semibold); color: var(--text-3); }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 var(--space-3); border-radius: var(--r); color: var(--side-text); text-decoration: none; font-size: var(--text-sm); font-weight: var(--weight-medium); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.side-nav a svg { width: 17px; height: 17px; opacity: .8; }
.side-nav a:hover { background: var(--side-hover); color: var(--text); text-decoration: none; }
.side-nav a[aria-current="page"] { background: var(--side-active-bg); color: var(--side-active-text); font-weight: var(--weight-semibold); }
.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-ink); }
.side-nav a[aria-current="page"] svg { opacity: 1; }
.nav-n { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: var(--text-xs); font-weight: var(--weight-semibold); text-align: center; color: var(--text-3); background: color-mix(in srgb, var(--side-text) 9%, transparent); }
.nav-n-warn { color: var(--st-warn); background: var(--st-warn-bg); }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom)) var(--space-4); 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; } }
.env-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--r-sm); background: var(--st-warn-bg); color: var(--st-warn); font-size: var(--text-xs); font-weight: var(--weight-bold); }

.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) 86%, transparent);
  backdrop-filter: saturate(1.3) blur(10px); -webkit-backdrop-filter: saturate(1.3) blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-brand .brand-text { font-size: var(--text-md); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); }
.ses-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-decoration: none; white-space: nowrap; }
.ses-pill:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.ses-pill svg { width: 14px; height: 14px; color: var(--st-ok); }
.ses-pill-fake svg { color: var(--st-warn); }
.ses-pill-off { color: var(--st-warn); background: var(--st-warn-bg); border-color: transparent; }
.ses-pill-off svg { color: var(--st-warn); }
.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) {
  .console { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .side { position: relative; top: auto; bottom: auto; left: auto; z-index: auto; transform: none; visibility: visible; width: auto; box-shadow: none; transition: none; }
  .side.is-open { box-shadow: none; }
  .side-inner { position: sticky; top: 0; height: 100vh; height: 100dvh; }
  .side-back { display: none !important; }
  .side-btn, .topbar-brand { display: none; }
  .topbar { padding: 0 var(--gutter); }
  .page { padding-top: var(--space-6); gap: var(--space-6); }
}

/* ── 화면 안 큰 배치(여러 화면이 같이 씀) ──
   .dash-grid       넓은 칸 + 좁은 칸(대시보드 막대·SES)        .dash-grid-even  같은 폭 두 칸(높이는 내용대로)
   .site-grid       본문 + 오른쪽 340 칸(사이트·기록 상세) */
.dash-grid, .site-grid { display: grid; gap: var(--space-5); }
.dash-grid-even, .site-grid { align-items: start; }
@media (min-width: 960px) {
  .dash-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
  .dash-grid-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) { .site-grid { grid-template-columns: minmax(0, 1fr) 340px; } }

/* ── 화면 머리 ── */
.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: 76ch; }
.page-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); font-size: 22px; font-weight: var(--weight-bold); }
.page-head .lead { color: var(--text-2); font-size: var(--text-sm); }
.page-head-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
@media (min-width: 960px) { .page-head h1 { font-size: var(--text-2xl); } }
.crumb a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: var(--text-sm); font-weight: var(--weight-semibold); text-decoration: none; color: var(--text-3); }
.crumb a:hover { color: var(--text); }
.crumb svg { width: 15px; height: 15px; }

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