/* Top Navbar Components */
.navbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.navbar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.navbar-mobile-right {
  display: none;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.navbar-mobile-status-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f2f4f6;
  color: #4e5968;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-mobile-status-pill:empty {
  display: none;
}

.navbar-mobile-deadline-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.navbar-mobile-deadline-pill.is-urgent {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}

.navbar-mobile-deadline-pill:empty {
  display: none;
}

.navbar-hamburger-btn {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #e5e8eb;
  background: #ffffff;
  color: #191f28;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.navbar-hamburger-btn:hover {
  background: #f2f4f6;
}

.navbar-hamburger-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3182f6;
  box-shadow: 0 0 0 1.5px #ffffff;
  visibility: hidden;
}

.navbar-hamburger-dot.is-visible {
  visibility: visible;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.navbar-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  flex-shrink: 0;
}

.navbar-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.navbar-tabs::-webkit-scrollbar {
  display: none;
}

.navbar-tab {
  height: 38px;
  padding: 0 14px;
  border: none;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.navbar-tab.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.navbar-aux-btn {
  position: relative;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  gap: 5px;
}

.navbar-aux-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 0 0 1.5px var(--bg-surface);
  visibility: hidden;
}

.navbar-aux-badge.is-visible {
  visibility: visible;
}

.policy-badge {
  max-width: 300px;
  height: 32px;
  line-height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pre-Allocated Fixed-Height Validation Slot (R3 Mandatory) */
.validation-slot {
  height: var(--validation-slot-height);
  min-height: var(--validation-slot-height);
  max-height: var(--validation-slot-height);
  line-height: var(--validation-slot-height);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-danger);
  visibility: hidden;
  margin: 0;
}

.validation-slot.is-visible {
  visibility: visible;
}

/* Fixed-Height KPI Strip & Filter Bar */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  height: var(--kpi-strip-height);
  min-height: var(--kpi-strip-height);
  max-height: var(--kpi-strip-height);
  flex-shrink: 0;
}

.kpi-card {
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: var(--filter-bar-height);
  min-height: var(--filter-bar-height);
  max-height: var(--filter-bar-height);
  flex-shrink: 0;
  padding: 0 var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  min-width: 0;
}

.filter-pill {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-pill.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
}

.card-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}

.card-body {
  padding: 16px;
  min-width: 0;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-default);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--bg-subtle);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

.data-table tbody tr.row-selected {
  background: var(--color-primary-soft);
}

.num-cell {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-status-미응답 {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.badge-status-입력중 {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge-status-제출완료 {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.badge-status-검토중 {
  background: var(--color-purple-soft);
  color: var(--color-purple);
}

.badge-status-신고완료 {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge-netpay {
  background: var(--color-netpay-soft);
  color: var(--color-netpay);
  border: 1px solid #99f6e4;
}

.badge-worker {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.badge-pass {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge-fail {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

/* Form Controls */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  min-width: 0;
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select {
  height: 36px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.form-input:focus,
.form-select:focus {
  outline: 2px solid rgba(29, 78, 216, 0.2);
  border-color: var(--color-primary);
}

.form-input:disabled,
.form-select:disabled {
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Buttons */
.btn {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: var(--text-xs);
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.btn-success {
  background: var(--color-success);
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: #047857;
}

.btn-warning {
  background: var(--color-warning);
  color: #ffffff;
}

.btn-warning:hover:not(:disabled) {
  background: #b45309;
}

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Centered Notification Modal Components (Zero Layout Shift) */
@keyframes toastModalPopIn {
  from {
    transform: scale(0.96);
  }
  to {
    transform: scale(1);
  }
}

.toast-card {
  position: relative;
  width: min(332px, calc(100vw - 40px));
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.26), 0 4px 12px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  animation: toastModalPopIn 0.12s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  margin-bottom: 2px;
  background: var(--color-info-soft);
  color: var(--color-info);
}

.toast-success .toast-icon-badge {
  background: #dcfce7;
  color: #059669;
}

.toast-error .toast-icon-badge {
  background: #fee2e2;
  color: #dc2626;
}

.toast-warning .toast-icon-badge {
  background: #fef3c7;
  color: #d97706;
}

.toast-info .toast-icon-badge {
  background: #dbeafe;
  color: #2563eb;
}

.toast-body {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.toast-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #191f28;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.toast-message {
  font-size: 13.5px;
  color: #4e5968;
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.toast-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
}

.toast-ok-btn {
  min-width: 112px;
  height: 38px;
  padding: 0 24px;
  border: none;
  border-radius: 11px;
  background: #3182f6;
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.toast-ok-btn:hover {
  background: #1b64da;
}

.toast-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-header .modal-close-x {
  position: static;
  width: 32px;
  height: 32px;
  font-size: 20px;
}

/* Fixed-Overlay Modal Components */
[data-testid="modal-dialog"] {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--bg-surface);
  border-radius: 20px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-testid="modal-dialog"].modal-wide {
  width: min(680px, calc(100vw - 32px));
}

[data-testid="modal-dialog"].is-backdrop-nudge {
  transform: scale(1.014);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 20px 24px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.modal-header-titles {
  min-width: 0;
  flex: 1 1 auto;
}

.modal-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #191f28;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #6b7684;
  line-height: 1.45;
}

.modal-close-x {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 50%;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
}

.modal-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Text & Utility Helpers */
.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-danger {
  color: var(--color-danger);
}

.text-success {
  color: var(--color-success);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1240px) {
  .kpi-strip {
    gap: var(--space-3);
  }

  .kpi-card {
    padding: var(--space-3);
  }

  .kpi-value {
    font-size: 15px;
  }

  .filter-bar {
    height: auto;
    min-height: 0;
    max-height: none;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: var(--space-2);
  }

  .filter-pills {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

@media (max-width: 1023px) {
  .navbar-left {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .navbar-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }

  .navbar-tabs.navbar-portal-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    gap: 4px;
  }

  .navbar-tab {
    height: 32px;
    padding: 0 10px;
    font-size: var(--text-xs);
  }

  .navbar-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .policy-badge {
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .kpi-card {
    height: auto;
    min-height: 82px;
  }

  .kpi-value {
    font-size: 18px;
  }

  .card-header {
    flex-wrap: wrap;
  }
}

@media (max-width: 767px) {
  [data-testid="top-navbar"]:has(.navbar-hamburger-btn) {
    padding: 8px 12px 0;
    gap: 6px;
    border-bottom: 1px solid #e5e8eb;
  }

  [data-testid="top-navbar"]:has(.navbar-hamburger-btn) .navbar-left {
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
  }

  [data-testid="top-navbar"]:has(.navbar-hamburger-btn) .navbar-brand-row {
    width: 100%;
    min-height: 36px;
  }

  [data-testid="top-navbar"]:has(.navbar-hamburger-btn) .navbar-mobile-right {
    display: inline-flex;
  }

  [data-testid="top-navbar"]:has(.navbar-hamburger-btn) .navbar-actions {
    display: none;
  }

  [data-testid="top-navbar"]:has(.navbar-hamburger-btn) .navbar-tabs.navbar-portal-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: calc(100% + 24px);
    margin: 0 -12px;
    height: 38px;
    min-height: 38px;
    border-top: 1px solid #f1f5f9;
    gap: 0;
    overflow: hidden;
  }

  [data-testid="top-navbar"]:has(.navbar-hamburger-btn) .navbar-tabs.navbar-portal-tabs .navbar-tab {
    height: 38px;
    padding: 0 4px;
    border-radius: 0;
    font-size: 11.5px;
    font-weight: 700;
    justify-content: center;
    text-align: center;
    border-bottom: 2px solid transparent;
    color: #6b7684;
    background: transparent;
  }

  [data-testid="top-navbar"]:has(.navbar-hamburger-btn) .navbar-tabs.navbar-portal-tabs .navbar-tab.is-active {
    color: #1b64da;
    border-bottom-color: #3182f6;
    background: transparent;
  }

  .kpi-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  [data-testid="modal-dialog"],
  [data-testid="modal-dialog"].modal-wide {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
  }

  .modal-header {
    padding: 15px 16px 11px;
  }

  .modal-title {
    font-size: 17px;
  }

  .modal-body {
    padding: 14px 16px;
  }

  .modal-footer {
    padding: 12px 16px 15px;
    gap: 8px;
  }

  .modal-footer > .btn,
  .modal-footer > button {
    flex: 1 1 0;
  }
}
