/* layout.css — シェル（ヘッダー／サイドバー／本文） */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 1180px;
}

/* ---------- ヘッダー ---------- */
.app-header {
  flex: 0 0 var(--h-header);
  height: var(--h-header);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-5);
  background: var(--c-paper);
  border-bottom: 1px solid var(--c-line-strong);
}
.app-header__brand {
  display: flex; align-items: baseline; gap: var(--sp-2);
  font-size: 14px; font-weight: 700; color: var(--c-ink);
  letter-spacing: .01em;
}
.app-header__brand .mark {
  display: inline-block; width: 10px; height: 10px;
  background: var(--c-primary); border-radius: 2px;
  transform: translateY(1px);
}
.app-header__brand .sub {
  font-size: 11px; font-weight: 400; color: var(--c-muted);
}
.app-header__spacer { flex: 1 1 auto; }
.app-header__right { display: flex; align-items: center; gap: var(--sp-3); }

.dummy-badge {
  height: 22px; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 var(--sp-3);
  background: var(--c-warn-bg); color: var(--c-warn);
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  border-radius: var(--r-sm);
}
.dummy-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-warn);
}

.app-role {
  display: flex; flex-direction: column; gap: 1px;
  padding-left: var(--sp-3); border-left: 1px solid var(--c-line);
}
.app-user {
  display: flex; flex-direction: column; line-height: 1.25;
  padding-left: var(--sp-3); border-left: 1px solid var(--c-line);
}
.app-user__name { font-size: 12px; font-weight: 700; color: var(--c-ink); }
.app-user__role { font-size: 11px; color: var(--c-muted); }

/* ---------- 本体 ---------- */
.app-body { flex: 1 1 auto; display: flex; min-height: 0; }

/* ---------- サイドバー ---------- */
.sidebar {
  flex: 0 0 var(--w-side);
  width: var(--w-side);
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  transition: flex-basis var(--dur) var(--ease), width var(--dur) var(--ease);
}
.app.is-collapsed .sidebar {
  flex-basis: var(--w-side-collapsed);
  width: var(--w-side-collapsed);
}
.sidebar__group { padding: var(--sp-3) 0 var(--sp-1); }
.sidebar__group + .sidebar__group { border-top: 1px solid var(--c-line); }
.sidebar__group-label {
  padding: 0 var(--sp-4) var(--sp-1);
  font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--c-muted);
}
.app.is-collapsed .sidebar__group-label { visibility: hidden; height: 12px; }

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%; height: 34px;
  padding: 0 var(--sp-4) 0 calc(var(--sp-4) + 3px);
  color: var(--c-body); font-size: 13px; text-align: left;
  transition: background var(--dur-fast) var(--ease);
}
.nav-item:hover { background: var(--c-surface-2); text-decoration: none; }
.nav-item__glyph {
  flex: 0 0 16px; width: 16px; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--c-muted);
}
.nav-item__label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app.is-collapsed .nav-item__label { display: none; }
.app.is-collapsed .nav-item { padding-left: var(--sp-4); }
.nav-item__count {
  flex: 0 0 auto; min-width: 18px; height: 17px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-alert-bg); color: var(--c-alert);
  font-size: 11px; font-weight: 700; border-radius: var(--r-sm);
  font-variant-numeric: tabular-nums;
}
.app.is-collapsed .nav-item__count {
  position: absolute; top: 3px; right: 3px; min-width: 0;
  width: 6px; height: 6px; padding: 0; font-size: 0; border-radius: 50%;
  background: var(--c-alert);
}
.nav-item.is-active {
  background: var(--c-surface-2); color: var(--c-ink); font-weight: 700;
}
.nav-item.is-active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--c-primary);
}
.nav-item.is-active .nav-item__glyph { color: var(--c-primary); }

.sidebar__foot {
  margin-top: auto;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--c-line);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.sidebar__theme { display: flex; flex-direction: column; gap: 3px; }
.sidebar__theme .select { width: 100%; height: 28px; font-size: 12px; }
.app.is-collapsed .sidebar__theme { display: none; }
.sidebar__toggle {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 11px; color: var(--c-muted);
}
.sidebar__toggle:hover { color: var(--c-ink); }

/* ---------- 主要領域 ---------- */
.app-main {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--c-paper);
}
.page-head {
  flex: 0 0 auto;
  display: flex; align-items: flex-end; gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6) var(--sp-3);
  border-bottom: 1px solid var(--c-line);
}
.page-head__title { display: flex; align-items: baseline; gap: var(--sp-3); }
.page-head__desc { font-size: 11px; color: var(--c-muted); }
.page-head__actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }

.page-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: var(--sp-5) var(--sp-6) var(--sp-10);
}

/* 汎用グリッド */
.grid { display: grid; gap: var(--sp-4); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--60-40 { grid-template-columns: 60% 1fr; }
.grid--62-38 { grid-template-columns: 62% 1fr; }
.stack > * + * { margin-top: var(--sp-5); }
