/* ==========================================================================
   공통 레이아웃 — 앱 셸, 사이드바, 페이지 머리글, 본문 여백, 브레드크럼
   app.css(토큰) 다음, app-components.css 앞에 불러온다 (components/app_css.html).
   ========================================================================== */

/* ---------- 앱 레이아웃 ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}
@media (min-width: 992px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; }
  /* Bootstrap .offcanvas-lg 는 lg 이상에서 background-color: transparent !important 를 건다 */
  .app-sidebar.offcanvas-lg { background-color: var(--sidebar-bg) !important; }
}
@media (max-width: 991.98px) {
  .app-sidebar.offcanvas-lg { --bs-offcanvas-width: var(--sidebar-width); background: var(--sidebar-bg); }
}
.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: 1.25rem 0.875rem; position: relative; }
.sidebar-close { position: absolute; top: 1.25rem; right: 1rem; }
.sidebar-brand {
  display: flex; align-items: center; gap: 0.625rem;
  color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem;
  padding: 0 0.5rem 1.25rem;
}
.sidebar-brand:hover { color: #fff; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 1rem;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-section {
  margin: 1.25rem 0.75rem 0.5rem; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: #6b7390;
}
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--sidebar-text); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar-link:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.sidebar-link.active { color: var(--sidebar-active); background: var(--sidebar-active-bg); }
.sidebar-link.active i { color: #a5b4fc; }

.sidebar-user { margin-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 0.875rem; }
.sidebar-user-btn {
  width: 100%; display: flex; align-items: center; gap: 0.625rem;
  background: transparent; border: 0; padding: 0.5rem; border-radius: var(--radius-sm);
  color: var(--sidebar-text); text-align: left;
}
.sidebar-user-btn:hover { background: rgba(255, 255, 255, 0.05); }
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar-user-text strong { color: #fff; font-size: 0.875rem; font-weight: 600; }
.sidebar-user-text small { font-size: 0.75rem; color: #7c849c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.25rem 2rem 1rem;
}
.app-header-titles { flex: 1 1 15rem; min-width: 0; }
.app-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.page-title {
  font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.02em;
  word-break: keep-all; overflow-wrap: anywhere; /* 한글 단어 중간 줄바꿈 방지, 긴 토큰은 강제 줄바꿈 */
}
.app-content { padding: 0 2rem 2.5rem; flex: 1; min-width: 0; }
@media (max-width: 767.98px) {
  .app-header { padding: 1rem 1rem 0.75rem; }
  .app-content { padding: 0 1rem 2rem; }
  .page-title { font-size: 1.25rem; }
}

.breadcrumb {
  margin-bottom: 0.25rem; font-size: 0.8125rem; --bs-breadcrumb-divider-color: var(--text-subtle);
  flex-wrap: nowrap; min-width: 0;
}
.breadcrumb-item { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-item:first-child { flex-shrink: 0; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-item.active { color: var(--text-subtle); }

.flash-messages .alert { border-radius: var(--radius-sm); }
