/* ==========================================================================
   office-components.css — 새 디자인(클로드 디자인 리디자인) 공통 컴포넌트
   --------------------------------------------------------------------------
   적용 대상: <html data-theme="office"> 인 화면만 (로그인·공통 레이아웃, 이후 화면1·화면2).
   화면3·7은 data-theme 이 없어 영향 없음 — 모든 규칙이 html[data-theme="office"] 안에 있다.
   로드 순서: common.css → tokens.css → office-components.css → 화면별 css
   (사이드바·상단바 같은 공통 레이아웃은 office-layout.css)
   들어 있는 컴포넌트: 본문 글꼴 / 입력(.field) / 체크박스 / 먹색 버튼 / 스피너 /
                      계정 메뉴(.acct-menu) / 모달(.modal) / 토스트(.toast)
   ========================================================================== */

html[data-theme="office"] body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
}
html[data-theme="office"] h1,
html[data-theme="office"] h2,
html[data-theme="office"] h3 { font-family: var(--font-sans); }

/* 키보드 포커스 — 먹색 2px 윤곽 (보드에 별도 지정 없음, 좌석 포커스 링 --ring-focus 의 먹색을 따름) */
html[data-theme="office"] a:focus-visible,
html[data-theme="office"] button:focus-visible,
html[data-theme="office"] [tabindex]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
/* 대화상자·패널이 열릴 때 프로그램이 첫 포커스를 주는 컨테이너(tabindex="-1")는 링을 그리지 않음 — Tab 을 누르면 그때부터 안쪽 버튼에 링이 보임 */
html[data-theme="office"] [tabindex="-1"]:focus-visible { outline: none; }

/* ---------- 입력칸 (.field) ---------- */
html[data-theme="office"] .field { margin-bottom: 0; }
html[data-theme="office"] .field label,
html[data-theme="office"] .field__label {
  display: block; margin-bottom: 7px;
  font: var(--fw-label) var(--fs-label)/var(--lh-base) var(--font-sans); color: var(--text);
}
html[data-theme="office"] .field input,
html[data-theme="office"] .field__input {
  width: 100%; height: var(--h-input); padding: 0 14px;
  border: 1px solid var(--input-line); border-radius: var(--radius-input); background: var(--surface);
  font: 400 var(--fs-input) var(--font-sans); color: var(--ink); box-shadow: none; outline: none;
}
html[data-theme="office"] .field input::placeholder,
html[data-theme="office"] .field__input::placeholder { color: var(--faint); }
html[data-theme="office"] .field input:focus,
html[data-theme="office"] .field__input:focus { border: 1px solid var(--ink); box-shadow: none; }
/* 브라우저 자동완성: 파란 바탕 대신 미색 (2026-10-28 대표님 피드백). 테두리는 건드리지 않아 focus·에러 색 유지 */
html[data-theme="office"] .field__input:-webkit-autofill,
html[data-theme="office"] .field__input:-webkit-autofill:hover,
html[data-theme="office"] .field__input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--input-autofill-bg) inset;
  -webkit-text-fill-color: var(--input-autofill-text);
  caret-color: var(--ink);
  transition: background-color 9999s ease-out 0s;
  animation: onAutoFillStart 1ms; /* JS가 animationstart 로 자동완성 시작을 감지하는 용도 (화면8 로그인) */
}
@keyframes onAutoFillStart { from { opacity: 1; } to { opacity: 1; } }
html[data-theme="office"] .field--error input,
html[data-theme="office"] .field--error .field__input { border: 1px solid var(--error); color: var(--ink); }
html[data-theme="office"] .field__error-msg {
  display: block; margin: 6px 0 0; font: 400 var(--fs-label) var(--font-sans); color: var(--error);
}
html[data-theme="office"] .field__error-msg[hidden] { display: none; }

/* ---------- 체크박스 ---------- */
html[data-theme="office"] .form-checkbox { min-height: 44px; padding: 0; }
html[data-theme="office"] .form-checkbox__input { width: 17px; height: 17px; }
html[data-theme="office"] .form-checkbox__box {
  width: 17px; height: 17px; border-radius: 4px; border: 1px solid var(--input-line); background: var(--surface);
}
html[data-theme="office"] .form-checkbox__box i { font-size: 13px; }
html[data-theme="office"] .form-checkbox:hover .form-checkbox__box { border-color: var(--ink); }
html[data-theme="office"] .form-checkbox__input:checked + .form-checkbox__box { background: var(--ink); border-color: var(--ink); }
html[data-theme="office"] .form-checkbox__input:focus-visible + .form-checkbox__box { box-shadow: none; outline: 2px solid var(--ink); outline-offset: 2px; }
html[data-theme="office"] .form-checkbox__label { margin-left: 9px; font: 400 var(--fs-body-sm) var(--font-sans); color: var(--text); }

/* ---------- 스피너 ---------- */
html[data-theme="office"] .spinner {
  border-color: var(--spin-track); border-top-color: var(--ink); animation-duration: .8s;
}
html[data-theme="office"] .spinner--sm { width: 14px; height: 14px; border-width: 2px; }
html[data-theme="office"] .spinner--on-primary { border-color: var(--spin-on-ink); border-top-color: #fff; }

/* ---------- 먹색 꽉 찬 버튼 (.btn-ink : 로그인 · 모달 저장) ---------- */
html[data-theme="office"] .btn-ink {
  width: 100%; height: var(--h-btn-md); padding: 0; border: 0; border-radius: var(--radius-button);
  background: var(--ink); color: #fff; font: 600 13.5px var(--font-sans); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .13s;
}
html[data-theme="office"] .btn-ink:hover { background: var(--ink-hover); }
html[data-theme="office"] .btn-ink:disabled { background: var(--btn-off-bg); color: var(--btn-off-text); cursor: not-allowed; }
html[data-theme="office"] .btn-ink.btn--loading,
html[data-theme="office"] .btn-ink.btn--loading:disabled { background: var(--ink-busy); color: #fff; cursor: default; }
html[data-theme="office"] .btn-ink .spinner { display: none; }
html[data-theme="office"] .btn-ink.btn--loading .spinner { display: inline-block; }

/* ---------- 계정 메뉴 (상단바 프로필 + 드롭다운) ---------- */
html[data-theme="office"] .acct-menu__trigger {
  width: var(--profile-size); height: var(--profile-size); padding: 0; margin: 0;
  border-radius: 50%; line-height: 0; background: transparent;
}
html[data-theme="office"] .acct-menu__avatar {
  width: var(--profile-size); height: var(--profile-size); background: none; border-radius: 50%;
  display: block; line-height: 0; transition: box-shadow .13s;
}
html[data-theme="office"] .acct-menu__avatar svg { display: block; width: 100%; height: 100%; }
/* 열림: 바탕색 3px + 프로필 링 1px (보드 「열림」) */
html[data-theme="office"] .acct-menu__trigger:hover .acct-menu__avatar,
html[data-theme="office"] .acct-menu.is-open .acct-menu__avatar {
  background: none; box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--profile-ring);
}
html[data-theme="office"] .acct-menu__trigger:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
html[data-theme="office"] .acct-menu__trigger:focus-visible .acct-menu__avatar { box-shadow: none; }

html[data-theme="office"] .acct-menu__panel {
  top: calc(100% + 10px); width: var(--menu-w); padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-dropdown);
  box-shadow: var(--shadow-pop);
}
html[data-theme="office"] .acct-menu__panel::before { display: none; }
html[data-theme="office"] .acct-menu__item {
  height: 42px; padding: 0 12px; gap: 8px; border-radius: 9px;
  font: 500 var(--fs-body-sm) var(--font-sans); color: var(--ink);
}
html[data-theme="office"] .acct-menu__item:hover { background: var(--surface-2); }
html[data-theme="office"] .acct-menu__item:focus-visible { background: var(--surface-2); outline: 2px solid var(--ink); outline-offset: -2px; }
html[data-theme="office"] .acct-menu__sep { height: 1px; margin: 4px 6px; background: var(--line-soft); }
html[data-theme="office"] .acct-menu__item--logout { margin-top: 0; padding-top: 0; border-top: 0; }
html[data-theme="office"] .acct-menu__item .spinner { width: 13px; height: 13px; }
html[data-theme="office"] .acct-menu__item--loading { color: var(--muted); }
html[data-theme="office"] .acct-menu__item:disabled { cursor: default; }

/* ---------- 모달 ---------- */
html[data-theme="office"] .modal-overlay { background: var(--overlay); }
html[data-theme="office"] .modal {
  width: var(--modal-w); max-width: 92%; background: var(--surface);
  border-radius: var(--radius-card); box-shadow: var(--shadow-modal);
}
html[data-theme="office"] .modal__header { padding: 20px 20px 4px 24px; align-items: center; border-bottom: 0; }
html[data-theme="office"] .modal__title {
  font: var(--fw-modal-title) var(--fs-modal-title) var(--font-sans); letter-spacing: var(--ls-modal-title); color: var(--ink);
}
html[data-theme="office"] .modal__close {
  width: 32px; height: 32px; border-radius: 8px; background: transparent; color: var(--text);
}
html[data-theme="office"] .modal__close:hover { background: var(--surface-2); }
html[data-theme="office"] .modal__body { padding: 14px 24px 4px; }
html[data-theme="office"] .modal__form { display: flex; flex-direction: column; gap: 14px; }
html[data-theme="office"] .modal .field label,
html[data-theme="office"] .modal .field__label { font-size: var(--fs-label-sm); margin-bottom: 6px; }
html[data-theme="office"] .modal .field input,
html[data-theme="office"] .modal .field__input { height: var(--h-input-sm); padding: 0 13px; font-size: var(--fs-input-sm); }
html[data-theme="office"] .modal__footer {
  padding: 20px 24px 24px; border-top: 0; background: transparent; border-radius: 0;
  display: block;
}

/* ---------- 토스트 ----------
   위치: 화면 중앙 하단 .toast-region (대표님 2026-10-21 지시 "토스트는 중앙 하단" — 보드의 오른쪽 아래보다 우선).
   여러 개면 새 것이 맨 아래, 오래된 것은 위로 밀려 올라감. 모달 어두운 배경(z-index 120)보다 위(200).
   오류형 role="alert" = 직접 닫을 때까지 유지, 안내·성공형 role="status" = --toast-auto-ms(4000ms) 뒤 자동으로 사라짐
   (JS 는 office-toast.js). */
.toast-region { display: none; }
html[data-theme="office"] .toast-region {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  position: fixed; left: 50%; bottom: var(--toast-offset); transform: translateX(-50%); z-index: 200;
  width: max-content; max-width: calc(100vw - 2 * var(--toast-gutter));
  pointer-events: none;
}
html[data-theme="office"] .toast {
  position: relative; left: auto; right: auto; bottom: auto; pointer-events: auto;
  max-width: min(var(--toast-w-max), calc(100vw - 2 * var(--toast-gutter)));
  width: max-content; min-width: min(var(--toast-w), calc(100vw - 2 * var(--toast-gutter)));
  background: var(--toast); border-radius: var(--radius-toast); box-shadow: var(--shadow-toast);
  padding: 13px 12px 13px 14px; display: flex; align-items: center; gap: 10px; /* 점·문구 묶음·× 세로 가운데 (대표님 2026-10-27) */
}
html[data-theme="office"] .toast__dot {
  width: var(--toast-dot); height: var(--toast-dot); border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font: 700 var(--fs-toast-dot) var(--font-sans);
}
html[data-theme="office"] .toast__dot--ok { background: var(--toast-ok); color: #fff; }
html[data-theme="office"] .toast__dot--err { background: var(--toast-err); color: var(--toast); }
html[data-theme="office"] .toast__dot--info { background: var(--toast-info); color: #fff; }
html[data-theme="office"] .toast__body { flex: 1; min-width: 0; }
html[data-theme="office"] .toast__title {
  display: block; font: var(--fw-toast-title) var(--fs-toast-title)/var(--lh-base) var(--font-sans); color: var(--toast-text);
  word-break: keep-all; overflow-wrap: break-word; /* 한국어는 단어 단위로 줄바꿈 (단어 중간 끊김 방지) */
}
html[data-theme="office"] .toast__desc {
  display: block; margin-top: 2px; font: 400 var(--fs-toast-desc)/1.5 var(--font-sans); color: var(--toast-sub);
  word-break: keep-all; overflow-wrap: break-word;
}
html[data-theme="office"] .toast__close {
  flex: none; width: 28px; height: 28px; padding: 0; border: 0; background: transparent;
  color: var(--toast-x); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
html[data-theme="office"] .toast__close:hover { color: var(--toast-text); }
html[data-theme="office"] .toast__close:focus-visible { outline: 2px solid var(--toast-text); outline-offset: 0; }
html[data-theme="office"] .toast--enter { animation: office-toast-in .25s ease-out; }
@keyframes office-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 선택 상자 .sel (화면3 「담당」 · 화면7 「기간 선택」 공용, 2026-10-28 대표님 A안) ----------
   닫힌 상자 = 입력칸 규격(테두리 --input-line · 모서리 10px · 높이 --sel-h 기본 36px · 오른쪽 화살표).
   펼친 목록 = 크롬 customizable select(appearance: base-select)로 디자인 — 흰 면·--radius-dropdown·--shadow-pop(계정 메뉴와 같은 톤),
   항목 높이 36px, hover/키보드 포커스 = --line-soft 면(윤곽선 없이 면으로만 — 목록이 열릴 때 선택 항목에 처음 포커스가 가므로 굵은 테두리는 쓰지 않음), 선택 항목 = 오른쪽 먹색 체크, 긴 목록 = 320px 넘으면 스크롤.
   base-select 를 모르는 브라우저는 @supports 밖의 기존 네이티브 모양(화살표 배경 SVG)으로 자연스럽게 떨어짐.
   마크업은 평범한 <select class="sel">…<option> 그대로 — JS 가 option 을 채우거나 value 를 바꾸는 방식은 변하지 않음. */
.sel {
  height: var(--sel-h, 36px); border: 1px solid var(--input-line); border-radius: var(--radius-input); background-color: var(--surface);
  padding: 0 32px 0 12px; font: 400 var(--fs-body-sm) var(--font-sans); color: var(--ink); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%2375777D'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
.sel:hover { border-color: var(--faint); }
/* 포커스 링 = 테두리 안쪽 한 겹(2px) — 바깥으로 나가는 outline 은 쓰지 않음(스크롤 영역 경계에 잘리고, base-select 는 마우스 클릭 뒤에도 :focus-visible 이라 이중 링으로 남던 문제). 열린 동안은 1px 먹색 테두리만 */
.sel:focus-visible { outline: 0; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sel:disabled { background-color: var(--surface-2); border-color: var(--line); color: var(--faint); cursor: not-allowed; }

@supports (appearance: base-select) {
  .sel, .sel::picker(select) { appearance: base-select; }
  /* 오른쪽 안쪽 여백 = 테두리 1 + 11 = 12px → ▼ 오른쪽 끝이 상자 오른쪽 끝에서 12px. 폭은 office-sel.js 가 가장 긴 옵션에 맞춰 min-width 로 고정 */
  .sel { background-image: none; display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 11px 0 12px; }
  .sel::picker-icon {
    margin-left: auto; content: ""; width: 10px; height: 6px; flex: none; transition: rotate .15s;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%2375777D'/></svg>") no-repeat center / 10px 6px;
  }
  .sel:open::picker-icon { rotate: 180deg; }
  .sel:open, .sel:open:focus-visible { box-shadow: none; border-color: var(--ink); }
  .sel:disabled::picker-icon { opacity: .5; }

  .sel::picker(select) {
    position-area: block-end span-inline-end; /* 상자 바로 아래, 목록 왼쪽 끝 = 상자 왼쪽 끝 */
    box-sizing: border-box; width: anchor-size(width); min-width: anchor-size(width); max-width: anchor-size(width); /* 펼친 목록 너비 = 닫힌 상자 너비 (대표님 확정 2026-10-28) — 넓어지지도 좁아지지도 않음 */ max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
    margin: 6px 0 0; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-dropdown); box-shadow: var(--shadow-pop);
  }
  .sel::picker(select)::-webkit-scrollbar { width: var(--sb-w); height: var(--sb-w); background: transparent; } /* 공용 스크롤바(office-layout.css 맨 아래)와 같은 모양 — picker 는 * 선택자에 안 잡혀 따로 */
  .sel::picker(select)::-webkit-scrollbar-track { background: transparent; }
  .sel::picker(select)::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  .sel::picker(select)::-webkit-scrollbar-thumb { background: var(--sb-thumb); border: 2px solid transparent; background-clip: padding-box; border-radius: 999px; }
  .sel::picker(select)::-webkit-scrollbar-thumb:hover { background: var(--sb-thumb-hover); background-clip: padding-box; }
  .sel option {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 5px 0 6px; border-radius: 9px; box-sizing: border-box;
    font: 500 var(--fs-body-sm) var(--font-sans); color: var(--ink); cursor: pointer; white-space: nowrap;
  }
  .sel option:hover, .sel option:focus-visible { background: var(--line-soft); outline: 0; }
  .sel option:checked { font-weight: 600; }
  .sel option:disabled { color: var(--faint); cursor: not-allowed; }
  /* 체크 아이콘 = 얇은 선(14px, 굵기 1.75, 둥근 끝) SVG mask — 색은 currentColor(--ink) 를 따름 */
  .sel option::checkmark {
    content: ""; order: 1; margin-left: auto; flex: none; width: 14px; height: 14px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M2.5 7.4l3 3 6-6.4' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat center / 14px 14px;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M2.5 7.4l3 3 6-6.4' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat center / 14px 14px;
  }
}

/* ---------- 기본 모양 방어 (2026-10-28) ----------
   office 화면 어디서든 새 입력 부품이 브라우저 기본 모양으로 나오지 않게 하는 공용 규칙.
   textarea: 크기 조절 손잡이(빗금) 제거 — 길면 안쪽 스크롤(공용 얇은 스크롤바). 높이는 각 화면 클래스가 정함.
   number/search/비밀번호: 위아래 화살표·× 버튼·눈 아이콘 제거(Chrome·Edge). */
html[data-theme="office"] textarea { resize: none; }
html[data-theme="office"] input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
html[data-theme="office"] input[type="number"]::-webkit-inner-spin-button,
html[data-theme="office"] input[type="number"]::-webkit-outer-spin-button,
html[data-theme="office"] input[type="search"]::-webkit-search-cancel-button,
html[data-theme="office"] input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
html[data-theme="office"] input::-ms-reveal,
html[data-theme="office"] input::-ms-clear { display: none; }
