/* ============================================================
   ZynxTech components — Linear/Vercel/Shadcn-minimal primitives
   ============================================================ */

/* ----- LAYOUT ------------------------------------------------ */
.container {
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
  width: 100%;
}
.container--narrow { max-width: var(--container-md); }
.container--wide   { max-width: var(--container-2xl); }

.main {
  min-height: calc(100vh - var(--nav-height) - 120px);
}

/* ----- ICONS ------------------------------------------------- */
.icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  pointer-events: none;
}
.icon--12 { width: 12px; height: 12px; }
.icon--14 { width: 14px; height: 14px; }
.icon--16 { width: 16px; height: 16px; }
.icon--18 { width: 18px; height: 18px; }
.icon--20 { width: 20px; height: 20px; }
.icon--24 { width: 24px; height: 24px; }
.icon--32 { width: 32px; height: 32px; }
.icon--48 { width: 48px; height: 48px; }

/* ----- NAV --------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  transition: border-color var(--transition-base), background var(--transition-base);
}
.nav--scrolled {
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  box-shadow: 0 1px 0 var(--border), var(--shadow-sm);
}
.nav__inner {
  max-width: var(--container-2xl);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
  color: var(--fg);
}
.nav__logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.nav__wordmark {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.nav__links {
  display: flex;
  gap: var(--space-1);
  margin-left: var(--space-4);
  flex: 1;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid transparent;
}
.nav__link:hover {
  color: var(--fg);
  background: var(--bg-hover);
}
/* Flagship link — accent color, soft tint, sparkle icon. */
.nav__link--flagship {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  font-weight: 600;
  position: relative;
}
.nav__link--flagship:hover {
  color: var(--accent-fg);
  background: var(--accent);
  border-color: var(--accent);
}
.nav__link--flagship .icon {
  color: currentColor;
  animation: sparkle-pulse 2.4s ease-in-out infinite;
}
@keyframes sparkle-pulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}
.nav__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}
.nav__user {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  font-family: var(--font-mono);
  padding: 0 var(--space-2);
}
.nav__logout-form {
  display: inline;
}
@media (max-width: 800px) {
  .nav__links { display: none; }
}

/* ----- BUTTONS ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  height: 38px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast),
              transform var(--transition-fast),
              box-shadow var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  color: var(--fg);
  user-select: none;
  position: relative;
}
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn:active:not(:disabled) { transform: translateY(0.5px); }

.btn--xs { height: 26px; padding: 0 var(--space-2); font-size: var(--fs-xs); border-radius: var(--radius-sm); gap: var(--space-1); }
.btn--sm { height: 32px; padding: 0 var(--space-3); font-size: var(--fs-xs); }
.btn--lg { height: 46px; padding: 0 var(--space-6); font-size: var(--fs-md); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  box-shadow: 0 1px 0 0 color-mix(in srgb, var(--accent) 60%, black) inset,
              0 1px 2px 0 rgba(0,0,0,0.1);
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--ghost {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--fg);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn--subtle {
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
}
.btn--subtle:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--fg);
}

.btn--destructive {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
}
.btn--destructive:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-color: var(--danger);
}

.btn--link {
  background: transparent;
  border: none;
  color: var(--accent);
  padding: 0;
  height: auto;
  text-decoration: none;
}
.btn--link:hover { text-decoration: underline; }

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

/* spinner inside a button */
.btn--loading {
  pointer-events: none;
}
.btn--loading > :not(.btn__spinner) {
  visibility: hidden;
}
.btn__spinner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

/* icon-only square button */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
  border-color: var(--border);
}
.icon-btn--sm { width: 28px; height: 28px; }
.icon-btn--lg { width: 40px; height: 40px; }

/* button group (segmented) */
.btn-group {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.btn-group > .btn {
  height: 28px;
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
}
.btn-group > .btn[aria-pressed="true"], .btn-group > .btn.is-active {
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

/* ----- INPUTS ------------------------------------------------ */
.input, .textarea, .select {
  display: block;
  width: 100%;
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  height: 38px;
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input::placeholder, .textarea::placeholder {
  color: var(--fg-subtle);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.textarea {
  min-height: 120px;
  height: auto;
  resize: vertical;
  padding: var(--space-3);
  font-family: var(--font-mono);
}

.input--sm { height: 32px; font-size: var(--fs-xs); }

/* input with leading icon
   Note on specificity: the [data-tooltip] rule below sets `position: relative`
   on every element with a data-tooltip attribute, so we use compound selectors
   here to make sure leading icons + trailing actions inside an input-wrap
   always win the cascade — even when they have a tooltip on them. */
.input-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.input-wrap > .input-wrap__icon {
  position: absolute;
  left: var(--space-3);
  top: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  color: var(--fg-subtle);
  pointer-events: none;
  width: 16px;
  height: auto;
}
.input-wrap > .input {
  padding-left: calc(var(--space-3) + 16px + var(--space-2));
}
.input-wrap > .input-wrap__action {
  position: absolute;
  right: var(--space-2);
  top: 0;
  bottom: 0;
  margin: auto 0;
  height: 28px;
  width: 28px;
  color: var(--fg-subtle);
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.input-wrap > .input-wrap__action:hover {
  color: var(--fg);
  background: var(--bg-hover);
}
.input-wrap--has-action > .input {
  padding-right: calc(var(--space-3) + 28px);
}

/* form field */
.label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg);
  margin-bottom: var(--space-2);
}
.label--muted {
  color: var(--fg-muted);
  font-weight: 400;
}
.label__hint {
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  font-weight: 400;
}
.field {
  margin-bottom: var(--space-4);
}
.field-hint {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.field-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.field--error .input,
.field--error .textarea,
.field--error .select {
  border-color: var(--danger);
}
.field--error .input:focus,
.field--error .textarea:focus,
.field--error .select:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent);
}

/* ----- CARDS ------------------------------------------------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: border-color var(--transition-base), transform var(--transition-base);
}
.card--hover:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.card--flush { padding: 0; }
.card__title {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.card__desc {
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  gap: var(--space-3);
}
.card__body { padding: var(--space-5); }
.card__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ----- TABLES ------------------------------------------------ */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
.table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  text-align: left;
  font-weight: 500;
  color: var(--fg-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  z-index: 2;
  white-space: nowrap;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table tbody tr:hover td {
  background: var(--bg-hover);
}
.table--compact tbody td { padding: var(--space-2) var(--space-3); }
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  overflow: auto;
  max-height: 70vh;
}

/* result NULL chip */
.null-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  background: var(--bg-hover);
  padding: 0 var(--space-1);
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

/* ----- BADGES / CHIPS ---------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  line-height: 1.4;
}
.badge--success { color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); background: color-mix(in srgb, var(--success) 8%, transparent); }
.badge--warn    { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.badge--danger  { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.badge--accent  { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.badge--dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

/* keyboard shortcut hint */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  line-height: 1;
}

/* ----- ALERTS ------------------------------------------------ */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: var(--fs-sm);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}
.alert__icon { flex-shrink: 0; margin-top: 1px; }
.alert__body { flex: 1; line-height: 1.5; }
.alert--success { border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 6%, transparent); color: var(--success); }
.alert--danger  { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 6%, transparent); color: var(--danger); }
.alert--warn    { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 6%, transparent); color: var(--warn); }
.alert--info    { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); color: var(--accent); }

/* ----- CODE BLOCK -------------------------------------------- */
.code {
  display: block;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  overflow: auto;
  white-space: pre;
  line-height: 1.5;
}
.code--inline {
  display: inline-block;
  padding: 1px var(--space-2);
}

/* ----- TOAST ------------------------------------------------- */
.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: min(420px, calc(100vw - var(--space-8)));
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
  min-width: 260px;
}
.toast__icon { flex-shrink: 0; margin-top: 1px; }
.toast__body { flex: 1; line-height: 1.5; }
.toast__title { font-weight: 600; margin-bottom: 2px; }
.toast__close {
  background: transparent;
  border: 0;
  color: var(--fg-subtle);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.toast__close:hover { color: var(--fg); }
.toast--success .toast__icon { color: var(--success); }
.toast--danger .toast__icon { color: var(--danger); }
.toast--warn .toast__icon { color: var(--warn); }
.toast--info .toast__icon { color: var(--accent); }
.toast--leaving { animation: toast-out 0.16s ease-in forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ----- DIALOG ------------------------------------------------ */
.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  color: var(--fg);
  padding: 0;
  max-width: min(92vw, 480px);
  box-shadow: var(--shadow-lg);
  animation: dialog-in 0.18s ease-out;
}
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  animation: backdrop-in 0.18s ease-out;
}
.dialog__inner { padding: var(--space-6); }
.dialog__title {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.dialog__body {
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-5);
  line-height: var(--lh-relaxed);
}
.dialog__actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}
@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ----- DROPDOWN / POPOVER ------------------------------------ */
.popover {
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  min-width: 200px;
  z-index: 100;
  animation: popover-in 0.14s ease-out;
}
.popover[hidden] { display: none; }
.popover__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  color: var(--fg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.popover__item:hover, .popover__item:focus {
  background: var(--bg-hover);
  outline: none;
}
.popover__sep {
  height: 1px;
  background: var(--border);
  margin: var(--space-1) 0;
}
.popover__label {
  padding: var(--space-2) var(--space-3) var(--space-1);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
@keyframes popover-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----- DROP ZONE --------------------------------------------- */
.dropzone {
  position: relative;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-4);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
}
.dropzone:hover, .dropzone.is-hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, var(--bg));
}
.dropzone.is-dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}
.dropzone__icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  margin-bottom: var(--space-3);
}
.dropzone__title {
  font-size: var(--fs-sm);
  color: var(--fg);
  font-weight: 500;
  margin-bottom: 2px;
}
.dropzone__hint {
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
}
.dropzone__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ----- SPINNER ----------------------------------------------- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}
.spinner--sm { width: 12px; height: 12px; border-width: 1.5px; }
.spinner--lg { width: 24px; height: 24px; border-width: 2.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- SKELETON ---------------------------------------------- */
.skeleton {
  display: block;
  background: linear-gradient(90deg,
    var(--bg-hover) 25%,
    var(--bg-active) 37%,
    var(--bg-hover) 63%);
  background-size: 400% 100%;
  border-radius: var(--radius-sm);
  animation: skeleton 1.4s ease-in-out infinite;
  height: 0.9em;
  width: 100%;
}
.skeleton--text-sm { height: 0.75em; }
.skeleton--text-lg { height: 1.2em; }
.skeleton--circle { border-radius: 50%; }
@keyframes skeleton {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ----- TOOLTIP ----------------------------------------------- */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: var(--fs-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
  z-index: 80;
  box-shadow: var(--shadow-md);
}

/* ----- SWITCH ------------------------------------------------ */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-active);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}
.switch__slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  top: 3px;
  background: var(--fg);
  border-radius: 50%;
  transition: transform var(--transition-fast);
}
.switch input:checked + .switch__slider { background: var(--accent); }
.switch input:checked + .switch__slider::before {
  transform: translateX(16px);
  background: var(--accent-fg);
}

/* ----- FOOTER ------------------------------------------------ */
.footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-16);
  padding: var(--space-6) 0;
}
.footer__inner {
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  color: var(--fg-muted);
  font-size: var(--fs-sm);
}
.footer__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.footer__logo {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-xs);
}
.footer__link {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.footer__link:hover {
  color: var(--fg);
}

/* ----- EMPTY STATE ------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--fg-muted);
}
.empty-state__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  margin-bottom: var(--space-4);
}
.empty-state__title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--fg);
  margin-bottom: var(--space-2);
}
.empty-state__desc {
  font-size: var(--fs-sm);
  max-width: 36ch;
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-4);
}

/* ----- FOCUS RINGS (dark-mode aware) ------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.btn:focus-visible,
.icon-btn:focus-visible,
.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ----- UTILITIES --------------------------------------------- */
.stack { display: flex; flex-direction: column; }
.stack--xs { gap: var(--space-1); }
.stack--sm { gap: var(--space-2); }
.stack--md { gap: var(--space-4); }
.stack--lg { gap: var(--space-6); }

.row { display: flex; align-items: center; }
.row--sm { gap: var(--space-2); }
.row--md { gap: var(--space-4); }
.row--lg { gap: var(--space-6); }
.row--baseline { align-items: baseline; }
.row--start { align-items: flex-start; }
.row--end { align-items: flex-end; }

.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.fg { color: var(--fg); }
.success { color: var(--success); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.accent { color: var(--accent); }
.mono { font-family: var(--font-mono); }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-md { font-size: var(--fs-md); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }
.text-2xl { font-size: var(--fs-2xl); }
.text-3xl { font-size: var(--fs-3xl); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; letter-spacing: 0.04em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

.hidden { display: none !important; }
.flex { display: flex; }
.grid { display: grid; }
.inline-flex { display: inline-flex; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }

.no-scrollbar { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.no-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.no-scrollbar::-webkit-scrollbar-track { background: transparent; }
.no-scrollbar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
