:root {
  --bg: #07100f;
  --bg-deep: #040a09;
  --surface: #0c1715;
  --surface-raised: #11201d;
  --surface-soft: #142521;
  --surface-hover: #19302a;
  --line: rgba(194, 231, 219, 0.11);
  --line-strong: rgba(194, 231, 219, 0.2);
  --text: #eff8f4;
  --text-soft: #c2d3cd;
  --muted: #849a92;
  --accent: #5de3b2;
  --accent-bright: #8af3ce;
  --accent-dark: #143d31;
  --amber: #f0bd68;
  --danger: #ff8b83;
  --danger-soft: rgba(255, 139, 131, 0.1);
  --success: #68dfad;
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.38);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.2);
  --sidebar-width: 300px;
  --panel-width: 350px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 78% 10%, rgba(50, 131, 104, 0.12), transparent 31%),
    var(--bg);
  color: var(--text);
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled),
a {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

input,
textarea {
  color: var(--text);
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #062018;
  font-weight: 750;
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

.app-shell,
.workspace-view {
  width: 100%;
  height: 100%;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.3;
}

.muted {
  color: var(--muted);
}

.loading-view {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 32px;
  text-align: center;
}

.loading-view h1 {
  margin: 10px 0 18px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 680;
  letter-spacing: -0.035em;
}

.loading-view p:last-child {
  margin: 15px 0 0;
  font-size: 0.88rem;
}

.loading-line {
  width: min(220px, 70vw);
  height: 2px;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
}

.loading-line span {
  display: block;
  width: 44%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loading-sweep 1.25s ease-in-out infinite;
}

@keyframes loading-sweep {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(280%);
  }
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(138, 243, 206, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(93, 227, 178, 0.2), rgba(93, 227, 178, 0.03)),
    #0c1b17;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 8px 20px rgba(0, 0, 0, 0.22);
  color: var(--accent-bright);
  font-size: 0.77rem;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.brand-mark--large {
  width: 58px;
  height: 58px;
  border-radius: 17px;
  font-size: 1.05rem;
}

.auth-view {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 100%;
  place-items: center;
  overflow: auto;
  padding: 42px 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(67, 169, 132, 0.14), transparent 42%),
    linear-gradient(165deg, #07110f 0%, #050a09 65%, #08120f 100%);
}

.auth-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(126, 195, 171, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 195, 171, 0.025) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 510px);
  padding: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: rgba(12, 23, 21, 0.93);
  box-shadow: var(--shadow-lg), inset 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(20px);
}

.auth-card--compact {
  max-width: 430px;
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-bottom: 27px;
}

.auth-header h1 {
  margin: 5px 0 0;
  font-size: clamp(1.65rem, 5vw, 2.1rem);
  font-weight: 690;
  letter-spacing: -0.045em;
}

.auth-header--centered {
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.auth-header--centered h1 {
  margin-top: 2px;
  font-size: 2.25rem;
}

.auth-header--centered .auth-copy {
  margin: 0;
}

.auth-card h2 {
  margin: 6px 0 10px;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.auth-copy {
  margin: 0 0 24px;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.62;
}

.auth-form {
  display: grid;
  gap: 17px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span:first-child {
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 680;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: #091411;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field input:focus {
  border-color: rgba(93, 227, 178, 0.62);
  background: #0a1713;
  box-shadow: 0 0 0 3px rgba(93, 227, 178, 0.08);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 78px;
}

.reveal-button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
}

.otp-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2em;
  text-align: center;
  font-size: 1.08rem;
}

.field-hint {
  margin: -8px 0 2px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.form-error {
  margin: -3px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 139, 131, 0.2);
  border-radius: 10px;
  background: var(--danger-soft);
  color: #ffc1bd;
  font-size: 0.8rem;
  line-height: 1.45;
}

.primary-button,
.secondary-button,
.danger-quiet-button,
.quiet-button,
.new-thread-button,
.text-button,
.icon-button,
.status-pill,
.send-button,
.stop-button {
  border: 0;
  transition: transform 130ms ease, background 130ms ease, border-color 130ms ease, color 130ms ease, opacity 130ms ease;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--accent);
  color: #052018;
  font-weight: 780;
  box-shadow: 0 8px 24px rgba(23, 111, 81, 0.24), inset 0 1px rgba(255, 255, 255, 0.28);
}

.primary-button:not(:disabled):hover {
  background: var(--accent-bright);
  transform: translateY(-1px);
}

.secondary-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 690;
}

.secondary-button:not(:disabled):hover {
  border-color: rgba(93, 227, 178, 0.3);
  background: var(--surface-hover);
}

.danger-quiet-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 139, 131, 0.18);
  border-radius: 11px;
  background: rgba(255, 139, 131, 0.07);
  color: #ffc0bc;
  font-weight: 680;
}

.danger-quiet-button:hover {
  background: rgba(255, 139, 131, 0.13);
}

.text-button {
  width: max-content;
  padding: 3px 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.79rem;
  font-weight: 680;
}

.text-button:hover {
  color: var(--accent-bright);
}

.centered {
  display: block;
  margin-inline: auto;
}

.full-width {
  width: 100%;
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 27px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
  text-align: center;
}

.lock-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(104, 223, 173, 0.5);
}

.step-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.qr-frame {
  width: 198px;
  height: 198px;
  margin: 22px auto 13px;
  padding: 13px;
  border-radius: 17px;
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
}

.qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.success-seal {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(104, 223, 173, 0.32);
  border-radius: 50%;
  background: rgba(104, 223, 173, 0.1);
  color: var(--success);
  font-size: 1.45rem;
  font-weight: 800;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #07100e;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.recovery-code {
  padding: 7px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  text-align: center;
}

.recovery-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.workspace-view {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--bg-deep);
}

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 20%),
    #091310;
}

.sidebar-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 19px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 0.91rem;
  letter-spacing: -0.02em;
}

.brand-lockup span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.57rem;
  font-weight: 760;
  letter-spacing: 0.13em;
}

.new-thread-button {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 1px 14px 12px;
  border: 1px solid rgba(93, 227, 178, 0.17);
  border-radius: 12px;
  background: rgba(93, 227, 178, 0.075);
  color: var(--accent-bright);
  font-size: 0.83rem;
  font-weight: 720;
}

.new-thread-button:hover {
  border-color: rgba(93, 227, 178, 0.3);
  background: rgba(93, 227, 178, 0.12);
}

.new-thread-button span {
  font-size: 1.15rem;
  line-height: 1;
}

.search-field {
  position: relative;
  display: block;
  margin: 0 14px 12px;
}

.search-field input {
  width: 100%;
  height: 37px;
  padding: 0 12px 0 35px;
  border: 1px solid transparent;
  border-radius: 10px;
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font-size: 0.78rem;
}

.search-field input:focus {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}

.search-field input::placeholder,
.composer textarea::placeholder {
  color: #60746d;
}

.search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 12px;
  transform: translateY(-54%);
  color: var(--muted);
}

.thread-list {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 8px 14px;
  scrollbar-color: rgba(156, 190, 178, 0.2) transparent;
  scrollbar-width: thin;
}

.thread-list-empty {
  padding: 30px 18px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: center;
}

.thread-group-label {
  margin: 15px 11px 6px;
  color: #657c74;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.thread-button {
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
}

.thread-button:hover {
  background: rgba(255, 255, 255, 0.035);
}

.thread-button[aria-current="page"] {
  border-color: rgba(93, 227, 178, 0.1);
  background: rgba(93, 227, 178, 0.08);
  color: var(--text);
}

.thread-button-copy {
  min-width: 0;
}

.thread-button strong,
.thread-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-button strong {
  font-size: 0.78rem;
  font-weight: 610;
}

.thread-button small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.66rem;
}

.thread-time {
  align-self: start;
  padding-top: 3px;
  color: #60746d;
  font-size: 0.59rem;
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  display: flex;
  min-height: 69px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.account-button {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 9px;
  padding: 5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.account-button:hover {
  background: rgba(255, 255, 255, 0.035);
}

.account-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #225b48, #13382d);
  color: #d7fff0;
  font-size: 0.66rem;
  font-weight: 800;
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 0.72rem;
}

.account-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.61rem;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
}

.icon-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

.main-content {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% -10%, rgba(58, 134, 109, 0.12), transparent 30%),
    #0a1211;
}

.topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 20px 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 18, 16, 0.8);
  backdrop-filter: blur(18px);
}

.topbar-title-group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.topbar-title-group > div:last-child {
  min-width: 0;
}

.topbar-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 780;
  letter-spacing: 0.15em;
}

.topbar h1 {
  overflow: hidden;
  max-width: min(44vw, 640px);
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 660;
  letter-spacing: -0.012em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.status-pill,
.quiet-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 670;
}

.status-pill:hover,
.quiet-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.quiet-button--accent {
  border-color: rgba(93, 227, 178, 0.17);
  color: var(--accent-bright);
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.status-dot--online {
  background: var(--success);
  box-shadow: 0 0 10px rgba(104, 223, 173, 0.6);
}

.status-dot--offline {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 139, 131, 0.38);
}

.status-dot--checking {
  background: var(--amber);
  animation: status-pulse 1.3s ease-in-out infinite;
}

@keyframes status-pulse {
  50% {
    opacity: 0.35;
  }
}

.connection-banner {
  display: flex;
  min-height: 37px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 6px 18px;
  border-bottom: 1px solid rgba(240, 189, 104, 0.13);
  background: rgba(240, 189, 104, 0.07);
  color: #e9c98d;
  font-size: 0.72rem;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  animation: status-pulse 1.2s ease-in-out infinite;
}

.conversation-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.empty-state {
  display: flex;
  width: min(100%, 800px);
  height: 100%;
  min-height: 420px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: 0 auto;
  padding: 36px 30px 28px;
  text-align: center;
}

.empty-orbit {
  position: relative;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin-bottom: 22px;
  border: 1px solid rgba(93, 227, 178, 0.22);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(93, 227, 178, 0.15), transparent 68%);
  box-shadow: 0 0 60px rgba(39, 152, 111, 0.12);
}

.empty-orbit::before,
.empty-orbit::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(93, 227, 178, 0.1);
  border-radius: 50%;
}

.empty-orbit::before {
  inset: -9px;
}

.empty-orbit::after {
  inset: 10px;
}

.empty-orbit span {
  color: var(--accent-bright);
  font-size: 0.86rem;
  font-weight: 850;
}

.empty-state h2 {
  margin: 9px 0 11px;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 640;
  letter-spacing: -0.052em;
}

.empty-state > p:not(.eyebrow) {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.62;
}

.suggestion-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 31px;
}

.suggestion-card {
  min-width: 0;
  min-height: 119px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.024);
  color: var(--text-soft);
  text-align: left;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.suggestion-card:hover {
  transform: translateY(-2px);
  border-color: rgba(93, 227, 178, 0.22);
  background: rgba(93, 227, 178, 0.055);
}

.suggestion-card strong,
.suggestion-card small {
  display: block;
}

.suggestion-card strong {
  margin-top: 14px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 680;
}

.suggestion-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.4;
}

.suggestion-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 8px;
  background: rgba(93, 227, 178, 0.09);
  color: var(--accent);
  font-size: 0.9rem;
}

.messages {
  height: 100%;
  overflow-y: auto;
  padding: 24px clamp(18px, 4vw, 56px) 30px;
  scrollbar-color: rgba(156, 190, 178, 0.22) transparent;
  scrollbar-width: thin;
}

.messages-inner {
  width: min(100%, 880px);
  margin: 0 auto;
}

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 13px;
  padding: 15px 0 20px;
}

.message + .message {
  border-top: 1px solid rgba(194, 231, 219, 0.055);
}

.message-avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 0.62rem;
  font-weight: 800;
}

.message--assistant .message-avatar {
  border: 1px solid rgba(93, 227, 178, 0.18);
  background: rgba(93, 227, 178, 0.09);
  color: var(--accent-bright);
}

.message-copy {
  min-width: 0;
  padding-top: 2px;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.message-header strong {
  font-size: 0.76rem;
  font-weight: 720;
}

.message-header time {
  color: #5e746c;
  font-size: 0.62rem;
}

.message-text {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 0.91rem;
  line-height: 1.68;
  white-space: pre-wrap;
}

.message--user .message-text {
  color: #e6f0ec;
}

.message--streaming .message-text::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 4px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: -0.12em;
  animation: cursor-blink 0.9s step-end infinite;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

.event-card {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 12px 47px;
  padding: 8px 11px;
  border-left: 2px solid rgba(93, 227, 178, 0.25);
  color: var(--muted);
  font-size: 0.71rem;
}

.event-card span:first-child {
  color: var(--accent);
}

.scroll-latest {
  position: absolute;
  right: 24px;
  bottom: 17px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(17, 32, 29, 0.94);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
  font-size: 0.68rem;
}

.composer-area {
  position: relative;
  z-index: 5;
  padding: 8px clamp(18px, 4vw, 56px) 13px;
  background: linear-gradient(180deg, transparent, #09110f 24%);
}

.activity-line {
  display: flex;
  width: min(100%, 880px);
  align-items: center;
  gap: 8px;
  margin: 0 auto 7px;
  padding-left: 4px;
  color: var(--muted);
  font-size: 0.68rem;
}

.activity-spinner {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(93, 227, 178, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.composer {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 12px 12px 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: #101d1a;
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.22), inset 0 1px rgba(255, 255, 255, 0.025);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: rgba(93, 227, 178, 0.32);
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.24), 0 0 0 3px rgba(93, 227, 178, 0.05);
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 190px;
  min-height: 27px;
  resize: none;
  overflow-y: auto;
  padding: 1px 3px 4px 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 0.88rem;
  line-height: 1.5;
}

.composer-actions {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.composer-hint {
  margin-right: auto;
  color: #5f736c;
  font-size: 0.61rem;
}

.send-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #052018;
  font-size: 1.08rem;
  font-weight: 800;
}

.send-button:not(:disabled):hover {
  background: var(--accent-bright);
  transform: translateY(-1px);
}

.stop-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(255, 139, 131, 0.17);
  border-radius: 9px;
  background: rgba(255, 139, 131, 0.07);
  color: #ffb6b1;
  font-size: 0.67rem;
  font-weight: 690;
}

.stop-button:hover {
  background: rgba(255, 139, 131, 0.12);
}

.stop-button span {
  font-size: 0.5rem;
}

.privacy-note {
  margin: 7px auto 0;
  color: #566b63;
  font-size: 0.57rem;
  text-align: center;
}

.side-panel {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  width: min(var(--panel-width), 94vw);
  height: 100%;
  padding: 22px;
  border-left: 1px solid var(--line-strong);
  background: rgba(9, 19, 16, 0.98);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.3);
  transform: translateX(103%);
  transition: transform 220ms ease;
}

.side-panel[data-open="true"] {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 25px;
}

.panel-header h2 {
  margin: 5px 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.status-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.status-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.status-hero strong,
.status-hero small {
  display: block;
}

.status-hero strong {
  font-size: 0.84rem;
}

.status-hero small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.4;
}

.status-orb {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.status-orb--online {
  border-color: rgba(104, 223, 173, 0.17);
  background: var(--success);
  box-shadow: 0 0 18px rgba(104, 223, 173, 0.28);
}

.status-orb--offline {
  border-color: rgba(255, 139, 131, 0.17);
  background: var(--danger);
}

.status-orb--checking {
  border-color: rgba(240, 189, 104, 0.16);
  background: var(--amber);
  animation: status-pulse 1.2s ease-in-out infinite;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
}

.status-card span {
  color: var(--muted);
  font-size: 0.7rem;
}

.status-card strong {
  font-size: 0.7rem;
  font-weight: 670;
  text-align: right;
}

.modal {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 20px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(1, 5, 4, 0.7);
  backdrop-filter: blur(5px);
}

.modal[open] {
  display: grid;
  place-items: center;
}

.modal-card {
  width: min(100%, 510px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #0e1a17;
  box-shadow: var(--shadow-lg);
}

.modal-card--wide {
  width: min(100%, 720px);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
}

.modal-header--spaced {
  align-items: flex-start;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 5px 0 0;
  font-size: 1.32rem;
  letter-spacing: -0.035em;
}

.approval-shield {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(240, 189, 104, 0.22);
  border-radius: 14px;
  background: rgba(240, 189, 104, 0.09);
  color: var(--amber);
  font-size: 1.05rem;
  font-weight: 850;
}

.modal-copy {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.91rem;
  line-height: 1.62;
}

.technical-details {
  margin-top: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
}

.technical-details summary {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 670;
}

.technical-details pre {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 0 12px 12px;
  color: #aebfb9;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.67rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.approval-note {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 0.69rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 23px;
}

.file-toolbar {
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 13px;
  margin-bottom: 10px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
}

.files-path {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.69rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-list {
  min-height: 250px;
  max-height: min(55vh, 490px);
  overflow-y: auto;
}

.files-empty {
  display: grid;
  min-height: 230px;
  place-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.file-row {
  display: grid;
  min-height: 57px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(194, 231, 219, 0.05);
}

.file-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: rgba(93, 227, 178, 0.07);
  color: var(--accent);
  font-size: 0.8rem;
}

.file-copy {
  min-width: 0;
}

.file-copy strong,
.file-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy strong {
  font-size: 0.76rem;
  font-weight: 620;
}

.file-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.63rem;
}

.file-action {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.67rem;
  font-weight: 660;
  text-decoration: none;
}

a.file-action {
  display: inline-flex;
  align-items: center;
}

.file-action:hover {
  border-color: rgba(93, 227, 178, 0.25);
  color: var(--accent-bright);
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(16, 30, 26, 0.97);
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.toast--error .toast-dot {
  background: var(--danger);
}

.toast-copy strong,
.toast-copy span {
  display: block;
}

.toast-copy strong {
  font-size: 0.73rem;
}

.toast-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.toast-close {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

.mobile-scrim {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
}

.mobile-only {
  display: none;
}

@media (max-width: 1050px) {
  :root {
    --sidebar-width: 270px;
  }

  .suggestion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .suggestion-card {
    min-height: 101px;
  }

  .button-label {
    display: none;
  }

  .quiet-button {
    width: 38px;
    padding: 0;
  }
}

@media (max-width: 760px) {
  .mobile-only {
    display: inline-grid;
  }

  .workspace-view {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    transform: translateX(-103%);
    transition: transform 210ms ease;
  }

  .sidebar[data-open="true"] {
    transform: translateX(0);
  }

  .main-content {
    width: 100%;
    height: 100%;
  }

  .topbar {
    min-height: 64px;
    padding: 9px 12px;
  }

  .topbar h1 {
    max-width: 39vw;
  }

  .status-pill {
    width: 38px;
    padding: 0;
  }

  .status-pill #status-label {
    display: none;
  }

  .empty-state {
    justify-content: flex-start;
    padding: 48px 18px 25px;
  }

  .empty-state > p:not(.eyebrow) {
    font-size: 0.84rem;
  }

  .suggestion-grid {
    margin-top: 25px;
  }

  .messages {
    padding: 17px 15px 25px;
  }

  .composer-area {
    padding: 7px 10px 10px;
  }

  .composer-hint {
    display: none;
  }

  .message {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
  }

  .event-card {
    margin-left: 40px;
  }

  .modal-actions--approval {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .modal-actions--approval .primary-button {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (max-width: 520px) {
  .auth-view {
    align-items: start;
    padding: 18px 12px;
  }

  .auth-card {
    padding: 25px 20px;
    border-radius: 20px;
  }

  .auth-header:not(.auth-header--centered) {
    align-items: flex-start;
  }

  .recovery-codes {
    grid-template-columns: 1fr;
  }

  .recovery-actions {
    display: grid;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .suggestion-card {
    display: grid;
    min-height: 72px;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    padding: 10px 12px;
  }

  .suggestion-card .suggestion-icon {
    grid-row: 1 / 3;
  }

  .suggestion-card strong,
  .suggestion-card small {
    margin: 0;
  }

  .suggestion-card small {
    align-self: start;
  }

  .empty-orbit {
    width: 60px;
    height: 60px;
    margin-bottom: 17px;
  }

  .empty-state h2 {
    font-size: 1.85rem;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    padding: 20px;
    border-radius: 17px;
  }

  .file-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }

  .topbar-actions {
    gap: 3px;
  }
}

@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;
  }
}
