/* RokBot faces, the sign-in horizon and the overview stage. */
@property --lid { syntax: "<number>"; inherits: true; initial-value: 1; }
.face {
  --size: 64px;
  --eye: var(--face-eye);
  --skin: var(--face-skin);
  position: relative;
  display: block;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: var(--shape, 46% 36% 48% 52% / 44% 38% 54% 52%);
  background: var(--skin);
  box-shadow: inset calc(var(--size) * -.05) calc(var(--size) * -.07) calc(var(--size) * .14) var(--sand-face-inner-shadow);
}
.face:not([data-hue])::after {
  content: "";
  position: absolute;
  top: 11%;
  right: 17%;
  width: 9%;
  height: 9%;
  border-radius: var(--radius-full);
  background: var(--sand-bg-accent-primary);
  box-shadow: 0 0 calc(var(--size) * .06) var(--sand-bg-accent-primary);
  pointer-events: none;
}
.face[data-hue] {
  --eye: #101010db;
  --skin: radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--c) 42%, white) 0, var(--c) 50%, color-mix(in srgb, var(--c) 70%, black) 100%);
}
.face[data-hue="red"] { --c: #fb2b3e; }
.face[data-hue="orange"] { --c: #fd690f; }
.face[data-hue="yellow"] { --c: #f59312; }
.face[data-hue="green"] { --c: #14c16f; }
.face[data-hue="cyan"] { --c: #13b7a2; }
.face[data-hue="blue"] { --c: #1e86fc; }
.face[data-hue="purple"] { --c: #8f59f9; }
.face[data-hue="magenta"] { --c: #f93498; }
.face[data-hue="brown"] { --c: #a06b39; }
.face-eyes {
  position: absolute;
  top: 27%;
  left: 31%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 38%;
  height: 30%;
  transform: translate(var(--look-x, 0px), var(--look-y, 0px));
  transition: transform var(--gaze-speed, var(--duration-max)) var(--ease-out);
}
.face-eye {
  width: 27%;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--eye);
  transform: rotate(-26deg) scaleY(var(--lid));
  transition: transform var(--duration-fast) var(--ease-out);
}
.face-eye:last-child {
  height: 82%;
}
.face.blink .face-eye { --lid: .08; transition-duration: 60ms; }
.face[data-state="closed"] .face-eye, .face[data-state="sleep"] .face-eye { --lid: .1; }
.face[data-state="happy"] .face-eye { --lid: .32; }
.face[data-state="up"] .face-eyes { transform: translateY(-14%); }
.face[data-state="down"] .face-eyes { transform: translateY(16%); }
.face[data-state="busy"]:not([data-mood]) .face-eyes { animation: glance 2.8s ease-in-out infinite; }

/* Working moods: each face gets one, scaled by its own --mood-speed and shifted by --mood-delay. */
.face[data-mood] { --tempo: calc(var(--mood-speed, 1) * 1s); }
.face[data-mood="reading"] .face-eyes { animation: read calc(var(--tempo) * 2.6) ease-in-out infinite; animation-delay: var(--mood-delay); }
.face[data-mood="typing"] { animation: bob calc(var(--tempo) * .5) ease-in-out infinite alternate; animation-delay: var(--mood-delay); }
.face[data-mood="typing"] .face-eyes { animation: type calc(var(--tempo) * 1.2) steps(1) infinite; animation-delay: var(--mood-delay); }
.face[data-mood="thinking"] { animation: tilt calc(var(--tempo) * 3.4) ease-in-out infinite alternate, ponder calc(var(--tempo) * 4.6) linear infinite; animation-delay: var(--mood-delay); }
.face[data-mood="thinking"] .face-eyes { transform: translate(14%, -18%); }
.face[data-mood="scanning"] .face-eyes { animation: scan calc(var(--tempo) * 3.2) ease-in-out infinite; animation-delay: var(--mood-delay); }
.face[data-mood="focused"] { animation: breathe calc(var(--tempo) * 2.2) ease-in-out infinite alternate, stare calc(var(--tempo) * 3.8) linear infinite; animation-delay: var(--mood-delay); }
.face[data-mood="focused"] .face-eyes { transform: translateY(6%); }
.face[data-mood="nodding"] { animation: nod calc(var(--tempo) * 1.4) ease-in-out infinite; animation-delay: var(--mood-delay); }
.face[data-mood="nodding"] .face-eyes { transform: translate(-10%, 14%); }
@keyframes read { 0%, 100% { transform: translate(-14%, 6%); } 42%, 52% { transform: translate(14%, 6%); } 60% { transform: translate(14%, 12%); } }
@keyframes type { 0% { transform: translate(-8%, 20%); } 25% { transform: translate(-1%, 20%); } 50% { transform: translate(6%, 22%); } 75% { transform: translate(-3%, 20%); } }
@keyframes bob { to { translate: 0 3%; } }
@keyframes tilt { from { rotate: -5deg; } to { rotate: 6deg; } }
@keyframes ponder { 0%, 78% { --lid: .72; } 84% { --lid: .08; } 90%, 100% { --lid: .72; } }
@keyframes scan { 0%, 100% { transform: translate(-13%, -9%); } 25% { transform: translate(13%, -9%); } 50% { transform: translate(13%, 11%); } 75% { transform: translate(-13%, 11%); } }
@keyframes breathe { to { scale: 1.035; } }
@keyframes stare { 0%, 86% { --lid: .66; } 91% { --lid: .08; } 96%, 100% { --lid: .66; } }
@keyframes nod { 0%, 100% { translate: 0 0; rotate: 0deg; } 40% { translate: 0 4%; rotate: 3deg; } 60% { translate: 0 1%; rotate: -1deg; } }
.face.shake { animation: shake 520ms var(--ease-out); }
@keyframes glance { 0%, 100% { transform: translateX(-14%); } 45%, 55% { transform: translateX(14%); } }
@keyframes shake { 20% { translate: -2.5% 0; } 40% { translate: 2.5% 0; } 60% { translate: -1.5% 0; } 80% { translate: 1% 0; } }

/* Sign-in: the Host face rises over the bottom edge and watches the form. */
.auth { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; background: var(--sand-bg-sidebar); color: var(--sand-text-primary); }
html:has(.auth:not([hidden])) { background: var(--sand-bg-auth-backdrop); }
.auth-top { display: flex; align-items: center; padding: var(--space-4) 20px; }
/* The password goes in a composer-style pill; errors pop up above it without moving it. */
.auth-talk {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  align-self: center;
  justify-self: center;
  width: min(460px, calc(100% - var(--space-8)));
  margin: var(--space-6) 0 48px;
}
.auth-bubble {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  left: 0;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 18px;
  border-radius: 22px;
  background: var(--sand-bg-elevated);
  color: var(--sand-text-danger-primary);
  font: 15px/22px var(--font-sans);
  text-align: center;
  animation: bubble-in var(--duration-normal) var(--ease-out);
}
.auth-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px var(--space-4);
  border: var(--hairline) solid var(--sand-border-secondary-translucent);
  border-radius: var(--radius-full);
  background: var(--sand-bg-elevated);
  color: var(--sand-text-primary);
  font: var(--text-secondary);
  font-weight: var(--weight-medium);
  text-decoration: none;
}
.auth-link[hidden] { display: none; }
.auth-link:hover { background: var(--sand-bg-elevated-hover); text-decoration: none; }
.composer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 54px;
  padding: 6px 6px 6px 22px;
  border: var(--hairline) solid var(--sand-border-secondary-translucent);
  border-radius: var(--radius-full);
  background: var(--sand-bg-elevated);
  box-shadow: var(--shadow-composer);
  transition: border-color var(--duration-fast) var(--ease-out);
}
.composer:focus-within { border-color: var(--sand-border-primary-translucent); }
.composer input:not([type=checkbox]):not([type=radio]):not([type=file]) { flex: 1; min-height: 40px; padding: 0; border: 0; background: transparent; font: 15px/22px var(--font-sans); box-shadow: none; }
label.composer { padding-right: 22px; }
.send-btn { position: relative; width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--sand-bg-primary); color: var(--sand-text-inverted); }
.auth-talk.pending .send-btn svg { opacity: 0; }
.auth-talk.pending .send-btn::after { content: ""; position: absolute; inset: 0; width: 16px; height: 16px; margin: auto; border: 2px solid currentColor; border-right-color: transparent; border-radius: var(--radius-full); animation: spin 700ms linear infinite; }
.send-btn:hover:not(:disabled) { background: var(--sand-bg-primary-hover); color: var(--sand-text-inverted); }
.send-btn:disabled { background: var(--sand-bg-primary-disabled); color: var(--sand-text-inverted); opacity: 1; }
.send-btn svg { width: 18px; height: 18px; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes spin { to { transform: rotate(1turn); } }
.auth-horizon { --face: min(92vmin, 820px); position: relative; height: calc(var(--face) * .34); }
.login-face { --size: var(--face); position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.login-face .face-eyes { top: 12%; left: 33%; width: 34%; height: 15%; }
@media (max-height: 640px) { .auth-horizon { --face: min(80vmin, 640px); } }

/* Overview header: balanced status card with compact Host illustration on the right. */
.page.overview { gap: var(--space-6); max-width: 1040px; padding: var(--space-8) var(--space-8) 72px; }
.page.overview .page-body, .page.overview .module { gap: var(--space-6); }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "copy host" "crew crew";
  gap: var(--space-4) var(--space-6);
  align-items: center;
  padding: var(--space-6);
  border: var(--hairline) solid var(--sand-border-secondary-translucent);
  border-radius: var(--radius-lg);
  background: var(--sand-bg-elevated);
  box-shadow: var(--shadow-card);
}
.hero-copy { display: flex; flex-direction: column; gap: var(--space-2); grid-area: copy; align-self: center; min-width: 0; }
.hero-title { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-1); color: var(--sand-text-primary); font: var(--text-page-title); letter-spacing: -0.012em; overflow-wrap: anywhere; }
.hero-usage { color: var(--sand-text-secondary); font: var(--text-secondary); font-variant-numeric: tabular-nums; }
.hero-host { grid-area: host; align-self: center; }
.hero-host .face { --size: 76px; box-shadow: inset calc(var(--size) * -.05) calc(var(--size) * -.07) calc(var(--size) * .14) var(--sand-face-inner-shadow), 0 calc(var(--size) * .1) calc(var(--size) * .18) calc(var(--size) * -.08) var(--sand-face-drop-shadow); }
.crew { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4); grid-area: crew; min-width: 0; padding-top: var(--space-3); border-top: var(--hairline) solid var(--sand-border-tertiary-translucent); }
.crew:empty { display: none; }
.crew-bot { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); margin: 0; }
.crew-bot .face { --size: 48px; }
.crew-name { max-width: 84px; overflow: hidden; color: var(--sand-text-secondary); font: var(--text-meta); text-overflow: ellipsis; white-space: nowrap; }
.crew-more { display: grid; place-items: center; min-width: 44px; height: 44px; margin-bottom: var(--space-6); padding: 0 var(--space-3); border-radius: var(--radius-full); background: var(--sand-bg-elevated-hover); color: var(--sand-text-secondary); font: var(--text-secondary); font-weight: var(--weight-medium); }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); align-items: start; }
.row-icon-title { display: flex; align-items: center; gap: 10px; }
.row-icon-title svg { flex: none; color: var(--sand-icon-tertiary); }
.overview .row.link { min-height: 48px; }
.overview .row.link .status { color: var(--sand-text-secondary); }

/* Attention queue: blocking setup items get accent prominence; optional items stay neutral. */
.attention-row .row-title { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-weight: var(--weight-medium); }
.attention-blocking { background: var(--sand-bg-accent-secondary); box-shadow: inset 3px 0 0 var(--sand-bg-accent-primary); }
.attention-blocking .row-title { color: var(--sand-text-primary); font-weight: var(--weight-semibold); }
.attention-optional { background: transparent; }

/* Usage by model: the charts are usage-charts.css; counts show the exact number on hover. */
.usage .section-head { flex-wrap: wrap; }
.usage-count { border-radius: 3px; cursor: help; -webkit-touch-callout: none; user-select: none; }
.usage-count:focus-visible { outline: 2px solid var(--sand-border-focus-primary); outline-offset: 1px; }
@media (max-width: 900px) { .overview-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .page.overview { gap: var(--space-6); padding: var(--space-4) var(--space-4) 56px; }
  .hero { grid-template-areas: "copy host" "crew crew"; gap: var(--space-3); align-items: center; padding: var(--space-4); }
  .hero-title { font: var(--text-heading3); font-weight: var(--weight-semibold); text-wrap: balance; }
  .hero-usage { font: var(--text-secondary); }
  .hero-host { align-self: center; }
  .hero-host .face { --size: 56px; }
  .crew { gap: var(--space-3); }
  .crew-bot .face { --size: 40px; }
  .crew-name { max-width: 52px; }
  .crew-more { min-width: 40px; height: 40px; margin-bottom: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) { .face-eyes { transition: none; } }

/* Overview: compact facts that link to their pages, and one card per console page. */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); }
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-4);
  border: var(--hairline) solid var(--sand-border-secondary-translucent);
  border-radius: var(--radius-lg);
  background: var(--sand-bg-elevated);
  box-shadow: var(--shadow-card);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
a.stat:hover { background: var(--sand-bg-elevated); border-color: var(--sand-border-primary-translucent); box-shadow: var(--shadow-card-hover); text-decoration: none; }
a.stat:focus-visible, .section-link:focus-visible { outline: 2px solid var(--sand-border-focus-primary); outline-offset: 2px; }
.stat-label { color: var(--sand-text-tertiary); font: var(--text-meta); font-weight: var(--weight-medium); }
.stat-value { display: flex; align-items: baseline; gap: var(--space-1); min-width: 0; color: var(--sand-text-primary); font: var(--text-stat-value); font-variant-numeric: tabular-nums; }
.stat-number { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-unit { flex: none; color: var(--sand-text-tertiary); font: var(--text-meta); font-weight: var(--weight-regular); }
.stat-value[data-tone="success"] { color: var(--sand-text-success-primary); }
.stat-value[data-tone="warn"] { color: var(--sand-text-warn-primary); }
.stat-value[data-tone="accent"] { color: var(--sand-text-accent-primary); }
.stat-hint { color: var(--sand-text-tertiary); font: var(--text-meta); line-height: 16px; overflow-wrap: anywhere; }
.stat-hint:empty { display: none; }
.section-head .section-icon { display: inline-grid; color: var(--sand-icon-tertiary); }
.section-head .section-icon svg { width: 14px; height: 14px; }
.section-head:has(.section-icon) { justify-content: flex-start; gap: 6px; }
.section-link { color: var(--sand-text-secondary); text-decoration: none; }
.section-link:hover { color: var(--sand-text-primary); text-decoration: none; }
.overview a.row.link, .overview a.row.link:hover { text-decoration: none; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.overview a.row.link .row-copy { flex: 1 1 auto; min-width: 0; }
#tenant-box-mode-card .row-title { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
#user-box-runtime-hint { padding: var(--space-2) var(--space-3); border: var(--hairline) solid var(--sand-border-secondary-translucent); border-radius: var(--radius-md); background: var(--sand-bg-secondary); color: var(--sand-text-secondary); }
#user-box-runtime-hint.is-warn { border-color: transparent; background: var(--sand-bg-warn-secondary); color: var(--sand-text-warn-primary); }
#user-box-runtime-hint .runtime-hint-title { color: var(--sand-text-primary); font: var(--text-body2); font-weight: var(--weight-medium); }
#user-box-runtime-hint .runtime-hint-summary { margin-top: 2px; color: var(--sand-text-secondary); font: var(--text-body2); }
#user-box-runtime-hint .runtime-hint-details { margin-top: 8px; padding-top: 6px; border-top: var(--hairline) solid var(--sand-border-tertiary-translucent); }
#user-box-runtime-hint .runtime-hint-details > summary { min-height: 28px; padding: 2px 0; color: var(--sand-text-secondary); font: var(--text-body2); }
#user-box-runtime-hint .runtime-hint-steps { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 0; padding-left: 18px; color: var(--sand-text-secondary); font: var(--text-body2); }
#tenant-box-mode-form textarea { width: 100%; font: var(--text-mono); }
