:root {
  /* 채용/인재 SaaS 느낌: 밝은 캔버스 + 블루 포인트 + 블랙 탭 */
  --bg: #f0f2f5;
  --bg-gradient-mid: #fafbfc;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --muted: #6b7280;
  --text: #111827;
  --text-soft: #4b5563;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-contrast: #ffffff;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-contrast: #ffffff;
  --ink: #18181b;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --input-bg: #ffffff;
  --input-border: #e5e7eb;
  --surface-muted: #f3f4f6;
  --table-border: #f3f4f6;
  --table-hover: #f9fafb;
  --table-active: #eff6ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --font-xs: 12px;
  --font-sm: 13px;
  --font-md: 14px;
  --font-lg: 17px;
}

html {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-gradient-mid) 32%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: var(--font-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 18px 28px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  background: var(--panel);
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-sm);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tab-btn:hover {
  background: var(--panel-soft);
  border-color: var(--border-strong);
  color: var(--text);
}

.tab-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.icon {
  opacity: 0.95;
  font-size: var(--font-sm);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  opacity: 0.95;
}

.login-input {
  width: 120px;
  padding: 8px 10px;
  border-radius: 8px;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.app-subtitle {
  font-size: var(--font-xs);
  letter-spacing: 0.02em;
}

.health {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--font-sm);
  background: var(--panel-soft);
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.gender-group {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.gender-btn {
  padding: 8px 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: var(--font-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--font-sm);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover {
  background: #27272a;
}

.btn.accent {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 1px 2px rgba(234, 88, 12, 0.25);
}

.btn.accent:hover {
  background: var(--accent-hover);
}

.btn.ghost {
  background: var(--panel);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.crud-head strong,
.img-box-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn.ghost:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

/* ghost보다 뒤에 두어 선택된 성별 필터가 확실히 보이게 */
.btn.ghost.gender-btn.active {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e3a8a;
  border: 1px solid #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
  font-weight: 700;
}

.btn.ghost.gender-btn.active:hover {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #2563eb;
  color: #1e3a8a;
}

.btn.ghost.gender-btn#genderFemaleBtn.active {
  background: linear-gradient(180deg, #fef2f2 0%, #fecdd3 100%);
  color: #9f1239;
  border-color: #fb7185;
  box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.22);
  font-weight: 700;
}

.btn.ghost.gender-btn#genderFemaleBtn.active:hover {
  background: linear-gradient(180deg, #fecdd3 0%, #fda4af 100%);
  border-color: #f43f5e;
  color: #881337;
}

.btn.danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn.danger:hover {
  background: #fee2e2;
}

.btn.info {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn.info:hover {
  background: var(--primary-hover);
}

.btn.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.btn.success:hover {
  background: #d1fae5;
}

.btn.warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.btn.warning:hover {
  background: #fef3c7;
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 16px;
  max-height: calc(100vh - 250px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 560px;
  box-shadow: var(--shadow-card);
}

.list-panel {
  padding: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 250px);
  overflow: hidden;
}

.grid-panel {
  padding: 12px;
}

.crud-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
  font-size: var(--font-sm);
}

.panel-title {
  padding: 4px 2px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.panel-title strong {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--table-border);
  padding: 8px;
  text-align: left;
  font-size: var(--font-sm);
}

.data-table th {
  font-weight: 600;
  font-size: var(--font-xs);
  text-transform: none;
  letter-spacing: 0.02em;
  background: var(--surface-muted);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--table-hover);
}

.data-table tbody tr.active {
  background: var(--table-active);
  box-shadow: inset 3px 0 0 0 var(--primary);
}

.staff-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 8px 2px;
}

.staff-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.staff-item:hover {
  border-color: #d1d5db;
  box-shadow: var(--shadow-md);
}

/* 업체 좌측 목록 선택 (블루 톤 유지) */
#companyList .staff-item.active {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(37, 99, 235, 0.12);
}

/* 스탭 좌측 목록 선택: 붉은색 계열 (라운드는 .staff-item 과 동일) */
#staffList .staff-item.active {
  border-color: #f87171;
  background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(220, 38, 38, 0.14);
}

.staff-item-main {
  line-height: 1.35;
}

.staff-item-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.staff-item-meta {
  font-size: var(--font-xs);
  font-weight: 500;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

.staff-item .sub {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: var(--font-sm);
}

.detail-panel {
  padding: 16px;
  max-height: calc(100vh - 250px);
  overflow: auto;
}

.empty {
  color: var(--muted);
  padding: 20px 8px;
}

.detail.hidden {
  display: none;
}

.detail {
  display: grid;
  gap: 8px;
}

.inline-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  align-items: center;
}

.dual-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.inline-row.compact {
  grid-template-columns: 64px 1fr;
}

.inline-row label {
  color: var(--muted);
  font-size: var(--font-sm);
}

.section-label {
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-top: 4px;
}

.account-info {
  margin-top: 2px;
}

.account-wrap {
  display: grid;
  grid-template-columns: minmax(140px, 190px) 1fr;
  gap: 8px;
}

.detail h2 {
  margin: 0;
}

.meta {
  color: var(--muted);
  margin-bottom: 6px;
}

.projects {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  min-height: 48px;
  padding: 10px;
  color: var(--text-soft);
  background: var(--surface-muted);
}

.staff-note {
  font-size: var(--font-sm);
  line-height: 1.45;
}

.staff-projects {
  font-size: var(--font-sm);
  line-height: 1.45;
}

.actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.edit-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
}

.edit-grid label {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-soft);
}

.project-schedule-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.project-schedule-fields input[type="date"] {
  flex: 1 1 140px;
  min-width: 0;
  max-width: 100%;
}

.schedule-sep {
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

.line-sep {
  border-top: 1px solid var(--border);
  margin-top: 2px;
  margin-bottom: 2px;
}

.upload-form {
  display: grid;
  grid-template-columns: 110px minmax(220px, 520px);
  gap: 10px;
  align-items: center;
}

.upload-limit-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--font-sm);
  line-height: 1.45;
}

.company-toolbar {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.project-toolbar {
  grid-template-columns: 1fr auto auto auto;
}

.project-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.project-layout.drawer-open {
  grid-template-columns: minmax(520px, 1fr) minmax(380px, 440px);
}

.project-drawer {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.company-list-panel {
  min-width: 0;
}

.company-list-panel #companyList {
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
}

.company-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.company-list-head-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.company-sort-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.company-sort-select {
  min-width: 140px;
}

.project-list-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.project-list-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 10px;
}

.project-table-wrap {
  flex: 0 1 auto;
  max-height: min(42vh, 320px);
  min-height: 0;
}

.project-participants-wrap {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.project-participants-head {
  margin-bottom: 0;
}

.project-participants-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 4px 6px 2px;
}

.project-participant-row {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  font-size: var(--font-sm);
  line-height: 1.4;
}

.project-participant-row .pp-name {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.project-participant-row .pp-social {
  font-size: var(--font-xs);
  color: var(--muted);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.project-participant-row .pp-contact {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: var(--font-sm);
}

#companyDetailWrap {
  max-height: calc(100vh - 250px);
  overflow: auto;
  min-width: 0;
  overflow-x: hidden;
}

/* 업체 상세: 행 단위 반응형 */
.company-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.company-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  align-items: start;
}

.company-form-row.one {
  grid-template-columns: 1fr;
}

.company-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.company-field label {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-soft);
}

.company-field input,
.company-field select,
.company-field textarea {
  width: 100%;
  min-width: 0;
}

.company-form-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.company-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

#companyDetailWrap .company-form-images .img-box {
  min-width: 0;
}

#companyDetailWrap .img-box-title {
  white-space: normal;
  word-break: keep-all;
}

@media (max-width: 1400px) {
  .project-layout.drawer-open {
    grid-template-columns: 1fr;
  }
}

.pager-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pager-left,
.pager-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pager-select {
  width: 86px;
  padding: 6px 8px;
}

.pager-input {
  width: 90px;
  padding: 7px 8px;
}

.entity-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  margin-bottom: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.span-2 {
  grid-column: 1 / span 2;
}

.org-body {
  display: grid;
  gap: 10px;
}

.starfield-title {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  font-weight: 600;
  color: var(--ink);
}

.crud-head strong {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.project-drawer .crud-head strong,
#companyDetailWrap .company-detail-head strong {
  font-size: var(--font-sm);
  font-weight: 700;
}

.project-drawer .crud-head .muted,
#companyDetailWrap .company-detail-head .muted {
  font-size: var(--font-sm);
}

.starfield-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  padding: 6px 8px;
  margin-bottom: 12px;
}

#starTable td:last-child,
#starTable th:last-child {
  min-width: 120px;
  max-width: 280px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.img-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
}

.img-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.img-modal-content {
  position: relative;
  z-index: 1;
  width: min(92vw, 1200px);
  max-height: 92vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

.img-modal-content img {
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-muted);
}

.img-modal-content iframe.img-modal-pdf {
  width: 100%;
  height: min(80vh, 720px);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-muted);
}

/* 스탭 신분증·통장 확대: 기본 대비 약 30% 작게 */
.img-modal--compact .img-modal-content {
  width: min(64.4vw, 840px);
  max-height: 64vh;
}

.img-modal--compact .img-modal-content img {
  max-height: 56vh;
}

.img-modal--compact .img-modal-content iframe.img-modal-pdf {
  height: min(56vh, 620px);
}

.company-doc-preview {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--input-bg);
  margin-bottom: 6px;
  cursor: zoom-in;
}

.company-doc-pdf {
  width: 100%;
  height: 140px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--input-bg);
  margin-bottom: 6px;
  cursor: zoom-in;
}

.staff-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.img-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--panel-soft);
}

.img-box-title {
  font-size: var(--font-sm);
  font-weight: 700;
  margin-bottom: 8px;
}

.staff-img-preview {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--input-bg);
  margin-bottom: 6px;
}

.staff-pdf-preview {
  width: 100%;
  height: 220px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--input-bg);
  margin-bottom: 6px;
}

.org-pdf-preview {
  width: 100%;
  max-width: 980px;
  height: min(72vh, 680px);
  min-height: 400px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--input-bg);
}

.img-actions {
  margin-top: 4px;
}

.org-preview {
  width: 100%;
  max-width: 980px;
  min-height: 520px;
  max-height: 680px;
  object-fit: contain;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--input-bg);
}

.hidden {
  display: none !important;
}

/* ---------- 모바일 (스탭정보 업로드 탭·화면은 제외: 탭 숨김 + 나머지 레이아웃 대응) ---------- */
@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .app-shell {
    max-width: 100%;
    padding: 12px max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  h1 {
    font-size: 18px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .topbar-brand {
    flex-wrap: wrap;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .login-input {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    width: auto;
    max-width: none;
  }

  .health {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .tabs {
    gap: 4px;
    margin-bottom: 12px;
  }

  .tab-btn {
    padding: 7px 10px;
    font-size: 12px;
  }

  /* 스탭정보 업로드: 모바일에서 탭·패널 비노출 (PC·태블릿 넓은 화면에서만 사용) */
  .tab-btn[data-tab="upload"],
  #tab-upload {
    display: none !important;
  }

  .toolbar,
  .company-toolbar,
  .project-toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .toolbar > div:empty {
    display: none;
  }

  .toolbar .btn,
  .company-toolbar .btn,
  .project-toolbar .btn {
    width: 100%;
    justify-content: center;
  }

  .gender-group {
    width: 100%;
  }

  .gender-group .gender-btn {
    flex: 1;
    min-width: 0;
  }

  .layout {
    grid-template-columns: 1fr;
    max-height: none;
    gap: 12px;
  }

  .panel {
    min-height: 0;
  }

  .list-panel {
    max-height: min(42vh, 360px);
    min-height: 200px;
  }

  .detail-panel {
    max-height: none;
    padding: 12px;
  }

  .dual-inline {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .inline-row,
  .inline-row.compact {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 4px;
  }

  .inline-row label {
    padding-top: 2px;
  }

  .account-wrap {
    grid-template-columns: 1fr;
  }

  .staff-images {
    grid-template-columns: 1fr;
  }

  .company-form-row.two {
    grid-template-columns: 1fr;
  }

  .company-form-images {
    grid-template-columns: 1fr;
  }

  .edit-grid {
    grid-template-columns: 1fr;
  }

  .edit-grid .span-2 {
    grid-column: 1 / -1;
  }

  #companyDetailWrap {
    max-height: none;
  }

  .company-list-head {
    flex-direction: column;
    align-items: stretch;
  }

  .company-sort-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .company-sort-select {
    flex: 1;
    max-width: 100%;
  }

  .project-table-wrap {
    max-height: min(38vh, 280px);
  }

  .entity-table-wrap,
  .starfield-table-wrap {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  .data-table {
    min-width: 520px;
  }

  .crud-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  .img-modal-content {
    width: min(96vw, 100%);
    max-height: 88vh;
    padding: 8px;
  }

  .img-modal--compact .img-modal-content {
    width: min(96vw, 100%);
  }

  .org-preview {
    min-height: 200px;
    max-height: 55vh;
  }

  .org-pdf-preview {
    min-height: 240px;
    height: min(55vh, 480px);
  }

  .btn {
    touch-action: manipulation;
  }
}

/* 로그인 게이트 · 가입 승인 모달 */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.72), rgba(30, 58, 138, 0.55));
  backdrop-filter: blur(8px);
}

.login-gate.hidden {
  display: none;
}

.login-gate-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--border);
  padding: 24px 22px 22px;
}

.login-gate-brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.login-gate-brand h2 {
  margin: 0 0 6px;
  font-size: var(--font-lg);
}

.login-gate-sub {
  margin: 0;
  font-size: var(--font-sm);
  line-height: 1.45;
}

.login-gate-logo {
  border-radius: 10px;
  flex-shrink: 0;
}

.login-gate-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.gate-tab {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  font-weight: 600;
  font-size: var(--font-sm);
  cursor: pointer;
  color: var(--text-soft);
}

.gate-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.gate-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-panel.hidden {
  display: none;
}

.gate-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-soft);
}

.gate-field .login-input {
  width: 100%;
  font-weight: 400;
}

.gate-submit {
  margin-top: 4px;
  width: 100%;
  justify-content: center;
}

.gate-msg {
  margin: 0;
  min-height: 1.25em;
  font-size: var(--font-sm);
}

.gate-msg.error {
  color: #dc2626;
}

.gate-msg.ok {
  color: #059669;
}

.app-shell.app-shell--locked {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.approval-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.approval-modal.hidden {
  display: none;
}

.approval-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.approval-modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(85vh, 640px);
  overflow: auto;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 18px 18px 20px;
}

.approval-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.approval-modal-head h2 {
  margin: 0;
  font-size: var(--font-lg);
}

.approval-modal-hint {
  margin: 0 0 14px;
  font-size: var(--font-sm);
}

.approval-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.approval-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.approval-row-user {
  font-weight: 700;
  min-width: 120px;
}

.approval-row-meta {
  font-size: var(--font-sm);
  color: var(--muted);
  flex: 1;
}

.approval-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.approval-role-select {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: var(--font-sm);
  background: var(--input-bg);
}
