@font-face {
  font-family: "Ubuntu";
  src: url("./assets/font/Ubuntu-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Ubuntu";
  src: url("./assets/font/Ubuntu-Medium.ttf") format("truetype");
  font-weight: 500;
}

@font-face {
  font-family: "Ubuntu";
  src: url("./assets/font/Ubuntu-Bold.ttf") format("truetype");
  font-weight: 700;
}

:root {
  /* DS UDD foundations */
  --primary-0: #f1f6f8;
  --primary-50: #c3ebff;
  --primary-100: #88d7ff;
  --primary-200: #4cc4ff;
  --primary-300: #11b0ff;
  --primary-400: #008ed4;
  --primary-500: #006699;
  --primary-600: #004d73;
  --primary-700: #00334d;
  --primary-800: #001a26;
  --secondary-50: #ccfff2;
  --secondary-100: #99ffe6;
  --secondary-200: #66ffd9;
  --secondary-300: #33ffcc;
  --secondary-400: #00ffbf;
  --secondary-500: #00cc99;
  --secondary-600: #009973;
  --secondary-700: #00664d;
  --secondary-800: #003326;
  --accent-50: #ffe6d5;
  --accent-100: #ffccaa;
  --accent-200: #ffb380;
  --accent-300: #ff9955;
  --accent-400: #ff802b;
  --accent-500: #ff6600;
  --accent-600: #bf4d00;
  --accent-700: #803300;
  --accent-800: #401a00;
  --notification-50: #fff5df;
  --notification-100: #ffecbe;
  --notification-200: #ffe29e;
  --notification-300: #ffd87e;
  --notification-400: #ffcf5d;
  --notification-500: #ffc53d;
  --notification-600: #eda600;
  --notification-700: #9e6f00;
  --notification-800: #4f3700;
  --success-50: #bfffe0;
  --success-100: #7effc1;
  --success-200: #3effa2;
  --success-300: #00fc83;
  --success-400: #00bc62;
  --success-500: #007b40;
  --success-600: #005c30;
  --success-700: #003e20;
  --success-800: #001f10;
  --error-50: #fddfdf;
  --error-100: #fabebf;
  --error-200: #f89e9f;
  --error-300: #f57e7e;
  --error-400: #f25d5e;
  --error-500: #f03d3e;
  --error-600: #d21011;
  --error-700: #8c0b0c;
  --error-800: #460506;
  --danger-50: var(--error-50);
  --danger-700: var(--error-700);
  --gray-0: #ffffff;
  --gray-50: #f7f7f8;
  --gray-100: #eef0f1;
  --gray-200: #e6e8ea;
  --gray-300: #dde0e2;
  --gray-400: #d5d9db;
  --gray-500: #ccd1d4;
  --gray-600: #949ea4;
  --gray-700: #5f6a71;
  --gray-800: #303538;
  --udd-blue: #006699;
  --udd-blue-deep: var(--primary-700);
  --udd-blue-soft: var(--primary-0);
  --login-blue: #006699;
  --udd-orange: #ff6600;
  /* Approved DS UDD loader palette: primary blue + secondary green. */
  --udd-green: #00d095;
  --loader-green: #00d095;
  --bg-surface-primary: var(--gray-50);
  --bg-surface-secondary: var(--gray-100);
  --bg-surface-tertiary: var(--primary-0);
  --bg-surface-disabled: var(--gray-300);
  --bg-surface-invert: var(--gray-800);
  --bg-fill-primary: var(--primary-500);
  --bg-fill-primary-hover: var(--primary-600);
  --bg-fill-secondary: var(--secondary-500);
  --bg-fill-secondary-hover: var(--secondary-600);
  --bg-fill-accent: var(--accent-500);
  --bg-fill-accent-hover: var(--accent-600);
  --text-primary: var(--gray-800);
  --text-secondary: var(--gray-600);
  --text-disabled: var(--gray-500);
  --text-brand: var(--primary-500);
  --text-link: var(--primary-300);
  --text-error: var(--error-600);
  --text-success: var(--success-600);
  --text-warning: var(--notification-600);
  --border-primary: var(--gray-300);
  --border-secondary: var(--gray-200);
  --border-brand: var(--primary-500);
  --border-primary-focus: var(--gray-600);
  --border-accent: var(--accent-500);
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-primary);
  --panel: var(--gray-50);
  --panel-soft: var(--gray-100);
  --canvas: var(--gray-100);
  --sidebar-surface: var(--gray-50);
  --sidebar-control: var(--gray-100);
  --sidebar-control-hover: var(--primary-0);
  --sidebar-control-border: var(--gray-300);
  --sidebar-text-muted: var(--gray-600);
  --focus-ring: 0 0 0 3px rgba(0, 102, 153, 0.16);
  --focus-ring-strong: 0 0 0 3px rgba(0, 102, 153, 0.28);
  --warning-soft: var(--notification-50);
  --success-soft: var(--success-50);
  --radius-control: 4px;
  --radius-small: 4px;
  --radius-nav: 6px;
  --radius-card: 8px;
  --radius-large: 16px;
  --space-1: 4px;
  --space-1-5: 6px;
  --space-2: 8px;
  --space-2-5: 12px;
  --space-3: 16px;
  --space-3-5: 20px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 40px;
  --space-7: 48px;
  --space-8: 56px;
  --shadow-card: 0 1px 3px rgba(48, 53, 56, 0.1), 0 1px 2px -1px rgba(48, 53, 56, 0.1);
  --shadow-card-hover: 0 2px 4px -2px rgba(48, 53, 56, 0.1), 0 4px 6px -1px rgba(48, 53, 56, 0.1);
  --shadow: var(--shadow-card);
  --shadow-raised: 0 16px 36px rgba(48, 53, 56, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, #f7fafc 0%, #edf5f8 58%, #f7f1ec 100%);
  font-family:
    "Ubuntu",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

body:not(.login-active) {
  background: var(--canvas);
}

body[data-theme="dark"]:not(.login-active) {
  --ink: #edf5f8;
  --muted: #a6b4bf;
  --line: #243847;
  --panel: #101a23;
  --panel-soft: #162533;
  --canvas: #0b131b;
  --udd-blue-soft: #123247;
  --sidebar-surface: linear-gradient(180deg, #071521 0%, #0d1b27 55%, #12171f 100%);
  --sidebar-control: rgba(255, 255, 255, 0.07);
  --sidebar-control-hover: rgba(0, 102, 153, 0.26);
  --sidebar-control-border: rgba(87, 169, 209, 0.28);
  --sidebar-text-muted: rgba(238, 247, 251, 0.72);
  --warning-soft: #382515;
  --success-soft: #123126;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
  --shadow-raised: 0 22px 54px rgba(0, 0, 0, 0.34);
  color-scheme: dark;
}

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

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(0, 102, 153, 0.42);
  outline-offset: 2px;
}

textarea:focus-visible {
  outline: 0;
}

[hidden] {
  display: none !important;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 28px;
  background:
    linear-gradient(135deg, var(--login-blue) 0%, var(--login-blue) 48%, #f7f9fb 48%);
}

.loading-screen {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 28px;
  color: #fff;
  background: var(--login-blue);
}

.loading-lockup {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.loading-logo-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: min(280px, 60vw);
  margin-inline: auto;
  aspect-ratio: 1;
}

.loading-logo {
  position: relative;
  z-index: 1;
  width: 88%;
  height: auto;
  object-fit: contain;
}

.loading-ring {
  position: absolute;
  inset: 0;
  border: 2px solid color-mix(in srgb, var(--loader-green) 28%, transparent);
  border-top-color: var(--loader-green);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.88s linear infinite;
}

.loading-lockup p {
  position: relative;
  margin: 0;
  font-weight: 700;
  text-align: center;
}

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

@media (prefers-reduced-motion: reduce) {
  .loading-ring,
  .compact-udd-loader__arc {
    animation: none;
  }
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 440px);
  gap: clamp(14px, 3vw, 36px);
  width: min(1120px, 100%);
  min-height: 560px;
}

.login-brand-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding:
    clamp(26px, 5vw, 60px)
    clamp(18px, 4vw, 56px)
    clamp(26px, 5vw, 60px)
    clamp(14px, 2vw, 28px);
  color: #fff;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.login-brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  width: max-content;
  max-width: 100%;
}

.login-brand-lockup picture {
  display: block;
  align-self: center;
  max-width: 100%;
}

.login-logo {
  display: block;
  align-self: center;
  width: min(268px, 100%);
  height: auto;
  object-fit: contain;
}

.login-brand-panel h1 {
  max-width: 600px;
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.login-form {
  align-self: center;
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 440px;
  padding: clamp(24px, 4vw, 36px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
}

.login-form h2 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.1;
  text-align: center;
}

.login-help {
  margin: -4px 0 4px;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.field-group {
  display: grid;
  gap: 6px;
}

.field-group label {
  font-size: 0.84rem;
  font-weight: 700;
}

.field-group input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.field-group input:focus {
  border-color: var(--udd-blue);
}

.field-group input:focus-visible {
  outline: 0;
  border-color: var(--udd-blue);
  box-shadow: var(--focus-ring);
}

.field-group select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.field-group select:focus-visible {
  outline: 0;
  border-color: var(--udd-blue);
  box-shadow: var(--focus-ring);
}

.login-error {
  margin: 0;
  padding: 10px;
  color: var(--danger-700);
  background: var(--danger-50);
  border: 1px solid rgba(176, 68, 29, 0.22);
  border-radius: var(--radius-control);
  font-size: 0.9rem;
}

.login-button {
  min-height: 48px;
  color: #fff;
  background: var(--primary-500);
  border-radius: var(--radius-control);
  font-weight: 700;
}

.login-button:hover {
  background: var(--primary-600);
}

.terms-link {
  justify-self: center;
  min-height: 34px;
  padding: 4px 6px;
  color: var(--primary-500);
  background: transparent;
  border-radius: var(--radius-control);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.terms-link:hover {
  color: var(--primary-700);
  background: var(--udd-blue-soft);
}

.terms-dialog,
.profile-dialog,
.support-dialog,
.name-dialog,
.move-dialog,
.onboarding-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.terms-dialog {
  width: min(760px, calc(100vw - 32px));
}

.model-dialog {
  width: min(820px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.support-dialog {
  width: min(580px, calc(100vw - 32px));
}

.onboarding-dialog {
  width: min(760px, calc(100vw - 28px));
}

.terms-dialog::backdrop,
.model-dialog::backdrop,
.profile-dialog::backdrop,
.support-dialog::backdrop,
.name-dialog::backdrop,
.move-dialog::backdrop,
.onboarding-dialog::backdrop {
  background: rgba(10, 29, 41, 0.54);
}

.terms-dialog-panel,
.model-dialog-panel,
.profile-dialog-panel,
.support-dialog-panel,
.name-dialog-panel,
.move-dialog-panel,
.onboarding-dialog-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-raised);
}

.terms-dialog-panel {
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(86dvh, 760px);
}

.terms-dialog-header,
.model-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.terms-dialog-header h2,
.model-dialog-header h2 {
  margin: 0;
  color: var(--primary-700);
  font-size: 1.28rem;
  line-height: 1.15;
}

body[data-theme="dark"]:not(.login-active) .terms-dialog-header h2,
body[data-theme="dark"]:not(.login-active) .model-dialog-header h2 {
  color: var(--ink);
}

.terms-dialog-header p,
.model-dialog-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.dialog-close-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--primary-500);
  background: var(--udd-blue-soft);
  border-radius: var(--radius-control);
  font-size: 1.3rem;
  font-weight: 700;
}

.terms-dialog-body {
  display: grid;
  gap: 14px;
  color: var(--muted);
  font-size: 0.94rem;
}

.terms-dialog .terms-dialog-body {
  overflow-y: auto;
  padding-right: 4px;
}

.terms-dialog-body p {
  margin: 0;
}

.terms-dialog-body section {
  display: grid;
  gap: 6px;
}

.terms-dialog-body h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.25;
}

.terms-status {
  padding: 10px;
  color: var(--primary-700);
  background: var(--udd-blue-soft);
  border: 1px solid rgba(0, 102, 153, 0.16);
  border-radius: var(--radius-control);
  font-weight: 700;
}

.support-message-input {
  min-height: 132px;
  max-height: 240px;
  padding: 12px;
  resize: vertical;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.support-message-input:focus-visible {
  outline: 0;
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring);
}

.support-success {
  margin: 0;
  padding: 10px;
  color: #07523f;
  background: var(--success-soft);
  border: 1px solid rgba(0, 168, 123, 0.2);
  border-radius: var(--radius-control);
  font-size: 0.9rem;
  font-weight: 700;
}

.support-dialog-panel.is-submitted {
  min-height: 320px;
}

.support-dialog-panel.is-submitted .support-body,
.support-dialog-panel.is-submitted .dialog-actions {
  display: none;
}

.support-dialog-panel.is-submitted .support-success {
  display: grid;
  place-items: center;
  min-height: 210px;
  padding: 28px;
  text-align: center;
}

.onboarding-dialog-panel {
  position: relative;
  justify-items: center;
  gap: 20px;
  max-height: min(90dvh, 780px);
  padding: clamp(24px, 4vw, 38px);
  text-align: center;
}

.onboarding-close-button {
  position: absolute;
  top: 14px;
  right: 14px;
}

.onboarding-media {
  display: grid;
  place-items: center;
  width: min(560px, 100%);
  min-height: 320px;
  margin-top: 12px;
}

.onboarding-image {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.onboarding-copy {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 640px;
}

.onboarding-text {
  margin: 0;
  color: var(--ink);
  font-size: clamp(0.98rem, 1.8vw, 1.16rem);
  font-weight: 700;
  line-height: 1.28;
  white-space: pre-line;
}

.onboarding-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0;
}

.onboarding-dot {
  display: block;
  width: 8px;
  height: 8px;
  background: rgba(0, 102, 153, 0.28);
  border-radius: 999px;
}

.onboarding-dot.is-current {
  width: 20px;
  background: var(--primary-500);
}

.onboarding-actions {
  justify-content: center;
  width: 100%;
}

.walkthrough {
  position: fixed;
  z-index: 1200;
  inset: 0;
  pointer-events: none;
}

.walkthrough-spotlight {
  position: fixed;
  z-index: 1;
  border: 2px solid #fff;
  border-radius: var(--radius-control);
  box-shadow: 0 0 0 9999px rgba(8, 25, 38, 0.64), 0 0 0 5px rgba(0, 102, 153, 0.58);
  transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease;
  pointer-events: none;
}

.walkthrough-bubble {
  position: fixed;
  z-index: 2;
  display: grid;
  gap: 10px;
  width: min(330px, calc(100vw - 32px));
  padding: 22px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-raised);
  pointer-events: auto;
}

.walkthrough-bubble h2,
.walkthrough-bubble p {
  margin: 0;
}

.walkthrough-bubble h2 {
  padding-right: 28px;
  font-size: 1.05rem;
}

.walkthrough-bubble > p:not(.walkthrough-progress) {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.walkthrough-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
}

.walkthrough-progress {
  color: var(--primary-500);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.walkthrough-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

@media (max-width: 760px) {
  .walkthrough-bubble {
    left: 16px !important;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}

.profile-fields {
  display: grid;
  gap: 12px;
  margin: 0;
}

.profile-fields div {
  display: grid;
  gap: 3px;
}

.profile-fields dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.profile-fields dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.dialog-primary-button {
  justify-self: end;
  min-height: 40px;
  padding: 0 16px;
  color: #fff;
  background: var(--primary-500);
  border-radius: var(--radius-control);
  font-weight: 700;
}

.dialog-secondary-button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--primary-500);
  background: var(--udd-blue-soft);
  border-radius: var(--radius-control);
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-error {
  margin: 0;
  color: var(--danger-700);
  font-size: 0.86rem;
  font-weight: 700;
}

.dialog-close-button:hover,
.dialog-primary-button:hover,
.dialog-secondary-button:hover {
  filter: brightness(0.94);
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100dvh;
  color: var(--ink);
  background: var(--canvas);
}

.mobile-app-bar,
.mobile-account-drawer,
.mobile-drawer-backdrop,
.mobile-chat-drawer-header {
  display: none;
}

.sidebar,
.workspace {
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: var(--sidebar-surface);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 10px 0 30px rgba(13, 57, 77, 0.06);
  z-index: 20;
}

body[data-theme="dark"]:not(.login-active) .sidebar {
  background:
    linear-gradient(180deg, #071521 0%, #0d1b27 55%, #12171f 100%);
  border-right-color: rgba(87, 169, 209, 0.24);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.34);
}

.sidebar-brand {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-logo {
  display: block;
  flex: 0 0 auto;
  width: auto;
  height: 31px;
  max-width: 118px;
  object-fit: contain;
}

.brand-title,
.history-title,
.history-meta,
.conversation-title,
.conversation-subtitle,
.message-meta,
.model-provider,
.model-name,
.model-processes {
  margin: 0;
}

.brand-title {
  flex: 0 1 auto;
  overflow: hidden;
  color: #fff;
  font-size: 1.14rem;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-theme="dark"]:not(.login-active) .brand-title {
  color: #fff;
}

.new-chat-button,
.send-button,
.history-item,
.history-main,
.model-card,
.icon-button,
.settings-trigger,
.settings-menu-item,
.sidebar-secondary-button,
.row-menu-button,
.row-menu-item,
.dialog-secondary-button {
  cursor: pointer;
}

.new-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  width: 100%;
  padding: 0 14px;
  color: var(--primary-700);
  background: #fff;
  border-radius: var(--radius-control);
  font-weight: 700;
  box-shadow: none;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.new-chat-button:hover {
  color: var(--primary-600);
  background: var(--primary-50);
  transform: translateY(-1px);
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--primary-500);
  background: #fff;
  border: 1px solid rgba(0, 102, 153, 0.18);
  border-radius: var(--radius-small);
  font-size: 1.1rem;
  line-height: 1;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sidebar-secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 10px;
  color: #fff;
  background: var(--sidebar-control);
  border: 1px solid var(--sidebar-control-border);
  border-radius: var(--radius-control);
  font-size: 0.82rem;
  font-weight: 700;
}

.sidebar-button-icon,
.inline-svg-icon,
.process-icon {
  display: block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#newFolderButton .sidebar-button-icon {
  width: 19px;
  height: 19px;
  margin-left: -1px;
}

.sidebar-secondary-button:hover,
.sidebar-secondary-button:focus-visible {
  background: var(--sidebar-control-hover);
  border-color: rgba(255, 255, 255, 0.36);
}

.chat-search {
  display: grid;
  gap: 6px;
}

.chat-search-field {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 20px 24px;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 0 7px 0 10px;
  color: #fff;
  background: var(--sidebar-control);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-control);
}

.chat-search-field:focus-within {
  background: var(--sidebar-control-hover);
  border-color: var(--secondary-500);
  box-shadow: 0 0 0 3px rgba(0, 204, 153, 0.18);
}

.chat-search-icon {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.82;
}

.chat-search-field input {
  min-width: 0;
  color: #fff;
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 0.86rem;
}

.chat-search-field input::placeholder {
  color: rgba(255, 255, 255, 0.66);
}

.chat-search-field input::-webkit-search-cancel-button {
  appearance: none;
}

.chat-search-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}

.compact-udd-loader {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.compact-udd-loader__arc {
  position: absolute;
  inset: 0;
  border: 1.5px solid color-mix(in srgb, var(--loader-green) 30%, transparent);
  border-top-color: var(--loader-green);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}

.compact-udd-loader__core {
  display: grid;
  place-items: center;
  width: 72%;
  height: 72%;
  overflow: hidden;
  background: var(--udd-blue);
  border-radius: 50%;
}

.compact-udd-loader__core img {
  width: 66%;
  height: auto;
  object-fit: contain;
}

.compact-udd-loader--menu {
  width: 20px;
  height: 20px;
  margin-left: auto;
}

.compact-udd-loader--button {
  width: 22px;
  height: 22px;
}

.compact-udd-loader--message {
  width: 30px;
  height: 30px;
}

.message-processing {
  display: flex;
  align-items: center;
  min-height: 34px;
}

.settings-menu-item.is-loading,
.dialog-primary-button.is-loading {
  cursor: wait;
}

.dialog-primary-button.is-loading .button-label {
  display: none;
}

.settings-menu-item.is-loading .compact-udd-loader,
.dialog-primary-button.is-loading .compact-udd-loader {
  display: inline-grid !important;
}

.chat-search-clear {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 1.15rem;
  line-height: 1;
}

.chat-search-clear:hover,
.chat-search-clear:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.chat-search-status {
  min-height: 1rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.73rem;
  line-height: 1.35;
}

.chat-search-results {
  display: grid;
  max-height: 212px;
  overflow-y: auto;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
  scrollbar-width: thin;
}

.chat-search-results:empty {
  display: none;
}

.chat-search-result-list {
  display: grid;
  gap: 6px;
}

.chat-search-result {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px;
  text-align: left;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.chat-search-result:hover,
.chat-search-result:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.36);
}

.chat-search-result-title {
  overflow: hidden;
  font-size: 0.83rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-search-result-snippet {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.74rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search-match-highlight {
  padding: 0 2px;
  color: #1f2933;
  background: rgba(255, 229, 128, 0.86);
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.sidebar-section {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.section-label {
  color: var(--sidebar-text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-inline: 3px 4px;
  scrollbar-color: transparent transparent;
  scrollbar-width: thin;
  transition: scrollbar-color 0.18s ease;
}

.chat-history:hover,
.chat-history:focus-within,
.chat-history.is-scrolling {
  scrollbar-color: rgba(255, 255, 255, 0.38) transparent;
}

.mobile-account-drawer:hover,
.mobile-account-drawer:focus-within,
.mobile-account-drawer.is-scrolling {
  scrollbar-color: rgba(0, 102, 153, 0.32) transparent;
}

.chat-history::-webkit-scrollbar,
.mobile-account-drawer::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.chat-history::-webkit-scrollbar-track,
.mobile-account-drawer::-webkit-scrollbar-track {
  background: transparent;
}

.chat-history::-webkit-scrollbar-thumb,
.mobile-account-drawer::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}

.chat-history:hover::-webkit-scrollbar-thumb,
.chat-history:focus-within::-webkit-scrollbar-thumb,
.chat-history.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.38);
}

.mobile-account-drawer:hover::-webkit-scrollbar-thumb,
.mobile-account-drawer:focus-within::-webkit-scrollbar-thumb,
.mobile-account-drawer.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(0, 102, 153, 0.32);
}

.history-empty {
  margin: 6px 0 0;
  color: var(--sidebar-text-muted);
  font-size: 0.88rem;
}

.history-group {
  display: grid;
  gap: 8px;
}

.history-group + .history-group {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.history-group-label {
  margin: 0;
  color: var(--sidebar-text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-item,
.history-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px;
  text-align: left;
  color: #fff;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
}

.history-main {
  min-width: 0;
}

.history-main.is-static,
.folder-main {
  cursor: default;
}

.history-item-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 4px;
  align-items: center;
}

.chat-row {
  grid-template-columns: 28px minmax(0, 1fr) 34px;
}

.chat-row.is-archived {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.history-item:hover,
.history-item[aria-current="true"],
.history-main:hover,
.history-main[aria-current="true"] {
  background: rgba(0, 204, 153, 0.16);
  border-color: rgba(0, 204, 153, 0.3);
}

.chat-row[draggable="true"] {
  cursor: grab;
}

.chat-row[draggable="true"] .history-main {
  cursor: grab;
}

.chat-drag-handle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 38px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-control);
  cursor: grab;
  touch-action: none;
}

.chat-drag-handle:hover,
.chat-drag-handle:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.38);
}

.chat-drag-handle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.56);
  outline-offset: 2px;
}

.chat-drag-icon {
  display: block;
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.chat-row.is-dragging {
  opacity: 0.48;
}

.folder-row.is-drop-target,
.root-drop-zone.is-drop-target {
  position: relative;
  outline: 0;
  box-shadow: none;
}

.folder-row.is-drop-target::after,
.root-drop-zone.is-drop-target::after {
  position: absolute;
  z-index: 1;
  inset: 3px;
  border: 1.5px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-small);
  pointer-events: none;
  content: "";
}

.folder-row.is-drop-target {
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-control);
}

.folder-row.is-drop-target .folder-main {
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
}

.root-drop-zone.is-drop-target {
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-control);
}

.history-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--primary-500);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  font-weight: 700;
}

.history-icon-svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.history-title {
  display: block;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
}

.folder-block {
  display: grid;
  gap: 6px;
}

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

.folder-row .history-main {
  grid-template-columns: 30px minmax(0, 1fr);
}

.folder-toggle-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 34px;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: var(--radius-small);
}

.folder-toggle-button:hover,
.folder-toggle-button[aria-expanded="true"] {
  color: #fff;
}

.folder-toggle-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.52);
  outline-offset: 2px;
}

.folder-toggle-icon {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}

.folder-toggle-button[aria-expanded="true"] .folder-toggle-icon {
  transform: rotate(90deg);
}

.folder-mark {
  position: relative;
  align-self: center;
  width: 28px;
  height: 22px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 5px;
}

.folder-mark::before {
  position: absolute;
  top: -5px;
  left: 2px;
  width: 12px;
  height: 7px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  content: "";
}

.folder-chats {
  display: grid;
  gap: 6px;
  margin-left: 14px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.root-drop-zone {
  display: none;
  min-height: 34px;
  padding: 7px 9px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-control);
  font-size: 0.78rem;
  font-weight: 700;
}

.chat-history.is-dragging-chat .root-drop-zone,
.root-chat-section.is-drop-only .root-drop-zone {
  display: block;
}

.chat-row.is-nested .history-main {
  grid-template-columns: 30px minmax(0, 1fr);
  padding: 8px;
}

.chat-row.is-nested .history-icon {
  width: 30px;
  height: 30px;
}

.row-empty {
  margin: 2px 0 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
}

.row-actions {
  position: relative;
}

.row-menu-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-weight: 700;
  letter-spacing: 0;
}

.row-menu-button:hover,
.row-menu-button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
}

.row-menu {
  position: fixed;
  top: auto;
  left: auto;
  z-index: 1002;
  display: grid;
  gap: 3px;
  min-width: 174px;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
}

.row-menu-item {
  min-height: 34px;
  padding: 0 9px;
  color: var(--ink);
  background: transparent;
  border-radius: var(--radius-small);
  text-align: left;
  font-size: 0.84rem;
  font-weight: 700;
}

.row-menu-item:hover,
.row-menu-item:focus-visible {
  background: var(--udd-blue-soft);
}

.sidebar-footer {
  position: relative;
}

.settings-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  color: #fff;
  background: var(--sidebar-control);
  border: 1px solid var(--sidebar-control-border);
  border-radius: var(--radius-control);
  font-weight: 700;
}

.settings-trigger:hover,
.settings-trigger:focus-visible {
  background: var(--sidebar-control-hover);
  border-color: rgba(255, 255, 255, 0.36);
}

.settings-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--primary-700);
  background: #fff;
  border-radius: var(--radius-control);
  font-size: 0.76rem;
  font-weight: 700;
}

.settings-avatar-icon,
.user-avatar-icon {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  display: grid;
  gap: 4px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  z-index: 30;
}

.settings-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink);
  background: transparent;
  border-radius: var(--radius-small);
  text-align: left;
  font-weight: 700;
  text-decoration: none;
}

.settings-menu-item:hover,
.settings-menu-item:focus-visible {
  background: var(--udd-blue-soft);
}

.external-link-mark {
  color: var(--muted);
  font-size: 0.82rem;
}

.custom-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: min(240px, calc(100vw - 16px));
  padding: 6px 8px;
  color: #fff;
  background: rgba(23, 32, 42, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(12, 37, 54, 0.2);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
  pointer-events: none;
}

body[data-theme="dark"]:not(.login-active) .custom-tooltip {
  color: #071521;
  background: #d8f1ff;
  border-color: rgba(139, 212, 248, 0.4);
}

body[data-theme="dark"]:not(.login-active) .new-chat-button {
  color: #eef7fb;
  background: #123247;
  border: 1px solid rgba(87, 169, 209, 0.36);
}

body[data-theme="dark"]:not(.login-active) .new-chat-button:hover {
  background: #174764;
}

body[data-theme="dark"]:not(.login-active) .sidebar-secondary-button {
  color: #f5fbff;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(87, 169, 209, 0.26);
}

body[data-theme="dark"]:not(.login-active) .sidebar-secondary-button:hover,
body[data-theme="dark"]:not(.login-active) .sidebar-secondary-button:focus-visible {
  background: rgba(0, 102, 153, 0.26);
  border-color: rgba(139, 212, 248, 0.44);
}

body[data-theme="dark"]:not(.login-active) .chat-search-field {
  color: #f5fbff;
  background: rgba(0, 102, 153, 0.16);
  border-color: rgba(139, 212, 248, 0.26);
}

body[data-theme="dark"]:not(.login-active) .chat-search-field:focus-within {
  background: rgba(0, 102, 153, 0.24);
  border-color: rgba(139, 212, 248, 0.52);
  box-shadow: 0 0 0 2px rgba(139, 212, 248, 0.14);
}

body[data-theme="dark"]:not(.login-active) .chat-search-field input {
  color: #f5fbff;
}

body[data-theme="dark"]:not(.login-active) .chat-search-field input::placeholder,
body[data-theme="dark"]:not(.login-active) .chat-search-status,
body[data-theme="dark"]:not(.login-active) .chat-search-result-snippet {
  color: rgba(238, 247, 251, 0.72);
}

body[data-theme="dark"]:not(.login-active) .chat-search-result {
  color: #f5fbff;
  background: rgba(0, 102, 153, 0.14);
  border-color: rgba(139, 212, 248, 0.2);
}

body[data-theme="dark"]:not(.login-active) .chat-search-result:hover,
body[data-theme="dark"]:not(.login-active) .chat-search-result:focus-visible {
  background: rgba(0, 102, 153, 0.26);
  border-color: rgba(139, 212, 248, 0.44);
}

body[data-theme="dark"]:not(.login-active) .button-icon {
  color: #eef7fb;
  background: var(--udd-blue);
}

body[data-theme="dark"]:not(.login-active) .section-label,
body[data-theme="dark"]:not(.login-active) .history-empty,
body[data-theme="dark"]:not(.login-active) .history-meta,
body[data-theme="dark"]:not(.login-active) .history-group-label {
  color: rgba(238, 247, 251, 0.72);
}

body[data-theme="dark"]:not(.login-active) .history-group + .history-group {
  border-top-color: rgba(139, 212, 248, 0.24);
}

body[data-theme="dark"]:not(.login-active) .history-item {
  color: #f5fbff;
}

body[data-theme="dark"]:not(.login-active) .history-main {
  color: #f5fbff;
}

body[data-theme="dark"]:not(.login-active) .history-item:hover,
body[data-theme="dark"]:not(.login-active) .history-item[aria-current="true"],
body[data-theme="dark"]:not(.login-active) .history-main:hover,
body[data-theme="dark"]:not(.login-active) .history-main[aria-current="true"] {
  background: rgba(0, 102, 153, 0.22);
  border-color: rgba(87, 169, 209, 0.36);
}

body[data-theme="dark"]:not(.login-active) .history-icon {
  color: #8bd4f8;
  background: #0d2433;
  border-color: rgba(87, 169, 209, 0.3);
}

body[data-theme="dark"]:not(.login-active) .chat-drag-handle {
  color: rgba(238, 247, 251, 0.82);
  background: rgba(0, 102, 153, 0.18);
  border-color: rgba(139, 212, 248, 0.26);
}

body[data-theme="dark"]:not(.login-active) .chat-drag-handle:hover,
body[data-theme="dark"]:not(.login-active) .chat-drag-handle:focus-visible {
  color: #f5fbff;
  background: rgba(0, 102, 153, 0.3);
  border-color: rgba(139, 212, 248, 0.48);
}

body[data-theme="dark"]:not(.login-active) .folder-mark {
  background: rgba(0, 102, 153, 0.28);
  border-color: rgba(139, 212, 248, 0.38);
}

body[data-theme="dark"]:not(.login-active) .folder-mark::before {
  background: rgba(0, 102, 153, 0.34);
  border-color: rgba(139, 212, 248, 0.38);
}

body[data-theme="dark"]:not(.login-active) .folder-toggle-button {
  color: #f5fbff;
}

body[data-theme="dark"]:not(.login-active) .folder-toggle-button:hover,
body[data-theme="dark"]:not(.login-active) .folder-toggle-button[aria-expanded="true"] {
  color: #f5fbff;
}

body[data-theme="dark"]:not(.login-active) .folder-toggle-button:focus-visible {
  outline-color: rgba(139, 212, 248, 0.72);
}

body[data-theme="dark"]:not(.login-active) .chat-history:hover,
body[data-theme="dark"]:not(.login-active) .chat-history:focus-within,
body[data-theme="dark"]:not(.login-active) .chat-history.is-scrolling,
body[data-theme="dark"]:not(.login-active) .mobile-account-drawer:hover,
body[data-theme="dark"]:not(.login-active) .mobile-account-drawer:focus-within,
body[data-theme="dark"]:not(.login-active) .mobile-account-drawer.is-scrolling {
  scrollbar-color: rgba(139, 212, 248, 0.44) transparent;
}

body[data-theme="dark"]:not(.login-active) .chat-history:hover::-webkit-scrollbar-thumb,
body[data-theme="dark"]:not(.login-active) .chat-history:focus-within::-webkit-scrollbar-thumb,
body[data-theme="dark"]:not(.login-active) .chat-history.is-scrolling::-webkit-scrollbar-thumb,
body[data-theme="dark"]:not(.login-active) .mobile-account-drawer:hover::-webkit-scrollbar-thumb,
body[data-theme="dark"]:not(.login-active) .mobile-account-drawer:focus-within::-webkit-scrollbar-thumb,
body[data-theme="dark"]:not(.login-active) .mobile-account-drawer.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(139, 212, 248, 0.44);
}

body[data-theme="dark"]:not(.login-active) .support-success {
  color: #d7fff4;
  border-color: rgba(85, 214, 174, 0.28);
}

body[data-theme="dark"]:not(.login-active) .folder-chats {
  border-left-color: rgba(139, 212, 248, 0.22);
}

body[data-theme="dark"]:not(.login-active) .root-drop-zone {
  color: rgba(238, 247, 251, 0.84);
  background: rgba(0, 102, 153, 0.18);
  border-color: rgba(139, 212, 248, 0.34);
}

body[data-theme="dark"]:not(.login-active) .row-empty {
  color: rgba(238, 247, 251, 0.62);
}

body[data-theme="dark"]:not(.login-active) .row-menu-button {
  color: #f5fbff;
}

body[data-theme="dark"]:not(.login-active) .row-menu-button:hover,
body[data-theme="dark"]:not(.login-active) .row-menu-button[aria-expanded="true"] {
  background: rgba(0, 102, 153, 0.22);
  border-color: rgba(87, 169, 209, 0.34);
}

body[data-theme="dark"]:not(.login-active) .settings-trigger {
  color: #f5fbff;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(87, 169, 209, 0.28);
}

body[data-theme="dark"]:not(.login-active) .settings-avatar {
  color: #071521;
  background: #8bd4f8;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, var(--panel-soft) 0%, var(--canvas) 100%);
}

.blank-workspace {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  min-height: 100%;
  padding: 24px;
  color: var(--muted);
  background: transparent;
  text-align: center;
}

.blank-workspace-illustration {
  display: block;
  width: min(760px, 82vw);
  max-height: 620px;
  object-fit: contain;
}

.blank-workspace p {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
}

.conversation-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  min-height: 0;
  padding: 22px;
}

.conversation-shell[hidden] {
  display: none !important;
}

.conversation-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: min(920px, 100%);
  margin-inline: auto;
  min-height: 62px;
  padding: 0 2px 14px;
  border-bottom: 1px solid var(--line);
}

.conversation-title {
  font-size: 1.04rem;
  font-weight: 700;
}

.conversation-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(920px, 100%);
  margin-inline: auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 8px;
}

.message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  width: min(100%, 880px);
}

.message.user {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--primary-500);
  border-radius: var(--radius-control);
  font-size: 0.8rem;
  font-weight: 700;
}

.assistant-avatar {
  color: var(--primary-500);
  background: var(--panel);
  border: 1px solid var(--line);
}

.lucide-icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-icon {
  width: 21px;
  height: 21px;
}

.mic-icon {
  width: 20px;
  height: 20px;
}

.message.user .avatar {
  background: var(--primary-800);
}

.message-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: 0 8px 20px rgba(12, 37, 54, 0.06);
}

.message.assistant .message-card {
  box-shadow: none;
}

.message.user .message-card {
  color: #fff;
  background: var(--primary-800);
  border-color: var(--primary-800);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.message.user .message-meta {
  color: rgba(255, 255, 255, 0.78);
}

.message-content {
  display: grid;
  gap: 9px;
}

.message-content p,
.message-content ul {
  margin-top: 0;
  margin-bottom: 0;
}

.message-content ul {
  padding-left: 1.2rem;
}

.message-content li + li {
  margin-top: 5px;
}

.message-attachments,
.model-processes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.attachment-chip,
.model-processes > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  max-width: 100%;
  padding: 4px 8px;
  color: var(--primary-700);
  background: var(--udd-blue-soft);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius-control);
  font-size: 0.78rem;
  font-weight: 700;
}

body[data-theme="dark"]:not(.login-active) .attachment-chip,
body[data-theme="dark"]:not(.login-active) .model-processes > span {
  color: var(--ink);
}

.message.user .attachment-chip {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.composer-shell {
  display: grid;
  gap: 8px;
  width: min(920px, 100%);
  margin-inline: auto;
}

.attachment-tray {
  display: flex;
  gap: 8px;
  min-height: 0;
  overflow-x: auto;
}

.attachment-tray:empty {
  display: none;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  min-height: 32px;
  padding: 5px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.remove-attachment {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--muted);
  background: var(--panel-soft);
  border-radius: var(--radius-small);
}

.composer {
  display: grid;
  grid-template-columns: 42px 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
}

.composer:focus-within {
  border-color: var(--primary-500);
  box-shadow: var(--focus-ring), var(--shadow);
}

.icon-button,
.attach-button,
.dictate-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--primary-500);
  background: var(--udd-blue-soft);
  border: 1px solid rgba(0, 102, 153, 0.16);
  border-radius: var(--radius-control);
}

.icon-button:hover,
.attach-button:hover,
.dictate-button:hover {
  color: var(--primary-600);
  border-color: var(--primary-100);
}

.attach-button {
  font-size: 1.25rem;
  font-weight: 700;
}

.dictate-button[aria-pressed="true"] {
  color: #fff;
  background: var(--primary-500);
}

.dictation-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.dictation-status:empty {
  display: none;
}

.composer-disclaimer {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
}

textarea {
  width: 100%;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 4px;
  overflow-y: auto;
  resize: none;
  color: var(--ink);
  background: transparent;
  border: 0;
}

textarea::placeholder {
  color: #7a8795;
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  min-height: 42px;
  padding: 0 14px;
  color: #fff;
  background: var(--primary-500);
  border-radius: var(--radius-control);
  font-weight: 700;
}

.send-button:hover {
  background: var(--primary-600);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.model-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
}

.model-card {
  display: grid;
  gap: 10px;
  min-height: 108px;
  padding: 13px;
  text-align: left;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.model-card:hover,
.model-card:focus-visible,
.model-card[aria-selected="true"] {
  border-color: var(--primary-500);
  box-shadow: 0 8px 20px rgba(12, 37, 54, 0.1);
  transform: translateY(-1px);
}

.model-card[aria-selected="true"] {
  background: #f2f9fc;
}

body[data-theme="dark"]:not(.login-active) .model-card[aria-selected="true"] {
  background: var(--panel-soft);
}

.model-provider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: max-content;
  min-height: 22px;
  padding: 2px 8px 2px 3px;
  color: #fff;
  background: var(--primary-500);
  border-radius: var(--radius-small);
  font-size: 0.72rem;
  font-weight: 700;
}

.provider-mark-frame {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  overflow: hidden;
  background: #fff;
  border-radius: var(--radius-small);
}

.provider-mark {
  display: block;
  width: 13px;
  height: 13px;
  object-fit: contain;
}

.provider-mark--deepseek,
.provider-mark--mistral {
  width: 15px;
  height: 15px;
}

.provider-mark--openai {
  width: 14px;
  height: 14px;
}

.provider-mark--meta {
  width: 16px;
  height: 12px;
}

.model-name {
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.15;
}

.model-processes > span {
  min-height: 26px;
  padding: 3px 8px;
  color: var(--primary-600);
  background: var(--udd-blue-soft);
  border: 1px solid #bde1ee;
  border-radius: var(--radius-control);
  font-size: 0.76rem;
  font-weight: 700;
}

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

@media (max-width: 920px) {
  .login-screen {
    align-items: stretch;
    padding: 16px;
    background: var(--login-blue);
  }

  .login-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
    min-height: calc(100dvh - 32px);
  }

  .login-brand-panel {
    align-items: stretch;
    justify-content: flex-start;
    padding: 8px 12px 0;
  }

  .login-brand-lockup {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
  }

  .login-brand-lockup picture {
    align-self: auto;
    flex: 0 0 auto;
  }

  .login-brand-panel h1 {
    font-size: clamp(1.55rem, 6vw, 2.2rem);
    text-align: left;
  }

  .login-logo {
    width: min(150px, 40vw);
  }

  .login-form {
    align-self: center;
    justify-self: center;
    width: min(420px, 100%);
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 58px minmax(0, 1fr);
  }

  .mobile-app-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    color: #fff;
    background: linear-gradient(90deg, var(--udd-blue-deep), var(--udd-blue));
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 8px 24px rgba(12, 37, 54, 0.12);
    z-index: 30;
  }

  body[data-theme="dark"]:not(.login-active) .mobile-app-bar {
    background: linear-gradient(90deg, #071521, #0d1b27);
    border-bottom-color: rgba(87, 169, 209, 0.24);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    color: #fff;
    font-weight: 700;
  }

  .mobile-brand-logo {
    display: block;
    width: auto;
    height: 22px;
    max-width: 78px;
    object-fit: contain;
  }

  .mobile-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
  }

  .mobile-bar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 10px;
    color: #fff;
    background: var(--sidebar-control);
    border: 1px solid var(--sidebar-control-border);
    border-radius: var(--radius-control);
    font-size: 0.84rem;
    font-weight: 700;
  }

  .mobile-bar-button:hover,
  .mobile-bar-button:focus-visible,
  .mobile-bar-button[aria-expanded="true"] {
    background: var(--sidebar-control-hover);
    border-color: rgba(255, 255, 255, 0.36);
  }

  .workspace {
    grid-row: 2;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(340px, calc(100vw - 38px));
    max-height: none;
    padding: 14px;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    border-bottom: 0;
    box-shadow: 16px 0 36px rgba(12, 37, 54, 0.18);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 1001;
  }

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

  .mobile-chat-drawer-header {
    display: flex;
  }

  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    color: var(--ink);
  }

  .sidebar .drawer-header {
    color: #fff;
  }

  .drawer-header h2 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
  }

  .sidebar-brand,
  .sidebar-footer {
    display: none;
  }

  .mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(7, 21, 33, 0.48);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
  }

  .mobile-drawer-backdrop.is-open {
    opacity: 1;
  }

  .mobile-account-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(320px, calc(100vw - 38px));
    padding: 16px;
    color: var(--ink);
    background: var(--panel);
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 36px rgba(12, 37, 54, 0.18);
    transform: translateX(105%);
    transition: transform 0.2s ease;
    z-index: 1001;
  }

  .mobile-account-drawer.is-open {
    transform: translateX(0);
  }

  body[data-theme="dark"]:not(.login-active) .mobile-account-drawer {
    box-shadow: -16px 0 36px rgba(0, 0, 0, 0.36);
  }

  .mobile-account-actions {
    display: grid;
    gap: 4px;
  }

  .conversation-shell {
    padding: 14px;
  }

  .blank-workspace {
    padding: 20px;
  }

  .blank-workspace-illustration {
    width: min(620px, 90vw);
    max-height: 500px;
  }

  .model-choice-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-dialog-panel {
    gap: 14px;
    padding: 24px 20px;
  }

  .onboarding-media {
    width: min(370px, 94%);
    min-height: 240px;
    margin-top: 18px;
  }

  .onboarding-image {
    max-height: 240px;
  }

  .onboarding-text {
    font-size: 0.96rem;
  }
}

@media (max-width: 620px) {
  .login-screen {
    place-items: stretch center;
    overflow-y: auto;
  }

  .login-logo {
    width: min(132px, 36vw);
  }

  .login-form {
    padding: 22px;
  }

  .onboarding-actions .dialog-primary-button {
    justify-self: stretch;
    width: 100%;
  }

  .mobile-app-bar {
    padding-inline: 10px;
  }

  .mobile-bar-button {
    gap: 5px;
    padding-inline: 8px;
  }

  .mobile-bar-button .inline-svg-icon {
    width: 15px;
    height: 15px;
  }

  .conversation-header {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
  }

  .message,
  .message.user {
    grid-template-columns: 34px minmax(0, 1fr);
    align-self: stretch;
  }

  .message.user .avatar {
    order: -1;
  }

  .composer {
    grid-template-columns: 40px 40px minmax(0, 1fr) 46px;
  }

  .send-button {
    min-width: 46px;
    padding: 0;
  }

  .send-button span:first-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

@media (max-width: 420px) {
  .mobile-app-bar {
    grid-row: 1;
    min-width: 0;
  }

  .mobile-brand {
    gap: 7px;
  }

  .mobile-brand-logo {
    max-width: 68px;
  }

  .mobile-bar-actions {
    gap: 6px;
  }

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

  .mobile-bar-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .sidebar,
  .mobile-account-drawer {
    width: min(312px, calc(100vw - 24px));
  }

  .conversation-shell {
    gap: 12px;
    padding: 12px;
  }

  .composer {
    grid-template-columns: 38px 38px minmax(0, 1fr) 42px;
    gap: 6px;
    padding: 6px;
  }

  .icon-button,
  .attach-button,
  .dictate-button,
  textarea,
  .send-button {
    min-height: 40px;
  }

  .icon-button,
  .attach-button,
  .dictate-button {
    width: 38px;
    height: 40px;
  }
}

body:not(.login-active) {
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.5;
}

.login-form,
.message-card,
.model-card,
.attachment-pill {
  background: var(--bg-surface-primary);
  border-color: var(--border-primary);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.field-group {
  gap: var(--space-1-5);
}

.field-group label {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 400;
  line-height: 24px;
}

.field-group input,
.field-group select {
  min-height: 40px;
  padding: 0 12px;
  color: var(--text-primary);
  background: var(--bg-surface-primary);
  border-color: var(--border-primary);
  border-radius: var(--radius-control);
  font-size: 1rem;
  line-height: 24px;
}

.field-group input::placeholder,
textarea::placeholder,
.chat-search-field input::placeholder {
  color: var(--text-secondary);
}

.field-group input:focus,
.field-group select:focus,
.field-group input:focus-visible,
.field-group select:focus-visible,
.support-message-input:focus-visible {
  border-color: var(--border-primary-focus);
  box-shadow: var(--focus-ring);
}

.login-form h2 {
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 30px;
}

.login-button,
.dialog-primary-button,
.send-button,
.new-chat-button {
  min-height: 40px;
  color: var(--gray-200);
  background: var(--bg-fill-primary);
  border: 1px solid var(--bg-fill-primary);
  border-radius: var(--radius-control);
  font-size: 1rem;
  font-weight: 500;
  line-height: 24px;
  box-shadow: none;
}

.login-button:hover,
.dialog-primary-button:hover,
.send-button:hover,
.new-chat-button:hover {
  color: var(--gray-200);
  background: var(--bg-fill-primary-hover);
  border-color: var(--bg-fill-primary-hover);
  filter: none;
  transform: none;
}

.dialog-primary-button:active,
.send-button:active,
.new-chat-button:active {
  background: var(--primary-700);
  border-color: var(--primary-700);
}

.dialog-secondary-button,
.sidebar-secondary-button,
.mobile-bar-button {
  min-height: 40px;
  color: var(--text-secondary);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-control);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 24px;
}

.dialog-secondary-button:hover,
.sidebar-secondary-button:hover,
.sidebar-secondary-button:focus-visible,
.mobile-bar-button:hover,
.mobile-bar-button:focus-visible,
.mobile-bar-button[aria-expanded="true"] {
  color: var(--text-primary);
  background: var(--bg-surface-tertiary);
  border-color: var(--border-primary-focus);
  filter: none;
}

.terms-link {
  min-height: 32px;
  color: var(--text-link);
  border-radius: var(--radius-control);
  font-size: 1rem;
  font-weight: 500;
  line-height: 24px;
  text-decoration-thickness: 1px;
}

.terms-link:hover {
  color: var(--primary-200);
  background: transparent;
}

.terms-dialog-panel,
.model-dialog-panel,
.profile-dialog-panel,
.support-dialog-panel,
.name-dialog-panel,
.move-dialog-panel,
.onboarding-dialog-panel,
.walkthrough-bubble {
  gap: 10px;
  padding: 15px 16px;
  color: var(--text-primary);
  background: var(--bg-surface-primary);
  border-color: var(--border-primary);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-raised);
}

.onboarding-dialog-panel {
  border-radius: var(--radius-card);
}

.terms-dialog-header h2,
.model-dialog-header h2,
.walkthrough-bubble h2 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 30px;
}

.terms-dialog-header p,
.model-dialog-header p,
.terms-dialog-body,
.walkthrough-bubble > p:not(.walkthrough-progress) {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 24px;
}

.terms-dialog-body h3 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  line-height: 24px;
}

.dialog-close-button {
  width: 32px;
  height: 32px;
  color: var(--text-primary);
  background: var(--bg-surface-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: 1.1rem;
  font-weight: 500;
}

.dialog-close-button:hover,
.dialog-close-button:focus-visible {
  background: var(--bg-surface-tertiary);
  border-color: var(--border-primary);
  filter: none;
}

.dialog-actions {
  gap: var(--space-2);
}

.dialog-error,
.login-error {
  color: var(--text-error);
  background: var(--error-50);
  border-color: var(--error-600);
  border-radius: var(--radius-control);
  font-size: 0.8125rem;
  line-height: 19.5px;
}

.terms-status {
  color: var(--text-brand);
  background: var(--bg-surface-tertiary);
  border-color: rgba(0, 102, 153, 0.16);
  border-radius: var(--radius-control);
  font-size: 0.8125rem;
  line-height: 19.5px;
}

.support-message-input {
  min-height: 77px;
  padding: 8px 12px;
  color: var(--text-primary);
  background: var(--bg-surface-primary);
  border-color: var(--border-primary);
  border-radius: var(--radius-control);
  font-size: 1rem;
  line-height: 24px;
}

.support-success {
  color: var(--text-success);
  background: var(--success-50);
  border-color: var(--success-600);
  border-radius: var(--radius-control);
  font-size: 0.8125rem;
  line-height: 19.5px;
}

.app-shell {
  background: var(--canvas);
}

.sidebar {
  gap: var(--space-2);
  padding: var(--space-2);
  color: var(--text-primary);
  background: var(--sidebar-surface);
  border-right: 1px solid var(--border-primary);
  box-shadow: var(--shadow-card);
}

.sidebar-brand {
  min-height: 56px;
  padding: 8px 8px 0;
}

.sidebar-logo {
  height: 27px;
  max-width: 128px;
}

.brand-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  line-height: 24px;
}

.new-chat-button {
  gap: var(--space-2);
  width: 100%;
  padding: 4px 12px;
}

.button-icon {
  width: 16px;
  height: 16px;
  color: currentColor;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 1rem;
}

.sidebar-actions {
  gap: var(--space-2);
}

.sidebar-secondary-button {
  justify-content: center;
  gap: var(--space-2);
  padding: 4px 8px;
}

.sidebar-button-icon,
.inline-svg-icon,
.process-icon,
.chat-search-icon {
  color: currentColor;
  stroke-width: 1.5;
}

.chat-search {
  gap: var(--space-1-5);
}

.chat-search-field {
  min-height: 40px;
  padding: 0 7px 0 10px;
  color: var(--text-secondary);
  background: var(--bg-surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-control);
}

.chat-search-field:focus-within {
  color: var(--text-primary);
  background: var(--bg-surface-primary);
  border-color: var(--border-primary-focus);
  box-shadow: var(--focus-ring);
}

.chat-search-field input {
  color: var(--text-primary);
  font-size: 0.8125rem;
  line-height: 19.5px;
}

.chat-search-spinner {
  border-color: rgba(0, 102, 153, 0.24);
  border-top-color: var(--primary-500);
}

.chat-search-clear {
  color: var(--text-secondary);
  border-radius: var(--radius-control);
}

.chat-search-clear:hover,
.chat-search-clear:focus-visible {
  color: var(--text-primary);
  background: var(--bg-surface-secondary);
}

.chat-search-status {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 19.5px;
}

.chat-search-results,
.chat-history {
  scrollbar-color: var(--gray-500) transparent;
}

.chat-search-result {
  gap: 2px;
  min-height: 44px;
  padding: 6px;
  color: var(--text-primary);
  background: var(--bg-surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-control);
}

.chat-search-result:hover,
.chat-search-result:focus-visible {
  background: var(--bg-surface-secondary);
  border-color: var(--border-primary-focus);
}

.chat-search-result-title {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 19.5px;
}

.chat-search-result-snippet,
.section-label,
.history-empty,
.history-group-label,
.history-meta,
.row-empty,
.message-meta,
.conversation-subtitle,
.composer-disclaimer,
.dictation-status {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 19.5px;
  letter-spacing: 0;
}

.section-label,
.history-group-label {
  font-weight: 500;
  text-transform: none;
}

.history-group + .history-group {
  border-top-color: var(--border-primary);
}

.chat-history {
  gap: var(--space-1-5);
  padding-inline: 0;
}

.history-item,
.history-main {
  min-height: 40px;
  gap: var(--space-2);
  padding: var(--space-2);
  color: var(--text-primary);
  background: var(--bg-surface-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
}

.history-item:hover,
.history-item[aria-current="true"],
.history-main:hover,
.history-main[aria-current="true"] {
  color: var(--text-primary);
  background: var(--bg-surface-secondary);
  border-color: var(--border-primary);
}

.history-main[aria-current="true"] .history-title,
.history-item[aria-current="true"] .history-title {
  font-weight: 700;
}

.history-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 400;
  line-height: 24px;
}

.history-icon,
.settings-avatar,
.chat-drag-handle,
.row-menu-button,
.folder-toggle-button,
.remove-attachment {
  color: var(--text-brand);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-control);
}

.history-icon {
  width: 32px;
  height: 32px;
}

.chat-drag-handle {
  height: 36px;
}

.chat-drag-handle:hover,
.chat-drag-handle:focus-visible,
.row-menu-button:hover,
.row-menu-button[aria-expanded="true"],
.folder-toggle-button:hover,
.folder-toggle-button[aria-expanded="true"],
.remove-attachment:hover {
  color: var(--text-primary);
  background: var(--bg-surface-secondary);
  border-color: var(--border-primary-focus);
}

.chat-drag-handle:focus-visible,
.folder-toggle-button:focus-visible {
  outline-color: rgba(0, 102, 153, 0.42);
}

.folder-mark {
  background: var(--bg-surface-secondary);
  border-color: var(--border-primary);
  border-radius: var(--radius-control);
}

.folder-mark::before {
  background: var(--bg-surface-secondary);
  border-color: var(--border-primary);
}

.folder-chats {
  border-left-color: var(--border-primary);
}

.root-drop-zone {
  color: var(--text-secondary);
  background: var(--bg-surface-secondary);
  border-color: var(--border-primary);
  border-radius: var(--radius-control);
}

.folder-row.is-drop-target,
.root-drop-zone.is-drop-target {
  background: var(--bg-surface-tertiary);
}

.folder-row.is-drop-target::after,
.root-drop-zone.is-drop-target::after {
  border-color: var(--border-brand);
  border-radius: var(--radius-control);
}

.folder-row.is-drop-target .folder-main {
  background: var(--bg-surface-secondary);
}

.row-menu,
.settings-menu {
  gap: 3px;
  padding: 5px;
  background: var(--bg-surface-primary);
  border-color: var(--border-primary);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-card-hover);
}

.row-menu-item,
.settings-menu-item {
  min-height: 36px;
  padding: 6px 8px;
  color: var(--text-primary);
  background: transparent;
  border-radius: var(--radius-control);
  font-size: 1rem;
  font-weight: 400;
  line-height: 24px;
}

.row-menu-item:hover,
.row-menu-item:focus-visible,
.settings-menu-item:hover,
.settings-menu-item:focus-visible {
  background: var(--bg-surface-secondary);
}

.settings-trigger {
  min-height: 40px;
  gap: var(--space-2);
  padding: 4px 8px;
  color: var(--text-primary);
  background: var(--bg-surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-control);
  font-size: 1rem;
  font-weight: 400;
  line-height: 24px;
}

.settings-trigger:hover,
.settings-trigger:focus-visible {
  background: var(--bg-surface-secondary);
  border-color: var(--border-primary-focus);
}

.settings-avatar {
  width: 24px;
  height: 24px;
}

.settings-avatar-icon,
.user-avatar-icon {
  width: 16px;
  height: 16px;
  stroke-width: 1.5;
}

.workspace {
  background: var(--canvas);
}

.blank-workspace {
  color: var(--text-secondary);
  background: var(--bg-surface-secondary);
}

.blank-workspace p,
.conversation-title,
.message-content,
.model-name {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 24px;
}

.conversation-shell {
  gap: var(--space-3);
  padding: 24px;
}

.conversation-header {
  min-height: 56px;
  border-bottom-color: var(--border-primary);
}

.messages {
  gap: var(--space-3);
}

.avatar {
  width: 40px;
  height: 40px;
  color: var(--gray-200);
  background: var(--primary-500);
  border-radius: 999px;
  font-size: 0.8125rem;
  line-height: 19.5px;
}

.assistant-avatar {
  color: var(--text-brand);
  background: var(--bg-surface-primary);
  border-color: var(--border-primary);
}

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

.message.user {
  grid-template-columns: minmax(0, 1fr) 40px;
}

.message-card {
  gap: var(--space-2);
  padding: 15px 16px;
}

.message.assistant .message-card {
  box-shadow: var(--shadow-card);
}

.message.user .avatar,
.message.user .message-card {
  color: var(--gray-200);
  background: var(--primary-500);
  border-color: var(--primary-500);
}

.message.user .message-meta {
  color: rgba(230, 232, 234, 0.84);
}

.attachment-chip,
.model-processes > span,
.model-provider {
  min-height: 20px;
  padding: 2px 8px;
  color: var(--text-primary);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 400;
  line-height: 15.6px;
}

.message.user .attachment-chip {
  color: var(--gray-200);
  background: rgba(230, 232, 234, 0.12);
  border-color: rgba(230, 232, 234, 0.44);
}

.model-provider {
  color: var(--gray-200);
  background: var(--primary-500);
}

.provider-mark-frame {
  width: 16px;
  height: 16px;
  border-radius: 999px;
}

.attachment-pill {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 0.8125rem;
  line-height: 19.5px;
}

.composer {
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--bg-surface-primary);
  border-color: var(--border-primary);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.composer:focus-within {
  border-color: var(--border-primary-focus);
  box-shadow: var(--focus-ring), var(--shadow-card);
}

.icon-button,
.attach-button,
.dictate-button {
  width: 40px;
  height: 40px;
  color: var(--text-brand);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-control);
}

.icon-button:hover,
.attach-button:hover,
.dictate-button:hover {
  color: var(--text-primary);
  background: var(--bg-surface-tertiary);
  border-color: var(--border-primary-focus);
}

.dictate-button[aria-pressed="true"] {
  color: var(--gray-200);
  background: var(--primary-500);
  border-color: var(--primary-500);
}

textarea {
  min-height: 40px;
  padding: 8px 4px;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 24px;
}

.send-button {
  gap: var(--space-2);
  min-height: 40px;
  padding: 4px 12px;
}

.model-choice-grid {
  gap: var(--space-2);
}

.model-card {
  gap: var(--space-2);
  min-height: 116px;
  padding: 12px;
}

.model-card:hover,
.model-card:focus-visible {
  border-color: var(--border-primary-focus);
  box-shadow: var(--shadow-card-hover);
  transform: none;
}

.model-card[aria-selected="true"] {
  background: var(--bg-surface-tertiary);
  border-color: var(--border-brand);
  box-shadow: var(--shadow-card-hover);
  transform: none;
}

.model-name {
  font-weight: 500;
}

.model-processes {
  gap: var(--space-1-5);
}

.profile-fields {
  gap: var(--space-2);
}

.profile-fields div {
  gap: 2px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-secondary);
}

.profile-fields dt {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 19.5px;
}

.profile-fields dd {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 400;
  line-height: 24px;
}

.onboarding-dot {
  background: var(--gray-300);
}

.onboarding-dot.is-current {
  background: var(--primary-500);
}

.walkthrough-progress {
  color: var(--text-brand);
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 15.6px;
  letter-spacing: 0;
  text-transform: none;
}

.custom-tooltip {
  color: var(--gray-200);
  background: var(--gray-800);
  border-color: var(--gray-700);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-card-hover);
  font-size: 0.8125rem;
  line-height: 19.5px;
}

@media (max-width: 920px) {
  .mobile-app-bar {
    color: var(--text-primary);
    background: var(--bg-surface-primary);
    border-bottom: 1px solid var(--border-primary);
    box-shadow: var(--shadow-card);
  }

  .mobile-brand {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 24px;
  }

  .mobile-brand-logo {
    height: 27px;
    max-width: 128px;
  }

  .sidebar {
    padding: var(--space-2);
    border-right-color: var(--border-primary);
    box-shadow: 0 10px 15px -3px rgba(48, 53, 56, 0.1), 0 4px 6px -4px rgba(48, 53, 56, 0.1);
  }

  .sidebar .drawer-header {
    color: var(--text-primary);
  }

  .drawer-header h2 {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 30px;
  }

  .mobile-account-drawer {
    background: var(--bg-surface-primary);
    border-left-color: var(--border-primary);
    box-shadow: -10px 0 15px -3px rgba(48, 53, 56, 0.1), -4px 0 6px -4px rgba(48, 53, 56, 0.1);
  }

  .conversation-shell {
    padding: 16px;
  }
}

@media (max-width: 620px) {
  .conversation-shell {
    padding: 16px;
  }

  .composer {
    grid-template-columns: 40px 40px minmax(0, 1fr) 46px;
  }
}

@media (max-width: 420px) {
  .mobile-brand-logo {
    max-width: 96px;
  }

  .mobile-bar-button {
    width: 40px;
  }

  .composer {
    grid-template-columns: 38px 38px minmax(0, 1fr) 42px;
  }
}

body[data-theme="dark"]:not(.login-active) {
  --bg-surface-primary: var(--panel);
  --bg-surface-secondary: var(--panel-soft);
  --bg-surface-tertiary: var(--udd-blue-soft);
  --bg-surface-disabled: #243847;
  --text-primary: var(--ink);
  --text-secondary: var(--muted);
  --text-disabled: #738493;
  --border-primary: var(--line);
  --border-secondary: #1e3140;
  --border-primary-focus: rgba(139, 212, 248, 0.52);
  --sidebar-surface: linear-gradient(180deg, #071521 0%, #0d1b27 55%, #12171f 100%);
  --sidebar-control: rgba(255, 255, 255, 0.07);
  --sidebar-control-hover: rgba(0, 102, 153, 0.26);
  --sidebar-control-border: rgba(87, 169, 209, 0.28);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.28), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 2px 4px -2px rgba(0, 0, 0, 0.35), 0 4px 6px -1px rgba(0, 0, 0, 0.34);
  --shadow: var(--shadow-card);
  --shadow-raised: 0 20px 40px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"]:not(.login-active) .brand-title,
body[data-theme="dark"]:not(.login-active) .sidebar,
body[data-theme="dark"]:not(.login-active) .sidebar .drawer-header,
body[data-theme="dark"]:not(.login-active) .mobile-app-bar,
body[data-theme="dark"]:not(.login-active) .mobile-brand {
  color: var(--text-primary);
}

.sidebar-brand {
  gap: 8px;
  min-height: 64px;
  padding: 10px 10px 4px;
}

.sidebar-brand .brand-title {
  flex: 0 0 auto;
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
}

.sidebar-logo {
  width: 132px;
  max-width: 132px;
  height: auto;
  max-height: 24px;
  margin-left: auto;
  object-fit: contain;
}

.history-item-row {
  gap: 6px;
}

.folder-row,
.chat-row {
  grid-template-columns: 32px minmax(0, 1fr) 32px;
}

.chat-row.is-archived {
  grid-template-columns: minmax(0, 1fr) 32px;
}

.chat-row .history-main,
.folder-row .history-main {
  min-height: 40px;
  padding: 7px 8px;
}

.chat-row .history-main {
  grid-template-columns: 24px minmax(0, 1fr);
}

.chat-row .history-copy {
  display: block;
  min-width: 0;
}

.chat-row .history-title {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 19.5px;
}

.chat-row .history-meta {
  display: none;
}

.chat-row .history-icon {
  width: 24px;
  height: 24px;
  background: transparent;
  border-color: transparent;
}

.folder-mark {
  display: grid;
  place-items: center;
  align-self: center;
  width: 24px;
  height: 24px;
  color: var(--text-brand);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.folder-mark::before {
  content: none;
}

.folder-icon,
.row-menu-icon,
.attach-icon,
.send-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}

.folder-icon {
  width: 24px;
  height: 24px;
}

.chat-drag-handle,
.row-menu-button,
.folder-toggle-button {
  width: 32px;
  height: 40px;
  min-height: 40px;
  color: var(--text-brand);
  background: transparent;
  border-color: transparent;
}

.chat-drag-handle:hover,
.chat-drag-handle:focus-visible,
.row-menu-button:hover,
.row-menu-button:focus-visible,
.row-menu-button[aria-expanded="true"],
.folder-toggle-button:hover,
.folder-toggle-button:focus-visible,
.folder-toggle-button[aria-expanded="true"] {
  color: var(--text-primary);
  background: var(--bg-surface-secondary);
  border-color: var(--border-primary);
}

.conversation-header,
.messages,
.composer-shell {
  width: 100%;
  max-width: none;
}

.message {
  width: min(840px, 76%);
}

.message.assistant {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
}

.message.user .message-card {
  justify-self: end;
  width: fit-content;
  max-width: 100%;
  color: #ffffff;
  background: var(--primary-500);
  border-color: var(--primary-500);
}

.message.user .message-content,
.message.user .message-content p,
.message.user .message-content li,
.message.user .message-content strong,
.message.user .message-content em {
  color: #ffffff;
}

.message.user .message-meta {
  color: rgba(255, 255, 255, 0.82);
}

@media (max-width: 620px) {
  .conversation-header,
  .messages,
  .composer-shell,
  .message {
    width: 100%;
  }

  .sidebar-logo {
    width: 118px;
    max-width: 118px;
    max-height: 22px;
  }
}
