/* ============================================================================
   AnyShift shared components — Phase 0/1. Tokenized, reusable building blocks
   used by the partials in views/partials/ui/. Loaded AFTER style.css.
   Scoped with the `as-` prefix so it never collides with legacy classes.
   ========================================================================== */

/* --- Page header ---------------------------------------------------------- */
.as-page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6);
}
.as-page-header__titles { min-width: 0; }
.as-page-header__title {
  font-family: var(--as-font); font-size: var(--fs-h1); font-weight: var(--fw-bold);
  color: var(--as-ink); line-height: var(--lh-tight); margin: 0;
}
.as-page-header__subtitle {
  font-size: var(--fs-sm); color: var(--as-text-muted); margin: var(--sp-1) 0 0;
}
.as-page-header__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.as-breadcrumb {
  display: flex; gap: var(--sp-2); align-items: center; list-style: none;
  padding: 0; margin: 0 0 var(--sp-2); font-size: var(--fs-caption); color: var(--as-text-subtle);
}
.as-breadcrumb a { color: var(--as-text-subtle); text-decoration: none; }
.as-breadcrumb a:hover { color: var(--as-primary); }

/* --- Alert / inline message ---------------------------------------------- */
.as-alert {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  border: 1px solid transparent; font-size: var(--fs-sm); line-height: var(--lh-normal);
}
.as-alert[hidden] { display: none; }
.as-alert__icon { flex-shrink: 0; margin-top: 1px; }
.as-alert__close {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: inherit; opacity: .6; padding: 0 var(--sp-1);
}
.as-alert__close:hover { opacity: 1; }
.as-alert--success { background: var(--as-success-weak); border-color: var(--as-success); color: #0a6b43; }
.as-alert--error   { background: var(--as-danger-weak);  border-color: var(--as-danger);  color: #a30000; }
.as-alert--info    { background: var(--as-info-weak);    border-color: var(--as-info);    color: #084a8f; }
.as-alert--warning { background: var(--as-warning-weak); border-color: var(--as-warning); color: #8a5a00; }

/* --- Toast stack ---------------------------------------------------------- */
.as-toast-stack {
  position: fixed; top: var(--sp-5); right: var(--sp-5); z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--sp-2); max-width: 360px;
}
.as-toast {
  background: var(--as-surface); border: 1px solid var(--as-border);
  border-left-width: 4px; border-radius: var(--r-md); box-shadow: var(--sh-2);
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); color: var(--as-text);
  animation: as-toast-in var(--dur) var(--ease);
}
.as-toast--success { border-left-color: var(--as-success); }
.as-toast--error   { border-left-color: var(--as-danger); }
.as-toast--info    { border-left-color: var(--as-info); }
@keyframes as-toast-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }

/* --- Empty state ---------------------------------------------------------- */
.as-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--sp-12) var(--sp-5); color: var(--as-text-muted);
}
.as-empty__icon {
  width: 56px; height: 56px; border-radius: var(--r-pill);
  display: grid; place-items: center; background: var(--as-bg);
  color: var(--as-slate); margin-bottom: var(--sp-4);
}
.as-empty__title { font-size: var(--fs-h3); font-weight: var(--fw-semibold); color: var(--as-ink); margin: 0 0 var(--sp-1); }
.as-empty__text { font-size: var(--fs-sm); margin: 0 0 var(--sp-4); max-width: 420px; }

/* --- Error state (in-content) -------------------------------------------- */
.as-error-state { text-align: center; padding: var(--sp-12) var(--sp-5); }
.as-error-state__icon { color: var(--as-danger); margin-bottom: var(--sp-3); }
.as-error-state__title { font-size: var(--fs-h3); font-weight: var(--fw-semibold); color: var(--as-ink); margin: 0 0 var(--sp-1); }
.as-error-state__text { font-size: var(--fs-sm); color: var(--as-text-muted); margin: 0 0 var(--sp-4); }

/* --- Skeleton loading ----------------------------------------------------- */
.as-skeleton {
  display: block; border-radius: var(--r-sm);
  background: linear-gradient(90deg, #eef1f5 25%, #e4e8ee 37%, #eef1f5 63%);
  background-size: 400% 100%; animation: as-shimmer 1.4s ease infinite;
}
.as-skeleton--text { height: 12px; margin: 6px 0; }
.as-skeleton--row { height: 44px; margin: 8px 0; }
@keyframes as-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* --- Full-page error / minimal shell (error.ejs, index.ejs) --------------- */
.as-page-shell {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--as-bg); font-family: var(--as-font); color: var(--as-text); padding: var(--sp-6);
}
.as-page-shell__card {
  background: var(--as-surface); border: 1px solid var(--as-border);
  border-radius: var(--r-lg); box-shadow: var(--sh-2);
  padding: var(--sp-10); max-width: 440px; width: 100%; text-align: center;
}
.as-page-shell__code { font-size: 48px; font-weight: var(--fw-bold); color: var(--as-primary); line-height: 1; }
.as-page-shell__title { font-size: var(--fs-h2); font-weight: var(--fw-semibold); color: var(--as-ink); margin: var(--sp-4) 0 var(--sp-2); }
.as-page-shell__text { font-size: var(--fs-sm); color: var(--as-text-muted); margin: 0 0 var(--sp-6); }
.as-btn-primary {
  display: inline-block; background: var(--as-primary); color: #fff; text-decoration: none;
  padding: var(--sp-3) var(--sp-6); border-radius: var(--r-md); font-weight: var(--fw-semibold);
  font-size: var(--fs-body); transition: background var(--dur) var(--ease);
}
.as-btn-primary:hover { background: var(--as-primary-hover); color: #fff; }

/* ============================================================================
   Phase 1 components — table, badge, form field, toolbar, modal, pagination,
   buttons. Tokenized, `as-` prefixed. Consumed by as-ui.js + module views.
   ========================================================================== */

/* --- Buttons -------------------------------------------------------------- */
.as-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--as-font); font-size: var(--fs-body); font-weight: var(--fw-semibold);
  line-height: 1; padding: 10px var(--sp-5); border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.as-btn:focus-visible { outline: 2px solid var(--as-info); outline-offset: 2px; }
.as-btn[disabled], .as-btn:disabled { opacity: .55; cursor: not-allowed; }
.as-btn--primary { background: var(--as-primary); color: #fff; }
.as-btn--primary:hover { background: var(--as-primary-hover); color: #fff; }
.as-btn--danger { background: var(--as-danger); color: #fff; }
.as-btn--danger:hover { background: var(--as-primary-hover); color: #fff; }
.as-btn--secondary { background: var(--as-surface); color: var(--as-ink); border-color: var(--as-border-strong); }
.as-btn--secondary:hover { border-color: var(--as-slate); }
.as-btn--ghost { background: transparent; color: var(--as-text); }
.as-btn--ghost:hover { background: var(--as-bg); }
.as-btn--sm { padding: 6px var(--sp-3); font-size: var(--fs-sm); }

/* --- Status badge --------------------------------------------------------- */
.as-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-caption); font-weight: var(--fw-semibold); line-height: 1.4;
  border: 1px solid transparent; white-space: nowrap;
}
.as-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.as-badge--success { background: var(--as-success-weak); color: #0a6b43; }
.as-badge--warning { background: var(--as-warning-weak); color: #8a5a00; }
.as-badge--danger  { background: var(--as-danger-weak);  color: #a30000; }
.as-badge--info    { background: var(--as-info-weak);    color: #084a8f; }
.as-badge--neutral { background: var(--as-bg);           color: var(--as-slate); }

/* --- Form fields ---------------------------------------------------------- */
.as-field { margin-bottom: var(--sp-4); }
.as-label { display: block; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--as-ink); margin-bottom: 6px; }
.as-label .as-req { color: var(--as-primary); margin-left: 2px; }
.as-input, .as-select, .as-textarea {
  width: 100%; font-family: var(--as-font); font-size: var(--fs-body); color: var(--as-ink);
  background: var(--as-surface); border: 1px solid var(--as-border-strong);
  border-radius: var(--r-md); padding: 10px var(--sp-3); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.as-input:focus, .as-select:focus, .as-textarea:focus {
  outline: none; border-color: var(--as-info); box-shadow: 0 0 0 3px var(--as-info-weak);
}
.as-input.is-invalid, .as-select.is-invalid, .as-textarea.is-invalid {
  border-color: var(--as-danger); box-shadow: 0 0 0 3px var(--as-danger-weak);
}
.as-help { font-size: var(--fs-caption); color: var(--as-text-subtle); margin-top: 4px; }
.as-error { font-size: var(--fs-caption); color: var(--as-danger); margin-top: 4px; min-height: 1em; }

/* --- Toolbar (search + filter + sort) ------------------------------------ */
.as-toolbar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.as-search { position: relative; flex: 1 1 240px; max-width: 360px; }
.as-search .as-input { padding-left: 38px; }
.as-search__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--as-slate); pointer-events: none; }
.as-search [data-as-clear] { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--as-slate); cursor: pointer; }

/* --- Data table ----------------------------------------------------------- */
.as-table-wrap { background: var(--as-surface); border: 1px solid var(--as-border); border-radius: var(--r-lg); overflow: auto; }
.as-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.as-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--as-bg-alt);
  text-align: left; font-weight: var(--fw-semibold); color: var(--as-text-muted);
  font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .02em;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--as-border);
  white-space: nowrap;
}
.as-table th.as-sortable { cursor: pointer; user-select: none; }
.as-table th.as-sortable:hover { color: var(--as-ink); }
.as-table th .as-sort-ind { opacity: .5; margin-left: 4px; }
.as-table tbody td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--as-divider); color: var(--as-text); vertical-align: middle; }
.as-table tbody tr:last-child td { border-bottom: 0; }
.as-table tbody tr:hover { background: var(--as-bg); }
.as-table .as-num, .as-table .as-amount { text-align: right; font-variant-numeric: tabular-nums; }
.as-table .as-date { white-space: nowrap; color: var(--as-text-muted); }
.as-table .as-row-actions { text-align: right; white-space: nowrap; }

/* --- Modal / confirm (built by as-ui.js) --------------------------------- */
.as-modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(16, 24, 40, .45); display: grid; place-items: center; padding: var(--sp-5);
  animation: as-fade var(--dur) var(--ease);
}
.as-modal {
  background: var(--as-surface); border-radius: var(--r-lg); box-shadow: var(--sh-3);
  padding: var(--sp-6); max-width: 420px; width: 100%; animation: as-pop var(--dur) var(--ease);
}
.as-modal__title { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--as-ink); margin: 0 0 var(--sp-2); }
.as-modal__body { font-size: var(--fs-sm); color: var(--as-text-muted); margin: 0 0 var(--sp-6); line-height: var(--lh-normal); }
.as-modal__actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
@keyframes as-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes as-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* --- Pagination (built by as-ui.js) -------------------------------------- */
.as-pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }
.as-pagination__info { font-size: var(--fs-sm); color: var(--as-text-muted); }
.as-pagination__nav { display: flex; gap: 4px; flex-wrap: wrap; }
.as-pagination__btn {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--as-border-strong); background: var(--as-surface); color: var(--as-text);
  font-size: var(--fs-sm); cursor: pointer; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.as-pagination__btn:hover:not(:disabled):not(.is-active) { background: var(--as-bg); }
.as-pagination__btn.is-active { background: var(--as-primary); border-color: var(--as-primary); color: #fff; font-weight: var(--fw-semibold); }
.as-pagination__btn:disabled { opacity: .45; cursor: not-allowed; }

/* --- Stat card (operational dashboard) ----------------------------------- */
.as-stat {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--as-surface); border: 1px solid var(--as-border);
  border-radius: var(--r-lg); padding: var(--sp-5); height: 100%;
  text-decoration: none; transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.as-stat:hover { box-shadow: var(--sh-2); border-color: var(--as-border-strong); transform: translateY(-1px); }
.as-stat:focus-visible { outline: 2px solid var(--as-info); outline-offset: 2px; }
.as-stat__icon {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: var(--r-md);
  display: grid; place-items: center; font-size: 20px;
  background: var(--as-primary-weak); color: var(--as-primary);
}
.as-stat__icon--info    { background: var(--as-info-weak);    color: var(--as-info); }
.as-stat__icon--warning { background: var(--as-warning-weak); color: #8a5a00; }
.as-stat__icon--success { background: var(--as-success-weak); color: #0a6b43; }
.as-stat__value { font-size: 26px; font-weight: var(--fw-bold); color: var(--as-ink); line-height: 1.1; }
.as-stat__label { font-size: var(--fs-sm); color: var(--as-text-muted); margin-top: 2px; }

/* --- Registration / onboarding stepper ----------------------------------- */
.reg-stepper { display: flex; gap: var(--sp-2); margin: 0 0 var(--sp-5); }
.reg-stepper__item { flex: 1; text-align: center; min-width: 0; }
.reg-stepper__dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  margin: 0 auto 6px; background: var(--as-bg); color: var(--as-slate);
  border: 1px solid var(--as-border-strong); font-weight: var(--fw-semibold); font-size: var(--fs-sm);
}
.reg-stepper__label { font-size: 11px; color: var(--as-text-subtle); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg-stepper__item.is-active .reg-stepper__dot { background: var(--as-primary); color: #fff; border-color: var(--as-primary); }
.reg-stepper__item.is-done .reg-stepper__dot { background: var(--as-success); color: #fff; border-color: var(--as-success); }
.reg-stepper__item.is-active .reg-stepper__label { color: var(--as-ink); font-weight: var(--fw-semibold); }
.reg-step { display: none; }
.reg-step.is-active { display: block; }
.reg-review__row { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--as-divider); font-size: var(--fs-sm); }
.reg-review__label { color: var(--as-text-muted); }
.reg-review__value { color: var(--as-ink); font-weight: var(--fw-medium); text-align: right; word-break: break-word; }
.reg-pw-meter { height: 6px; border-radius: var(--r-pill); background: var(--as-divider); overflow: hidden; margin-top: 8px; }
.reg-pw-meter__bar { height: 100%; width: 0; transition: width var(--dur) var(--ease), background var(--dur) var(--ease); background: var(--as-danger); }

/* --- Active nav link (business top nav) ----------------------------------- */
.navbar-nav .nav-link.active { color: var(--as-primary); font-weight: var(--fw-semibold); position: relative; }
.navbar-nav .nav-link.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--as-primary); border-radius: var(--r-pill);
}

/* --- Timesheets: column priority on small screens (keep it scannable) ----- */
@media (max-width: 767.98px) {
  .as-ts-table th:nth-child(1), .as-ts-table td:nth-child(1),   /* Job ID */
  .as-ts-table th:nth-child(4), .as-ts-table td:nth-child(4),   /* Planned hrs */
  .as-ts-table th:nth-child(5), .as-ts-table td:nth-child(5),   /* Working hrs */
  .as-ts-table th:nth-child(6), .as-ts-table td:nth-child(6) {  /* Break */
    display: none;
  }
}

/* --- Accessible red text -------------------------------------------------- */
/* Small red text/links use the AA-passing text-red; red backgrounds/buttons
   (and the logo) keep #FF0000, so the brand look is unchanged. */
.red-text { color: var(--as-red-text) !important; }

/* ── Dashboard operational panels + quick links (added for the P1 employer loop) ── */
.as-page-header__sub { font-size: var(--fs-sm, 0.9rem); }

.as-panel {
  background: var(--as-surface, #fff);
  border: 1px solid var(--as-border, #e6e8ec);
  border-radius: var(--r-lg, 12px);
  box-shadow: var(--sh-1, 0 1px 2px rgba(16,24,40,.06));
  overflow: hidden;
  height: 100%;
}
.as-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--as-divider, #eef0f3);
}
.as-panel__title { font-size: 1rem; font-weight: var(--fw-bold, 700); color: var(--as-ink, #0b0f19); margin: 0; }
.as-panel__link { font-size: var(--fs-sm, 0.875rem); color: var(--as-red-text, #cc0000); text-decoration: none; white-space: nowrap; }
.as-panel__link:hover { text-decoration: underline; }
.as-panel .as-table { margin: 0; }
.as-panel .as-table td, .as-panel .as-table th { padding-left: 16px; padding-right: 16px; }

.as-empty--sm { padding: 20px 8px; }
.as-empty--sm .as-empty__title { font-size: var(--fs-sm, 0.875rem); color: var(--as-text-muted, #667085); margin: 0; font-weight: 500; }

.as-quick {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; height: 100%;
  background: var(--as-surface, #fff);
  border: 1px solid var(--as-border, #e6e8ec);
  border-radius: var(--r-lg, 12px);
  text-decoration: none; color: inherit;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.as-quick:hover { box-shadow: var(--sh-2, 0 4px 12px rgba(16,24,40,.1)); border-color: var(--as-border-strong, #cfd4dc); transform: translateY(-1px); color: inherit; }
.as-quick:focus-visible { outline: 2px solid var(--as-info, #2e90fa); outline-offset: 2px; }
.as-quick__icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--as-primary-weak, #ffe5e5); color: var(--as-primary, #ff0000);
  font-size: 18px;
}
.as-quick__title { font-weight: var(--fw-bold, 700); color: var(--as-ink, #0b0f19); }
.as-quick__sub { font-size: var(--fs-sm, 0.875rem); }
@media (prefers-reduced-motion: reduce) { .as-quick { transition: none; } .as-quick:hover { transform: none; } }

/* ── Auth experience (login / register / reset) — premium split layout ───────── */
.as-auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--as-bg, #f6f7f9);
}
/* Left: branded value panel */
.as-auth__brand {
  position: relative;
  color: #fff;
  padding: 56px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(255,255,255,.14), transparent 60%),
    linear-gradient(145deg, #ff2d2d 0%, var(--as-primary, #ff0000) 42%, #cc0000 100%);
  overflow: hidden;
}
.as-auth__brand::after {
  content: ""; position: absolute; right: -120px; bottom: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.as-auth__brandTop { display: flex; align-items: center; gap: 12px; }
.as-auth__brandLogo { height: 40px; filter: brightness(0) invert(1); }
.as-auth__headline { font-family: var(--as-font-display, inherit); font-weight: 800; font-size: clamp(26px, 3vw, 40px); line-height: 1.12; margin: 28px 0 14px; max-width: 16ch; }
.as-auth__lead { font-size: 1.05rem; opacity: .92; max-width: 42ch; margin-bottom: 28px; }
.as-auth__points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.as-auth__points li { display: flex; align-items: flex-start; gap: 12px; font-size: 1rem; }
.as-auth__points i { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.18); font-size: 12px; margin-top: 1px; }
.as-auth__foot { position: relative; z-index: 1; font-size: .9rem; opacity: .9; display: flex; align-items: center; gap: 10px; }
.as-auth__rating { font-weight: 700; }

/* Right: form side */
.as-auth__formSide { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.as-auth__card { width: 100%; max-width: 420px; }
.as-auth__brandMobile { display: none; text-align: center; margin-bottom: 18px; }
.as-auth__title { font-weight: 800; color: var(--as-ink, #0b0f19); font-size: 1.6rem; margin: 6px 0 4px; }
.as-auth__subtitle { color: var(--as-text-muted, #667085); margin-bottom: 22px; }
.as-auth__toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.as-auth .input-group-text { background: #fff; border-color: var(--as-border, #e6e8ec); color: var(--as-text-muted, #667085); }
.as-auth .form-control { border-color: var(--as-border, #e6e8ec); }
.as-auth .form-control:focus { border-color: var(--as-primary, #ff0000); box-shadow: 0 0 0 3px var(--as-primary-weak, #ffe5e5); }

@media (max-width: 991.98px) {
  .as-auth { grid-template-columns: 1fr; }
  .as-auth__brand { display: none; }
  .as-auth__brandMobile { display: block; }
}

/* ── Command palette (⌘K) — instant nav + global search ──────────────────────── */
.as-cmdk-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(16,24,40,.45); backdrop-filter: blur(2px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px;
}
.as-cmdk-overlay.is-open { display: flex; }
.as-cmdk {
  width: 100%; max-width: 620px;
  background: var(--as-surface, #fff);
  border: 1px solid var(--as-border, #e6e8ec);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(16,24,40,.28);
  overflow: hidden;
  animation: as-cmdk-in .14s ease;
}
@keyframes as-cmdk-in { from { transform: translateY(-8px); opacity: .6; } to { transform: none; opacity: 1; } }
.as-cmdk__search { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--as-divider, #eef0f3); }
.as-cmdk__search i { color: var(--as-text-muted, #667085); }
.as-cmdk__input { flex: 1; border: 0; outline: 0; font-size: 1.05rem; background: transparent; color: var(--as-ink, #0b0f19); }
.as-cmdk__kbd { font-size: 11px; color: var(--as-text-muted, #667085); border: 1px solid var(--as-border, #e6e8ec); border-radius: 6px; padding: 2px 6px; }
.as-cmdk__results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.as-cmdk__section { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--as-text-subtle, #98a2b3); padding: 10px 12px 4px; font-weight: 700; }
.as-cmdk__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--as-text, #1d2433); }
.as-cmdk__item:hover, .as-cmdk__item.is-active { background: var(--as-primary-weak, #ffe5e5); }
.as-cmdk__item.is-active { outline: 2px solid var(--as-primary, #ff0000); outline-offset: -2px; }
.as-cmdk__ico { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--as-bg-alt, #f2f4f7); color: var(--as-primary, #ff0000); font-size: 14px; }
.as-cmdk__meta { flex: 1; min-width: 0; }
.as-cmdk__t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-cmdk__s { font-size: 12px; color: var(--as-text-muted, #667085); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-cmdk__empty { padding: 28px 12px; text-align: center; color: var(--as-text-muted, #667085); font-size: .9rem; }
/* header trigger pill */
.as-cmdk-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--as-bg-alt, #f2f4f7); border: 1px solid var(--as-border, #e6e8ec);
  color: var(--as-text-muted, #667085); border-radius: 999px; padding: 7px 12px;
  font-size: .85rem; cursor: pointer; white-space: nowrap;
}
.as-cmdk-trigger:hover { border-color: var(--as-border-strong, #cfd4dc); color: var(--as-text, #1d2433); }
.as-cmdk-trigger .as-cmdk__kbd { margin-left: 2px; }
@media (prefers-reduced-motion: reduce) { .as-cmdk { animation: none; } }
@media (max-width: 575.98px) { .as-cmdk-trigger span.label { display: none; } }

/* ── Glassmorphism (scoped to dashboards so dense tables stay crisp) ──────────── */
.as-glass-dash {
  position: relative;
}
.as-glass-dash::before {
  /* soft brand-tinted gradient mesh behind the glass surfaces */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 8% -5%, rgba(255,45,45,.16), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(46,144,250,.14), transparent 55%),
    radial-gradient(700px 600px at 50% 110%, rgba(18,183,106,.12), transparent 60%),
    var(--as-bg, #f6f7f9);
}
.as-glass-dash > * { position: relative; z-index: 1; }

/* Glass surfaces */
.as-glass-dash .as-stat,
.as-glass-dash .as-panel {
  background: rgba(255, 255, 255, 0.62);
  -webkit-backdrop-filter: blur(16px) saturate(165%);
  backdrop-filter: blur(16px) saturate(165%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.10), inset 0 1px 0 rgba(255,255,255,0.6);
}
.as-glass-dash .as-stat:hover {
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 36px rgba(16, 24, 40, 0.14), inset 0 1px 0 rgba(255,255,255,0.7);
}
.as-glass-dash .as-panel__head { border-bottom-color: rgba(16,24,40,0.07); }
/* Glass stat icons get a frosted tint */
.as-glass-dash .as-stat__icon { backdrop-filter: blur(6px); }

/* Fallback: browsers without backdrop-filter get solid cards (readability first) */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .as-glass-dash .as-stat, .as-glass-dash .as-panel { background: var(--as-surface, #fff); }
}

/* ── Sortable tables (client-side column sort, works on .table and .as-table) ──── */
table th.as-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table th.as-sortable:hover { color: var(--as-ink, #0b0f19); }
table th.as-sortable .as-sort-ind { opacity: .4; margin-left: 6px; font-size: .78em; display: inline-block; }
table th.as-sort-asc .as-sort-ind, table th.as-sort-desc .as-sort-ind { opacity: 1; color: var(--as-primary, #ff0000); }
/* Indicator as a pseudo-element so it survives i18n textContent rewrites on the
   header (the global applyI18n resets th text, which would drop a child span). */
table th.as-sortable[data-server-sort-col]::after { content: '↕'; opacity: .4; margin-left: 6px; font-size: .78em; display: inline-block; }
table th.as-sort-asc[data-server-sort-col]::after { content: '↑'; opacity: 1; color: var(--as-primary, #ff0000); }
table th.as-sort-desc[data-server-sort-col]::after { content: '↓'; opacity: 1; color: var(--as-primary, #ff0000); }
