/* =====================================================================
   WON-UP 웹 클라이언트 스타일 (프로토타입)
   - 외부 CDN / 웹폰트 0. 시스템 폰트 스택만 사용.
   - 톤: 의료기관 블루 (차분 · 고대비 · 가독성 우선).
   ===================================================================== */

:root {
  /* 의료 블루 팔레트 */
  --blue-900: #042c53;
  --blue-800: #0c447c;
  --blue-700: #0b5cad;   /* primary */
  --blue-600: #185fa5;
  --blue-500: #378add;
  --blue-200: #b5d4f4;
  --blue-100: #e6f1fb;
  --blue-050: #f2f8fd;

  --teal-600: #0f6e56;   /* online accent */
  --teal-500: #1d9e75;
  --amber-600: #ba7517;  /* away */
  --red-700:   #a32d2d;  /* urgent / dnd */
  --red-600:   #c0392b;
  --red-050:   #fcebeb;

  --ink-900: #14202b;
  --ink-700: #33424f;
  --ink-500: #5f6c78;
  --ink-400: #8a96a1;

  --surface:  #ffffff;
  --surface-1:#f6f9fc;
  --surface-2:#eef3f8;
  --page-bg:  #e9eef4;

  --border:   #d7e0ea;
  --border-strong: #c2cedb;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 32, 43, 0.06);
  --shadow-md: 0 6px 24px rgba(20, 32, 43, 0.12);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
               "Malgun Gothic", "맑은 고딕", "Noto Sans KR", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--page-bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.is-hidden { display: none !important; }

/* ---------- 버튼 / 폼 공통 ---------- */
.btn {
  font: inherit;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-900);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-1); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 1px; }

.btn-primary {
  background: var(--blue-700);
  border-color: var(--blue-700);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-800); border-color: var(--blue-800); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #fff;
  padding: 7px 10px;
}
.btn-ghost:hover { background: rgba(255,255,255,.14); }

.btn-block { width: 100%; padding: 11px 14px; font-size: 15px; }

.link {
  background: none;
  border: none;
  color: var(--blue-700);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}
.link:hover { color: var(--blue-800); }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--ink-500);
  font-size: 16px;
  line-height: 1;
  width: 30px; height: 30px;
  border-radius: var(--radius);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink-900); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 13px; color: var(--ink-700); font-weight: 500; }
.field > span em { color: var(--red-600); font-style: normal; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

input, textarea, select {
  font: inherit;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 11px;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.6;
}
.badge-muted { background: var(--surface-2); color: var(--ink-500); }

/* ===================== 로그인 화면 ===================== */
.auth-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--blue-100), transparent),
    var(--page-bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 26px 18px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--blue-700);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
}
.auth-brand-text h1 { margin: 0; font-size: 22px; color: var(--blue-800); letter-spacing: .5px; }
.auth-brand-text p { margin: 2px 0 0; font-size: 13px; color: var(--ink-500); }

.auth-form { margin: 0; }
.auth-msg { font-size: 13px; color: var(--red-700); min-height: 18px; margin: 2px 0 10px; }
.auth-msg.ok { color: var(--teal-600); }
.auth-switch { text-align: center; font-size: 13px; color: var(--ink-500); margin: 14px 0 6px; }
.auth-foot {
  text-align: center; font-size: 11px; color: var(--ink-400);
  margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border);
}

/* ===================== 앱 레이아웃 ===================== */
.app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  height: 54px;
  flex: 0 0 auto;
  background: var(--blue-700);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,.18); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.topbar-title { font-weight: 600; font-size: 17px; letter-spacing: .5px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.conn-state { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.9); margin-right: 4px; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber-600); }
.conn-state.is-open .conn-dot { background: #57d9a3; }
.conn-state.is-down .conn-dot { background: var(--red-600); }

.me-chip {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.14);
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
}
.me-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; color: var(--blue-800);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.me-name { font-size: 13px; color: #fff; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ico { font-size: 14px; }

.main { flex: 1 1 auto; display: flex; min-height: 0; }

/* ---------- 좌측 사이드바 ---------- */
.sidebar {
  flex: 0 0 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
}
.sidebar-head h2 { margin: 0; font-size: 14px; color: var(--ink-700); text-transform: uppercase; letter-spacing: .6px; }

.presence-self {
  padding: 6px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.ps-label { display: block; font-size: 11px; color: var(--ink-400); margin-bottom: 6px; }
.ps-toggle { display: flex; gap: 6px; }
.chip-btn {
  flex: 1;
  font: inherit; font-size: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-500);
  padding: 6px 8px;
  border-radius: 999px;
  cursor: pointer;
}
.chip-btn.is-active {
  background: var(--blue-100);
  border-color: var(--blue-200);
  color: var(--blue-800);
  font-weight: 600;
}

.channel-list { list-style: none; margin: 0; padding: 6px 8px; overflow-y: auto; flex: 1 1 auto; }
.channel-empty { color: var(--ink-400); font-size: 13px; padding: 14px 10px; }

.channel-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 2px;
}
.channel-item:hover { background: var(--surface-1); }
.channel-item.is-active { background: var(--blue-100); }
.channel-item.is-active .ch-name { color: var(--blue-800); font-weight: 600; }

.ch-presence { font-size: 14px; line-height: 1; width: 18px; text-align: center; }
.ch-body { flex: 1; min-width: 0; }
.ch-name { font-size: 14px; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-sub { font-size: 11px; color: var(--ink-400); }
.ch-unread {
  background: var(--blue-700); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 우측 채팅 ---------- */
.chat { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; background: var(--surface-1); }

.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; }
.chat-empty-inner { text-align: center; color: var(--ink-400); }
.chat-empty-mark { font-size: 44px; }
.chat-empty-inner h3 { margin: 10px 0 4px; color: var(--ink-700); font-size: 16px; }
.chat-empty-inner p { margin: 0; font-size: 13px; }

.chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 11px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-head-main { display: flex; align-items: center; gap: 10px; }
.chat-head-main h2 { margin: 0; font-size: 16px; color: var(--ink-900); }
.chat-members { font-size: 12px; color: var(--ink-400); }

.message-list { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }

/* 메시지 행 */
.msg {
  display: flex; gap: 10px;
  padding: 4px 0;
  max-width: 100%;
}
.msg-avatar {
  flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); color: var(--blue-800);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-sender { font-weight: 600; font-size: 13px; color: var(--ink-900); }
.msg-time { font-size: 11px; color: var(--ink-400); }
.msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px 12px 12px 12px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--ink-900);
  white-space: pre-wrap;
  word-break: break-word;
  display: inline-block;
  max-width: 100%;
}

/* 본인 메시지 정렬 */
.msg.is-mine { flex-direction: row-reverse; }
.msg.is-mine .msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.msg.is-mine .msg-head { flex-direction: row-reverse; }
.msg.is-mine .msg-bubble {
  background: var(--blue-700);
  border-color: var(--blue-700);
  color: #fff;
  border-radius: 12px 4px 12px 12px;
}
.msg.is-mine .msg-avatar { background: var(--blue-700); color: #fff; }

/* 긴급 메시지 */
.msg.is-urgent .msg-bubble {
  border-color: var(--red-600);
  background: var(--red-050);
  color: var(--red-700);
  border-left: 3px solid var(--red-600);
}
.msg.is-urgent.is-mine .msg-bubble { background: var(--red-600); color: #fff; border-color: var(--red-700); }
.urgent-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  background: var(--red-600); color: #fff;
  padding: 1px 6px; border-radius: 999px; margin-right: 4px;
}

/* ACK 액션 */
.msg-actions { display: flex; gap: 8px; margin-top: 5px; align-items: center; }
.msg.is-mine .msg-actions { justify-content: flex-end; }
.ack-btn {
  font: inherit; font-size: 12px;
  border: 1px solid var(--teal-500);
  background: #fff; color: var(--teal-600);
  padding: 3px 10px; border-radius: 999px; cursor: pointer;
}
.ack-btn:hover { background: var(--teal-500); color: #fff; }
.ack-done { font-size: 12px; color: var(--teal-600); font-weight: 600; }
.esc-link {
  font: inherit; font-size: 12px;
  background: none; border: none; color: var(--blue-700);
  cursor: pointer; text-decoration: underline; padding: 0;
}

/* ---------- 작성 영역 ---------- */
.composer {
  flex: 0 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 14px 12px;
}
.composer-row { display: flex; align-items: flex-end; gap: 10px; }
.urgent-check {
  display: flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none;
  font-size: 13px; color: var(--ink-700);
  padding-bottom: 9px;
  white-space: nowrap;
}
.urgent-check input { width: auto; }
.urgent-label { font-weight: 500; }
.msg-input {
  flex: 1;
  resize: none;
  max-height: 140px;
  min-height: 40px;
  line-height: 1.45;
}
.btn-send { padding: 9px 20px; }
.composer-hint { font-size: 11px; color: var(--ink-400); margin: 6px 2px 0; min-height: 14px; }

/* ===================== 오버레이 (조직/에스컬레이션/새채널) ===================== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(20, 32, 43, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 50;
}
.overlay-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%; max-width: 820px;
  max-height: 86vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.overlay-panel-sm { max-width: 460px; }
.overlay-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.overlay-head h2 { margin: 0; font-size: 16px; color: var(--blue-800); }
.overlay-head-side { display: flex; align-items: center; gap: 6px; }
.overlay-body { padding: 16px 18px; overflow-y: auto; }
.overlay-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* 조직 패널 */
.org-body { display: flex; gap: 18px; }
.org-col { flex: 1; min-width: 0; }
.org-col h3 { margin: 0 0 10px; font-size: 13px; color: var(--ink-700); text-transform: uppercase; letter-spacing: .5px; }
.org-search { margin-bottom: 10px; }
.org-tree { font-size: 13px; }
.org-dept {
  padding: 6px 8px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 8px;
}
.org-dept:hover { background: var(--surface-1); }
.org-dept .dept-name { color: var(--ink-900); }
.org-dept .dept-code { font-size: 11px; color: var(--ink-400); }
.org-dept .dept-type { margin-left: auto; }
.dept-children { margin-left: 16px; border-left: 1px solid var(--border); padding-left: 6px; }

.org-users { display: flex; flex-direction: column; gap: 2px; }
.org-user {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: var(--radius);
}
.org-user:hover { background: var(--surface-1); }
.org-user .u-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); color: var(--blue-800);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex: 0 0 auto;
}
.org-user .u-body { flex: 1; min-width: 0; }
.org-user .u-name { font-size: 13px; color: var(--ink-900); }
.org-user .u-meta { font-size: 11px; color: var(--ink-400); }
.org-user .u-presence { font-size: 14px; }

/* presence 아이콘 도트 (사용자 목록/채널) */
.pres { display: inline-flex; align-items: center; gap: 3px; }
.pres-off { opacity: .4; filter: grayscale(1); }

/* 에스컬레이션 로그 */
.esc-steps { display: flex; flex-direction: column; gap: 10px; }
.esc-step {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
}
.esc-step.is-sent    { border-left-color: var(--amber-600); }
.esc-step.is-acked   { border-left-color: var(--teal-500); }
.esc-step.is-failed  { border-left-color: var(--red-600); }
.esc-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.esc-step-no { font-weight: 700; color: var(--ink-700); font-size: 13px; }
.esc-step-ch { font-size: 12px; color: var(--blue-700); font-weight: 600; }
.esc-step-status { margin-left: auto; font-size: 11px; font-weight: 600; }
.esc-step-time { font-size: 11px; color: var(--ink-400); }
.esc-step-payload { font-size: 12px; color: var(--ink-500); margin-top: 4px; }
.esc-empty { color: var(--ink-400); font-size: 13px; padding: 8px 0; }

/* ===================== 토스트 ===================== */
.toast {
  position: fixed;
  left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink-900); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow-md);
  z-index: 100; max-width: 90vw;
}
.toast.is-urgent { background: var(--red-600); }

/* ===================== 반응형 ===================== */
@media (max-width: 720px) {
  .sidebar { flex-basis: 220px; }
  .topbar-title, .me-name { display: none; }
  .btn-ghost .ico + * { display: none; }
}

/* ===================== PWA 업데이트 배너 ===================== */
.pwa-update {
  position: fixed;
  left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); color: var(--ink-900);
  border: 1px solid var(--border-strong);
  padding: 8px 8px 8px 16px; border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 110; max-width: 92vw;
  font-size: 13px;
}
.pwa-update .pwa-update-btn { padding: 6px 14px; }

/* ===================== PWA standalone(설치형) 데스크톱 UX ===================== */
/* 설치형 창에서는 페이지 스크롤 바운스/주소창이 없으므로 셸을 꽉 채운다. */
@media (display-mode: standalone), (display-mode: window-controls-overlay) {
  html, body { overscroll-behavior: none; }
  /* 데스크톱 standalone 창의 우상단 컨트롤(닫기/최소화) 여백 확보용 안전영역. */
  .topbar { padding-right: max(14px, env(titlebar-area-x, 0px)); }
}

/* Window Controls Overlay: 상단바를 타이틀바로 통합(드래그 가능 영역).
   데스크톱(Electron/Edge/Chrome 설치형)에서 네이티브 타이틀바를 숨기고
   .topbar 를 창 드래그 핸들로 쓴다. 버튼/칩은 no-drag 로 클릭 가능 유지. */
@media (display-mode: window-controls-overlay) {
  .topbar {
    /* env() 로 OS 창 컨트롤 오버레이 영역을 비켜 배치. */
    height: env(titlebar-area-height, 54px);
    padding-left: env(titlebar-area-x, 14px);
    padding-right: 14px;
    -webkit-app-region: drag;
            app-region: drag;
    -webkit-user-select: none; user-select: none;
  }
  /* 상호작용 요소는 드래그에서 제외(클릭/입력 가능하게). */
  .topbar .btn,
  .topbar .icon-btn,
  .topbar .me-chip,
  .topbar .conn-state {
    -webkit-app-region: no-drag;
            app-region: no-drag;
  }
}

/* 데스크톱 넓은 화면: 본문 폭 제한 없이 채널/대화 2단을 안정적으로 펼친다. */
@media (min-width: 1200px) {
  .sidebar { flex-basis: 300px; }
  .message-list { padding-left: 28px; padding-right: 28px; }
}

/* 키보드 포커스 가시성(데스크톱 접근성) — 채널/메시지 액션. */
.channel-item:focus-visible,
.msg-actions button:focus-visible {
  outline: 2px solid var(--blue-500); outline-offset: 2px;
}

/* 모션 최소화 선호 사용자: 버튼 트랜지션 제거. */
@media (prefers-reduced-motion: reduce) {
  .btn, .pwa-update { transition: none !important; }
}

/* ===================== 비밀번호 정책 체크리스트 (회원가입) ===================== */
.pw-policy {
  list-style: none;
  margin: 4px 0 10px;
  padding: 10px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}
.pw-rule {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--ink-500);
  padding: 2px 0;
}
.pw-rule .pw-mark { flex: 0 0 auto; width: 14px; text-align: center; font-weight: 700; color: var(--ink-400); }
.pw-rule.is-ok { color: var(--teal-600); }
.pw-rule.is-ok .pw-mark { color: var(--teal-500); }
.pw-rule.is-bad { color: var(--red-700); }
.pw-rule.is-bad .pw-mark { color: var(--red-600); }
.pw-match { font-size: 12px; min-height: 16px; margin: -4px 0 10px; }
.pw-match.is-ok { color: var(--teal-600); }
.pw-match.is-bad { color: var(--red-700); }

.btn:disabled, .btn[disabled] {
  opacity: .5; cursor: not-allowed; filter: grayscale(.2);
}
.btn:disabled:hover { background: var(--blue-700); }

/* ===================== 헤더 role 배지 ===================== */
.me-role {
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  background: var(--amber-600); color: #fff;
  padding: 1px 6px; border-radius: 999px; margin-left: 2px;
}

/* ===================== 조직 관리 패널 (admin) ===================== */
.overlay-panel-lg { max-width: 1040px; }
.badge-admin { background: var(--amber-600); color: #fff; margin-left: 6px; vertical-align: middle; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); border-color: var(--red-700); }

.oa-tabs {
  flex: 0 0 auto;
  display: flex; gap: 2px;
  padding: 0 14px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.oa-tab {
  font: inherit; font-size: 13px;
  border: none; background: transparent;
  color: var(--ink-500);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.oa-tab:hover { color: var(--ink-900); }
.oa-tab.is-active { color: var(--blue-700); border-bottom-color: var(--blue-700); font-weight: 600; }

.oa-body { padding: 16px 18px; }
.oa-pane { display: none; }
.oa-pane.is-active { display: block; }
.oa-note { font-size: 12px; color: var(--ink-500); margin: 0 0 12px; line-height: 1.5; }
.oa-hint { font-size: 12px; color: var(--ink-400); }
.oa-toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.oa-two { display: flex; gap: 18px; }
.oa-two > * { flex: 1; min-width: 0; }

.oa-edit-block { margin-bottom: 18px; }
.oa-edit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.oa-edit-head h3 { margin: 0; font-size: 13px; color: var(--ink-700); text-transform: uppercase; letter-spacing: .5px; }

.oa-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.oa-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.oa-table th {
  text-align: left; background: var(--surface-2); color: var(--ink-700);
  font-weight: 600; padding: 7px 8px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.oa-table td { padding: 3px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.oa-table tbody tr:last-child td { border-bottom: none; }
.oa-cell { padding: 5px 7px; font-size: 12px; min-width: 80px; }
.oa-check { text-align: center; }
.oa-check input { width: auto; }
.oa-row-del {
  border: none; background: transparent; color: var(--red-600);
  cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: var(--radius);
}
.oa-row-del:hover { background: var(--red-050); }

.oa-csv-col .oa-csv {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5; resize: vertical;
}
.oa-file-btn { display: inline-flex; align-items: center; }
.oa-source { margin-bottom: 0; }
.oa-source > span { font-size: 12px; }

.oa-preview {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin: 6px 0 10px; background: var(--surface-1);
}
.oa-diff-title { font-size: 12px; font-weight: 600; color: var(--ink-700); margin-bottom: 8px; }
.oa-diff-grid { display: flex; gap: 10px; }
.oa-diff-cell {
  flex: 1; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 6px;
}
.oa-diff-num { display: block; font-size: 20px; font-weight: 700; color: var(--blue-700); }
.oa-diff-lbl { display: block; font-size: 11px; color: var(--ink-500); margin-top: 2px; }

.oa-errors { margin-top: 12px; }
.oa-err-title { font-size: 12px; font-weight: 700; color: var(--red-700); margin-bottom: 6px; }
.oa-err-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.oa-err-row {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 12px; padding: 5px 8px;
  background: var(--red-050); border-left: 3px solid var(--red-600);
  border-radius: 4px;
}
.oa-err-loc { font-weight: 700; color: var(--red-700); flex: 0 0 auto; }
.oa-err-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px; color: #fff; background: var(--red-600);
  padding: 0 6px; border-radius: 999px;
}
.oa-err-msg { color: var(--ink-700); }

.oa-promote { max-width: 420px; }
.oa-promote .btn { margin-top: 4px; }

@media (max-width: 720px) {
  .oa-two { flex-direction: column; }
}

/* Android APK 다운로드 (로그인 카드) */
.auth-download { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border, #e5e7eb); }
.btn-download { background: #0b8a3b; color: #fff; border: 1px solid #0b7a34; font-weight: 500; }
.btn-download:hover { background: #0a7a34; }
.auth-download-note { margin: 8px 2px 0; font-size: 12px; line-height: 1.5; color: var(--text-muted, #6b7280); text-align: center; }
.auth-download-note em { font-style: normal; font-weight: 500; color: var(--text-secondary, #374151); }
