:root {
  color-scheme: light;
  --ink: #102a38;
  --muted: #607784;
  --line: rgba(37, 102, 128, 0.2);
  --panel: rgba(250, 254, 255, 0.91);
  --panel-strong: rgba(255, 255, 255, 0.97);
  --cyan: #d9f4ff;
  --cyan-strong: #8bd4ef;
  --blue: #235e94;
  --blue-deep: #163f69;
  --orange: #f2a25d;
  --secondary-ink: #3e5c6b;
  --content-surface: rgba(242, 250, 253, 0.82);
  --content-surface-strong: rgba(233, 247, 252, 0.92);
  --glass-surface: rgba(224, 244, 251, 0.66);
  --hairline: rgba(35, 91, 116, 0.1);
  --shadow: 0 24px 70px rgba(26, 73, 99, 0.2);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(46, 83, 101, 0.24) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(46, 83, 101, 0.24);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(46, 83, 101, 0.38);
}

*::-webkit-scrollbar-button,
*::-webkit-scrollbar-button:single-button,
*::-webkit-scrollbar-button:vertical:decrement,
*::-webkit-scrollbar-button:vertical:increment,
*::-webkit-scrollbar-button:horizontal:decrement,
*::-webkit-scrollbar-button:horizontal:increment,
*::-webkit-scrollbar-corner {
  -webkit-appearance: none;
  appearance: none;
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

/* Keep scrolling available while removing native Windows tracks and arrows. */
* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

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

body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: #dff5ff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(24, 104, 161, 0.52);
  outline-offset: 2px;
}

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

.background-mark {
  position: fixed;
  inset: -12%;
  z-index: -2;
  background:
    linear-gradient(rgba(213, 243, 255, 0.28), rgba(219, 244, 255, 0.46)),
    url("assets/babes-union-logo.png") center / 118% 118% no-repeat;
  filter: blur(20px) saturate(1.04);
  transform: scale(1.04);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, rgba(238, 251, 255, 0.12), rgba(118, 201, 232, 0.12) 50%, rgba(255, 229, 201, 0.08));
}

.auth-screen {
  display: grid;
  width: 100vw;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.auth-panel {
  width: min(440px, 100%);
  padding: 30px;
  border: 0;
  border-radius: 30px;
  background: var(--glass-surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
  backdrop-filter: blur(28px) saturate(1.25);
}

.auth-logo {
  display: block;
  width: min(300px, 86%);
  max-height: 185px;
  margin: 0 auto 18px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(20, 61, 88, 0.15));
}

.auth-panel h1 {
  margin: 0 0 8px;
  color: #173c50;
  font-size: 26px;
  text-align: center;
}

.auth-panel > p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.nickname-field > span,
.password-field > span {
  display: block;
  margin-bottom: 7px;
  color: rgba(73, 99, 111, 0.68);
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
}

.nickname-field {
  display: block;
}

.password-field {
  display: block;
  margin-top: 13px;
}

.nickname-field input,
.password-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 0;
  border-radius: 18px;
  outline: 0;
  background: rgba(250, 254, 255, 0.78);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 24px rgba(45, 93, 116, 0.08);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.nickname-field input::placeholder,
.password-field input::placeholder {
  color: rgba(67, 86, 95, 0.48);
}

.nickname-field input:focus,
.password-field input:focus {
  box-shadow: 0 0 0 3px rgba(78, 163, 203, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 24px rgba(45, 93, 116, 0.08);
}

.auth-panel .auth-error {
  min-height: 20px;
  margin: 8px 0 4px;
  color: #a73d35;
  font-size: 13px;
  text-align: left;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffbd73, #f08a36 56%, #d56524);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.auth-submit:hover {
  background: linear-gradient(135deg, #ffcb8d, #f59b4f 56%, #df762d);
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  width: min(1440px, calc(100vw - 40px));
  height: min(900px, calc(100vh - 40px));
  min-height: 620px;
  margin: 20px auto;
  overflow: hidden;
  background: rgba(231, 247, 252, 0.22);
  border: 0;
  border-radius: 26px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: rgba(224, 244, 251, 0.66);
  border-right: 0;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.42);
  -webkit-backdrop-filter: blur(24px) saturate(1.12);
  backdrop-filter: blur(24px) saturate(1.12);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 134px;
  overflow: hidden;
  padding: 0 24px;
}

.sidebar-brand img {
  display: block;
  width: 176px;
  height: 176px;
  flex: 0 0 176px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(30, 70, 100, 0.13));
}

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

.section-label {
  padding: 0 20px 10px;
  color: var(--secondary-ink);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.chat-list {
  min-height: 0;
  overflow-y: auto;
  padding: 0 10px;
}

.session-list-label {
  padding: 20px 10px 9px;
  color: var(--secondary-ink);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.chat-item {
  width: 100%;
  min-height: 48px;
  margin-bottom: 4px;
  padding: 9px 12px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.chat-item:hover {
  background: rgba(125, 188, 213, 0.13);
}

.chat-item.active {
  background: rgba(236, 248, 252, 0.88);
  border: 1px solid var(--hairline);
  box-shadow: none;
}

.chat-item-title,
.chat-item-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item-title {
  color: #173b4e;
  font-size: 14px;
  font-weight: 650;
}

.chat-item-meta {
  margin-top: 3px;
  color: #526d7a;
  font-size: 14px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 12px 20px;
  border-top: 0;
  color: var(--muted);
  font-size: 13px;
}

.signed-user {
  min-width: 0;
  flex: 1;
  min-height: 36px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid rgba(35, 91, 116, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.34);
  color: #425f6d;
  font-size: 14px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.signed-user:hover {
  color: var(--blue-deep);
  background: rgba(255, 255, 255, 0.54);
}

.logout-button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: #536f7c;
  font-size: 14px;
  cursor: pointer;
}

.logout-button:hover {
  color: #163f69;
  text-decoration: underline;
}

.logout-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.logout-status {
  margin: 0;
  padding: 0 20px 12px;
  color: #a43c37;
  font-size: 12px;
}

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

.chat-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 70px minmax(0, 1fr) auto;
  background: transparent;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 0 24px;
  border-bottom: 0;
  background: transparent;
}

.topbar .mode-switch {
  grid-area: 1 / 1;
  justify-self: center;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 360px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--glass-surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.mode-button {
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #536f7c;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.mode-button.active {
  background: rgba(248, 253, 255, 0.86);
  color: #154c68;
  box-shadow: 0 3px 12px rgba(30, 78, 99, 0.12);
}

.mobile-menu {
  display: none;
}

.conversation {
  width: min(820px, calc(100% - 48px));
  min-width: 0;
  margin: 0 auto;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 38px 0 28px;
}

.welcome {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0 34px;
  text-align: center;
}

.welcome h1 {
  max-width: 650px;
  margin: 0 0 9px;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.15;
}

.welcome p {
  max-width: 680px;
  margin: 0;
  color: var(--secondary-ink);
  line-height: 1.5;
}

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

.usage-card {
  --usage-angle: 274deg;
  --usage-middle-angle: 142deg;
  display: grid;
  justify-items: center;
  width: min(250px, 100%);
  margin-top: 24px;
  padding: 4px 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  text-align: center;
}

.usage-heading span {
  display: block;
  color: rgba(16, 42, 56, 0.48);
  font-size: 10px;
  font-weight: 600;
}

.usage-heading strong {
  display: block;
  margin-top: 2px;
  color: #173c50;
  font-size: 15px;
  font-weight: 650;
}

.usage-ring {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  margin: 12px 0 13px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(from 220deg, #ed8137 0deg, #ffd36d var(--usage-middle-angle), #dff4e7 var(--usage-angle), rgba(27, 70, 88, 0.14) var(--usage-angle));
}

.usage-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: rgba(239, 249, 252, 0.92);
}

.usage-ring-center {
  position: relative;
  z-index: 1;
  display: grid;
  place-content: center;
  text-align: center;
}

.usage-ring-center strong {
  color: #173c50;
  font-size: 35px;
  font-weight: 500;
  line-height: 1;
}

.usage-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  gap: 6px;
}

.usage-stats > div {
  min-width: 0;
  padding: 8px 7px;
  border-radius: 11px;
  background: rgba(239, 249, 252, 0.46);
}

.usage-stats span {
  display: block;
  overflow: hidden;
  color: rgba(16, 42, 56, 0.48);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-stats strong {
  display: block;
  margin-top: 2px;
  color: rgba(16, 42, 56, 0.78);
  font-size: 14px;
  font-weight: 600;
}

.command-card {
  min-height: 88px;
  padding: 14px 16px;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  background: var(--content-surface);
  box-shadow: none;
  text-align: center;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.command-card:hover {
  transform: translateY(-2px);
  background: var(--content-surface-strong);
}

.command-card strong,
.command-card span {
  display: block;
}

.command-card strong {
  color: #16435a;
  font-size: 14px;
  line-height: 1.3;
  white-space: pre-line;
}

.command-card span {
  margin-top: 4px;
  color: var(--secondary-ink);
  font-size: 12px;
  line-height: 1.35;
}

.message-row {
  display: flex;
  min-width: 0;
  margin-bottom: 18px;
  gap: 12px;
}

.message-row.user {
  justify-content: flex-end;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: #e6f7ff;
}

.avatar img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.message {
  max-width: min(680px, 82%);
  min-width: 0;
  padding: 13px 16px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--content-surface);
  box-shadow: none;
  font-size: 17px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-row.user .message {
  background: rgba(213, 240, 249, 0.94);
  border-radius: 18px 18px 5px 18px;
}

.message-row.assistant .message {
  width: min(680px, 100%);
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.message-row.user .message.has-image {
  padding: 0;
  border: 0;
  background: transparent;
}

.message-row.user .message.has-image .message-text {
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: 18px 18px 5px 18px;
  background: rgba(213, 240, 249, 0.94);
}

.message-image-button {
  display: block;
  width: min(224px, 70vw);
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(215, 237, 246, 0.52);
  cursor: pointer;
}

.message-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-dialog {
  width: min(100vw, 760px);
  max-width: 100vw;
  max-height: 100dvh;
  padding: 44px 12px 12px;
  border: 0;
  background: transparent;
  text-align: center;
}

.image-dialog::backdrop {
  background: rgba(10, 24, 32, 0.88);
}

.image-dialog img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 70px);
  margin: 0 auto;
  object-fit: contain;
}

.image-dialog-close {
  position: absolute;
  top: 4px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 27px;
  cursor: pointer;
}

.message-text {
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  min-height: 30px;
  margin-top: 5px;
}

.copy-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #647b86;
  cursor: pointer;
}

.copy-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-button:hover,
.copy-button:focus-visible {
  background: rgba(87, 130, 149, 0.12);
}

.reply-option {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(35, 91, 116, 0.16);
  border-radius: 6px;
  background: rgba(245, 251, 253, 0.58);
}

.reply-option-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}

.reply-option p {
  margin: 0;
}

.reply-option .reply-translation {
  margin-top: 5px;
  color: var(--secondary-ink);
}

.typing {
  color: var(--secondary-ink);
}

.composer-wrap {
  width: min(860px, calc(100% - 48px));
  min-width: 0;
  margin: 0 auto;
  padding: 0 0 18px;
}

.quick-actions {
  display: flex;
  overflow-x: auto;
  padding: 3px 0 9px;
  gap: 7px;
  scrollbar-width: none;
}

.quick-actions:empty {
  display: none;
}

.quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-action {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(239, 249, 252, 0.9);
  color: #244f64;
  font-size: 14px;
  cursor: pointer;
}

.quick-action:hover {
  background: rgba(250, 254, 255, 0.96);
}

.composer {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 7px;
}

.composer-input {
  min-width: 0;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  background: rgba(235, 247, 251, 0.79);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.composer-input:focus-within {
  border-color: rgba(45, 116, 146, 0.55);
}

.composer textarea {
  width: 100%;
  max-height: 150px;
  min-height: 42px;
  resize: none;
  padding: 10px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.4;
  font-size: 16px;
}

.composer textarea::placeholder {
  color: #8497a0;
}

.send-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #395a68;
  color: #fff;
  cursor: pointer;
}

.send-button:hover {
  background: #254653;
}

.send-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send-button.is-idle {
  background: rgba(57, 90, 104, 0.5);
  color: #fff;
}

.send-button.is-idle:hover {
  background: rgba(57, 90, 104, 0.65);
}

.send-button:disabled {
  background: #9aabb3;
  cursor: not-allowed;
  opacity: 0.72;
}

.composer textarea:disabled {
  cursor: not-allowed;
}

.attach-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(235, 247, 251, 0.79);
  color: #264d5e;
  cursor: pointer;
}

.attach-button:hover {
  background: rgba(92, 130, 147, 0.22);
}

.attach-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.attachment-preview {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  min-width: 0;
  gap: 9px;
  padding: 4px 6px;
}

.attachment-preview.is-hidden {
  display: none;
}

.attachment-preview img {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
}

.attachment-preview span {
  flex: 1;
  overflow: hidden;
  color: var(--secondary-ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--secondary-ink);
  font-size: 22px;
  cursor: pointer;
}

.attachment-status {
  margin: 4px 8px 0;
  color: #a43c37;
  font-size: 12px;
}

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

.composer-note {
  margin: 7px 0 0;
  color: rgba(47, 85, 102, 0.58);
  font-size: 12px;
  text-align: center;
}

.sidebar-scrim {
  display: none;
}

.account-dialog {
  width: min(430px, calc(100vw - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  background: rgba(231, 247, 252, 0.92);
  box-shadow: 0 26px 80px rgba(18, 54, 72, 0.28);
  color: var(--ink);
  -webkit-backdrop-filter: blur(28px) saturate(1.14);
  backdrop-filter: blur(28px) saturate(1.14);
}

.account-dialog::backdrop {
  background: rgba(22, 52, 67, 0.3);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.password-change-form {
  padding: 24px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-kicker {
  margin: 0 0 4px;
  color: #54717e;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 24px;
}

.dialog-close {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
}

.dialog-close::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
}

.dialog-close::after {
  content: "×";
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  place-items: center;
  color: rgba(49, 90, 110, 0.62);
  font-size: 18px;
  font-weight: 500;
}

.dialog-copy {
  margin: 12px 0 20px;
  color: rgba(62, 92, 107, 0.62);
  font-size: 13px;
  line-height: 1.45;
}

.dialog-field {
  display: block;
  margin-top: 13px;
}

.dialog-field span {
  display: block;
  margin-bottom: 7px;
  color: #4c6875;
  font-size: 14px;
  font-weight: 700;
}

.dialog-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 0;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.dialog-field input:focus,
.dialog-field input:focus-visible {
  outline: 0;
  border: 0;
  box-shadow: none;
}

.dialog-status {
  min-height: 21px;
  margin: 10px 0 5px;
  color: #8d392d;
  font-size: 14px;
}

.dialog-submit {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffbd73, #f08a36 56%, #d56524);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

@media (max-width: 880px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    position: fixed;
    top: var(--visual-viewport-top, 0px);
    left: 0;
    grid-template-columns: minmax(0, 1fr);
    width: 100vw;
    height: var(--visual-viewport-height, 100dvh);
    min-height: 0;
    margin: 0;
    padding-top: env(safe-area-inset-top);
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(310px, 86vw);
    transform: translateX(-102%);
    box-shadow: 20px 0 50px rgba(20, 57, 76, 0.22);
    background: rgba(222, 243, 250, 0.97);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    padding-top: env(safe-area-inset-top);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    transition: transform 150ms ease-out;
  }

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

  .sidebar-scrim.visible {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(20, 51, 66, 0.18);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 0 12px;
  }

  .mobile-menu {
    display: grid;
    grid-area: 1 / 1;
    justify-self: start;
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 11px;
    place-content: center;
    gap: 4px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.54);
    cursor: pointer;
  }

  .mobile-menu span {
    display: block;
    width: 16px;
    height: 2px;
    background: #315a6e;
  }

  .mode-switch {
    min-width: 0;
    width: min(410px, calc(100% - 64px));
    justify-self: center;
  }

  .mode-button {
    padding: 7px 8px;
  }

  .mode-switch {
    -webkit-backdrop-filter: blur(14px) saturate(1.08);
    backdrop-filter: blur(14px) saturate(1.08);
  }
}

@media (max-width: 560px) {
  .auth-screen {
    padding: 14px;
  }

  .auth-panel {
    padding: 24px 18px;
  }

  .auth-logo {
    width: 250px;
    max-height: 165px;
  }

  .chat-panel {
    grid-template-rows: 56px minmax(0, 1fr) auto;
  }

  .topbar {
    padding: 0 8px;
  }

  .mobile-menu {
    width: 36px;
    height: 36px;
  }

  .mode-switch {
    width: calc(100% - 46px);
    margin-left: 40px;
  }

  .mode-switch {
    padding: 3px;
  }

  .mode-button {
    min-height: 40px;
    padding: 5px 3px;
    font-size: 12px;
  }

  .conversation {
    width: calc(100% - 24px);
    padding: 8px 0 12px;
  }

  .welcome {
    justify-content: flex-start;
    padding: 4px 0 10px;
  }

  .welcome h1 {
    margin: 4px 0 5px;
    font-size: 20px;
  }

  .welcome p {
    font-size: 12px;
    line-height: 1.35;
  }

  .command-grid {
    grid-template-columns: 1fr;
    margin-top: 12px;
    gap: 6px;
  }

  .usage-card {
    width: 190px;
    margin-top: 12px;
    padding: 0 8px;
  }

  .usage-ring {
    width: 76px;
    height: 76px;
    margin: 6px 0;
  }

  .usage-ring-center strong {
    font-size: 25px;
  }

  .usage-stats > div {
    padding: 5px 6px;
  }

  .command-card {
    min-height: 58px;
    padding: 7px 10px;
    border-radius: 15px;
  }

  .command-card strong {
    font-size: 12px;
    line-height: 1.2;
  }

  .command-card span {
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.2;
  }

  .message-row {
    gap: 7px;
    margin-bottom: 10px;
  }

  .avatar {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .avatar img {
    width: 26px;
    height: 26px;
  }

  .message {
    max-width: 84%;
    padding: 9px 11px;
    font-size: 17px;
    line-height: 1.35;
  }

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

  .quick-actions {
    min-width: 0;
    padding-bottom: 5px;
  }

  .quick-action {
    min-height: 32px;
    max-width: min(72vw, 250px);
    padding: 5px 9px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  .composer textarea {
    min-height: 34px;
    padding: 7px 0;
    font-size: 16px;
  }

  .send-button {
    width: 42px;
    height: 42px;
  }

  .attach-button {
    width: 42px;
    height: 42px;
  }

  .composer-note {
    display: none;
  }
}

@media (max-width: 560px) and (max-height: 650px) {
  .chat-panel {
    grid-template-rows: 48px minmax(0, 1fr) auto;
  }

  .welcome > p {
    display: none;
  }

  .usage-card {
    margin-top: 7px;
  }

  .usage-ring {
    width: 58px;
    height: 58px;
    margin: 4px 0;
  }

  .usage-ring::before {
    inset: 5px;
  }

  .usage-ring-center strong {
    font-size: 21px;
  }

  .command-grid {
    margin-top: 8px;
    gap: 4px;
  }

  .command-card {
    min-height: 48px;
    padding: 5px 8px;
  }
}

@media (prefers-contrast: more) {
  :root {
    --content-surface: rgba(251, 254, 255, 0.97);
    --content-surface-strong: #fff;
    --glass-surface: rgba(238, 249, 253, 0.94);
    --hairline: rgba(18, 69, 92, 0.34);
  }

  .sidebar,
  .mode-switch,
  .auth-panel {
    background: var(--glass-surface);
  }
}

@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  .auth-panel,
  .app-shell,
  .sidebar,
  .mode-switch {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #eef9fd;
  }
}

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