/* ── Modal confirm ───────────────────────────────────────────────────────── */
.modal-confirm { display: flex; align-items: flex-start; gap: 14px; }
.modal-confirm-icon { font-size: 1.6rem; flex-shrink: 0; line-height: 1; }
.modal-confirm-msg { color: var(--text-secondary); font-size: 0.86rem; line-height: 1.55; }

/* ── Modal helpers ─────────────────────────────────────────────────────────── */
.modal-body .mt-3  { margin-top: 12px; }
.modal-body .mt-4  { margin-top: 16px; }
.modal-body .mb-3  { margin-bottom: 12px; }
.modal-body .text-sm { font-size: 0.78rem; }
.modal-body .text-xs { font-size: 0.72rem; }
.modal-body .text-warning { color: var(--warning); }
.modal-body .text-accent { color: var(--accent); }
.modal-body .empty-sm { padding: 32px 0; }
.modal-body .upload-icon { font-size: 2rem; margin-bottom: 8px; }
.modal-body .file-name { margin-top: 8px; color: var(--accent); font-size: 0.81rem; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,30,60,0.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 900; display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: overlayIn 0.18s ease;
  overflow-y: auto;
}
@keyframes overlayIn { from { opacity:0; } to { opacity:1; } }
.modal {
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  animation: modalUp 0.22s cubic-bezier(.4,0,.2,1);
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
@keyframes modalUp { from { opacity:0; transform:translateY(16px) scale(.98); } to { opacity:1; transform:translateY(0) scale(1); } }
.modal-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; background: var(--bg-surface); }
.modal-title  { font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.modal-close  { background: none; border: 1px solid var(--border); color: var(--text-muted); width: 28px; height: 28px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 0.95rem; transition: all var(--transition); flex-shrink: 0; }
.modal-close:hover { border-color: var(--red); color: var(--red); background: rgba(220,38,38,0.06); }
.modal-body   { padding: 20px; overflow-y: auto; min-height: 0; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; flex-shrink: 0; background: var(--bg-surface); }
.modal-footer .btn { min-width: 100px; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; max-width: 340px; pointer-events: none;
}
.toast {
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 12px 14px; font-size: 0.83rem;
  box-shadow: var(--shadow-lg); display: flex; align-items: flex-start; gap: 10px;
  animation: toastIn 0.28s cubic-bezier(.4,0,.2,1);
  border-left: 3px solid var(--border); pointer-events: all;
}
@keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }
.toast.info    { border-left-color: var(--accent); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--amber); }
.toast.info    .toast-icon { color: var(--accent); }
.toast-msg   { flex: 1; line-height: 1.45; color: var(--text-primary); }
.toast-close { background: none; border: none; color: var(--text-muted); padding: 0; font-size: 0.85rem; flex-shrink: 0; }
.toast-close:hover { color: var(--text-primary); }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.data-table thead th {
  padding: 10px 16px; text-align: left; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted);
  font-weight: 700; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--bg-elevated); user-select: none;
}
.data-table thead th.right { text-align: right; }
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table td { padding: 11px 16px; color: var(--text-secondary); vertical-align: middle; }
.data-table td.primary { color: var(--text-primary); font-weight: 600; }
.data-table td.mono    { font-family: var(--font-mono); font-size: 0.79rem; }
.data-table td.right   { text-align: right; }
.data-table td.actions { white-space: nowrap; display: flex; gap: 4px; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); flex-wrap: wrap; gap: 8px; }
.pagination .pages { display: flex; gap: 4px; }
.page-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary); font-size: 0.78rem; font-family: inherit; transition: all var(--transition); }
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Filters bar ─────────────────────────────────────────────────────────── */
.filters-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--bg-elevated); }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; }

/* ── File upload ──────────────────────────────────────────────────────────  */
.file-upload { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 28px 20px; text-align: center; cursor: pointer; transition: all var(--transition); position: relative; }
.file-upload:hover, .file-upload.drag-over { border-color: var(--accent); background: var(--accent-dim); }
.file-upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-upload .icon  { font-size: 2rem; margin-bottom: 8px; color: var(--text-muted); }
.file-upload .title { font-size: 0.86rem; font-weight: 600; margin-bottom: 4px; }
.file-upload .hint  { font-size: 0.76rem; color: var(--text-muted); }
.file-upload.has-file { border-color: var(--green); background: rgba(5,150,105,0.05); }
.file-upload.has-file .icon { color: var(--green); }
.amb.homolog { background: rgba(99,99,99,0.12); color: #888; font-size: 11px; padding: 2px 8px; border-radius: 4px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92dvh; max-width: 100%; }
  .modal-lg, .modal-xl { max-width: 100%; }
  .modal-body { padding: 16px; max-height: calc(92dvh - 120px); }
  .modal-header { padding: 16px 16px 12px; }
  .modal-footer { padding: 12px 16px; }
  .modal-footer .btn { flex: 1; min-width: 0; }
  .filters-bar { padding: 12px 14px; gap: 6px; }
  .filter-group { flex: 1; min-width: calc(50% - 6px); }
  .filter-group:last-child { min-width: 100%; }
  .data-table td, .data-table thead th { padding: 9px 12px; }
  #toast-container { bottom: 12px; right: 12px; left: 12px; max-width: none; }
}
