/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (max-width: 767px) {
  .card {
    border-radius: 16px;
    box-shadow: var(--shadow-card-phone);
  }
}

.card-selected {
  border: 2px solid var(--blue-600) !important;
  box-shadow: var(--shadow-selected) !important;
}

.card-conflict {
  background: var(--conflict-bg) !important;
  border-color: var(--conflict-border) !important;
}

.inset-panel {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
}

/* Rank Badge */
.rank {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--navy-950);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 13px;
  }
  .rank-first {
    background: var(--blue-600) !important;
  }
}

/* Status Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pg { background: var(--green-50); color: var(--green-ink); }
.pa { background: var(--amber-50); color: var(--amber-ink); }
.pr { background: var(--red-50); color: var(--red-ink); }
.pb { background: var(--blue-50); color: var(--blue-ink); }
.pn { background: var(--neutral-50); color: var(--slate-700); }
.pk { background: var(--navy-950); color: #fff; }

/* Outline & Solid Variant Pills */
.pill-solid-green { background: var(--green-700); color: #fff; }
.pill-solid-red { background: var(--red-500); color: #fff; }
.pill-outline-amber { background: #fff; border: 1px solid var(--amber-border); color: var(--amber-ink); }

/* Trade Chips */
.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--blue-50);
  color: var(--blue-ink);
  border: 1px solid var(--blue-50);
}

.chip.co {
  background: #fff;
  border-color: var(--blue-outline);
  color: var(--blue-ink);
}

.chip.cd {
  background: #fff;
  color: var(--muted);
  border: 1px dashed var(--dashed);
}

/* Source Chips */
.src {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue-ink);
  background: var(--blue-50);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

/* Buttons */
.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--button-border);
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn:hover {
  background: #F7F9FC;
}

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.bgo {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
}
.btn.bgo:hover {
  background: #11703A;
}

.btn.bp {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
}
.btn.bp:hover {
  background: var(--blue-ink);
}

.btn.bk {
  background: var(--navy-950);
  border-color: var(--navy-950);
  color: #fff;
}
.btn.bk:hover {
  background: var(--navy-900);
}

.btn.bam {
  background: var(--amber-accent);
  border-color: var(--amber-accent);
  color: var(--navy-950);
}

@media (max-width: 767px) {
  .btn-mobile {
    height: 48px;
    border-radius: 12px;
    font-size: 15px;
  }
}

/* Form Controls */
.input {
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--input-border);
  background: #fff;
  outline: none;
  font-size: 13.5px;
  transition: border-color 0.15s ease;
}
.input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 2px rgba(31,95,209,.15);
}

/* Toggle Switch */
.sw {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--toggle-off);
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: inline-block;
  flex-shrink: 0;
}
.sw.on {
  background: var(--green-700);
}
.sw .kn {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform 0.2s ease;
}
.sw.on .kn {
  transform: translateX(16px);
}

/* Checkbox */
.chk {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid var(--check-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.chk.checked {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
}
.chk.checked-green {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
}

/* Segmented Control */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--neutral-50);
  border-radius: 9px;
  gap: 2px;
}
.segmented-item {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s ease;
}
.segmented-item.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(11,27,51,.08);
}

/* Modals & Dialogs */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.98);
  transition: transform 0.2s ease-out;
}
.modal-backdrop.open .modal-dialog {
  transform: scale(1);
}

.modal-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--divider);
}
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-footer {
  padding: 16px 24px;
  background: #FAFBFC;
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Phone Bottom Sheet */
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-modal);
  z-index: 1000;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.bottom-sheet.open {
  transform: translateY(0);
}
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #D3DAE4;
  margin: 10px auto 4px;
}

/* Toast Notification (Undo) */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--navy-950);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(11,27,51,.25);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  pointer-events: auto;
  animation: slideUpToast 0.2s ease-out;
}
@keyframes slideUpToast {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
