/* ============================================================ Buttons */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong); --btn-hover: var(--stone-50);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-5); border-radius: var(--radius);
  border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: var(--text-sm); letter-spacing: -0.005em; white-space: nowrap;
  box-shadow: var(--shadow-xs); user-select: none;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { box-shadow: var(--focus); }
.btn[disabled], .btn.is-loading { pointer-events: none; opacity: 0.7; }

.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-border: var(--amber-600); --btn-hover: var(--accent-hover);
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 1px 2px rgba(168, 93, 10, .25); }
.btn-dark { --btn-bg: var(--stone-900); --btn-fg: #fff; --btn-border: var(--stone-900); --btn-hover: var(--stone-800); }
.btn-danger { --btn-bg: var(--red-500); --btn-fg: #fff; --btn-border: var(--red-600); --btn-hover: var(--red-600); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-hover: var(--stone-100); box-shadow: none; }
.btn-danger-outline { --btn-bg: var(--surface); --btn-fg: var(--red-600); --btn-border: #efc3be; --btn-hover: var(--red-50); }
.btn-sm { min-height: 36px; padding: 0 var(--s-3); border-radius: var(--radius-sm); }
.btn-danger-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--red-600); --btn-hover: var(--red-50); box-shadow: none; }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: var(--text-base); border-radius: var(--radius); }
.btn-icon { width: 44px; padding: 0; }

.btn .spinner { display: none; }
.btn.is-loading .btn-label, .btn.is-loading > .icon { visibility: hidden; }
.btn.is-loading .spinner { display: block; position: absolute; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ Fields (floating labels) */
.field { position: relative; }
.field-control {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.field-control:hover { border-color: var(--stone-400); }
.field-control:focus-within { border-color: var(--amber-500); box-shadow: var(--focus); }
.field input {
  width: 100%; min-width: 0; height: 56px; padding: 22px var(--s-4) 6px;
  border: 0; background: transparent; border-radius: var(--radius);
  font-size: var(--text-base); appearance: none; -webkit-appearance: none;
}
.field input:focus { box-shadow: none; }
.field input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--surface) inset; -webkit-text-fill-color: var(--text); }
.field label {
  position: absolute; left: var(--s-4); top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: var(--text-base); pointer-events: none; transform-origin: left center;
  transition: transform var(--medium) var(--ease), color var(--medium) var(--ease), top var(--medium) var(--ease);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field input:-webkit-autofill + label {
  top: 17px; transform: translateY(-50%) scale(0.78); color: var(--text-soft); font-weight: 500;
}
.field-control:focus-within label { color: var(--amber-700); }

/* Currency prefix / unit suffix: appear once the label floats, so the empty field stays clean. */
.field-control.has-prefix input { padding-left: calc(var(--s-4) + 12px); }
.field-prefix, .field-suffix {
  position: absolute; bottom: 7px; font-size: var(--text-base); line-height: 26px; color: var(--text-muted); pointer-events: none;
  opacity: 0; transform: translateY(2px); transition: opacity var(--medium) var(--ease), transform var(--medium) var(--ease);
}
.field-prefix { left: var(--s-4); }
.field-suffix { right: var(--s-4); font-size: var(--text-sm); }
.field input:focus ~ .field-prefix, .field input:not(:placeholder-shown) ~ .field-prefix,
.field input:focus ~ .field-suffix, .field input:not(:placeholder-shown) ~ .field-suffix { opacity: 1; transform: none; }
@media (min-width: 640px) { .field-narrow { max-width: 260px; } }
.money { font-variant-numeric: tabular-nums; }

/* Role-dependent copy (team form): sign-in roles vs. crew */
[data-crew-only], .is-crew [data-signin-only] { display: none; }
.is-crew [data-crew-only] { display: revert; }
.is-crew .crew-optional label::after { content: " (optional)"; }

.field-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; margin-right: 6px;
  border: 0; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm);
}
.field-toggle:hover { color: var(--text); background: var(--stone-100); }
.field-toggle .icon-eye-off { display: none; }
.field-toggle[aria-pressed="true"] .icon-eye { display: none; }
.field-toggle[aria-pressed="true"] .icon-eye-off { display: block; }

.field-hint, .field-error { display: flex; gap: var(--s-2); align-items: flex-start; margin-top: var(--s-2); padding-left: 2px; font-size: var(--text-sm); }
.field-hint { color: var(--text-muted); }
.field-error { color: var(--red-600); font-weight: 500; animation: drop-in var(--medium) var(--ease); }
.field-error .icon { margin-top: 2px; }
.field.has-error .field-control { border-color: var(--red-500); background: var(--red-50); }
.field.has-error .field-control:focus-within { box-shadow: 0 0 0 3px rgba(217, 61, 47, 0.2); }
.field.has-error label { color: var(--red-600) !important; }
.field.is-shaking { animation: shake 0.4s var(--ease); }

@keyframes drop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.field-grid { display: grid; gap: var(--s-4); }
@media (min-width: 640px) { .field-grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldset-label { display: block; margin-bottom: var(--s-3); font-size: var(--text-sm); font-weight: 600; color: var(--text-soft); }

/* Password checklist */
.pw-rules { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--text-sm); color: var(--text-muted); }
.pw-rules li { display: flex; align-items: center; gap: var(--s-2); transition: color var(--medium) var(--ease); }
.pw-rules .dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--stone-300); transition: all var(--medium) var(--ease-spring); }
.pw-rules .dot .icon { width: 12px; height: 12px; stroke-width: 3; opacity: 0; transform: scale(0.4); transition: all var(--medium) var(--ease-spring); }
.pw-rules li.ok { color: var(--green-700); }
.pw-rules li.ok .dot { background: var(--green-500); border-color: var(--green-500); color: #fff; }
.pw-rules li.ok .dot .icon { opacity: 1; transform: none; }

/* ============================================================ Alerts */
.alert { display: flex; gap: var(--s-3); padding: var(--s-4); border-radius: var(--radius); font-size: var(--text-sm); line-height: 1.5; animation: drop-in var(--medium) var(--ease); }
.alert .icon { margin-top: 1px; }
.alert-error { background: var(--red-50); color: var(--red-700); border: 1px solid #f6d3cf; }
.alert-info { background: var(--amber-50); color: var(--amber-700); border: 1px solid var(--amber-100); }
.alert-muted { background: var(--stone-100); color: var(--stone-700); border: 1px solid var(--border); }
.alert strong { font-weight: 700; }
.alert-success { background: var(--green-50); color: var(--green-700); border: 1px solid #c9ecd6; }

/* ============================================================ Role picker (radio cards) */
.choice-grid { display: grid; gap: var(--s-3); }
@media (min-width: 640px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card {
  display: flex; gap: var(--s-3); align-items: flex-start; height: 100%;
  padding: var(--s-4); border-radius: var(--radius); background: var(--surface);
  border: 1.5px solid var(--border-strong);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.choice:hover .choice-card { border-color: var(--stone-400); }
.choice:active .choice-card { transform: scale(0.99); }
.choice input:focus-visible + .choice-card { box-shadow: var(--focus); }
.choice input:checked + .choice-card { border-color: var(--amber-500); background: var(--amber-50); box-shadow: 0 0 0 1px var(--amber-500); }
.choice-radio {
  flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
  border: 1.5px solid var(--stone-300); background: var(--surface); display: grid; place-items: center;
  transition: border-color var(--fast) var(--ease);
}
.choice-radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--amber-500); transform: scale(0); transition: transform var(--medium) var(--ease-spring); }
.choice input:checked + .choice-card .choice-radio { border-color: var(--amber-500); }
.choice input:checked + .choice-card .choice-radio::after { transform: scale(1); }
.choice-title { display: block; font-weight: 600; }
.choice-desc { display: block; margin-top: 2px; font-size: var(--text-sm); color: var(--text-muted); }

/* ============================================================ Custom select (dropdown) */
.select { position: relative; }
.select-trigger {
  display: inline-flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 44px; padding: 0 var(--s-3) 0 var(--s-4);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  font-size: var(--text-sm); font-weight: 500; text-align: left;
  transition: border-color var(--fast) var(--ease);
}
.select-trigger:hover { border-color: var(--stone-400); }
.select-trigger .select-value { flex: 1; }
.select-trigger .icon { color: var(--text-muted); transition: transform var(--medium) var(--ease); }
.select.is-open .select-trigger { border-color: var(--amber-500); box-shadow: var(--focus); }
.select.is-open .select-trigger .icon { transform: rotate(180deg); }
.select-menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; min-width: 200px;
  margin: 0; padding: 6px; list-style: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(0.98); transform-origin: top; pointer-events: none;
  transition: opacity var(--fast) var(--ease), transform var(--medium) var(--ease);
}
.select.is-open .select-menu { opacity: 1; transform: none; pointer-events: auto; }
.select-option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: 10px var(--s-3); border-radius: var(--radius-sm); font-size: var(--text-sm); cursor: pointer;
}
.select-option .icon { color: var(--amber-600); opacity: 0; }
.select-option.is-active { background: var(--stone-100); }
.select-option[aria-selected="true"] { font-weight: 600; }
.select-option[aria-selected="true"] .icon { opacity: 1; }

/* ============================================================ Chips (filter pills) */
.chips { display: flex; gap: var(--s-2); overflow-x: auto; padding: 2px; margin: -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips-scroller { position: relative; margin-bottom: var(--s-4); }
@media (max-width: 767px) {
  .chips-scroller { margin-left: calc(var(--s-4) * -1); margin-right: calc(var(--s-4) * -1); }
  .chips-scroller .chips { padding: 2px var(--s-4); scroll-padding: 0 var(--s-4); scroll-snap-type: x proximity;
    mask-image: linear-gradient(90deg, transparent, #000 var(--s-4), #000 calc(100% - var(--s-8)), transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--s-4), #000 calc(100% - var(--s-8)), transparent); }
  .chips-scroller .chip { scroll-snap-align: start; }
}
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 var(--s-4);
  border-radius: var(--radius-full); border: 1px solid var(--border-strong); background: var(--surface);
  font-size: var(--text-sm); font-weight: 500; color: var(--text-soft);
  transition: all var(--fast) var(--ease);
}
.chip:hover { border-color: var(--stone-400); color: var(--text); }
.chip.is-active { background: var(--stone-900); border-color: var(--stone-900); color: #fff; }
.chip .count { min-width: 20px; height: 20px; padding: 0 6px; margin-right: -8px; display: inline-grid; place-items: center; border-radius: var(--radius-full); background: var(--stone-100); color: var(--text-soft); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip.is-active .count { background: rgba(255,255,255,.16); color: #fff; }

/* ============================================================ Search */
.search { position: relative; display: block; } /* a <label>: block so spacing around it applies */
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0 40px 0 44px; border-radius: var(--radius);
  border: 1.5px solid var(--border-strong); background: var(--surface); font-size: var(--text-base);
  appearance: none; -webkit-appearance: none; transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:hover { border-color: var(--stone-400); }
.search input:focus { border-color: var(--amber-500); box-shadow: var(--focus); }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px;
  display: none; place-items: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted);
}
.search-clear:hover { background: var(--stone-100); color: var(--text); }
.search.has-value .search-clear { display: grid; }
.search-kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: none; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--stone-50); color: var(--text-muted); font: 600 12px/1 var(--font); }
@media (hover: hover) and (min-width: 768px) { .search:not(.has-value) .search-kbd { display: grid; } .search input:focus ~ .search-kbd { display: none; } }
.search.has-value .search-clear .icon { position: static; transform: none; }

/* ============================================================ Badges & avatars */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--stone-100); color: var(--stone-700);
}
.badge-owner { background: var(--amber-100); color: var(--amber-700); }
.badge-admin { background: var(--violet-50); color: var(--violet-700); }
.badge-manager { background: var(--blue-50); color: var(--blue-700); }
.badge-foreman { background: var(--teal-50); color: var(--teal-700); }
.badge-worker { background: var(--stone-100); color: var(--stone-600); box-shadow: inset 0 0 0 1px var(--border); }
.badge-platform { background: var(--stone-900); color: var(--amber-300); }
/* What a vendor does */
.badge-rentals { background: var(--blue-50); color: var(--blue-700); }
.badge-subs { background: var(--violet-50); color: var(--violet-700); }
.badge-truckers { background: var(--amber-50); color: var(--amber-700); box-shadow: inset 0 0 0 1px var(--amber-100); }
.badge-suppliers { background: var(--teal-50); color: var(--teal-700); }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.list-meta .badge-row { width: 260px; justify-content: flex-end; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-soft); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--stone-400); }
.status-active::before { background: var(--green-500); box-shadow: 0 0 0 3px var(--green-50); }
.status-invited::before { background: var(--amber-500); box-shadow: 0 0 0 3px var(--amber-50); }
.status-inactive { color: var(--text-muted); }

.avatar {
  --av-bg: var(--amber-100); --av-fg: var(--amber-700);
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--av-bg); color: var(--av-fg); font-size: var(--text-sm); font-weight: 700; letter-spacing: 0.02em;
}
.avatar-lg { width: 72px; height: 72px; font-size: var(--text-xl); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar[data-tone="1"] { --av-bg: var(--violet-50); --av-fg: var(--violet-700); }
.avatar[data-tone="2"] { --av-bg: var(--blue-50); --av-fg: var(--blue-700); }
.avatar[data-tone="3"] { --av-bg: var(--teal-50); --av-fg: var(--teal-700); }
.avatar[data-tone="4"] { --av-bg: var(--green-50); --av-fg: var(--green-700); }
.avatar[data-tone="5"] { --av-bg: var(--red-50); --av-fg: var(--red-700); }
.avatar { position: relative; }
.avatar.is-inactive { color: var(--stone-500); background: var(--stone-100); }
.avatar-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); background: var(--stone-400); }
.avatar-lg .avatar-dot { width: 18px; height: 18px; border-width: 3px; right: 2px; bottom: 2px; }
.dot-invited { background: var(--amber-500); }
.dot-inactive { background: var(--stone-400); }
.status-text { font-weight: 600; }
.status-text-invited { color: var(--amber-700); }
.status-text-inactive { color: var(--stone-500); }
.you-tag { display: inline-flex; align-items: center; height: 18px; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--stone-900); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; vertical-align: 2px; }

/* ============================================================ Cards & lists */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-body { padding: var(--s-5); }
@media (min-width: 640px) { .card-body { padding: var(--s-6); } }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.card-title { font-size: var(--text-lg); font-weight: 700; }
.card-meta { font-size: var(--text-sm); color: var(--text-muted); }
.card-inset { padding: var(--s-4) var(--s-5); }
@media (min-width: 640px) { .card-inset { padding: var(--s-4) var(--s-6); } }
.danger-row { display: grid; gap: var(--s-4); }
.danger-row p { margin-top: var(--s-1); font-size: var(--text-sm); }
@media (min-width: 640px) { .danger-row { grid-template-columns: 1fr auto; align-items: center; } }
.card-section + .card-section { border-top: 1px solid var(--border); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5);
  transition: background var(--fast) var(--ease);
}
.list-item + .list-item { border-top: 1px solid var(--border); }
a.list-item:hover { background: var(--stone-25); }
a.list-item:active { background: var(--stone-50); }
.list-item .chevron { color: var(--stone-300); transition: transform var(--fast) var(--ease), color var(--fast) var(--ease); }
a.list-item:hover .chevron { color: var(--text-muted); transform: translateX(2px); }
.list-primary { font-weight: 600; }
.list-head { display: none; }
@media (min-width: 768px) {
  .list-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--border); background: var(--stone-25); border-radius: var(--radius-lg) var(--radius-lg) 0 0; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
  .list-head .grow { padding-left: 52px; }
  .chevron-space { width: 20px; }
}
.list-action:empty { display: none; }
.list-stagger > * { animation: rise var(--slow) var(--ease) both; }
.list-stagger > :nth-child(2) { animation-delay: 30ms; } .list-stagger > :nth-child(3) { animation-delay: 60ms; }
.list-stagger > :nth-child(4) { animation-delay: 90ms; } .list-stagger > :nth-child(5) { animation-delay: 120ms; }
.list-stagger > :nth-child(6) { animation-delay: 150ms; } .list-stagger > :nth-child(7) { animation-delay: 180ms; }
.list-stagger > :nth-child(n+8) { animation-delay: 210ms; }
.list-secondary { font-size: var(--text-sm); color: var(--text-muted); }
.list-meta { display: none; }
@media (min-width: 768px) {
  .list-meta { display: flex; align-items: center; gap: var(--s-6); }
  .list-meta > * { width: 120px; }
}

.details { display: grid; gap: 0; margin: 0; }
.details > div { display: grid; gap: 2px; padding: var(--s-4) var(--s-5); }
.details > div + div { border-top: 1px solid var(--border); }
@media (min-width: 640px) { .details > div { grid-template-columns: 160px 1fr; align-items: center; padding: var(--s-4) var(--s-6); } }
.details dt { font-size: var(--text-sm); color: var(--text-muted); }
.details dd { margin: 0; font-weight: 500; word-break: break-word; }
.details a { color: var(--amber-700); }
.details a:hover { text-decoration: underline; text-underline-offset: 3px; }
.copyable { display: flex; align-items: center; gap: var(--s-2); min-height: 32px; }
.copy-btn { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); transition: background var(--fast) var(--ease), color var(--fast) var(--ease), opacity var(--fast) var(--ease); }
.copy-btn:hover { background: var(--stone-100); color: var(--text); }
.copy-btn .icon-copied { display: none; color: var(--green-500); }
.copy-btn.is-copied .icon-copy { display: none; }
.copy-btn.is-copied .icon-copied { display: block; animation: pop var(--medium) var(--ease-spring); }
@media (hover: hover) { .copy-btn { opacity: 0; } .copyable:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.is-copied { opacity: 1; } }

.stat-bar { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; }
.stat { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--s-4); transition: background var(--fast) var(--ease); }
@media (min-width: 640px) { .stat { padding: var(--s-5) var(--s-6); } }
.stat + .stat { border-left: 1px solid var(--border); }
a.stat:hover { background: var(--stone-25); }
a.stat:active { background: var(--stone-50); }
a.stat::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--amber-500); transform: scaleX(0); transform-origin: left; transition: transform var(--medium) var(--ease); }
a.stat:hover::after { transform: scaleX(1); }
.stat-value { font-size: var(--text-2xl); line-height: 1.15; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }
.stat-label .status { font-size: inherit; }

.tile {
  display: flex; gap: var(--s-4); align-items: center; padding: var(--s-5);
  transition: transform var(--medium) var(--ease), box-shadow var(--medium) var(--ease), border-color var(--medium) var(--ease);
}
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--stone-300); }
.tile-icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--amber-50); color: var(--amber-700); }
.tile-title { display: block; font-weight: 700; }
.tile-desc { display: block; margin-top: 2px; font-size: var(--text-sm); color: var(--text-muted); line-height: 1.45; }
.tile-chevron { color: var(--stone-300); transition: transform var(--medium) var(--ease), color var(--medium) var(--ease); }
a.tile:hover .tile-chevron { color: var(--amber-600); transform: translateX(3px); }
.tile-icon-sm { width: 40px; height: 40px; border-radius: var(--radius-sm); }
.tile-grid { display: grid; gap: var(--s-3); }
@media (min-width: 768px) { .tile-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-4); } .tile-grid .tile { align-items: flex-start; flex-direction: column; } .tile-grid .tile-chevron { display: none; } }

/* ============================================================ Empty state */
.empty { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-12) var(--s-6); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: var(--s-2); border-radius: 50%; background: var(--stone-100); color: var(--text-muted); }
.empty-title { font-size: var(--text-lg); font-weight: 700; }
.empty p { max-width: 340px; color: var(--text-muted); font-size: var(--text-sm); }
.empty .btn { margin-top: var(--s-3); }

/* ============================================================ Modal */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 0; visibility: hidden; }
.modal-root.is-open { visibility: visible; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(28, 25, 23, 0.5); backdrop-filter: blur(3px); opacity: 0; transition: opacity var(--medium) var(--ease); }
.modal-root.is-open .modal-backdrop { opacity: 1; }
.modal {
  position: relative; width: 100%; max-width: 440px; padding: var(--s-6); padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(100%); transition: transform var(--slow) var(--ease);
}
.modal-root.is-open .modal { transform: none; }
@media (min-width: 640px) {
  .modal-root { align-items: center; padding: var(--s-6); }
  .modal { border-radius: var(--radius-xl); padding-bottom: var(--s-6); transform: translateY(12px) scale(0.96); opacity: 0;
    transition: transform var(--medium) var(--ease-spring), opacity var(--medium) var(--ease); }
  .modal-root.is-open .modal { opacity: 1; }
}
.modal-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: var(--s-4); border-radius: 50%; background: var(--amber-50); color: var(--amber-700); }
.modal-icon.is-danger { background: var(--red-50); color: var(--red-600); }
.modal-title { font-size: var(--text-xl); font-weight: 700; }
.modal-body { margin-top: var(--s-2); color: var(--text-soft); }
.modal-actions { display: flex; flex-direction: column-reverse; gap: var(--s-2); margin-top: var(--s-6); }
@media (min-width: 640px) { .modal-actions { flex-direction: row; justify-content: flex-end; } }
.modal-grabber { width: 40px; height: 4px; margin: calc(var(--s-2) * -1) auto var(--s-4); border-radius: 4px; background: var(--stone-200); }
@media (min-width: 640px) { .modal-grabber { display: none; } }
body.has-modal { overflow: hidden; }

/* ============================================================ Toasts */
.toast-stack {
  position: fixed; z-index: 120; left: var(--s-4); right: var(--s-4); bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
  display: grid; gap: var(--s-2); justify-items: center; pointer-events: none;
}
@media (min-width: 640px) { .toast-stack { left: auto; right: var(--s-6); bottom: var(--s-6); justify-items: end; } }
.toast {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; max-width: 420px; padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  border-radius: var(--radius); background: var(--stone-900); color: #fff; box-shadow: var(--shadow-lg);
  font-size: var(--text-sm); font-weight: 500; pointer-events: auto;
  animation: toast-in var(--slow) var(--ease-spring);
}
.toast.is-leaving { animation: toast-out var(--medium) var(--ease) forwards; }
.toast-icon { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--green-500); color: #fff; }
.toast-icon .icon { width: 14px; height: 14px; stroke-width: 3; }
.toast-error .toast-icon { background: var(--red-500); }
.toast-msg { flex: 1; }
.toast-action { flex: none; height: 32px; padding: 0 var(--s-3); border: 0; border-radius: var(--radius-sm); background: rgba(255,255,255,.1); color: var(--amber-300); font-size: var(--text-sm); font-weight: 700; }
.toast-action:hover { background: rgba(255,255,255,.18); }
.toast-close { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--stone-400); }
.toast-close:hover { background: var(--stone-800); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ============================================================ Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-muted); }
.pagination .btn { min-height: 36px; padding: 0 var(--s-3); }
