:root {
  color-scheme: dark;
  --bg: #080a10;
  --bg-soft: #0d1018;
  --surface: #11151f;
  --surface-2: #171c28;
  --surface-3: #1c2230;
  --surface-hover: #202736;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f7fb;
  --text-soft: #c4cad6;
  --muted: #858e9f;
  --muted-2: #788293;
  --accent: #7c6cf2;
  --accent-2: #52d3c6;
  --accent-soft: rgba(124, 108, 242, 0.14);
  --green: #45d09b;
  --green-soft: rgba(69, 208, 155, 0.13);
  --amber: #f1bd62;
  --amber-soft: rgba(241, 189, 98, 0.13);
  --red: #ff6c7c;
  --red-soft: rgba(255, 108, 124, 0.12);
  --violet-soft: rgba(170, 120, 255, 0.13);
  --sidebar-width: 288px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --focus: 0 0 0 3px rgba(124, 108, 242, 0.3);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(124, 108, 242, 0.10), transparent 28rem),
    var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

::selection {
  color: #fff;
  background: rgba(124, 108, 242, 0.7);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(153, 163, 182, 0.26);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(153, 163, 182, 0.42);
  background-clip: padding-box;
}

:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

.is-hidden {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 999;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: 10px;
  color: white;
  background: var(--accent);
  font-weight: 700;
}

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

.mobile-only {
  display: none;
}

.eyebrow {
  margin-bottom: 9px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 17px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: linear-gradient(145deg, #917cf8, #5d50ca);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.24), 0 5px 18px rgba(90, 76, 200, 0.25);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  position: absolute;
  content: "";
}

.brand-mark::before {
  width: 18px;
  height: 8px;
  transform: rotate(-26deg);
  border-radius: 50%;
  border-top: 2px solid rgba(255, 255, 255, 0.92);
}

.brand-mark::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 8px -5px 0 -1px rgba(255, 255, 255, 0.55), -7px 6px 0 -1px rgba(255, 255, 255, 0.45);
}

.brand-mark span {
  width: 21px;
  height: 21px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.brand-mark--large {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}

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

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease, opacity 150ms ease;
}

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

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button--primary {
  color: #fff;
  background: linear-gradient(135deg, #8170f5, #6657d9);
  box-shadow: 0 8px 24px rgba(102, 87, 217, 0.22);
}

.button--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #8d7dfb, #7060e2);
}

.button--secondary {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.button--secondary:hover:not(:disabled),
.button--ghost:hover:not(:disabled) {
  border-color: rgba(124, 108, 242, 0.42);
  background: var(--surface-hover);
}

.button--ghost {
  border-color: var(--border);
  color: var(--text-soft);
  background: transparent;
}

.button--danger {
  border-color: rgba(255, 108, 124, 0.2);
  color: #ff9eaa;
  background: var(--red-soft);
}

.button--danger:hover:not(:disabled) {
  border-color: rgba(255, 108, 124, 0.42);
  background: rgba(255, 108, 124, 0.18);
}

.button--success {
  border-color: rgba(69, 208, 155, 0.25);
  color: #8ae7c2;
  background: var(--green-soft);
}

.button--success:hover:not(:disabled) {
  background: rgba(69, 208, 155, 0.2);
}

.button--wide {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 16px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.icon-button:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface-2);
}

.link-button {
  padding: 0;
  color: #a89cff;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.link-button:hover {
  color: #c0b8ff;
  text-decoration: underline;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.input-shell {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.input-shell:focus-within {
  border-color: rgba(124, 108, 242, 0.65);
  background: rgba(124, 108, 242, 0.035);
  box-shadow: var(--focus);
}

.input-icon {
  width: 21px;
  flex: 0 0 21px;
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

.input-shell input {
  min-width: 0;
  height: 42px;
  flex: 1;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
  font-weight: 450;
}

input::placeholder,
textarea::placeholder {
  color: #636c7b;
}

textarea,
select,
input[type="text"],
input[type="search"],
input[type="password"],
input[type="email"],
input[type="number"] {
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: 0;
  background: var(--surface-2);
}

textarea:focus,
select:focus,
input[type="text"]:focus,
input[type="search"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus {
  border-color: rgba(124, 108, 242, 0.6);
  box-shadow: var(--focus);
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 11px 12px;
}

select {
  min-height: 38px;
  padding: 7px 34px 7px 11px;
  color: var(--text-soft);
}

.input-shell input:focus {
  box-shadow: none;
}

.password-toggle {
  width: auto;
  min-width: 60px;
  height: 29px;
  padding: 0 5px;
  color: var(--muted);
  font-size: 10px;
}

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.check input {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.form-error {
  margin: -2px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 108, 124, 0.2);
  border-radius: 9px;
  color: #ff9eaa;
  background: var(--red-soft);
  font-size: 11px;
}

.boot-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 40%, rgba(124, 108, 242, 0.13), transparent 18rem),
    var(--bg);
  transition: opacity 250ms ease;
}

.boot-screen p {
  color: var(--muted);
  font-size: 13px;
}

.boot-screen .brand-mark {
  animation: breathe 1.8s ease-in-out infinite;
}

@keyframes breathe {
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(124, 108, 242, 0.35);
  }
}

/* Authentication */
.auth-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(410px, 1.15fr) minmax(420px, 0.85fr);
}

.auth-hero {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(28px, 4.5vw, 66px);
  border-right: 1px solid var(--border);
  background:
    linear-gradient(118deg, rgba(124, 108, 242, 0.08), transparent 50%),
    radial-gradient(circle at 25% 65%, rgba(82, 211, 198, 0.08), transparent 20rem),
    #0a0d14;
}

.auth-hero::before {
  position: absolute;
  right: -140px;
  bottom: -240px;
  width: 560px;
  height: 560px;
  content: "";
  border: 1px solid rgba(124, 108, 242, 0.10);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(124, 108, 242, 0.025), 0 0 0 160px rgba(124, 108, 242, 0.018);
}

.auth-hero::after {
  position: absolute;
  top: 22%;
  right: 12%;
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: -190px 90px 0 -2px rgba(124, 108, 242, 0.8), 140px 190px 0 -2px rgba(255, 255, 255, 0.5);
}

.auth-hero__top,
.auth-hero__content,
.auth-hero__footer {
  position: relative;
  z-index: 1;
}

.auth-hero__content {
  width: 100%;
  max-width: 660px;
  min-width: 0;
  padding: 80px 0;
}

.auth-hero h1 {
  max-width: 680px;
  margin-bottom: 22px;
  font-size: clamp(43px, 5.5vw, 76px);
  font-weight: 690;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.auth-hero h1 span {
  color: #9c91f8;
}

.auth-lead {
  max-width: 525px;
  margin-bottom: 48px;
  color: var(--muted);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.7;
}

.feature-row {
  display: grid;
  max-width: 670px;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.feature-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.feature-icon {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 33px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: #a79cf4;
  background: var(--accent-soft);
  font-size: 9px;
  font-weight: 800;
}

.feature-item strong,
.feature-item small {
  display: block;
}

.feature-item strong {
  margin-bottom: 2px;
  font-size: 12px;
}

.feature-item small {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-hero__footer {
  margin: 0;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.auth-panel {
  display: grid;
  min-height: 100vh;
  align-items: center;
  padding: 38px clamp(26px, 6vw, 90px);
  background: rgba(8, 10, 16, 0.9);
}

.auth-card {
  width: 100%;
  max-width: 390px;
  min-width: 0;
  margin: 0 auto;
}

.auth-card__heading {
  margin-bottom: 24px;
}

.auth-card__heading h2 {
  margin-bottom: 7px;
  font-size: 27px;
  letter-spacing: -0.035em;
}

.auth-card__heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.segmented {
  display: grid;
  margin-bottom: 25px;
  padding: 4px;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.segmented__button {
  min-height: 37px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.segmented__button.is-active {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

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

.form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.auth-form .button--primary {
  min-height: 47px;
  margin-top: 3px;
  justify-content: space-between;
  padding-inline: 18px;
}

/* Main app */
.app-shell {
  display: grid;
  width: 100%;
  height: 100vh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
}

.sidebar,
.admin-sidebar {
  z-index: 20;
  display: flex;
  min-width: 0;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #0b0e15;
}

.sidebar__top {
  display: flex;
  height: 70px;
  flex: 0 0 70px;
  align-items: center;
  justify-content: space-between;
  padding: 0 19px;
}

.button--new-chat {
  min-height: 44px;
  margin: 2px 14px 14px;
  justify-content: flex-start;
  border-color: rgba(124, 108, 242, 0.22);
  color: #ddd9ff;
  background: rgba(124, 108, 242, 0.10);
}

.button--new-chat:hover {
  border-color: rgba(124, 108, 242, 0.45);
  background: rgba(124, 108, 242, 0.16);
}

.button-symbol {
  font-size: 18px;
  font-weight: 400;
}

.button--new-chat kbd {
  margin-left: auto;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted-2);
  background: rgba(0, 0, 0, 0.18);
  font: 8px/1.4 inherit;
}

.sidebar-search {
  display: flex;
  min-height: 37px;
  align-items: center;
  gap: 7px;
  margin: 0 14px 18px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.025);
}

.sidebar-search:focus-within {
  border-color: rgba(124, 108, 242, 0.45);
}

.sidebar-search input {
  min-width: 0;
  height: 34px;
  flex: 1;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.sidebar-search input:focus {
  box-shadow: none;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 19px 9px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.muted-count {
  display: inline-grid;
  min-width: 20px;
  min-height: 18px;
  padding: 1px 5px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
}

.conversation-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}

.conversation-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.conversation-item:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.035);
}

.conversation-item.is-active {
  border-color: rgba(124, 108, 242, 0.15);
  color: var(--text);
  background: var(--accent-soft);
}

.conversation-item__icon {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
}

.conversation-item.is-active .conversation-item__icon {
  color: #b9b1ff;
  background: rgba(124, 108, 242, 0.16);
}

.conversation-item.is-generating .conversation-item__icon {
  color: var(--accent-2);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 35%, transparent);
  animation: conversationGenerating 1.5s ease-out infinite;
}

.conversation-item.is-generating .conversation-item__text small {
  color: var(--accent-2);
}

@keyframes conversationGenerating {
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.conversation-item__text {
  min-width: 0;
  flex: 1;
}

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

.conversation-item__text strong {
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 620;
}

.conversation-item__text small {
  color: var(--muted-2);
  font-size: 8px;
}

.conversation-list-empty {
  padding: 25px 18px;
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
}

.sidebar__footer {
  flex: 0 0 auto;
  padding: 10px 12px 15px;
  border-top: 1px solid var(--border);
}

.profile-chip {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.profile-chip:hover {
  color: var(--text);
  background: var(--surface-2);
}

.avatar {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  place-items: center;
  border: 1px solid rgba(124, 108, 242, 0.26);
  border-radius: 10px;
  color: #c6c0ff;
  background: linear-gradient(145deg, rgba(124, 108, 242, 0.25), rgba(82, 211, 198, 0.08));
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.avatar--large {
  width: 47px;
  height: 47px;
  flex-basis: 47px;
  border-radius: 14px;
  font-size: 16px;
}

.profile-chip__text {
  min-width: 0;
  flex: 1;
}

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

.profile-chip__text strong {
  margin-bottom: 1px;
  color: var(--text-soft);
  font-size: 10px;
}

.profile-chip__text small {
  color: var(--muted-2);
  font-size: 8px;
}

.workspace {
  display: grid;
  min-width: 0;
  height: 100vh;
  grid-template-rows: 70px minmax(0, 1fr) auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 32%, rgba(124, 108, 242, 0.045), transparent 26rem),
    #090b12;
}

.chat-header {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--border);
  background: rgba(9, 11, 18, 0.86);
  backdrop-filter: blur(18px);
}

.chat-header__left,
.chat-header__actions {
  display: flex;
  min-width: 0;
  align-items: center;
}

.chat-header__left {
  gap: 12px;
}

.chat-header__left > div {
  min-width: 0;
}

.chat-header h1 {
  max-width: min(40vw, 500px);
  margin: 0 0 2px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 710;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-status {
  margin: 0;
  color: var(--muted-2);
  font-size: 8px;
}

.connection-status span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 3px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(69, 208, 155, 0.7);
}

.connection-status.is-busy span {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(241, 189, 98, 0.7);
  animation: blink 1s infinite;
}

.connection-status.is-error span {
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 108, 124, 0.7);
}

@keyframes blink {
  50% { opacity: 0.35; }
}

.sidebar-toggle {
  display: none;
}

.chat-header__actions {
  position: relative;
  gap: 8px;
}

.model-control select {
  max-width: 190px;
  min-height: 34px;
  border-color: transparent;
  background-color: var(--surface);
  font-size: 10px;
}

.stream-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  font-size: 9px;
  font-weight: 650;
}

.stream-toggle:hover {
  border-color: var(--border);
}

.stream-toggle input {
  position: absolute;
  opacity: 0;
}

.stream-toggle > span:first-of-type {
  position: relative;
  width: 22px;
  height: 12px;
  border-radius: 10px;
  background: var(--muted-2);
}

.stream-toggle > span:first-of-type::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  content: "";
  border-radius: 50%;
  background: #fff;
  transition: transform 150ms ease;
}

.stream-toggle input:checked + span {
  background: var(--accent);
}

.stream-toggle input:checked + span::after {
  transform: translateX(10px);
}

.stream-toggle:focus-within {
  box-shadow: var(--focus);
}

.menu-popover {
  position: absolute;
  z-index: 50;
  top: calc(100% + 14px);
  right: 0;
  width: 205px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(17, 21, 31, 0.98);
  box-shadow: var(--shadow);
}

.menu-popover button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-soft);
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.menu-popover button:hover {
  background: var(--surface-hover);
}

.menu-popover .danger-text {
  color: #ff9eaa;
}

.chat-main {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.empty-state {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(50px, 10vh, 118px) 0 42px;
  text-align: center;
}

.assistant-orb {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px solid rgba(124, 108, 242, 0.26);
  border-radius: 19px;
  background: linear-gradient(145deg, rgba(124, 108, 242, 0.18), rgba(82, 211, 198, 0.06));
  box-shadow: 0 15px 50px rgba(82, 70, 190, 0.16);
}

.assistant-orb::before,
.assistant-orb::after,
.assistant-orb span {
  position: absolute;
  content: "";
}

.assistant-orb::before {
  width: 30px;
  height: 13px;
  transform: rotate(-23deg);
  border-radius: 50%;
  border-top: 2px solid #a9a0fb;
}

.assistant-orb::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 12px -7px 0 -2px #a9a0fb, -11px 9px 0 -2px #a9a0fb;
}

.assistant-orb span {
  width: 43px;
  height: 43px;
  border: 1px solid rgba(124, 108, 242, 0.12);
  border-radius: 50%;
}

.empty-state h2 {
  margin-bottom: 8px;
  font-size: clamp(28px, 3.2vw, 39px);
  letter-spacing: -0.045em;
}

.empty-state > p:not(.eyebrow) {
  margin: 0 auto 34px;
  color: var(--muted);
  font-size: 13px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  text-align: left;
}

.prompt-card {
  display: grid;
  min-height: 89px;
  grid-template-columns: 33px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 11px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.prompt-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 108, 242, 0.34);
  background: rgba(124, 108, 242, 0.055);
}

.prompt-card__icon {
  display: grid;
  width: 33px;
  height: 33px;
  grid-row: 1 / 3;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: #aaa1f6;
  background: var(--accent-soft);
  font-size: 12px;
}

.prompt-card strong {
  align-self: end;
  color: var(--text-soft);
  font-size: 11px;
}

.prompt-card small {
  align-self: start;
  color: var(--muted-2);
  font-size: 9px;
}

.prompt-card > span:last-child {
  grid-column: 3;
  grid-row: 1 / 3;
  font-size: 16px;
}

.message-list {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 34px clamp(18px, 4vw, 44px) 40px;
}

.message {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 29px;
  animation: messageIn 220ms ease both;
}

@keyframes messageIn {
  from { transform: translateY(6px); opacity: 0; }
}

.message__avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 10px;
  font-weight: 800;
}

.message--assistant .message__avatar {
  border-color: rgba(124, 108, 242, 0.22);
  color: #b6aff9;
  background: var(--accent-soft);
}

.message__main {
  min-width: 0;
}

.message__meta {
  display: flex;
  min-height: 22px;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.message__meta strong {
  font-size: 11px;
}

.message__meta time {
  color: var(--muted-2);
  font-size: 8px;
}

.message__copy {
  width: auto;
  min-width: 26px;
  height: 26px;
  margin-left: auto;
  opacity: 0;
  font-size: 9px;
}

.message:hover .message__copy,
.message__copy:focus {
  opacity: 1;
}

.message__content {
  color: #dce0e8;
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.message__content--streaming {
  white-space: pre-wrap;
}

.message--user .message__content {
  display: inline-block;
  max-width: 720px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 4px 14px 14px 14px;
  background: rgba(255, 255, 255, 0.035);
}

.message__content p {
  margin: 0 0 0.8em;
}

.message__content p:last-child {
  margin-bottom: 0;
}

.message__content pre {
  position: relative;
  max-width: 100%;
  margin: 13px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #070910;
}

.message__content code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.message__content :not(pre) > code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #bfb7ff;
  background: var(--accent-soft);
  font-size: 0.9em;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 31px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-2);
  background: var(--surface);
  font-size: 8px;
  text-transform: uppercase;
}

.code-header button {
  color: var(--muted);
  background: transparent;
  font-size: 8px;
}

.message__content pre > code {
  display: block;
  padding: 13px;
  color: #cbd2df;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre;
}

.message__content ul,
.message__content ol {
  margin: 8px 0;
  padding-left: 22px;
}

.message__content a {
  color: #a99eff;
  text-decoration: underline;
}

.message__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.message-file {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  font-size: 9px;
}

.message__cursor {
  display: inline-block;
  width: 6px;
  height: 15px;
  margin-left: 2px;
  border-radius: 2px;
  background: var(--accent-2);
  vertical-align: -2px;
  animation: blink 0.8s infinite;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: dot 1s ease-in-out infinite;
}

.typing-dots i:nth-child(2) { animation-delay: 120ms; }
.typing-dots i:nth-child(3) { animation-delay: 240ms; }

@keyframes dot {
  50% { transform: translateY(-3px); opacity: 0.45; }
}

.generation-activity {
  display: grid;
  width: min(560px, 100%);
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  padding: 13px 15px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background:
    linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, .035) 45%, transparent 65%) 0 0 / 220% 100%,
    var(--surface-2);
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
  animation: generationShimmer 2.8s linear infinite;
}

.generation-activity__visual {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-soft) 78%, transparent);
}

.generation-activity__visual i {
  position: absolute;
  border-radius: 50%;
}

.generation-activity__visual i:nth-child(1) {
  width: 30px;
  height: 30px;
  border: 2px solid transparent;
  border-top-color: var(--accent-2);
  border-right-color: color-mix(in srgb, var(--accent-2) 35%, transparent);
  animation: generationOrbit 1.15s linear infinite;
}

.generation-activity__visual i:nth-child(2) {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-bottom-color: var(--accent-2);
  animation: generationOrbit .85s linear infinite reverse;
}

.generation-activity__visual i:nth-child(3) {
  width: 6px;
  height: 6px;
  background: var(--accent-2);
  box-shadow: 0 0 13px color-mix(in srgb, var(--accent-2) 70%, transparent);
  animation: generationPulse 1.25s ease-in-out infinite;
}

.generation-activity__body {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.generation-activity__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.generation-activity__heading strong {
  color: var(--text);
  font-size: 12px;
}

.generation-activity__heading time,
.generation-activity__body small {
  color: var(--muted-2);
  font-size: 9px;
}

.generation-activity__heading time {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.generation-activity__progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 3px;
}

.generation-activity__progress span {
  position: relative;
  padding-top: 6px;
  color: var(--muted-2);
  font-size: 8px;
}

.generation-activity__progress span::before {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  border-radius: 10px;
  background: var(--border-strong);
  content: "";
}

.generation-activity__progress span.is-active {
  color: var(--text-soft);
}

.generation-activity__progress span.is-active::before {
  background: var(--accent-2);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent-2) 50%, transparent);
  animation: generationProgress 1.1s ease-in-out infinite;
}

.generation-activity__progress span.is-done::before {
  background: color-mix(in srgb, var(--accent-2) 55%, var(--border));
}

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

@keyframes generationPulse {
  50% { transform: scale(.68); opacity: .55; }
}

@keyframes generationShimmer {
  to { background-position: -220% 0, 0 0; }
}

@keyframes generationProgress {
  50% { opacity: .45; }
}

@media (max-width: 560px) {
  .generation-activity {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 11px;
  }

  .generation-activity__visual {
    width: 34px;
    height: 34px;
  }

  .generation-activity__visual i:nth-child(1) {
    width: 25px;
    height: 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .generation-activity,
  .generation-activity__visual i,
  .generation-activity__progress span.is-active::before {
    animation: none;
  }
}

.composer-wrap {
  position: relative;
  z-index: 10;
  width: min(880px, calc(100% - 34px));
  margin: 0 auto;
  padding: 0 0 14px;
  background: linear-gradient(180deg, transparent, #090b12 20%);
}

.composer {
  min-height: 92px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: rgba(18, 22, 32, 0.96);
  box-shadow: 0 13px 40px rgba(0, 0, 0, 0.22);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.composer:focus-within {
  border-color: rgba(124, 108, 242, 0.42);
  box-shadow: 0 0 0 3px rgba(124, 108, 242, 0.08), 0 13px 40px rgba(0, 0, 0, 0.22);
}

#message-input {
  display: block;
  width: 100%;
  max-height: 190px;
  min-height: 48px;
  resize: none;
  padding: 15px 16px 5px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  line-height: 1.5;
}

#message-input:focus {
  box-shadow: none;
}

.composer__toolbar {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 7px 7px 10px;
}

.composer__left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.composer-tool {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
}

.composer-tool:hover {
  border-color: var(--border);
  color: var(--text-soft);
  background: var(--surface-hover);
}

.composer-tool[aria-pressed="true"] {
  border-color: rgba(225, 154, 119, 0.5);
  color: #f4c1a6;
  background: rgba(212, 122, 85, 0.16);
  box-shadow: inset 0 0 0 1px rgba(212, 122, 85, 0.08);
}

.composer-hint {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.send-button {
  display: inline-flex;
  min-width: 91px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px 0 13px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #8170f5, #6757d8);
  font-size: 9px;
  font-weight: 760;
  box-shadow: 0 5px 16px rgba(103, 87, 216, 0.24);
}

.send-button:hover {
  background: linear-gradient(135deg, #8e7efb, #7161e2);
}

.send-button--stop {
  min-width: 72px;
  background: var(--red-soft);
  color: #ff9eaa;
  border: 1px solid rgba(255, 108, 124, 0.28);
  box-shadow: none;
}

.send-button--stop:hover {
  background: rgba(255, 108, 124, 0.18);
}

.stop-square {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
}

.composer-note {
  margin: 7px 0 0;
  color: var(--muted-2);
  font-size: 8px;
  text-align: center;
}

.attachment-list {
  display: flex;
  max-height: 94px;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  overflow-y: auto;
}

.attachment-chip {
  display: flex;
  max-width: 240px;
  align-items: center;
  gap: 7px;
  padding: 6px 7px 6px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-soft);
  background: var(--surface-2);
  font-size: 9px;
}

.attachment-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip small {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 8px;
}

.attachment-chip button {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  padding: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.attachment-chip button:hover {
  color: var(--red);
  background: var(--red-soft);
}

.upload-dropzone {
  position: fixed;
  z-index: 100;
  inset: 16px;
  display: none;
  align-content: center;
  justify-items: center;
  border: 2px dashed rgba(124, 108, 242, 0.65);
  border-radius: 24px;
  color: var(--text);
  background: rgba(8, 10, 16, 0.91);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.upload-dropzone strong {
  margin-bottom: 5px;
  font-size: 22px;
}

.upload-dropzone span {
  color: var(--muted);
}

body.is-dragging .upload-dropzone {
  display: grid;
}

/* Modals and feedback */
.modal {
  width: min(510px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: visible;
  border: 1px solid var(--border-strong);
  border-radius: 19px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(2, 3, 7, 0.72);
  backdrop-filter: blur(7px);
}

.modal[open] {
  animation: modalIn 160ms ease both;
}

@keyframes modalIn {
  from { transform: translateY(8px) scale(0.985); opacity: 0; }
}

.modal__panel {
  max-height: calc(100vh - 30px);
  margin: 0;
  padding: 23px;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.modal__header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.modal__header .eyebrow {
  margin-bottom: 3px;
}

.modal__panel > p {
  color: var(--muted);
  font-size: 12px;
}

.modal__footer {
  display: flex;
  gap: 9px;
  margin-top: 20px;
}

.modal__footer--split {
  align-items: center;
  justify-content: space-between;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.02);
}

.profile-summary > div {
  min-width: 0;
}

.profile-summary strong {
  display: block;
  margin-bottom: 5px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 20px;
  color: var(--muted);
  background: var(--surface-3);
  font-size: 8px;
  font-weight: 700;
}

.status-pill--success {
  color: #7de1ba;
  background: var(--green-soft);
}

.status-pill--danger {
  color: #ff9eaa;
  background: var(--red-soft);
}

.status-pill--warning {
  color: #f6ca7f;
  background: var(--amber-soft);
}

.details-list {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--border);
}

.details-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
}

.details-list dt {
  color: var(--muted);
  font-size: 10px;
}

.details-list dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
}

.modal-section {
  margin-top: 17px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.018);
}

.modal-section h3 {
  margin-bottom: 5px;
  font-size: 12px;
}

.modal-section__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-section__heading h3 {
  margin-bottom: 0;
}

.modal-section p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
}

.modal-section textarea {
  font-size: 11px;
}

.memory-list {
  display: grid;
  max-height: 155px;
  gap: 5px;
  margin-top: 8px;
  overflow-y: auto;
}

.memory-item {
  display: grid;
  grid-template-columns: minmax(85px, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.10);
  font-size: 9px;
}

.memory-item strong {
  overflow: hidden;
  color: #aaa1f6;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-item span {
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.memory-empty {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted-2);
  font-size: 9px;
  text-align: center;
}

.memory-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.memory-actions .danger-text {
  color: #ff9eaa;
}

.inline-form {
  display: flex;
  align-items: stretch;
  gap: 7px;
}

.inline-form input,
.inline-form select {
  min-width: 0;
  flex: 1;
  padding: 8px 10px;
  font-size: 11px;
}

.modal--confirm {
  width: min(390px, calc(100% - 28px));
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  place-items: center;
  border: 1px solid rgba(255, 108, 124, 0.24);
  border-radius: 14px;
  color: #ff9eaa;
  background: var(--red-soft);
  font-size: 18px;
  font-weight: 800;
}

.modal--confirm h2 {
  margin-bottom: 7px;
  font-size: 18px;
}

.modal--confirm p {
  margin-bottom: 0;
}

.modal--confirm .button {
  min-width: 120px;
}

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

.toast {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(23, 28, 40, 0.97);
  box-shadow: 0 13px 40px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  animation: toastIn 200ms ease both;
}

@keyframes toastIn {
  from { transform: translateX(15px); opacity: 0; }
}

.toast__icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  color: #c4beff;
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 800;
}

.toast--success .toast__icon {
  color: #80e2bc;
  background: var(--green-soft);
}

.toast--error .toast__icon {
  color: #ff9eaa;
  background: var(--red-soft);
}

.toast strong,
.toast small {
  display: block;
}

.toast strong {
  margin-bottom: 1px;
  font-size: 10px;
}

.toast small {
  color: var(--muted);
  font-size: 9px;
}

.toast button {
  width: 25px;
  height: 25px;
  padding: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.toast button:hover {
  background: var(--surface-hover);
}

.sidebar-scrim {
  display: none;
}

.sidebar-skeleton,
.content-skeleton {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.sidebar-skeleton i,
.content-skeleton i {
  display: block;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--surface) 20%, var(--surface-2) 50%, var(--surface) 80%);
  background-size: 240% 100%;
  animation: skeleton 1.4s linear infinite;
}

.content-skeleton i {
  height: 44px;
}

@keyframes skeleton {
  to { background-position: -240% 0; }
}

/* Admin */
.admin-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 242px minmax(0, 1fr);
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 242px;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin: 2px 16px 18px;
  padding: 5px 8px;
  border: 1px solid rgba(124, 108, 242, 0.18);
  border-radius: 7px;
  color: #aaa1f6;
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.admin-badge span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
}

.admin-nav {
  display: grid;
  gap: 3px;
  padding: 0 10px;
}

.admin-nav__item {
  display: grid;
  min-height: 41px;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
}

.admin-nav__item:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.03);
}

.admin-nav__item.is-active {
  border-color: rgba(124, 108, 242, 0.17);
  color: var(--text);
  background: var(--accent-soft);
}

.admin-nav__item > span:first-child {
  color: #9c92ef;
  font-size: 13px;
  text-align: center;
}

.admin-nav__item b {
  display: grid;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 10px;
}

.admin-nav__item.is-active b {
  color: #bcb5fa;
  background: rgba(124, 108, 242, 0.17);
}

.admin-sidebar__footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.admin-sidebar__footer .button {
  justify-content: flex-start;
  font-size: 11px;
}

.admin-main {
  min-width: 0;
  min-height: 100vh;
  grid-column: 2;
  padding: 0 clamp(20px, 3.5vw, 52px) 60px;
}

.admin-header {
  display: flex;
  min-height: 87px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.admin-header > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-header .eyebrow {
  margin-bottom: 2px;
}

.admin-header h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.admin-header__actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.health-chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 650;
}

.health-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.health-chip.is-healthy i {
  background: var(--green);
  box-shadow: 0 0 7px rgba(69, 208, 155, 0.55);
}

.health-chip.is-unhealthy i {
  background: var(--red);
}

.admin-section {
  animation: sectionIn 180ms ease both;
}

@keyframes sectionIn {
  from { transform: translateY(4px); opacity: 0; }
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 19px;
}

.section-heading h2 {
  margin-bottom: 4px;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.section-heading p,
.section-heading time {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.026), rgba(255, 255, 255, 0.01));
}

.stat-card__icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 11px;
  color: #b8b0ff;
  background: var(--accent-soft);
  font-size: 14px;
}

.stat-card__icon--green {
  color: #81e3bd;
  background: var(--green-soft);
}

.stat-card__icon--amber {
  color: #f5ca80;
  background: var(--amber-soft);
}

.stat-card__icon--violet {
  color: #c6a4ff;
  background: var(--violet-soft);
}

.stat-card div {
  min-width: 0;
}

.stat-card small,
.stat-card strong,
.stat-card div > span {
  display: block;
}

.stat-card small {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
}

.stat-card strong {
  margin-bottom: 1px;
  font-size: 21px;
  line-height: 1.1;
}

.stat-card div > span {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-card,
.table-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.admin-card {
  min-width: 0;
  overflow: hidden;
}

.admin-card > header {
  display: flex;
  min-height: 63px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
}

.admin-card h3 {
  margin-bottom: 2px;
  font-size: 13px;
}

.admin-card header p {
  margin: 0;
  color: var(--muted-2);
  font-size: 11px;
}

.compact-list {
  min-height: 196px;
}

.compact-list__item {
  display: flex;
  width: 100%;
  min-height: 59px;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.compact-list__item:hover,
.compact-list__item:focus-visible {
  background: var(--surface-hover);
}

.compact-list__item:last-child {
  border-bottom: 0;
}

.compact-list__main {
  min-width: 0;
  flex: 1;
}

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

.compact-list__main strong {
  margin-bottom: 2px;
  font-size: 11px;
}

.compact-list__main small {
  color: var(--muted-2);
  font-size: 10px;
}

.compact-list__item > time {
  color: var(--muted-2);
  font-size: 10px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}

.admin-search {
  display: flex;
  width: min(360px, 100%);
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
}

.admin-search:focus-within {
  border-color: rgba(124, 108, 242, 0.55);
  box-shadow: var(--focus);
}

.admin-search input {
  min-width: 0;
  height: 35px;
  flex: 1;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
}

.admin-search input:focus {
  box-shadow: none;
}

.compact-select select {
  min-height: 38px;
  background-color: var(--surface);
  font-size: 11px;
}

.toolbar-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.pagination-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.data-table th {
  height: 42px;
  padding: 0 15px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.012);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  height: 60px;
  padding: 9px 15px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.018);
}

.table-user {
  display: flex;
  min-width: 185px;
  align-items: center;
  gap: 9px;
}

.table-user__text strong,
.table-user__text small {
  display: block;
}

.table-user__text strong {
  margin-bottom: 1px;
  font-size: 11px;
}

.table-user__text small {
  color: var(--muted-2);
  font-size: 10px;
}

.role-mark {
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 5px;
  color: #bcb5fa;
  background: var(--accent-soft);
  font-size: 9px;
  text-transform: uppercase;
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.table-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.table-status--banned {
  color: #ff9eaa;
}

.table-status--banned i {
  background: var(--red);
}

.table-status--unverified {
  color: #f4c87e;
}

.table-status--unverified i {
  background: var(--amber);
}

.plan-badge {
  display: inline-flex;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: #b7aff9;
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.row-action {
  min-height: 29px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.row-action:hover {
  border-color: rgba(124, 108, 242, 0.38);
  color: var(--text);
  background: var(--surface-hover);
}

.table-empty {
  padding: 54px 20px;
  color: var(--muted);
  text-align: center;
}

.access-denied-title {
  margin: 0;
  font-size: 22px;
}

.table-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 12px;
}

.table-empty p {
  margin: 0;
  font-size: 11px;
}

.filter-tabs {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.filter-tabs button {
  min-height: 31px;
  padding: 5px 11px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.filter-tabs button.is-active {
  color: var(--text);
  background: var(--surface-3);
}

.request-list {
  display: grid;
  gap: 9px;
}

.request-card {
  display: grid;
  min-height: 92px;
  grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1.4fr) auto;
  align-items: center;
  gap: 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.015);
}

.request-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

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

.request-card__user strong {
  margin-bottom: 4px;
  font-size: 12px;
}

.request-card__user small {
  color: var(--muted-2);
  font-size: 10px;
}

.request-card__reason {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.request-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.request-detail {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  font-size: 11px;
}

.request-detail strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-soft);
  font-size: 11px;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.plan-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.plan-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
}

.plan-card__header h3 {
  margin-bottom: 3px;
  font-size: 14px;
  text-transform: capitalize;
}

.plan-card__header p {
  margin: 0;
  color: var(--muted-2);
  font-size: 10px;
}

.plan-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.plan-field {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.plan-field input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 11px;
}

.plan-tools-field .permission-option input {
  width: auto;
  min-height: 0;
  padding: 0;
}

.plan-field--wide {
  grid-column: 1 / -1;
}

.plan-field textarea {
  min-height: 70px;
  font-size: 11px;
  line-height: 1.55;
}

.plan-switch-row {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 11px;
}

.plan-switch-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.plan-card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
}

/* Responsive */
@media (max-width: 1100px) {
  .auth-view {
    grid-template-columns: 1fr 430px;
  }

  .feature-row {
    grid-template-columns: 1fr;
    gap: 17px;
  }

  .feature-item small {
    white-space: normal;
  }

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

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

  .auth-view {
    display: block;
  }

  .auth-hero {
    width: 100%;
    min-width: 0;
    min-height: 380px;
    padding: 28px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .auth-hero__content {
    padding: 60px 0 30px;
  }

  .auth-hero h1 {
    font-size: 48px;
  }

  .auth-lead {
    margin-bottom: 0;
  }

  .feature-row,
  .auth-hero__footer {
    display: none;
  }

  .auth-panel {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: auto;
    padding: 48px 25px 70px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .admin-sidebar {
    position: fixed;
    z-index: 80;
    inset: 0 auto 0 0;
    width: min(300px, calc(100vw - 46px));
    transform: translateX(-105%);
    box-shadow: 24px 0 70px rgba(0, 0, 0, 0.38);
    transition: transform 220ms ease;
  }

  .sidebar.is-open,
  .admin-sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(2, 3, 7, 0.62);
    opacity: 0;
    transition: opacity 220ms ease, visibility 220ms ease;
  }

  .sidebar-scrim.is-visible {
    visibility: visible;
    opacity: 1;
  }

  .workspace {
    grid-column: 1;
  }

  .sidebar-toggle {
    display: inline-grid;
  }

  .model-control select {
    max-width: 150px;
  }

  .stream-toggle > span:last-child {
    display: none;
  }

  .admin-shell {
    display: block;
  }

  .admin-main {
    padding: 0 22px 50px;
  }

  .admin-header .sidebar-toggle {
    display: inline-grid;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .request-card {
    grid-template-columns: minmax(160px, 0.8fr) minmax(200px, 1.2fr);
  }

  .request-card__actions {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .auth-hero {
    min-height: 315px;
  }

  .auth-hero__content {
    padding: 44px 0 12px;
  }

  .auth-hero h1 {
    font-size: 39px;
  }

  .auth-lead {
    font-size: 14px;
  }

  .chat-header {
    padding: 0 10px;
  }

  .chat-header h1 {
    max-width: 31vw;
  }

  .model-control select {
    width: 105px;
    padding-right: 23px;
    text-overflow: ellipsis;
  }

  .stream-toggle {
    display: none;
  }

  .empty-state {
    padding-top: 54px;
  }

  .empty-state h2 {
    font-size: 29px;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .prompt-card {
    min-height: 78px;
  }

  .message-list {
    padding-inline: 15px;
  }

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

  .message__avatar {
    width: 27px;
    height: 27px;
    border-radius: 8px;
  }

  .composer-wrap {
    width: calc(100% - 18px);
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .composer-hint {
    display: none;
  }

  .composer-note {
    display: none;
  }

  .send-button {
    min-width: 34px;
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .send-label {
    display: none;
  }

  .desktop-label {
    display: none;
  }

  .modal__panel {
    padding: 19px;
  }

  .modal__footer--split {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal--confirm .modal__footer--split {
    flex-direction: row;
  }

  .modal--confirm .button {
    min-width: 0;
    flex: 1;
  }

  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }

  .admin-main {
    padding-inline: 14px;
  }

  .admin-header {
    min-height: 76px;
  }

  .admin-header h1 {
    font-size: 16px;
  }

  .admin-header__actions .health-chip {
    display: none;
  }

  .admin-header__actions .button {
    min-width: 34px;
    width: 34px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0;
  }

  .admin-header__actions .button::before {
    content: "↻";
    color: var(--text);
    font-size: 14px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .admin-search {
    width: 100%;
  }

  .compact-select {
    flex: 1;
  }

  .compact-select select {
    width: 100%;
  }

  .toolbar-count {
    align-self: center;
  }

  .filter-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .filter-tabs button {
    flex: 1;
    white-space: nowrap;
  }

  .request-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .request-card__actions {
    grid-column: auto;
  }

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

  .plan-field--wide,
  .plan-switch-row {
    grid-column: 1 / -1;
  }
}

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

/* Warm, calm interface */
:root {
  color-scheme: dark;
  --bg: #181511;
  --bg-soft: #1d1a16;
  --surface: #24201b;
  --surface-2: #2b2620;
  --surface-3: #342e27;
  --surface-hover: #393229;
  --border: rgba(246, 232, 211, 0.12);
  --border-strong: rgba(246, 232, 211, 0.21);
  --text: #f7efe3;
  --text-soft: #e0d5c5;
  --muted: #aea293;
  --muted-2: #a2988b;
  --accent: #d47a55;
  --accent-2: #9db5a0;
  --accent-soft: rgba(212, 122, 85, 0.14);
  --green: #88b197;
  --green-soft: rgba(136, 177, 151, 0.14);
  --amber: #d9a85f;
  --amber-soft: rgba(217, 168, 95, 0.14);
  --red: #df7d73;
  --red-soft: rgba(223, 125, 115, 0.14);
  --violet-soft: rgba(174, 146, 119, 0.14);
  --radius-xs: 9px;
  --radius-sm: 13px;
  --radius: 17px;
  --radius-lg: 24px;
  --shadow: 0 24px 64px rgba(8, 6, 4, 0.32);
  --focus: 0 0 0 3px rgba(225, 142, 105, 0.34);
}

body {
  background: var(--bg);
  font-size: 15px;
}

::selection {
  color: #fffaf3;
  background: rgba(212, 122, 85, 0.72);
}

:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus);
}

.eyebrow,
.sidebar-section-title,
.admin-badge,
.data-table th,
.role-mark {
  letter-spacing: normal;
  text-transform: none;
}

.eyebrow {
  color: #c99b7f;
  font-size: 12px;
  font-weight: 700;
}

.brand-mark {
  overflow: visible;
  border-color: rgba(255, 239, 222, 0.28);
  border-radius: 50%;
  background: linear-gradient(145deg, #dc8b66, #bc6547);
  box-shadow: 0 5px 16px rgba(86, 42, 26, 0.24);
}

.brand-mark::before {
  width: auto;
  height: auto;
  content: "w";
  transform: none;
  border: 0;
  color: #fff8ee;
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}

.brand-mark::after,
.brand-mark span {
  display: none;
}

.brand-mark--large::before {
  font-size: 29px;
}

.button {
  min-height: 42px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 680;
}

.button--primary,
.send-button {
  color: #fffaf4;
  background: #c96f4c;
  box-shadow: 0 7px 20px rgba(81, 38, 22, 0.24);
}

.button--primary:hover:not(:disabled),
.send-button:hover {
  background: #d77c57;
}

.button--secondary {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.button--secondary:hover:not(:disabled),
.button--ghost:hover:not(:disabled) {
  border-color: rgba(225, 154, 119, 0.5);
  background: var(--surface-hover);
}

.link-button {
  color: #dda07f;
  font-size: 13px;
}

.link-button:hover {
  color: #f0b99b;
}

.field {
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
}

.field small {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 450;
}

.field > input,
.field > select,
.field > textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
}

.input-shell {
  min-height: 48px;
  border-color: var(--border-strong);
  border-radius: 13px;
  background: rgba(255, 248, 237, 0.035);
}

.input-shell:focus-within,
textarea:focus,
select:focus,
input[type="text"]:focus,
input[type="search"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus {
  border-color: rgba(225, 154, 119, 0.64);
  background-color: rgba(212, 122, 85, 0.045);
}

input::placeholder,
textarea::placeholder {
  color: #978c7f;
}

.check {
  color: var(--muted);
  font-size: 12px;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

.auth-view {
  grid-template-columns: minmax(440px, 1.08fr) minmax(420px, 0.92fr);
}

.auth-hero {
  border-color: var(--border);
  background: #211c17;
}

.auth-hero::before {
  right: -180px;
  bottom: -300px;
  border-color: rgba(214, 154, 118, 0.1);
  box-shadow: 0 0 0 90px rgba(214, 154, 118, 0.025), 0 0 0 180px rgba(214, 154, 118, 0.014);
}

.auth-hero::after {
  display: none;
}

.auth-hero h1 {
  max-width: 720px;
  font-size: clamp(42px, 5.2vw, 72px);
  font-weight: 660;
  letter-spacing: -0.045em;
  line-height: 1.03;
}

.auth-hero h1 span {
  color: #dfa082;
}

.auth-lead {
  color: var(--muted);
  line-height: 1.65;
}

.feature-row {
  gap: 14px;
}

.feature-item {
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 245, 230, 0.025);
}

.feature-icon {
  border: 0;
  border-radius: 50%;
  color: #f1c2a8;
  background: var(--accent-soft);
  font-size: 14px;
}

.feature-item strong {
  font-size: 13px;
}

.feature-item small {
  color: var(--muted-2);
  font-size: 10px;
  white-space: normal;
}

.auth-hero__footer {
  font-size: 11px;
  letter-spacing: normal;
}

.auth-panel {
  background: #181511;
}

.auth-card {
  max-width: 410px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 248, 238, 0.025);
  box-shadow: 0 20px 56px rgba(7, 5, 3, 0.18);
}

.auth-card__heading > p:last-child {
  font-size: 13px;
}

.segmented,
.filter-tabs {
  border-color: var(--border);
  border-radius: 13px;
  background: rgba(255, 248, 238, 0.035);
}

.segmented__button,
.filter-tabs button {
  min-height: 38px;
  font-size: 13px;
}

.segmented__button.is-active,
.filter-tabs button.is-active {
  background: var(--surface-3);
  box-shadow: 0 2px 8px rgba(8, 6, 4, 0.18);
}

.sidebar,
.admin-sidebar {
  border-color: var(--border);
  background: #1d1915;
}

.button--new-chat {
  border-color: rgba(212, 122, 85, 0.32);
  color: #f3d0bd;
  background: var(--accent-soft);
}

.button--new-chat:hover {
  border-color: rgba(225, 154, 119, 0.55);
  background: rgba(212, 122, 85, 0.2);
}

.sidebar-search {
  border-color: transparent;
  background: rgba(255, 248, 238, 0.04);
}

.sidebar-search:focus-within {
  border-color: rgba(225, 154, 119, 0.5);
}

.sidebar-search input {
  font-size: 12px;
}

.sidebar-section-title {
  color: var(--muted);
  font-size: 11px;
}

.conversation-item {
  min-height: 52px;
  border-radius: 12px;
}

.conversation-item__text strong {
  font-size: 12px;
}

.conversation-item__text small,
.profile-chip__text small {
  font-size: 10px;
}

.conversation-item.is-active {
  border-color: rgba(212, 122, 85, 0.25);
  background: var(--accent-soft);
}

.conversation-item.is-active .conversation-item__icon {
  color: #efb695;
  background: rgba(212, 122, 85, 0.18);
}

.avatar {
  border-color: rgba(212, 122, 85, 0.34);
  color: #f1bea2;
  background: rgba(212, 122, 85, 0.14);
}

.profile-chip__text strong {
  font-size: 11px;
}

.workspace {
  background: #181511;
}

@supports (height: 100dvh) {
  .app-shell,
  .workspace,
  .sidebar,
  .admin-sidebar {
    height: 100dvh;
  }
}

.chat-header {
  border-color: var(--border);
  background: rgba(24, 21, 17, 0.92);
}

.chat-header h1 {
  font-size: 14px;
}

.connection-status {
  color: var(--muted);
  font-size: 10px;
}

.connection-status span,
.health-chip.is-healthy i {
  box-shadow: none;
}

.empty-state {
  width: min(780px, calc(100% - 40px));
  padding-top: clamp(42px, 8vh, 92px);
}

.assistant-orb {
  width: 62px;
  height: 62px;
  border-color: rgba(212, 122, 85, 0.28);
  border-radius: 50%;
  background: rgba(212, 122, 85, 0.13);
  box-shadow: none;
}

.assistant-orb::before {
  width: auto;
  height: auto;
  content: "✦";
  transform: none;
  border: 0;
  color: #e8a987;
  font-size: 24px;
}

.assistant-orb::after,
.assistant-orb span {
  display: none;
}

.empty-state h2 {
  font-weight: 660;
  letter-spacing: -0.035em;
}

.empty-state > p:not(.eyebrow) {
  font-size: 14px;
  line-height: 1.6;
}

.prompt-card {
  min-height: 96px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 248, 238, 0.025);
}

.prompt-card:hover {
  transform: translateY(-1px);
  border-color: rgba(225, 154, 119, 0.42);
  background: rgba(212, 122, 85, 0.06);
}

.prompt-card__icon {
  border-color: rgba(212, 122, 85, 0.2);
  color: #e7a582;
  background: var(--accent-soft);
}

.prompt-card strong {
  font-size: 13px;
}

.prompt-card small {
  font-size: 11px;
}

.message {
  margin-bottom: 31px;
}

.message__avatar {
  border-color: var(--border);
  border-radius: 50%;
}

.message--assistant .message__avatar {
  color: #efb294;
  background: var(--accent-soft);
}

.message__meta strong {
  font-size: 12px;
}

.message__content {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.68;
}

.message--user .message__content {
  border-color: var(--border);
  background: #2b2620;
}

.composer-wrap {
  padding-top: 8px;
  padding-bottom: 15px;
  background: linear-gradient(180deg, transparent, #181511 18%);
}

.chat-mode-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 9px;
}

.chat-mode-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #211d18;
}

.chat-mode-option {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 680;
}

.chat-mode-option span {
  margin-left: 4px;
  padding: 2px 5px;
  border-radius: 20px;
  color: #d8bda9;
  background: rgba(255, 248, 238, 0.07);
  font-size: 9px;
}

.chat-mode-option.is-active {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 2px 7px rgba(7, 5, 3, 0.2);
}

.is-codex-mode .chat-mode-option.is-active {
  color: #f4c1a6;
  background: rgba(212, 122, 85, 0.18);
}

.mode-description {
  max-width: 520px;
  margin: 0;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.45;
  text-align: right;
}

.is-codex-mode .mode-description {
  color: #cdb7a7;
}

.composer {
  min-height: 98px;
  border-color: var(--border-strong);
  border-radius: 17px;
  background: #24201b;
  box-shadow: 0 12px 30px rgba(7, 5, 3, 0.2);
}

.composer:focus-within {
  border-color: rgba(225, 154, 119, 0.5);
  box-shadow: var(--focus), 0 12px 30px rgba(7, 5, 3, 0.2);
}

#message-input {
  padding-top: 16px;
  font-size: 14px;
}

.composer-tool {
  font-size: 11px;
}

.composer-hint,
.composer-note {
  color: var(--muted-2);
  font-size: 10px;
}

.send-button {
  min-width: 96px;
  height: 36px;
  font-size: 11px;
}

.modal {
  border-color: var(--border-strong);
  border-radius: 22px;
  background: var(--surface);
}

.modal::backdrop {
  background: rgba(12, 9, 6, 0.74);
}

.modal__panel {
  padding: 25px;
}

.modal__panel--wide {
  width: min(680px, calc(100vw - 30px));
}

.modal--wide {
  width: min(680px, calc(100% - 28px));
}

.modal-section,
.profile-summary,
.request-detail {
  background: rgba(255, 248, 238, 0.025);
}

.modal-section h3 {
  font-size: 14px;
}

.modal-section p {
  font-size: 12px;
}

.status-pill {
  font-size: 10px;
}

.admin-shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.admin-sidebar {
  width: 260px;
}

.admin-badge {
  border-color: rgba(212, 122, 85, 0.25);
  border-radius: 20px;
  color: #dca383;
  background: var(--accent-soft);
  font-size: 11px;
}

.admin-badge span {
  background: var(--green);
}

.admin-nav {
  gap: 4px;
}

.admin-nav__item {
  min-height: 44px;
  border-radius: 11px;
  font-size: 13px;
}

.admin-nav__item > span:first-child {
  color: #c79c82;
}

.admin-nav__item.is-active {
  border-color: rgba(212, 122, 85, 0.24);
  background: var(--accent-soft);
}

.admin-main {
  grid-column: 2;
  max-width: 1600px;
  padding-inline: clamp(22px, 3.5vw, 54px);
}

.admin-header {
  min-height: 92px;
}

.admin-header h1 {
  font-size: 21px;
}

.health-chip {
  border-radius: 20px;
  background: var(--surface);
  font-size: 12px;
}

.section-heading {
  align-items: center;
}

.section-heading h2 {
  font-size: 21px;
}

.section-heading p,
.section-heading time {
  font-size: 12px;
}

.section-heading__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-grid {
  gap: 14px;
}

.stat-card,
.admin-card,
.table-card,
.request-card,
.plan-card {
  border-color: var(--border);
  border-radius: 16px;
  background: rgba(255, 248, 238, 0.025);
}

.stat-card {
  padding: 18px;
}

.stat-card__icon {
  color: #e7aa89;
  background: var(--accent-soft);
}

.stat-card small,
.stat-card div > span,
.admin-card header p,
.compact-list__main small,
.compact-list__item > time {
  font-size: 11px;
}

.stat-card strong {
  font-size: 24px;
}

.admin-card h3 {
  font-size: 14px;
}

.compact-list__main strong,
.data-table,
.table-user__text strong,
.request-card__user strong {
  font-size: 12px;
}

.admin-search,
.compact-select select {
  background: var(--surface);
}

.data-table {
  min-width: 900px;
}

.data-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.data-table td {
  font-size: 12px;
}

.role-mark,
.plan-badge,
.role-badge {
  color: #e5ad8e;
  background: var(--accent-soft);
}

.role-badge {
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 680;
}

.row-action {
  min-height: 32px;
  font-size: 12px;
}

.row-action:hover {
  border-color: rgba(225, 154, 119, 0.42);
}

.request-card__reason {
  font-size: 12px;
}

.plans-grid,
.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.plan-card {
  padding: 19px;
}

.plan-field,
.plan-switch-row {
  font-size: 12px;
}

.resource-grid > .content-skeleton,
.resource-empty {
  grid-column: 1 / -1;
}

.resource-card {
  display: flex;
  min-width: 0;
  min-height: 250px;
  flex-direction: column;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(255, 248, 238, 0.025);
}

.resource-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.resource-card h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.resource-card code {
  color: var(--muted-2);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.resource-card__badges,
.resource-card__features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.resource-card__badges {
  justify-content: flex-end;
}

.resource-card__description {
  min-height: 44px;
  margin: 15px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.resource-badge {
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.resource-badge--success {
  color: #add2b8;
  background: var(--green-soft);
}

.resource-badge--accent {
  color: #e7af90;
  background: var(--accent-soft);
}

.resource-badge--muted {
  color: var(--muted-2);
}

.resource-badge--danger {
  color: #ff9eaa;
  background: var(--red-soft);
}

.resource-badge--warning {
  color: #f5ca80;
  background: rgba(217, 168, 95, 0.09);
}

.resource-card > footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 17px;
}

.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.permission-list li {
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.resource-empty {
  padding: 56px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 17px;
  color: var(--muted);
  text-align: center;
}

.resource-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-soft);
  font-size: 15px;
}

.resource-empty p {
  max-width: 560px;
  margin: 0 auto;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.field--full {
  grid-column: 1 / -1;
}

.option-group {
  margin: 20px 0 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 15px;
}

.option-group legend {
  padding: 0 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.option-group > .check {
  margin: 6px 18px 6px 0;
}

.option-check {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 248, 238, 0.02);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.permission-option {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--muted);
  background: rgba(255, 248, 238, 0.02);
  cursor: pointer;
}

.permission-option:has(input:checked) {
  border-color: rgba(212, 122, 85, 0.38);
  background: var(--accent-soft);
}

.permission-option input {
  margin-top: 3px;
}

.permission-option span,
.permission-option strong,
.permission-option code {
  display: block;
  min-width: 0;
}

.permission-option strong {
  color: var(--text-soft);
  font-size: 11px;
}

.permission-option code {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.muted-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .resource-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .auth-card {
    max-width: 460px;
  }

  .admin-main {
    grid-column: auto;
  }

  .plans-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .section-heading__actions {
    align-items: stretch;
    flex-wrap: wrap;
  }
}

@media (max-width: 580px) {
  .auth-hero {
    min-height: 300px;
  }

  .auth-hero h1 {
    font-size: clamp(34px, 11vw, 42px);
  }

  .auth-panel {
    padding: 30px 14px 54px;
  }

  .auth-card {
    padding: 22px 18px;
  }

  .empty-state {
    width: calc(100% - 28px);
  }

  .chat-mode-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .chat-mode-switch {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .mode-description {
    max-width: none;
    min-height: 30px;
    padding-inline: 3px;
    text-align: left;
  }

  .composer-wrap {
    width: calc(100% - 18px);
  }

  .composer {
    min-height: 94px;
  }

  .section-heading,
  .section-heading__actions {
    width: 100%;
  }

  .section-heading__actions .button {
    flex: 1;
  }

  .resource-card {
    min-height: 0;
    padding: 16px;
  }

  .resource-card > header {
    flex-direction: column;
  }

  .resource-card__badges {
    justify-content: flex-start;
  }

  .resource-card > footer {
    align-items: stretch;
    flex-direction: column;
  }

  .resource-card > footer .button {
    width: 100%;
  }

  .form-grid,
  .form-grid--numbers,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .field--full {
    grid-column: auto;
  }

  .option-group > .check {
    display: flex;
    margin-right: 0;
  }

  .modal--wide {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }

  .modal__panel--wide {
    width: 100%;
  }

  .data-table {
    min-width: 850px;
  }
}

/* llama.cpp runtime diagnostics */
.runtime-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
  border: 1px solid rgba(212, 122, 85, 0.2);
  border-radius: 20px;
  background:
    radial-gradient(circle at 92% -20%, rgba(212, 122, 85, 0.16), transparent 38%),
    rgba(255, 248, 238, 0.025);
  box-shadow: 0 18px 48px rgba(7, 5, 3, 0.12);
}

.runtime-card__header,
.runtime-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 21px;
}

.runtime-card__header {
  border-bottom: 1px solid var(--border);
}

.runtime-card__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.runtime-card__mark {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(212, 122, 85, 0.3);
  border-radius: 14px;
  color: #f0b596;
  background: var(--accent-soft);
  font: 700 21px/1 Georgia, serif;
}

.runtime-card__identity h3,
.registry-heading h3,
.runtime-inventory__heading h4 {
  margin: 0;
  color: var(--text);
}

.runtime-card__identity h3 {
  margin-top: 2px;
  font-size: 17px;
}

.runtime-card__identity p:last-child,
.registry-heading p,
.runtime-inventory__heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.runtime-card__identity .eyebrow {
  margin: 0;
  font-size: 10px;
}

.runtime-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  background: rgba(255, 248, 238, 0.035);
  font-size: 10px;
  font-weight: 680;
}

.runtime-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}

.runtime-status[data-state="ready"] {
  border-color: rgba(136, 177, 151, 0.32);
  color: #b8d9c0;
  background: var(--green-soft);
}

.runtime-status[data-state="ready"] i {
  background: var(--green);
}

.runtime-status[data-state="loading"] {
  border-color: rgba(217, 168, 95, 0.32);
  color: #ebc98f;
  background: var(--amber-soft);
}

.runtime-status[data-state="loading"] i {
  background: var(--amber);
}

.runtime-status[data-state="offline"],
.runtime-status[data-state="error"] {
  border-color: rgba(223, 125, 115, 0.32);
  color: #efaaa2;
  background: var(--red-soft);
}

.runtime-status[data-state="offline"] i,
.runtime-status[data-state="error"] i {
  background: var(--red);
}

.runtime-card__body {
  display: grid;
  grid-template-columns: minmax(210px, 0.36fr) minmax(0, 1fr);
}

.runtime-facts {
  display: grid;
  align-content: start;
  gap: 0;
  margin: 0;
  padding: 8px 21px;
  border-right: 1px solid var(--border);
}

.runtime-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(246, 232, 211, 0.07);
}

.runtime-facts > div:last-child {
  border-bottom: 0;
}

.runtime-facts dt {
  color: var(--muted);
  font-size: 10px;
}

.runtime-facts dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 680;
  text-align: right;
  overflow-wrap: anywhere;
}

.runtime-inventory {
  min-width: 0;
  padding: 17px 21px 20px;
}

.runtime-inventory__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.runtime-inventory__heading h4 {
  font-size: 13px;
}

.runtime-inventory__heading > span {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 9px;
}

.runtime-model-list {
  display: grid;
  max-height: 312px;
  gap: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--surface-3) transparent;
}

.runtime-model {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 11px;
  border: 1px solid rgba(246, 232, 211, 0.09);
  border-radius: 12px;
  background: rgba(255, 248, 238, 0.022);
}

.runtime-model__main {
  min-width: 0;
}

.runtime-model__main code {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.runtime-model__facts,
.runtime-model__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.runtime-model__facts {
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 9px;
}

.runtime-model__facts span:not(:last-child)::after {
  margin-left: 5px;
  content: "·";
  opacity: 0.65;
}

.runtime-model__badges {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.runtime-model-status {
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 9px;
  font-weight: 680;
  white-space: nowrap;
}

.runtime-model-status[data-state="loaded"] {
  color: #add2b8;
  background: var(--green-soft);
}

.runtime-model-status[data-state="loading"] {
  color: #ebc98f;
  background: var(--amber-soft);
}

.runtime-empty {
  display: grid;
  min-height: 84px;
  place-content: center;
  gap: 4px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.runtime-empty strong {
  color: var(--text-soft);
  font-size: 11px;
}

.runtime-empty span {
  font-size: 10px;
}

.runtime-empty--error {
  border-color: rgba(223, 125, 115, 0.25);
  background: rgba(223, 125, 115, 0.045);
}

.runtime-card__footer {
  align-items: flex-start;
  border-top: 1px solid var(--border);
  background: rgba(255, 248, 238, 0.018);
}

.runtime-card__footer > p {
  max-width: 650px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.runtime-card__footer > p strong {
  color: var(--text-soft);
}

.runtime-card__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.registry-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
}

.registry-heading h3 {
  font-size: 15px;
}

@media (max-width: 900px) {
  .runtime-card__body {
    grid-template-columns: 1fr;
  }

  .runtime-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .runtime-facts > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 640px) {
  .runtime-card__header,
  .runtime-card__footer,
  .runtime-inventory {
    padding: 16px;
  }

  .runtime-card__header,
  .runtime-card__footer,
  .runtime-model,
  .runtime-inventory__heading {
    align-items: stretch;
    flex-direction: column;
  }

  .runtime-status {
    align-self: flex-start;
  }

  .runtime-facts {
    grid-template-columns: 1fr;
    padding-inline: 16px;
  }

  .runtime-facts > div:nth-last-child(2) {
    border-bottom: 1px solid rgba(246, 232, 211, 0.07);
  }

  .runtime-model__badges {
    justify-content: flex-start;
  }

  .runtime-card__actions,
  .runtime-card__actions .button {
    width: 100%;
  }

  .runtime-card__actions {
    flex-direction: column;
  }
}

/* Operational console */
.operations-banner,
.operations-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  border-radius: 18px;
}

.operations-banner {
  padding: 1rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--danger, #c54b40) 35%, transparent);
  background: color-mix(in srgb, var(--danger, #c54b40) 9%, var(--surface, #fff));
}

.operations-banner > div,
.operations-toolbar > div,
.operations-toolbar > div:last-child {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.operations-banner p,
.operations-toolbar span {
  margin: .18rem 0 0;
  color: var(--muted, #6d675f);
  font-size: .86rem;
}

.operations-banner__icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  background: var(--danger, #c54b40);
  font-weight: 800;
}

.operations-toolbar {
  padding: .9rem 1rem;
  border: 1px solid var(--line, #ded8cf);
  background: var(--surface, #fff);
}

.operations-toolbar > div:first-child {
  align-items: flex-start;
  flex-direction: column;
  gap: 0;
}

.infrastructure-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.infrastructure-card {
  min-width: 0;
  padding: .9rem 1rem;
  border: 1px solid var(--line, #ded8cf);
  border-radius: 16px;
  background: var(--surface, #fff);
}

.infrastructure-card span,
.infrastructure-card small {
  display: block;
  overflow: hidden;
  color: var(--muted, #6d675f);
  font-size: .76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.infrastructure-card strong {
  display: block;
  margin: .28rem 0;
  font-size: 1.05rem;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 1rem;
  margin: 1rem 0;
}

.operations-panel {
  margin-bottom: 1rem;
}

.operations-list,
.audit-list {
  display: grid;
  max-height: 28rem;
  gap: .55rem;
  overflow: auto;
  padding-right: .2rem;
}

.operation-item,
.audit-item {
  padding: .8rem .9rem;
  border: 1px solid var(--line, #ded8cf);
  border-left-width: 4px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface, #fff) 92%, var(--background, #f5f2ec));
}

.operation-item--error { border-left-color: var(--danger, #c54b40); }
.operation-item--warning { border-left-color: #d18a22; }
.operation-item--info { border-left-color: var(--accent, #3f745b); }
.operation-item.is-read { opacity: .68; }

.operation-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .7rem;
}

.operation-item p,
.audit-item p {
  margin: .22rem 0;
  color: var(--text, #29251f);
  font-size: .86rem;
}

.operation-item small,
.audit-item small {
  color: var(--muted, #6d675f);
  font-size: .75rem;
}

.audit-item {
  border-left-color: var(--accent, #3f745b);
}

.audit-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.model-journal-filters,
.model-journal-item__badges {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.model-journal-list {
  display: grid;
  max-height: 42rem;
  gap: .7rem;
  overflow: auto;
  padding-right: .2rem;
}

.token-usage-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .65rem;
  margin-bottom: 1rem;
}

.token-usage-grid > .content-skeleton {
  grid-column: 1 / -1;
}

.token-usage-card {
  display: grid;
  min-width: 0;
  gap: .2rem;
  padding: .78rem .82rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
}

.token-usage-card.is-emphasis {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 75%),
    var(--surface-2);
}

.token-usage-card span,
.token-usage-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-usage-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-journal-item {
  display: grid;
  gap: .55rem;
  padding: .9rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent, #3f745b);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-2) 88%, var(--surface));
  box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
}

.model-journal-item--success { border-left-color: var(--green); }
.model-journal-item--cancelled { border-left-color: var(--amber); }
.model-journal-item--error { border-left-color: var(--red); }

.model-journal-item__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .8rem;
}

.model-journal-item__heading > div:first-child {
  display: grid;
  gap: .2rem;
}

.model-journal-item p {
  margin: 0;
  color: var(--text, #29251f);
  font-size: .82rem;
}

.model-journal-item small {
  color: var(--muted, #6d675f);
  font-size: .75rem;
}

.model-journal-token-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .45rem;
}

.model-journal-token-grid > div {
  display: grid;
  min-width: 0;
  gap: .08rem;
  padding: .48rem .58rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-3) 72%, transparent);
}

.model-journal-token-grid span {
  color: var(--muted);
  font-size: .68rem;
}

.model-journal-token-grid strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-journal-char-summary {
  padding-left: .1rem;
}

.model-journal-reveal {
  width: max-content;
}

.model-journal-details {
  display: grid;
  gap: .75rem;
  min-width: 0;
  padding-top: .2rem;
}

.model-journal-content {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}

.model-journal-content > div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .7rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-3);
  font-size: .76rem;
}

.model-journal-content > div > div {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.model-journal-content > div span {
  color: var(--muted);
}

.model-journal-copy {
  min-height: 28px;
  padding: .2rem .45rem;
  color: var(--text-soft);
  font-size: .7rem;
}

.model-journal-content pre {
  max-height: 26rem;
  margin: 0;
  overflow: auto;
  padding: .8rem;
  scrollbar-color: var(--border-strong) transparent;
  color: var(--text-soft);
  background: color-mix(in srgb, var(--bg) 74%, var(--surface-2));
  font: .76rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .token-usage-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .token-usage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .model-journal-item__heading,
  .model-journal-content > div {
    align-items: stretch;
    flex-direction: column;
  }

  .model-journal-content > div > div {
    justify-content: space-between;
  }
}

.compact-metrics-table td,
.compact-metrics-table th {
  padding: .7rem .65rem;
  white-space: nowrap;
}

.runtime-job__side .row-action {
  font-size: .75rem;
}

.message__feedback {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .65rem;
  color: var(--muted, #6d675f);
  font-size: .76rem;
}

.message__feedback button {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--line, #ded8cf);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  filter: grayscale(1);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.message__feedback button:hover,
.message__feedback button:focus-visible,
.message__feedback button.is-active {
  border-color: var(--accent, #3f745b);
  background: color-mix(in srgb, var(--accent, #3f745b) 10%, transparent);
  filter: none;
  transform: translateY(-1px);
}

@media (max-width: 1050px) {
  .infrastructure-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .operations-grid,
  .infrastructure-grid {
    grid-template-columns: 1fr;
  }

  .operations-banner,
  .operations-toolbar,
  .operations-toolbar > div:last-child {
    align-items: stretch;
    flex-direction: column;
  }

  .operations-toolbar .button {
    width: 100%;
  }
}

/* Desktop agent download */
.page-download {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0, rgba(124, 108, 242, .18), transparent 32rem),
    radial-gradient(circle at 90% 24%, rgba(82, 211, 198, .1), transparent 26rem),
    var(--bg);
}

.download-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
}

.download-header nav,
.download-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.download-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 90px;
}

.download-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  align-items: center;
  gap: clamp(42px, 7vw, 92px);
  min-height: 560px;
}

.download-hero h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: .98;
  letter-spacing: -.055em;
}

.download-lead {
  max-width: 680px;
  margin-bottom: 30px;
  color: var(--text-soft);
  font-size: clamp(17px, 2vw, 20px);
}

.download-actions .button {
  min-height: 48px;
}

.download-requirements {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.download-preview {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: rgba(17, 21, 31, .84);
  box-shadow: 0 36px 110px rgba(0, 0, 0, .45);
  backdrop-filter: blur(22px);
  transform: perspective(1100px) rotateY(-4deg) rotateX(2deg);
}

.download-preview__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.download-preview__bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
}

.download-preview__bar i:first-child { background: var(--red); }
.download-preview__bar i:nth-child(2) { background: var(--amber); }
.download-preview__bar i:nth-child(3) { background: var(--green); }
.download-preview__bar span { margin-left: auto; }

.download-preview__body {
  display: grid;
  gap: 13px;
  padding: 30px;
}

.download-preview__body p {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, .025);
}

.download-step {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-3);
  font-weight: 800;
}

.download-step.is-complete {
  color: var(--green);
  background: var(--green-soft);
}

.download-step.is-active {
  color: var(--accent-2);
  background: rgba(82, 211, 198, .13);
}

.download-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 38px 0 84px;
}

.download-features article {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(17, 21, 31, .72);
}

.download-features article > span {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 13px;
  color: var(--accent-2);
  background: rgba(82, 211, 198, .1);
  font-weight: 900;
}

.download-features h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

.download-features p,
.download-notice p,
.download-notice li {
  color: var(--muted);
}

.download-notice {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 38px;
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid var(--border);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(124, 108, 242, .09), transparent 52%),
    var(--surface);
}

.download-notice h2 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.08;
}

.download-notice ol {
  display: grid;
  gap: 9px;
  padding-left: 22px;
}

.download-notice aside {
  align-self: center;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(8, 10, 16, .5);
}

.download-notice aside p {
  margin: 8px 0 0;
  font-size: 13px;
}

@media (max-width: 860px) {
  .download-hero,
  .download-notice {
    grid-template-columns: 1fr;
  }

  .download-hero {
    min-height: 0;
    padding-top: 30px;
  }

  .download-preview {
    transform: none;
  }

  .download-features {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .download-header {
    align-items: flex-start;
  }

  .download-header nav {
    display: none;
  }

  .download-main {
    padding-top: 28px;
  }

  .download-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .download-actions .button {
    width: 100%;
  }
}

/* Primary-admin API key management */
.security-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(217, 168, 95, 0.28);
  border-radius: 15px;
  color: var(--muted);
  background: rgba(217, 168, 95, 0.075);
}

.security-notice > span,
.secret-warning > span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 9px;
  color: #f0c781;
  background: var(--amber-soft);
  font-weight: 800;
}

.security-notice strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text-soft);
  font-size: 12px;
}

.security-notice p {
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
}

.api-keys-table {
  min-width: 1260px;
}

.api-key-identity,
.api-key-owner,
.api-key-date {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.api-key-identity {
  min-width: 170px;
  max-width: 245px;
}

.api-key-identity strong,
.api-key-owner strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-identity code {
  width: fit-content;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 6px;
  color: #e7af90;
  background: var(--accent-soft);
  font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}

.api-key-identity small,
.api-key-owner small,
.api-key-date small,
.api-key-cell-note {
  display: block;
  max-width: 220px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-owner {
  min-width: 160px;
}

.api-key-owner .resource-badge {
  width: fit-content;
  margin-top: 3px;
}

.api-key-scope-list {
  display: flex;
  min-width: 160px;
  max-width: 230px;
  flex-wrap: wrap;
  gap: 4px;
}

.api-key-scope-list code,
.api-key-scope-list > span:not(.muted-copy) {
  max-width: 180px;
  padding: 3px 6px;
  overflow: hidden;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  font: 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-date {
  min-width: 116px;
  font-size: 10px;
}

.api-key-cell-note {
  max-width: 155px;
  margin-top: 5px;
}

.api-key-actions {
  min-width: 102px;
  flex-direction: column;
  align-items: stretch;
}

.api-key-actions .row-action {
  width: 100%;
  white-space: nowrap;
}

.api-key-enabled {
  min-height: 68px;
  align-items: flex-start;
  align-self: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 248, 238, 0.02);
}

.api-key-enabled > span,
.api-key-enabled strong,
.api-key-enabled small {
  display: block;
}

.api-key-enabled strong {
  margin-bottom: 3px;
  color: var(--text-soft);
  font-size: 11px;
}

.api-key-enabled small,
.option-group__hint {
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.45;
}

.option-group__hint {
  margin: 0 0 12px;
}

.permission-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.68;
}

.secret-warning {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(217, 168, 95, 0.3);
  border-radius: 14px;
  background: rgba(217, 168, 95, 0.075);
}

.secret-warning p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.secret-warning strong {
  color: var(--text-soft);
}

.secret-value__control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.secret-value__control input {
  min-width: 0;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.secret-copy-status {
  min-height: 18px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.secret-dialog .modal__footer {
  justify-content: flex-end;
}

.runtime-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.live-indicator i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(69, 208, 155, 0.45);
}

.live-indicator.is-paused i {
  background: var(--muted-2);
  box-shadow: none;
}

.runtime-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.runtime-summary-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(129, 105, 255, 0.09), transparent 45%),
    rgba(255, 255, 255, 0.015);
}

.runtime-summary-card small,
.runtime-summary-card strong,
.runtime-summary-card span {
  display: block;
}

.runtime-summary-card small {
  color: var(--muted);
  font-size: 10px;
}

.runtime-summary-card strong {
  margin: 6px 0 3px;
  font-size: 24px;
}

.runtime-summary-card span {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-jobs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.runtime-panel {
  min-height: 245px;
}

.runtime-job-list {
  max-height: 360px;
  overflow: auto;
}

.runtime-job {
  display: flex;
  min-height: 67px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
}

.runtime-job:last-child {
  border-bottom: 0;
}

.runtime-job > div:first-child {
  min-width: 0;
}

.runtime-job strong,
.runtime-job span {
  display: block;
}

.runtime-job strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-job span {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 9px;
}

.runtime-job__side {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.runtime-job__side code,
.runtime-events-table code {
  color: var(--muted);
  font: 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.runtime-list-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 20px;
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
}

.runtime-events-panel {
  margin-bottom: 18px;
}

.runtime-level-filter select {
  min-width: 155px;
}

.runtime-events-table {
  min-width: 860px;
}

.runtime-events-table td {
  vertical-align: middle;
  font-size: 10px;
}

.runtime-events-table td:nth-child(1) {
  min-width: 132px;
  color: var(--muted);
}

.runtime-events-table td:nth-child(3) {
  min-width: 180px;
}

.runtime-events-table td:nth-child(4) {
  min-width: 280px;
  color: var(--muted);
}

.runtime-events-table strong,
.runtime-events-table small {
  display: block;
}

.runtime-events-table strong {
  color: var(--text-soft);
  font-size: 10px;
}

.runtime-events-table small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
}

.runtime-privacy-note {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 15px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.runtime-privacy-note > span {
  color: var(--green);
}

.runtime-privacy-note p {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .security-notice,
  .secret-warning {
    padding: 12px;
  }

  .secret-value__control {
    grid-template-columns: 1fr;
  }

  .secret-value__control .button,
  .secret-dialog .modal__footer .button {
    width: 100%;
  }

  .runtime-heading-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .runtime-heading-actions .button {
    width: 100%;
  }

  .runtime-summary-grid,
  .runtime-jobs-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 1000px) {
  .runtime-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Safe rich chat content, reasoning, and per-message actions */
.message__actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.message__actions .icon-button {
  width: auto;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  opacity: 0;
  font-size: 10px;
}

.message:hover .message__actions .icon-button,
.message:focus-within .message__actions .icon-button {
  opacity: 1;
}

.message__actions .message__delete:hover,
.message__actions .message__delete:focus-visible {
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
  color: var(--red);
  background: var(--red-soft);
}

.message__actions .message__edit:hover,
.message__actions .message__edit:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  color: var(--accent-2);
  background: var(--accent-soft);
}

.message__editor {
  display: grid;
  gap: 8px;
  max-width: 760px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.message__editor-input {
  width: 100%;
  min-height: 116px;
  max-height: min(48vh, 420px);
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  line-height: 1.6;
}

.message__editor-input:focus {
  border-color: color-mix(in srgb, var(--accent) 58%, transparent);
  outline: 3px solid color-mix(in srgb, var(--accent) 13%, transparent);
}

.message__editor small {
  color: var(--muted);
  font-size: 9px;
}

.message__editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.message__editor-actions .button {
  width: auto;
  min-height: 32px;
  padding: 6px 11px;
}

.message__reasoning {
  margin: 8px 0 13px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: 13px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    color-mix(in srgb, var(--surface) 72%, transparent);
}

.message__reasoning summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.message__reasoning summary::-webkit-details-marker {
  display: none;
}

.message__reasoning summary::after {
  content: "⌄";
  margin-left: 2px;
  color: var(--muted-2);
  font-size: 14px;
  transition: transform 160ms ease;
}

.message__reasoning[open] summary::after {
  transform: rotate(180deg);
}

.message__reasoning-title {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.message__reasoning-title > span {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  place-items: center;
  border-radius: 7px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
}

.message__reasoning-title strong {
  color: var(--text-soft);
  font-size: 11px;
}

.message__reasoning-title small {
  color: var(--muted-2);
  font-size: 9px;
}

.message__reasoning-copy {
  width: auto;
  height: 26px;
  margin-left: auto;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}

.message__reasoning-copy:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.message__reasoning-content {
  max-height: min(46vh, 430px);
  padding: 12px 14px 14px;
  overflow: auto;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.message__reasoning-content p:last-child {
  margin-bottom: 0;
}

.message__reasoning-cursor {
  height: 13px;
  background: var(--accent);
}

.message__content h1,
.message__content h2,
.message__content h3,
.message__content h4,
.message__content h5,
.message__content h6,
.message__reasoning-content h1,
.message__reasoning-content h2,
.message__reasoning-content h3 {
  margin: 1.15em 0 .5em;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -.015em;
}

.message__content h1 { font-size: 1.45em; }
.message__content h2 { font-size: 1.3em; }
.message__content h3 { font-size: 1.16em; }
.message__content h4,
.message__content h5,
.message__content h6 { font-size: 1.04em; }

.message__content blockquote,
.message__reasoning-content blockquote {
  margin: 13px 0;
  padding: 9px 13px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 0 9px 9px 0;
  color: var(--muted);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.message__content hr,
.message__reasoning-content hr {
  height: 1px;
  margin: 18px 0;
  border: 0;
  background: var(--border);
}

.message__content strong,
.message__reasoning-content strong {
  color: var(--text);
}

.message__content del,
.message__reasoning-content del {
  color: var(--muted);
}

.message__content li,
.message__reasoning-content li {
  margin: 4px 0;
  padding-left: 2px;
}

.markdown-task {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  list-style: none;
}

.markdown-task input {
  margin: .35em 0 0;
  accent-color: var(--accent);
}

.markdown-table-wrap {
  max-width: 100%;
  margin: 14px 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.markdown-table-wrap:focus-visible {
  box-shadow: var(--focus);
}

.markdown-table-wrap table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: .92em;
}

.markdown-table-wrap th,
.markdown-table-wrap td {
  padding: 9px 11px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.markdown-table-wrap th:last-child,
.markdown-table-wrap td:last-child {
  border-right: 0;
}

.markdown-table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.markdown-table-wrap th {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  font-size: .86em;
  font-weight: 720;
}

.markdown-table-wrap tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 52%, transparent);
}

.markdown-align--center { text-align: center; }
.markdown-align--right { text-align: right; }

.message__content pre.code-block,
.message__reasoning-content pre.code-block {
  box-shadow: 0 12px 30px color-mix(in srgb, #000 20%, transparent);
}

.code-header {
  position: sticky;
  left: 0;
  letter-spacing: .04em;
}

.code-header button {
  min-height: 25px;
  padding: 0 8px;
  border-radius: 7px;
}

.code-header button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.message__content a,
.message__reasoning-content a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.message__content a:hover,
.message__reasoning-content a:hover {
  color: var(--accent-2);
}

.toast .toast__action {
  width: auto;
  height: auto;
  min-height: 28px;
  margin-top: 7px;
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 700;
}

@media (hover: none) {
  .message__actions .icon-button {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .message__actions .icon-button {
    min-width: 27px;
    padding: 0 6px;
    opacity: 1;
    font-size: 0;
  }

  .message__actions .message__copy::before {
    content: "⧉";
    font-size: 13px;
  }

  .message__actions .message__delete::before {
    content: "×";
    font-size: 17px;
  }

  .message__actions .message__edit::before {
    content: "✎";
    font-size: 14px;
  }

  .message__editor-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .message__editor-actions .button {
    width: 100%;
  }

  .message__reasoning summary {
    padding: 8px 9px;
  }

  .message__reasoning-title small,
  .message__reasoning-copy {
    display: none;
  }

  .markdown-table-wrap {
    margin-right: -8px;
  }
}

/* Windows client discovery and verified release metadata */
.auth-download-card,
.profile-download-card {
  display: grid;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  color: var(--text-soft);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent 72%),
    color-mix(in srgb, var(--surface-2) 72%, transparent);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.auth-download-card:hover,
.profile-download-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 72%),
    var(--surface-2);
}

.auth-download-card {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  margin-top: 20px;
  padding: 12px;
  border-radius: 14px;
}

.auth-download-card__icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 16px;
  font-weight: 800;
}

.auth-download-card strong,
.auth-download-card small,
.profile-download-card strong,
.profile-download-card small {
  display: block;
}

.auth-download-card strong {
  margin-bottom: 2px;
  font-size: 11px;
}

.auth-download-card small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.auth-download-card__action {
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
}

.profile-download-card {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 13px;
}

.profile-download-card > span:first-child {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
}

.profile-download-card strong {
  margin-bottom: 2px;
  font-size: 11px;
}

.profile-download-card small {
  color: var(--muted);
  font-size: 9px;
}

.profile-download-card b {
  color: var(--accent);
  font-size: 14px;
}

.download-release {
  display: grid;
  max-width: 660px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--border);
}

.download-release > div {
  min-width: 0;
  padding: 11px 13px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
}

.download-release small,
.download-release strong {
  display: block;
}

.download-release small {
  margin-bottom: 3px;
  color: var(--muted-2);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.download-release strong {
  overflow: hidden;
  color: var(--text-soft);
  font: 650 11px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-release > p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 9px 13px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  font-size: 10px;
}

.download-release.is-available {
  border-color: color-mix(in srgb, var(--green) 30%, var(--border));
}

.download-release.is-unavailable {
  border-color: color-mix(in srgb, var(--amber) 34%, var(--border));
}

.download-actions .button.is-disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: .5;
  filter: saturate(.45);
}

@media (max-width: 560px) {
  .auth-download-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .auth-download-card__action {
    grid-column: 2;
  }

  .download-release {
    grid-template-columns: 1fr;
  }

  .download-release > p {
    grid-column: 1;
  }
}
