/* ==========================================================================
   Components: buttons, cards, form fields, chips, segmented controls,
   status badges, avatars, lists, bottom sheets, toasts, skeletons,
   empty states, steppers, callouts.
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
  --btn-h: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-height: var(--btn-h);
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
}

.btn .icon {
  width: 20px;
  height: 20px;
}

.btn-primary {
  background: var(--brand);
  color: var(--text-on-brand);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, var(--shadow-xs);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--brand-press);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn-soft {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.btn-soft:hover:not(:disabled) {
  background: var(--brand-soft-2);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger-text);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--danger-soft);
}

.btn-sm {
  --btn-h: 36px;
  padding: 0 var(--sp-2);
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
}

.btn-sm .icon {
  width: 18px;
  height: 18px;
}

.btn-lg {
  --btn-h: 56px;
  font-size: var(--fs-lg);
  border-radius: var(--r-card);
}

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

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

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-color: var(--text-on-brand) var(--text-on-brand) transparent transparent;
  animation: spin 0.7s linear infinite;
}

.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after,
.btn-soft.is-loading::after {
  border-color: var(--brand) var(--brand) transparent transparent;
}

/* Square icon-only button (always has an aria-label) */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  color: var(--text);
  transition: background-color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}

.icon-btn:hover {
  background: var(--surface-hover);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn .icon {
  width: 22px;
  height: 22px;
}

.icon-btn-round {
  border-radius: 50%;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-0);
  min-height: 32px;
  color: var(--brand-text);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
}

.text-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: var(--sp-2);
}

.card-pad-lg {
  padding: var(--sp-3);
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2);
}

.card-link:hover {
  text-decoration: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card-link:active {
  transform: scale(0.99);
}

.card-flat {
  box-shadow: none;
}

/* ---- Form fields ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.field-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.field-label .optional {
  font-weight: var(--fw-regular);
  color: var(--text-3);
}

.field-hint {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.field-error {
  display: flex;
  align-items: center;
  gap: var(--sp-0);
  font-size: var(--fs-sm);
  color: var(--danger-text);
}

.field-error:empty {
  display: none;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 16px; /* 16px stops iOS from zooming in */
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.textarea {
  min-height: 96px;
  padding: var(--sp-1) var(--sp-2);
  resize: vertical;
  line-height: var(--lh);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

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

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

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

.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: var(--sp-5);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  background-position: right 22px center, right 16px center;
}

[dir="rtl"] .select {
  background-position: left 16px center, left 22px center;
}

/* Phone field: fixed +961 prefix, always LTR */
.phone-field {
  display: flex;
  align-items: stretch;
  direction: ltr;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.phone-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft-2);
}

.phone-field.is-invalid {
  border-color: var(--danger);
}

.phone-prefix {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0 var(--sp-2);
  background: var(--surface-2);
  border-inline-end: 1px solid var(--border);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  white-space: nowrap;
}

.phone-flag {
  flex: none;
  width: 22px;
  height: 15px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.phone-field .input {
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
  font-size: 18px;
  letter-spacing: 0.04em;
  min-height: 56px;
}

/* One-time code boxes */
.otp {
  display: flex;
  justify-content: center;
  gap: var(--sp-1);
  direction: ltr;
}

.otp-box {
  width: 48px;
  height: 56px;
  padding: 0;
  text-align: center;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  caret-color: var(--brand);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2);
}

.otp-box:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft-2);
}

.otp-box.is-filled {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.otp.is-error .otp-box {
  border-color: var(--danger);
  animation: shake 0.4s var(--ease);
}

@media (max-width: 380px) {
  .otp {
    gap: 6px;
  }
  .otp-box {
    width: 42px;
    height: 52px;
    font-size: var(--fs-xl);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Checkbox */
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--text-2);
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--brand);
  flex: none;
}

/* Number stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.stepper button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--brand-text);
}

.stepper button:hover:not(:disabled) {
  background: var(--brand-soft);
}

.stepper button:disabled {
  color: var(--text-3);
}

.stepper output {
  min-width: 56px;
  text-align: center;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}

/* ---- Chips (filters, multi-select) ---- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.chips-scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-inline: calc(var(--sp-2) * -1);
  padding-inline: var(--sp-2);
  scroll-padding-inline: var(--sp-2);
}

.chips-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-0);
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background-color var(--dur-2) var(--ease), border-color var(--dur-2), color var(--dur-2);
}

.chip:hover {
  border-color: var(--grey-400);
}

.chip[aria-pressed="true"],
.chip[aria-checked="true"],
.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-on-brand);
}

.chip .icon {
  width: 16px;
  height: 16px;
}

/* ---- Segmented control ---- */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}

.segmented-block {
  display: flex;
  width: 100%;
}

.segmented button {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-0);
  min-height: 36px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2), box-shadow var(--dur-2);
}

.segmented button[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented .icon {
  width: 16px;
  height: 16px;
}

/* ---- Option cards (big radio cards) ---- */
.option-card {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2);
  border-radius: var(--r-card);
  border: 1.5px solid var(--border);
  background: var(--surface);
  text-align: start;
  transition: border-color var(--dur-2) var(--ease), background-color var(--dur-2), box-shadow var(--dur-2);
}

.option-card:hover {
  border-color: var(--border-strong);
}

.option-card[aria-checked="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px var(--brand) inset;
}

.option-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand-text);
}

.option-card[aria-checked="true"] .option-icon {
  background: var(--brand);
  color: var(--text-on-brand);
}

.option-icon .icon {
  width: 24px;
  height: 24px;
}

.option-title {
  font-weight: var(--fw-bold);
}

.option-desc {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.option-check {
  margin-inline-start: auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  color: transparent;
  transition: all var(--dur-2) var(--ease);
}

.option-check .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.option-card[aria-checked="true"] .option-check {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--text-on-brand);
}

/* ---- Status badges: color + icon + text, never color alone ---- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px 0 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  border: 1px solid transparent;
  white-space: nowrap;
}

.status .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.status-green {
  background: var(--ok-soft);
  color: var(--ok-text);
  border-color: var(--ok-border);
}

.status-yellow {
  background: var(--warn-soft);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.status-red {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.status-unknown {
  background: var(--bg-sunken);
  color: var(--text-2);
  border-color: var(--border);
}

/* Solid version, for use on top of photos */
.status-solid.status-green { background: #1c7f45; color: #fff; border-color: transparent; }
.status-solid.status-yellow { background: #f2bb2a; color: #2a1c00; border-color: transparent; }
.status-solid.status-red { background: #c42b2b; color: #fff; border-color: transparent; }

/* Small neutral badges (Demo, Verified, Growing, Pending) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  background: var(--bg-sunken);
  color: var(--text-2);
  white-space: nowrap;
}

.badge .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.badge-brand {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.badge-verified {
  background: var(--brand);
  color: var(--text-on-brand);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn-text);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.badge-demo {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-3);
  min-height: 20px;
  padding: 0 6px;
  font-size: 11px;
}

/* ---- Avatar (initials / role icon, never a real photo of a resident) ---- */
.avatar {
  --size: 40px;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-weight: var(--fw-bold);
  font-size: calc(var(--size) * 0.38);
  overflow: hidden;
  position: relative;
}

.avatar .icon {
  width: 55%;
  height: 55%;
}

.avatar-sm { --size: 32px; }
.avatar-lg { --size: 56px; }
.avatar-xl { --size: 72px; }

.avatar-verified::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--brand) inset;
}

/* ---- Lists ---- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 56px;
  padding: var(--sp-1) var(--sp-2);
  color: inherit;
  text-decoration: none;
  width: 100%;
  text-align: start;
}

.list-item + .list-item,
.list > li + li > .list-item {
  border-top: 1px solid var(--border);
}

a.list-item:hover,
button.list-item:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.list-item-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  color: var(--text-2);
}

.list-item-icon .icon {
  width: 20px;
  height: 20px;
}

.list-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

.list-item-title {
  font-weight: var(--fw-semibold);
}

.list-item-sub {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.list-item-end {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--text-3);
  flex: none;
}

/* ---- Callouts ---- */
.callout {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}

.callout > .icon {
  width: 22px;
  height: 22px;
  margin-top: 1px;
}

.callout-title {
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  margin-bottom: 2px;
}

.callout-info {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--text);
}

.callout-info > .icon {
  color: var(--brand-text);
}

.callout-warn {
  background: var(--warn-soft);
  border-color: var(--warn-border);
}

.callout-warn > .icon {
  color: var(--warn-text);
}

.callout-danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.callout-danger > .icon {
  color: var(--danger-text);
}

/* Emergency call buttons */
.call-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-1);
}

.call-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 40px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--danger);
  color: #fff;
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  text-decoration: none;
}

.call-btn:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.call-btn.call-btn-outline {
  background: var(--surface);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.call-btn .icon {
  width: 18px;
  height: 18px;
}

/* ---- Bottom sheet ---- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: var(--overlay);
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease);
}

.sheet-backdrop.is-open {
  opacity: 1;
}

.sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: calc(var(--z-sheet) + 1);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
  margin-inline: auto;
  width: 100%;
  max-width: 560px;
  background: var(--bg-elevated);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform var(--dur-3) var(--ease-out);
  padding-bottom: var(--safe-bottom);
}

.sheet.is-open {
  transform: translateY(0);
}

.sheet.is-dragging {
  transition: none;
}

.sheet-handle {
  display: grid;
  place-items: center;
  height: 24px;
  flex: none;
  cursor: grab;
  touch-action: none;
}

.sheet-handle::before {
  content: "";
  width: 40px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0 var(--sp-1) var(--sp-1) var(--sp-2);
  flex: none;
}

.sheet-title {
  flex: 1 1 auto;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sp-1) var(--sp-2) var(--sp-3);
}

@media (min-width: 720px) {
  .sheet {
    bottom: 50%;
    border-radius: var(--r-lg);
    transform: translateY(calc(50% + 24px)) scale(0.98);
    opacity: 0;
    transition: transform var(--dur-3) var(--ease-out), opacity var(--dur-3) var(--ease);
    max-height: min(720px, calc(100dvh - 96px));
    padding-bottom: 0;
  }

  .sheet.is-open {
    transform: translateY(50%) scale(1);
    opacity: 1;
  }

  .sheet-handle {
    display: none;
  }

  .sheet-head {
    padding-top: var(--sp-2);
  }
}

/* ---- Toasts ---- */
.toast-root {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-2));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: 0 var(--sp-2);
  pointer-events: none;
}

.app[data-chrome="none"] ~ .toast-root,
.app[data-chrome="minimal"] ~ .toast-root {
  bottom: calc(var(--safe-bottom) + var(--sp-3));
}

@media (min-width: 960px) {
  .toast-root {
    bottom: var(--sp-4);
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  max-width: 440px;
  min-height: 52px;
  padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-2);
  border-radius: var(--r-card);
  background: var(--grey-900);
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: toastIn var(--dur-3) var(--ease-out) both;
}

:root[data-theme="dark"] .toast {
  background: #2a302e;
}

.toast.is-leaving {
  animation: toastOut var(--dur-2) var(--ease) both;
}

.toast > .icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.toast-success > .icon { color: #6ad898; }
.toast-error > .icon { color: #ff8b8b; }
.toast-info > .icon { color: var(--mint-400); }
.toast-code > .icon { color: var(--mint-400); }

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

.toast-code-value {
  display: inline-block;
  margin-inline-start: 4px;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: 0.15em;
  direction: ltr;
  color: var(--mint-400);
}

.toast-action {
  flex: none;
  min-height: 36px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--mint-400);
  font-weight: var(--fw-bold);
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.08);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

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

/* ---- Skeleton loaders ---- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-sunken);
  border-radius: var(--r-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}

[dir="rtl"] .skeleton::after {
  animation-name: shimmerRtl;
}

.skeleton-line {
  height: 12px;
  border-radius: var(--r-pill);
}

.skeleton-circle {
  border-radius: 50%;
}

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

@keyframes shimmerRtl {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}

/* ---- Empty states ---- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-1);
  padding: var(--sp-5) var(--sp-3);
}

.empty-art {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin-bottom: var(--sp-1);
  border-radius: 28px;
  background: var(--brand-soft);
  color: var(--brand-text);
}

.empty-art .icon {
  width: 40px;
  height: 40px;
  stroke-width: 1.6;
}

.empty-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}

.empty-text {
  max-width: 340px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
}

/* ---- Progress steps (wizards) ---- */
.steps {
  display: flex;
  gap: 6px;
}

.steps > span {
  flex: 1 1 0;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--border);
  overflow: hidden;
  position: relative;
}

.steps > span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur-4) var(--ease-out);
}

[dir="ltr"] .steps > span::after {
  transform-origin: left;
}

.steps > span.is-done::after,
.steps > span.is-current::after {
  transform: scaleX(1);
}

.steps-caption {
  margin-top: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: var(--fw-medium);
}

/* ---- Meter (quota, progress) ---- */
.meter {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width var(--dur-4) var(--ease-out);
}

.meter.is-full > span {
  background: var(--warn);
}

/* ---- Rating stars ---- */
.rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.rating .icon {
  width: 16px;
  height: 16px;
  color: var(--yellow-500);
}

/* ---- Spinner ---- */
.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--brand-soft-2);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

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

/* ---- Key-value grid ---- */
.kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-1);
}

.kv-item {
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.kv-label {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.kv-value {
  font-weight: var(--fw-bold);
}

/* ---- Divider with text ---- */
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
}

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