/* 화면 골격: 데스크톱 상단 메뉴 / 모바일 하단 탭 */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.app-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand img { width: 50px; height: auto; }
.brand:hover { color: var(--text); }

.main-nav { flex: 1; display: flex; flex-wrap: wrap; gap: 0 4px; }
.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: calc(var(--header-h) - 2px);
  padding: 0 12px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
}
.main-nav a[aria-current="page"] { font-weight: 700; border-bottom-color: var(--accent); }
.main-nav a:hover { color: var(--accent); }

.header-tools { display: flex; align-items: center; gap: 8px; }

.app-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 24px;
}
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.split {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
.split__main { flex: 999 1 560px; min-width: 0; }
.split__side { flex: 1 1 340px; min-width: 0; }

/* 모듈 안의 보조 메뉴(결재함 목록 등) */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.subnav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.subnav a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

.tabbar { display: none; }

.flash {
  max-width: var(--maxw);
  margin: 16px auto 0;
  padding: 0 24px;
}
.flash p {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-weight: 500;
}
.flash .notice { background: var(--ok-soft); color: var(--ok); }
.flash .alert { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 900px) {
  :root { --fs: 17px; --fs-xl: 26px; --fs-lg: 22px; }

  .app-header__inner { min-height: 64px; padding: 0 12px 0 16px; }
  .brand { font-size: 19px; }
  .brand img { width: 44px; }
  .main-nav, .header-tools .hide-mobile { display: none; }
  .header-tools { margin-left: auto; }

  .app-main { padding: 18px 14px calc(var(--tabbar-h) + 28px); }

  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 2px solid var(--line);
  }
  .tabbar a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-top: -2px;
    border-top: 4px solid transparent;
    color: var(--text-2);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
  }
  .tabbar a[aria-current="page"] { color: var(--accent); border-top-color: var(--accent); font-weight: 700; }
  .tabbar .badge { position: absolute; top: 6px; left: 50%; margin-left: 8px; }

  .flash { padding: 0 14px; }
}

@media print {
  .app-header, .tabbar, .page-head__actions, .no-print, .cal-side, .subnav, .flash { display: none !important; }
  .split { display: block; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; }
  .app-main { padding: 0; max-width: none; }
}

/* 로그인 */
.login { max-width: 440px; margin: 40px auto; }
.login__brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px; }
.login__rock { width: 150px; height: auto; }
.bell { position: relative; }
.bell .badge { position: absolute; top: 2px; right: -2px; min-width: 22px; height: 22px; font-size: 12px; padding: 0 5px; }

/* 마스터 관리자 (/admin): 회사 화면과 헷갈리지 않게 머리줄 아래에 진한 선 */
.app-header--master { border-bottom: 4px solid var(--text); }
@media (max-width: 900px) {
  .is-master .main-nav { display: flex; overflow-x: auto; }
}
