body {
  overflow-x: hidden;
  overflow-y: auto;
}

.org-canvas {
  padding: 20px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  position: relative;
}

.dept-section {
  width: 100%;
  max-width: 1900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 40px;
  position: relative;
}

.dept-box {
  width: fit-content;
  min-width: 320px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  position: relative;
  z-index: 20;
  margin-bottom: 40px;
}

.dept-header {
  background: var(--color-header);
  color: white;
  padding: 12px;
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  border-radius: var(--radius-md);
}

.dept-header.has-members {
  border-radius: 10px 10px 0 0;
  border-bottom: none;
  margin-bottom: 15px;
}

.node-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  position: relative;
  gap: 12px;
}

.node-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.box {
  width: fit-content;
  min-width: 112px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px;
  box-shadow: var(--shadow-soft);
  position: relative;
  z-index: 10;
  margin-bottom: 40px;
}

.box-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text-soft);
  text-align: center;
  border-bottom: 1px solid var(--color-bg);
  padding-bottom: 4px;
  margin-bottom: 6px;
  word-break: keep-all;
}

.box-level-그룹 {
  min-width: 250px;
}

.box-level-그룹 .box-name {
  background: var(--color-header-soft);
  color: #ffffff;
  padding: 8px;
  border-radius: 6px 6px 0 0;
  margin: -6px -6px 8px -6px;
  border-bottom: none;
}

.box-level-디비전 {
  min-width: 150px;
}

.box-level-디비전 .box-name {
  background: #7b93ab;
  color: #ffffff;
  padding: 8px;
  border-radius: 6px 6px 0 0;
  margin: -6px -6px 8px -6px;
  border-bottom: none;
}

.box-level-팀 {
  width: auto;
  min-width: 120px;
}

.box-team {
  width: auto;
  min-width: 120px;
}

.member-grid {
  display: grid;
  grid-template-rows: repeat(10, auto);
  grid-auto-flow: column;
  gap: 3px;
  column-gap: 8px;
}

.cell-label {
  grid-column: span 1;
  background: var(--color-surface-strong);
  color: var(--color-text-soft);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  padding: 3px;
  border-radius: 4px;
  margin: 2px 0;
  height: fit-content;
}

.spacer-box {
  width: 100px;
  height: 26px;
  visibility: hidden;
}

.member-card {
  width: 100px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  text-align: left;
  border: 1px solid var(--color-bg);
  border-left: 4px solid #94a3b8;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  flex-direction: column;
  position: relative;
}

.member-card.full-width {
  width: 100% !important;
}

.member-card:hover {
  background: var(--color-surface);
  border-color: var(--color-accent);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
  transform: translateY(-2px);
  z-index: 50;
}

.drop-left::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--color-accent);
  border-radius: 4px;
  z-index: 20;
}

.drop-right::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--color-accent);
  border-radius: 4px;
  z-index: 20;
}

.co-삼안 {
  border-left-color: #ffb366 !important;
}

.co-한맥 {
  border-left-color: #ef4444 !important;
}

.co-피티씨 {
  border-left-color: #a855f7 !important;
}

.co-바론 {
  border-left-color: #3b82f6 !important;
}

.m-top {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.m-name {
  font-weight: 900;
  color: #1e293b;
  font-size: 12px;
}

.m-rank {
  color: #94a3b8;
  font-size: 8px;
  font-weight: 500;
  margin-left: auto;
}

.m-role {
  color: #4f46e5;
  font-weight: 800;
  font-size: 8.5px;
  margin-left: 3px;
}

#modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 650px;
  padding: 24px 24px 20px;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 2010;
}

#last-updated {
  z-index: 4000;
}

@media print {
  @page {
    size: A3 landscape;
    margin: 10mm;
  }

  body {
    background: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .top-wrap,
  .search-container,
  .tab-container,
  .stat-section,
  .fab-container,
  .admin-mode-btn,
  #last-updated,
  .admin-mode-btn {
    display: none !important;
  }

  .main-content {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    width: 100% !important;
  }

  .dept-container {
    page-break-inside: avoid;
    margin-bottom: 20px !important;
  }

  .member-card {
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
  }
}

.modal-content.wide {
  max-width: 1200px;
}

.member-photo-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.member-basic-top-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.member-edit-layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.member-edit-left-pane,
.member-edit-right-pane {
  min-width: 0;
}

.member-edit-left-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-edit-profile-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-seat-field {
  flex: 1 1 auto;
  min-height: 0;
}

.member-seat-field-emphasis .seat-preview-card {
  min-height: 100%;
}

.member-detail-top-row {
  width: 100%;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.member-detail-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.member-name-field {
  min-width: 0;
}

.member-inline-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.member-inline-info-grid-edit {
  margin-top: 10px;
}

.member-inline-info-grid-stacked {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 0;
}

.member-name-field-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-inline-info-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.member-inline-info-card label {
  display: block;
  font-size: 10px;
  font-weight: 900;
  color: #64748b;
}

.member-inline-info-card strong {
  display: block;
  font-size: 13px;
  font-weight: 900;
  color: #1e293b;
  word-break: break-word;
}

.member-inline-info-card-full {
  grid-column: 1 / -1;
}

.modal-form-grid {
  align-items: start;
}

.modal-form-grid>.col-span-1,
.modal-form-grid>.col-span-2 {
  min-width: 0;
}

.member-photo-upload-card {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
}

.member-photo-upload-card-compact {
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
}

.member-photo-preview-wrap {
  flex: 0 0 auto;
}

.member-photo-preview {
  width: 84px;
  height: 84px;
  border-radius: 9999px;
  object-fit: cover;
  border: 3px solid #e0e7ff;
  background: #ffffff;
}

.member-photo-upload-controls {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.member-photo-file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 10px;
  background: #4f46e5;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.member-photo-file-label input {
  display: none;
}

.member-photo-file-name {
  font-size: 11px;
  color: #334155;
  word-break: break-all;
}

.seat-preview-card {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  overflow: hidden;
  min-height: 100%;
}

.seat-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 8px;
  align-items: flex-start;
}

.seat-preview-head strong {
  display: block;
  font-size: 13px;
  font-weight: 900;
  color: #1e293b;
}

.seat-preview-head p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #64748b;
  font-weight: 700;
}

.seat-preview-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 9999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
}

.seat-preview-badge-muted {
  background: #e2e8f0;
  color: #64748b;
}

.seat-preview-canvas {
  margin: 0 14px 14px;
  min-height: 220px;
  border-radius: 16px;
  border: 1px dashed #94a3b8;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(224, 231, 255, 0.95)),
    repeating-linear-gradient(0deg,
      rgba(148, 163, 184, 0.12),
      rgba(148, 163, 184, 0.12) 1px,
      transparent 1px,
      transparent 24px),
    repeating-linear-gradient(90deg,
      rgba(148, 163, 184, 0.12),
      rgba(148, 163, 184, 0.12) 1px,
      transparent 1px,
      transparent 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.seat-preview-frame {
  display: block;
  width: 100%;
  height: 300px;
  border: 0;
  background: #fff;
}

.seat-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.member-edit-right-pane .seat-preview-head {
  padding: 18px 20px 12px;
}

.member-edit-right-pane .seat-preview-head strong {
  font-size: 18px;
}

.member-edit-right-pane .seat-preview-head p {
  font-size: 12px;
}

.member-edit-right-pane .seat-preview-badge {
  font-size: 12px;
  padding: 8px 12px;
}

.member-edit-right-pane .seat-preview-canvas {
  min-height: 360px;
}

.member-edit-right-pane .seat-preview-frame,
.member-edit-right-pane .seat-preview-placeholder {
  min-height: 320px;
}


.seat-preview-placeholder-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  font-size: 24px;
}

@media (max-width: 720px) {
  .member-basic-top-row {
    grid-template-columns: 1fr;
  }

  .member-edit-layout {
    grid-template-columns: 1fr;
  }

  .member-detail-top-row,
  .member-inline-info-grid {
    grid-template-columns: 1fr;
  }
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.list-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 800;
  padding: 10px;
  border: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 20;
  text-align: center;
}

.list-table td {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  text-align: center;
  background: white;
  vertical-align: middle;
}

.col-name {
  width: 90px;
}

.col-rank {
  width: 80px;
}

.col-pos {
  width: 80px;
}

.col-unit-sm {
  width: 70px;
}

.col-unit-lg {
  width: 100px;
}

.col-corp {
  width: 110px;
}

.col-action {
  width: 90px;
}

.list-header-row {
  color: #334155;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #f1f5f9;
}

.list-header-row td {
  font-size: 13px;
  text-align: left !important;
  padding: 10px 15px !important;
}

.list-header-row.lvl-0 td {
  background: #1e293b !important;
  color: white !important;
  font-size: 13.5px;
  font-weight: 900;
}

.list-header-row.lvl-1 td {
  background: #3f516a !important;
  color: white !important;
}

.list-header-row.lvl-2 td {
  background: #869fb7 !important;
  color: white !important;
}

.list-header-row.lvl-3 td {
  background: #4f46e5 !important;
  color: white !important;
}

.list-header-row.lvl-4 td {
  background: #e2e8f0 !important;
  color: #475569 !important;
}

.list-header-row:hover {
  filter: brightness(1.1);
}

.collapse-icon {
  margin-right: 8px;
  transition: transform 0.2s;
  display: inline-block;
}

.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

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

.list-table tr:hover td {
  background: #f8fafc;
}

.list-table tr.dragging {
  opacity: 0.5;
  background: #eef2ff;
}

.list-search-target td {
  background: #eff6ff !important;
  border-top: 2px solid #3b82f6;
  border-bottom: 2px solid #3b82f6;
}

.list-action-btn {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit {
  background: #eef2ff;
  color: #4f46e5;
}

.btn-delete {
  background: #fef2f2;
  color: #ef4444;
}

.fab-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 15px;
  z-index: 5000;
}

.fab-main {
  width: 60px;
  height: 60px;
  background: #4f46e5;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.fab-menu {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s;
}

.fab-container.active .fab-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fab-container.active .fab-main {
  transform: rotate(45deg);
  background: #4338ca;
}

.fab-sub {
  width: 50px;
  height: 50px;
  background: white;
  color: #4f46e5;
  border: 2px solid #4f46e5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.fab-sub:hover {
  background: #4f46e5;
  color: white;
  transform: scale(1.1);
}

.fab-sub::after {
  content: attr(data-label);
  position: absolute;
  right: 65px;
  background: #1e293b;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  opacity: 0;
  transition: 0.2s;
  pointer-events: none;
}

.fab-sub:hover::after {
  opacity: 1;
  right: 75px;
}

.clickable-title {
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
}

.clickable-title:hover {
  color: #818cf8 !important;
  text-decoration: underline;
}

.search-section {
  position: fixed;
  top: 14px;
  left: 18px;
  background: var(--color-surface-soft);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-border-soft);
  z-index: 1010;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(8px);
  transition: all 0.3s;
}

.search-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  width: 150px;
}

.search-icon {
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  transform: scale(0.9);
}

.stats-section {
  position: fixed;
  top: 14px;
  right: 18px;
  width: 332px;
  background: var(--color-surface-soft);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-border-soft);
  z-index: 1010;
  backdrop-filter: blur(8px);
  transition: all 0.3s;
}

.stats-title {
  font-size: 11px;
  line-height: 1.1;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  border-radius: 8px;
  overflow: hidden;
  border-style: hidden;
  box-shadow: 0 0 0 1px #e2e8f0;
}

.stats-table th {
  background: #f8fafc;
  color: var(--color-text-muted);
  font-weight: 800;
  padding: 6px 4px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.stats-table td {
  padding: 6px 4px;
  border: 1px solid #e2e8f0;
  text-align: center;
  font-weight: 700;
  color: var(--color-text);
}

.stats-table .row-label {
  background: #f8fafc;
  color: var(--color-text-soft);
  font-weight: 800;
  width: 92px;
}

.stats-company-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stats-company-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.stats-company-dot.co-삼안 {
  background: #ffb366;
}

.stats-company-dot.co-한맥 {
  background: #ef4444;
}

.stats-company-dot.co-피티씨 {
  background: #a855f7;
}

.stats-company-dot.co-바론 {
  background: #3b82f6;
}

.stats-table .total-cell {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 900;
}

.sum-row {
  background: #f1f5f9;
}

.sum-row td {
  font-weight: 900 !important;
  color: var(--color-text) !important;
}

@keyframes target-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    transform: scale(1.05);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    transform: scale(1);
  }
}

.search-target {
  animation: target-pulse 1.5s ease-in-out 2;
  position: relative;
  z-index: 1000 !important;
  border-color: #4f46e5 !important;
}

.admin-mode-btn {
  position: fixed;
  bottom: 37.5px;
  right: 105px;
  z-index: 5001;
  width: 45px;
  height: 45px;
  background: var(--color-surface-soft);
  backdrop-filter: blur(4px);
  border: 1px solid var(--color-border-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-soft);
  transition: all 0.3s;
  cursor: pointer;
}

.admin-mode-btn::after {
  content: attr(data-label);
  position: absolute;
  bottom: 55px;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  pointer-events: none;
}

.admin-mode-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

.admin-mode-btn.is-admin {
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.admin-mode-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.dept-tabs-container {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding: 2px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.dept-tabs-container::-webkit-scrollbar {
  display: none;
}

.dept-tab {
  padding: 5px 11px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.dept-tab:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.dept-tab.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}
