/* 허브 셸(메뉴·레이아웃) 전용 스타일 */
body { height: 100vh; overflow: hidden; }
#app { height: 100%; }

.shell { display: flex; height: 100%; }
.sidebar {
  width: 240px; flex: none; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 15px; }
.brand.big { justify-content: center; font-size: 22px; padding: 0 0 18px; }
.brand.big .logo { width: 38px; height: 38px; font-size: 19px; }

nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
nav a:hover { background: var(--surface-2); }
nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
nav .ic { width: 22px; text-align: center; font-size: 16px; }
.nav-label { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 16px 10px 6px; letter-spacing: .3px; }
.nav-empty { font-size: 12.5px; color: var(--muted); padding: 4px 10px; margin: 0; }

.userbox { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; flex: none; }
.userbox .who { flex: 1; min-width: 0; }
.userbox .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .who span { font-size: 12px; color: var(--muted); }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; gap: 8px; height: 52px; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; }
.topbar h1 { font-size: 16px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-btn { display: flex; align-items: center; gap: 4px; height: 38px; padding: 0 12px; border-radius: 10px; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 15px; text-decoration: none; }
.home-btn[hidden] { display: none; }
.brand-link { color: inherit; text-decoration: none; }
.view { flex: 1; overflow-y: auto; }
.view.full { overflow: hidden; display: flex; }
.view.full iframe { border: 0; width: 100%; height: 100%; display: block; background: var(--bg); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; }

.mod-card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.mod-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.mod-card .ic { font-size: 28px; line-height: 1; margin-bottom: 10px; }
.mod-card h3 { margin: 0 0 4px; }
.mod-card p { margin: 0; color: var(--muted); font-size: 13px; }

.perm-select { min-width: 92px; padding: 4px 8px; min-height: 30px; }
.perm-select.write { color: var(--ok); font-weight: 700; }
.perm-select.read { color: var(--primary); font-weight: 700; }

/* 데이터베이스 보기 */
.db-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.db-pick .btn { height: auto; min-height: 38px; padding: 6px 12px; }
.db-pick .btn.primary .muted { color: inherit; opacity: .8; }
.db-grid { max-height: 60vh; overflow: auto; }
.db-grid th { position: sticky; top: 0; background: var(--surface); z-index: 1; white-space: nowrap; }
.db-grid td { white-space: nowrap; font-size: 13px; }

/* 로그인/설정 화면 */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.auth-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 30px 26px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 19px; text-align: center; margin-bottom: 4px; }
.auth-card > p.muted { text-align: center; margin: 0 0 20px; }

.code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
pre.code { padding: 12px 14px; overflow-x: auto; margin: 8px 0; }

/* 모바일 */
@media (max-width: 820px) {
  .topbar { display: flex; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
}
