/* =================================================================
   Salaryvia — Component Library
   Design System: typography · forms · tables · alerts · tabs · more
   Relies on CSS tokens defined in main.css (:root)
   ================================================================= */

/* ─── 1. TYPOGRAPHY SCALE ────────────────────────────────────────── */

.ds-display {
  font-family: var(--display);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -3px;
  color: var(--text-1);
}

.ds-h1 {
  font-family: var(--display);
  font-size: clamp(1.875rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -1.8px;
  color: var(--text-1);
}

.ds-h2 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -1.2px;
  color: var(--text-1);
}

.ds-h3 {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.8px;
  color: var(--text-1);
}

.ds-h4 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.4px;
  color: var(--text-1);
}

.ds-h5 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.2px;
  color: var(--text-1);
}

.ds-lead {
  font-size: 1.125rem;
  color: var(--text-2);
  line-height: 1.75;
  letter-spacing: -0.02em;
  font-weight: 400;
}

.ds-body {
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.7;
  letter-spacing: -0.01em;
}

.ds-caption {
  font-size: 0.8125rem;
  color: var(--text-3);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.ds-overline {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.ds-mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  font-size: 0.875em;
  font-variant-numeric: tabular-nums;
}

/* Gradient text utility */
.ds-gradient-text {
  background: linear-gradient(135deg, var(--grad-start) 0%, var(--grad-mid) 50%, var(--grad-end) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── 2. SPACING UTILITIES ───────────────────────────────────────── */

.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mt-5  { margin-top: 20px; }
.mt-6  { margin-top: 24px; }
.mt-8  { margin-top: 32px; }
.mt-10 { margin-top: 40px; }
.mt-12 { margin-top: 48px; }

.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 4px; }
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 16px; }
.mb-5  { margin-bottom: 20px; }
.mb-6  { margin-bottom: 24px; }
.mb-8  { margin-bottom: 32px; }
.mb-10 { margin-bottom: 40px; }
.mb-12 { margin-bottom: 48px; }

.pt-4 { padding-top: 16px; }
.pt-6 { padding-top: 24px; }
.pt-8 { padding-top: 32px; }
.pb-4 { padding-bottom: 16px; }
.pb-6 { padding-bottom: 24px; }
.pb-8 { padding-bottom: 32px; }

.p-4  { padding: 16px; }
.p-5  { padding: 20px; }
.p-6  { padding: 24px; }

.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-center { justify-content: center; }
.justify-end    { justify-content: flex-end; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }

.hidden { display: none; }
.block  { display: block; }

/* ─── 3. FORM INPUTS ─────────────────────────────────────────────── */

/* Label */
.ds-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.ds-label .req {
  color: var(--red);
  margin-left: 2px;
}

/* Base input */
.ds-input {
  display: block;
  width: 100%;
  padding: 9px 13px;
  font-size: 0.9375rem;
  font-family: var(--font);
  font-weight: 400;
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  letter-spacing: -0.01em;
  line-height: 1.5;
  -webkit-appearance: none;
  appearance: none;
}

.ds-input::placeholder { color: var(--text-4); font-weight: 400; }

.ds-input:hover {
  border-color: var(--border-strong);
}

.ds-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #fff;
}

.ds-input:disabled {
  background: var(--bg-alt);
  color: var(--text-3);
  cursor: not-allowed;
  opacity: 0.7;
}

.ds-input.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.ds-input.success {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.08);
}

/* Textarea */
.ds-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

/* Select */
.ds-select {
  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='%23a1a1aa' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Input with icon */
.ds-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ds-input-wrap .ds-input {
  padding-left: 38px;
}

.ds-input-wrap.icon-right .ds-input {
  padding-left: 13px;
  padding-right: 38px;
}

.ds-input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-3);
  font-size: 16px;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.ds-input-wrap.icon-right .ds-input-icon {
  left: auto;
  right: 12px;
}

/* Input group (input + button side-by-side) */
.ds-input-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.ds-input-group:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.ds-input-group .ds-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.ds-input-group .ds-input:focus {
  box-shadow: none;
}
.ds-input-group .btn {
  border-radius: 0;
  flex-shrink: 0;
  border: none;
  border-left: 1px solid var(--border);
}

/* Form field wrapper */
.ds-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ds-hint {
  font-size: 0.8125rem;
  color: var(--text-3);
  letter-spacing: -0.01em;
  line-height: 1.5;
}

.ds-error-msg {
  font-size: 0.8125rem;
  color: var(--red);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Form row (2-col grid) */
.ds-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .ds-form-row { grid-template-columns: 1fr; } }

/* Form section */
.ds-form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ds-form-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.02em;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

/* Checkbox */
.ds-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.ds-check input[type="checkbox"],
.ds-check input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--ease);
  position: relative;
}
.ds-check input[type="radio"] {
  border-radius: 50%;
}
.ds-check input[type="checkbox"]:checked,
.ds-check input[type="radio"]:checked {
  background: var(--blue);
  border-color: var(--blue);
}
.ds-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1.5px;
  width: 5px;
  height: 8px;
  border: 1.5px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.ds-check input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #fff;
}
.ds-check input:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}
.ds-check-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.5;
}
.ds-check-hint {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 1px;
}

/* Toggle switch */
.ds-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.ds-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: var(--r-full);
  background: var(--border-strong);
  transition: background var(--ease);
  flex-shrink: 0;
}
.ds-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ds-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--ease-out);
}
.ds-toggle input:checked ~ .ds-toggle-thumb {
  transform: translateX(16px);
}
.ds-toggle:has(input:checked) .ds-toggle-track {
  background: var(--blue);
}
.ds-toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-1);
}

/* ─── 4. TABLE ───────────────────────────────────────────────────── */

.ds-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--surface);
}

.ds-table thead {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.ds-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.ds-table th:first-child { padding-left: 20px; }
.ds-table th:last-child  { padding-right: 20px; }

.ds-table td {
  padding: 13px 16px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  letter-spacing: -0.01em;
}

.ds-table td:first-child { padding-left: 20px; }
.ds-table td:last-child  { padding-right: 20px; }

.ds-table tbody tr:last-child td {
  border-bottom: none;
}

/* Hover rows */
.ds-table.hover tbody tr {
  transition: background var(--ease);
}
.ds-table.hover tbody tr:hover {
  background: var(--bg-alt);
}

/* Striped */
.ds-table.striped tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.015);
}

/* Compact */
.ds-table.compact th,
.ds-table.compact td {
  padding-top: 9px;
  padding-bottom: 9px;
}

/* Cell helpers */
.ds-table .td-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-1);
  text-align: right;
  letter-spacing: -0.02em;
}

.ds-table .td-strong {
  font-weight: 600;
  color: var(--text-1);
}

.ds-table .td-muted {
  color: var(--text-3);
  font-size: 0.8125rem;
}

/* Sortable column header */
.ds-table th.sortable {
  cursor: pointer;
}
.ds-table th.sortable:hover {
  color: var(--text-2);
}
.ds-table th.sortable::after {
  content: ' ↕';
  opacity: 0.35;
  font-weight: 400;
}
.ds-table th.sort-asc::after  { content: ' ↑'; opacity: 0.8; color: var(--blue); }
.ds-table th.sort-desc::after { content: ' ↓'; opacity: 0.8; color: var(--blue); }

/* ─── 5. ALERT / INFO BOX ────────────────────────────────────────── */

.ds-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 0.875rem;
  line-height: 1.6;
}

.ds-alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ds-alert-body { flex: 1; }

.ds-alert-title {
  font-weight: 600;
  margin-bottom: 3px;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

/* Variants */
.ds-alert-info {
  background: var(--blue-subtle);
  border-color: var(--blue-border);
  color: #1e40af;
}
.ds-alert-info .ds-alert-icon { color: var(--blue); }

.ds-alert-success {
  background: var(--green-subtle);
  border-color: var(--green-muted);
  color: #166534;
}
.ds-alert-success .ds-alert-icon { color: var(--green); }

.ds-alert-warning {
  background: var(--amber-subtle);
  border-color: var(--amber-muted);
  color: #92400e;
}
.ds-alert-warning .ds-alert-icon { color: var(--amber); }

.ds-alert-error {
  background: var(--red-subtle);
  border-color: var(--red-muted);
  color: #991b1b;
}
.ds-alert-error .ds-alert-icon { color: var(--red); }

.ds-alert-tip {
  background: var(--purple-subtle);
  border-color: var(--purple-muted);
  color: #5b21b6;
}
.ds-alert-tip .ds-alert-icon { color: var(--purple); }

.ds-alert-neutral {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text-2);
}
.ds-alert-neutral .ds-alert-icon { color: var(--text-3); }

/* Inline / banner style */
.ds-alert.banner {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

/* ─── 6. CALLOUT ─────────────────────────────────────────────────── */

.ds-callout {
  border-left: 3px solid var(--blue);
  padding: 16px 20px;
  background: var(--blue-subtle);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.7;
}

.ds-callout.success { border-color: var(--green); background: var(--green-subtle); }
.ds-callout.warning { border-color: var(--amber); background: var(--amber-subtle); }
.ds-callout.error   { border-color: var(--red);   background: var(--red-subtle); }
.ds-callout.tip     { border-color: var(--purple); background: var(--purple-subtle); }

.ds-callout strong { color: var(--text-1); }

/* ─── 7. TABS ────────────────────────────────────────────────────── */

.ds-tabs { display: flex; flex-direction: column; gap: 0; }

.ds-tab-list {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ds-tab-list::-webkit-scrollbar { display: none; }

.ds-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
  font-family: var(--font);
  letter-spacing: -0.01em;
}

.ds-tab-item:hover {
  color: var(--text-2);
  background: var(--bg-alt);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}

.ds-tab-item.active {
  color: var(--text-1);
  font-weight: 600;
  border-bottom-color: var(--text-1);
}

.ds-tab-item .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-3);
}

.ds-tab-item.active .tab-count {
  background: var(--text-1);
  border-color: var(--text-1);
  color: #fff;
}

.ds-tab-panel { padding-top: 24px; }
.ds-tab-panel:not(.active) { display: none; }

/* Pill-style tabs */
.ds-tab-list.pills {
  border-bottom: none;
  background: var(--bg-alt);
  padding: 4px;
  border-radius: var(--r-md);
  gap: 2px;
  width: fit-content;
}

.ds-tab-list.pills .ds-tab-item {
  border-bottom: none;
  margin-bottom: 0;
  border-radius: var(--r-sm);
  padding: 7px 14px;
}

.ds-tab-list.pills .ds-tab-item.active {
  background: var(--surface);
  color: var(--text-1);
  box-shadow: var(--shadow-sm);
}

/* ─── 8. PROGRESS ────────────────────────────────────────────────── */

.ds-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-alt);
  border-radius: var(--r-full);
  overflow: hidden;
}

.ds-progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--blue);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Color variants */
.ds-progress-fill.green  { background: var(--green); }
.ds-progress-fill.amber  { background: var(--amber); }
.ds-progress-fill.red    { background: var(--red); }
.ds-progress-fill.purple { background: var(--purple); }
.ds-progress-fill.grad   { background: linear-gradient(90deg, var(--blue), var(--purple)); }

/* Sizes */
.ds-progress.sm { height: 4px; }
.ds-progress.lg { height: 10px; }

/* Labeled progress */
.ds-progress-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ds-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8125rem;
}

.ds-progress-header .label { font-weight: 500; color: var(--text-1); }
.ds-progress-header .value { font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }

/* ─── 9. BADGE EXTENSIONS ────────────────────────────────────────── */

/* Base .badge is in main.css — extend here */
.badge-sm {
  padding: 1px 7px;
  font-size: 0.6875rem;
  border-radius: 3px;
}

.badge-lg {
  padding: 4px 12px;
  font-size: 0.8125rem;
  border-radius: var(--r-sm);
}

.badge-pill {
  border-radius: var(--r-full);
}

/* Badge with animated dot */
.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: blink 2.5s ease infinite;
}

/* Status-specific */
.badge-draft     { background: var(--bg-alt);        border-color: var(--border);       color: var(--text-3); }
.badge-review    { background: var(--amber-subtle);  border-color: var(--amber-muted);  color: var(--amber); }
.badge-approved  { background: var(--green-subtle);  border-color: var(--green-muted);  color: var(--green); }
.badge-published { background: #ecfdf5;              border-color: #6ee7b7;             color: #065f46; }
.badge-scheduled { background: var(--blue-subtle);   border-color: var(--blue-border);  color: var(--blue); }
.badge-noindex   { background: var(--purple-subtle); border-color: var(--purple-muted); color: var(--purple); }
.badge-archived  { background: var(--bg-alt);        border-color: var(--border-strong); color: var(--text-3); }

/* Pass / Fail */
.badge-pass { background: var(--green-subtle); border-color: var(--green-muted); color: var(--green); }
.badge-fail { background: var(--red-subtle);   border-color: var(--red-muted);   color: var(--red); }

/* ─── 10. CHIP / TAG ─────────────────────────────────────────────── */

.ds-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: default;
  transition: all var(--ease);
  letter-spacing: -0.01em;
}

.ds-chip.interactive { cursor: pointer; }
.ds-chip.interactive:hover {
  background: var(--blue-subtle);
  border-color: var(--blue-border);
  color: var(--blue);
}

.ds-chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.ds-chip-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
  cursor: pointer;
  font-size: 10px;
  transition: background var(--ease);
}
.ds-chip-close:hover { background: rgba(0,0,0,0.2); }
.ds-chip.active .ds-chip-close { background: rgba(255,255,255,0.25); }
.ds-chip.active .ds-chip-close:hover { background: rgba(255,255,255,0.4); }

/* ─── 11. ACCORDION (generic) ────────────────────────────────────── */

.ds-accordion { display: flex; flex-direction: column; gap: 1px; }

.ds-accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--ease);
}

.ds-accordion-item + .ds-accordion-item { margin-top: 4px; }

.ds-accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-1);
  text-align: left;
  transition: background var(--ease);
  letter-spacing: -0.02em;
}

.ds-accordion-trigger:hover { background: var(--bg-alt); }

.ds-accordion-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: all var(--ease-out);
  font-size: 12px;
  color: var(--text-3);
}

.ds-accordion-item.open .ds-accordion-chevron {
  background: var(--text-1);
  border-color: var(--text-1);
  color: #fff;
  transform: rotate(180deg);
}

.ds-accordion-item.open {
  border-color: var(--border-strong);
}

.ds-accordion-content {
  display: none;
  padding: 0 18px 18px;
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.75;
  letter-spacing: -0.01em;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.ds-accordion-item.open .ds-accordion-content { display: block; }

/* ─── 12. SKELETON LOADER ────────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.ds-skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-alt) 25%,
    var(--border-subtle) 37%,
    var(--bg-alt) 63%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-sm);
}

.ds-skeleton-text {
  height: 14px;
  border-radius: var(--r-xs);
  margin-bottom: 8px;
}
.ds-skeleton-text.lg { height: 20px; }
.ds-skeleton-text.sm { height: 10px; }
.ds-skeleton-text.w-75 { width: 75%; }
.ds-skeleton-text.w-50 { width: 50%; }
.ds-skeleton-text.w-25 { width: 25%; }

.ds-skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ds-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* ─── 13. EMPTY STATE ────────────────────────────────────────────── */

.ds-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
  gap: 16px;
}

.ds-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-xl);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-4);
  flex-shrink: 0;
}

.ds-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

.ds-empty-desc {
  font-size: 0.875rem;
  color: var(--text-3);
  max-width: 340px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

/* ─── 14. AVATAR ─────────────────────────────────────────────────── */

.ds-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-subtle);
  border: 1.5px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
  overflow: hidden;
  letter-spacing: -0.02em;
}

.ds-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ds-avatar.sm { width: 28px; height: 28px; font-size: 0.6875rem; }
.ds-avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.ds-avatar.xl { width: 64px; height: 64px; font-size: 1.25rem; }

/* Avatar group (stacked) */
.ds-avatar-group {
  display: flex;
  align-items: center;
}
.ds-avatar-group .ds-avatar {
  border: 2px solid var(--surface);
  margin-left: -8px;
}
.ds-avatar-group .ds-avatar:first-child { margin-left: 0; }
.ds-avatar-group .ds-avatar-more {
  background: var(--bg-alt);
  color: var(--text-2);
}

/* ─── 15. STAT BLOCK ─────────────────────────────────────────────── */

.ds-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ds-stat-value {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -1.5px;
  line-height: 1;
}

.ds-stat-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: -0.01em;
}

.ds-stat-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.ds-stat-change.up   { color: var(--green); }
.ds-stat-change.down { color: var(--red); }

/* Stat card */
.ds-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--ease-out);
  position: relative;
  overflow: hidden;
}
.ds-stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.ds-stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 0;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
  transition: height var(--ease-out);
}
.ds-stat-card:hover::after { height: 100%; }

.ds-stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--blue-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--blue);
  margin-bottom: 4px;
}

/* ─── 16. KEYBOARD SHORTCUT ──────────────────────────────────────── */

.ds-kbd {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

/* ─── 17. TOOLTIP ────────────────────────────────────────────────── */

[data-tip] {
  position: relative;
  cursor: default;
}

[data-tip]::before,
[data-tip]::after {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 999;
}

[data-tip]::before {
  content: attr(data-tip);
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text-1);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-md);
}

[data-tip]::after {
  content: '';
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: var(--text-1);
}

[data-tip]:hover::before,
[data-tip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── 18. DIVIDERS ───────────────────────────────────────────────── */

.ds-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

.ds-divider-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}
.ds-divider-label::before,
.ds-divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.ds-divider-label span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ─── 19. CARD EXTENSIONS ────────────────────────────────────────── */

/* Feature card — icon + content */
.ds-feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--ease-out);
}
.ds-feature-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.ds-feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--blue-subtle);
  border: 1px solid var(--blue-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--blue);
}
.ds-feature-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.02em;
}
.ds-feature-desc {
  font-size: 0.875rem;
  color: var(--text-3);
  line-height: 1.65;
  letter-spacing: -0.01em;
}

/* Horizontal card */
.ds-card-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--ease-out);
}
.ds-card-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* ─── 20. DATA LIST ──────────────────────────────────────────────── */

.ds-dl {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ds-dl-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.ds-dl-row:last-child { border-bottom: none; }

.ds-dl-label {
  color: var(--text-3);
  font-weight: 500;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.ds-dl-value {
  color: var(--text-1);
  font-weight: 600;
  text-align: right;
  letter-spacing: -0.02em;
}

/* ─── 21. SCORE / QUALITY RING ───────────────────────────────────── */

.ds-score-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ds-score-ring svg { transform: rotate(-90deg); }

.ds-score-ring .ring-bg {
  fill: none;
  stroke: var(--bg-alt);
  stroke-width: 8;
}

.ds-score-ring .ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.ds-score-ring .ring-value {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -1px;
  fill: var(--text-1);
  transform: rotate(90deg);
}

/* ─── 22. NOTIFICATION / TOAST ───────────────────────────────────── */

.ds-toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.ds-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: var(--text-1);
  color: rgba(255,255,255,0.85);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  max-width: 360px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  letter-spacing: -0.01em;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ds-toast-icon { font-size: 16px; flex-shrink: 0; }
.ds-toast-text { flex: 1; }

.ds-toast.success { background: var(--green); color: #fff; }
.ds-toast.error   { background: var(--red);   color: #fff; }
.ds-toast.info    { background: var(--blue);  color: #fff; }

/* ─── 23. LINK STYLES ────────────────────────────────────────────── */

.ds-link {
  color: var(--blue);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--blue-border);
  text-underline-offset: 2px;
  transition: all var(--ease);
}
.ds-link:hover {
  color: var(--blue-hover);
  text-decoration-color: var(--blue);
}

.ds-link-muted {
  color: var(--text-3);
  font-weight: 500;
  transition: color var(--ease);
}
.ds-link-muted:hover { color: var(--text-1); }

/* ─── 24. CODE BLOCK ─────────────────────────────────────────────── */

.ds-code {
  display: inline;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  font-size: 0.84em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 1px 5px;
  color: var(--text-1);
}

.ds-pre {
  background: var(--text-1);
  color: rgba(255,255,255,0.85);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,0.06);
}

/* ─── 25. STEP LIST ──────────────────────────────────────────────── */

.ds-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ds-step {
  display: flex;
  gap: 16px;
  padding-bottom: 24px;
  position: relative;
}

.ds-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.ds-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.ds-step-body { flex: 1; padding-top: 5px; }

.ds-step-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.ds-step-desc {
  font-size: 0.875rem;
  color: var(--text-3);
  line-height: 1.65;
  letter-spacing: -0.01em;
}
