/* 신학부 대시보드 (views/theology-dashboard.js)
 *
 * 규칙(org-dashboard.css 와 동일):
 *  - **모든 선택자는 `.theodash` 로 시작한다.** 40개 뷰가 한 문서에 얹히므로 전역에 새면
 *    다른 뷰의 .card/.badge/.panel 이 뒤틀린다.
 *  - base.css 에 이미 있는 것(.panel/.badge/.toolbar/.table-wrap/.field/.primary/.ghost/
 *    .compact-action/.error/.muted/.hint/.panel-head)은 재정의하지 않는다.
 *  - **토큰만 쓴다.** #fff / rgba(255…) 같은 고정색 금지 — :root[data-theme="dark"] 가
 *    토큰을 갈아끼우므로 토큰만 쓰면 다크모드가 자동으로 따라온다.
 */

.theodash {
  --r: 8px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  display: block;
  min-width: 0;
}

/* 보드 바깥 줄 — 다크모드 토글과 세션 시계만 여기 둔다. */
.theodash .theodash-outer-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  min-height: var(--ctl-h);
}

/* 세션 시계는 base.css 에서 화면 우상단 position:fixed 라 보드 위를 덮는다.
   이 화면에서만 흐름 배치로 되돌린다 — base.css 를 고치면 다른 39개 화면까지 바뀐다. */
.theodash .theodash-outer-tools .session-timer {
  position: static;
  top: auto;
  right: auto;
  z-index: auto;
  box-shadow: none;
}

.theodash .theodash-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: var(--ctl-h);
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.theodash .theodash-theme-btn:hover:not(:disabled) {
  color: var(--brand);
  background: var(--panel);
  border-color: var(--line);
}

/* 카드형 보드: 헤더는 고정, 본문(iframe)이 남은 높이를 전부 먹는다.
   --theodash-shell-h 는 mountTheologyDashboard 의 syncTheoDashHeight 가 주입한다. */
.theodash .theodash-shell {
  display: flex;
  flex-direction: column;
  height: var(--theodash-shell-h, calc(100dvh - 200px));
  min-height: 420px;
  overflow: hidden;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.theodash .theodash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  row-gap: var(--sp-2);
  min-height: 60px;
  flex: none;
  padding: var(--sp-2) var(--sp-6);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.theodash .top-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: none;
}

.theodash .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  background: var(--brand);
  flex: none;
}

.theodash .brand-text {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.2px;
}

.theodash .top-right {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.theodash .top-right .badge.warn-badge {
  background: var(--warn-soft);
  color: var(--warn);
}

.theodash .top-tabsrow {
  order: 3;
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.theodash .top-nav {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  flex: 1 1 auto;
}

/* 탭: 브랜드색 + 밑줄. 조직 대시보드와 같은 룩이다. */
.theodash .top-nav .btn.nav-item {
  flex: 0 0 auto;
  width: auto;
  height: 44px;
  align-self: center;
  padding: 0 var(--sp-4);
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  white-space: nowrap;
  cursor: pointer;
}

.theodash .top-nav .btn.nav-item:hover {
  color: var(--ink);
  background: var(--soft);
  border-bottom-color: var(--line);
}

.theodash .top-nav .btn.nav-item.is-on {
  color: var(--brand);
  background: var(--brand-soft);
  border-bottom-color: var(--brand);
}

/* 업로드 화면에서는 탭 행을 비활성으로 보여 준다(누르면 대시보드로 돌아간다). */
.theodash .top-nav .btn.nav-item.is-muted {
  opacity: .55;
}

.theodash .theodash-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.theodash .theodash-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  display: block;
  background: var(--page);
}

.theodash .theodash-state {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-6);
  display: grid;
  align-content: start;
}

.theodash .theodash-upload {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-6);
  display: grid;
  gap: var(--sp-4);
  align-content: start;
}

.theodash .theodash-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
  margin: 0;
}

.theodash .theodash-status-grid > div {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--soft);
}

.theodash .theodash-status-grid dt {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.theodash .theodash-status-grid dd {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-all;
}

.theodash .theodash-upload-form {
  display: grid;
  gap: var(--sp-3);
  max-width: 640px;
}

.theodash .theodash-upload-actions {
  display: flex;
  gap: var(--sp-2);
}

.theodash .theodash-ok {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--good-soft);
  color: var(--good);
  font-weight: 700;
}

.theodash .table-wrap td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1080px) {
  .theodash .theodash-topbar {
    padding: var(--sp-2) var(--sp-4);
  }
  .theodash .top-nav .btn.nav-item {
    padding: 0 var(--sp-3);
    font-size: 14px;
  }
}
