/* USV — components.css — 버튼/폼/카드/KPI/테이블/배지/모달/토스트/탭/타임라인/사이드패널/드로어/대시보드/지도/로그인/회원관리 */
/* ===================================================================
   12. 버튼 (.btn + 변형)
   =================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover    { background: var(--bg); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
/* Disabled — WCAG AA UI 3:1 보장 (B-M7, 2026-04-18):
   opacity 만으로 덮던 과거와 달리 명시적 색 토큰 사용 → 다크모드/복잡 배경에서도 최소 3:1 유지 */
.btn:disabled,
.btn[disabled] {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  border-color: var(--disabled-border);
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}
.btn:disabled:hover,
.btn[disabled]:hover { background: var(--disabled-bg); border-color: var(--disabled-border); }
.btn:active:not(:disabled) { transform: scale(.98); }

/* 변형 */
.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

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

.btn-ghost {
  background: transparent;
  color: var(--text-sub);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #DC2626; border-color: #DC2626; }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #059669; border-color: #059669; }

.btn-warn {
  background: var(--warn);
  color: #fff;
  border-color: var(--warn);
}
.btn-warn:hover { background: #D97706; border-color: #D97706; }

.btn-outline-brand {
  background: transparent;
  color: var(--brand);
  border-color: var(--brand);
}
.btn-outline-brand:hover { background: var(--brand-soft); }

/* 크기 */
.btn-sm  { min-height: 40px; padding: 7px 12px; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.btn-lg  { min-height: 48px; padding: 11px 20px; font-size: var(--fs-md); }
.btn-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--bg);
  border-color: var(--border-strong);
}
.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
.icon-btn:disabled,
.icon-btn[disabled] {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  border-color: var(--disabled-border);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-icon--danger {
  color: var(--danger);
}
.btn-icon--danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-panel-close {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  gap: 0;
  font-size: 13px;
  line-height: 1;
}

.color-input-square {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 2px;
  background: var(--surface);
}

/* 페이지 행 액션처럼 반복 사용되는 40px 아이콘 버튼 변형 */
.icon-btn--action {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-sm);
}
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}
.btn-action-edit:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-soft-border);
}
.btn-action-danger,
.btn-icon--danger,
.icon-btn--action.danger {
  color: var(--danger);
}
.btn-action-danger:hover,
.btn-icon--danger:hover,
.icon-btn--action.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}
.actions-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.page-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* 버튼 그룹 */
.btn-group    { display: flex; gap: 6px; }
.btn-row      { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; }
.form-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* 13. Legacy 버튼 alias (btn-cyan, btn-warning) — 제거됨 (TD-7, v2.2) */

/* ===================================================================
   14. 폼 컴포넌트
   =================================================================== */
.form-group { margin-bottom: 14px; }
.form-group.inline { display: flex; align-items: center; gap: var(--sp-2); }
.form-group.inline label { width: 80px; flex-shrink: 0; text-align: right; margin-bottom: 0; }

.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-sub);
  margin-bottom: 6px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }

/* 기존 .form-group label 호환 */
.form-group label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-sub);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: var(--fs-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.form-control:hover   { border-color: var(--border-strong); }
.form-control:focus   { outline: none; border-color: var(--brand); box-shadow: var(--shadow-focus); }
.form-control::placeholder { color: var(--muted); } /* v3.2.3-297 a11y: 대비 상향 */
.form-control:disabled,
.form-control[disabled] {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  border-color: var(--disabled-border);
  cursor: not-allowed;
  opacity: 1;
}

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

textarea.form-control {
  min-height: 96px;
  resize: vertical;
}

.form-hint  { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.form-error { font-size: var(--fs-xs); color: var(--danger); margin-top: 4px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

/* 체크박스 / 라디오 */
input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
}
input[type="checkbox"] { border-radius: var(--radius-xs); }
input[type="radio"]    { border-radius: 50%; }
input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: var(--brand);
  border-color: var(--brand);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translate(-50%, -58%) rotate(-45deg);
  transform-origin: center;
}
input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}

/* 토글 스위치 */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #D1D5DB;
  border-radius: var(--radius-full);
  transition: background var(--dur-base);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base);
}
.toggle-switch input:checked + .toggle-slider { background: var(--brand); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* 15. Legacy 폼 alias (form-input, form-select, form-textarea) — 제거됨 (TD-7, v2.2) */

/* ===================================================================
   16. 카드 (.card)
   =================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--dur-base), transform var(--dur-base);
}
.card--elevated { box-shadow: var(--shadow-card); }
.card.hoverable:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  cursor: default;
  transition: background var(--dur-fast);
}
.card-header:hover { background: var(--surface-hover); }
.card-header h3, .card-header h4 {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--text);
}
.card-header .card-title-text {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-header .card-actions { display: flex; gap: 6px; }

.card-body {
  padding: 16px 20px;
  background: var(--surface);
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.card.compact .card-body { padding: 12px 16px; }

/* 콜랩서블 카드 */
.card.collapsible .card-header { cursor: pointer; }
.card.collapsible:not(.open) .card-body { display: none; }
.card.open .card-body { display: block; }

/* ===================================================================
   17. KPI 카드 (.kpi-grid, .kpi-card)
   =================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi-grid--compact { gap: 10px; }
.kpi-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  transition: box-shadow var(--dur-base), transform var(--dur-base);
}
.kpi-card--panel {
  padding: 15px 18px;
  box-shadow: var(--shadow-card);
}
.kpi-card--static { cursor: default; }
.kpi-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.kpi-card--static:hover {
  box-shadow: var(--shadow-card);
  transform: none;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: var(--fw-medium);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
}

.kpi-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: 1;
  color: var(--text);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.kpi-sub { font-size: var(--fs-sm); color: var(--muted); }

.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: 2px 6px;
  border-radius: 20px;
  margin-right: 4px;
}

.kpi-up   { background: var(--success-soft); color: var(--success-text); }
.kpi-down { background: var(--danger-soft);  color: var(--danger-text); }

/* 색상 변형 */
.kpi-card.warn    .kpi-icon { background: var(--warn-soft);    color: var(--warn-text); }
.kpi-card.danger  .kpi-icon { background: var(--danger-soft);  color: var(--danger-text); }
.kpi-card.success .kpi-icon { background: var(--success-soft); color: var(--success-text); }
.kpi-card.accent  .kpi-icon { background: var(--accent-soft);  color: var(--accent); }

/* ===================================================================
   18. 테이블 (.tbl, .table-wrapper)
   =================================================================== */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  overflow-x: auto;
}
.table-wrapper--elevated { box-shadow: var(--shadow-card); }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

.tbl thead th {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  background: var(--surface-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
.tbl thead th.sortable {
  cursor: pointer;
  user-select: none;
}
.tbl thead th.sortable:hover { color: var(--brand); }
.tbl thead th.sortable .sort-icon { opacity: .4; font-size: 10px; margin-left: 4px; }
.tbl thead th.asc  .sort-icon::after  { content: '▲'; opacity: 1; }
.tbl thead th.desc .sort-icon::after { content: '▼'; opacity: 1; }

.tbl tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.tbl tbody tr:last-child td      { border-bottom: none; }
.tbl tbody tr:hover td            { background: var(--surface-hover); }
.tbl.rows-clickable tbody tr:hover td { cursor: pointer; }
.tbl tbody tr.selected td         { background: var(--brand-soft); }
.tbl.zebra tbody tr:nth-child(even) td { background: var(--surface-muted); }
.tbl.striped tbody tr:nth-child(even) td { background: var(--surface-muted); }
.tbl .link-cell { color: var(--brand); font-weight: var(--fw-medium); }
.tbl .link-cell:hover { text-decoration: underline; }
.tbl.compact tbody td { padding: 8px 12px; }
.tbl .actions-cell, .tbl .action-column { white-space: nowrap; }

/* 19. Legacy .data-table — 제거됨 (TD-7, v2.2) */

/* ===================================================================
   20. 배지 (.badge)
   =================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.5;
}

/* dot 배지 */
.badge.with-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 2px;
}

/* solid 변형 */
.badge.solid.blue  { background: var(--brand);   color: #fff; }
.badge.solid.green { background: var(--success); color: #fff; }
.badge.solid.red   { background: var(--danger);  color: #fff; }

/* 색상 변형 */
/* v3.2.3-297: 하드코딩 색 → 토큰화 (다크모드 대응, purple 판독불가 해소) */
.badge-blue,   .badge-info    { background: var(--info-soft);    color: var(--info-text); }
.badge-green,  .badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-yellow, .badge-warning, .badge-orange { background: var(--warn-soft); color: var(--warn-text); }
.badge-red,    .badge-danger  { background: var(--danger-soft);  color: var(--danger-text); }
.badge-gray,   .badge-secondary { background: var(--neutral-soft); color: var(--neutral-text); }
.badge-purple  { background: var(--accent-soft); color: var(--accent-text); }
.badge-teal,   .badge-cyan    { background: var(--teal-soft);    color: var(--teal-text); }

/* 21. Legacy .badge-count — 제거됨 (TD-7, v2.2) */

/* ===================================================================
   22. 상태 인디케이터
   =================================================================== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.green  { background: var(--success); box-shadow: 0 0 4px rgba(16,185,129,.4); }
.status-dot.red    { background: var(--danger);  box-shadow: 0 0 4px rgba(239,68,68,.4); }
.status-dot.yellow { background: var(--warn);    box-shadow: 0 0 4px rgba(245,158,11,.4); }
.status-dot.blue   { background: var(--brand);   box-shadow: 0 0 4px rgba(37,99,235,.4); }
.status-dot.gray   { background: var(--muted-light); }
.status-dot.purple { background: var(--accent);  box-shadow: 0 0 4px rgba(139,92,246,.4); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.status-badge.online  { background: var(--success-soft); color: var(--success-text); border: 1px solid #BBF7D0; }
.status-badge.offline { background: var(--danger-soft);  color: var(--danger-text);  border: 1px solid #FECACA; }
.status-badge.error   { background: var(--danger-soft);  color: var(--danger-text); }
.status-badge.warn    { background: var(--warn-soft);    color: var(--warn-text); }
.status-badge.info    { background: var(--info-soft);    color: var(--info-text); }
.status-badge.success { background: var(--success-soft); color: var(--success-text); }
.status-badge.system  { background: var(--accent-soft);  color: #5B21B6; }

/* ===================================================================
   23. 모달 (.modal-overlay, .modal)
   =================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }

/* B-M8: width: min(Npx, 90vw) 일원화 — 어떤 뷰포트에서도 폭이 자동 축소됨 */
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: min(480px, 90vw);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  animation: modalIn var(--dur-base) var(--ease);
}
.modal.sm  { width: min(360px, 90vw); }
.modal.lg  { width: min(640px, 90vw); }
.modal.xl  { width: min(800px, 90vw); }
.modal.xxl { width: min(960px, 95vw); }

.modal-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text); }

.modal-close {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body   { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  flex-shrink: 0;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ===================================================================
   24. Toast 알림
   =================================================================== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-popover);
  font-size: var(--fs-base);
  color: var(--text);
  animation: toastIn var(--dur-slow) var(--ease);
}
.toast .toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warn    { border-left: 3px solid var(--warn); }
.toast.warn    .toast-icon { color: var(--warn); }
.toast.info    { border-left: 3px solid var(--brand); }
.toast.info    .toast-icon { color: var(--brand); }

/* v3.2.3-109: 토스트 메시지 span — 남은 공간을 채워 닫기 버튼을 오른쪽으로 밀어냄 */
.toast > span { flex: 1 1 auto; min-width: 0; word-break: break-word; }

/* v3.2.3-109: 닫기(✕) 버튼 — 오른쪽 정렬 (margin-left:auto) + 버튼 기본 스타일 제거 */
.toast .toast-dismiss {
  margin-left: auto;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.toast .toast-dismiss:hover { background: var(--surface-hover); color: var(--text); }

@keyframes toastIn  { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ===================================================================
   25. 페이지네이션
   =================================================================== */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
}

.page-btn {
  min-width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text-sub);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
  font-family: inherit;
}
.page-btn:hover  { background: var(--bg); border-color: var(--border-strong); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: var(--fw-semibold); }
.page-btn:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  border-color: var(--disabled-border);
  cursor: not-allowed;
  opacity: 1;
}

.page-info { font-size: var(--fs-sm); color: var(--muted); margin-left: 12px; }

/* ===================================================================
   26. 탭 바 (.tab-bar, .tab-btn, .tab-pane)
   =================================================================== */
.tab-bar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tab-btn {
  padding: 7px 14px;
  border-radius: 7px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--muted);
  transition: color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
  font-family: inherit;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-sub); }
.tab-btn.active {
  background: var(--surface);
  color: var(--brand);
  font-weight: var(--fw-semibold);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.tab-pane        { display: none; }
.tab-pane.active { display: block; }

/* 언더라인 변형 */
.tab-bar.underline {
  padding: 0;
  border: none;
  background: transparent;
  border-bottom: 1px solid var(--border);
  gap: 0;
  border-radius: 0;
}
.tab-bar.underline .tab-btn {
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
}
.tab-bar.underline .tab-btn.active {
  background: transparent;
  border-bottom-color: var(--brand);
  box-shadow: none;
}

/* ===================================================================
   27. Legacy 탭 alias — .tab-bar .tab (기존 마크업 호환)
   =================================================================== */
.tab-bar .tab {
  padding: 9px 16px;
  font-size: var(--fs-base);
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  font-weight: var(--fw-medium);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.tab-bar .tab:hover { color: var(--brand); }
.tab-bar .tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: var(--fw-semibold);
}

/* ===================================================================
   28. 타임라인 (.timeline)
   =================================================================== */
.timeline {
  position: relative;
  padding-left: 32px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
}

.timeline-marker {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--brand);
  z-index: 1;
}
.timeline-item.major .timeline-marker { background: var(--brand); }

.timeline-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.version-badge {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-soft-border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  padding: 2px 8px;
  margin-bottom: var(--sp-1);
}

.release-date {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

.release-notes {
  font-size: var(--fs-base);
  color: var(--text-sub);
  line-height: var(--lh-base);
}
.release-notes li { margin-left: 18px; margin-bottom: 4px; }

/* ===================================================================
   29. 프로그레스 바
   =================================================================== */
.prog-bar {
  height: 6px;
  background: var(--surface-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--brand);
  transition: width var(--dur-slow) var(--ease);
}
.prog-fill.green  { background: var(--success); }
.prog-fill.warn   { background: var(--warn); }
.prog-fill.danger { background: var(--danger); }

/* ===================================================================
   30. 설정 페이지 (.settings-nav, .settings-card)
   =================================================================== */
.settings-nav {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: var(--sp-6);
  padding-right: var(--sp-4);
}

.settings-nav a {
  display: block;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  color: var(--text-sub);
  text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast);
  margin-bottom: 2px;
}
.settings-nav a:hover  { background: var(--bg); color: var(--text); }
.settings-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: var(--fw-semibold); }

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.setting-row:last-child { border-bottom: none; }

.setting-label { flex: 1; }
.setting-title { font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--text); }
.setting-desc  { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }

/* ===================================================================
   31. 사이드패널 (split 레이아웃)
   =================================================================== */
.sidepanel {
  width: 420px;
  min-width: 420px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidepanel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: var(--sp-3);
}

.sidepanel-filter {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidepanel-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3);
}

/* 지도 섹션 */
.map-section {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--surface-muted);
  overflow: hidden;
}

/* ===================================================================
   32. 드로어 (.drawer)
   =================================================================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.3);
  z-index: calc(var(--z-modal-backdrop) - 1);
  display: none;
}
.drawer-overlay.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 90vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  z-index: var(--z-modal);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-header h3 { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text); }

.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ===================================================================
   33. 그리팅 (.greeting)
   =================================================================== */
.greeting { margin-bottom: var(--sp-6); }
.greeting h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--text);
  line-height: var(--lh-2xl);
  margin-bottom: 6px;
}
.greeting p {
  font-size: var(--fs-base);
  color: var(--muted);
}

/* ===================================================================
   34. 대시보드 그리드 (.dash-grid, .dash-card)
   =================================================================== */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr .7fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dash-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dash-card-header h3 { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text); }

.dash-card-body { padding: 16px 20px; }

/* ===================================================================
   35. 바로가기 그리드 (.shortcut-grid, .shortcut-card)
   =================================================================== */
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
}

.shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-sub);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
  text-align: center;
}
.shortcut-card:hover {
  background: var(--brand-soft);
  border-color: var(--brand-soft-border);
  color: var(--brand);
}

/* ===================================================================
   36. Legacy .panel-section, .panel-section-title (boat-control에서 사용)
   — .right-panel / .panel-scroll 은 제거됨 (TD-7, v2.2)
   =================================================================== */
.panel-section {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.panel-section-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--brand);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.panel-section-title .badge {
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: var(--fw-medium);
}

/* ===================================================================
   37. 지도 오버레이 헬퍼
   =================================================================== */
.map-area {
  flex: 1;
  position: relative;
  background: var(--surface-muted);
  overflow: hidden;
}

.map-overlay {
  position: absolute;
  z-index: var(--z-map-overlay);
}

.map-topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: var(--z-map-overlay);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-card);
}

.map-overlay-panel {
  position: absolute;
  top: 80px;
  right: 16px;
  width: 420px;
  max-height: calc(100vh - 120px);
  z-index: var(--z-map-overlay);
  overflow-y: auto;
}

.map-kpi-strip {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: var(--z-map-overlay);
  display: flex;
  gap: var(--sp-2);
}
.map-kpi-strip .kpi-card {
  padding: 12px 16px;
  min-width: 100px;
}
.map-kpi-strip .kpi-value { font-size: var(--fs-xl); }

/* ===================================================================
   38. 지도 범례 (.map-legend) — Notion 스타일 업데이트
   =================================================================== */
.map-legend {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: var(--fs-xs);
  z-index: var(--z-map-overlay);
  box-shadow: var(--shadow-card);
}
.map-legend .legend-title {
  font-weight: var(--fw-semibold);
  margin-bottom: 5px;
  color: var(--text);
  font-size: var(--fs-sm);
}
.map-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  color: var(--text-sub);
}

/* 39. Legacy .boat-marker — 제거됨 (TD-7, v2.2) */

/* ===================================================================
   40. Leaflet 오버라이드 (내부 요소는 절대 건드리지 않음)
   =================================================================== */
.leaflet-container { width: 100%; height: 100%; }
.map-area .leaflet-container { z-index: 1; }

/* 팝업 래퍼만 살짝 다듬음 */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-popover) !important;
}

/* ===================================================================
   41. 로그인 페이지 (.login-page-body) — 라이트 테마로 재작성
   =================================================================== */
.login-page-body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  flex-direction: column;
}

/* 배경 장식 — 은은한 그라디언트 */
.login-page-body::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.07), transparent 70%);
  pointer-events: none;
}
.login-page-body::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.05), transparent 70%);
  pointer-events: none;
}

/* wave-bg — 기존 클래스 있으면 숨김 처리 */
.login-page-body .wave-bg { display: none; }

.login-box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px 36px;
  width: 400px;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.login-box .login-icon { font-size: 48px; margin-bottom: 8px; }

.login-box h1 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: 4px;
}

.login-box .subtitle {
  font-size: var(--fs-base);
  color: var(--muted);
  margin-bottom: 28px;
}

.login-box .form-group {
  text-align: left;
  margin-bottom: 14px;
}

.login-box .form-group label {
  color: var(--text-sub);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  margin-bottom: 5px;
  display: block;
}

/* v3.2.3-121: 체크박스/라디오는 제외 — 이 규칙이 적용되면 checked 시
   배경(var(--surface))·테두리가 input[type=checkbox]:checked 를 덮어써
   파란 채움이 사라지고 흰색 체크표시(::after)가 보이지 않게 된다.
   ('로그인 정보 저장' 체크박스 체크 상태 미노출 결함) */
.login-box .form-group input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--fs-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  height: 42px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.login-box .form-group input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}
.login-box .form-group input::placeholder { color: var(--muted); } /* v3.2.3-297 a11y */

.login-box .error-message {
  color: var(--danger-text);
  font-size: var(--fs-sm);
  background: var(--danger-soft);
  border: 1px solid #FECACA;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  text-align: left;
}

.login-box .btn-login {
  width: 100%;
  padding: 12px;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  margin-top: 6px;
  border-radius: var(--radius-md);
  background: var(--brand);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: background var(--dur-fast);
  font-family: inherit;
}
.login-box .btn-login:hover { background: var(--brand-hover); }

.login-box .login-footer { margin-top: 24px; }

.login-box .test-hint {
  font-size: var(--fs-xs);
  color: var(--muted);
  background: var(--bg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: inline-block;
  border: 1px solid var(--border);
}

.login-box .current-time {
  font-size: var(--fs-xs);
  /* v3.2.3-297 접근성: 본문 텍스트는 --muted(4.6:1) 이상 (WCAG 1.4.3) */
  color: var(--muted);
  margin-top: 10px;
}

/* ===================================================================
   42. 회원 관리 legacy 레이아웃
   =================================================================== */
.user-management-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

.user-list-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--sp-4) var(--sp-5);
}

.user-form-panel {
  width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.list-title-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.list-title-bar h2 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--text);
  margin: 0;
}

.filter-row {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.filter-row .filter-select { width: 120px; flex: none; }
.filter-row .filter-search { flex: 1; }

.form-card { padding: 18px; }
.form-card .form-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--brand-soft);
}

/* ============================================================
   Empty state / Skeleton loading (v2.6.0 L-1)
   USVEmpty.render() / USVSkeleton.list() 에서 사용
   ============================================================ */

/* 빈 상태 컨테이너 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  gap: 10px;
}
.empty-state__icon {
  width: 48px;
  height: 48px;
  color: var(--muted-light);
  opacity: 0.6;
}
.empty-state__icon svg { width: 100%; height: 100%; }
.empty-state__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-sub);
  margin: 0;
}
.empty-state__desc {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0;
  max-width: 280px;
  line-height: var(--lh-base);
}
.empty-state__action { margin-top: 4px; }

/* 컴팩트 빈 상태 — 좁은 사이드패널용 */
.empty-state--compact {
  padding: 20px 12px;
  gap: 6px;
}
.empty-state--compact .empty-state__icon { width: 32px; height: 32px; }
.empty-state--compact .empty-state__title { font-size: var(--fs-sm); }
.empty-state--compact .empty-state__desc { font-size: var(--fs-xs); }

/* 스켈레톤 애니메이션 (shimmer) */
@keyframes usv-skel-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  display: block;
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    var(--surface-hover) 50%,
    var(--surface-muted) 100%
  );
  background-size: 200% 100%;
  animation: usv-skel-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton--line {
  height: 12px;
  margin-bottom: 8px;
}
.skeleton--line-sm { height: 10px; margin-bottom: 6px; }
.skeleton--line-lg { height: 16px; margin-bottom: 10px; }
.skeleton--block {
  width: 100%;
  height: 64px;
  margin-bottom: 10px;
}
.skeleton--circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.skeleton--w-50 { width: 50%; }
.skeleton--w-70 { width: 70%; }
.skeleton--w-100 { width: 100%; }

/* 스켈레톤 리스트 아이템 */
.skeleton-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: var(--surface);
}
.skeleton-list-item .skel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 모션 감소 환경 — 애니메이션 정지 */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--surface-muted); }
}

/* 다크 모드 보강 */
[data-theme='dark'] .skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    rgba(255,255,255,0.04) 50%,
    var(--surface-muted) 100%
  );
  background-size: 200% 100%;
}

/* ============================================================
   SW 업데이트 알림 notice (v2.6.1 E-1)
   우측 하단 고정 + 새로고침 버튼
   ============================================================ */
.sw-update-notice {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  padding: 14px 16px;
  animation: usv-sw-notice-in 0.24s ease-out;
}
@keyframes usv-sw-notice-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sw-update-notice__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: 4px;
}
.sw-update-notice__desc {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 10px;
  line-height: var(--lh-base);
}
.sw-update-notice__actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .sw-update-notice {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}


/* v3.2.3-11 — Leaflet 타일 opacity 강제 1 (Leaflet fade-in 버그 우회) */
.leaflet-tile {
  opacity: 1 !important;
}

/* ===========================================================
   v3.2.3-87 USVPopup — 마커 팝업 통일 디자인 (5+ 페이지 공용)
   이전엔 integrated-control 만 인라인 정의. 공통화하여 모든 지도
   페이지(dock/mission/geofence/water-quality/boat-control)에서
   동일 시각·동작 사용. 우리 토큰 사용 → 라이트/다크 자동 대응.
   =========================================================== */
.usv-popup {
  min-width: 240px;
  max-width: 300px;
  font-family: var(--font-sans, system-ui);
  color: var(--text);
}
.usv-popup-header {
  display: flex; align-items: center; gap: 8px;
  padding-right: 34px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 8px;
  min-width: 0;
}
.usv-popup-icon {
  flex-shrink: 0; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--brand-soft); color: var(--brand);
  font-size: 14px;
}
.usv-popup-title {
  flex: 1; font-size: 13px;
  min-width: 0;
  font-weight: var(--fw-bold); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.usv-popup-badge {
  flex-shrink: 0; font-size: 10px;
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--fw-semibold);
  padding: 2px 7px; border-radius: var(--radius-full);
  background: var(--surface-muted); color: var(--muted);
}
.usv-popup-badge.success { background: var(--success-soft); color: var(--success-text); }
.usv-popup-badge.warn    { background: var(--warn-soft);    color: var(--warn-text); }
.usv-popup-badge.danger  { background: var(--danger-soft);  color: var(--danger-text); }
.usv-popup-meta {
  display: grid;
  grid-template-columns: minmax(74px, auto) minmax(0, 1fr);
  gap: 4px 8px;
  font-size: 11.5px;
  margin-bottom: 8px;
}
.usv-popup-meta .k { color: var(--muted); }
.usv-popup-meta .v {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.usv-popup[data-popup-type="boat"] {
  min-width: 270px;
  max-width: 340px;
}
.usv-popup-meta.usv-popup-meta--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.usv-popup-meta--compact .usv-popup-meta-item {
  min-width: 0;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-muted) 58%, transparent);
}
.usv-popup-meta--compact .k,
.usv-popup-meta--compact .v {
  display: block;
}
.usv-popup-meta--compact .k {
  margin-bottom: 2px;
  font-size: 10px;
}
.usv-popup-meta--compact .v {
  font-size: 11.5px;
}
.usv-popup-actions {
  display: flex; gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}
.usv-popup-actions .btn {
  flex: 1; padding: 5px 8px;
  font-size: 11px; font-weight: var(--fw-semibold);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-sub);
  cursor: pointer; transition: all var(--dur-fast);
  white-space: nowrap;
}
.usv-popup-actions .btn:hover { background: var(--bg); color: var(--text); }
.usv-popup-actions .btn.primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.usv-popup-actions .btn.primary:hover { filter: brightness(1.05); }
.usv-popup-actions .btn.danger:hover {
  background: var(--danger-soft); color: var(--danger); border-color: var(--danger);
}
/* Leaflet popup 컨테이너 토큰 통일 */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-popover) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}
.leaflet-popup-content { margin: 12px 14px !important; }
.leaflet-popup-tip { background: var(--surface) !important; }

/* ───────────────────────────────────────────────────────────────────────
 * v3.2.3-94 — 보트 마커 / 자율·원격 모드 모션 시각화
 * 지도 위에 보트가 "움직이고 있다" 는 인지를 주기 위한 클래스 묶음.
 *   - .usv-boat-marker        : 회전 가능한 divIcon 래퍼 (transition 으로 부드러운 이동/회전)
 *   - .usv-boat-marker.moving : 운항/측정 중 — 후방 파동(wake) + 본체 강조
 *   - .usv-boat-marker.holding: 대기 — 보조 펄스 1회
 *   - .usv-boat-mode-badge    : AUTO / REMOTE / MANUAL 모드 뱃지
 *   - .usv-boat-body          : SVG 본체. 색상은 status 별 변형.
 *   - 위치 보간은 JS (USVBoatMarker._animateTo, requestAnimationFrame) 에서
 *     처리한다. CSS `transition: transform` 을 .leaflet-marker-icon 에 걸면
 *     지도 팬/줌 시 마커가 0.95초 뒤늦게 따라오는 lag 가 생기기 때문.
 * ─────────────────────────────────────────────────────────────────────── */

.leaflet-marker-icon.usv-boat-marker {
  /* v3.2.3-94: GPU acceleration hint 만 유지 — transition 은 JS 보간으로 대체 */
  will-change: transform;
}
.usv-boat-marker {
  position: relative;
  width: 34px;
  height: 34px;
  pointer-events: auto;
}
.usv-boat-marker .usv-boat-rot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 회전 보간 — 헤딩 변경 시 자연스럽게 돌게 한다 */
  transition: transform 950ms cubic-bezier(.22,.61,.36,1);
  transform-origin: 50% 50%;
}
.usv-boat-marker .usv-boat-body {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}
.usv-boat-marker.status-navigating .usv-boat-body,
.usv-boat-marker.status-sensing   .usv-boat-body { color: #1D4ED8; }
.usv-boat-marker.status-holding   .usv-boat-body { color: #B45309; }
.usv-boat-marker.status-parking   .usv-boat-body { color: #6B7280; }

/* 운항 중 — wake (후방으로 퍼지는 동심원 파동) */
/* v3.2.3-97: 시인성 강화 — 굵기 3px, 색상 진한 파랑, 크기 18→ 5배 확장 */
.usv-boat-marker .usv-boat-wake {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  border: 3px solid currentColor;
  color: #2563EB;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}
.usv-boat-marker.moving .usv-boat-wake {
  animation: usv-boat-wake 1.4s ease-out infinite;
}
.usv-boat-marker.moving .usv-boat-wake.delay { animation-delay: 0.45s; }
@keyframes usv-boat-wake {
  0%   { transform: scale(0.5); opacity: 0.95; }
  60%  { opacity: 0.4; }
  100% { transform: scale(5);   opacity: 0; }
}
/* 본체도 운항 중일 때는 살짝 펄스 */
.usv-boat-marker.moving .usv-boat-body {
  animation: usv-boat-body-pulse 1.4s ease-in-out infinite;
}
@keyframes usv-boat-body-pulse {
  0%, 100% { filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
  50%      { filter: drop-shadow(0 2px 6px rgba(37,99,235,.7)); }
}

/* 대기 — 한 번씩 깜빡 */
.usv-boat-marker.holding .usv-boat-body {
  animation: usv-boat-blink 2.4s ease-in-out infinite;
}
@keyframes usv-boat-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* AUTO/REMOTE 모드 뱃지 (우상단) */
.usv-boat-mode-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.usv-boat-mode-badge.auto   { background: #10B981; color: #fff; }
.usv-boat-mode-badge.remote { background: #2563EB; color: #fff; }
.usv-boat-mode-badge.manual { background: #F59E0B; color: #fff; }

/* ── boat-control / dashboard 상단의 큰 모드 인디케이터 ────────────── */
.usv-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full, 999px);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.usv-mode-pill .usv-mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.usv-mode-pill.auto   { background: rgba(16,185,129,.10); color: #047857; border-color: rgba(16,185,129,.35); }
.usv-mode-pill.auto   .usv-mode-dot { background: #10B981; box-shadow: 0 0 0 4px rgba(16,185,129,.25); }
.usv-mode-pill.remote { background: rgba(37,99,235,.10);  color: #1D4ED8; border-color: rgba(37,99,235,.35); }
.usv-mode-pill.remote .usv-mode-dot { background: #2563EB; box-shadow: 0 0 0 4px rgba(37,99,235,.25); }
.usv-mode-pill.manual { background: rgba(245,158,11,.10); color: #92400E; border-color: rgba(245,158,11,.35); }
.usv-mode-pill.manual .usv-mode-dot { background: #F59E0B; box-shadow: 0 0 0 4px rgba(245,158,11,.25); }

/* 모드가 활성(자율/원격) + 운항 중이면 도트 펄스 */
.usv-mode-pill.live .usv-mode-dot { animation: usv-mode-dot-pulse 1.5s ease-in-out infinite; }
@keyframes usv-mode-dot-pulse {
  0%, 100% { transform: scale(1);   box-shadow: 0 0 0 4px rgba(37,99,235,.25); }
  50%      { transform: scale(1.3); box-shadow: 0 0 0 8px rgba(37,99,235,.05); }
}
