/* 포털 공용 스타일 — it-park-node 관리 화면 모양(어두운 사이드바 #263238 · 흰 헤더 60px · 바탕 #f5f5f5 · Roboto).

   갈래 C 템플릿이 쓰는 클래스(계약 — 이름을 바꾸지 않는다):
     타일      .tiles  .tile  .tile-k(이름)  .tile-n(큰 숫자)  .tile-sub(보조 줄)  .tile-alert(주황 강조)
     카드      .panel(흰 카드, 안쪽 여백 18/20)  .panel-h(제목 줄 — h2 + 오른쪽 버튼 · 칩)  .panel-f(아래 설명)  .panel-accent(파란 테두리)
     표        .table(thead 회색 줄)  .table-nowrap(칸 줄바꿈 없음)  .table-wrap(가로 스크롤 — .panel 바로 안이면 카드 끝까지 붙는다)
               td.num  td.actions  td.wrap  td.empty
     칩        .chip  .chip-wait(대기 · 파랑)  .chip-two(2인 · 주황)  .chip-busy(진행 중 · 회색)  .chip-ok(반영 · 초록)
               .chip-hold(보류 · 주황)  .chip-off(정지 · 갈색)
     버튼      .btn  .btn-primary  .btn-ghost  .btn-danger  .btn-sm  .btn-block   (disabled 는 회색)
     알림 띠   .banner  .banner-info(파랑)  .banner-alert(주황 테두리)  .banner-ok(초록)
     진행률    .progress > .progress-bar(style="width: 37%")
     폼        .form-row(라벨 + 입력 세로)  .choices  .choice  .hint  .form-actions
     글자      .muted  .mono  .nowrap  .sr-only
     고르기    .pills > a.pill(.on 또는 aria-pressed="true")
     배치      .cols > .col-main + .col-side
     판정 틀   .judge-frame — 헤더 아래를 꽉 채우는 iframe(또는 iframe 을 감싼 div). .content 바로 안에 두면 여백이 빠진다.
   아이콘: templates/_icons.html 의 icon(name, size) 매크로. */

:root {
  --sidebar: #263238;
  --sidebar-active: #37474f;
  --sidebar-link: #b0bec5;
  --sidebar-muted: #90a4ae;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #263238;
  --text-2: #37474f;
  --muted: #546e7a;
  --line: #eceff1;
  --border: #b0bec5;
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --primary-soft: #e3f2fd;
  --primary-line: #90caf9;
  --warn: #bf360c;
  --warn-soft: #fff3e0;
  --ok: #1b5e20;
  --ok-soft: #e8f5e9;
  --off: #4e342e;
  --off-soft: #efebe9;
  --danger: #c62828;
  --danger-line: #ef9a9a;
  --danger-soft: #ffebee;
  --header-h: 60px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --font: Roboto, "Noto Sans KR", system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  word-break: keep-all;          /* 한글을 낱자 가운데서 끊지 않는다 */
  overflow-wrap: break-word;
}
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3 { margin: 0; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--line); border-radius: 4px; padding: 1px 5px; }
.icon { flex: 0 0 auto; display: block; }
:focus-visible { outline: 3px solid rgba(21, 101, 192, 0.4); outline-offset: 2px; }

/* ───────── 틀: 사이드바 + 헤더 + 본문 ───────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 232px;
  width: 232px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar);
  color: #fff;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 16px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.brand:hover { color: #fff; }
.brand-name { white-space: nowrap; }
.brand-engine {
  font-size: 11px;
  font-weight: 700;
  background: var(--sidebar-active);
  border-radius: 4px;
  padding: 2px 6px;
}
.sidebar-rule { border-top: 1px solid var(--sidebar-active); margin: 0 0 8px; }
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-section { font-size: 12px; color: var(--sidebar-muted); padding: 14px 12px 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--sidebar-link);
  text-decoration: none;
  font-size: 15px;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav-link.active { color: #fff; background: var(--sidebar-active); }
button.nav-link {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.nav-link-sm { min-height: 40px; font-size: 14px; padding: 0 10px; }
.who {
  margin-top: auto;
  border-top: 1px solid var(--sidebar-active);
  padding: 14px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.who-id { font-size: 14px; font-weight: 500; padding: 0 10px; }
.who-display { font-weight: 400; color: var(--sidebar-link); }
.who-role { font-size: 12px; color: var(--sidebar-link); padding: 0 10px 6px; }
.logout-form { margin: 0; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  min-height: var(--header-h);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
}
.header h1 { font-size: 20px; font-weight: 500; }
.header h1 small, .header h1 .muted { font-size: 14px; font-weight: 400; color: var(--muted); }
.header-action { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.header-user { display: inline-flex; align-items: center; gap: 8px; }

.content {
  flex: 1 1 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ───────── 타일 ───────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.tile-k { font-size: 13px; color: var(--muted); }
.tile-n { font-size: 26px; font-weight: 700; margin-top: 4px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 13px; color: var(--muted); }
.tile-alert { background: var(--warn-soft); box-shadow: inset 0 0 0 2px var(--warn); }
.tile-alert .tile-n { color: var(--warn); }
.tile-alert .tile-k, .tile-alert .tile-sub { color: var(--text-2); }
a.tile { display: block; color: inherit; text-decoration: none; }
a.tile:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }

/* ───────── 카드 ───────── */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  min-width: 0;
}
.panel-h {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-h h2, .panel > h2 { font-size: 16px; font-weight: 700; }
.panel > h2 { margin-bottom: 12px; }
.panel-f { font-size: 13px; color: var(--muted); line-height: 1.6; margin-top: 12px; }
.panel > :last-child { margin-bottom: 0; }
.panel p { margin: 0 0 10px; }
.panel-accent { box-shadow: inset 0 0 0 2px var(--primary), var(--shadow); }

/* ───────── 표 ───────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; }
.panel > .table-wrap { margin-left: -20px; margin-right: -20px; }
.panel > .table-wrap:last-child { margin-bottom: -18px; border-radius: 0 0 var(--radius) var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead tr { background: var(--line); color: var(--text-2); }
.table th { padding: 10px 14px; font-weight: 500; text-align: left; white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; padding-top: 8px; padding-bottom: 8px; }
.table .actions > * + * { margin-left: 6px; }
.table .actions form { display: inline; }
.table .strong { font-weight: 500; }
.table-nowrap td { white-space: nowrap; }
.table td.wrap { white-space: normal; min-width: 120px; }
.table .empty { text-align: center; color: var(--muted); padding: 28px 14px; }

/* ───────── 칩 ───────── */
.chip {
  display: inline-block;
  font-size: 12px;
  line-height: 1.5;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.chip-wait { background: var(--primary-soft); color: var(--primary-dark); }
.chip-two { background: var(--warn-soft); color: var(--warn); }
.chip-busy { background: var(--line); color: var(--text-2); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-hold { background: var(--warn-soft); color: var(--warn); }
.chip-off { background: var(--off-soft); color: var(--off); }

/* ───────── 버튼 ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: var(--line);
  color: var(--text-2);
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: #f5f7f8; color: var(--text); }
.btn-danger { background: #fff; border-color: var(--danger-line); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: #cfd8dc;
  border-color: #cfd8dc;
  color: var(--text-2);
  cursor: not-allowed;
}
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; min-height: 46px; font-size: 15px; }

/* ───────── 알림 띠 ───────── */
.banner { border-radius: 8px; padding: 10px 14px; font-size: 13px; line-height: 1.6; background: var(--line); color: var(--text-2); }
.banner-info { background: var(--primary-soft); color: var(--primary-dark); }
.banner-alert { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); }
.banner-ok { background: var(--ok-soft); color: var(--ok); }
.banner b, .banner strong { font-weight: 700; }

/* ───────── 진행률 ───────── */
.progress {
  flex: 0 0 auto;
  width: 220px;
  max-width: 100%;
  height: 8px;
  background: var(--primary-soft);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width 0.2s ease; }

/* ───────── 폼 ───────── */
.form-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-row > label, .form-row > .label, fieldset.form-row > legend {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
fieldset.form-row { border: 0; margin: 0; padding: 0; }
fieldset.form-row > legend { padding: 0; margin-bottom: 6px; }
.form-row input:not([type="checkbox"]):not([type="radio"]),
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
}
.form-row textarea { padding: 10px 12px; min-height: 88px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--primary);
  outline: 2px solid rgba(21, 101, 192, 0.25);
  outline-offset: 0;
}
.form-row [aria-invalid="true"] { border-color: var(--warn) !important; }
.form-row .error { font-size: 13px; color: var(--warn); }
.choices { display: flex; flex-direction: column; gap: 2px; }
.choice { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.choice.disabled { color: var(--muted); cursor: default; }
.hint { font-size: 12px; color: var(--muted); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ───────── 글자 ───────── */
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ───────── 고르기(필터) ───────── */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.pill:hover { color: var(--text); background: #f5f7f8; }
.pill.on, .pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ───────── 배치 ───────── */
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* ───────── 판정 틀 ───────── */
.judge-frame {
  display: block;
  width: 100%;
  height: calc(100vh - var(--header-h));
  min-height: 480px;
  border: 0;
  background: #0f1115;
}
.judge-frame > iframe { display: block; width: 100%; height: 100%; border: 0; }
.content:has(> .judge-frame) { padding: 0; gap: 0; }
.content:has(> .judge-frame) > .banner { margin: 12px 16px; }

/* ───────── 비밀번호 한 번 보여 주기 ───────── */
.secret {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.secret-value {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.04em;
  user-select: all;
  word-break: break-all;
}

/* ───────── 로그인 ───────── */
.login-body { background: var(--line); }
.login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 16px;
}
.login-card { width: 100%; max-width: 420px; }
.login-head {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--sidebar);
  color: #fff;
  border-radius: 12px 12px 0 0;
  padding: 24px 28px;
}
.login-title { font-size: 20px; font-weight: 700; }
.login-sub { font-size: 13px; color: var(--sidebar-link); }
.login-form {
  background: #fff;
  border-radius: 0 0 12px 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.login-notes { margin: 0; padding: 0 0 0 18px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.login-foot { text-align: center; font-size: 12px; color: var(--muted); }

/* ───────── 좁은 화면: 사이드바를 위로 ───────── */
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    flex: 0 0 auto;
    padding: 12px;
    overflow: visible;
  }
  .brand { padding: 4px 4px 10px; }
  .sidebar-rule { margin-bottom: 6px; }
  .nav-list { flex-direction: row; flex-wrap: wrap; }
  .nav-section { flex-basis: 100%; padding: 6px 4px 0; }
  .nav-link { min-height: 40px; font-size: 14px; }
  .who { margin-top: 8px; padding-top: 10px; }
  .who-links { display: flex; flex-wrap: wrap; gap: 4px; }
  .who-links .nav-link { width: auto; }
  .header { position: static; padding: 10px 16px; }
  .content { padding: 16px; gap: 16px; }
  .panel { padding: 16px; }
  .panel > .table-wrap { margin-left: -16px; margin-right: -16px; }
  .panel > .table-wrap:last-child { margin-bottom: -16px; }
  .judge-frame { height: calc(100vh - var(--header-h)); }
}
