/**
 * TDS Components — 인트라넷 공통 프리미티브
 * 페이지/모달 마이그레이션 시 이 클래스만 사용. 인라인 slate hex 금지.
 */

/* ── Dialog shell (fullscreen .modal 과 분리) ── */
.tds-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 1050);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--tds-space-md, 1rem);
  box-sizing: border-box;
  background: rgba(2, 9, 19, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.tds-dialog-overlay.is-open,
.tds-dialog-overlay[style*="display: flex"],
.tds-dialog-overlay[style*="display:flex"],
.tds-dialog-overlay.active {
  display: flex !important;
}

.tds-dialog {
  position: relative;
  width: min(100%, 40rem);
  max-height: min(90vh, 52rem);
  display: flex;
  flex-direction: column;
  background: var(--tds-bg-surface, #fff);
  border-radius: var(--tds-radius-xl, 1.25rem);
  box-shadow: var(--tds-shadow-elevated, 0 16px 48px rgba(2, 9, 19, 0.12));
  border: none;
  overflow: hidden;
  transform: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.tds-dialog--lg {
  width: min(100%, 56rem);
}

.tds-dialog--xl {
  width: min(100%, 72rem);
  max-height: min(94vh, 64rem);
}

.tds-dialog--contract-edit {
  width: min(100%, 72rem);
  max-height: min(94vh, 64rem);
  height: min(94vh, 64rem);
}

.tds-dialog--contract-edit .tds-dialog__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0.75rem;
}

.contract-edit-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.5rem;
}

.contract-editor-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--tds-grey200, #e5e8eb);
  border-radius: var(--tds-radius-lg, 1rem);
  background: var(--tds-bg-surface, #fff);
  overflow: hidden;
}

.contract-editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: var(--tds-grey50, #f9fafb);
  border-bottom: 1px solid var(--tds-grey200, #e5e8eb);
}

.contract-editor-toolbar__label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--tds-grey900, #191f28);
}

.contract-editor-toolbar__actions {
  display: inline-flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.contract-body-editor {
  flex: 1 1 auto;
  min-height: 18rem;
  max-height: none;
  height: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1.35rem;
  border: none;
  border-radius: 0;
  background: var(--tds-bg-surface, #fff);
  outline: none;
  font-size: 0.9375rem;
  line-height: 1.8;
  color: #374151;
}

.contract-body-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(49, 130, 246, 0.18);
}

.contract-body-editor h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.75rem;
}

.contract-body-editor p,
.contract-body-editor li {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: #374151;
}

.contract-editor-hint {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--tds-grey500, #8b95a1);
}

.tds-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--tds-space-md, 1rem);
  padding: var(--tds-space-lg, 1.25rem) var(--tds-space-xl, 1.5rem);
  border-bottom: 1px solid var(--tds-border-light, #f2f4f6);
  flex: 0 0 auto;
  background: var(--tds-bg-surface, #fff);
}

.tds-dialog__title {
  margin: 0;
  font-size: var(--tds-typo4-size, 1.25rem);
  line-height: var(--tds-typo4-line, 1.8125rem);
  font-weight: 700;
  color: var(--tds-text-primary, #191f28);
  letter-spacing: -0.02em;
}

.tds-dialog__subtitle {
  margin: 0.25rem 0 0;
  font-size: var(--tds-typo7-size, 0.8125rem);
  line-height: var(--tds-typo7-line, 1.21875rem);
  color: var(--tds-text-secondary, #6b7684);
}

.tds-dialog__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: var(--tds-radius-sm, 0.5rem);
  background: var(--tds-grey100, #f2f4f6);
  color: var(--tds-grey700, #4e5968);
  cursor: pointer;
}

.tds-dialog__close:hover {
  background: var(--tds-grey200, #e5e8eb);
}

.tds-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--tds-space-lg, 1.25rem) var(--tds-space-xl, 1.5rem);
  background: var(--tds-bg-surface, #fff);
}

.tds-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--tds-space-sm, 0.5rem);
  padding: var(--tds-space-md, 1rem) var(--tds-space-xl, 1.5rem);
  border-top: 1px solid var(--tds-border-light, #f2f4f6);
  flex: 0 0 auto;
  background: var(--tds-bg-surface, #fff);
}

/* Forms / loose content placed directly in dialog (common-work 등) */
.tds-dialog > form,
.tds-dialog > div:not(.tds-dialog__header):not(.tds-dialog__footer):not(.tds-dialog__body) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .tds-dialog-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .tds-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: var(--tds-radius-xl, 1.25rem) var(--tds-radius-xl, 1.25rem) 0 0;
  }
}

/* ── Legacy modal-overlay → TDS dialog 호환 ── */
body.tds-theme .modal-overlay > .tds-dialog,
body.tds-theme .modal-overlay > .project-mgmt {
  /* project-mgmt / tds-dialog handled by own CSS */
}

/* ── Page primitives ── */
.tds-page {
  background: transparent;
  padding: 0;
}

body.tds-theme .page-content.tds-page,
body.tds-theme .page-content.tds-page--flat {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.tds-page__header {
  margin-bottom: var(--tds-space-xl, 1.5rem);
}

.tds-page__title {
  margin: 0 0 var(--tds-space-xs, 0.25rem);
  font-size: var(--tds-typo2-size, 1.625rem);
  line-height: var(--tds-typo2-line, 2.1875rem);
  font-weight: 700;
  color: var(--tds-text-primary, #191f28);
  letter-spacing: -0.02em;
}

.tds-page__subtitle {
  margin: 0;
  font-size: var(--tds-typo6-size, 0.9375rem);
  line-height: var(--tds-typo6-line, 1.40625rem);
  color: var(--tds-text-secondary, #6b7684);
}

/* ── Filter / action bar (인트라넷 공통 상단 검색바) ── */
body.tds-theme .page-actions,
body.tds-theme .tds-filter-bar,
body.tds-theme .page-actions.tds-filter-bar {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.5rem !important;
  padding: 0.875rem 1rem !important;
  margin: 0 0 1rem !important;
  background: var(--tds-bg-surface, #fff) !important;
  border: none !important;
  border-radius: var(--tds-radius-xl, 1.25rem) !important;
  box-shadow: none !important;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

/* 안쪽에 또 page-actions / 이중 카드 생기지 않게 */
body.tds-theme .page-actions .page-actions,
body.tds-theme .tds-filter-bar .page-actions,
body.tds-theme .page-actions .tds-filter-bar {
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  width: auto !important;
  max-width: none !important;
}

/* 폼: 한 줄 flex (display:contents 는 그대로 통과) */
body.tds-theme .page-actions > form,
body.tds-theme .tds-filter-bar > form,
body.tds-theme .page-actions form.filter-form,
body.tds-theme .page-actions .filter-form,
body.tds-theme .page-actions .vendors-search-form {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.5rem !important;
  flex: 1 1 16rem;
  min-width: 0;
  max-width: none !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.tds-theme .page-actions form.filter-form[style*="display: contents"],
body.tds-theme .page-actions .filter-form[style*="display: contents"],
body.tds-theme .page-actions form.filter-form[style*="display:contents"],
body.tds-theme .page-actions .filter-form[style*="display:contents"] {
  display: contents !important;
}

/* 검색 입력 + 버튼 묶음 */
body.tds-theme .tds-search-row,
body.tds-theme .vendors-search-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0.5rem !important;
  flex: 1 1 16rem;
  min-width: 0;
  width: auto !important;
  max-width: 100%;
}

body.tds-theme .tds-filter-row,
body.tds-theme .vendors-filter-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.5rem !important;
  min-width: 0;
}

/* 컨트롤 높이·형태 통일 */
body.tds-theme .page-actions .form-control,
body.tds-theme .tds-filter-bar .form-control,
body.tds-theme .page-actions input.form-control,
body.tds-theme .page-actions select.form-control,
body.tds-theme .page-actions input[type="text"],
body.tds-theme .page-actions input[type="search"],
body.tds-theme .page-actions input[type="date"],
body.tds-theme .page-actions input[type="month"],
body.tds-theme .page-actions select {
  box-sizing: border-box;
  height: 2.5rem !important;
  min-height: 2.5rem !important;
  margin: 0 !important;
  padding: 0 0.875rem !important;
  border-radius: var(--tds-radius-md, 0.75rem) !important;
  border: 1px solid var(--tds-grey200, #e5e8eb) !important;
  background: var(--tds-bg-surface, #fff) !important;
  color: var(--tds-grey900, #191f28);
  font-size: 0.875rem !important;
  line-height: 1.25 !important;
  box-shadow: none !important;
}

body.tds-theme .page-actions input[type="text"].form-control,
body.tds-theme .page-actions input[type="search"].form-control,
body.tds-theme .page-actions .tds-search-row .form-control,
body.tds-theme .page-actions .vendors-search-input {
  flex: 1 1 12rem !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100%;
}

body.tds-theme .page-actions select.form-control,
body.tds-theme .page-actions .tds-filter-row .form-control,
body.tds-theme .page-actions .vendors-filter-row .form-control {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 7.5rem !important;
  max-width: 12rem;
}

/* 버튼 통일 — primary/secondary 동일 박스 모델 */
body.tds-theme .page-actions .btn,
body.tds-theme .tds-filter-bar .btn,
body.tds-theme .page-actions a.btn,
body.tds-theme .page-actions button.btn {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: 2.5rem !important;
  min-height: 2.5rem !important;
  max-height: 2.5rem !important;
  padding: 0 0.875rem !important;
  margin: 0 !important;
  border-radius: var(--tds-radius-md, 0.75rem) !important;
  border-width: 1px !important;
  border-style: solid !important;
  font-size: 0.875rem !important;
  font-weight: 600;
  line-height: 1 !important;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: none !important;
  vertical-align: middle;
  overflow: hidden;
}

body.tds-theme .page-actions .btn svg,
body.tds-theme .tds-filter-bar .btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

body.tds-theme .page-actions .btn-primary,
body.tds-theme .tds-filter-bar .btn-primary {
  background: var(--tds-blue500, #3182f6) !important;
  border-color: var(--tds-blue500, #3182f6) !important;
  color: #fff !important;
}

body.tds-theme .page-actions .btn-primary:hover,
body.tds-theme .tds-filter-bar .btn-primary:hover {
  background: var(--tds-blue600, #2272eb) !important;
  border-color: var(--tds-blue600, #2272eb) !important;
  color: #fff !important;
}

body.tds-theme .page-actions .btn-secondary,
body.tds-theme .tds-filter-bar .btn-secondary,
body.tds-theme .page-actions .btn-outline,
body.tds-theme .tds-filter-bar .btn-outline {
  background: var(--tds-bg-surface, #fff) !important;
  border-color: var(--tds-grey200, #e5e8eb) !important;
  color: var(--tds-grey900, #191f28) !important;
}

body.tds-theme .page-actions .btn-secondary:hover,
body.tds-theme .tds-filter-bar .btn-secondary:hover,
body.tds-theme .page-actions .btn-outline:hover,
body.tds-theme .tds-filter-bar .btn-outline:hover {
  background: var(--tds-grey100, #f2f4f6) !important;
  border-color: var(--tds-grey300, #d1d6db) !important;
  color: var(--tds-grey900, #191f28) !important;
}

/* 우측 액션 그룹 (필터바 / 패널 헤더 탭) */
body.tds-theme .page-actions .tds-filter-bar__actions,
body.tds-theme .page-actions .tds-filter-bar-buttons,
body.tds-theme .page-actions .vendors-filter-actions,
body.tds-theme .page-actions .tasks-page-actions-group,
body.tds-theme .tds-panel__header .tds-filter-bar__actions {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.375rem !important;
  flex: 0 0 auto !important;
  width: auto !important;
  margin-left: auto !important;
  padding: 0 !important;
  background: transparent !important;
}

/* ── Section card (replaces dashboard-card) ── */
.tds-panel {
  background: var(--tds-bg-surface, #fff);
  border-radius: var(--tds-radius-xl, 1.25rem);
  margin-bottom: var(--tds-space-md, 1rem);
  overflow: hidden;
  border: none;
  box-shadow: none;
}

.tds-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tds-space-md, 1rem);
  padding: var(--tds-space-lg, 1.25rem) var(--tds-space-lg, 1.25rem) var(--tds-space-sm, 0.5rem);
}

.tds-panel__title {
  margin: 0;
  font-size: var(--tds-typo3-size, 1.375rem);
  line-height: var(--tds-typo3-line, 1.9375rem);
  font-weight: 700;
  color: var(--tds-text-primary, #191f28);
  letter-spacing: -0.01em;
}

.tds-panel__subtitle {
  margin: 0.125rem 0 0;
  font-size: var(--tds-typo7-size, 0.8125rem);
  color: var(--tds-text-tertiary, #8b95a1);
}

.tds-panel__body {
  padding: var(--tds-space-sm, 0.5rem) var(--tds-space-lg, 1.25rem) var(--tds-space-lg, 1.25rem);
}

.tds-panel__body--flush {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

/* Detail / meta blocks inside dialogs & panels (no slate hex) */
.tds-detail-block {
  padding: var(--tds-space-md, 1rem);
  background: var(--tds-grey50, #f9fafb);
  border-radius: var(--tds-radius-md, 0.75rem);
  border: 1px solid var(--tds-grey200, #e5e8eb);
}

.tds-detail-label {
  font-weight: 600;
  color: var(--tds-grey600, #6b7684);
  font-size: var(--tds-typo7-size, 0.8125rem);
}

.tds-detail-value {
  color: var(--tds-text-primary, #191f28);
}

.tds-detail-grid {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.75rem;
  align-items: start;
}

.tds-stat-tile {
  border-radius: var(--tds-radius-md, 0.75rem);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--tds-grey200, #e5e8eb);
  background: var(--tds-grey50, #f9fafb);
}

.tds-stat-tile__label {
  font-size: 0.875rem;
  color: var(--tds-grey600, #6b7684);
  margin-bottom: 0.5rem;
}

.tds-stat-tile__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--tds-text-primary, #191f28);
  letter-spacing: -0.02em;
}

/* Legacy dashboard-card → TDS panel look */
body.tds-theme .dashboard-card,
body.tds-theme .dashboard-card-full {
  background: var(--tds-bg-surface, #fff);
  border: none;
  border-radius: var(--tds-radius-xl, 1.25rem);
  box-shadow: none;
  overflow: hidden;
}

body.tds-theme .dashboard-card-header {
  padding: var(--tds-space-lg, 1.25rem) var(--tds-space-lg, 1.25rem) var(--tds-space-sm, 0.5rem);
  border-bottom: none;
  background: transparent;
}

body.tds-theme .dashboard-card-title {
  font-size: var(--tds-typo3-size, 1.375rem);
  line-height: var(--tds-typo3-line, 1.9375rem);
  font-weight: 700;
  color: var(--tds-text-primary, #191f28);
  letter-spacing: -0.01em;
  margin: 0;
}

body.tds-theme .dashboard-card-body {
  padding: var(--tds-space-sm, 0.5rem) var(--tds-space-lg, 1.25rem) var(--tds-space-lg, 1.25rem);
}

/* ── Table in TDS panel ── */
body.tds-theme .tds-panel .table,
body.tds-theme .dashboard-card .table,
body.tds-theme .page-content .table {
  width: 100%;
  border-collapse: collapse;
}

body.tds-theme .table thead th {
  font-size: var(--tds-typo7-size, 0.8125rem);
  font-weight: 600;
  color: var(--tds-text-secondary, #6b7684);
  background: var(--tds-grey50, #f9fafb);
  border-bottom: 1px solid var(--tds-border-light, #f2f4f6);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}

body.tds-theme .table tbody td {
  font-size: var(--tds-typo6-size, 0.9375rem);
  color: var(--tds-text-primary, #191f28);
  border-bottom: 1px solid var(--tds-border-light, #f2f4f6);
  padding: 0.875rem 1rem;
  vertical-align: middle;
}

body.tds-theme .table tbody tr:last-child td {
  border-bottom: none;
}

body.tds-theme .table tbody tr:hover {
  background: var(--tds-grey50, #f9fafb);
}

/* ── Empty state ── */
.tds-empty {
  text-align: center;
  padding: var(--tds-space-2xl, 2rem) var(--tds-space-md, 1rem);
  color: var(--tds-text-tertiary, #8b95a1);
  font-size: var(--tds-typo6-size, 0.9375rem);
}

/* ── Soften main.css mobile inline-style hammers inside TDS surfaces ── */
@media (max-width: 768px) {
  body.tds-theme .tds-dialog-overlay div[style*="display: flex"][style*="gap"] > .btn,
  body.tds-theme .tds-dialog div[style*="display: flex"][style*="gap"] > .btn,
  body.tds-theme #projectManagementModal div[style*="display: flex"][style*="gap"] > .btn,
  body.tds-theme #projectManagementModal .pm-toolbar .btn {
    flex: 0 0 auto !important;
    width: auto !important;
  }

  /* 상단 검색바: 세로 강제 해제 — 입력+검색은 가로 유지 */
  body.tds-theme .page-actions,
  body.tds-theme .tds-filter-bar,
  body.tds-theme .page-actions.tds-filter-bar {
    flex-direction: row !important;
    align-items: stretch !important;
  }

  body.tds-theme .page-actions > *,
  body.tds-theme .tds-filter-bar > * {
    width: auto !important;
  }

  body.tds-theme .page-actions > form,
  body.tds-theme .tds-filter-bar > form,
  body.tds-theme .page-actions form,
  body.tds-theme .page-actions .filter-form,
  body.tds-theme .page-actions .vendors-search-form {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.tds-theme .page-actions form > *,
  body.tds-theme .page-actions .filter-form > * {
    width: auto !important;
    min-width: 0 !important;
  }

  body.tds-theme .page-actions .tds-search-row,
  body.tds-theme .page-actions .vendors-search-row {
    flex: 1 1 100% !important;
    width: 100% !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }

  body.tds-theme .page-actions .tds-search-row > *,
  body.tds-theme .page-actions .vendors-search-row > * {
    width: auto !important;
  }

  body.tds-theme .page-actions input[type="text"].form-control,
  body.tds-theme .page-actions input[type="search"].form-control,
  body.tds-theme .page-actions .vendors-search-input,
  body.tds-theme .page-actions .tds-search-row .form-control {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
  }

  body.tds-theme .page-actions select.form-control {
    flex: 1 1 calc(50% - 0.25rem) !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
  }

  body.tds-theme .page-actions .btn,
  body.tds-theme .tds-filter-bar .btn {
    flex: 0 0 auto !important;
    width: auto !important;
  }

  body.tds-theme .page-actions .tds-filter-bar__actions,
  body.tds-theme .page-actions .tds-filter-bar-buttons,
  body.tds-theme .page-actions .vendors-filter-actions,
  body.tds-theme .page-actions .tasks-page-actions-group {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body.tds-theme .page-actions > div[style*="display: flex"],
  body.tds-theme .page-actions div[style*="display: flex"][style*="gap"] {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: auto !important;
  }

  body.tds-theme .page-actions div[style*="display: flex"][style*="gap"] > .btn,
  body.tds-theme .page-actions div[style*="display: flex"][style*="gap"] > a.btn,
  body.tds-theme .page-actions div[style*="display: flex"][style*="gap"] > button {
    flex: 0 0 auto !important;
    width: auto !important;
  }
}

/* ── Resource cards (client / freelancer customers) ── */
.tds-resource-card {
  background: var(--tds-bg-surface, #fff);
  border-radius: var(--tds-radius-xl, 1.25rem);
  border: 1px solid var(--tds-border-light, #f2f4f6);
  box-shadow: none;
  padding: 1.25rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tds-resource-card:hover {
  background: var(--tds-grey50, #f9fafb);
  transform: none;
  box-shadow: none;
}

body.tds-theme .customer-resource-card {
  background: var(--tds-bg-surface, #fff) !important;
  border-radius: var(--tds-radius-xl, 1.25rem) !important;
  border: 1px solid var(--tds-border-light, #f2f4f6) !important;
  box-shadow: none !important;
  padding: 1.25rem;
  cursor: pointer;
  transform: none !important;
  transition: background 0.15s ease, border-color 0.15s ease;
}

body.tds-theme .customer-resource-card:hover {
  background: var(--tds-grey50, #f9fafb) !important;
  box-shadow: none !important;
  transform: none !important;
}

/* ── Stats cards (settlements / summary) ── */
body.tds-theme .stats-card,
body.tds-theme .settlement-summary .stats-card {
  background: var(--tds-bg-surface, #fff);
  border: none;
  border-radius: var(--tds-radius-xl, 1.25rem);
  box-shadow: none;
}

body.tds-theme .stats-card .stats-card-value,
body.tds-theme .settlement-summary .stats-card .stats-card-value {
  color: var(--tds-text-primary, #191f28);
}

body.tds-theme .stats-card .stats-card-label,
body.tds-theme .settlement-summary .stats-card .stats-card-label {
  color: var(--tds-text-secondary, #6b7684);
}

body.tds-theme .stats-card:hover,
body.tds-theme .settlement-summary .stats-card:hover {
  box-shadow: none;
  transform: none;
}

/* ── Empty state ── */
body.tds-theme .empty-state {
  color: var(--tds-text-tertiary, #8b95a1);
  text-align: center;
  padding: var(--tds-space-2xl, 2rem) var(--tds-space-md, 1rem);
}

/* ── Customer resource modal (tasks / customers) ── */
#customerModal.modal-overlay {
  background: rgba(2, 9, 19, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 1rem;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

#customerModal .tds-dialog--customer {
  width: min(100%, 52rem);
  max-height: min(90vh, 56rem);
}

.cr-vendor {
  margin-bottom: 1.5rem;
}

.cr-vendor__name {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--tds-grey900, #191f28);
  letter-spacing: -0.02em;
}

.cr-vendor__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.125rem;
  background: var(--tds-grey50, #f9fafb);
  border-radius: var(--tds-radius-lg, 1rem);
}

.cr-vendor__label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tds-grey500, #8b95a1);
}

.cr-vendor__value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--tds-grey800, #333d4b);
}

.cr-section {
  margin-bottom: 1.5rem;
}

.cr-section:last-child {
  margin-bottom: 0;
}

.cr-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.cr-section__title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--tds-grey900, #191f28);
}

.cr-section__count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tds-grey500, #8b95a1);
}

.cr-list {
  display: grid;
  gap: 0.75rem;
}

.cr-card {
  background: var(--tds-bg-surface, #fff);
  border: 1px solid var(--tds-grey200, #e5e8eb);
  border-radius: var(--tds-radius-lg, 1rem);
  padding: 1rem 1.125rem;
}

.cr-card__title {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--tds-grey900, #191f28);
}

.cr-card__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--tds-grey700, #4e5968);
  margin-top: 0.35rem;
}

.cr-card__row a {
  color: var(--tds-blue500, #3182f6);
  word-break: break-all;
}

.cr-card__meta {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--tds-grey100, #f2f4f6);
  font-size: 0.75rem;
  color: var(--tds-grey500, #8b95a1);
}

.cr-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--tds-bg-surface, #fff);
  border: 1px solid var(--tds-grey200, #e5e8eb);
  border-radius: var(--tds-radius-lg, 1rem);
}

.cr-file-row__info {
  flex: 1;
  min-width: 0;
}

.cr-file-row__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--tds-grey900, #191f28);
  word-break: break-word;
}

.cr-file-row__desc {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  color: var(--tds-grey600, #6b7684);
}

.cr-file-row__meta {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--tds-grey500, #8b95a1);
}

.cr-file-row__actions {
  flex-shrink: 0;
}

.cr-note__body {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--tds-grey700, #4e5968);
  white-space: pre-wrap;
  word-break: break-word;
}

.cr-group {
  border: 1px solid var(--tds-grey200, #e5e8eb);
  border-radius: var(--tds-radius-lg, 1rem);
  overflow: hidden;
  margin-bottom: 0.75rem;
  background: var(--tds-bg-surface, #fff);
}

.cr-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--tds-grey50, #f9fafb);
  cursor: pointer;
  user-select: none;
}

.cr-group__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--tds-grey900, #191f28);
}

.cr-group__body {
  display: none;
  padding: 0.75rem;
  border-top: 1px solid var(--tds-grey100, #f2f4f6);
}

.cr-group__body.is-open {
  display: grid;
  gap: 0.5rem;
}

.cr-empty {
  text-align: center;
  padding: 1.75rem 1rem;
  color: var(--tds-grey500, #8b95a1);
  font-size: 0.875rem;
  background: var(--tds-grey50, #f9fafb);
  border-radius: var(--tds-radius-lg, 1rem);
}

.cr-websites {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
}

a.tds-link-vendor {
  color: var(--tds-blue500, #3182f6);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
}

a.tds-link-vendor:hover {
  border-bottom-color: var(--tds-blue500, #3182f6);
}

/* ── Table row actions (보기/수정 등 동일 크기) ── */
.tds-table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: nowrap;
}

body.tds-theme .tds-table-actions .tds-action-btn,
body.tds-theme .tds-table-actions a.btn.tds-action-btn,
body.tds-theme .tds-table-actions button.btn.tds-action-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  height: 2rem;
  padding: 0 0.75rem;
  margin: 0;
  border-radius: var(--tds-radius-md, 0.75rem);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: none;
}

body.tds-theme .tds-table-actions a.btn.tds-action-btn.btn-secondary,
body.tds-theme .tds-table-actions button.btn.tds-action-btn.btn-secondary {
  background: var(--tds-bg-surface, #fff);
  border: 1px solid var(--tds-grey200, #e5e8eb);
  color: var(--tds-grey800, #333d4b);
}

body.tds-theme .tds-table-actions a.btn.tds-action-btn.btn-secondary:hover,
body.tds-theme .tds-table-actions button.btn.tds-action-btn.btn-secondary:hover {
  background: var(--tds-grey100, #f2f4f6);
  border-color: var(--tds-grey300, #d1d6db);
  color: var(--tds-grey900, #191f28);
}

body.tds-theme .tds-table-actions a.btn.tds-action-btn.btn-primary,
body.tds-theme .tds-table-actions button.btn.tds-action-btn.btn-primary {
  background: var(--tds-blue500, #3182f6);
  border: 1px solid var(--tds-blue500, #3182f6);
  color: #fff;
}

body.tds-theme .tds-table-actions a.btn.tds-action-btn.btn-primary:hover,
body.tds-theme .tds-table-actions button.btn.tds-action-btn.btn-primary:hover {
  background: var(--tds-blue600, #2272eb);
  border-color: var(--tds-blue600, #2272eb);
  color: #fff;
}

@media (max-width: 768px) {
  #customerModal.modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  #customerModal .tds-dialog--customer {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 1.25rem 1.25rem 0 0;
  }

  .cr-file-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cr-file-row__actions .btn {
    width: 100%;
  }

  .cr-websites {
    grid-template-columns: 1fr;
  }
}
