:root {
  color-scheme: light;
  --font-family: 'Roboto', Arial, sans-serif;
  --blue: #023199;
  --blue-solid: #023199;
  --blue-hover: #021f64;
  --action: #3b66f2;
  --ink: #182033;
  --muted: #667085;
  --faint: #71809a;
  --canvas: #f7f9fd;
  --paper: #fff;
  --surface: #fff;
  --surface-muted: #f3f6fb;
  --surface-active: #e9efff;
  --control: #fff;
  --control-hover: #f4f7fc;
  --line: #dadbdc;
  --line-strong: #cfd6e2;
  --green: #1f8b4c;
  --green-wash: #eaf7f0;
  --amber: #8a570a;
  --amber-wash: #fff4dd;
  --focus-ring: #75a7ef;
  --scrim: rgb(14 26 49 / .42);
  --overlay-shadow: 0 16px 36px rgb(15 31 58 / .18);
  --drawer-shadow: -18px 0 45px rgb(15 31 58 / .12);
  --shell-height: 55px;
  --rail-expanded: 230px;
  --rail-compact: 72px;
  --rail-icon-track: 46px;
  --mobile-nav-height: 68px;
  --rail-motion: 200ms cubic-bezier(.2, 0, 0, 1);
  --workspace-inline: 18px;
  --app-card-height: 96px;
  --app-card-radius: 12px;
  --app-card-icon-size: 64px;
  --app-card-icon-radius: 10px;
  --app-card-padding: 12px;
  --app-card-gap: 14px;
  --app-card-shadow: 0 4px 14px rgb(20 49 118 / .08);
  --app-card-hover-shadow: 0 8px 22px rgb(20 49 118 / .13);
  --entry-canvas: #f2f5fa;
  --entry-copy: #667085;
  --entry-slice-start: #164cb6;
  --entry-slice-middle: #023199;
  --entry-slice-end: #061b50;
  --entry-halo: rgb(117 167 239 / .2);
  font-family: var(--font-family);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

html[data-theme='dark'] {
  color-scheme: dark;
  --blue: #9cb9ff;
  --blue-solid: #3b66f2;
  --blue-hover: #bfd0ff;
  --ink: #edf3ff;
  --muted: #aebbd0;
  --faint: #8999b2;
  --canvas: #0b1322;
  --paper: #111c2f;
  --surface: #111c2f;
  --surface-muted: #101a2c;
  --surface-active: #1b3157;
  --control: #142238;
  --control-hover: #1a2b45;
  --line: #33445e;
  --line-strong: #42536d;
  --green: #75d39d;
  --green-wash: #173326;
  --amber: #e6bc62;
  --amber-wash: #352b17;
  --focus-ring: #9ec4ff;
  --scrim: rgb(2 8 18 / .72);
  --overlay-shadow: 0 16px 36px rgb(0 0 0 / .38);
  --drawer-shadow: -18px 0 45px rgb(0 0 0 / .34);
  --entry-canvas: #081120;
  --entry-copy: #aebbd0;
  --entry-slice-start: #123a8d;
  --entry-slice-middle: #08296d;
  --entry-slice-end: #031331;
  --entry-halo: rgb(84 133 224 / .18);
  --app-card-shadow: none;
  --app-card-hover-shadow: none;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background: var(--canvas);
}

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

::selection {
  color: #fff;
  background: var(--blue-solid);
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.microsoft-sign-in:focus-visible,
.icon-button:focus-visible,
.account-trigger:focus-visible,
.nav-item:focus-visible,
.app-row:focus-visible,
.filter-button:focus-visible,
.search-clear:focus-visible,
.account-menu button:focus-visible,
.drawer-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Shared entry states */
.loading-gate {
  box-sizing: border-box;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 32px;
  background: var(--entry-canvas);
}

.entry-logo {
  display: block;
  width: min(72vw, 310px);
  height: auto;
  aspect-ratio: 310 / 66;
  object-fit: contain;
}

.entry-logo-dark { display: none; }
.auth-factor-logo.auth-factor-logo-dark { display: none; }

html[data-theme='dark'] .entry-logo-light,
html[data-theme='dark'] .auth-factor-logo-light { display: none; }

html[data-theme='dark'] .entry-logo-dark,
html[data-theme='dark'] .auth-factor-logo-dark { display: block; }

.loading-gate > p {
  margin: 18px 0 0;
  color: var(--entry-copy);
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
}

.portal-visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.portal-pending { min-height:240px; padding:16px var(--workspace-inline); }
.portal-pending-grid { width:min(100%,880px); display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.portal-pending-card { min-height:var(--app-card-height); box-sizing:border-box; display:flex; align-items:center; gap:var(--app-card-gap); padding:var(--app-card-padding); border:1px solid var(--line); border-radius:var(--app-card-radius); background:var(--paper); }
.portal-pending-icon { flex:none; width:var(--app-card-icon-size); height:var(--app-card-icon-size); border-radius:var(--app-card-icon-radius); }
.portal-pending-copy { flex:1; display:grid; gap:10px; }
.portal-pending-copy .portal-skeleton:first-child { width:52%; }
.portal-pending-copy .portal-skeleton:last-child { width:76%; }
.portal-skeleton { position:relative; display:block; height:10px; border-radius:4px; overflow:hidden; background:var(--loading-skeleton-base,#e6e9ee); }
.portal-skeleton::after { content:""; position:absolute; inset:0; background:linear-gradient(100deg,transparent 20%,var(--loading-skeleton-highlight,#f7f8fa) 48%,transparent 76%); transform:translateX(-100%); animation:portal-loading-sweep 1.35s ease-in-out infinite; }
.portal-pending-table { display:grid; grid-template-columns:min(260px,30%) minmax(0,1fr); gap:16px; min-height:350px; }
.portal-pending-sidebar,.portal-pending-rows { display:grid; align-content:start; gap:20px; }
.portal-pending-sidebar .portal-skeleton { width:65%; }
.portal-pending-rows .portal-skeleton { width:72%; }
.portal-pending-rows .portal-skeleton:nth-child(3n) { width:56%; }
@keyframes portal-loading-sweep { to { transform:translateX(100%); } }
@media(max-width:650px) { .portal-pending-grid { grid-template-columns:1fr; } .portal-pending-table { grid-template-columns:1fr; } .portal-pending-sidebar { display:none; } }
@media(prefers-reduced-motion:reduce) { .portal-skeleton::after { animation:none; } }

.loading-progress {
  position: relative;
  width: min(58vw, 220px);
  height: 2px;
  margin-top: 42px;
  overflow: hidden;
  background: transparent;
  mask-image: linear-gradient(90deg, #000 0%, #000 72%, transparent 100%);
}

.loading-progress span {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background: linear-gradient(90deg, #023199 0%, #3b66f2 72%, #75a7ef 100%);
  animation: loading-line 1.8s cubic-bezier(.65, 0, .35, 1) infinite;
}

.auth-gate {
  /* Anchor the logo, not the variable-height sign-in/error group. */
  --auth-logo-width: min(72vw, 310px);
  --auth-logo-top: calc(50dvh - (var(--auth-logo-width) * 66 / 310 + 82px) / 2);
  box-sizing: border-box;
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
  padding: 32px;
  background: var(--entry-canvas);
}

.auth-gate::before {
  content: '';
  position: absolute;
  z-index: -2;
  inset: 0;
  background: linear-gradient(152deg, var(--entry-slice-start) 0%, var(--entry-slice-middle) 54%, var(--entry-slice-end) 100%);
  clip-path: polygon(82% 0, 100% 0, 100% 100%, 66% 100%);
}

.auth-access {
  position: relative;
  z-index: 2;
  width: min(100%, 350px);
  display: grid;
  justify-items: center;
  align-self: start;
  margin-top: max(0px, calc(var(--auth-logo-top) - 32px));
}

.auth-factor-logo {
  display: block;
  width: var(--auth-logo-width);
  height: auto;
  aspect-ratio: 310 / 66;
  object-fit: contain;
  margin-bottom: 52px;
}

.microsoft-sign-in {
  width: min(100%, 318px);
  min-height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid #8c8c8c;
  border-radius: 2px;
  background: #fff;
  color: #5e5e5e;
  cursor: pointer;
  font: 600 15px/21px 'Segoe UI', Frutiger, 'Helvetica Neue', Arial, sans-serif;
  transition: background-color 120ms ease-out, box-shadow 120ms ease-out, transform 120ms ease-out;
}

.microsoft-sign-in:hover {
  background: #f7f7f7;
  box-shadow: 0 2px 8px rgb(0 0 0 / .12);
}

.microsoft-sign-in:active {
  transform: translateY(1px);
  background: #efefef;
}

.microsoft-sign-in:disabled {
  cursor: wait;
  opacity: .7;
}

.microsoft-mark {
  display: block;
  width: 21px;
  height: 21px;
}

.auth-account-hint,
.auth-error {
  width: min(100%, 318px);
  margin: 13px 0 0;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.auth-account-hint { color: var(--entry-copy); }
.auth-error { margin-top: 18px; color: #9b1c1c; }

.auth-geometry {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  clip-path: polygon(82% 0, 100% 0, 100% 100%, 66% 100%);
  pointer-events: none;
}

.auth-geometry::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 86% 78%, var(--entry-halo) 0, transparent 30rem);
}

.auth-horizon {
  position: absolute;
  right: -.75%;
  bottom: -.75%;
  width: clamp(330px, 24vw, 680px);
  aspect-ratio: 843 / 888;
  contain: layout style;
  overflow: visible;
}

.auth-horizon > img,
.auth-polygon-beam {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.auth-polygon-beam { overflow: visible; }

.auth-horizon > img { opacity: .18; }

.auth-polygon-light {
  fill: none;
  stroke: #f8fbff;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: .22 .78;
  stroke-dashoffset: .22;
  opacity: 0;
  filter: url(#auth-polygon-light-field);
  will-change: opacity, stroke-dashoffset;
  animation:
    polygon-light-travel 9s linear infinite,
    polygon-light-luminance 9s linear infinite;
}

.auth-horizon g > g > g:nth-child(1) path { animation-delay: -9s; }
.auth-horizon g > g > g:nth-child(2) path { animation-delay: -7.2s; }
.auth-horizon g > g > g:nth-child(3) path { animation-delay: -5.4s; }
.auth-horizon g > g > g:nth-child(4) path { animation-delay: -3.6s; }
.auth-horizon g > g > g:nth-child(5) path { animation-delay: -1.8s; }

/* Shared FACTOR application shell */
.portal-shell {
  --rail-width: var(--rail-expanded);
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--canvas);
}

.portal-shell.is-rail-collapsed { --rail-width: var(--rail-compact); }

.topbar {
  position: fixed;
  z-index: 40;
  inset: 0 0 auto;
  height: var(--shell-height);
  display: grid;
  grid-template-columns: minmax(350px, 1fr) minmax(140px, 390px) minmax(210px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.shell-branding {
  grid-column: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
}

.icon-button,
.drawer-close {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
}

.icon-button:hover,
.drawer-close:hover {
  background: var(--control-hover);
  color: var(--blue);
}

.menu-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-icon-open { display: none; }
.portal-shell.is-rail-collapsed .menu-icon-close { display: none; }
.portal-shell.is-rail-collapsed .menu-icon-open { display: block; }

.portal-brand {
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 4px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 120ms ease-out, color 120ms ease-out, transform 120ms ease-out;
}

.portal-brand:hover {
  background: var(--control-hover);
  color: var(--blue);
}

.portal-brand:active { transform: translateY(1px); }

.brand-mark {
  width: 30px;
  height: 32px;
  display: flex;
  align-items: center;
  flex: none;
}

.brand-mark img {
  display: block;
  width: 30px;
  height: 32px;
  object-fit: contain;
}

.brand-mark-dark { display: none !important; }
html[data-theme='dark'] .brand-mark-light { display: none !important; }
html[data-theme='dark'] .brand-mark-dark { display: block !important; }

.portal-brand strong {
  min-width: 0;
  overflow: hidden;
  color: #333;
  font-size: 21.6px;
  font-weight: 400;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme='dark'] .portal-brand strong { color: var(--ink); }

.search {
  grid-column: 2;
  width: 100%;
  max-width: 390px;
  display: flex;
  justify-self: center;
}

.search:focus-within {
  border-color: var(--focus-ring);
  background: var(--surface);
  outline: 2px solid rgb(117 167 239 / .28);
}

.search > svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-clear svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.topbar-actions {
  grid-column: 3;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: stretch;
}

.account {
  position: relative;
  width: 34px;
  height: 34px;
  flex: none;
}

.account-trigger {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.account-initials,
.account-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-solid);
  color: #fff;
  font-weight: 700;
}

.account-initials {
  width: 34px;
  height: 34px;
  font-size: 10px;
}

.account-avatar {
  width: 42px;
  height: 42px;
  font-size: 11px;
}

.account-menu {
  position: absolute;
  z-index: 70;
  top: calc(100% + 10px);
  right: 0;
  width: 330px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--overlay-shadow);
}

.account-detail {
  min-height: 78px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.account-detail > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.account-detail strong,
.account-detail span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-detail strong { font-size: 14px; }
.account-detail span { color: var(--muted); font-size: 11px; }
.account-detail em { margin-top: 2px; color: var(--ink); font-size: 11px; font-style: normal; }

.account-menu .account-menu-action {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.account-menu .account-menu-action:hover {
  background: var(--control-hover);
  color: var(--blue);
}

.account-menu .account-menu-signout { border-bottom: 0; }

.account-menu-action svg,
.drawer-close svg,
.nav-icon svg,
.app-icon svg,
.app-arrow {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-menu-action svg { width: 18px; }

.sidebar {
  position: fixed;
  z-index: 20;
  inset: var(--shell-height) auto 0 0;
  width: var(--rail-width);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 0 12px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  transition: width var(--rail-motion), box-shadow var(--rail-motion);
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: calc(100% - 16px);
  min-height: 45px;
  display: grid;
  grid-template-columns: var(--rail-icon-track) minmax(0, 1fr);
  align-items: center;
  gap: 0;
  margin-inline: 8px;
  padding: 0;
  overflow: hidden;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: width var(--rail-motion), background-color 120ms ease-out, color 120ms ease-out, transform 120ms ease-out;
}

.nav-item:hover {
  background: var(--control-hover);
  color: var(--blue);
}

.nav-item:active { transform: translateY(1px); }

.nav-item.is-active {
  background: var(--surface-active);
  color: var(--blue);
  font-weight: 700;
}

.nav-icon {
  width: var(--rail-icon-track);
  height: 45px;
  display: grid;
  place-items: center;
}

.nav-icon svg { width: 19px; }

.nav-label {
  min-width: 0;
  overflow: hidden;
  opacity: 1;
  transform: translateX(0);
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 120ms ease-out 45ms, transform var(--rail-motion);
}

.portal-shell.is-rail-collapsed .sidebar .nav-item {
  width: var(--rail-icon-track);
  margin-right: auto;
}

.portal-shell.is-rail-collapsed .sidebar .nav-label {
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
}

.nav-divider {
  height: 1px;
  margin: 8px;
  background: var(--line);
}

.sidebar footer {
  margin-top: auto;
  padding: 10px 21px 0;
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
  transition: opacity 100ms ease-out;
}

.portal-shell.is-rail-collapsed .sidebar footer { opacity: 0; }

.mobile-bottom-nav { display: none; }

.workspace {
  position: fixed;
  inset: var(--shell-height) 0 0 var(--rail-width);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--canvas);
  transition: left var(--rail-motion);
}

.workspace-heading {
  flex: none;
  width: 100%;
  height: 50px;
  min-height: 50px;
  display: flex;
  align-items: center;
  padding: 0 var(--workspace-inline);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.context-breadcrumb {
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.context-breadcrumb strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 400;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: var(--blue);
  background: var(--surface-active);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.filter-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.workspace-scroll {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px var(--workspace-inline) 44px;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.workspace-scroll::-webkit-scrollbar { width: 10px; }
.workspace-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid var(--canvas); border-radius: 999px; }

.scrim {
  position: fixed;
  z-index: 19;
  inset: var(--shell-height) 0 0;
  width: auto;
  height: auto;
  border: 0;
  background: rgb(14 26 49 / .18);
  cursor: default;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease-out, visibility 0s linear 180ms;
}

.scrim:not([hidden]) { display: block; }

.portal-shell:not(.is-rail-collapsed) .scrim:not([hidden]) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 200ms ease-out, visibility 0s;
}

/* Reusable application collections */
.app-section + .app-section { margin-top: 28px; }

.app-section h2 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.app-list {
  width: min(100%, 880px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.app-row {
  min-height: var(--app-card-height);
  display: grid;
  grid-template-columns: var(--app-card-icon-size) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--app-card-gap);
  padding: var(--app-card-padding);
  border: 1px solid var(--line);
  border-radius: var(--app-card-radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--app-card-shadow);
  text-decoration: none;
  transition: background-color 120ms ease-out, box-shadow 120ms ease-out, transform 120ms ease-out;
}

.app-row[href]:hover {
  background: var(--control-hover);
  box-shadow: var(--app-card-hover-shadow);
  transform: translateY(-1px);
}
.app-row.is-disabled { cursor: default; }

.app-row[data-navigation-pending] {
  position: relative;
  overflow: hidden;
  cursor: progress;
  pointer-events: none;
  transform: none;
}

.app-row[data-navigation-pending]::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: '';
  background: var(--scrim);
}

.app-row[data-navigation-pending]::after {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 2rem;
  box-sizing: border-box;
  content: '';
  border: 3px solid color-mix(in srgb, var(--paper) 55%, transparent);
  border-top-color: var(--action);
  border-radius: 9999px;
  animation: app-navigation-spin 700ms linear infinite;
  transform: translate(-50%, -50%);
}

html[data-theme='light'] .app-row[data-navigation-pending]::before {
  background: color-mix(in srgb, var(--canvas) 78%, transparent);
}

html[data-theme='light'] .app-row[data-navigation-pending]::after {
  border-color: color-mix(in srgb, var(--blue) 24%, transparent);
  border-top-color: var(--blue);
}

.app-icon {
  width: var(--app-card-icon-size);
  height: var(--app-card-icon-size);
  display: grid;
  place-items: center;
  border-radius: var(--app-card-icon-radius);
}

.app-icon svg { width: 34px; }
.app-icon.sat { color: #fff; background: var(--blue-solid); }
.app-icon.pdf, .app-icon.building { color: #174ea6; background: #e7efff; }
.app-icon.dte { color: #176641; background: #e1f3e9; }
.app-icon.org { color: #65458f; background: #f0e9f8; }
.app-icon.notify { color: #835111; background: #fff0d0; }

.app-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.app-copy strong,
.app-copy span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app-copy strong { font-size: 15px; line-height: 1.25; }
.app-copy span { color: var(--muted); font-size: 12px; line-height: 1.35; }

.app-meta {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.app-status {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.app-status.available { color: var(--green); background: var(--green-wash); }
.app-status.migrating { color: var(--amber); background: var(--amber-wash); }

.app-arrow {
  width: 19px;
  color: var(--blue);
  transition: transform 120ms ease-out;
}

.app-row[href]:hover .app-arrow { transform: translateX(3px); }
.app-row[data-navigation-pending] .app-arrow { transform: none; }

html[data-theme='dark'] .app-icon.dte { color: #75d39d; background: #173326; }
html[data-theme='dark'] .app-icon.pdf, html[data-theme='dark'] .app-icon.building { color: #a9c7ff; background: #1c2d4c; }
html[data-theme='dark'] .app-icon.org { color: #c7a9ed; background: #2e243a; }
html[data-theme='dark'] .app-icon.notify { color: #e6bc62; background: #352b17; }

.empty-state,
.about {
  width: min(100%, 760px);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  box-shadow: none;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 38px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 36px;
  margin-bottom: 13px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.5;
}

.empty-state h2 { margin: 0; color: var(--ink); font-size: 16px; }
.empty-state p { max-width: 48ch; margin: 9px auto 0; font-size: 12px; line-height: 1.5; }

.about { padding: 28px; }
.about h2 { margin: 0; font-size: 22px; font-weight: 400; }
.about p { max-width: 65ch; margin: 12px 0 0; color: var(--muted); line-height: 1.58; }
.about dl { display: grid; grid-template-columns: 130px 1fr; gap: 12px 18px; margin: 26px 0 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; }
.about dt { color: var(--faint); }
.about dd { margin: 0; color: var(--ink); }

/* Shared account preferences drawer */
.preferences-layer {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.preferences-layer.is-open { pointer-events: auto; }

.preferences-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--scrim);
  opacity: 0;
  will-change: opacity;
  transition: opacity 220ms cubic-bezier(.2, 0, 0, 1);
}

.preferences-layer.is-open .preferences-backdrop { opacity: 1; }

.preferences-drawer {
  position: relative;
  width: min(430px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--drawer-shadow);
  transform: translate3d(100%, 0, 0);
  will-change: transform;
  transition: transform 260ms cubic-bezier(.2, 0, 0, 1);
}

.preferences-layer.is-open .preferences-drawer { transform: translate3d(0, 0, 0); }

.preferences-drawer header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px 15px 24px;
  border-bottom: 1px solid var(--line);
}

.preferences-drawer header > div { display: grid; gap: 4px; }
.preferences-drawer header span { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.preferences-drawer h2 { margin: 0; font-size: 22px; font-weight: 400; }

.drawer-close {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
}

.drawer-close svg { width: 18px; }

.preferences-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 28px 24px;
}

.preferences-body fieldset { margin: 0; padding: 0; border: 0; }
.preferences-body legend { font-size: 15px; font-weight: 700; }
.preferences-body p { margin: 6px 0 18px; color: var(--muted); font-size: 12px; }
.preferences-body label { min-height: 48px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.preferences-body input { accent-color: var(--blue-solid); }

@keyframes polygon-light-travel {
  0% { stroke-dashoffset: .22; }
  3% { stroke-dashoffset: .18; animation-timing-function: cubic-bezier(.4, 0, .6, .6); }
  13% { stroke-dashoffset: -.38; animation-timing-function: cubic-bezier(.46, 1, .7, 1); }
  40% { stroke-dashoffset: -1.08; }
  100% { stroke-dashoffset: -1.08; }
}

@keyframes polygon-light-luminance {
  0% { opacity: 0; }
  3% { opacity: .3; }
  10% { opacity: .92; }
  13% { opacity: 1; animation-timing-function: cubic-bezier(.4, 0, .7, 1); }
  34%, 100% { opacity: 0; }
}

@keyframes loading-line {
  0% { opacity: 0; transform: scaleX(.03); }
  12% { opacity: 1; }
  72% { opacity: 1; transform: scaleX(.82); }
  100% { opacity: 0; transform: scaleX(1); }
}

@keyframes app-navigation-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 900px) and (min-width: 651px) {
  .portal-shell { --rail-width: 76px; }
  .portal-shell:not(.is-rail-collapsed) .sidebar { width: var(--rail-expanded); box-shadow: 14px 0 32px rgb(15 31 58 / .16); }
  .portal-shell:not(.is-rail-collapsed) .sidebar .nav-item { width: calc(100% - 16px); }
  .portal-shell:not(.is-rail-collapsed) .sidebar .nav-label { opacity: 1; transform: none; }
  .topbar { grid-template-columns: minmax(220px, 1fr) minmax(190px, 390px) auto; }
}

@media (max-width: 720px) {
  .app-list { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  :root { --workspace-inline: 18px; }

  .auth-gate {
    --auth-logo-width: min(74vw, 275px);
    --auth-logo-top: calc(50dvh - (var(--auth-logo-width) * 66 / 310 + 76px) / 2);
    padding: 28px 24px calc(28px + env(safe-area-inset-bottom));
    background: var(--entry-canvas);
  }

  .auth-gate::before,
  .auth-geometry { clip-path: polygon(100% 48%, 100% 100%, 36% 100%); }
  .auth-access { width: min(100%, 330px); margin-top: max(0px, calc(var(--auth-logo-top) - 28px)); }
  .auth-factor-logo { margin-bottom: 46px; }
  .auth-geometry::before { background: radial-gradient(circle at 85% 88%, var(--entry-halo) 0, transparent 16rem); }
  .auth-horizon { right: -1%; bottom: -1%; width: 150px; }
  .auth-horizon > img { opacity: .32; }
  .loading-gate > img { width: min(74vw, 275px); }
  .loading-progress { width: min(62vw, 210px); margin-top: 36px; }

  .portal-shell { --rail-width: 0px; }

  .topbar {
    grid-template-columns: minmax(86px, auto) minmax(0, 1fr) 34px;
    gap: 8px;
    padding: 0 8px;
  }

  .shell-branding { gap: 4px; }
  .portal-brand { width: 38px; min-width: 38px; padding: 0 4px; }
  .portal-brand strong { display: none; }
  .search { max-width: none; }

  .account-menu {
    position: fixed;
    top: calc(var(--shell-height) + 5px);
    right: 10px;
    width: min(330px, calc(100vw - 20px));
  }

  .sidebar {
    inset: var(--shell-height) auto 0 0;
    width: min(var(--rail-expanded), calc(100vw - 48px));
    height: auto;
    display: flex;
    padding: 14px 0;
    border-top: 0;
    border-right: 1px solid var(--line);
    box-shadow: 14px 0 32px rgb(15 31 58 / .16);
    transform: translate3d(calc(-100% - 16px), 0, 0);
    visibility: hidden;
    pointer-events: none;
    will-change: transform;
    transition: transform 200ms cubic-bezier(.55, 0, 1, .45), visibility 0s linear 200ms;
  }

  .sidebar nav { grid-template-columns: 1fr; gap: 4px; }
  .sidebar footer { display: none; }

  .sidebar .nav-item,
  .portal-shell.is-rail-collapsed .sidebar .nav-item {
    width: calc(100% - 16px);
    min-height: 48px;
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-rows: 48px;
    place-items: stretch;
    gap: 0;
    margin-inline: 8px;
    padding: 0;
    text-align: left;
  }

  .sidebar .nav-icon { width: 60px; height: 48px; }
  .sidebar .nav-label,
  .portal-shell.is-rail-collapsed .sidebar .nav-label { grid-column: 2; grid-row: 1; align-self: center; display: block; opacity: 1; transform: none; font-size: 14px; line-height: 1.2; }

  .portal-shell:not(.is-rail-collapsed) .sidebar {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
    transition: transform 240ms cubic-bezier(.16, 1, .3, 1), visibility 0s;
  }

  .portal-shell:not(.is-rail-collapsed) .sidebar .nav-divider { display: block; }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 18;
    inset: auto 0 0;
    height: var(--mobile-nav-height);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 7px 8px;
    background: var(--paper);
    border-top: 1px solid var(--line);
  }

  .mobile-bottom-nav .nav-item {
    width: auto;
    min-height: 54px;
    grid-template-columns: 1fr;
    grid-template-rows: 27px 14px;
    place-items: center;
    gap: 2px;
    margin: 0;
    padding: 3px;
    text-align: center;
  }

  .mobile-bottom-nav .nav-icon { width: 100%; height: 27px; }
  .mobile-bottom-nav .nav-label { display: block; grid-row: 2; opacity: 1; transform: none; font-size: 9px; line-height: 12px; }

  .workspace { left: 0; bottom: var(--mobile-nav-height); }
  .workspace-heading,
  .workspace-scroll { padding-inline: var(--workspace-inline); }

  .filter-button { width: 34px; justify-content: center; padding: 0; font-size: 0; }
  .filter-button:not([hidden]) { display: inline-grid; }
  .filter-button svg { width: 17px; }

  .app-row {
    min-height: 80px;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    padding: 10px;
  }

  .app-icon { width: 56px; height: 56px; }
  .app-icon svg { width: 29px; }
  .app-meta { grid-column: 2; grid-auto-flow: column; align-items: center; justify-content: start; justify-items: start; }
  .app-arrow { display: none; }

  .about { padding: 24px 20px; }
  .about dl { grid-template-columns: 1fr; gap: 5px; }
  .about dd + dt { margin-top: 9px; }

  .preferences-drawer { width: 100%; }
}

@media (max-width: 380px) {
  :root { --workspace-inline: 14px; }
  .topbar { gap: 6px; padding-inline: 6px; }
  .search { --fqs-search-padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-row[data-navigation-pending]::after {
    animation: none;
    transform: translate(-50%, -50%);
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
