/* zSuite hub + placeholder. Tokens and base components live in /shared/zui.css. */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { height: 100%; height: 100dvh; overflow: hidden; }

body {
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.hidden { display: none !important; }

.container {
  width: 100%;
  max-width: 560px;
  min-width: 0;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
}

.card {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Top bar ---------- */
.nav-breadcrumbs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.nav-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: 0;
  min-height: 32px;
  font-size: 13px;
}

.hub-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.02em;
}

/* ---------- zSuite wordmark ---------- */
.hub-word {
  font-size: clamp(26px, 3.4vw, 32px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--text);
  animation: hubWordIn .7s cubic-bezier(.2,.8,.2,1) both;
}
.hw-z { color: var(--accent); font-style: italic; margin-right: .04em; }
@keyframes hubWordIn {
  from { opacity: 0; transform: translateY(4px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hub-word { animation: none; }
}
.hub-actions { display: flex; align-items: center; gap: 8px; }

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--fill);
  color: var(--text-3);
  font: 500 12.5px var(--font-ui);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.kbd-hint:hover { background: var(--fill-2); color: var(--text); }
.kbd-hint svg { width: 14px; height: 14px; }
.kbd-hint kbd {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  color: var(--text-3);
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--fill);
  color: var(--text-3);
  font: 500 12.5px var(--font-ui);
  cursor: pointer;
  user-select: none;
  transition: all var(--t-fast);
}
.admin-pill svg { width: 14px; height: 14px; }
.admin-pill:hover { background: var(--fill-2); color: var(--text); }
.admin-pill.active {
  color: var(--positive);
  border-color: color-mix(in oklab, var(--positive) 40%, transparent);
  background: var(--positive-bg);
}

/* ---------- Hero ---------- */
.hub-hero { margin: 8px 0 26px; animation: zuiRise .6s var(--ease-out) .05s both; }
@keyframes hubPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--positive) 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 8px transparent; }
}
.hub-title {
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.04;
  font-weight: 680;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
}
.hub-title .gradient-text {
  background-size: 200% 100%;
  animation: hubSheen 8s ease-in-out infinite alternate;
}
@keyframes hubSheen { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.hub-sub { color: var(--text-3); font-size: 14.5px; max-width: 460px; }

.hub-grid-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  animation: zuiRise .5s var(--ease-out) .12s both;
}

/* ---------- App list (spotlight) ---------- */
/* Page-wide wash that follows the hovered app's hue. Two stacked layers
   cross-fade on opacity only, so the change stays on the compositor. */
.hub-tint {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(48% 55% at 78% 30%, hsl(var(--hue, 260) 90% 60% / .20), transparent 70%),
    radial-gradient(40% 45% at 12% 88%, hsl(var(--hue, 260) 90% 60% / .10), transparent 70%);
  transition: opacity .9s var(--ease-out);
  will-change: opacity;
}
.hub-tint.is-on { opacity: 1; }

.hub-body { flex: 1 0 auto; display: flex; flex-direction: column; }
.hub-main { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }
.app-list { display: flex; flex-direction: column; gap: 4px; }

.app-row {
  --h: 260;
  --tint: hsl(var(--h) 85% 64%);
  position: relative;
  display: grid;
  grid-template-columns: 26px 40px 1fr auto 18px;
  align-items: center;
  column-gap: 14px;
  padding: 14px 14px;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  outline: none;
  isolation: isolate;
  overflow: hidden;
  transition: opacity var(--t-med), background-color var(--t-med), border-color var(--t-med), padding-left var(--t-slow) var(--ease-spring);
}
.app-row.zui-spot {
  background-image: radial-gradient(260px circle at var(--mx, 50%) var(--my, -300px), color-mix(in oklab, var(--tint) 16%, transparent), transparent 70%);
}
.app-row::after {
  content: '';
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 3px;
  border-radius: 3px;
  background: var(--tint);
  transform: scaleY(0);
  transition: transform var(--t-slow) var(--ease-spring);
}
.app-row.is-active {
  padding-left: 22px;
  background-color: color-mix(in oklab, var(--tint) 7%, var(--fill));
  border-color: color-mix(in oklab, var(--tint) 30%, transparent);
}
.app-row.is-active::after { transform: scaleY(1); }
/* While the list is in use, un-hovered rows recede */
@media (hover: hover) {
  .app-list:hover .app-row:not(.is-active),
  .app-list:focus-within .app-row:not(.is-active) { opacity: .5; }
}
.app-row:active { transform: scale(.992); }

.app-row-num { font-size: 11.5px; color: var(--text-4); transition: color var(--t-med); }
.app-row.is-active .app-row-num { color: var(--tint); }
.app-row-icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  color: var(--tint);
  background: color-mix(in oklab, var(--tint) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tint) 25%, transparent);
  transition: transform var(--t-slow) var(--ease-spring);
}
.app-row-icon svg { width: 20px; height: 20px; stroke-width: 1.75px; }
.app-row.is-active .app-row-icon { transform: scale(1.1) rotate(-5deg); }
.app-row-text { display: flex; flex-direction: column; min-width: 0; }
.app-row-name {
  width: fit-content; /* tight box so it scales cleanly into the app's title */
  max-width: 100%;
  font-size: clamp(17px, 2.4vw, 22px);
  font-weight: 640;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}
.app-row-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.app-row-go {
  color: var(--tint);
  opacity: 0;
  transform: translate(-8px, 4px);
  transition: opacity var(--t-med), transform var(--t-slow) var(--ease-spring);
}
.app-row-go svg { width: 18px; height: 18px; }
.app-row.is-active .app-row-go { opacity: 1; transform: none; }
.app-row.admin-locked .app-row-icon { filter: saturate(.55); }
.app-row .app-tile-indicator { position: static; }

/* Icon chip shared with the command palette */
.app-tile-icon {
  --tint: hsl(var(--h, 260) 85% 64%);
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--tint);
  background: color-mix(in oklab, var(--tint) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tint) 25%, transparent);
}

/* Preview panel (wide screens only) */
.app-preview { display: none; }

/* Phones: an equal-size launcher grid. No hover states, just tap feedback. */
@media (max-width: 559px) {
  .app-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .app-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    min-height: 128px;
    padding: 16px 8px 12px;
    text-align: center;
    border: 1px solid var(--border);
    background-color: var(--fill);
    box-shadow: var(--glass-hi);
    transition: transform .45s var(--ease-spring), background-color var(--t-med);
  }
  .app-row.zui-spot { background-image: none; }
  .app-row::after, .app-row-num, .app-row-go { display: none; }
  .app-row:active {
    transform: scale(.94);
    transition-duration: 90ms;
    background-color: color-mix(in oklab, var(--tint) 12%, var(--fill));
  }
  .app-row-icon { width: 50px; height: 50px; border-radius: 15px; }
  .app-row-icon svg { width: 24px; height: 24px; }
  .app-row-text { align-items: center; margin-top: 10px; }
  .app-row-name { font-size: 13.5px; letter-spacing: -0.01em; }
  .app-row-desc {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  /* Badge shrinks to a corner mark: green dot for open, lock otherwise */
  .app-row .app-tile-indicator { position: absolute; top: 8px; right: 8px; }
  .app-row .app-tile-indicator.is-open { font-size: 0; gap: 0; padding: 0; background: none; }
  .app-row .app-tile-indicator.is-locked,
  .app-row .app-tile-indicator.is-unlocked { width: 20px; height: 20px; }
  .app-row .app-tile-indicator svg { width: 10px; height: 10px; }
}
@media (max-width: 339px) {
  .app-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Wide screens with a mouse: content scrolls on the left, the preview stays pinned on the right */
@media (min-width: 900px) and (hover: hover) {
  .hub-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); column-gap: 44px; align-items: start; }
  .app-preview {
    --h: 260;
    --tint: hsl(var(--h) 85% 64%);
    --line: color-mix(in oklab, var(--text) 13%, transparent);
    display: block;
    position: sticky;
    top: 64px;
    height: calc(min(94vh, 860px) - 150px);
    min-height: 440px;
    padding: 26px 28px 24px;
    border-radius: var(--r-xl);
    border: 1px solid color-mix(in oklab, var(--tint) 30%, var(--border));
    background:
      radial-gradient(70% 50% at 100% 0%, color-mix(in oklab, var(--tint) 20%, transparent), transparent 70%),
      var(--fill);
    box-shadow: var(--glass-hi), var(--shadow-2), 0 24px 70px -34px var(--tint);
    overflow: hidden;
    transition: border-color .6s var(--ease-out), box-shadow .6s var(--ease-out);
  }
}

/* Preview content: shared by the pinned desktop panel and the mobile sheet */
.app-preview-inner { position: relative; display: flex; flex-direction: column; height: 100%; }
.app-preview-num {
  position: absolute; right: -6px; top: -16px;
  font-size: 112px; font-weight: 700; line-height: 1; letter-spacing: -0.06em;
  color: color-mix(in oklab, var(--tint) 13%, transparent);
  pointer-events: none;
  animation: pvNum .8s var(--ease-out) both;
}
.pv-head { position: relative; display: flex; align-items: center; gap: 14px; }
.app-preview-icon {
  display: grid; place-items: center;
  width: 60px; height: 60px; border-radius: 18px;
  color: var(--tint);
  background: color-mix(in oklab, var(--tint) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tint) 30%, transparent);
  animation: pvIcon .7s var(--ease-spring) both;
}
.app-preview-icon svg { width: 28px; height: 28px; stroke-width: 1.6px; }
.pv-status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600;
  animation: pvUp .5s var(--ease-out) .08s both;
}
.pv-status span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pv-status.is-public { color: var(--positive); background: var(--positive-bg); }
.pv-status.is-public span { animation: hubPulse 2.2s ease-out infinite; }
.pv-status.is-private { color: var(--text-3); background: var(--fill); box-shadow: inset 0 0 0 1px var(--border); }
.pv-status svg { width: 12px; height: 12px; stroke-width: 2.2px; }
.app-preview-name {
  position: relative;
  margin-top: 18px;
  font-size: 34px; font-weight: 680; letter-spacing: -0.045em; line-height: 1.05;
  animation: pvUp .5s var(--ease-out) .05s both;
}
.app-preview-desc { margin-top: 6px; font-size: 14.5px; color: var(--text-3); animation: pvUp .5s var(--ease-out) .1s both; }

/* Animated scene */
.pv-scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 128px;
  max-height: 300px;
  margin: 18px 0 16px;
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in oklab, var(--tint) 18%, var(--border));
  background:
    radial-gradient(color-mix(in oklab, var(--tint) 22%, transparent) 1px, transparent 1.3px) 0 0 / 14px 14px,
    color-mix(in oklab, var(--tint) 5%, transparent);
  overflow: hidden;
  animation: pvScene .6s var(--ease-out) .12s both;
}

/* Feature teaser */
.pv-feats-title {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 8px;
}
.pv-feats ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.pv-feats li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; line-height: 1.4; color: var(--text-2);
  animation: pvItem .5s var(--ease-out) calc(.22s + var(--i) * .07s) both;
}
.pv-feats li svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--tint); stroke-width: 2.2px; }

.app-preview-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
}
.app-preview-open {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 18px;
  border-radius: var(--r-pill); border: 0; cursor: pointer;
  font: 600 13.5px var(--font-ui);
  color: #fff;
  background: linear-gradient(135deg, var(--tint), hsl(calc(var(--h) + 30) 80% 52%));
  box-shadow: 0 8px 24px -10px var(--tint);
  transition: transform var(--t-slow) var(--ease-spring);
}
.app-preview-open:hover { transform: translateY(-2px); }
.app-preview-open svg { width: 16px; height: 16px; transition: transform var(--t-slow) var(--ease-spring); }
.app-preview-open:hover svg { transform: translate(2px, -2px); }

/* Mobile / tablet: the same preview rises as a sheet when an app is tapped */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overscroll-behavior: contain;
}
#app-sheet > .sheet {
  --h: 260;
  --tint: hsl(var(--h) 85% 64%);
  --line: color-mix(in oklab, var(--text) 13%, transparent);
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(88dvh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 22px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 26px 26px 0 0 !important;
  border-bottom: 0 !important;
  box-shadow: var(--glass-hi), var(--shadow-3), 0 -20px 70px -30px var(--tint) !important;
  animation: sheetUp .5s var(--ease-spring) both;
  touch-action: pan-y;
}
#app-sheet > .sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(80% 45% at 100% 0%, color-mix(in oklab, var(--tint) 22%, transparent), transparent 70%);
}
#app-sheet.is-closing { animation: sheetFade .22s var(--ease-out) both; }
#app-sheet.is-closing > .sheet { animation: sheetDown .26s var(--ease-out) both; }
.sheet.is-dragging { animation: none !important; transition: none; }
.sheet-grab {
  position: relative;
  width: 40px; height: 5px;
  margin: 0 auto 14px;
  border-radius: 3px;
  background: color-mix(in oklab, var(--text) 22%, transparent);
}
.sheet-close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 2;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--fill);
  color: var(--text-3);
  cursor: pointer;
}
.sheet-close svg { width: 16px; height: 16px; }
.app-preview.is-sheet { display: block; position: relative; }
.is-sheet .app-preview-num { right: 44px; top: -6px; font-size: 84px; }
.is-sheet .app-preview-name { font-size: 30px; }
.is-sheet .pv-scene { flex: none; height: 176px; }
.is-sheet .app-preview-foot { padding-top: 20px; }
.is-sheet .app-preview-open { flex: 1; justify-content: center; min-height: 50px; font-size: 15px; }
@keyframes sheetUp { from { translate: 0 100%; } }
@keyframes sheetDown { to { translate: 0 100%; } }
@keyframes sheetFade { to { opacity: 0; } }
/* Tablets and narrow desktop windows: a centred card instead of a bottom sheet */
@media (min-width: 600px) {
  .sheet-overlay { align-items: center; padding: 24px; }
  #app-sheet > .sheet {
    max-width: 440px;
    border-radius: var(--r-xl) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    padding-top: 22px;
    animation: zuiPop var(--t-slow) var(--ease-spring) both;
  }
  #app-sheet.is-closing > .sheet { animation: sheetFade .2s var(--ease-out) both; }
  .sheet-grab { display: none; }
}

/* Short laptop screens: tighten the panel so everything fits */
@media (min-width: 900px) and (hover: hover) and (max-height: 780px) {
  .app-preview { padding: 20px 22px 18px; }
  .app-preview-icon { width: 48px; height: 48px; border-radius: 14px; }
  .app-preview-icon svg { width: 22px; height: 22px; }
  .app-preview-num { font-size: 84px; }
  .app-preview-name { margin-top: 12px; font-size: 27px; }
  .app-preview-desc { font-size: 13.5px; }
  .pv-scene { min-height: 112px; margin: 12px 0; }
  .pv-feats ul { gap: 4px; }
  .pv-feats li { font-size: 12.5px; }
}

@keyframes pvNum { from { opacity: 0; translate: 16px 0; } }
@keyframes pvIcon { from { scale: .6; rotate: -12deg; opacity: 0; } }
@keyframes pvUp { from { opacity: 0; translate: 0 8px; } }
@keyframes pvItem { from { opacity: 0; translate: -8px 0; } }
@keyframes pvScene { from { opacity: 0; scale: .97; } }

/* ---------- Preview scenes: small looping illustrations, transform/opacity only ---------- */
.sc { position: relative; }
.sc i, .sc b, .sc em { display: block; }
@keyframes scSpin { to { rotate: 360deg; } }

/* zSPLIT: receipt lines light up, then each person's share pops in */
.sc-split { display: flex; align-items: center; gap: 26px; }
.sc-receipt {
  width: 100px; padding: 12px 11px 10px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--text) 6%, transparent);
  border: 1px solid var(--line);
}
.sc-receipt i { position: relative; height: 6px; width: var(--w); margin-bottom: 7px; border-radius: 3px; background: var(--line); overflow: hidden; }
.sc-receipt i::after {
  content: ''; position: absolute; inset: 0; background: var(--tint); opacity: 0;
  animation: scLine 4.8s calc(var(--i) * .3s) infinite;
}
.sc-receipt b { height: 8px; width: 55%; margin: 10px 0 0 auto; border-radius: 4px; background: var(--tint); }
@keyframes scLine { 0%, 4% { opacity: 0; } 10%, 22% { opacity: 1; } 32%, 100% { opacity: 0; } }
.sc-people { display: flex; flex-direction: column; gap: 9px; }
.sc-people span { display: flex; align-items: center; gap: 8px; }
.sc-people em { width: 22px; height: 22px; border-radius: 50%; background: hsl(calc(var(--h) + var(--i) * 50) 70% 62%); }
.sc-people i {
  height: 10px; width: 46px; border-radius: 5px;
  background: color-mix(in oklab, var(--tint) 70%, transparent);
  transform-origin: left;
  animation: scChip 4.8s calc(1.3s + var(--i) * .22s) infinite var(--ease-out);
}
@keyframes scChip { 0% { scale: 0 1; opacity: 0; } 8%, 66% { scale: 1 1; opacity: 1; } 76%, 100% { scale: 0 1; opacity: 0; } }

/* zARCADE / zGAMES: a board filling with marks */
.sc-grid { display: grid; grid-template-columns: repeat(5, 24px); gap: 8px; }
.sc-grid i { position: relative; width: 24px; height: 24px; border-radius: 7px; background: var(--line); }
.sc-grid i::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(135deg, var(--tint), hsl(calc(var(--h) + 40) 80% 60%));
  opacity: 0; scale: .4;
  animation: scMark 6s calc(var(--d) * .28s) infinite;
}
@keyframes scMark { 0%, 4% { opacity: 0; scale: .4; } 10%, 68% { opacity: .95; scale: 1; } 78%, 100% { opacity: 0; scale: .4; } }

/* zPOLLS / zBUDGET: bars growing in */
.sc-bars { width: 78%; display: flex; flex-direction: column; gap: 11px; }
.sc-bars div { display: flex; align-items: center; gap: 10px; }
.sc-bars b { flex: none; width: 22px; height: 7px; border-radius: 4px; background: var(--line); }
.sc-bars i {
  height: 12px; width: var(--w); border-radius: 6px;
  background: linear-gradient(90deg, var(--tint), hsl(calc(var(--h) + 30) 80% 60%));
  transform-origin: left;
  animation: scBar 5s calc(var(--i) * .16s) infinite var(--ease-out);
}
@keyframes scBar { 0% { scale: 0 1; } 22%, 80% { scale: 1 1; } 92%, 100% { scale: 0 1; } }

/* zWRITE / zBLOGS / zDEV: lines typed out one after another */
.sc-type { width: 74%; display: flex; flex-direction: column; gap: 10px; }
.sc-type i {
  height: 7px; width: var(--w); margin-left: var(--x); border-radius: 4px;
  background: var(--line);
  transform-origin: left;
  animation: scType 6s calc(var(--i) * .5s) infinite steps(9, end);
}
.sc-type i:first-child { background: color-mix(in oklab, var(--tint) 75%, transparent); height: 9px; }
.sc-type.is-code i:nth-child(3n + 2) { background: color-mix(in oklab, var(--tint) 60%, transparent); }
.sc-type.is-code i:nth-child(3n) { background: hsl(calc(var(--h) + 120) 60% 60% / .55); }
@keyframes scType { 0% { scale: 0 1; } 8%, 84% { scale: 1 1; } 92%, 100% { scale: 0 1; } }

/* zSHOOTS / zDOCS / zFEED: a stack of cards cycling to the front */
.sc-stack { width: 150px; height: 96px; margin-top: 18px; }
.sc-stack > i {
  position: absolute; inset: 0;
  padding: 16px 14px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--surface) 92%, var(--tint));
  border: 1px solid color-mix(in oklab, var(--tint) 28%, var(--border));
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .5);
  animation: scStack 7.5s calc(var(--i) * -2.5s) infinite var(--ease-in-out);
}
.sc-stack b { height: 7px; width: 72%; margin-bottom: 9px; border-radius: 4px; background: var(--line); }
.sc-stack b:first-child { width: 42%; background: color-mix(in oklab, var(--tint) 70%, transparent); }
@keyframes scStack {
  0%, 28% { translate: 0 -22px; scale: .84; opacity: .35; rotate: 0deg; z-index: 1; }
  33%, 61% { translate: 0 -11px; scale: .92; opacity: .7; z-index: 2; }
  66%, 88% { translate: 0 0; scale: 1; opacity: 1; z-index: 3; }
  96% { translate: 80px 6px; scale: 1; opacity: 0; rotate: 10deg; z-index: 3; }
  97% { translate: 0 -22px; scale: .84; opacity: 0; rotate: 0deg; z-index: 1; }
  100% { translate: 0 -22px; scale: .84; opacity: .35; z-index: 1; }
}

/* zVAULT: a lock with a rotating seal and a passcode filling in */
.sc-vault { width: 140px; height: 124px; display: grid; place-items: center; }
.sc-ring {
  position: absolute; top: 6px; left: 24px;
  width: 92px; height: 92px; border-radius: 50%;
  border: 1.5px dashed color-mix(in oklab, var(--tint) 55%, transparent);
  animation: scSpin 16s linear infinite;
}
.sc-lock {
  position: absolute; top: 26px; left: 44px;
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--tint), hsl(calc(var(--h) + 30) 80% 48%));
  box-shadow: 0 10px 26px -10px var(--tint);
  animation: scBeat 3.6s var(--ease-in-out) infinite;
}
.sc-lock svg { width: 22px; height: 22px; }
@keyframes scBeat { 0%, 70%, 100% { scale: 1; } 80% { scale: 1.08; } }
.sc-dots { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 7px; }
.sc-dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--line); position: relative;
}
.sc-dots i::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--tint);
  opacity: 0; scale: .3;
  animation: scDot 3.6s calc(var(--i) * .22s) infinite;
}
@keyframes scDot { 0%, 4% { opacity: 0; scale: .3; } 10%, 74% { opacity: 1; scale: 1; } 84%, 100% { opacity: 0; scale: .3; } }

/* zCANVAS: a mind map drawing itself */
.sc-nodes { width: 82%; max-width: 270px; }
.sc-nodes svg { display: block; width: 100%; height: auto; overflow: visible; }
.sc-nodes path {
  stroke: color-mix(in oklab, var(--tint) 65%, transparent);
  stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: scDraw 5.5s var(--ease-in-out) infinite;
}
.sc-nodes path:nth-child(n + 3) { animation-delay: .6s; }
.sc-nodes circle {
  fill: var(--tint);
  transform-box: fill-box; transform-origin: center;
  animation: scNode 5.5s calc(var(--i) * .25s) infinite var(--ease-out);
}
.sc-nodes circle:first-of-type { fill: hsl(calc(var(--h) + 40) 80% 62%); }
@keyframes scDraw { 0% { stroke-dashoffset: 100; } 30%, 80% { stroke-dashoffset: 0; } 92%, 100% { stroke-dashoffset: 100; opacity: 0; } }
@keyframes scNode { 0% { scale: 0; } 12%, 82% { scale: 1; } 92%, 100% { scale: 0; } }

/* zDROP: a file hopping between two devices */
.sc-drop { width: 86%; display: flex; align-items: center; gap: 10px; }
.sc-dev {
  flex: none; display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 13px;
  color: var(--tint);
  background: color-mix(in oklab, var(--tint) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tint) 26%, transparent);
}
.sc-dev svg { width: 22px; height: 22px; stroke-width: 1.7px; }
.sc-track { position: relative; flex: 1; height: 44px; }
.sc-track b {
  position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 12px);
}
.sc-file {
  position: absolute; top: 50%; left: 0; z-index: 1;
  display: grid; place-items: center;
  width: 26px; height: 26px; margin-top: -13px; border-radius: 8px;
  color: #fff;
  background: var(--tint);
  box-shadow: 0 6px 16px -6px var(--tint);
  animation: scFly 3.2s var(--ease-in-out) infinite;
}
.sc-file svg { width: 14px; height: 14px; }
@keyframes scFly {
  0% { left: 0; opacity: 0; scale: .5; translate: 0 0; }
  14% { opacity: 1; scale: 1; }
  50% { translate: 0 -14px; }
  84% { left: calc(100% - 26px); opacity: 1; scale: 1; translate: 0 0; }
  100% { left: calc(100% - 26px); opacity: 0; scale: .5; }
}

/* zTIME: a ticking clock beside a few zones */
.sc-clock { display: flex; align-items: center; gap: 24px; }
.sc-face {
  position: relative; width: 86px; height: 86px; border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--tint) 50%, transparent);
  background: color-mix(in oklab, var(--tint) 8%, transparent);
}
.sc-face i { position: absolute; left: 50%; bottom: 50%; width: 3px; margin-left: -1.5px; border-radius: 2px; transform-origin: 50% 100%; }
.sc-face .h { height: 22px; background: var(--text-2); animation: scSpin 30s linear infinite; }
.sc-face .m { height: 32px; background: var(--tint); animation: scSpin 5s linear infinite; }
.sc-face b { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--tint); }
.sc-zones { display: flex; flex-direction: column; gap: 8px; }
.sc-zones span { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 11px; font-weight: 600; color: var(--text-4); animation: scZone 4.5s calc(var(--i) * 1.5s) infinite; }
.sc-zones em { font-style: normal; font-size: 13px; color: var(--text); }
@keyframes scZone { 0%, 30%, 100% { opacity: .55; } 8%, 22% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .hub-tint { transition: none; }
  .app-row, .app-row *, .app-preview *, .app-preview *::after, #app-sheet, #app-sheet > .sheet { transition: none !important; animation: none !important; }
}

.app-tile-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
}
.app-tile-indicator.is-open {
  padding: 3px 8px 3px 7px;
  border-radius: var(--r-pill);
  color: var(--positive);
  background: var(--positive-bg);
}
.app-tile-indicator .app-dot-open {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--positive);
  animation: hubPulse 2.2s ease-out infinite;
}
.app-tile-indicator.is-locked,
.app-tile-indicator.is-unlocked {
  width: 24px; height: 24px;
  justify-content: center;
  border-radius: 50%;
  background: var(--fill);
  border: 1px solid var(--border);
  color: var(--text-4);
}
.app-tile-indicator.is-unlocked { color: var(--positive); background: var(--positive-bg); border-color: transparent; }
.app-tile-indicator svg { width: 12px; height: 12px; stroke-width: 2.2px; }

/* ---------- Lock screen ---------- */
#screen-lock .lock-panel {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 28px 24px 24px;
  text-align: center;
  animation: zuiPop var(--t-slow) var(--ease-spring) both;
}
.lock-icon {
  display: inline-grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 18px;
  margin-bottom: 16px;
  color: #fff;
  background: var(--accent-grad);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), var(--glow);
}
.lock-icon svg { width: 26px; height: 26px; stroke-width: 1.75px; }
#screen-lock h1 { font-size: 20px; margin-bottom: 6px; }
#screen-lock p.subtitle { margin-bottom: 20px; }
#screen-lock .input-group { text-align: left; }

.input-group { margin-bottom: 16px; }
label { display: block; font-size: 12px; margin-bottom: 6px; }
input {
  width: 100%;
  font-size: 16px;
  padding: 11px 14px;
  min-height: 46px;
  outline: none;
}
.internal-password { -webkit-text-security: disc; }

.lock-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--negative-bg);
  color: var(--negative);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
}
.lock-error svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  min-height: 44px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; }

.shake { animation: zuiShake .42s ease-in-out !important; }

.footer-note {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-4);
}

/* ---------- Command palette ---------- */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}
.cmdk-panel {
  width: 100%;
  max-width: 540px;
  overflow: hidden;
  padding: 0 !important;
}
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
}
.cmdk-input-row svg { width: 18px; height: 18px; flex-shrink: 0; }
.cmdk-input-row input,
.cmdk-input-row input:focus {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 16px 0;
  min-height: 56px;
  font-size: 16px;
  border-radius: 0;
}
.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.cmdk-item {
  --h: 260;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-2);
}
.cmdk-item .app-tile-icon { width: 32px; height: 32px; border-radius: 9px; margin: 0; --tint: hsl(var(--h) 85% 64%); }
.cmdk-item .app-tile-icon svg { width: 16px; height: 16px; }
.cmdk-item b { color: var(--text); font-weight: 600; font-size: 13.5px; }
.cmdk-item small { display: block; color: var(--text-3); font-size: 12px; }
.cmdk-item .cmdk-lock { margin-left: auto; color: var(--text-4); }
.cmdk-item .cmdk-lock svg { width: 14px; height: 14px; }
.cmdk-item.sel { background: var(--fill-2); color: var(--text); }
.cmdk-empty { padding: 22px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- Confirm dialog ---------- */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.confirm-panel {
  width: 100%;
  max-width: 380px;
  padding: 26px 22px 20px;
  text-align: center;
}
.confirm-panel .lock-icon { width: 48px; height: 48px; border-radius: 15px; margin-bottom: 14px; }
.confirm-panel .lock-icon svg { width: 22px; height: 22px; }
.confirm-panel h2 { font-size: 18px; margin: 0 0 6px; }
.confirm-panel .subtitle { margin: 0 0 20px; font-size: 13.5px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) {
  .confirm-modal { align-items: flex-end; }
}

/* ---------- Placeholder page ---------- */
.ph-wrap { margin: auto; text-align: center; max-width: 440px; padding: 24px 0; }
.ph-ring {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 88px; height: 88px;
  border-radius: 28px;
  margin-bottom: 22px;
  color: var(--accent-text);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  isolation: isolate;
}
.ph-ring::before {
  content: '';
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: 30px;
  background: conic-gradient(from var(--ang, 0deg), #8b6dff, #3ec6ff, #3ddc97, #ff7ac6, #8b6dff);
  animation: phSpin 4s linear infinite;
}
.ph-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 28px;
  background: var(--surface);
}
.ph-ring svg { width: 36px; height: 36px; stroke-width: 1.6px; }
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes phSpin { to { --ang: 360deg; } }
.ph-wrap h1 { font-size: 34px; letter-spacing: -0.04em; margin-bottom: 10px; }
.ph-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 26px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
}
.ph-status span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: hubPulse 2.2s ease-out infinite; }

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
  body { padding: 28px; align-items: center; }
  .container {
    max-width: 1120px;
    height: min(94vh, 860px);
    border: 1px solid var(--glass-border);
  }
  .card { padding: 22px 36px 26px; }
  #screen-lock .lock-panel { margin-top: 8vh; }
}

@media (max-width: 480px) {
  .kbd-hint span, .kbd-hint kbd { display: none; }
}

/* ---------- Page transitions (see zui.css) ---------- */
#screen-hub, #screen-lock { view-transition-name: zui-page; }
/* The arriving page is a live snapshot that repaints whenever anything in it moves, and the
   tint sits under the glass blur. Hold the ambient loops and the tint fade until it settles. */
html:active-view-transition :is(.gradient-text, .app-preview, .app-preview *) { animation-play-state: paused; }
html:active-view-transition .hub-tint,
html:active-view-transition :is(.app-row, .app-row *) { transition: none; }

/* ---------- Scroll layer hooks ---------- */
.timeline-host, #screen-hub { timeline-scope: --zui-hero; }
.nav-breadcrumbs.zui-sticky-head {
  top: -18px;
  margin: -18px -20px 18px;
  padding: 14px 20px;
  border-bottom: 1px solid transparent !important;
}
.hub-compact { margin-left: 8px; font-weight: 500; color: var(--text-3); }
@media (min-width: 768px) {
  .nav-breadcrumbs.zui-sticky-head { top: -22px; margin: -22px -36px 18px; padding: 16px 36px; }
}
@media (max-width: 559px) {
  .hub-compact { display: none !important; }
}
