/* ═══════════════════════════════════════════════════════════════════════════
   Arhipedija Design System (ds.css)
   Shared foundation for Arhipedija + Arhitech projects.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  /* Primary palette */
  --ds-text: #1a1a2e;
  --ds-accent: #1a1a2e;
  --ds-accent-hover: #2d2d4a;

  /* Surfaces */
  --ds-surface: #ffffff;
  --ds-bg: #f6f6f8;
  --ds-tint: #f8f9fb;

  /* Borders */
  --ds-border: #1a1a2e;
  --ds-border-light: #e4e5ea;

  /* Text */
  --ds-muted: #8a8fa0;

  /* Status */
  --ds-red: #d44040;
  --ds-green: #2ba866;
  --ds-orange: #d4820a;

  /* Earthy / warm */
  --ds-sand: #e8dfd4;
  --ds-sand-dark: #c4b49e;
  --ds-clay: #a68b6b;
  --ds-earth: #6b5340;
  --ds-warm-bg: #f5f1ec;

  /* Misc */
  --ds-radius: 2px;
  --ds-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Spacing scale (4px base) */
  --ds-sp-1: 4px;
  --ds-sp-2: 8px;
  --ds-sp-3: 12px;
  --ds-sp-4: 16px;
  --ds-sp-5: 20px;
  --ds-sp-6: 24px;
  --ds-sp-8: 32px;
  --ds-sp-10: 40px;
  --ds-sp-12: 48px;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Typography ─────────────────────────────────────────────────────────── */

.ds-heading-xl {
  font-family: var(--ds-font);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--ds-text);
}

.ds-heading-lg {
  font-family: var(--ds-font);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
  color: var(--ds-text);
}

.ds-heading-md {
  font-family: var(--ds-font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.35;
  color: var(--ds-text);
}

.ds-heading-sm {
  font-family: var(--ds-font);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ds-text);
}

.ds-body {
  font-family: var(--ds-font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ds-text);
}

.ds-body-sm {
  font-family: var(--ds-font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ds-text);
}

.ds-label {
  font-family: var(--ds-font);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ds-muted);
}

.ds-caption {
  font-family: var(--ds-font);
  font-size: 12px;
  line-height: 1.4;
  color: var(--ds-muted);
}

/* ── Logo ───────────────────────────────────────────────────────────────── */

.ds-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--ds-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ds-logo-icon svg { width: 16px; height: 16px; }

.ds-logo-icon--lg {
  width: 36px;
  height: 36px;
}

.ds-logo-icon--lg svg { width: 20px; height: 20px; }

.ds-logo-icon--sm {
  width: 20px;
  height: 20px;
}

.ds-logo-icon--sm svg { width: 12px; height: 12px; }

.ds-logo-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ds-text);
}

.ds-logo-mark-title {
  font-family: var(--ds-font);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ds-text);
}

.ds-logo-mark--lg .ds-logo-mark-title {
  font-size: 28px;
  letter-spacing: -0.3px;
}

.ds-logo-mark--sm .ds-logo-icon {
  width: 20px;
  height: 20px;
}

.ds-logo-mark--sm .ds-logo-icon svg {
  width: 12px;
  height: 12px;
}

.ds-logo-mark--sm .ds-logo-mark-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.ds-logo-mark-sub {
  font-family: var(--ds-font);
  font-size: 12px;
  font-weight: 400;
  color: var(--ds-muted);
  letter-spacing: 0;
}

/* Inverted (on dark backgrounds) */
.ds-logo-mark--inv .ds-logo-icon {
  background: rgba(255, 255, 255, 0.15);
}

.ds-logo-mark--inv .ds-logo-mark-title { color: #fff; }
.ds-logo-mark--inv .ds-logo-mark-sub { color: rgba(255, 255, 255, 0.5); }

/* ── Buttons ────────────────────────────────────────────────────────────── */

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 var(--ds-sp-6);
  background: var(--ds-accent);
  color: #fff;
  border: 1px solid var(--ds-accent);
  border-radius: var(--ds-radius);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--ds-font);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.ds-btn:hover { background: var(--ds-accent-hover); }
.ds-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ds-btn--full { width: 100%; }

.ds-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 var(--ds-sp-6);
  background: var(--ds-surface);
  color: var(--ds-text);
  border: 1.5px solid var(--ds-border);
  border-radius: var(--ds-radius);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--ds-font);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.ds-btn-secondary:hover { background: var(--ds-tint); }
.ds-btn-secondary:disabled { opacity: 0.35; cursor: not-allowed; }

.ds-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  background: var(--ds-accent);
  color: #fff;
  border: none;
  border-radius: var(--ds-radius);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--ds-font);
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.ds-btn-sm:hover { opacity: 0.8; }

.ds-btn-sm-secondary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  background: transparent;
  color: var(--ds-text);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--ds-font);
  cursor: pointer;
  transition: border-color 0.15s;
  white-space: nowrap;
}

.ds-btn-sm-secondary:hover { border-color: var(--ds-border); }

.ds-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--ds-radius);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--ds-font);
  cursor: pointer;
  transition: border-color 0.15s;
  white-space: nowrap;
}

.ds-btn-ghost:hover { border-color: rgba(255, 255, 255, 0.7); }

/* ── Inputs ─────────────────────────────────────────────────────────────── */

.ds-input {
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--ds-border);
  border-radius: var(--ds-radius);
  font-size: 14px;
  font-family: var(--ds-font);
  color: var(--ds-text);
  background: var(--ds-surface);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.ds-input:focus { background: var(--ds-tint); }
.ds-input::placeholder { color: var(--ds-muted); }
.ds-input--full { width: 100%; }

.ds-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--ds-border-light);
  border-radius: var(--ds-radius);
  font-size: 14px;
  font-family: var(--ds-font);
  color: var(--ds-text);
  background: var(--ds-surface);
  outline: none;
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
  transition: border-color 0.15s;
}

.ds-textarea:focus { border-color: var(--ds-border); }
.ds-textarea::placeholder { color: var(--ds-muted); }

.ds-select {
  height: 40px;
  padding: 0 32px 0 12px;
  border: 1.5px solid var(--ds-border);
  border-radius: var(--ds-radius);
  font-size: 14px;
  font-family: var(--ds-font);
  color: var(--ds-text);
  background: var(--ds-surface);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8fa0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s, background-color 0.15s;
}

.ds-select:focus { border-color: var(--ds-accent); background-color: var(--ds-tint); }
.ds-select--full { width: 100%; }

.ds-field-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ds-muted);
  margin-bottom: var(--ds-sp-1);
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.ds-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--ds-sp-3);
}

.ds-card {
  background: var(--ds-surface);
  padding: var(--ds-sp-4);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ds-card-label {
  font-family: var(--ds-font);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ds-muted);
}

.ds-card-value {
  font-family: var(--ds-font);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
  color: var(--ds-text);
}

.ds-card-sub {
  font-family: var(--ds-font);
  font-size: 12px;
  color: var(--ds-muted);
  line-height: 1.3;
}

.ds-val--red { color: var(--ds-red); }
.ds-val--green { color: var(--ds-green); }
.ds-val--orange { color: var(--ds-orange); }

/* ── Panels ─────────────────────────────────────────────────────────────── */

.ds-panel {
  background: var(--ds-surface);
  overflow: hidden;
}

.ds-panel-header {
  font-family: var(--ds-font);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ds-muted);
  padding: 12px var(--ds-sp-4);
  border-bottom: 1px solid var(--ds-border-light);
}

.ds-panel-body {
  padding: var(--ds-sp-4);
}

/* Collapsible detail sections */
.ds-detail-section {
  background: var(--ds-surface);
}

.ds-detail-header {
  padding: 14px var(--ds-sp-4);
  font-family: var(--ds-font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  user-select: none;
  transition: background 0.1s;
}

.ds-detail-header:hover { background: var(--ds-tint); }

.ds-detail-arrow {
  font-size: 10px;
  color: var(--ds-muted);
  transition: transform 0.15s;
  display: inline-block;
}

.ds-detail-section.open .ds-detail-arrow { transform: rotate(90deg); }

.ds-detail-body {
  display: none;
  padding: 0 var(--ds-sp-4) var(--ds-sp-4);
}

.ds-detail-section.open .ds-detail-body { display: block; }

/* ── Title Bar ──────────────────────────────────────────────────────────── */

.ds-title-bar {
  background: var(--ds-accent);
  color: #fff;
  padding: var(--ds-sp-3) var(--ds-sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--ds-font);
  font-size: 14px;
  font-weight: 700;
}

.ds-title-bar-left {
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
}

.ds-title-sep { opacity: 0.4; }

/* ── Chips ──────────────────────────────────────────────────────────────── */

.ds-chip {
  padding: 7px 14px;
  background: var(--ds-surface);
  border: 1.5px solid var(--ds-border);
  border-radius: var(--ds-radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--ds-font);
  color: var(--ds-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ds-chip:hover,
.ds-chip--selected {
  background: var(--ds-accent);
  color: #fff;
}

.ds-chip--sm {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */

.ds-badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--ds-font);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: var(--ds-radius);
}

.ds-badge--red { background: #fde8e8; color: #b93131; }
.ds-badge--orange { background: #fef3e2; color: #b5690a; }
.ds-badge--yellow { background: #fef9e7; color: #92690d; }
.ds-badge--blue { background: #eaecf7; color: #3f4d99; }
.ds-badge--green { background: #dcfce7; color: #1a7a42; }
.ds-badge--muted { background: #f0f1f4; color: #5c6070; }

/* ── Citation Chip ──────────────────────────────────────────────────────── */

.ds-cite-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  color: var(--ds-text);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--ds-font);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s;
  vertical-align: baseline;
}

.ds-cite-chip:hover { background: var(--ds-tint); }

.ds-cite-icon {
  font-size: 14px;
  font-weight: 400;
  opacity: 0.6;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */

.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--ds-font);
}

.ds-table th {
  text-align: left;
  padding: 10px var(--ds-sp-4);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ds-muted);
  border-bottom: 1px solid var(--ds-border-light);
}

.ds-table td {
  padding: 10px var(--ds-sp-4);
  border-bottom: 1px solid var(--ds-border-light);
  vertical-align: middle;
}

.ds-table tr:last-child td { border-bottom: none; }
.ds-table tbody tr:hover td { background: var(--ds-tint); }

.ds-td-muted { color: var(--ds-muted); white-space: nowrap; }
.ds-td-bold { font-weight: 600; }

/* ── Hero ───────────────────────────────────────────────────────────────── */

.ds-hero-box {
  width: 100%;
  max-width: 580px;
  background: var(--ds-surface);
  padding: var(--ds-sp-12) var(--ds-sp-10);
  text-align: center;
}

.ds-hero-title {
  font-family: var(--ds-font);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ds-text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: var(--ds-sp-2);
}

.ds-hero-sub {
  font-family: var(--ds-font);
  font-size: 14px;
  color: var(--ds-muted);
  margin-bottom: var(--ds-sp-8);
}

.ds-hero-form {
  display: flex;
  gap: 0;
  margin-bottom: var(--ds-sp-3);
}

.ds-hero-form .ds-input { border-right: none; }
.ds-hero-form .ds-input:last-child { border-right: 1.5px solid var(--ds-border); }

/* ── Corner Marks ───────────────────────────────────────────────────────── */

.ds-corner-box {
  position: relative;
}

.ds-corner-box::before,
.ds-corner-box::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.ds-corner-box::before {
  top: -6px;
  left: -6px;
  border-top: 1px solid var(--ds-border);
  border-left: 1px solid var(--ds-border);
}

.ds-corner-box::after {
  top: -6px;
  right: -6px;
  border-top: 1px solid var(--ds-border);
  border-right: 1px solid var(--ds-border);
}

.ds-corner-box-bottom {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ds-corner-box-bottom::before,
.ds-corner-box-bottom::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
}

.ds-corner-box-bottom::before {
  bottom: -6px;
  left: -6px;
  border-bottom: 1px solid var(--ds-border);
  border-left: 1px solid var(--ds-border);
}

.ds-corner-box-bottom::after {
  bottom: -6px;
  right: -6px;
  border-bottom: 1px solid var(--ds-border);
  border-right: 1px solid var(--ds-border);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */

.ds-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
}

.ds-modal {
  background: var(--ds-surface);
  padding: var(--ds-sp-8);
  width: 100%;
  max-width: 460px;
  position: relative;
  border-radius: var(--ds-radius);
  box-shadow: 0 12px 40px rgba(26, 26, 46, 0.18);
}

.ds-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--ds-muted);
  line-height: 1;
}

.ds-modal-close:hover { color: var(--ds-text); }

.ds-modal-title {
  font-family: var(--ds-font);
  font-size: 18px;
  font-weight: 700;
  color: var(--ds-text);
  margin-bottom: 6px;
}

.ds-modal-desc {
  font-family: var(--ds-font);
  font-size: 13px;
  color: var(--ds-muted);
  line-height: 1.5;
  margin-bottom: var(--ds-sp-5);
}

@media (max-width: 768px) {
  .ds-modal { margin: 16px; padding: var(--ds-sp-6); }
}

/* ── Loading ────────────────────────────────────────────────────────────── */

.ds-spinner {
  width: 36px;
  height: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 2px;
}

.ds-spinner::before,
.ds-spinner::after { content: none; }

.ds-spinner-block {
  background: var(--ds-accent);
  animation: ds-block-pulse 1.2s ease-in-out infinite;
}

.ds-spinner-block:nth-child(1) { animation-delay: 0s; }
.ds-spinner-block:nth-child(2) { animation-delay: 0.1s; }
.ds-spinner-block:nth-child(3) { animation-delay: 0.2s; }
.ds-spinner-block:nth-child(4) { animation-delay: 0.1s; }
.ds-spinner-block:nth-child(5) { animation-delay: 0.2s; }
.ds-spinner-block:nth-child(6) { animation-delay: 0.3s; }
.ds-spinner-block:nth-child(7) { animation-delay: 0.2s; }
.ds-spinner-block:nth-child(8) { animation-delay: 0.3s; }
.ds-spinner-block:nth-child(9) { animation-delay: 0.4s; }

@keyframes ds-block-pulse {
  0%, 100% { opacity: 0.12; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

.ds-spinner--sm { width: 24px; height: 24px; }

/* Dot bounce loader */
.ds-dot-loader {
  display: flex;
  gap: 4px;
  align-items: center;
}

.ds-dot-loader span {
  display: block;
  width: 7px;
  height: 7px;
  background: var(--ds-accent);
  animation: ds-dot-bounce 0.9s ease-in-out infinite;
}

.ds-dot-loader span:nth-child(2) { animation-delay: 0.15s; }
.ds-dot-loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ds-dot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* Loading steps */
.ds-loading-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ds-loading-step {
  font-family: var(--ds-font);
  font-size: 13px;
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  color: var(--ds-muted);
  transition: color 0.2s;
}

.ds-loading-step.active { color: var(--ds-text); }
.ds-loading-step.done { color: var(--ds-green); }

.ds-step-icon {
  width: 16px;
  text-align: center;
  font-size: 11px;
  flex-shrink: 0;
}

.ds-step-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--ds-border-light);
  border-top-color: var(--ds-accent);
  border-radius: 50%;
  animation: ds-spin 0.8s linear infinite;
}

@keyframes ds-spin { 100% { transform: rotate(360deg); } }

/* ── Navigation ─────────────────────────────────────────────────────────── */

.ds-nav {
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-border-light);
}

.ds-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--ds-sp-6);
  display: flex;
  align-items: center;
  height: 48px;
}

.ds-nav-brand {
  font-family: var(--ds-font);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  margin-right: var(--ds-sp-8);
  white-space: nowrap;
  text-decoration: none;
  color: var(--ds-text);
}

.ds-nav-links {
  display: flex;
  height: 48px;
}

.ds-nav-link {
  display: flex;
  align-items: center;
  padding: 0 var(--ds-sp-4);
  font-family: var(--ds-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.ds-nav-link:hover { color: var(--ds-text); }
.ds-nav-link.active { color: var(--ds-text); border-bottom-color: var(--ds-accent); }

.ds-nav-spacer { flex: 1; }

.ds-nav-status {
  font-family: var(--ds-font);
  font-size: 11px;
  color: var(--ds-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ds-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ds-green);
}

/* ── Rankings ───────────────────────────────────────────────────────────── */

.ds-ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ds-border-light);
  font-family: var(--ds-font);
}

.ds-ranking-item:last-child { border-bottom: none; }

.ds-rank-num {
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}

.ds-rank-1 { background: var(--ds-red); }
.ds-rank-2 { background: var(--ds-orange); }
.ds-rank-3 { background: #c9a20a; }
.ds-rank-4, .ds-rank-5 { background: #9ca3af; }

.ds-rank-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-rank-count {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* ── Key-Value List ─────────────────────────────────────────────────────── */

.ds-kv-list {
  font-family: var(--ds-font);
  font-size: 13px;
}

.ds-kv-list dt {
  color: var(--ds-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: var(--ds-sp-3);
}

.ds-kv-list dt:first-child { margin-top: 0; }

.ds-kv-list dd {
  margin: 2px 0 0;
  font-weight: 600;
  color: var(--ds-text);
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */

.ds-alert {
  font-family: var(--ds-font);
  font-size: 13px;
  line-height: 1.55;
  padding: var(--ds-sp-3) 14px;
  border-radius: var(--ds-radius);
}

.ds-alert--warning {
  background: #fffbf5;
  border-left: 3px solid var(--ds-orange);
  color: #6b3a08;
}

.ds-alert--warning b { color: var(--ds-orange); }

.ds-alert--error {
  background: #fef5f5;
  border-left: 3px solid var(--ds-red);
  color: #9a2020;
}

.ds-alert--success {
  background: #f2fdf6;
  border-left: 3px solid var(--ds-green);
  color: #166534;
}

/* ── Drop Zone ──────────────────────────────────────────────────────────── */

.ds-drop-zone {
  border: 2px dashed var(--ds-border-light);
  padding: var(--ds-sp-12) var(--ds-sp-8);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.ds-drop-zone:hover,
.ds-drop-zone.drag-over {
  border-color: var(--ds-accent);
  background: var(--ds-tint);
}

.ds-drop-zone-icon { margin-bottom: var(--ds-sp-3); }
.ds-drop-zone-icon svg { width: 40px; height: 40px; stroke: var(--ds-muted); }

.ds-drop-zone-text {
  font-family: var(--ds-font);
  font-size: 14px;
  color: var(--ds-muted);
}

.ds-drop-zone-text b { color: var(--ds-text); }

.ds-drop-zone-sub {
  font-family: var(--ds-font);
  font-size: 12px;
  color: var(--ds-muted);
  margin-top: 6px;
}

/* ── Filter Bar ─────────────────────────────────────────────────────────── */

.ds-filter-bar {
  background: var(--ds-surface);
  padding: 10px var(--ds-sp-4);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--ds-font);
}

.ds-filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ds-muted);
}

.ds-filter-sep {
  width: 1px;
  height: 24px;
  background: var(--ds-border-light);
}

/* ── Utility ────────────────────────────────────────────────────────────── */

.ds-hidden { display: none !important; }
