/* ─────────────────────────────────────────────────────────────────────────────
   platform.css — 계정·조직도·전자결재·관리자 화면과 공용 유틸리티.
   규칙: 모든 padding/margin/gap 은 4px 배수, 인라인 style 금지(CSP style-src 'self').
   ───────────────────────────────────────────────────────────────────────────── */

/* ── 유틸리티 ─────────────────────────────────────────────────────────────── */
.u-flex { display: flex; }
.u-grow { flex: 1; min-width: 0; }
.u-gap-8 { gap: 8px; }
.u-gap-12 { gap: 12px; }
.u-mt-4 { margin-top: 4px; }
.u-mt-8 { margin-top: 8px; }
.u-mt-16 { margin-top: 16px; }
.u-mb-8 { margin-bottom: 8px; }
.u-mb-16 { margin-bottom: 16px; }
.u-ml-4 { margin-left: 4px; }
.u-pl-8 { padding-left: 8px; }
.u-right { text-align: right; }
.u-muted { color: var(--text-3); }
.u-nowrap { white-space: nowrap; }
.blk { display: block; }
.is-late { color: var(--neg); }
.mono-sm { font-family: var(--font-num); font-size: 12px; font-variant-numeric: tabular-nums; }

.swatch-1 { background: var(--series-1); }
.swatch-2 { background: var(--series-2); }
.swatch-3 { background: var(--series-3); }
.swatch-4 { background: var(--series-4); }

.row--dot { grid-template-columns: 8px 1fr auto; }
.row--pair { grid-template-columns: 1fr auto; }
.row__right--muted { color: var(--text-3); font-family: var(--font-ui); font-size: 12px; }
.row__title.is-read { color: var(--text-2); }

.msgrow.is-btn {
  grid-template-columns: 8px 1fr auto; text-align: left; width: 100%;
  background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer;
  font: inherit; color: inherit;
}

.card__title--lg { font-size: 16px; line-height: 24px; color: var(--text); font-weight: 500; }

.msgbody {
  font-size: 13px; line-height: 22px; color: var(--text-2); white-space: pre-wrap;
  border-top: 1px solid var(--line); padding-top: 16px; margin-top: 0;
}

.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pager { padding: 12px 20px; border-top: 1px solid var(--line); }

.meter__cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter__pct { font-family: var(--font-num); font-size: 11px; color: var(--text-3); }

.aging__row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.aging__row:last-child { border-bottom: 0; }
.aging__label { font-family: var(--font-num); font-size: 12px; color: var(--text-2); width: 56px; flex: none; }
.aging__bar { height: 8px; flex: 1; }
.aging__value { text-align: right; width: 120px; flex: none; }
.aging__count { font-size: 11px; color: var(--text-3); margin-left: 4px; }

.workflow--row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.workflow--row:last-child { border-bottom: 0; }

.form-stack { display: flex; flex-direction: column; gap: 12px; }
.range { height: 24px; padding: 0; margin: 0; }

/* progress 요소를 미터로 사용한다(인라인 width 없이 값만 attribute 로) */
progress.meter {
  appearance: none; -webkit-appearance: none; border: 0;
  width: 100%; height: 8px; background: var(--surface-3);
  border-radius: 4px; overflow: hidden; margin: 0;
}
progress.meter::-webkit-progress-bar { background: var(--surface-3); border-radius: 4px; }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: 4px; }
progress.meter.is-warn::-webkit-progress-value { background: var(--warn); }
progress.meter.is-warn::-moz-progress-bar { background: var(--warn); }
progress.meter.is-neg::-webkit-progress-value { background: var(--neg); }
progress.meter.is-neg::-moz-progress-bar { background: var(--neg); }
progress.meter.is-pos::-webkit-progress-value { background: var(--pos); }
progress.meter.is-pos::-moz-progress-bar { background: var(--pos); }

/* 가로 막대(항목 비교) — SVG 로 그려 인라인 스타일이 없다 */
.barrow {
  display: grid; grid-template-columns: 112px 1fr 72px;
  align-items: center; gap: 12px; padding: 8px 0;
}
.barrow__label { font-size: 12px; color: var(--text-2); min-width: 0; }
.barrow__track { display: block; width: 100%; height: 8px; }
.barrow__bg { fill: var(--surface-2); }
.barrow__fill { fill: var(--text-3); opacity: 0.55; }
.barrow__fill.is-lead { fill: var(--accent); opacity: 1; }
.barrow__value {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-size: 12px; text-align: right; color: var(--text-2);
}
.barrow__value.is-lead { color: var(--text); }

/* ── 로그인 ───────────────────────────────────────────────────────────────── */
body.is-auth .shell { grid-template-columns: minmax(0, 1fr); }
body.is-auth .sidebar, body.is-auth .topbar, body.is-auth .scrim { display: none; }
body.is-auth .main { display: block; }
body.is-auth .view { padding: 0; max-width: none; }
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(127, 166, 255, 0.10), transparent 70%), var(--bg);
}
.auth__panel {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px;
}
.auth__brand { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.auth__mark { width: 28px; height: 28px; color: var(--accent); }
.auth__logo { display: block; height: 30px; width: auto; }
.auth__name { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; }
.auth__tag {
  font-size: 11px; color: var(--text-3); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 6px;
}
.auth__title { margin: 0 0 8px; font-size: 20px; line-height: 28px; font-weight: 600; color: var(--text); }
.auth__sub { margin: 0 0 24px; font-size: 13px; line-height: 20px; color: var(--text-3); }
.auth__form { display: flex; flex-direction: column; gap: 16px; }
.auth__field { display: flex; flex-direction: column; gap: 8px; }
.auth__field label { font-size: 12px; color: var(--text-3); }
.auth__field input {
  height: 44px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 14px;
}
.auth__field input:focus { outline: none; border-color: var(--accent); }
.auth__submit {
  height: 44px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.auth__submit:disabled { opacity: 0.6; cursor: progress; }
.auth__submit:hover { background: var(--accent-strong); }
.auth__error {
  font-size: 12px; line-height: 18px; color: var(--neg);
  border: 1px solid rgba(232, 106, 110, 0.32); border-radius: 8px; padding: 8px 12px;
}
.auth__foot { margin-top: 24px; font-size: 12px; line-height: 18px; color: var(--text-3); }
.auth__foot b { color: var(--text-2); font-weight: 500; }
.auth__hint { font-size: 12px; line-height: 18px; color: var(--text-3); margin-top: 8px; }
.auth__demo {
  margin-top: 16px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 8px;
  font-size: 12px; line-height: 18px; color: var(--text-3);
}
.auth__demo code { color: var(--text-2); font-family: var(--font-num); }

/* ── 상단 계정 영역 ───────────────────────────────────────────────────────── */
.whoami { display: flex; align-items: center; gap: 8px; }
.whoami__meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 16px; }
.whoami__name { font-size: 12px; color: var(--text); }
.whoami__role { font-size: 11px; color: var(--text-3); }
.tenant-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 11px; color: var(--text-2);
  background: var(--surface-2);
}

/* ── 조직도 ───────────────────────────────────────────────────────────────── */
.org { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.org__group { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.org__grouphead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.org__groupname { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); }
.org__count { font-family: var(--font-num); font-size: 11px; color: var(--text-3); }
.org__team { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.org__team:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.org__teamhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.org__teamname { font-size: 12px; color: var(--text-2); }
.org__head {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--warn);
}
.member { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member__avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600;
}
.member__body { min-width: 0; flex: 1; }
.member__name { margin: 0; font-size: 13px; color: var(--text); }
.member__meta { margin: 0; font-size: 11px; color: var(--text-3); }
.member__role {
  font-size: 11px; color: var(--text-2); border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px;
}
.org__empty { font-size: 12px; color: var(--text-3); padding: 8px 0; }

/* ── 전자결재 ─────────────────────────────────────────────────────────────── */
.appr-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.appr-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.appr-kpi__label { margin: 0 0 8px; font-size: 12px; color: var(--text-3); }
.appr-kpi__value { margin: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 24px; line-height: 32px; color: var(--text); }
.appr-kpi__unit { font-family: var(--font-ui); font-size: 12px; color: var(--text-3); margin-left: 4px; }

.appr-list { display: flex; flex-direction: column; }
.appr-item {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left;
  background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%;
  font: inherit; color: inherit;
}
.appr-item:hover { background: var(--surface-2); }
.appr-item.is-active { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.appr-item__no { font-family: var(--font-num); font-size: 11px; color: var(--text-3); }
.appr-item__title { margin: 0; font-size: 13px; color: var(--text); }
.appr-item__meta { margin: 4px 0 0; font-size: 11px; color: var(--text-3); }
.appr-item__right { text-align: right; }
.appr-item__amount { display: block; font-family: var(--font-num); font-size: 12px; color: var(--text-2); }

/* 결재선 */
.line { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
.line__step { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: start; padding: 8px 0; }
.line__idx {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-size: 11px; font-family: var(--font-num);
}
.line__step.is-done .line__idx { background: rgba(76, 195, 138, 0.16); color: var(--pos); }
.line__step.is-now .line__idx { background: var(--accent-soft); color: var(--accent); }
.line__step.is-reject .line__idx { background: rgba(232, 106, 110, 0.16); color: var(--neg); }
.line__name { margin: 0; font-size: 13px; color: var(--text); }
.line__meta { margin: 4px 0 0; font-size: 11px; color: var(--text-3); }
.line__decision { font-size: 11px; color: var(--text-2); }
.doc-body {
  white-space: pre-wrap; font-size: 13px; line-height: 22px; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0;
}
.hashline { font-family: var(--font-num); font-size: 11px; color: var(--text-3); word-break: break-all; }

/* ── 관리자(계정·부서) ─────────────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.role-tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 4px;
  font-size: 11px; border: 1px solid var(--line); color: var(--text-2);
}
.role-tag--owner { border-color: rgba(224, 161, 91, 0.4); color: var(--warn); }
.role-tag--admin { border-color: rgba(127, 166, 255, 0.4); color: var(--accent); }
.secret-box {
  border: 1px dashed var(--line-strong); border-radius: 8px; padding: 12px;
  font-family: var(--font-num); font-size: 14px; color: var(--text);
  letter-spacing: 0.06em; background: var(--bg); word-break: break-all;
}

/* ── 업데이트 배너 · 설치 안내 ─────────────────────────────────────────────── */
.updatebar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40;
  display: none; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  padding: 8px 8px 8px 16px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.updatebar.is-open { display: flex; }
.updatebar__text { font-size: 12px; color: var(--text); }
.updatebar__ver { font-family: var(--font-num); font-size: 11px; color: var(--text-3); }

.toast.is-out { opacity: 0; transform: translateY(8px); }

/* ── 반응형 (1440 · 1280 · 390 · 375) ─────────────────────────────────────── */
@media (max-width: 1180px) {
  .org { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .org { grid-template-columns: minmax(0, 1fr); }
  .appr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .whoami__meta { display: none; }
}
@media (max-width: 560px) {
  .auth { padding: 16px; }
  .auth__panel { padding: 24px; border-radius: 12px; }
  .appr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .appr-item { grid-template-columns: 1fr auto; }
  .appr-item__no { display: none; }
  .barrow { grid-template-columns: 88px 1fr 64px; }
  .updatebar { left: 16px; right: 16px; transform: none; max-width: none; border-radius: 12px; }
}

/* ── EDU 화면 보조 클래스 ─────────────────────────────────────────────────── */
.member__grade { font-size: 11px; }
.row__right--ui { font-family: var(--font-ui); font-size: 12px; }
.row--tight { padding: 8px 0; }
.statstrip--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; display: grid; }
.card--pad16 { padding: 16px; }
.kpi__label--dot { display: flex; align-items: center; gap: 8px; }
.kpi__value--lg { font-size: 24px; }
.select--date { width: 160px; }
.dot--present { background: var(--att-present); }
.dot--late { background: var(--att-late); }
.dot--absent { background: var(--att-absent); }
.dot--makeup { background: var(--att-makeup); }
.stage { cursor: pointer; text-align: left; }
.stage.is-active { border-color: var(--line-strong); }

/* 아이콘 크기 보정 — 상단 계정 영역과 새 컴포넌트의 SVG 는 고정 크기 */
.tenant-chip { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.tenant-chip svg { width: 14px; height: 14px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; }
.whoami { white-space: nowrap; }
.topbar__actions { flex-wrap: nowrap; }
.appr-kpi__value .kpi__unit { font-family: var(--font-ui); }
.org__count, .appr-item__no, .aging__label { white-space: nowrap; }
@media (max-width: 720px) { .tenant-chip { display: none; } }

/* 상단 계정 영역이 좁아져도 칩·이름이 겹치지 않게 */
.topbar__actions { flex: none; }
.tenant-chip { flex: none; }
.whoami { flex: none; }
.topbar__crumbs { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 버튼으로 쓰는 구성원 행 — UA 기본 스타일 제거(색·정렬이 상속되도록) */
.member--btn {
  width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line);
  font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 8px 0;
}
.member--btn:last-child { border-bottom: 0; }
.member--btn:hover { background: var(--surface-2); }
.member--btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.member--btn .member__name { color: var(--text); }
.member--btn .member__meta { color: var(--text-3); }
.member--btn .member__role { color: var(--text-2); }

/* ── 프로필 표시 — 기본은 단색 사람 실루엣, 어드민 허용 시에만 사진 ───────── */
.avatar {
  display: inline-grid; place-items: center; overflow: hidden; padding: 0;
  color: var(--text-3);
}
.avatar svg.avatar__icon { width: 16px; height: 16px; flex: none; }
.avatar__img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: inherit; background: var(--surface-2);
}
.avatar--xs { width: 24px; height: 24px; }
.avatar--xs svg.avatar__icon { width: 14px; height: 14px; }
.avatar--lg { width: 72px; height: 72px; }
.avatar--lg svg.avatar__icon { width: 36px; height: 36px; }

.account {
  width: 100%; background: none; border: 0; font: inherit; color: inherit;
  text-align: left; cursor: pointer;
}
.account:hover { background: var(--surface-2); }
.account:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account__meta { display: block; min-width: 0; }

.whoami__avatar {
  display: inline-flex; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 999px;
}
.whoami__avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 내 프로필 드로어 ─────────────────────────────────────────────────────── */
.profile-strip {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.profile-strip__meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.profile-strip__meta b { font-size: 15px; line-height: 20px; font-weight: 600; }
.profile-strip__meta small { font-size: 12px; line-height: 16px; color: var(--text-3); }

.policy-note {
  display: flex; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); font-size: 12px; line-height: 18px; color: var(--text-3);
}
.policy-note b { font-size: 12px; color: var(--text); }
.policy-note p { margin: 4px 0 0; }
.policy-note__badge {
  width: 24px; height: 24px; flex: none; display: grid; place-items: center;
  border-radius: 6px; background: var(--surface-3); color: var(--text-3);
}
.policy-note__badge svg { width: 14px; height: 14px; }
.policy-note.is-on { border-color: rgba(76, 195, 138, 0.28); }
.policy-note.is-on .policy-note__badge { color: var(--pos); }

.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-hint { margin: 0; font-size: 12px; line-height: 18px; color: var(--text-3); }

/* ── 어드민 정책 카드 · 스위치 ────────────────────────────────────────────── */
.policy-card .card__head { margin-bottom: 12px; }
.policy-card__hint { margin: 8px 0 0; font-size: 12px; line-height: 18px; color: var(--text-3); }
.policy-card__hint b { color: var(--text-2); }

.switch {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 8px 0; cursor: pointer; font-size: 13px; color: var(--text);
}
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch__track {
  width: 40px; height: 20px; flex: none; display: inline-flex; align-items: center;
  padding: 2px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface-3);
  transition: background 160ms ease, border-color 160ms ease;
}
.switch__knob {
  width: 14px; height: 14px; border-radius: 50%; background: var(--text-3);
  transition: transform 160ms ease, background 160ms ease;
}
.switch input:checked + .switch__track {
  background: var(--accent-soft); border-color: var(--accent-line);
}
.switch input:checked + .switch__track .switch__knob {
  transform: translateX(20px); background: var(--accent);
}
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch__label { font-size: 13px; }

/* ── 표·결재선 안의 아바타 ────────────────────────────────────────────────── */
.cell-user { display: flex; align-items: center; gap: 8px; }
.cell-user__text { display: block; min-width: 0; }
.line__who { display: inline-flex; align-items: center; gap: 8px; }
.appr-item { grid-template-columns: 96px 24px minmax(0, 1fr) auto; }
.appr-item__who { display: flex; }

@media (max-width: 560px) {
  .appr-item { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .appr-item__no { display: none; }
  .profile-strip { gap: 12px; padding: 12px; }
}
