:root {
  color-scheme: light;
  --org-ink: #18212f;
  --org-muted: #687385;
  --org-line: #dce3eb;
  --org-soft: #f3f6f9;
  --org-blue: #1769e0;
  --org-blue-dark: #0c4fb4;
  --org-mint: #dff6ef;
  --org-orange: #fff0dc;
  --org-danger: #c63737;
  --org-shadow: 0 14px 36px rgb(28 43 62 / 10%);
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

body.org-editor-page {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  color: var(--org-ink);
  background: #edf2f6;
}

button, input, select { font: inherit; }
button, a, label[for] { -webkit-tap-highlight-color: transparent; }

.org-editor { min-height: 100vh; display: flex; flex-direction: column; }
.org-editor__header {
  min-height: 82px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #fff;
  border-bottom: 1px solid var(--org-line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.org-editor__title-group, .org-editor__toolbar { display: flex; align-items: center; gap: 10px; }
.org-editor__title-group p, .org-inspector__head p, .org-dialog__head p, .org-canvas__heading p {
  margin: 0 0 3px;
  color: var(--org-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}
.org-editor__title-group h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.org-editor__date { margin-left: 6px; padding: 6px 10px; border-radius: 999px; background: var(--org-soft); color: var(--org-muted); font-size: 12px; font-weight: 700; }
.org-editor__back, .org-icon-button {
  width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--org-line); border-radius: 12px; background: #fff; color: var(--org-ink); text-decoration: none; cursor: pointer;
}
.org-editor__back svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.org-button {
  min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-weight: 750; color: var(--org-ink); background: #fff;
}
.org-button--primary { background: var(--org-blue); color: #fff; box-shadow: 0 6px 14px rgb(23 105 224 / 20%); }
.org-button--primary:hover { background: var(--org-blue-dark); }
.org-button--secondary { border-color: var(--org-line); }
.org-button--secondary:hover { border-color: #aab8c9; background: var(--org-soft); }
.org-button--small { min-height: 32px; padding: 6px 10px; display: inline-flex; align-items: center; }
.org-button:focus-visible, .org-icon-button:focus-visible, .org-editor__back:focus-visible, input:focus-visible, select:focus-visible, .org-member-card:focus-visible, .org-unit__title:focus-visible { outline: 3px solid rgb(23 105 224 / 28%); outline-offset: 2px; }

.org-editor__notice { margin: 12px 24px 0; padding: 11px 14px; border-radius: 10px; color: #15513d; background: #e5f7f0; border: 1px solid #b9e6d6; font-size: 14px; font-weight: 650; }
.org-editor__notice[data-type="error"] { color: #7d2020; background: #fff0f0; border-color: #f0bebe; }
.org-editor__notice[data-type="warning"] { color: #79500c; background: #fff7e7; border-color: #efd49c; }

.org-editor__workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(760px, 1fr) 370px; gap: 14px; padding: 14px; }
.org-canvas, .org-inspector { background: #fff; border: 1px solid var(--org-line); border-radius: 18px; box-shadow: var(--org-shadow); }
.org-canvas { min-width: 0; padding: 18px; overflow: auto; }
.org-canvas__heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.org-canvas__heading h2, .org-inspector h2, .org-dialog h2 { margin: 0; font-size: 20px; }
.org-canvas__heading > p { max-width: 430px; text-align: right; font-weight: 500; line-height: 1.5; }

.org-chart-editor { min-width: 900px; position: relative; padding: 8px 4px 24px; }
.org-chart-editor[aria-busy="true"]::before { content: "조직 정보를 불러오는 중입니다…"; display: block; padding: 80px; text-align: center; color: var(--org-muted); }
.org-chart-root { position: relative; }
.org-root-head { position: relative; margin-bottom: 38px; }
.org-root-head::after { content: ""; width: 1px; height: 39px; position: absolute; bottom: -39px; left: 50%; background: #aeb9c7; }
.org-root-card { width: 240px; margin: 0 auto 12px; padding: 15px 18px; border-radius: 14px; color: #fff; background: linear-gradient(145deg, #1c2837, #33455b); text-align: center; box-shadow: 0 12px 24px rgb(24 33 47 / 18%); }
.org-root-card button { color: inherit; background: transparent; border: 0; font: inherit; font-weight: 800; cursor: pointer; }
.org-root-members { display: flex; justify-content: center; gap: 8px; }
.org-root-members .org-member-wrap { width: 168px; }
.org-direct-grid { display: grid; grid-template-columns: repeat(5, minmax(156px, 1fr)); gap: 12px; align-items: start; position: relative; }
.org-direct-grid::before { content: ""; position: absolute; top: -20px; left: 9%; right: 9%; height: 1px; background: #aeb9c7; }
.org-unit { min-width: 0; padding-top: 0; position: relative; }
.org-unit--direct::before { content: ""; position: absolute; left: 50%; top: -20px; width: 1px; height: 20px; background: #aeb9c7; }
.org-unit__surface { border: 1px solid #d5dde7; border-radius: 14px; background: #fbfcfd; overflow: hidden; }
.org-unit__title { width: 100%; min-height: 48px; padding: 10px 12px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-bottom: 1px solid #d5dde7; color: #213146; background: #edf3fa; cursor: pointer; font-weight: 850; line-height: 1.25; text-align: center; }
.org-unit__title small { color: var(--org-muted); font-weight: 650; }
.org-unit__members { min-height: 74px; padding: 9px; display: flex; flex-direction: column; gap: 7px; }
.org-member-card { width: 100%; min-width: 0; padding: 8px; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 8px; border: 1px solid #e0e6ed; border-radius: 11px; background: #fff; color: var(--org-ink); cursor: pointer; text-align: left; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.org-member-card:hover { border-color: #99b9e5; box-shadow: 0 6px 14px rgb(31 69 115 / 11%); transform: translateY(-1px); }
.org-member-card[aria-current="true"], .org-unit__title[aria-current="true"] { border-color: var(--org-blue); box-shadow: 0 0 0 3px rgb(23 105 224 / 12%); }
.org-member-card[draggable="true"] { cursor: grab; }
.org-member-card.is-dragging { opacity: .45; }
.org-member-wrap { min-width: 0; }
.org-member-card__photo { width: 38px; height: 38px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; color: #45607d; background: #e9eff6; font-size: 12px; font-weight: 850; }
.org-member-card__photo img { width: 100%; height: 100%; object-fit: cover; }
.org-member-card__text { min-width: 0; }
.org-member-card__text strong, .org-member-card__text span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-member-card__text strong { font-size: 13px; }
.org-member-card__text span { margin-top: 2px; color: var(--org-muted); font-size: 11px; }
.org-order-controls { max-height: 0; display: flex; gap: 4px; margin-top: 0; overflow: hidden; opacity: 0; visibility: hidden; transition: max-height .15s ease, opacity .15s ease, margin .15s ease; }
.org-member-card[aria-current="true"] + .org-order-controls,
.org-member-wrap:hover > .org-order-controls,
.org-member-wrap:focus-within > .org-order-controls,
.org-unit:hover > .org-order-controls,
.org-unit:focus-within > .org-order-controls {
  max-height: 28px;
  margin-top: 5px;
  opacity: 1;
  visibility: visible;
}
.org-order-controls button { min-height: 24px; flex: 1; border: 1px solid var(--org-line); border-radius: 7px; background: #fff; color: var(--org-muted); cursor: pointer; font-size: 11px; }
.org-child-list { margin: 9px 7px 8px; padding-left: 7px; border-left: 2px solid #dce5ef; display: flex; flex-direction: column; gap: 8px; }
.org-child-list .org-unit__surface { background: #fff; }
.org-child-list .org-unit__title { min-height: 38px; background: var(--org-soft); font-size: 12px; }
.org-separated { margin-top: 28px; padding-top: 18px; border-top: 1px dashed #bbc7d4; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.org-separated__group { padding: 12px; border-radius: 12px; background: #f5f7fa; }
.org-separated__group h3 { margin: 0 0 8px; font-size: 13px; }
.org-separated__members { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.org-empty { padding: 16px 8px; color: #8993a1; font-size: 12px; text-align: center; }

.org-inspector { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; }
.org-inspector__empty { min-height: 440px; padding: 38px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--org-muted); text-align: center; }
.org-inspector__empty-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 50%; background: var(--org-soft); font-size: 25px; }
.org-inspector__empty p { max-width: 260px; line-height: 1.55; }
.org-form { padding: 20px; }
.org-inspector__head, .org-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.org-icon-button { width: 34px; height: 34px; font-size: 23px; line-height: 1; }
.org-photo-editor { padding: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 13px; border-radius: 12px; background: var(--org-soft); }
.org-photo-editor__preview { width: 72px; height: 72px; flex: 0 0 72px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; color: var(--org-muted); background: #dce5ef; font-weight: 800; }
.org-photo-editor__preview img { width: 100%; height: 100%; object-fit: cover; }
.org-photo-editor p, .org-form__hint { margin: 7px 0 0; color: var(--org-muted); font-size: 11px; line-height: 1.45; }
.org-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 10px; }
.org-form__wide { grid-column: 1 / -1; }
.org-form label > span { display: block; margin-bottom: 6px; color: #445064; font-size: 12px; font-weight: 750; }
.org-form input:not([type="file"]), .org-form select { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #cfd8e3; border-radius: 9px; color: var(--org-ink); background: #fff; }
.org-form input:disabled, .org-form select:disabled { color: #8590a0; background: #f1f3f5; }
.org-assignment-history { margin-top: 16px; }
.org-assignment-history h3 { margin: 0 0 8px; font-size: 12px; }
.org-assignment-history ul { margin: 0; padding: 0; list-style: none; }
.org-assignment-history li { padding: 7px 0; border-top: 1px solid #edf0f4; color: var(--org-muted); font-size: 11px; }
.org-form__actions { margin-top: 22px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.org-link-button { padding: 6px 0; border: 0; color: var(--org-blue-dark); background: transparent; cursor: pointer; font-weight: 750; }
.org-link-button--danger { color: var(--org-danger); margin-right: auto; }

.org-dialog { width: min(680px, calc(100vw - 40px)); max-height: 76vh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 24px 80px rgb(12 25 40 / 28%); }
.org-dialog::backdrop { background: rgb(16 27 40 / 46%); }
.org-dialog__head { padding: 18px 20px; margin: 0; border-bottom: 1px solid var(--org-line); }
.org-dialog__body { padding: 14px 20px 20px; overflow: auto; }
.org-dialog-row { padding: 11px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #edf0f4; }
.org-dialog-row strong, .org-dialog-row span { display: block; }
.org-dialog-row span { margin-top: 3px; color: var(--org-muted); font-size: 12px; }
.org-dialog-restore { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 170px auto; align-items: end; gap: 10px; }
.org-dialog-restore label > span { display: block; margin: 0 0 5px; color: #445064; font-size: 12px; font-weight: 750; }
.org-dialog-restore select, .org-dialog-restore input { width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid #cfd8e3; border-radius: 9px; color: var(--org-ink); background: #fff; }
.org-dialog-restore__actions { display: flex; gap: 6px; }
.org-finding { padding: 10px 11px; margin-bottom: 7px; border-radius: 9px; background: var(--org-soft); font-size: 13px; }
.org-finding[data-severity="error"] { color: #7d2020; background: #fff0f0; }
.org-finding[data-severity="warning"] { color: #79500c; background: #fff7e7; }

@media (max-width: 1350px) {
  .org-editor__workspace { grid-template-columns: minmax(720px, 1fr) 340px; }
  .org-editor__toolbar { flex-wrap: wrap; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
