/* =========================================================================
   Advoke CV — Components
   Buttons, cards, forms, chips, badges, modals, toasts, accordions, tabs.
   All interactive states include :hover, :focus-visible, :active, :disabled.
   ========================================================================= */

/* =========================================================================
   BUTTONS
   ========================================================================= */

.btn {
  --btn-bg: var(--bg-surface);
  --btn-fg: var(--text-primary);
  --btn-border: var(--border-default);
  --btn-bg-hover: var(--bg-surface-alt);
  --btn-fg-hover: var(--text-primary);
  --btn-border-hover: var(--border-strong);
  --btn-shadow: var(--shadow-xs);
  --btn-shadow-hover: var(--shadow-sm);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  box-shadow: var(--btn-shadow);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}

@media (min-width: 768px) {
  .btn {
    min-height: 42px;
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
  }
}

.btn:hover {
  background: var(--btn-bg-hover);
  color: var(--btn-fg-hover);
  border-color: var(--btn-border-hover);
  box-shadow: var(--btn-shadow-hover);
  text-decoration: none;
}

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

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--btn-shadow);
  border-color: var(--btn-border-hover);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

/* Sizes */
.btn--xs {
  min-height: 32px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  gap: var(--space-1);
}

.btn--sm {
  min-height: 36px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn--lg {
  min-height: 50px;
  padding: var(--space-4) var(--space-7);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

@media (min-width: 768px) {
  .btn--lg {
    min-height: 54px;
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
  }
}

.btn--xl {
  min-height: 56px;
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
  font-weight: var(--weight-bold);
}

@media (min-width: 768px) {
  .btn--xl {
    min-height: 60px;
    padding: var(--space-5) var(--space-10);
    font-size: var(--text-lg);
  }
}

.btn--block {
  width: 100%;
}

.btn--icon {
  padding: var(--space-2);
  min-height: 40px;
  min-width: 40px;
}

.btn--icon.btn--sm {
  min-height: 32px;
  min-width: 32px;
  padding: var(--space-1);
}

/* Primary — brand yellow */
.btn--primary {
  --btn-bg: var(--brand-500);
  --btn-fg: var(--ink-950);
  --btn-border: var(--brand-500);
  --btn-bg-hover: var(--brand-400);
  --btn-fg-hover: var(--ink-950);
  --btn-border-hover: var(--brand-600);
  --btn-shadow: 0 2px 6px rgba(245, 197, 24, 0.35);
  --btn-shadow-hover: 0 6px 16px rgba(245, 197, 24, 0.45);
}

/* Secondary — dark navy */
.btn--secondary {
  --btn-bg: var(--ink-900);
  --btn-fg: var(--white);
  --btn-border: var(--ink-900);
  --btn-bg-hover: var(--ink-800);
  --btn-fg-hover: var(--white);
  --btn-border-hover: var(--ink-800);
  --btn-shadow: var(--shadow-sm);
  --btn-shadow-hover: var(--shadow-md);
}

/* Outline */
.btn--outline {
  --btn-bg: transparent;
  --btn-fg: var(--text-primary);
  --btn-border: var(--border-strong);
  --btn-bg-hover: var(--bg-brand-soft);
  --btn-fg-hover: var(--text-primary);
  --btn-border-hover: var(--brand-500);
}

/* Ghost */
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-secondary);
  --btn-border: transparent;
  --btn-bg-hover: var(--bg-surface-alt);
  --btn-fg-hover: var(--text-primary);
  --btn-border-hover: transparent;
  --btn-shadow: none;
  --btn-shadow-hover: none;
}

/* Danger */
.btn--danger {
  --btn-bg: var(--danger-500);
  --btn-fg: var(--white);
  --btn-border: var(--danger-500);
  --btn-bg-hover: var(--danger-700);
  --btn-fg-hover: var(--white);
  --btn-border-hover: var(--danger-700);
  --btn-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
  --btn-shadow-hover: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Danger ghost — destructive actions in cards/lists */
.btn--danger-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--danger-700);
  --btn-border: transparent;
  --btn-bg-hover: var(--danger-50);
  --btn-fg-hover: var(--danger-700);
  --btn-border-hover: transparent;
  --btn-shadow: none;
  --btn-shadow-hover: none;
}

/* Link-style button */
.btn--link {
  --btn-bg: transparent;
  --btn-fg: var(--text-brand);
  --btn-border: transparent;
  --btn-bg-hover: transparent;
  --btn-fg-hover: var(--brand-800);
  --btn-border-hover: transparent;
  --btn-shadow: none;
  --btn-shadow-hover: none;
  min-height: auto;
  padding: 0;
  border-radius: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Button group */
.btn-group {
  display: inline-flex;
  align-items: stretch;
}

.btn-group > .btn {
  border-radius: 0;
}

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

.btn-group > .btn:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.btn-group > .btn + .btn {
  margin-left: -1px;
}

/* =========================================================================
   CARDS
   ========================================================================= */

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-standard);
}

.card--interactive {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.card--interactive:hover {
  border-color: var(--border-brand);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.card--interactive:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--shadow-lg);
  border-color: var(--border-brand);
}

.card__body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1 1 auto;
}

@media (min-width: 768px) {
  .card__body {
    padding: var(--space-6);
  }
}

.card__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
}

.card__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.card__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--bg-surface-alt);
}

@media (min-width: 768px) {
  .card__footer {
    padding: var(--space-4) var(--space-6);
  }
}

/* =========================================================================
   BADGES & CHIPS
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-2);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-sunk);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  line-height: 1.4;
}

.badge--brand {
  background: var(--bg-brand-soft);
  color: var(--brand-800);
  border-color: var(--brand-200);
}

.badge--dark {
  background: var(--ink-900);
  color: var(--white);
  border-color: var(--ink-900);
}

.badge--success {
  background: var(--success-50);
  color: var(--success-700);
  border-color: rgba(16, 185, 129, 0.25);
}

.badge--warning {
  background: var(--warning-50);
  color: var(--warning-700);
  border-color: rgba(245, 158, 11, 0.25);
}

.badge--danger {
  background: var(--danger-50);
  color: var(--danger-700);
  border-color: rgba(239, 68, 68, 0.25);
}

.badge--info {
  background: var(--info-50);
  color: var(--info-700);
  border-color: rgba(59, 130, 246, 0.25);
}

/* Chips — filter pills */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}

.chip:hover {
  background: var(--bg-brand-soft);
  color: var(--text-primary);
  border-color: var(--brand-300);
}

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

.chip[aria-pressed='true'],
.chip[data-active='true'] {
  background: var(--brand-500);
  color: var(--ink-950);
  border-color: var(--brand-600);
  font-weight: var(--weight-semibold);
}

.chip__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  border-radius: var(--radius-full);
  background: var(--bg-surface-sunk);
  color: var(--text-tertiary);
}

.chip[aria-pressed='true'] .chip__count,
.chip[data-active='true'] .chip__count {
  background: rgba(11, 18, 32, 0.15);
  color: var(--ink-950);
}

/* =========================================================================
   FORM CONTROLS
   ========================================================================= */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.field__label-req {
  color: var(--danger-500);
  font-weight: var(--weight-bold);
}

.field__help {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-snug);
}

.field__error {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--danger-700);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.field__counter {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.field__counter[data-warn='true'] {
  color: var(--warning-700);
}

.field__counter[data-over='true'] {
  color: var(--danger-700);
  font-weight: var(--weight-semibold);
}

/* Input, textarea, select */
.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-inset);
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard),
              background var(--duration-fast) var(--ease-standard);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-tertiary);
  opacity: 1;
}

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

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-200);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  background: var(--bg-surface-sunk);
}

.input[aria-invalid='true'],
.textarea[aria-invalid='true'],
.select[aria-invalid='true'] {
  border-color: var(--danger-500);
}

.input[aria-invalid='true']:focus,
.textarea[aria-invalid='true']:focus,
.select[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.textarea {
  min-height: 6rem;
  line-height: var(--leading-normal);
  resize: vertical;
}

.textarea--tall {
  min-height: 10rem;
}

.select {
  padding-right: var(--space-10);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2357648a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 16px;
  cursor: pointer;
}

/* Checkbox / radio */
.checkbox,
.radio {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: var(--leading-snug);
  padding: var(--space-1) 0;
  min-height: 32px;
}

.checkbox input,
.radio input {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--border-strong);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
  display: grid;
  place-content: center;
}

.radio input {
  border-radius: var(--radius-full);
}

.checkbox input::before {
  content: '';
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform var(--duration-fast) var(--ease-spring);
  background: var(--white);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.radio input::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  transform: scale(0);
  transition: transform var(--duration-fast) var(--ease-spring);
  background: var(--white);
}

.checkbox input:checked,
.radio input:checked {
  background: var(--brand-500);
  border-color: var(--brand-600);
}

.checkbox input:checked::before,
.radio input:checked::before {
  transform: scale(1);
}

.checkbox input:focus-visible,
.radio input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Toggle switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  min-height: 40px;
}

.switch__track {
  position: relative;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: background var(--duration-base) var(--ease-standard);
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-spring);
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch input:checked + .switch__track {
  background: var(--brand-500);
}

.switch input:checked + .switch__track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch__track {
  box-shadow: var(--focus-ring);
}

/* Color swatch picker */
.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.swatch {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-default);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}

.swatch:hover {
  transform: scale(1.08);
}

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

.swatch[aria-pressed='true'] {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--text-primary);
}

/* =========================================================================
   ACCORDION
   ========================================================================= */

.accordion {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-subtle);
}

.accordion__item {
  border-bottom: 1px solid var(--border-subtle);
}

.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-5) var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-standard),
              background var(--duration-fast) var(--ease-standard);
  min-height: 56px;
}

@media (min-width: 768px) {
  .accordion__trigger {
    padding: var(--space-6) var(--space-3);
    font-size: var(--text-lg);
  }
}

.accordion__trigger:hover {
  color: var(--text-brand);
  background: var(--bg-brand-soft);
}

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

.accordion__icon {
  flex-shrink: 0;
  color: var(--brand-600);
  transition: transform var(--duration-base) var(--ease-standard);
}

.accordion__trigger[aria-expanded='true'] .accordion__icon {
  transform: rotate(180deg);
}

.accordion__panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--duration-slow) var(--ease-decelerate);
}

.accordion__panel[data-open='true'] {
  max-height: 2000px;
}

.accordion__content {
  padding: 0 var(--space-2) var(--space-6);
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 78ch;
}

@media (min-width: 768px) {
  .accordion__content {
    padding: 0 var(--space-3) var(--space-7);
  }
}

.accordion__content p + p {
  margin-top: var(--space-4);
}

/* =========================================================================
   TABS
   ========================================================================= */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}

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

.tab {
  position: relative;
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: color var(--duration-fast) var(--ease-standard);
}

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

.tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.tab[aria-selected='true'] {
  color: var(--text-primary);
}

.tab[aria-selected='true']::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand-500);
  border-radius: var(--radius-full);
}

/* =========================================================================
   MODAL / DIALOG
   ========================================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--bg-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  animation: fadeIn var(--duration-base) var(--ease-standard) forwards;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: var(--space-6);
  }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  background: var(--bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  animation: slideUp var(--duration-slow) var(--ease-decelerate) forwards;
}

@media (min-width: 640px) {
  .modal {
    border-radius: var(--radius-xl);
    transform: scale(0.96);
    animation: popIn var(--duration-slow) var(--ease-decelerate) forwards;
  }
}

@keyframes slideUp {
  to { transform: translateY(0); }
}

@keyframes popIn {
  to { transform: scale(1); }
}

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

@media (min-width: 640px) {
  .modal__head {
    padding: var(--space-6) var(--space-6) var(--space-5);
  }
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}

.modal__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-2);
  line-height: var(--leading-relaxed);
}

.modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  transition: background var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}

.modal__close:hover {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
}

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

.modal__body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1 1 auto;
}

@media (min-width: 640px) {
  .modal__body {
    padding: var(--space-6);
  }
}

.modal__foot {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-alt);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .modal__foot {
    padding: var(--space-5) var(--space-6);
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
  }
}

/* =========================================================================
   TOAST
   ========================================================================= */

.toast-host {
  position: fixed;
  bottom: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 640px) {
  .toast-host {
    left: auto;
    right: var(--space-6);
    bottom: var(--space-6);
    max-width: 400px;
  }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--brand-500);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: toastIn var(--duration-slow) var(--ease-decelerate) forwards;
  transform: translateY(20px);
  opacity: 0;
}

@keyframes toastIn {
  to { transform: translateY(0); opacity: 1; }
}

.toast[data-leaving='true'] {
  animation: toastOut var(--duration-base) var(--ease-accelerate) forwards;
}

@keyframes toastOut {
  to { transform: translateY(10px); opacity: 0; }
}

.toast__icon {
  flex-shrink: 0;
  color: var(--brand-600);
  margin-top: 2px;
}

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

.toast__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.toast__msg {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  line-height: var(--leading-snug);
}

.toast__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: background var(--duration-fast) var(--ease-standard);
}

.toast__close:hover {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
}

.toast[data-type='success'] { border-left-color: var(--success-500); }
.toast[data-type='success'] .toast__icon { color: var(--success-700); }

.toast[data-type='warning'] { border-left-color: var(--warning-500); }
.toast[data-type='warning'] .toast__icon { color: var(--warning-700); }

.toast[data-type='error'] { border-left-color: var(--danger-500); }
.toast[data-type='error'] .toast__icon { color: var(--danger-700); }

.toast[data-type='info'] { border-left-color: var(--info-500); }
.toast[data-type='info'] .toast__icon { color: var(--info-700); }

/* =========================================================================
   SKELETON
   ========================================================================= */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface-sunk);
  border-radius: var(--radius-md);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.55),
    transparent
  );
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none;
  }
}

.skeleton--text { height: 12px; border-radius: var(--radius-sm); }
.skeleton--title { height: 20px; width: 60%; }
.skeleton--thumb { aspect-ratio: 210 / 297; border-radius: var(--radius-lg); }

/* =========================================================================
   EMPTY STATE
   ========================================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
}

.empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--bg-brand-soft);
  color: var(--brand-700);
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.empty-state__msg {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 44ch;
  line-height: var(--leading-relaxed);
}

/* =========================================================================
   PROGRESS BAR
   ========================================================================= */

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

.progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-decelerate);
}

/* =========================================================================
   TOOLTIP (CSS-only on hover/focus)
   ========================================================================= */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--white);
  background: var(--ink-900);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
  z-index: var(--z-dropdown);
  box-shadow: var(--shadow-lg);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}

@media (max-width: 767px) {
  [data-tooltip]::after {
    display: none;
  }
}

/* =========================================================================
   LOADING SPINNER
   ========================================================================= */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-default);
  border-top-color: var(--brand-500);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

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

.spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* =========================================================================
   DIVIDER WITH LABEL
   ========================================================================= */

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  margin: var(--space-6) 0;
}

.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--border-subtle);
}

/* =========================================================================
   PAGINATION
   ========================================================================= */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-8);
}

.pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}

.pagination__btn:hover {
  background: var(--bg-brand-soft);
  color: var(--text-primary);
  border-color: var(--border-brand);
}

.pagination__btn[aria-current='page'] {
  background: var(--brand-500);
  color: var(--ink-950);
  border-color: var(--brand-600);
}

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

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

/* =========================================================================
   SEARCH INPUT (with icon)
   ========================================================================= */

.search {
  position: relative;
  width: 100%;
}

.search__icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.search__input {
  width: 100%;
  min-height: 46px;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-12);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-inset);
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}

.search__input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-200);
}

.search__clear {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: background var(--duration-fast) var(--ease-standard);
}

.search__clear:hover {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
}

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

/* =========================================================================
   DROPDOWN
   ========================================================================= */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 200px;
  padding: var(--space-2);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--duration-fast) var(--ease-standard),
              visibility var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}

.dropdown[data-open='true'] .dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  min-height: 40px;
  transition: background var(--duration-fast) var(--ease-standard);
}

.dropdown__item:hover {
  background: var(--bg-brand-soft);
}

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

.dropdown__item--danger {
  color: var(--danger-700);
}

.dropdown__item--danger:hover {
  background: var(--danger-50);
}

.dropdown__divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-1) 0;
}