/* Tables */
.table-wrap {
  max-height: calc(100vh - 200px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--text);
}

.data-table tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr.row-selected {
  background: rgba(59, 130, 246, 0.12);
}

.table-empty {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.table-skel .skel-cell {
  height: 14px;
  background: linear-gradient(90deg, var(--border) 25%, #2a2a3a 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skel 1.2s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skel {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-grey {
  background: rgba(100, 116, 139, 0.2);
  color: var(--muted);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

.badge-purple {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-danger .modal-hd {
  border-bottom-color: rgba(239, 68, 68, 0.35);
}

.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-weight: 600;
}

.modal-x {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
}

.modal-bd {
  padding: 1.25rem;
}

.modal-desc {
  margin-top: 0;
  color: var(--muted);
}

.modal-label {
  display: block;
  font-size: 13px;
  margin: 1rem 0 0.35rem;
}

.modal-match {
  width: 100%;
}

.modal-ft {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.match-hl {
  color: var(--accent);
}

/* Toast */
.toast-host {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  border-left-width: 4px;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-info {
  border-left-color: var(--accent);
}

.toast-msg {
  flex: 1;
  font-size: 13px;
}

.toast-x {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}

/* Context menu */
.context-menu {
  position: fixed;
  z-index: 1500;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.context-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 1rem;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.context-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

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

.context-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.context-sep {
  height: 1px;
  background: var(--border);
  margin: 0.35rem 0;
}
