/* AugRank — Atlas component library (S-D1)
 *
 * The reusable layer. Every screen from S-D2 onward imports this file rather
 * than restyling; if a screen needs a new visual, it belongs here first.
 *
 * Load order:  tokens/approved.css  ->  atlas/components.css  ->  page styles
 *
 * Rules this file obeys:
 *  - No literal colours, sizes, or radii. Everything resolves to a token.
 *  - Every component that can be empty, loading, or failing has all three
 *    states defined here, not improvised per screen.
 *  - Focus is always visible and always uses --ar-shadow-focus.
 *  - Anything that conveys state carries an icon or text, never colour alone.
 */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ar-bg);
  color: var(--ar-text);
  font-family: var(--ar-font-body);
  font-size: var(--ar-text-body-size);
  line-height: var(--ar-text-body-lh);
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: none; box-shadow: var(--ar-shadow-focus); border-radius: var(--ar-radius-md); }

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

.ar-display, .ar-h1, .ar-h2 { font-family: var(--ar-font-display); }
.ar-display { font-size: var(--ar-text-display-lg-size); line-height: var(--ar-text-display-lg-lh); letter-spacing: var(--ar-text-display-lg-ls); font-weight: var(--ar-text-display-lg-weight); margin: 0; }
.ar-h1 { font-size: var(--ar-text-h1-size); line-height: var(--ar-text-h1-lh); letter-spacing: var(--ar-text-h1-ls); font-weight: var(--ar-text-h1-weight); margin: 0; }
.ar-h2 { font-size: var(--ar-text-h2-size); line-height: var(--ar-text-h2-lh); letter-spacing: var(--ar-text-h2-ls); font-weight: var(--ar-text-h2-weight); margin: 0; }
.ar-h3 { font-size: var(--ar-text-h3-size); line-height: var(--ar-text-h3-lh); font-weight: var(--ar-text-h3-weight); margin: 0; }
.ar-muted { color: var(--ar-text-muted); }
.ar-subtle { color: var(--ar-text-subtle); }
.ar-mono { font-family: var(--ar-font-mono); font-variant-numeric: tabular-nums; }
.ar-num { font-variant-numeric: tabular-nums; }

.ar-link { color: var(--ar-brand-ink); text-underline-offset: 2px; }
.ar-link:hover { text-decoration-thickness: 2px; }

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

.ar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--ar-space-2);
  height: var(--ar-control-md); padding: 0 var(--ar-space-5);
  font-family: inherit; font-size: var(--ar-text-body-size); font-weight: 700;
  border-radius: var(--ar-radius-full);
  border: var(--ar-stroke-hairline) solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap; position: relative;
  transition: background-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.ar-btn:disabled, .ar-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none !important; }

.ar-btn--primary { background: var(--ar-primary); color: var(--ar-on-primary); border-color: var(--ar-primary-border); box-shadow: var(--ar-shadow-sm); }
.ar-btn--primary:hover:not(:disabled) { background: var(--ar-primary-hover); transform: translateY(-1px); box-shadow: var(--ar-shadow-md); }
.ar-btn--primary:active:not(:disabled) { background: var(--ar-primary-active); transform: none; }

.ar-btn--secondary { background: var(--ar-secondary); color: var(--ar-on-secondary); }
.ar-btn--secondary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--ar-shadow-md); }

.ar-btn--ghost { background: var(--ar-surface); color: var(--ar-text); border-color: var(--ar-border-strong); }
.ar-btn--ghost:hover:not(:disabled) { background: var(--ar-surface-inset); }

.ar-btn--quiet { background: transparent; color: var(--ar-text-muted); }
.ar-btn--quiet:hover:not(:disabled) { background: var(--ar-surface-inset); color: var(--ar-text); }

/* Destructive actions are never the visual default — they must be chosen. */
.ar-btn--danger { background: var(--ar-danger); color: var(--ar-n-25); }
.ar-btn--danger:hover:not(:disabled) { filter: brightness(.92); }

.ar-btn--sm { height: var(--ar-control-sm); padding: 0 var(--ar-space-4); font-size: var(--ar-text-body-sm-size); }
.ar-btn--lg { height: var(--ar-control-lg); padding: 0 var(--ar-space-6); font-size: var(--ar-text-body-lg-size); }
.ar-btn--icon { width: var(--ar-control-md); padding: 0; }
.ar-btn--icon.ar-btn--sm { width: var(--ar-control-sm); }
.ar-btn--block { width: 100%; }

/* Loading keeps the button's width so the layout never jumps mid-submit. */
.ar-btn[data-loading="true"] { color: transparent !important; pointer-events: none; }
.ar-btn[data-loading="true"]::after {
  content: ''; position: absolute; width: 1em; height: 1em;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: var(--ar-radius-full); animation: ar-spin .7s linear infinite;
  color: var(--ar-on-primary);
}
.ar-btn--ghost[data-loading="true"]::after, .ar-btn--quiet[data-loading="true"]::after { color: var(--ar-text); }
@keyframes ar-spin { to { transform: rotate(360deg); } }

.ar-btn-group { display: inline-flex; gap: var(--ar-space-2); flex-wrap: wrap; align-items: center; }

/* ─── Forms ───────────────────────────────────────────────────────────── */

.ar-field { display: grid; gap: var(--ar-space-2); }
.ar-field__label { font-weight: 600; font-size: var(--ar-text-label-size); color: var(--ar-text); }
.ar-field__label .ar-req { color: var(--ar-danger); margin-left: 2px; }
.ar-field__optional { color: var(--ar-text-subtle); font-weight: 400; }

.ar-input, .ar-select, .ar-textarea {
  width: 100%; font-family: inherit; font-size: var(--ar-text-body-size);
  color: var(--ar-text); background: var(--ar-surface);
  border: var(--ar-stroke-hairline) solid var(--ar-border-strong);
  border-radius: var(--ar-radius-lg);
  padding: 0 var(--ar-space-4); height: var(--ar-control-md);
  transition: border-color .12s ease;
}
.ar-textarea { height: auto; min-height: 6rem; padding: var(--ar-space-3) var(--ar-space-4); line-height: var(--ar-text-body-lh); resize: vertical; }
.ar-input::placeholder, .ar-textarea::placeholder { color: var(--ar-text-subtle); }
.ar-input:hover, .ar-select:hover, .ar-textarea:hover { border-color: var(--ar-text-subtle); }
.ar-input:disabled, .ar-select:disabled, .ar-textarea:disabled { background: var(--ar-surface-inset); color: var(--ar-text-subtle); cursor: not-allowed; }
.ar-input[readonly] { background: var(--ar-surface-inset); }

.ar-select {
  appearance: none; padding-right: var(--ar-space-10);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right var(--ar-space-5) center, right var(--ar-space-4) center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

/* Validity is announced by border + icon + message, never by colour alone. */
.ar-field[data-state="invalid"] .ar-input,
.ar-field[data-state="invalid"] .ar-select,
.ar-field[data-state="invalid"] .ar-textarea { border-color: var(--ar-danger); border-width: var(--ar-stroke-strong); }
.ar-field[data-state="valid"] .ar-input { border-color: var(--ar-success); }

.ar-field__help { font-size: var(--ar-text-body-sm-size); color: var(--ar-text-subtle); }
.ar-field__error {
  display: flex; align-items: flex-start; gap: var(--ar-space-2);
  font-size: var(--ar-text-body-sm-size); color: var(--ar-danger); font-weight: 600;
}
.ar-field__ok { display: flex; align-items: center; gap: var(--ar-space-2); font-size: var(--ar-text-body-sm-size); color: var(--ar-success); font-weight: 600; }

.ar-input-group { display: flex; }
.ar-input-group .ar-input { border-radius: var(--ar-radius-lg) 0 0 var(--ar-radius-lg); }
.ar-input-group__addon {
  display: inline-flex; align-items: center; padding: 0 var(--ar-space-4);
  background: var(--ar-surface-inset); color: var(--ar-text-muted);
  border: var(--ar-stroke-hairline) solid var(--ar-border-strong); border-left: 0;
  border-radius: 0 var(--ar-radius-lg) var(--ar-radius-lg) 0;
  font-size: var(--ar-text-body-sm-size); white-space: nowrap;
}

/* Choice controls. Hit target stays >=44px even though the box is smaller. */
.ar-choice { display: flex; align-items: flex-start; gap: var(--ar-space-3); cursor: pointer; padding: var(--ar-space-2) 0; }
.ar-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ar-choice__box {
  flex: none; width: 1.25rem; height: 1.25rem; margin-top: .125rem;
  border: var(--ar-stroke-strong) solid var(--ar-border-strong);
  border-radius: var(--ar-radius-sm); background: var(--ar-surface);
  display: grid; place-items: center; transition: background-color .12s ease, border-color .12s ease;
}
.ar-choice--radio .ar-choice__box { border-radius: var(--ar-radius-full); }
.ar-choice input:checked + .ar-choice__box { background: var(--ar-primary); border-color: var(--ar-primary-border); }
.ar-choice input:checked + .ar-choice__box::after {
  content: ''; width: .5rem; height: .5rem; border-radius: var(--ar-radius-full); background: var(--ar-on-primary);
}
.ar-choice--check input:checked + .ar-choice__box::after {
  content: ''; width: .375rem; height: .6875rem; border-radius: 0; background: none;
  border: solid var(--ar-on-primary); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px);
}
.ar-choice input:focus-visible + .ar-choice__box { box-shadow: var(--ar-shadow-focus); }
.ar-choice input:disabled + .ar-choice__box { opacity: .5; }
.ar-choice__text { font-size: var(--ar-text-body-size); }
.ar-choice__desc { display: block; font-size: var(--ar-text-body-sm-size); color: var(--ar-text-subtle); }

.ar-switch { display: inline-flex; align-items: center; gap: var(--ar-space-3); cursor: pointer; }
.ar-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ar-switch__track {
  width: 2.75rem; height: 1.5rem; border-radius: var(--ar-radius-full);
  background: var(--ar-n-400); position: relative; transition: background-color .15s ease; flex: none;
}
.ar-switch__track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 1.125rem; height: 1.125rem;
  border-radius: var(--ar-radius-full); background: var(--ar-n-25);
  box-shadow: var(--ar-shadow-sm); transition: transform .15s ease;
}
.ar-switch input:checked + .ar-switch__track { background: var(--ar-primary); }
.ar-switch input:checked + .ar-switch__track::after { transform: translateX(1.25rem); }
.ar-switch input:focus-visible + .ar-switch__track { box-shadow: var(--ar-shadow-focus); }
.ar-switch input:disabled + .ar-switch__track { opacity: .5; }

/* Form-level error summary — focus lands here on failed submit. */
.ar-form-summary {
  border: var(--ar-stroke-strong) solid var(--ar-danger);
  background: var(--ar-danger-bg); color: var(--ar-danger);
  border-radius: var(--ar-radius-lg); padding: var(--ar-space-4) var(--ar-space-5);
}
.ar-form-summary h3 { margin: 0 0 var(--ar-space-2); font-size: var(--ar-text-body-size); }
.ar-form-summary ul { margin: 0; padding-left: var(--ar-space-5); font-size: var(--ar-text-body-sm-size); }

/* ─── Surfaces ────────────────────────────────────────────────────────── */

.ar-card {
  background: var(--ar-surface); border: var(--ar-stroke-hairline) solid var(--ar-border);
  border-radius: var(--ar-radius-xl); box-shadow: var(--ar-shadow-sm);
}
.ar-card__header {
  display: flex; align-items: center; gap: var(--ar-space-4);
  padding: var(--ar-space-5) var(--ar-space-6);
  border-bottom: var(--ar-stroke-hairline) solid var(--ar-border);
}
.ar-card__header h3 { margin: 0; font-family: var(--ar-font-display); font-size: var(--ar-text-h3-size); font-weight: 700; }
.ar-card__spacer { margin-left: auto; }
.ar-card__body { padding: var(--ar-space-6); }
.ar-card__footer { padding: var(--ar-space-5) var(--ar-space-6); border-top: var(--ar-stroke-hairline) solid var(--ar-border); display: flex; gap: var(--ar-space-3); align-items: center; }

.ar-panel { background: var(--ar-surface-inset); border-radius: var(--ar-radius-lg); padding: var(--ar-space-5); }

/* ─── Badges, pills, avatars ──────────────────────────────────────────── */

.ar-badge {
  display: inline-flex; align-items: center; gap: var(--ar-space-2);
  padding: var(--ar-space-1) var(--ar-space-3); border-radius: var(--ar-radius-full);
  font-size: var(--ar-text-body-sm-size); font-weight: 600; white-space: nowrap;
}
.ar-badge--neutral { background: var(--ar-surface-inset); color: var(--ar-text-muted); }
.ar-badge--success { background: var(--ar-success-bg); color: var(--ar-success); }
.ar-badge--warning { background: var(--ar-warning-bg); color: var(--ar-warning); }
.ar-badge--danger  { background: var(--ar-danger-bg);  color: var(--ar-danger); }
.ar-badge--info    { background: var(--ar-info-bg);    color: var(--ar-info); }
.ar-badge--brand   { background: var(--ar-primary); color: var(--ar-on-primary); }

.ar-avatar {
  width: 2.25rem; height: 2.25rem; border-radius: var(--ar-radius-full);
  background: var(--ar-secondary); color: var(--ar-on-secondary);
  display: grid; place-items: center; font-weight: 700; font-size: var(--ar-text-body-sm-size); flex: none;
}
.ar-avatar--sm { width: 1.75rem; height: 1.75rem; font-size: var(--ar-text-caption-size); }

.ar-meter { height: .5rem; background: var(--ar-surface-inset); border-radius: var(--ar-radius-full); overflow: hidden; }
.ar-meter__fill { height: 100%; background: var(--ar-primary); border-radius: var(--ar-radius-full); }
.ar-meter--over .ar-meter__fill { background: var(--ar-danger); }

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

.ar-alert {
  display: flex; gap: var(--ar-space-3); align-items: flex-start;
  padding: var(--ar-space-4) var(--ar-space-5); border-radius: var(--ar-radius-lg);
  border: var(--ar-stroke-hairline) solid transparent; font-size: var(--ar-text-body-sm-size);
}
.ar-alert__icon { flex: none; font-weight: 700; }
.ar-alert__body { flex: 1; }
.ar-alert__body strong { display: block; margin-bottom: 2px; }
.ar-alert--success { background: var(--ar-success-bg); color: var(--ar-success); border-color: currentColor; }
.ar-alert--warning { background: var(--ar-warning-bg); color: var(--ar-warning); border-color: currentColor; }
.ar-alert--danger  { background: var(--ar-danger-bg);  color: var(--ar-danger);  border-color: currentColor; }
.ar-alert--info    { background: var(--ar-info-bg);    color: var(--ar-info);    border-color: currentColor; }

/* ─── Tabs ────────────────────────────────────────────────────────────── */

.ar-tabs { display: flex; gap: var(--ar-space-1); border-bottom: var(--ar-stroke-hairline) solid var(--ar-border); overflow-x: auto; }
.ar-tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: var(--ar-text-body-size); font-weight: 600;
  color: var(--ar-text-muted); padding: var(--ar-space-3) var(--ar-space-4);
  border-bottom: var(--ar-stroke-rule) solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.ar-tab:hover { color: var(--ar-text); }
.ar-tab[aria-selected="true"] { color: var(--ar-text); border-bottom-color: var(--ar-primary); }
.ar-tab__count { color: var(--ar-text-subtle); font-size: var(--ar-text-caption-size); margin-left: var(--ar-space-2); }
.ar-tabpanel { padding-top: var(--ar-space-5); }
.ar-tabpanel[hidden] { display: none; }

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

.ar-table-wrap { overflow-x: auto; }
.ar-table { width: 100%; border-collapse: collapse; font-size: var(--ar-text-body-sm-size); }
.ar-table th, .ar-table td { text-align: left; padding: var(--ar-space-4) var(--ar-space-5); border-bottom: var(--ar-stroke-hairline) solid var(--ar-border); }
.ar-table thead th {
  font-size: var(--ar-text-label-size); font-weight: 600; color: var(--ar-text-muted);
  background: var(--ar-surface-inset); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.ar-table tbody tr:last-child td { border-bottom: 0; }
.ar-table tbody tr:hover { background: var(--ar-surface-inset); }
.ar-table td.ar-num, .ar-table th.ar-num { text-align: right; font-variant-numeric: tabular-nums; }

.ar-sort {
  appearance: none; background: none; border: 0; cursor: pointer; padding: 0;
  font: inherit; color: inherit; display: inline-flex; align-items: center; gap: var(--ar-space-2);
}
.ar-sort__arrow { color: var(--ar-text-subtle); font-size: .75em; }
.ar-sort[aria-sort="ascending"] .ar-sort__arrow,
.ar-sort[aria-sort="descending"] .ar-sort__arrow { color: var(--ar-brand-ink); }

.ar-table-toolbar { display: flex; gap: var(--ar-space-3); align-items: center; flex-wrap: wrap; padding: var(--ar-space-4) var(--ar-space-5); border-bottom: var(--ar-stroke-hairline) solid var(--ar-border); }
.ar-table-toolbar .ar-input { max-width: 20rem; height: var(--ar-control-sm); }

.ar-pagination { display: flex; align-items: center; gap: var(--ar-space-3); padding: var(--ar-space-4) var(--ar-space-5); border-top: var(--ar-stroke-hairline) solid var(--ar-border); flex-wrap: wrap; }
.ar-pagination__info { color: var(--ar-text-subtle); font-size: var(--ar-text-body-sm-size); margin-right: auto; }

/* ─── The three states, defined once ──────────────────────────────────── */

/* Empty — never a bare "no data". It says what would be here and how to get it. */
.ar-empty { text-align: center; padding: var(--ar-space-12) var(--ar-space-6); display: grid; gap: var(--ar-space-3); justify-items: center; }
.ar-empty__icon { width: 3rem; height: 3rem; border-radius: var(--ar-radius-full); background: var(--ar-surface-inset); display: grid; place-items: center; color: var(--ar-text-subtle); font-size: 1.25rem; }
.ar-empty__title { font-family: var(--ar-font-display); font-size: var(--ar-text-h3-size); font-weight: 700; }
.ar-empty__body { color: var(--ar-text-muted); max-width: 42ch; font-size: var(--ar-text-body-sm-size); }

/* Error — states what failed, and always offers a way forward. */
.ar-error-state { text-align: center; padding: var(--ar-space-12) var(--ar-space-6); display: grid; gap: var(--ar-space-3); justify-items: center; }
.ar-error-state__icon { width: 3rem; height: 3rem; border-radius: var(--ar-radius-full); background: var(--ar-danger-bg); color: var(--ar-danger); display: grid; place-items: center; font-size: 1.25rem; font-weight: 700; }
.ar-error-state__title { font-family: var(--ar-font-display); font-size: var(--ar-text-h3-size); font-weight: 700; }
.ar-error-state__body { color: var(--ar-text-muted); max-width: 46ch; font-size: var(--ar-text-body-sm-size); }
.ar-error-state__detail { font-family: var(--ar-font-mono); font-size: var(--ar-text-caption-size); color: var(--ar-text-subtle); background: var(--ar-surface-inset); padding: var(--ar-space-2) var(--ar-space-3); border-radius: var(--ar-radius-md); }

/* Loading — skeletons mirror the shape of what is coming, so nothing reflows. */
.ar-skeleton {
  background: linear-gradient(90deg, var(--ar-surface-inset) 25%, var(--ar-border) 37%, var(--ar-surface-inset) 63%);
  background-size: 400% 100%; animation: ar-shimmer 1.4s ease infinite;
  border-radius: var(--ar-radius-md); height: 1rem;
}
.ar-skeleton--text { height: .875rem; }
.ar-skeleton--title { height: 1.5rem; width: 40%; }
.ar-skeleton--circle { border-radius: var(--ar-radius-full); }
@keyframes ar-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.ar-spinner {
  width: 1.25rem; height: 1.25rem; border: 2px solid var(--ar-border-strong);
  border-top-color: var(--ar-brand-ink); border-radius: var(--ar-radius-full);
  animation: ar-spin .7s linear infinite; display: inline-block;
}

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

.ar-modal[hidden], .ar-drawer[hidden] { display: none; }
.ar-modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgb(0 0 0 / .5); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: var(--ar-space-4);
}
.ar-modal__panel {
  background: var(--ar-surface); border-radius: var(--ar-radius-2xl);
  box-shadow: var(--ar-shadow-lg); width: min(34rem, 100%);
  max-height: calc(100vh - var(--ar-space-8)); overflow: auto;
  border: var(--ar-stroke-hairline) solid var(--ar-border);
}
.ar-modal__header { padding: var(--ar-space-6) var(--ar-space-6) 0; display: flex; align-items: flex-start; gap: var(--ar-space-4); }
.ar-modal__header h2 { margin: 0; font-family: var(--ar-font-display); font-size: var(--ar-text-h2-size); font-weight: 700; }
.ar-modal__body { padding: var(--ar-space-5) var(--ar-space-6); color: var(--ar-text-muted); }
.ar-modal__footer { padding: var(--ar-space-5) var(--ar-space-6) var(--ar-space-6); display: flex; gap: var(--ar-space-3); justify-content: flex-end; flex-wrap: wrap; }

/* ─── Drawer ──────────────────────────────────────────────────────────── */

.ar-drawer { position: fixed; inset: 0; z-index: 100; background: rgb(0 0 0 / .5); }
.ar-drawer__panel {
  position: absolute; inset: 0 0 0 auto; width: min(30rem, 100%);
  background: var(--ar-surface); box-shadow: var(--ar-shadow-lg);
  display: flex; flex-direction: column;
  border-left: var(--ar-stroke-hairline) solid var(--ar-border);
}
.ar-drawer__header { padding: var(--ar-space-5) var(--ar-space-6); border-bottom: var(--ar-stroke-hairline) solid var(--ar-border); display: flex; align-items: center; gap: var(--ar-space-4); }
.ar-drawer__header h2 { margin: 0; font-family: var(--ar-font-display); font-size: var(--ar-text-h3-size); font-weight: 700; }
.ar-drawer__body { padding: var(--ar-space-6); overflow: auto; flex: 1; }
.ar-drawer__footer { padding: var(--ar-space-5) var(--ar-space-6); border-top: var(--ar-stroke-hairline) solid var(--ar-border); display: flex; gap: var(--ar-space-3); }

/* ─── Toasts ──────────────────────────────────────────────────────────── */

.ar-toasts {
  position: fixed; z-index: 200; bottom: var(--ar-space-6); right: var(--ar-space-6);
  display: grid; gap: var(--ar-space-3); width: min(24rem, calc(100vw - var(--ar-space-8)));
}
.ar-toast {
  display: flex; gap: var(--ar-space-3); align-items: flex-start;
  background: var(--ar-surface); border: var(--ar-stroke-hairline) solid var(--ar-border);
  border-left: var(--ar-stroke-rule) solid var(--ar-text-subtle);
  border-radius: var(--ar-radius-lg); box-shadow: var(--ar-shadow-lg);
  padding: var(--ar-space-4); font-size: var(--ar-text-body-sm-size);
  animation: ar-toast-in .18s ease;
}
.ar-toast--success { border-left-color: var(--ar-success); }
.ar-toast--warning { border-left-color: var(--ar-warning); }
.ar-toast--danger  { border-left-color: var(--ar-danger); }
.ar-toast--info    { border-left-color: var(--ar-info); }
.ar-toast__body { flex: 1; }
.ar-toast__body strong { display: block; }
.ar-toast__body span { color: var(--ar-text-muted); }
@keyframes ar-toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ─── Tooltip ─────────────────────────────────────────────────────────── */

.ar-tip { position: relative; display: inline-flex; }
.ar-tip__bubble {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ar-secondary); color: var(--ar-on-secondary);
  padding: var(--ar-space-2) var(--ar-space-3); border-radius: var(--ar-radius-md);
  font-size: var(--ar-text-caption-size); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .12s ease; z-index: 10;
}
.ar-tip:hover .ar-tip__bubble, .ar-tip:focus-within .ar-tip__bubble { opacity: 1; }

/* ─── Breadcrumb ──────────────────────────────────────────────────────── */

.ar-crumbs { display: flex; gap: var(--ar-space-2); align-items: center; font-size: var(--ar-text-body-sm-size); color: var(--ar-text-subtle); flex-wrap: wrap; }
.ar-crumbs a { color: var(--ar-text-muted); text-decoration: none; }
.ar-crumbs a:hover { color: var(--ar-text); text-decoration: underline; }
.ar-crumbs [aria-current] { color: var(--ar-text); font-weight: 700; }

/* ─── Layout helpers ──────────────────────────────────────────────────── */

.ar-stack { display: grid; gap: var(--ar-space-4); }
.ar-stack--tight { gap: var(--ar-space-2); }
.ar-stack--loose { gap: var(--ar-space-6); }
.ar-row { display: flex; gap: var(--ar-space-3); align-items: center; flex-wrap: wrap; }
.ar-grid { display: grid; gap: var(--ar-space-5); }
.ar-grid--2 { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.ar-grid--3 { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.ar-grid--4 { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }

.ar-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ─── Responsive ──────────────────────────────────────────────────────── */
/* Breakpoints match the token set: sm 640 · md 768 · lg 1024 · xl 1280 · 2xl 1536.
   Only two need component-level rules — below md the app collapses to a single
   column, and below sm controls go full-width so they stay tappable. */

@media (max-width: 767px) {
  .ar-card__header, .ar-card__body, .ar-card__footer { padding-left: var(--ar-space-4); padding-right: var(--ar-space-4); }
  .ar-table th, .ar-table td { padding: var(--ar-space-3) var(--ar-space-4); }
  .ar-modal__panel { width: 100%; }
  .ar-toasts { left: var(--ar-space-4); right: var(--ar-space-4); width: auto; }
}
@media (max-width: 639px) {
  .ar-btn { width: 100%; }
  .ar-btn--icon, .ar-btn-group .ar-btn--icon { width: var(--ar-control-md); }
  .ar-modal__footer .ar-btn, .ar-drawer__footer .ar-btn { width: 100%; }
  .ar-grid--2, .ar-grid--3, .ar-grid--4 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
