:root {
  color-scheme: dark;
  --bg: #070a10;
  --panel: rgba(12, 17, 26, 0.86);
  --panel-strong: rgba(15, 22, 33, 0.94);
  --line: rgba(145, 190, 218, 0.16);
  --line-strong: rgba(122, 211, 225, 0.34);
  --text: #eef6f8;
  --muted: #8d9ca8;
  --dim: #63717d;
  --cyan: #71d7df;
  --cyan-soft: rgba(113, 215, 223, 0.1);
  --cyan-faint: rgba(113, 215, 223, 0.045);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 76% -18%, rgba(53, 114, 155, 0.2), transparent 42%),
    radial-gradient(circle at -8% 86%, rgba(38, 118, 126, 0.11), transparent 34%),
    var(--bg);
}

button,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(117, 171, 191, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 171, 191, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 86%);
  mask-image: linear-gradient(to bottom, black, transparent 86%);
}

.app-shell {
  width: min(1280px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  margin-bottom: 12px;
  padding: 0 3px 10px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: inset 0 0 16px rgba(97, 207, 218, 0.08), 0 0 24px rgba(97, 207, 218, 0.07);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(113, 215, 223, 0.2);
  border-radius: 50%;
}

.brand-mark::before {
  inset: 5px;
  border-right-color: transparent;
}

.brand-mark::after {
  inset: 10px;
  border-left-color: transparent;
}

.brand-core {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.27em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c5dce0;
  background: rgba(11, 18, 25, 0.58);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.63rem;
  letter-spacing: 0.12em;
}

.status-pulse {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(113, 215, 223, 0.07), 0 0 10px rgba(113, 215, 223, 0.8);
}

.status-pulse {
  animation: breathe 2.8s ease-in-out infinite;
}

.workspace {
  height: calc(100vh - 102px);
  height: calc(100dvh - 102px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: 540px;
}

.conversation-surface {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.conversation-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 58px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(113, 215, 223, 0.025), transparent 45%);
}

.project-controls {
  display: grid;
  width: min(460px, 100%);
  min-width: 320px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.select-wrap {
  position: relative;
  min-width: 0;
}

.select-wrap::after {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
  content: "";
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

select,
.new-conversation-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: rgba(5, 9, 15, 0.74);
}

select {
  width: 100%;
  appearance: none;
  padding: 0 38px 0 13px;
}

select:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.72;
}

.new-conversation-button {
  display: inline-flex;
  width: 46px;
  min-width: 46px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--cyan);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.new-conversation-icon {
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
}

.new-conversation-button:hover {
  border-color: var(--line-strong);
  color: #d8fbfd;
  background: var(--cyan-soft);
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 19, 0.72);
}

textarea {
  width: 100%;
  min-height: 50px;
  max-height: 150px;
  resize: none;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(5, 9, 15, 0.78);
  line-height: 1.45;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea::placeholder {
  color: #64717d;
}

textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(113, 215, 223, 0.055);
}

.send-button {
  display: inline-flex;
  min-width: 108px;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 13px;
  border: 1px solid rgba(113, 215, 223, 0.42);
  border-radius: 11px;
  color: #061015;
  background: linear-gradient(135deg, #a2e6e5, #62becb);
  font-weight: 700;
  transition: filter 150ms ease, transform 150ms ease;
}

.send-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: wait;
  filter: saturate(0.35);
  opacity: 0.65;
}

.send-arrow {
  font-size: 1.05rem;
}

.composer-hint {
  position: absolute;
  bottom: 6px;
  left: 31px;
  margin: 0;
  color: var(--dim);
  font-size: 0.63rem;
}

.feed-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(145, 190, 218, 0.1);
  color: var(--dim);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.feed-label span:last-child {
  color: rgba(113, 215, 223, 0.62);
}

.message-list {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 16px 28px;
  scrollbar-color: rgba(113, 215, 223, 0.22) transparent;
  scrollbar-width: thin;
}

.empty-state {
  display: grid;
  min-height: 100%;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: clamp(0.98rem, 2vw, 1.12rem);
  letter-spacing: -0.015em;
}

.empty-orbit {
  position: relative;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(113, 215, 223, 0.21);
  border-radius: 50%;
  box-shadow: inset 0 0 24px rgba(113, 215, 223, 0.045);
}

.empty-orbit::before,
.empty-orbit::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.empty-orbit::before {
  inset: 11px;
  border: 1px solid rgba(113, 215, 223, 0.3);
  border-top-color: transparent;
  transform: rotate(-25deg);
}

.empty-orbit::after {
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
  transform: translate(-50%, -50%);
}

.conversation-turn {
  position: relative;
  width: min(100%, 980px);
  margin: 0 auto 12px;
  padding: 15px 16px 17px 19px;
  overflow: hidden;
  border: 1px solid rgba(145, 190, 218, 0.13);
  border-radius: 14px;
  background: rgba(11, 17, 26, 0.6);
}

.conversation-turn::before {
  position: absolute;
  inset: 14px auto 14px 0;
  width: 2px;
  border-radius: 99px;
  content: "";
  background: linear-gradient(to bottom, rgba(92, 145, 184, 0.7), rgba(113, 215, 223, 0.72));
}

.conversation-turn-current {
  border-color: rgba(113, 215, 223, 0.25);
  background: linear-gradient(120deg, rgba(36, 77, 91, 0.12), rgba(11, 17, 26, 0.7));
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.13);
}

.exchange-message + .exchange-message {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid rgba(145, 190, 218, 0.11);
}

.message-meta {
  margin: 0 0 6px;
  color: var(--dim);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.61rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.message-user .message-meta {
  color: #8daec6;
}

.message-assistant .message-meta {
  color: rgba(113, 215, 223, 0.82);
}

.message-content {
  width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: #dfe9ec;
  background: rgba(13, 21, 31, 0.76);
  font-size: 0.94rem;
  line-height: 1.58;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-user .message-content {
  border-color: rgba(93, 143, 179, 0.22);
  background: rgba(53, 91, 120, 0.16);
}

.message-error .message-content {
  border-color: rgba(255, 157, 157, 0.22);
  color: #ffd0d0;
  background: rgba(102, 38, 44, 0.12);
}

.thinking-dots {
  display: inline-flex;
  min-height: 18px;
  align-items: center;
  gap: 5px;
}

.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  animation: think 1.2s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 160ms;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 320ms;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.62;
  }
  50% {
    opacity: 1;
  }
}

@keyframes think {
  0%,
  70%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding-inline: max(12px, env(safe-area-inset-left));
  }

  .conversation-toolbar {
    gap: 12px;
  }

  .project-controls {
    width: min(470px, 55%);
    min-width: 350px;
  }
}

@media (max-width: 680px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    padding: max(7px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .topbar {
    min-height: 48px;
    margin-bottom: 7px;
    padding: 0 3px 7px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-mark::before {
    inset: 4px;
  }

  .brand-mark::after {
    inset: 9px;
  }

  .brand-name {
    font-size: 0.88rem;
  }

  .brand-subtitle {
    font-size: 0.54rem;
  }

  .system-status {
    gap: 6px;
    padding: 7px 8px;
    font-size: 0.54rem;
  }

  .status-pulse {
    width: 6px;
    height: 6px;
  }

  .workspace {
    height: auto;
    min-height: calc(100dvh - 72px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .conversation-surface {
    height: auto;
    min-height: inherit;
    overflow: visible;
    border-radius: 14px;
  }

  .conversation-toolbar {
    display: grid;
    min-height: 0;
    gap: 8px;
    padding: 9px 10px 10px;
  }

  .project-controls {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }

  select,
  .new-conversation-button {
    min-height: 44px;
  }

  .new-conversation-button {
    width: 44px;
    min-width: 44px;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 50px;
    gap: 7px;
    padding: 9px 9px 10px;
  }

  textarea {
    min-height: 48px;
    padding: 12px;
  }

  .send-button {
    width: 50px;
    min-width: 50px;
    min-height: 48px;
    padding: 0;
  }

  .send-button span:first-child,
  .composer-hint {
    display: none;
  }

  .feed-label {
    min-height: 30px;
    padding-inline: 10px;
    font-size: 0.53rem;
  }

  .message-list {
    min-height: 300px;
    overflow: visible;
    padding: 7px 7px 14px;
  }

  .empty-state {
    min-height: 290px;
  }

  .empty-orbit {
    width: 44px;
    height: 44px;
  }

  .conversation-turn {
    width: 100%;
    margin-bottom: 8px;
    padding: 11px 9px 12px 12px;
    border-radius: 11px;
  }

  .conversation-turn::before {
    inset-block: 11px;
  }

  .exchange-message + .exchange-message {
    margin-top: 10px;
    padding-top: 10px;
  }

  .message-meta {
    margin-bottom: 5px;
    font-size: 0.57rem;
  }

  .message-content {
    padding: 10px 11px;
    border-radius: 9px;
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* Mobile compatibility for any already-open pre-revision document. */
  .message-avatar {
    display: none !important;
  }

  .message,
  .message-user {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 0 9px !important;
  }

  .message-body,
  .message-user .message-body {
    width: 100% !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }

  .context-panel {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px !important;
    padding: 8px !important;
    border: 1px solid var(--line) !important;
    border-radius: 12px !important;
    background: var(--panel) !important;
  }

  .context-heading,
  .context-readout,
  .memory-state,
  .field-help {
    display: none !important;
  }

  .field-group {
    min-width: 0 !important;
    margin: 0 !important;
  }

  .secondary-button {
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    color: var(--cyan) !important;
    background: rgba(5, 9, 15, 0.74) !important;
  }

  .chat-panel {
    display: flex !important;
    min-height: 0 !important;
    flex-direction: column !important;
  }

  .chat-heading {
    display: flex !important;
    min-height: 0 !important;
    order: 1 !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    padding: 7px 10px !important;
    border-bottom: 1px solid var(--line) !important;
  }

  .chat-heading .eyebrow,
  .active-project-chip span {
    display: none !important;
  }

  .chat-heading h1 {
    margin: 0 !important;
    font-size: 0.82rem !important;
    font-weight: 620 !important;
    letter-spacing: 0 !important;
  }

  .active-project-chip {
    display: inline-flex !important;
    min-width: 0 !important;
    align-items: center !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  .active-project-chip::before {
    margin-right: 6px;
    color: var(--dim);
    content: "·";
  }

  .active-project-chip strong {
    color: #a7c7be !important;
    font-size: 0.74rem !important;
  }

  .chat-panel .composer {
    order: 2 !important;
  }

  .chat-panel .message-list {
    order: 3 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* SANDI Orb — primary local intelligence interface. */
[hidden] {
  display: none !important;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 9px;
}

.interface-view {
  min-width: 0;
  min-height: 0;
}

.mode-switch {
  position: relative;
  z-index: 10;
  display: inline-grid;
  width: max-content;
  grid-template-columns: repeat(2, 92px);
  justify-self: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(119, 196, 217, 0.18);
  border-radius: 999px;
  background: rgba(6, 11, 18, 0.82);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26), inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(16px);
}

.mode-button {
  min-height: 30px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  color: #728590;
  background: transparent;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.mode-button.is-active {
  color: #dcfbff;
  background: linear-gradient(180deg, rgba(45, 111, 133, 0.38), rgba(17, 56, 69, 0.34));
  box-shadow: inset 0 0 0 1px rgba(111, 231, 244, 0.28), 0 0 18px rgba(39, 190, 214, 0.08);
}

.orb-view {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(108, 190, 215, 0.19);
  border-radius: 18px;
  background:
    radial-gradient(circle at 34% 48%, rgba(24, 142, 169, 0.12), transparent 31%),
    radial-gradient(circle at 78% 18%, rgba(40, 86, 139, 0.12), transparent 28%),
    linear-gradient(145deg, rgba(13, 21, 32, 0.98), rgba(5, 10, 17, 0.99) 58%, rgba(10, 20, 29, 0.98));
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.025);
}

.orb-view::before,
.orb-view::after {
  position: absolute;
  pointer-events: none;
  content: "";
}

.orb-view::before {
  inset: 0;
  z-index: -1;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(97, 178, 198, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(97, 178, 198, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(circle at 36% 50%, black, transparent 78%);
  mask-image: radial-gradient(circle at 36% 50%, black, transparent 78%);
}

.orb-view::after {
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.45);
}

.neural-canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.72;
}

.hud-corner {
  position: absolute;
  z-index: 4;
  width: 28px;
  height: 28px;
  pointer-events: none;
  opacity: 0.48;
}

.hud-corner-top-left {
  top: 13px;
  left: 13px;
  border-top: 1px solid var(--cyan);
  border-left: 1px solid var(--cyan);
}

.hud-corner-top-right {
  top: 13px;
  right: 13px;
  border-top: 1px solid var(--cyan);
  border-right: 1px solid var(--cyan);
}

.hud-corner-bottom-left {
  bottom: 13px;
  left: 13px;
  border-bottom: 1px solid var(--cyan);
  border-left: 1px solid var(--cyan);
}

.hud-corner-bottom-right {
  right: 13px;
  bottom: 13px;
  border-right: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
}

.orb-layout {
  position: relative;
  z-index: 2;
  display: grid;
  height: 100%;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: clamp(18px, 3vw, 40px);
}

.orb-primary {
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  text-align: center;
}

.core-designation {
  margin: 0 0 6px;
  color: #a9c5cd;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.core-designation span {
  margin-left: 8px;
  color: #4f6872;
  font-weight: 500;
  letter-spacing: 0.13em;
}

.orb-state-readout {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 3px;
  color: #617781;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.57rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.orb-state-readout strong {
  color: #b9f3f8;
  font-size: inherit;
  font-weight: 700;
}

.orb-state-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #76eaf2;
  box-shadow: 0 0 10px rgba(118, 234, 242, 0.9);
}

.sandy-orb {
  position: relative;
  display: grid;
  width: clamp(236px, 30vw, 330px);
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

.sandy-orb:focus-visible {
  outline-offset: 6px;
}

.orb-greeting {
  margin: 1px 0 2px;
  color: #e9fbfc;
  font-size: clamp(1.1rem, 2.1vw, 1.45rem);
  font-weight: 530;
  letter-spacing: -0.025em;
  text-shadow: 0 0 28px rgba(104, 221, 231, 0.15);
}

.orb-caption {
  margin: 0;
  color: #61747d;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.orb-project-context {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  padding: 0 11px;
  border: 1px solid rgba(115, 184, 205, 0.13);
  border-radius: 999px;
  color: #60747d;
  background: rgba(5, 11, 18, 0.42);
}

.orb-project-context span,
.orb-dev-panel > p {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.52rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.orb-project-context strong {
  max-width: 180px;
  overflow: hidden;
  color: #ccebed;
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orb-project-context small {
  color: #536a74;
  font-size: 0.55rem;
}

.voice-controls {
  display: grid;
  width: 190px;
  gap: 6px;
  margin-top: 9px;
}

.voice-control {
  display: inline-flex;
  min-width: 190px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 0;
  padding: 6px 12px;
  border: 1px solid rgba(99, 196, 216, 0.12);
  border-radius: 13px;
  color: #9fc4c9;
  background: rgba(6, 13, 21, 0.34);
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.voice-control:hover:not(:disabled),
.voice-control.is-active {
  border-color: rgba(99, 216, 229, 0.34);
  color: #ddfbfd;
  background: rgba(39, 124, 143, 0.13);
}

.voice-control:disabled {
  cursor: wait;
  opacity: 0.72;
}

.voice-control > span:last-child {
  display: grid;
  gap: 2px;
  text-align: left;
}

.voice-control strong {
  font-size: 0.7rem;
  font-weight: 600;
}

.voice-control small {
  color: #526871;
  font-size: 0.57rem;
}

.voice-audio {
  display: none;
}

.voice-glyph {
  display: flex;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgba(99, 216, 229, 0.26);
  border-radius: 50%;
  background: rgba(61, 175, 194, 0.06);
}

.voice-glyph i {
  display: block;
  width: 2px;
  height: 8px;
  border-radius: 3px;
  background: #79dce5;
}

.voice-glyph i:nth-child(2) {
  height: 14px;
}

.hands-free-control {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 9px;
  padding: 5px 11px;
  border: 1px solid rgba(99, 196, 216, 0.1);
  border-radius: 11px;
  color: #78939a;
  background: rgba(6, 13, 21, 0.26);
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.hands-free-control:hover:not(:disabled),
.hands-free-control.is-active {
  border-color: rgba(99, 216, 229, 0.25);
  color: #c9eff2;
  background: rgba(39, 124, 143, 0.09);
}

.hands-free-control:disabled {
  cursor: wait;
  opacity: 0.74;
}

.hands-free-control > span:last-child {
  display: grid;
  gap: 1px;
}

.hands-free-control strong {
  font-size: 0.62rem;
  font-weight: 600;
}

.hands-free-control small {
  color: #4f656d;
  font-size: 0.53rem;
}

.hands-free-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #41515a;
  box-shadow: 0 0 0 3px rgba(90, 113, 123, 0.07);
}

.hands-free-control.is-active .hands-free-dot {
  background: #71d7df;
  box-shadow: 0 0 0 3px rgba(113, 215, 223, 0.08), 0 0 9px rgba(113, 215, 223, 0.62);
}

.hands-free-control.is-waiting .hands-free-dot {
  animation: hands-free-pulse 1.1s ease-in-out infinite;
}

.orb-dev-panel {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  width: min(270px, calc(100% - 28px));
  padding: 9px;
  border: 1px solid rgba(120, 190, 209, 0.18);
  border-radius: 11px;
  background: rgba(5, 11, 18, 0.9);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.orb-dev-panel > p {
  display: flex;
  justify-content: space-between;
  margin: 0 2px 7px;
  color: #6d858f;
}

.orb-dev-panel > p span {
  color: #b89565;
}

.orb-dev-panel > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.orb-dev-panel button {
  min-height: 30px;
  padding: 0 5px;
  border: 1px solid rgba(103, 177, 197, 0.13);
  border-radius: 7px;
  color: #6f8790;
  background: rgba(2, 8, 14, 0.5);
  font-size: 0.57rem;
  letter-spacing: 0.05em;
}

.orb-dev-panel button.is-active {
  border-color: rgba(105, 224, 236, 0.39);
  color: #c4f8fa;
  background: rgba(54, 162, 181, 0.13);
  box-shadow: inset 0 0 12px rgba(88, 208, 225, 0.06);
}

.orb-view[data-orb-state="speaking"] .voice-control .voice-glyph i {
  animation: voice-wave 0.72s ease-in-out infinite alternate;
}

.orb-view[data-orb-state="speaking"] .voice-control .voice-glyph i:nth-child(2) {
  animation-delay: -0.28s;
}

@keyframes orb-turn {
  to { transform: rotate(360deg); }
}

@keyframes orb-turn-reverse {
  to { transform: rotate(-360deg); }
}

@keyframes orb-breathe {
  0%, 100% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 0.82; transform: scale(1.015); }
}

@keyframes lens-breathe {
  0%, 100% { transform: scale(0.995); filter: brightness(0.96); }
  50% { transform: scale(1.008); filter: brightness(1.04); }
}

@keyframes spark-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes scan-pulse {
  0% { opacity: 0.72; transform: scale(0.78); }
  100% { opacity: 0; transform: scale(2.55); }
}

@keyframes listening-wave {
  0% { opacity: 0.28; transform: scale(0.9); }
  55% { opacity: 0.92; }
  100% { opacity: 0; transform: scale(1.12); }
}

@keyframes listening-core {
  0%, 100% { transform: scale(0.96); filter: brightness(0.92) saturate(0.96); }
  50% { transform: scale(1.07); filter: brightness(1.34) saturate(1.15); }
}

@keyframes listening-halo {
  0%, 100% { opacity: 0.48; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.13); }
}

@keyframes listening-center-light {
  0%, 100% { opacity: 0.16; transform: scale(0.78); }
  50% { opacity: 0.72; transform: scale(1.08); }
}

@keyframes listening-iris {
  0%, 100% { transform: scale(0.88); filter: brightness(0.92); }
  50% { transform: scale(1.08); filter: brightness(1.38); }
}

@keyframes thinking-focus {
  0%, 100% { transform: scale(0.985); filter: hue-rotate(12deg) brightness(1.04); }
  42% { transform: scale(1); filter: hue-rotate(18deg) brightness(1.18); }
  73% { transform: scale(0.99); filter: hue-rotate(8deg) brightness(1.1); }
}

@keyframes thinking-iris {
  0%, 100% { transform: scale(0.72); filter: brightness(1.28) hue-rotate(18deg); }
  50% { transform: scale(0.82); filter: brightness(1.52) hue-rotate(24deg); }
}

@keyframes neural-flicker {
  0%, 100% { opacity: 0.22; }
  19% { opacity: 0.58; }
  41% { opacity: 0.34; }
  67% { opacity: 0.72; }
  82% { opacity: 0.4; }
}

@keyframes speaking-ring {
  0%, 100% { transform: scale(0.97); }
  50% { transform: scale(1.035); }
}

@keyframes speech-core {
  0%, 100% { transform: scale(0.94); filter: brightness(0.9); }
  12% { transform: scale(1.08); filter: brightness(1.42); }
  25% { transform: scale(0.98); filter: brightness(1.06); }
  39% { transform: scale(1.13); filter: brightness(1.58); }
  56% { transform: scale(0.96); filter: brightness(0.98); }
  72% { transform: scale(1.06); filter: brightness(1.35); }
  84% { transform: scale(1.01); filter: brightness(1.14); }
}

@keyframes speech-iris {
  0%, 100% { transform: scale(0.76); filter: brightness(0.86); }
  12% { transform: scale(1.16); filter: brightness(1.55); }
  25% { transform: scale(0.9); filter: brightness(1.02); }
  39% { transform: scale(1.25); filter: brightness(1.72); }
  56% { transform: scale(0.82); filter: brightness(0.92); }
  72% { transform: scale(1.1); filter: brightness(1.42); }
  84% { transform: scale(0.96); filter: brightness(1.12); }
}

@keyframes speech-light {
  0%, 100% { opacity: 0.18; transform: scale(0.75); }
  12% { opacity: 0.78; transform: scale(1.05); }
  25% { opacity: 0.34; transform: scale(0.9); }
  39% { opacity: 0.92; transform: scale(1.14); }
  56% { opacity: 0.24; transform: scale(0.82); }
  72% { opacity: 0.68; transform: scale(1.02); }
}

@keyframes speech-halo {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  12% { opacity: 0.92; transform: scale(1.16); }
  25% { opacity: 0.58; transform: scale(1); }
  39% { opacity: 1; transform: scale(1.23); }
  56% { opacity: 0.48; transform: scale(0.94); }
  72% { opacity: 0.82; transform: scale(1.12); }
}

@keyframes speech-ripple {
  0% { opacity: 0; transform: scale(0.82); }
  12% { opacity: 0.62; }
  48% { opacity: 0.12; transform: scale(1.8); }
  49%, 100% { opacity: 0; transform: scale(0.82); }
}

@keyframes working-step {
  to { transform: rotate(360deg); }
}

@keyframes working-core {
  0%, 100% { filter: brightness(0.94) saturate(0.94); transform: scale(0.99); }
  33% { filter: brightness(1.18) saturate(1.08); transform: scale(1.015); }
  66% { filter: brightness(1.02) saturate(1); transform: scale(1); }
}

@keyframes alert-double-pulse {
  0%, 18%, 100% { filter: brightness(0.82) saturate(0.9); transform: scale(0.98); }
  5% { filter: brightness(1.34) saturate(1.15); transform: scale(1.055); }
  11% { filter: brightness(1.18) saturate(1.08); transform: scale(1.03); }
}

@keyframes alert-halo {
  0%, 18%, 100% { opacity: 0.36; transform: scale(0.94); }
  5% { opacity: 0.94; transform: scale(1.12); }
  11% { opacity: 0.72; transform: scale(1.06); }
}

@keyframes voice-wave {
  to { transform: scaleY(1.65); }
}

@keyframes hands-free-pulse {
  50% {
    opacity: 0.38;
    transform: scale(0.74);
  }
}

@media (max-width: 820px) {
  .orb-layout {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 18px;
  }

  .sandy-orb {
    width: clamp(220px, 34vw, 280px);
  }
}

@media (max-width: 680px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    min-height: 100dvh;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(9px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .topbar {
    min-height: 42px;
    margin-bottom: 6px;
    padding: 0 2px 6px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .brand-name {
    font-size: 0.84rem;
  }

  .brand-subtitle {
    font-size: 0.5rem;
  }

  .system-status {
    padding: 6px 8px;
    font-size: 0.52rem;
  }

  .workspace {
    height: auto;
    min-height: calc(100dvh - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
  }

  .mode-switch {
    grid-template-columns: repeat(2, 84px);
    padding: 2px;
  }

  .mode-button {
    min-height: 27px;
    font-size: 0.55rem;
  }

  .orb-view {
    height: auto;
    min-height: calc(100dvh - 94px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 14px;
  }

  .orb-layout {
    grid-template-columns: 1fr;
    align-content: center;
    padding: 10px 10px 12px;
  }

  .core-designation {
    margin-bottom: 3px;
    font-size: 0.53rem;
  }

  .core-designation span {
    margin-left: 5px;
  }

  .orb-state-readout {
    margin-bottom: -4px;
    font-size: 0.5rem;
  }

  .sandy-orb {
    width: min(61vw, 232px);
  }

  .orb-greeting {
    margin-top: -3px;
    font-size: 1.02rem;
  }

  .voice-glyph {
    width: 30px;
    height: 30px;
  }

  .orb-project-context {
    min-height: 32px;
    margin-top: 5px;
  }

  .orb-project-context small {
    font-size: 0;
  }

  .orb-project-context small::after {
    content: "→";
    font-size: 0.58rem;
  }

  .voice-controls {
    width: 178px;
    margin-top: 7px;
  }

  .voice-control {
    min-width: 178px;
    min-height: 44px;
  }

  .hands-free-control {
    min-height: 34px;
  }

  .orb-dev-panel {
    right: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
  }

  .orb-dev-panel button {
    min-height: 27px;
    font-size: 0.52rem;
  }

  .hud-corner {
    width: 18px;
    height: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb-atmosphere,
  .orb-ring,
  .orb-lens,
  .orb-aperture,
  .orb-spark,
  .orb-scan,
  .orb-iris,
  .voice-glyph i {
    animation: none !important;
  }

  .hands-free-dot {
    animation: none !important;
  }
}


/* ---------------------------------------------------------
   SANDI Orb UI cleanup — v0.3B
   Compact top controls; behavior intentionally unchanged.
   --------------------------------------------------------- */

.topbar-status-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hands-free-control-compact {
  display: inline-flex;
  min-height: auto;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c5dce0;
  background: rgba(11, 18, 25, 0.58);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.63rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hands-free-control-compact strong {
  font-size: inherit;
  font-weight: 400;
}

.hands-free-control-compact small {
  display: none;
}

.hands-free-control-compact:hover:not(:disabled),
.hands-free-control-compact.is-active {
  border-color: rgba(99, 216, 229, 0.28);
  color: #dcfbff;
  background: rgba(39, 124, 143, 0.10);
}

.workspace-controls {
  position: relative;
  z-index: 10;
  display: flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  justify-self: center;
  gap: 7px;
}

.orb-project-context-top {
  min-height: 38px;
  margin-top: 0;
  background: rgba(6, 11, 18, 0.82);
  backdrop-filter: blur(16px);
}

@media (max-width: 620px) {
  .workspace-controls {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .topbar-status-group {
    gap: 5px;
  }

  .hands-free-control-compact,
  .system-status {
    padding-left: 9px;
    padding-right: 9px;
  }
}


/* ---------------------------------------------------------
   SANDI Orb cleanup — standby + minimal center UI
   --------------------------------------------------------- */

.orb-view .orb-greeting {
  display: none;
}

.orb-view .voice-controls {
  display: none;
}



/* Manual Talk button remains in DOM/code as fallback. */

.hands-free-control-compact {
  width: auto;
  min-width: 0;
  min-height: 34px;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  font-size: 0.56rem;
  letter-spacing: 0.10em;
  white-space: nowrap;
}

.hands-free-control-compact strong {
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.10em;
}

/* SANDI top status pills — matched size + live wake pulse */
.topbar-status-group .system-status,
.topbar-status-group .hands-free-control-compact {
  box-sizing: border-box;
  width: 128px;
  min-height: 34px;
  justify-content: center;
  padding: 7px 10px;
}

.hands-free-control-compact strong {
  font-size: 0.50rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.hands-free-control-compact.is-active .hands-free-dot {
  animation: hands-free-pulse 1.6s ease-in-out infinite;
}

@media (max-width: 620px) {
  .topbar-status-group .system-status,
  .topbar-status-group .hands-free-control-compact {
    width: 116px;
  }

  .hands-free-control-compact strong {
    font-size: 0.46rem;
  }
}

/* Correction: MEMORY stays original size; only HANDS-FREE is matched to it */
.topbar-status-group .system-status {
  width: auto;
  min-height: initial;
  padding: 8px 11px;
}

.topbar-status-group .hands-free-control-compact {
  width: 92px;
  min-height: 34px;
  padding: 7px 9px;
}

.hands-free-control-compact strong {
  font-size: 0.47rem;
  letter-spacing: 0.06em;
}

/* Reduce HANDS-FREE pill only */
.topbar-status-group .hands-free-control-compact {
  width: 82px;
  min-width: 82px;
  padding-left: 7px;
  padding-right: 7px;
}

.hands-free-control-compact strong {
  font-size: 0.43rem;
  letter-spacing: 0.04em;
}

/* Match HANDS-FREE vertical height to MEMORY — width unchanged */
.topbar-status-group .hands-free-control-compact {
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  align-items: center;
}

/* HANDS-FREE: visually clone MEMORY exactly; preserve current width */
.topbar-status-group .hands-free-control-compact {
  height: auto;
  min-height: 0;
  max-height: none;
  padding-top: 8px;
  padding-bottom: 8px;

  color: #c5dce0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.63rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: normal;
}

.topbar-status-group .hands-free-control-compact strong {
  font: inherit;
  font-weight: 400;
  letter-spacing: inherit;
  line-height: inherit;
}

.topbar-status-group .hands-free-control-compact .hands-free-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.topbar-status-group .hands-free-control-compact.is-active .hands-free-dot {
  background: var(--cyan);
  box-shadow:
    0 0 0 4px rgba(113, 215, 223, 0.07),
    0 0 10px rgba(113, 215, 223, 0.8);
  animation: breathe 2.8s ease-in-out infinite;
}

.topbar-status-group .hands-free-control-compact.is-waiting .hands-free-dot {
  animation: breathe 2.8s ease-in-out infinite;
}


/* WAKE control:
   MEMORY is the visual master.
   No separate dimensions, typography, padding, or pulse timing. */
.hands-free-toggle {
  appearance: none;
  cursor: pointer;
}

.hands-free-toggle small {
  display: none;
}

/* Off = same dot position/size, but dormant. */
.hands-free-toggle:not(.is-active) .status-pulse {
  background: #41515a;
  box-shadow: 0 0 0 4px rgba(90, 113, 123, 0.07);
  animation: none;
}

.hands-free-toggle:disabled {
  cursor: wait;
  opacity: 0.74;
}

/* ================================================================
   SANDI Console navigation — unified pill system
   MEMORY is the visual master.
   ================================================================ */

/*
   Critical width correction:
   the former width:max-content workspace control widened the entire
   workspace when Project was added. Row 2 must stay inside the screen.
*/
.workspace-controls {
  position: relative;
  z-index: 10;
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: max-content minmax(0, 1fr) 14px;
  align-items: center;
  justify-self: stretch;
  gap: 7px;
}

/* ---------------------------------------------------------------
   ORB / CONSOLE
   Individual pills now clone MEMORY instead of sharing one shell.
   --------------------------------------------------------------- */

.mode-switch {
  position: relative;
  z-index: 10;
  display: inline-flex;
  width: auto;
  min-width: 0;
  grid-template-columns: none;
  justify-self: start;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.mode-button {
  box-sizing: border-box;
  min-height: 0;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c5dce0;
  background: rgba(11, 18, 25, 0.58);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.63rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: normal;
  text-transform: uppercase;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

/* ORB is intentionally tighter because the label is short. */
#orbModeButton {
  min-width: 58px;
  padding-left: 10px;
  padding-right: 10px;
}

/* Console gets only the room its word needs. */
#consoleModeButton {
  min-width: 86px;
  padding-left: 11px;
  padding-right: 11px;
}

.mode-button:hover {
  border-color: rgba(99, 216, 229, 0.22);
  color: #dcfbff;
}

.mode-button.is-active {
  border-color: rgba(99, 216, 229, 0.30);
  color: #dcfbff;
  background: rgba(39, 124, 143, 0.10);
  box-shadow:
    0 0 0 1px rgba(113, 215, 223, 0.04),
    0 0 12px rgba(39, 190, 214, 0.06);
}

/* ---------------------------------------------------------------
   PROJECT
   Same visual family as MEMORY, but flexible width.
   --------------------------------------------------------------- */

.project-selector-top {
  position: relative;
  display: inline-flex;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  max-height: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 31px 8px 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c5dce0;
  background: rgba(11, 18, 25, 0.58);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.63rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: normal;
}

.project-selector-label {
  flex: 0 0 auto;
  color: #7f949d;
  font: inherit;
  font-size: 0.63rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: normal;
  text-transform: uppercase;
}

.project-selector-value {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
}

.project-selector-top #orbProject {
  display: block;
  max-width: none;
  min-width: 0;
  overflow: hidden;
  color: #c5dce0;
  font: inherit;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-selector-chevron {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.project-select-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  appearance: auto;
  cursor: pointer;
  opacity: 0;
}

.project-select-overlay:disabled {
  cursor: not-allowed;
}

.project-selector-top:focus-within {
  border-color: rgba(99, 216, 229, 0.30);
  background: rgba(39, 124, 143, 0.10);
  box-shadow: 0 0 12px rgba(39, 190, 214, 0.06);
}

/* ---------------------------------------------------------------
   NEW CONVERSATION
   Compact cyan rail at the end of Row 2.
   --------------------------------------------------------------- */

.new-conversation-rail {
  position: relative;
  display: inline-flex;
  width: 14px;
  min-width: 14px;
  height: 34px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.new-conversation-rail span {
  display: block;
  width: 3px;
  height: 20px;
  border-radius: 999px;
  background: rgba(113, 215, 223, 0.78);
  box-shadow: 0 0 10px rgba(113, 215, 223, 0.24);
  transition:
    height 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.new-conversation-rail:hover span,
.new-conversation-rail:focus-visible span {
  height: 26px;
  background: #9ff5fb;
  box-shadow: 0 0 14px rgba(113, 215, 223, 0.4);
}

.new-conversation-rail:focus-visible {
  outline: none;
}

/* Console content remains inside the workspace width. */
.workspace,
.interface-view,
.console-view,
.console-view .composer,
.console-view .feed-label,
.console-view .message-list {
  min-width: 0;
  max-width: 100%;
}

.console-view .composer {
  margin-top: 0;
  padding-top: 10px;
}

/* ---------------------------------------------------------------
   Narrow screens
   Same design, simply tightened.
   --------------------------------------------------------------- */

@media (max-width: 680px) {
  .workspace-controls {
    grid-template-columns: max-content minmax(0, 1fr) 12px;
    gap: 5px;
  }

  .mode-switch {
    gap: 4px;
  }

  .mode-button {
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 0.54rem;
    letter-spacing: 0.10em;
  }

  #orbModeButton {
    min-width: 48px;
    padding-left: 8px;
    padding-right: 8px;
  }

  #consoleModeButton {
    min-width: 72px;
    padding-left: 9px;
    padding-right: 9px;
  }

  .project-selector-top {
    padding: 7px 26px 7px 9px;
    gap: 6px;
    font-size: 0.54rem;
    letter-spacing: 0.10em;
  }

  .project-selector-label {
    font-size: inherit;
    letter-spacing: inherit;
  }

  .project-selector-chevron {
    right: 11px;
    width: 6px;
    height: 6px;
  }

  .new-conversation-rail {
    width: 12px;
    min-width: 12px;
    height: 32px;
    min-height: 32px;
  }

  .new-conversation-rail span {
    height: 18px;
  }

  .console-view .composer {
    padding-top: 8px;
  }
}

/* ================================================================
   SANDI project-aligned personal composer
   ================================================================ */

.workspace {
  --sandy-mode-column: 150px;
  --sandy-action-column: 14px;
  --sandy-control-gap: 7px;
}

.workspace-controls {
  grid-template-columns:
    var(--sandy-mode-column)
    minmax(0, 1fr)
    var(--sandy-action-column);
  gap: var(--sandy-control-gap);
}

body[data-interface-mode="console"] .workspace {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
}

body[data-interface-mode="orb"] .console-composer-row {
  display: none;
}

.console-composer-row {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns:
    var(--sandy-mode-column)
    minmax(0, 1fr)
    var(--sandy-action-column);
  align-items: center;
  gap: var(--sandy-control-gap);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.composer-offset {
  display: none;
}

.console-composer-row #messageInput {
  grid-column: 1 / 3;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  max-height: 130px;
  margin: 0;
  padding: 8px 11px;
  resize: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  font: inherit;
  line-height: 1.4;
}

.console-composer-row #messageInput::placeholder {
  color: #75848f;
}

.console-composer-row #messageInput:focus,
.console-composer-row #messageInput:focus-visible {
  border: 0;
  outline: 0;
  box-shadow: none;
}

.send-message-rail {
  grid-column: 3;
  display: inline-flex;
  width: var(--sandy-action-column);
  min-width: var(--sandy-action-column);
  height: 34px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.send-message-rail span {
  display: block;
  width: 3px;
  height: 20px;
  border-radius: 999px;
  background: rgba(113, 215, 223, 0.78);
  box-shadow: 0 0 10px rgba(113, 215, 223, 0.24);
  transition:
    height 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.send-message-rail:hover span,
.send-message-rail:focus-visible span {
  height: 26px;
  background: #9ff5fb;
  box-shadow: 0 0 14px rgba(113, 215, 223, 0.40);
}

.send-message-rail:focus-visible {
  outline: none;
}

.send-message-rail:disabled {
  opacity: 0.45;
  cursor: wait;
}

.console-view {
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.console-view .message-list {
  width: 100%;
  min-width: 0;
  height: 100%;
}

.composer-hint,
.send-arrow,
.feed-label {
  display: none;
}

@media (max-width: 680px) {
  .workspace {
    --sandy-mode-column: 124px;
    --sandy-action-column: 12px;
    --sandy-control-gap: 5px;
  }

  body[data-interface-mode="console"] .workspace {
    gap: 5px;
  }

  .console-composer-row #messageInput {
    min-height: 34px;
    padding: 7px 9px;
  }

  .send-message-rail {
    height: 32px;
    min-height: 32px;
  }

  .send-message-rail span {
    height: 18px;
  }
}

/* ================================================================
   Safari project selector visual leak fix
   Native select remains clickable but completely invisible.
   ================================================================ */

.project-select-overlay {
  opacity: 0 !important;
  color: transparent !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;

  -webkit-appearance: none !important;
  appearance: none !important;

  text-shadow: none !important;
}

.project-select-overlay option {
  color: initial;
}

/* ================================================================
   SANDI open-space Orb refinement
   The top controls stay fixed; SANDI floats freely below them.
   ================================================================ */

/* ---------------------------------------------------------------
   OPEN SPACE
   Remove the framed/HUD-container appearance without touching the
   neural/star canvas or existing Orb structure.
   --------------------------------------------------------------- */

.orb-view {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

/* Keep the faint ambient background texture. */
.orb-view::before {
  opacity: 0.28;
}

/* Remove the old inset-panel/vignette treatment. */
.orb-view::after {
  display: none;
}

/* Crop/HUD marks are no longer part of the personal interface. */
.orb-view .hud-corner {
  display: none;
}

/* Keep the live neural/star field exactly in place. */
.orb-view .neural-canvas {
  opacity: 0.72;
}

/* Reserved line for specific ALERT conditions later. */
.orb-status-detail {
  min-height: 0;
  margin: 2px 0 0;
  color: #d6a36c;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.48rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
}

.orb-status-detail[hidden] {
  display: none;
}

/* ---------------------------------------------------------------
   IDLE
   Realtime conversation is live. Clearly awake and available,
   but calmer than LISTENING.
   --------------------------------------------------------------- */

.orb-view[data-orb-state="idle"] .orb-state-dot {
  opacity: 1;
  animation: idle-dot-breathe 2.7s ease-in-out infinite;
}

.orb-view[data-orb-state="idle"] .sandy-orb {
  filter:
    brightness(1.03)
    saturate(1.03);
}

.orb-view[data-orb-state="working"] .orb-state-dot {
  background: #78efd4;
  box-shadow: 0 0 11px rgba(111, 232, 196, 0.72);
  animation: working-state-pulse 1.8s steps(4, end) infinite;
}

.orb-view[data-orb-state="working"] .orb-state-readout strong {
  color: #bdf9e8;
}

/* ---------------------------------------------------------------
   State animations
   --------------------------------------------------------------- */

@keyframes standby-dot-breathe {
  0%,
  100% {
    opacity: 0.48;
    transform: scale(0.92);
  }

  50% {
    opacity: 0.88;
    transform: scale(1.05);
  }
}

@keyframes standby-halo {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.96);
  }

  50% {
    opacity: 0.58;
    transform: scale(1.015);
  }
}

@keyframes idle-dot-breathe {
  0%,
  100% {
    opacity: 0.74;
    transform: scale(0.95);
  }

  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes idle-halo {
  0%,
  100% {
    opacity: 0.58;
    transform: scale(0.97);
  }

  50% {
    opacity: 0.82;
    transform: scale(1.035);
  }
}

@keyframes active-state-pulse {
  0%,
  100% {
    transform: scale(0.90);
    opacity: 0.62;
  }

  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

@keyframes thinking-state-pulse {
  0%,
  100% {
    transform: scale(0.88);
    opacity: 0.50;
  }

  35% {
    transform: scale(1.10);
    opacity: 1;
  }

  68% {
    transform: scale(0.96);
    opacity: 0.70;
  }
}

@keyframes working-state-pulse {
  0%,
  100% {
    opacity: 0.46;
  }

  50% {
    opacity: 1;
  }
}

@keyframes alert-readout-pulse {
  0%,
  100% {
    opacity: 0.76;
  }

  50% {
    opacity: 1;
  }
}

/* Phone remains the priority interface. */
@media (max-width: 680px) {
  .orb-view {
    border-radius: 0;
  }

  .orb-status-detail {
    font-size: 0.44rem;
  }
}


/* Secure remote/mobile SANDI:
   expose existing manual Realtime voice fallback.
   Local desktop Orb remains unchanged. */
.sandy-remote-client .orb-view .voice-controls {
  display: grid;
}

/* Endpoint-specific wake control is local-desktop only.
   Global SANDI status remains HA · MEMORY · CORE. */
.sandy-remote-client .endpoint-wake-control {
  display: none;
}

/* Mobile SANDI header: notification ring should stay subordinate to brand mark. */
@media (max-width: 700px) {
  .topbar-status-group .sandi-notification-trigger {
    width: 22px;
    height: 22px;
    font-size: 0.44rem;
  }
}

/* Mobile SANDI header: notification ring should stay subordinate to brand mark. */
@media (max-width: 700px) {
  .topbar-status-group .sandi-notification-trigger {
    width: 22px;
    height: 22px;
    font-size: 0.44rem;
  }
}
