/* ============================================================================
   ADVOKE CV — components.css
   Buttons, inputs, cards, badges, chips, tabs, accordions, dialogs, toasts,
   skeletons, tooltips, breadcrumbs, pagination, empty states, avatars.
   Yellow & White design system. Fully responsive. Accessible states.
   ============================================================================ */

/* ── 1. Buttons ────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  --btn-border: var(--line);
  --btn-shadow: var(--shadow-sm);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  min-height: 44px;
  border-radius: var(--r-md);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.1;
  letter-spacing: var(--ls-normal);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--btn-shadow);
  transition:
    transform var(--t-fast),
    background-color var(--t-fast),
    border-color var(--t-fast),
    color var(--t-fast),
    box-shadow var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn .btn__icon-right { order: 2; }

/* Primary — brand yellow */
.btn-primary {
  --btn-bg: var(--y-500);
  --btn-fg: var(--ink);
  --btn-border: transparent;
  --btn-shadow: 0 1px 0 rgba(15, 23, 42, 0.05), 0 6px 16px -8px rgba(245, 179, 1, 0.7);
  font-weight: var(--fw-bold);
}

.btn-primary:hover {
  --btn-bg: var(--y-600);
  box-shadow: 0 2px 0 rgba(15, 23, 42, 0.04), 0 10px 22px -10px rgba(245, 179, 1, 0.85);
}

.btn-primary:active { --btn-bg: var(--y-700); }

/* Secondary — white on border */
.btn-secondary {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  --btn-border: var(--line);
}

.btn-secondary:hover {
  --btn-border: var(--y-500);
  --btn-bg: var(--y-50);
}

/* Ghost — bare */
.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink-2);
  --btn-border: transparent;
  --btn-shadow: none;
}

.btn-ghost:hover {
  --btn-bg: var(--y-50);
  --btn-fg: var(--ink);
  box-shadow: none;
  transform: none;
}

/* Outline — yellow outline */
.btn-outline {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: var(--y-500);
  --btn-shadow: none;
}

.btn-outline:hover {
  --btn-bg: var(--y-50);
}

/* Danger */
.btn-danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-border: transparent;
}

.btn-danger:hover { --btn-bg: #991B1B; }

/* Danger soft */
.btn-danger-soft {
  --btn-bg: var(--danger-bg);
  --btn-fg: var(--danger);
  --btn-border: var(--danger-line);
}

.btn-danger-soft:hover {
  --btn-bg: #FEE2E2;
  --btn-border: var(--danger);
}

/* Ink (dark) */
.btn-ink {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  --btn-border: transparent;
}

.btn-ink:hover { --btn-bg: #1E293B; }

/* Sizes */
.btn-xs {
  padding: 0.4rem 0.7rem;
  min-height: 32px;
  font-size: var(--fs-2xs);
  border-radius: var(--r-sm);
  gap: 0.35rem;
}

.btn-xs svg { width: 14px; height: 14px; }

.btn-sm {
  padding: 0.55rem 0.95rem;
  min-height: 38px;
  font-size: var(--fs-xs);
  border-radius: var(--r-sm);
}

.btn-sm svg { width: 16px; height: 16px; }

.btn-lg {
  padding: 0.95rem 1.75rem;
  min-height: 52px;
  font-size: var(--fs-lg);
  border-radius: var(--r-lg);
  gap: 0.6rem;
}

.btn-lg svg { width: 20px; height: 20px; }

.btn-xl {
  padding: 1.1rem 2.25rem;
  min-height: 60px;
  font-size: var(--fs-xl);
  border-radius: var(--r-lg);
  gap: 0.65rem;
}

.btn-xl svg { width: 22px; height: 22px; }

/* Full width */
.btn-block {
  width: 100%;
  display: flex;
}

/* Icon-only */
.btn-icon {
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
}

.btn-icon.btn-sm { width: 38px; height: 38px; }
.btn-icon.btn-xs { width: 32px; height: 32px; }

/* Loading state */
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--ink);
  animation: btn-spin 0.7s linear infinite;
}

.btn-primary.is-loading::after { color: var(--ink); }
.btn-ink.is-loading::after,
.btn-danger.is-loading::after { color: var(--paper); }

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Button groups */
.btn-group {
  display: inline-flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
  border-right-width: 0;
  box-shadow: none;
  transform: none;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--r-md);
  border-bottom-left-radius: var(--r-md);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--r-md);
  border-bottom-right-radius: var(--r-md);
  border-right-width: 1px;
}

.btn-group .btn[aria-pressed="true"] {
  background: var(--y-500);
  color: var(--ink);
  border-color: var(--y-500);
  z-index: 1;
}

/* ── 2. Form controls ──────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.field-row {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.field-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--ink-2);
  letter-spacing: var(--ls-wide);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.field-label .req {
  color: var(--danger);
  font-weight: var(--fw-bold);
}

.field-hint {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  line-height: 1.5;
}

.field-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  font-weight: var(--fw-medium);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.field-error svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  min-height: 44px;
  font-family: inherit;
  font-size: var(--fs-md);
  line-height: 1.4;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--line-3);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--y-500);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.22);
  background: var(--paper);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  background: var(--paper-4);
  color: var(--ink-4);
  cursor: not-allowed;
}

.textarea {
  min-height: 110px;
  resize: vertical;
  line-height: var(--lh-body);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.select {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 16px;
}

.field.has-error .input,
.field.has-error .textarea,
.field.has-error .select {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.field.has-error .input:focus,
.field.has-error .textarea:focus,
.field.has-error .select:focus {
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.18);
}

.field.has-success .input,
.field.has-success .textarea,
.field.has-success .select {
  border-color: var(--success-line);
}

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

.input-wrap svg.input-icon {
  position: absolute;
  left: 0.85rem;
  width: 18px;
  height: 18px;
  color: var(--ink-4);
  pointer-events: none;
}

.input-wrap .input { padding-left: 2.6rem; }

.input-wrap .input-suffix {
  position: absolute;
  right: 0.75rem;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  pointer-events: none;
}

/* Checkbox & radio */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  line-height: 1.45;
  user-select: none;
  min-height: 32px;
  padding-block: 0.2rem;
}

.check input[type="checkbox"],
.check input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  margin-top: 0.1em;
  border: 1.5px solid var(--line-3);
  background: var(--paper);
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  position: relative;
}

.check input[type="radio"] {
  border-radius: var(--r-circle);
}

.check input:hover {
  border-color: var(--y-500);
}

.check input:checked {
  background: var(--y-500);
  border-color: var(--y-500);
}

.check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--ink);
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg);
}

.check input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.check input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.28);
}

.check input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  user-select: none;
  min-height: 32px;
}

.switch input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: var(--r-pill);
  background: var(--line-3);
  cursor: pointer;
  transition: background-color var(--t-base);
  flex-shrink: 0;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base);
}

.switch input:checked {
  background: var(--y-500);
}

.switch input:checked::after {
  transform: translateX(18px);
}

.switch input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.28);
}

/* Range */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--paper-4);
  border-radius: var(--r-pill);
  outline: none;
  cursor: pointer;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--y-500);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
  cursor: grab;
  transition: transform var(--t-fast);
}

.range::-webkit-slider-thumb:hover { transform: scale(1.1); }
.range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.05); }

.range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--y-500);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
  cursor: grab;
}

/* Color swatch input */
.color-swatch {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.color-swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 8px; }
.color-swatch::-moz-color-swatch { border: none; border-radius: 8px; }

.color-swatch:hover { border-color: var(--y-500); }

.color-swatch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.28);
}

/* Fieldset block */
.fieldset {
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  background: var(--paper);
}

.fieldset legend {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--ink-3);
  padding-inline: 0.5rem;
  margin-inline-start: -0.5rem;
}

/* ── 3. Cards ──────────────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  min-width: 0;
}

.card-hover:hover {
  border-color: var(--y-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-flat {
  box-shadow: none;
  background: var(--paper-2);
}

.card-warm {
  background: linear-gradient(165deg, var(--y-50) 0%, var(--paper) 70%);
  border-color: var(--y-100);
}

.card-ink {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.card-ink h1, .card-ink h2, .card-ink h3, .card-ink h4 {
  color: var(--paper);
}

.card-ink p { color: #CBD5E1; }

.card-pad-lg { padding: clamp(1.25rem, 3vw, 2rem); }
.card-pad-sm { padding: var(--s-4); }
.card-pad-none { padding: 0; }

.card-interactive {
  display: block;
  color: inherit;
  text-align: left;
  width: 100%;
  font: inherit;
  cursor: pointer;
}

.card-interactive:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.card-header h3 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  margin: 0;
}

.card-body { color: var(--ink-2); font-size: var(--fs-sm); line-height: var(--lh-body); }

.card-footer {
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

/* Icon card */
.icon-card {
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
}

.icon-card__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--y-100);
  color: var(--y-800);
  border-radius: var(--r-md);
}

.icon-card__icon svg { width: 24px; height: 24px; }

.icon-card__body h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  margin-bottom: 0.4rem;
}

.icon-card__body p {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}

/* ── 4. Badges & chips ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  letter-spacing: var(--ls-wide);
  background: var(--paper-4);
  color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge svg { width: 12px; height: 12px; }

.badge-yellow { background: var(--y-100); color: var(--y-800); border-color: var(--y-200); }
.badge-ink { background: var(--ink); color: var(--paper); }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge-outline { background: transparent; border-color: var(--line); color: var(--ink-2); }

.badge-lg { padding: 0.4rem 0.85rem; font-size: var(--fs-xs); }

/* Chip — selectable filter */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  min-height: 38px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  user-select: none;
}

.chip:hover {
  border-color: var(--y-400);
  background: var(--y-50);
  color: var(--ink);
}

.chip[aria-pressed="true"],
.chip.is-active {
  background: var(--y-500);
  border-color: var(--y-500);
  color: var(--ink);
  box-shadow: 0 4px 12px -6px rgba(245, 179, 1, 0.75);
}

.chip svg { width: 15px; height: 15px; }

.chip .chip__count {
  font-size: var(--fs-3xs);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* ── 5. Tabs ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.3rem;
  background: var(--paper-4);
  border-radius: var(--r-md);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  min-height: 40px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--ink-3);
  white-space: nowrap;
  transition: background-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.tab:hover { color: var(--ink); }

.tab[aria-selected="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.tab svg { width: 15px; height: 15px; }

/* Underline tabs */
.tabs-underline {
  background: none;
  padding: 0;
  gap: var(--s-6);
  border-bottom: 1px solid var(--line-2);
  border-radius: 0;
}

.tabs-underline .tab {
  padding: 0.7rem 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--ink-3);
}

.tabs-underline .tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--y-500);
  background: none;
  box-shadow: none;
}

/* ── 6. Accordion (details-based, JS-free) ─────────────────────────────── */
.accordion {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.accordion__item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  overflow: hidden;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.accordion__item[open] {
  border-color: var(--y-300);
  box-shadow: var(--shadow-sm);
}

.accordion__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  min-height: 56px;
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  list-style: none;
  transition: background-color var(--t-fast);
}

.accordion__summary:hover { background: var(--y-50); }

.accordion__summary::-webkit-details-marker { display: none; }

.accordion__summary::after {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%230F172A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform var(--t-base);
}

.accordion__item[open] .accordion__summary::after {
  transform: rotate(180deg);
}

.accordion__body {
  padding: 0 var(--s-5) var(--s-5);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}

/* ── 7. Dialogs / modals ───────────────────────────────────────────────── */
dialog.modal {
  padding: 0;
  border: none;
  border-radius: var(--r-xl);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-2xl);
  width: min(94vw, 560px);
  max-height: min(90dvh, 780px);
  overflow: hidden;
  margin: auto;
}

dialog.modal--lg { width: min(94vw, 760px); }
dialog.modal--sm { width: min(94vw, 420px); }

dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

dialog.modal[open] {
  animation: modal-in var(--t-slow);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--line-2);
}

.modal__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  margin: 0;
}

.modal__subtitle {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  margin-top: 0.25rem;
}

.modal__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  transition: background-color var(--t-fast), color var(--t-fast);
}

.modal__close:hover { background: var(--paper-4); color: var(--ink); }
.modal__close svg { width: 20px; height: 20px; }

.modal__body {
  padding: var(--s-5);
  overflow-y: auto;
  max-height: 60dvh;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}

.modal__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  justify-content: flex-end;
  padding: var(--s-4) var(--s-5) var(--s-5);
  border-top: 1px solid var(--line-2);
  background: var(--paper-2);
}

@media (max-width: 480px) {
  .modal__footer { flex-direction: column-reverse; }
  .modal__footer .btn { width: 100%; }
}

/* ── 8. Toast notifications ───────────────────────────────────────────── */
.toast-host {
  position: fixed;
  bottom: var(--s-4);
  right: var(--s-4);
  left: var(--s-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  pointer-events: none;
}

@media (min-width: 640px) {
  .toast-host {
    left: auto;
    bottom: var(--s-6);
    right: var(--s-6);
    align-items: flex-end;
    max-width: 420px;
  }
}

.toast {
  pointer-events: auto;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  font-size: var(--fs-sm);
  line-height: 1.45;
  animation: toast-in var(--t-slow);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast.is-leaving {
  animation: toast-out var(--t-base) forwards;
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px); }
}

.toast svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast--success svg { color: #4ADE80; }
.toast--error svg { color: #F87171; }
.toast--warning svg { color: var(--y-400); }
.toast--info svg { color: #93C5FD; }

.toast__body { flex: 1 1 auto; min-width: 0; }

.toast__title {
  font-weight: var(--fw-semibold);
  margin-bottom: 0.15rem;
}

.toast__message {
  color: #CBD5E1;
  font-size: var(--fs-xs);
}

.toast__close {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  color: #94A3B8;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.toast__close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.toast__close svg { width: 16px; height: 16px; }

/* ── 9. Skeleton loaders ──────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--paper-4) 0%,
    var(--paper-3) 50%,
    var(--paper-4) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}

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

.skeleton-text { height: 0.9em; border-radius: var(--r-xs); }
.skeleton-title { height: 1.4em; border-radius: var(--r-xs); }
.skeleton-block { height: 100%; }
.skeleton-circle { border-radius: 50%; }

.skeleton-card {
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--paper);
}

.skeleton-card__media {
  aspect-ratio: 210 / 297;
  background: var(--paper-3);
}

.skeleton-card__body {
  padding: var(--s-4);
  display: grid;
  gap: 0.5rem;
}

/* ── 10. Tooltips (CSS only, aria-label driven) ───────────────────────── */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.65rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
}

.tooltip:hover::after,
.tooltip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (pointer: coarse) {
  .tooltip::after { display: none; }
}

/* ── 11. Breadcrumbs (already in layout, refined here) ────────────────── */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--y-700); }
.crumbs .sep { opacity: 0.5; }

/* ── 12. Empty states ─────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 5rem) var(--s-4);
  max-width: 460px;
  margin-inline: auto;
}

.empty__icon {
  width: 64px;
  height: 64px;
  margin-inline: auto;
  margin-bottom: var(--s-5);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--y-100);
  color: var(--y-800);
  border-radius: var(--r-lg);
}

.empty__icon svg { width: 30px; height: 30px; }

.empty h3 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--s-2);
}

.empty p {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  line-height: var(--lh-body);
  margin-bottom: var(--s-5);
}

/* ── 13. Avatar (interface, not resume) ───────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--y-100);
  color: var(--y-800);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  overflow: hidden;
  border: 1px solid var(--line);
}

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

.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-lg); }

/* ── 14. Progress bars ────────────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 8px;
  background: var(--paper-4);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--y-500), var(--y-600));
  border-radius: inherit;
  transition: width var(--t-slow);
}

.progress__label {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-2xs);
  color: var(--ink-3);
  margin-bottom: 0.4rem;
  font-weight: var(--fw-semibold);
}

/* ── 15. Notices / alerts ─────────────────────────────────────────────── */
.notice {
  display: flex;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.5;
  border: 1px solid var(--line-2);
  background: var(--paper-3);
  color: var(--ink-2);
}

.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.notice__body { min-width: 0; }
.notice__body strong { color: var(--ink); }

.notice-info { background: var(--info-bg); border-color: var(--info-line); color: #1E3A8A; }
.notice-info svg { color: var(--info); }

.notice-success { background: var(--success-bg); border-color: var(--success-line); color: #14532D; }
.notice-success svg { color: var(--success); }

.notice-warning { background: var(--warning-bg); border-color: var(--warning-line); color: #78350F; }
.notice-warning svg { color: var(--warning); }

.notice-danger { background: var(--danger-bg); border-color: var(--danger-line); color: #7F1D1D; }
.notice-danger svg { color: var(--danger); }

/* ── 16. Divider ──────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  color: var(--ink-4);
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: var(--ls-widest);
  font-weight: var(--fw-semibold);
  margin-block: var(--s-6);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-2);
}

/* ── 17. Load more / pagination ───────────────────────────────────────── */
.load-more {
  display: flex;
  justify-content: center;
  padding-block: var(--s-8) 0;
}

/* ── 18. Kbd shortcut hint ────────────────────────────────────────────── */
.shortcut {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--fs-2xs);
  color: var(--ink-3);
}

.shortcut kbd {
  font-size: 0.72em;
  padding: 0.15em 0.4em;
}

/* ── 19. Focus-visible override for interactive custom elements ──────── */
.chip:focus-visible,
.card-interactive:focus-visible,
.tab:focus-visible,
.btn:focus-visible,
.accordion__summary:focus-visible,
.check:has(input:focus-visible) {
  outline: 3px solid var(--y-500);
  outline-offset: 2px;
}

.check:has(input:focus-visible) {
  border-radius: var(--r-sm);
}