@font-face {
  font-family: "ARORA_IRAN_SANS";
  src: local("IRANSans"), local("IRANSansWeb"), local("IranSans"),
    url("../fonts/fa/iran_sans/IRANSansWeb.woff") format("woff"),
    url("../fonts/fa/iran_sans/IRANSansWeb.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "ARORA_IRAN_SANS";
  src: local("IRANSans Medium"), local("IRANSansWeb Medium"), local("IranSans Medium"),
    url("../fonts/fa/iran_sans/IRANSansWeb_Mediumt.woff") format("woff"),
    url("../fonts/fa/iran_sans/IRANSansWeb_Medium.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 500;
}

@font-face {
  font-family: "ARORA_IRAN_SANS";
  src: local("IRANSans Bold"), local("IRANSansWeb Bold"), local("IranSans Bold"),
    url("../fonts/fa/iran_sans/IRANSansWeb_Bold.woff") format("woff"),
    url("../fonts/fa/iran_sans/IRANSansWeb_Bold.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

:root {
  --background: #07090d;
  --foreground: #e5e7eb;
  --muted: #9ca3af;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-3: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #f1dec0;
  --danger: #f87171;
  --shadow: 0 36px 90px rgba(0, 0, 0, 0.35);
  --composer-safe-space: 240px;
  --page-bg:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.06), transparent 22%),
    radial-gradient(circle at 82% 0%, rgba(241, 222, 192, 0.12), transparent 20%),
    linear-gradient(180deg, #040507 0%, #07090d 100%);
}

html[data-theme="light"] {
  --background: #f7f7f8;
  --foreground: #111827;
  --muted: #4b5563;
  --surface: rgba(0, 0, 0, 0.04);
  --surface-2: rgba(0, 0, 0, 0.07);
  --surface-3: rgba(0, 0, 0, 0.1);
  --border: rgba(17, 24, 39, 0.12);
  --accent: #111827;
  --danger: #dc2626;
  --shadow: 0 28px 70px rgba(17, 24, 39, 0.16);
  --page-bg:
    radial-gradient(circle at 20% 10%, rgba(17, 24, 39, 0.05), transparent 22%),
    radial-gradient(circle at 82% 0%, rgba(17, 24, 39, 0.04), transparent 20%),
    linear-gradient(180deg, #f6f6f7 0%, #eceef1 100%);
}

html[data-theme="sepia"] {
  --background: #f4ecd8;
  --foreground: #2b2418;
  --muted: #5f523d;
  --surface: rgba(43, 36, 24, 0.06);
  --surface-2: rgba(43, 36, 24, 0.1);
  --surface-3: rgba(43, 36, 24, 0.14);
  --border: rgba(43, 36, 24, 0.16);
  --accent: #2b2418;
  --danger: #b91c1c;
  --shadow: 0 30px 72px rgba(43, 36, 24, 0.16);
  --page-bg:
    radial-gradient(circle at 20% 10%, rgba(43, 36, 24, 0.06), transparent 22%),
    radial-gradient(circle at 82% 0%, rgba(142, 110, 55, 0.1), transparent 20%),
    linear-gradient(180deg, #f6efdf 0%, #efe3cb 100%);
}

* {
  box-sizing: border-box;
}

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

html {
  font-family: "ARORA_IRAN_SANS", Arial, sans-serif;
  direction: rtl;
}

body {
  overflow: hidden;
  background: var(--page-bg);
  color: var(--foreground);
  font-family: inherit;
  direction: rtl;
  text-align: right;
}

body.is-restoring-state .conversation-panel {
  opacity: 0.94;
}

body.is-restoring-state .conversation-inner::before {
  content: "در حال بازیابی گفتگوهای ذخیره شده...";
  display: block;
  margin: 12px auto 24px;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

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

*,
*::before,
*::after {
  font-family: inherit;
}

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

button,
input,
select,
textarea {
  border: 0;
  outline: none;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.viewport-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.app-frame {
  width: min(1440px, calc(100vw - 48px));
  height: min(920px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 26px;
  overflow: hidden;
  background: var(--background);
  box-shadow: var(--shadow);
  direction: rtl;
  isolation: isolate;
}

.app-frame.frame-menu {
  display: flex;
  flex-direction: column;
}

.app-frame.frame-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar-panel {
  position: relative;
  z-index: 60;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--background) 92%, transparent);
  border-left: 1px solid var(--border);
  transition: transform 0.28s ease, opacity 0.28s ease;
  direction: rtl;
}

.frame-collapsed .sidebar-panel {
  opacity: 0;
  pointer-events: none;
}

.sidebar-inner {
  margin-top: -7px;
  padding: 22px 16px 18px;
  display: flex;
  flex: 1;
  height: 100%;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.sidebar-utility-box {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 74%, transparent);
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 10px;
  direction: ltr;
}

.sidebar-utility-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--foreground);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  flex: 0 0 auto;
}

.sidebar-utility-link:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.sidebar-utility-icon {
  flex: 0 0 auto;
}

.sidebar-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  direction: ltr;
  flex: 0 1 auto;
  white-space: nowrap;
}

.primary-action,
.secondary-action,
.menu-card-link,
.dropdown-item,
.theme-toggle button,
.icon-button {
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.primary-action,
.secondary-action,
.menu-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
}

.primary-action {
  background: var(--surface-2);
  color: var(--foreground);
}

.primary-action:hover,
.secondary-action:hover,
.menu-card-link:hover,
.icon-button:hover,
.theme-toggle button:hover,
.dropdown-item:hover,
.message-tools button:hover,
.composer-tools button:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  background: var(--surface-3);
}

.primary-action[data-blocked="true"] {
  border: 1px dashed var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--muted);
}

.secondary-action,
.menu-card-link {
  border: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.sidebar-secondary-action {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12px;
}

.sidebar-section-label {
  margin: 18px 0 10px;
  padding: 0 4px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.conversation-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  height: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.conversation-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
}

.conversation-card.is-active {
  border-color: var(--border);
  background: var(--surface);
}

.conversation-trigger {
  flex: 1;
  min-width: 0;
  background: transparent;
  color: inherit;
  text-align: right;
}

.conversation-title,
.conversation-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-title {
  font-size: 14px;
  font-weight: 500;
}

.conversation-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.conversation-menu {
  position: relative;
  z-index: 1;
}

.conversation-menu.is-open {
  z-index: 140;
}

.conversation-menu-button,
.icon-button,
.composer-tools button,
.message-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.conversation-dropdown {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 140;
  min-width: 180px;
  max-width: min(220px, calc(100vw - 24px));
  max-height: min(220px, calc(100vh - 24px));
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  overflow-x: hidden;
}

.dropdown-item {
  display: flex;
  width: 100%;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--foreground);
  text-align: right;
}

.dropdown-item.is-danger {
  color: var(--danger);
}

.sidebar-footer {
  margin-top: 16px;
  padding: 14px 6px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
}

.chat-panel,
.menu-panel {
  position: relative;
  display: flex;
  flex: 1;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  direction: rtl;
}

.shell-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 18px 22px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent);
  direction: rtl;
}

.brand-link,
.topbar-left,
.topbar-actions,
.theme-toggle,
.composer-selects,
.composer-tools,
.menu-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 38px;
  height: 38px;
}

.brand-wordmark {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
}

.shell-topbar-ghost {
  pointer-events: none;
}

.sidebar-recall-toggle {
  position: absolute;
  top: 18px;
  right: 22px;
  z-index: 32;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.sidebar-recall-toggle.hidden {
  display: none;
}

.topbar-status {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

.theme-toggle {
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface) 88%, transparent),
    color-mix(in srgb, var(--surface-2) 92%, transparent)
  );
}

.theme-toggle button {
  min-width: 58px;
  height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

.theme-toggle button.is-active {
  background: linear-gradient(180deg, var(--surface-2), var(--surface-3));
  color: var(--foreground);
}

.theme-toggle-sidebar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.theme-toggle-sidebar button {
  min-width: 0;
}

.status-banner {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: min(720px, calc(100% - 40px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--background) 92%, transparent);
  white-space: pre-wrap;
  text-align: right;
  display: none;
}

.status-banner.hidden,
.mobile-overlay.hidden,
.conversation-dropdown.hidden {
  display: none;
}

.chat-content,
.menu-shell {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  padding-top: 72px;
}

.chat-content {
  flex-direction: column;
  height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.conversation-panel {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.conversation-scroll {
  height: auto;
  overflow: visible;
}

.conversation-inner {
  width: min(100%, 920px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
 /* padding: 42px 28px var(--composer-safe-space); */
}

.chat-page.is-empty .conversation-inner {
  padding-top: 160px;
  opacity: 0.18;
}

.chat-page.is-empty .chat-content {
  justify-content: center;
  overflow: hidden;
}

.chat-page.is-empty .conversation-panel {
  display: none;
}

.empty-hint {
  margin: 0 auto;
  max-width: 540px;
  text-align: center;
  color: var(--muted);
  line-height: 1.8;
  direction: rtl;
}

.message-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-group.is-user,
.message-group.is-assistant {
  align-items: flex-start;
}

.message-label {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}

.message-bubble {
  max-width: min(92%, 780px);
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.95;
  text-align: right;
  direction: rtl;
}

.message-group.is-user .message-bubble {
  background: var(--surface-2);
}

.message-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  justify-content: flex-start;
  align-self: flex-start;
}

.message-tools button {
  width: auto;
  padding: 0;
  background: transparent;
  color: inherit;
}

.message-tools button.is-danger:hover {
  color: var(--danger);
}

.message-runtime {
  max-width: min(92%, 780px);
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}

.message-runtime-disclosure {
  max-width: min(92%, 780px);
}

.message-runtime-disclosure summary {
  list-style: none;
}

.message-runtime-disclosure summary::-webkit-details-marker {
  display: none;
}

.message-runtime-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 1px;
  user-select: none;
}

.message-runtime-toggle:hover {
  color: var(--text);
}

.message-runtime-disclosure[open] .message-runtime-toggle {
  color: var(--text);
}

.message-runtime-disclosure .message-runtime {
  margin-top: 4px;
}

.message-runtime.is-warning {
  color: var(--danger);
}

.typing-cursor {
  display: inline-block;
  margin-left: 4px;
  animation: blink 1s step-end infinite;
}

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

.composer-layer {
  position: sticky;
  bottom: 0;
  z-index: 18;
  flex: 0 0 auto;
  padding: 22px 24px 26px;
  margin-top: auto;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--background) 78%, transparent) 22%, var(--background) 100%);
}

.chat-page.is-empty .composer-layer {
  position: relative;
  bottom: auto;
  flex: 0 0 auto;
  inset: auto;
  display: grid;
  place-items: center;
  margin-top: 0;
  padding-top: 0;
  background: transparent;
}

.composer-anchor {
  width: min(100%, 920px);
  margin: 0 auto;
}

.composer-center-brand {
  display: none;
  margin-bottom: 28px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  direction: rtl;
}

.chat-page.is-empty .composer-center-brand {
  display: flex;
}

.center-logo {
  width: min(420px, 90%);
}

.center-tagline {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--muted);
  line-height: 1.9;
}

.composer-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: color-mix(in srgb, var(--background) 96%, transparent);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 18px 20px 16px;
  direction: rtl;
}

.composer-input {
  min-height: 56px;
  max-height: 240px;
  width: 100%;
  resize: none;
  background: transparent;
  color: var(--foreground);
  line-height: 1.7;
  text-align: right;
  direction: rtl;
}

.composer-input::placeholder {
  color: var(--muted);
}

.circle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--foreground);
}

.circle-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  direction: rtl;
}

.composer-selects select {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--foreground);
  text-align: right;
}

.composer-caption {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
}

.composer-tools button.is-active {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-2) 92%, transparent),
    color-mix(in srgb, var(--surface-3) 96%, transparent)
  );
  color: var(--foreground);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mobile-overlay {
  position: absolute;
  inset: 72px 0 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.35);
}

.menu-content {
  width: min(100%, 1040px);
  margin: 0 auto;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 22px;
  padding: 28px 24px 32px;
  overflow: auto;
}

.menu-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.menu-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.settings-content {
  width: min(100%, 1120px);
  margin: 0 auto;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 22px;
  padding: 28px 24px 32px;
  overflow: auto;
}

.settings-hero-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 76%, transparent)),
    var(--surface);
}

.settings-hero-card::after {
  content: "";
  position: absolute;
  inset: auto auto -40px -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  filter: blur(24px);
  pointer-events: none;
}

.menu-card h1,
.menu-card h2,
.menu-card h3,
.menu-card p {
  margin: 0;
}

.menu-card h1,
.menu-card h2 {
  margin-bottom: 14px;
}

.menu-card h3 {
  margin-bottom: 10px;
}

.menu-card p,
.runtime-list li {
  color: var(--muted);
  line-height: 1.7;
  text-align: right;
}

.menu-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.menu-grid > .menu-card {
  flex: 1 1 280px;
}

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

.diagnostics-card {
  gap: 14px;
}

.diagnostics-card-wide {
  grid-column: 1 / -1;
}

.diagnostics-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.diagnostics-actions {
  flex-wrap: wrap;
}

.diagnostics-actions select {
  min-height: 42px;
  min-width: min(100%, 320px);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--foreground);
  text-align: right;
}

.diagnostics-status {
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  line-height: 1.8;
}

.diagnostics-status.is-warning {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  color: var(--danger);
}

.diagnostics-list {
  display: grid;
  gap: 10px;
}

.diagnostics-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
}

.diagnostics-row strong {
  font-size: 13px;
}

.diagnostics-row span,
.diagnostics-row code {
  color: var(--muted);
  line-height: 1.8;
  text-align: left;
  direction: ltr;
}

.diagnostics-row .is-warning {
  color: var(--danger);
}

.diagnostics-block {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--foreground);
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  unicode-bidi: plaintext;
  line-height: 1.8;
  direction: rtl;
  text-align: right;
}

.runtime-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.runtime-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.settings-form,
.settings-fields,
.settings-toggles {
  display: flex;
  flex-direction: column;
}

.settings-form {
  gap: 18px;
}

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

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-section-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-kicker {
  display: inline-flex;
  align-self: flex-start;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.settings-fields,
.settings-toggles {
  gap: 14px;
}

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

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-flag {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-field span,
.settings-check span {
  font-weight: 500;
}

.settings-field input,
.settings-field select {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--foreground);
  text-align: right;
}

.settings-field input[type="range"] {
  min-height: auto;
  padding: 0;
  accent-color: var(--accent);
}

.settings-field input:focus,
.settings-field select:focus {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.settings-field small,
.settings-note {
  color: var(--muted);
  line-height: 1.8;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
}

.settings-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.settings-check-prominent {
  justify-content: space-between;
}

.settings-highlight-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.settings-highlight {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.settings-highlight strong {
  font-size: 13px;
}

.settings-highlight span {
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
}

.settings-callout {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.settings-callout strong {
  font-size: 13px;
}

.settings-callout span {
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
}

.settings-actions {
  flex-wrap: wrap;
}

.settings-summary {
  flex-wrap: wrap;
}

.settings-actions-card p {
  margin-bottom: 0;
}

.settings-status {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--foreground);
  line-height: 1.8;
}

.settings-status.is-error {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  color: var(--danger);
}

.settings-status.hidden {
  display: none;
}

@media (max-width: 1120px) {
  .app-frame {
    width: min(100vw - 24px, 100%);
    height: min(100vh - 24px, 100%);
  }

  .menu-hero {
    grid-template-columns: 1fr;
  }

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

  .settings-inline-grid,
  .settings-highlight-list {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 980px) {
  .viewport-shell {
    padding: 0;
  }

  .app-frame {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar-panel {
    position: absolute;
    inset: 72px 0 0 auto;
    width: min(320px, 86vw);
    transform: translateX(100%);
    opacity: 0;
    z-index: 35;
  }

  .app-frame.sidebar-open .sidebar-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 720px) {
  .shell-topbar {
    flex-wrap: wrap;
    min-height: 86px;
    padding: 14px 14px 10px;
  }

  .chat-content,
  .menu-shell {
    padding-top: 92px;
  }

  .sidebar-recall-toggle {
    top: 14px;
    right: 14px;
  }

  .conversation-inner {
    padding: 30px 16px var(--composer-safe-space);
  }

  .composer-layer {
    padding: 16px;
  }

  .composer-row,
  .composer-toolbar,
  .composer-selects,
  .composer-tools,
  .topbar-actions,
  .topbar-left,
  .runtime-list {
    flex-wrap: wrap;
  }

  .theme-toggle {
    width: 100%;
    justify-content: stretch;
  }

  .theme-toggle button {
    flex: 1;
    min-width: 58px;
  }
}
