:root {
  color-scheme: only light;
  --input-focus: #1f924f;
  --brand-green: #1f924f;
  --brand-green-soft: #63b285;
  --font-color: #212529;
  --font-color-sub: rgba(33, 37, 41, 0.68);
  --bg-color: #ffffff;
  --bg-color-alt: #f7f8fb;
  --main-color: #212529;
  --shadow: 5px 5px 0 var(--main-color);
  --paper-grid:
    linear-gradient(rgba(33, 37, 41, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 37, 41, 0.045) 1px, transparent 1px),
    #f3f6f5;
  --paper-grid-size: 46px 46px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  forced-color-adjust: none;
}

html {
  color-scheme: only light;
  touch-action: pan-x pan-y;
  overscroll-behavior: none;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
  background: var(--paper-grid);
  background-size: var(--paper-grid-size);
  color: var(--font-color);
  color-scheme: only light;
  font-family:
    Inter, Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.is-app-mode {
  background: var(--paper-grid);
  background-size: var(--paper-grid-size);
}

body.is-app-mode.is-chat-mode {
  background: var(--paper-grid);
  background-size: var(--paper-grid-size);
}

.animated-background {
  --pattern-0: #ffffff;
  --pattern-1: #101416;
  --pattern-2: #1d2427;
  --pattern-3: #293236;
  --pattern-4: #343f43;
  --pattern-5: #fecd62;
  --pattern-6: #1f924f;
  --pattern-7: #187a42;
  --pattern-8: #63b285;
  --pattern-9: #bfe5ce;
  --pattern-eye: #ff3131;
  --pattern-eye-glow: rgba(255, 49, 49, 0.95);
  position: fixed;
  inset: 0;
  z-index: 0;
  isolation: isolate;
  display: none;
  overflow: hidden;
  pointer-events: none;
  background-color: var(--pattern-1);
  background-image:
    linear-gradient(to top, var(--pattern-2) 5%, var(--pattern-1) 6%, var(--pattern-1) 7%, transparent 7%),
    linear-gradient(to bottom, var(--pattern-1) 30%, transparent 80%),
    linear-gradient(to right, var(--pattern-2), var(--pattern-4) 5%, transparent 5%),
    linear-gradient(to right, transparent 6%, var(--pattern-2) 6%, var(--pattern-4) 9%, transparent 9%),
    linear-gradient(to right, transparent 27%, var(--pattern-2) 27%, var(--pattern-4) 34%, transparent 34%),
    linear-gradient(to right, transparent 51%, var(--pattern-2) 51%, var(--pattern-4) 57%, transparent 57%),
    linear-gradient(to bottom, var(--pattern-1) 35%, transparent 35%),
    linear-gradient(to right, transparent 42%, var(--pattern-2) 42%, var(--pattern-4) 44%, transparent 44%),
    linear-gradient(to right, transparent 45%, var(--pattern-2) 45%, var(--pattern-4) 47%, transparent 47%),
    linear-gradient(to right, transparent 48%, var(--pattern-2) 48%, var(--pattern-4) 50%, transparent 50%),
    linear-gradient(to right, transparent 87%, var(--pattern-2) 87%, var(--pattern-4) 91%, transparent 91%),
    linear-gradient(to bottom, var(--pattern-1) 37.5%, transparent 37.5%),
    linear-gradient(to right, transparent 14%, var(--pattern-2) 14%, var(--pattern-4) 20%, transparent 20%),
    linear-gradient(to bottom, var(--pattern-1) 40%, transparent 40%),
    linear-gradient(to right, transparent 10%, var(--pattern-2) 10%, var(--pattern-4) 13%, transparent 13%),
    linear-gradient(to right, transparent 21%, var(--pattern-2) 21%, #151a1c 25%, transparent 25%),
    linear-gradient(to right, transparent 58%, var(--pattern-2) 58%, var(--pattern-4) 64%, transparent 64%),
    linear-gradient(to right, transparent 92%, var(--pattern-2) 92%, var(--pattern-4) 95%, transparent 95%),
    linear-gradient(to bottom, var(--pattern-1) 48%, transparent 48%),
    linear-gradient(to right, transparent 96%, var(--pattern-2) 96%, #151a1c 99%, transparent 99%),
    linear-gradient(to bottom, transparent 68.5%, transparent 76%, var(--pattern-1) 76%, var(--pattern-1) 77.5%, transparent 77.5%, transparent 86%, var(--pattern-1) 86%, var(--pattern-1) 87.5%, transparent 87.5%),
    linear-gradient(to right, transparent 35%, var(--pattern-2) 35%, var(--pattern-4) 41%, transparent 41%),
    linear-gradient(to bottom, var(--pattern-1) 68%, transparent 68%),
    linear-gradient(to right, transparent 78%, var(--pattern-3) 78%, var(--pattern-3) 80%, transparent 80%, transparent 82%, var(--pattern-3) 82%, var(--pattern-3) 83%, transparent 83%),
    linear-gradient(to right, transparent 66%, var(--pattern-2) 66%, var(--pattern-4) 85%, transparent 85%);
  background-position: center bottom;
  background-size: 300px 150px;
}

body.is-app-mode.is-start-mode .animated-background {
  display: none;
}

.animated-background::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background-color: var(--pattern-1);
  background-image:
    linear-gradient(to top, var(--pattern-5) 5%, var(--pattern-1) 6%, var(--pattern-1) 7%, transparent 7%),
    linear-gradient(to bottom, var(--pattern-1) 30%, transparent 30%),
    linear-gradient(to right, var(--pattern-6), var(--pattern-7) 5%, transparent 5%),
    linear-gradient(to right, transparent 6%, var(--pattern-8) 6%, var(--pattern-9) 9%, transparent 9%),
    linear-gradient(to right, transparent 27%, #63b285 27%, #1f924f 34%, transparent 34%),
    linear-gradient(to right, transparent 51%, #fecd62 51%, #d69c22 57%, transparent 57%),
    linear-gradient(to bottom, var(--pattern-1) 35%, transparent 35%),
    linear-gradient(to right, transparent 42%, #6badc3 42%, #317e98 44%, transparent 44%),
    linear-gradient(to right, transparent 45%, #6badc3 45%, #317e98 47%, transparent 47%),
    linear-gradient(to right, transparent 48%, #6badc3 48%, #317e98 50%, transparent 50%),
    linear-gradient(to right, transparent 87%, #a8b1b5 87%, #6b777c 91%, transparent 91%),
    linear-gradient(to bottom, var(--pattern-1) 37.5%, transparent 37.5%),
    linear-gradient(to right, transparent 14%, #fecd62 14%, #d69c22 20%, transparent 20%),
    linear-gradient(to bottom, var(--pattern-1) 40%, transparent 40%),
    linear-gradient(to right, transparent 10%, #63b285 10%, #1f924f 13%, transparent 13%),
    linear-gradient(to right, transparent 21%, #de7a96 21%, #a84c68 25%, transparent 25%),
    linear-gradient(to right, transparent 58%, #1f924f 58%, #187a42 64%, transparent 64%),
    linear-gradient(to right, transparent 92%, #2f4f4f 92%, #1c2f2f 95%, transparent 95%),
    linear-gradient(to bottom, var(--pattern-1) 48%, transparent 48%),
    linear-gradient(to right, transparent 96%, #2f4f4f 96%, #1c2f2f 99%, transparent 99%),
    linear-gradient(to bottom, transparent 68.5%, transparent 76%, var(--pattern-1) 76%, var(--pattern-1) 77.5%, transparent 77.5%, transparent 86%, var(--pattern-1) 86%, var(--pattern-1) 87.5%, transparent 87.5%),
    linear-gradient(to right, transparent 35%, #bfe5ce 35%, #63b285 41%, transparent 41%),
    linear-gradient(to bottom, var(--pattern-1) 68%, transparent 68%),
    linear-gradient(to right, transparent 78%, #bfe5ce 78%, #bfe5ce 80%, transparent 80%, transparent 82%, #bfe5ce 82%, #bfe5ce 83%, transparent 83%),
    linear-gradient(to right, transparent 66%, #1f924f 66%, #187a42 85%, transparent 85%);
  background-position: center bottom;
  background-size: 300px 150px;
  clip-path: circle(150px at center center);
  animation: bs-flashlight 20s ease infinite;
}

.animated-background::after {
  position: absolute;
  left: calc(50% + 59px);
  bottom: 100px;
  z-index: 2;
  content: "";
  width: 25px;
  height: 10px;
  filter: drop-shadow(0 0 5px var(--pattern-eye-glow));
  background-repeat: no-repeat;
  background-image:
    radial-gradient(circle, var(--pattern-eye) 50%, transparent 50%),
    radial-gradient(circle, var(--pattern-eye) 50%, transparent 50%);
  background-position:
    left center,
    right center;
  background-size: 10px 10px;
  animation: bs-signal-dots 20s infinite;
}

.auth-shell,
.app-shell {
  position: relative;
  z-index: 1;
}

@keyframes bs-flashlight {
  0% {
    clip-path: circle(150px at -25% 10%);
  }

  38% {
    clip-path: circle(150px at 60% 20%);
  }

  39% {
    opacity: 1;
    clip-path: circle(150px at 60% 86%);
  }

  40% {
    opacity: 0;
    clip-path: circle(150px at 60% 86%);
  }

  41% {
    opacity: 1;
    clip-path: circle(150px at 60% 86%);
  }

  42%,
  54% {
    opacity: 0;
    clip-path: circle(150px at 60% 86%);
  }

  55%,
  59% {
    opacity: 1;
    clip-path: circle(150px at 60% 86%);
  }

  64% {
    clip-path: circle(150px at 45% 78%);
  }

  68% {
    clip-path: circle(150px at 85% 89%);
  }

  72%,
  74% {
    clip-path: circle(150px at 60% 86%);
  }

  100% {
    clip-path: circle(150px at 150% 50%);
  }
}

@keyframes bs-signal-dots {
  0%,
  38% {
    opacity: 0;
  }

  39%,
  41% {
    opacity: 1;
    transform: scaleY(1);
  }

  40% {
    transform: scaleY(0);
    filter: none;
    background-image:
      radial-gradient(circle, var(--pattern-eye) 50%, transparent 50%),
      radial-gradient(circle, var(--pattern-eye) 50%, transparent 50%);
  }

  41% {
    transform: scaleY(1);
    background-image:
      radial-gradient(circle, var(--pattern-eye) 50%, transparent 50%),
      radial-gradient(circle, var(--pattern-eye) 50%, transparent 50%);
    filter: drop-shadow(0 0 5px var(--pattern-eye-glow));
  }

  42%,
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .animated-background::before,
  .animated-background::after {
    animation: none;
  }
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
}

.auth-panel {
  display: grid;
  min-width: 0;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.wrapper {
  --card-width: min(420px, calc(100vw - 48px));
  display: grid;
  width: min(100%, 460px);
  justify-items: center;
  color: var(--font-color);
}

.auth-logo {
  display: block;
  width: min(190px, 58vw);
  height: auto;
  margin: 0 0 34px;
}

.card-switch {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 26px;
  width: 100%;
}

.switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 28px;
}

.card-side {
  position: absolute;
  inset: 0;
}

.card-side::before,
.card-side::after {
  position: absolute;
  top: 2px;
  width: 104px;
  color: var(--font-color);
  font-weight: 900;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.card-side::before {
  right: 74px;
  content: "Вход";
  text-align: right;
  text-decoration-line: underline;
}

.card-side::after {
  left: 74px;
  content: "Регистрация";
  text-decoration-line: none;
}

.toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: var(--bg-color);
  border: 2px solid var(--main-color);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--main-color);
  transition: background-color 0.25s ease;
}

.slider::before {
  position: absolute;
  left: -2px;
  bottom: 3px;
  width: 22px;
  height: 22px;
  content: "";
  background-color: var(--bg-color);
  border: 2px solid var(--main-color);
  border-radius: 6px;
  box-shadow: 0 3px 0 var(--main-color);
  transition: transform 0.25s ease;
}

.toggle:focus-visible + .switch .slider {
  outline: 3px solid rgba(31, 146, 79, 0.35);
  outline-offset: 7px;
}

.toggle:checked + .switch .slider {
  background-color: var(--input-focus);
}

.toggle:checked + .switch .slider::before {
  transform: translateX(34px);
}

.toggle:checked + .switch .card-side::before {
  text-decoration-line: none;
}

.toggle:checked + .switch .card-side::after {
  text-decoration-line: underline;
}

.flip-card__inner {
  position: relative;
  width: var(--card-width);
  height: 560px;
  perspective: 1000px;
  text-align: center;
  transition: transform 0.78s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}

.toggle:checked ~ .flip-card__inner {
  transform: rotateY(180deg);
}

.flip-card__front,
.flip-card__back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 38px 34px;
  background: #e9edf5;
  border: 2px solid var(--main-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backface-visibility: hidden;
}

.flip-card__back {
  transform: rotateY(180deg);
}

.flip-card__form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.verify-head {
  display: grid;
  gap: 6px;
  margin: 0 0 6px;
  text-align: left;
}

.verify-head strong {
  color: var(--main-color);
  font-size: 21px;
  font-weight: 950;
  line-height: 1.08;
}

.verify-head span {
  color: var(--font-color-sub);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.verify-copy {
  margin: 0 0 8px;
  color: var(--font-color-sub);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.verify-copy strong {
  color: var(--font-color);
}

.title {
  margin: 0 0 20px;
  color: var(--main-color);
  font-size: 29px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
}

.field-label {
  color: var(--font-color-sub);
  font-size: 13px;
  font-weight: 850;
  text-align: left;
}

.flip-card__input {
  width: 100%;
  height: 44px;
  padding: 7px 12px;
  background-color: var(--bg-color);
  border: 2px solid var(--main-color);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--main-color);
  color: var(--font-color);
  font-size: 15px;
  font-weight: 700;
  outline: none;
}

.flip-card__input::placeholder {
  color: var(--font-color-sub);
  opacity: 0.82;
}

.flip-card__input:focus {
  border-color: var(--input-focus);
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field .flip-card__input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  display: inline-grid;
  width: 30px;
  height: 30px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  color: var(--main-color);
  place-items: center;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--accent-color);
  outline: none;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.password-toggle__slash {
  opacity: 0;
}

.password-toggle[aria-pressed="true"] .password-toggle__slash {
  opacity: 1;
}

.flip-card__btn {
  align-self: center;
  width: 176px;
  height: 44px;
  margin: 14px 0 0;
  cursor: pointer;
  background-color: var(--brand-green);
  border: 2px solid var(--main-color);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--main-color);
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
}

.flip-card__btn:hover {
  background-color: #187a42;
}

.flip-card__btn:active {
  box-shadow: 0 0 0 var(--main-color);
  transform: translate(4px, 4px);
}

.social-auth {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: center;
  width: 100%;
  gap: 12px;
  margin-top: 18px;
}

.social-auth__button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  height: 54px;
  padding: 0 14px;
  cursor: pointer;
  background: #ffffff;
  border: 2px solid #e4e7eb;
  border-radius: 14px;
  color: #111111;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.social-auth__button svg {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
}

.social-auth__button:hover {
  border-color: rgba(33, 37, 41, 0.22);
  box-shadow: 0 8px 22px rgba(33, 37, 41, 0.08);
  transform: translateY(-1px);
}

.social-auth__button:focus-visible {
  outline: 3px solid rgba(31, 146, 79, 0.28);
  outline-offset: 4px;
}

.social-auth__button:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.social-auth__button:disabled:hover {
  border-color: #e4e7eb;
  box-shadow: none;
  transform: none;
}

.ghost-button {
  align-self: center;
  padding: 0;
  cursor: pointer;
  background: none;
  border: 0;
  color: var(--font-color-sub);
  font-size: 14px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--font-color-sub);
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}

.form-status[data-state="success"] {
  color: var(--brand-green);
}

.form-status[data-state="error"] {
  color: #c03d3d;
}

.app-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 22px;
  padding: 20px;
  background: #ffffff;
  border-right: 2px solid var(--main-color);
}

.app-mark {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.app-mark__image {
  display: block;
  width: 62px;
  height: auto;
}

.app-mark__text {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--font-color);
  line-height: 1;
}

.app-mark__text strong {
  font-size: 22px;
  font-weight: 950;
}

.app-mark__text span {
  color: var(--font-color-sub);
  font-size: 16px;
  font-weight: 900;
}

.user-box strong {
  display: block;
  color: var(--font-color);
  font-size: 16px;
  line-height: 1.1;
}

.user-box small {
  display: block;
  margin-top: 3px;
  color: var(--font-color-sub);
  font-size: 12px;
  font-weight: 800;
}

.app-nav {
  display: grid;
  gap: 8px;
}

.app-nav__item,
.outline-button,
.send-button {
  min-height: 40px;
  cursor: pointer;
  background: var(--bg-color);
  border: 2px solid var(--main-color);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--main-color);
  color: var(--font-color);
  font-size: 15px;
  font-weight: 900;
}

.app-nav__item {
  width: 100%;
  text-align: left;
  padding: 0 12px;
}

.app-nav__item.is-active {
  background: #bfe5ce;
}

.app-nav__item:active,
.outline-button:active,
.send-button:active {
  box-shadow: 0 0 0 var(--main-color);
  transform: translate(4px, 4px);
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 12px;
  background: #e9edf5;
  border: 2px solid var(--main-color);
  border-radius: 8px;
}

.user-avatar {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  background: #fecd62;
  border: 2px solid var(--main-color);
  border-radius: 50%;
  color: var(--font-color);
  font-weight: 950;
}

.app-workspace {
  min-width: 0;
  padding: 22px 24px;
}

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

.workspace-kicker,
.panel-kicker {
  margin: 0 0 6px;
  color: var(--brand-green);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace-header h1,
.panel-head h2 {
  margin: 0;
  color: var(--font-color);
  letter-spacing: 0;
}

.workspace-header h1 {
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1;
}

.workspace-subtitle {
  max-width: 560px;
  margin: 8px 0 0;
  color: var(--font-color-sub);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.35;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.outline-button {
  min-width: 96px;
  padding: 0 16px;
}

.chat-panel,
.training-panel {
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 520px;
  height: calc(100vh - 132px);
  gap: 16px;
  align-items: stretch;
}

.chat-panel,
.training-panel {
  min-width: 0;
  padding: 16px;
}

.chat-panel {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.panel-head h2 {
  font-size: 22px;
  line-height: 1;
}

.panel-note {
  display: block;
  margin-top: 6px;
  color: var(--font-color-sub);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.chat-log {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(33, 37, 41, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(33, 37, 41, 0.035) 1px, transparent 1px),
    #f7f8fb;
  background-size: 26px 26px;
  border: 2px solid var(--main-color);
  border-radius: 8px;
}

.message {
  max-width: min(76%, 540px);
  padding: 12px 14px;
  border: 2px solid var(--main-color);
  border-radius: 8px;
  color: var(--font-color);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.48;
  overflow-wrap: anywhere;
  white-space: normal;
}

.message.bot {
  align-self: flex-start;
  background: #e9edf5;
}

.message.user {
  align-self: flex-end;
  background: #bfe5ce;
  font-weight: 750;
}

.message.has-code {
  width: min(78%, 760px);
}

.message-body {
  display: grid;
  gap: 12px;
}

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

.message-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  padding-top: 2px;
}

.message-materials__label {
  flex: 0 0 auto;
  max-width: 100%;
  color: var(--font-color-sub);
  font-size: 12px;
  font-weight: 850;
}

.message-materials__chip {
  display: inline-flex;
  flex: 0 1 auto;
  max-width: min(230px, 100%);
  min-width: 0;
  min-height: 24px;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  padding: 3px 9px;
  background: rgba(191, 229, 206, 0.55);
  border: 1px solid rgba(31, 146, 79, 0.35);
  border-radius: 999px;
  color: #176b3a;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.message-action-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--font-color);
  opacity: 0.68;
}

.message-action-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-action-button:hover {
  background: rgba(255, 255, 255, 0.72);
  opacity: 1;
}

.message-action-button:focus-visible {
  outline: 3px solid rgba(31, 146, 79, 0.35);
  outline-offset: 2px;
}

.code-block {
  min-width: 0;
  overflow: hidden;
  background: #fbfcff;
  border: 2px solid var(--main-color);
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(33, 37, 41, 0.95);
}

.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: #ffffff;
  border-bottom: 2px solid var(--main-color);
}

.code-block__language {
  font-size: 12px;
  font-weight: 950;
}

.code-block pre {
  max-width: 100%;
  margin: 0;
  overflow: auto;
  padding: 14px;
  color: #1f2933;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  white-space: pre;
}

.message.loading-message {
  display: grid;
  width: 180px;
  height: 82px;
  place-items: center;
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  white-space: normal;
}

.message.loading-message .inline-loader {
  position: relative;
  top: auto;
  left: auto;
  display: block;
  width: 164px;
  height: 66px;
  opacity: 1;
  transform: none;
  transform-origin: center;
  transition: none;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 10px;
}

.chat-input {
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  resize: none;
  overflow-y: hidden;
  background: var(--bg-color);
  border: 2px solid var(--main-color);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--main-color);
  color: var(--font-color);
  font: inherit;
  font-weight: 750;
  line-height: 1.25;
  outline: none;
}

.chat-input:focus {
  border-color: var(--input-focus);
}

.send-button {
  background: var(--brand-green);
  color: #ffffff;
}

.training-panel {
  display: grid;
  align-content: start;
  height: 100%;
  gap: 14px;
  overflow: auto;
}

.upload-zone {
  position: relative;
  display: grid;
  min-height: 120px;
  place-items: center;
  padding: 20px;
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(31, 146, 79, 0.15), transparent 55%),
    #f7f8fb;
  border: 2px dashed var(--main-color);
  border-radius: 8px;
  text-align: center;
}

.upload-zone:hover,
.training-panel.is-loading .upload-zone {
  background: #edf7f1;
}

.upload-zone__content {
  display: block;
}

.upload-zone__title,
.upload-zone__text {
  display: block;
}

.upload-zone__title {
  font-size: 18px;
  font-weight: 950;
}

.upload-zone__text {
  margin-top: 6px;
  color: var(--font-color-sub);
  font-size: 13px;
  font-weight: 850;
}

.training-panel.is-loading .upload-zone__content {
  opacity: 0;
}

.training-panel.is-loading .upload-loader {
  opacity: 1;
  transform: translate(-50%, -50%);
}

@keyframes loader-bounce {
  0% {
    top: 54px;
    height: 6px;
    border-radius: 50px 50px 24px 24px;
    transform: scaleX(1.7);
  }

  40% {
    height: 22px;
    border-radius: 50%;
    transform: scaleX(1);
  }

  100% {
    top: 0;
  }
}

@keyframes loader-shadow {
  0% {
    transform: scaleX(1.5);
  }

  40% {
    opacity: 0.64;
    transform: scaleX(1);
  }

  100% {
    opacity: 0.32;
    transform: scaleX(0.22);
  }
}

.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 164px;
  height: 66px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.loader-ball {
  position: absolute;
  left: 14%;
  width: 22px;
  height: 22px;
  background: var(--brand-green);
  border: 2px solid var(--main-color);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--main-color);
  transform-origin: 50%;
  animation: loader-bounce 0.54s alternate infinite ease;
}

.loader-ball:nth-of-type(2) {
  left: 45%;
  animation-delay: 0.18s;
  background: #fecd62;
}

.loader-ball:nth-of-type(3) {
  right: 14%;
  left: auto;
  animation-delay: 0.3s;
  background: #de7a96;
}

.loader-shadow {
  position: absolute;
  top: 62px;
  left: 14%;
  z-index: -1;
  width: 22px;
  height: 5px;
  background: rgba(33, 37, 41, 0.7);
  border-radius: 50%;
  filter: blur(1px);
  transform-origin: 50%;
  animation: loader-shadow 0.54s alternate infinite ease;
}

.loader-shadow:nth-of-type(5) {
  left: 45%;
  animation-delay: 0.18s;
}

.loader-shadow:nth-of-type(6) {
  right: 14%;
  left: auto;
  animation-delay: 0.3s;
}

@media (prefers-reduced-motion: reduce) {
  .loader-ball,
  .loader-shadow {
    animation: none;
  }

  .loader-ball {
    top: 22px;
  }

  .loader-shadow {
    opacity: 0.45;
    transform: scaleX(0.7);
  }
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.file-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.file-list-head strong {
  font-size: 15px;
}

.empty-files {
  margin: 0;
  color: var(--font-color-sub);
  font-size: 14px;
  font-weight: 750;
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 34px;
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: #e9edf5;
  border: 2px solid var(--main-color);
  border-radius: 8px;
}

.file-item__main {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.file-item strong,
.file-item__meta,
.file-item__error {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item strong {
  font-size: 14px;
}

.file-item__meta,
.file-item__error {
  color: var(--font-color-sub);
  font-size: 12px;
  font-weight: 850;
}

.file-item__error {
  color: #9a3412;
}

.file-status {
  min-width: 74px;
  padding: 5px 8px;
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 999px;
  color: var(--font-color-sub);
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.file-status--ready {
  background: #dff5e7;
  border-color: #97d4ab;
  color: #14783b;
}

.file-status--no_text {
  background: #fff3cf;
  border-color: #f2cc76;
  color: #8a5a00;
}

.file-status--unsupported,
.file-status--error {
  background: #ffe1dd;
  border-color: #efb0a6;
  color: #a93424;
}

.file-delete-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  cursor: pointer;
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 6px;
  color: var(--main-color);
  font-size: 24px;
  font-weight: 950;
  line-height: 1;
}

.file-delete-button:hover {
  background: #ffd9d9;
  color: #b91c1c;
}

@media (max-width: 540px) {
  .auth-panel {
    padding: 34px 18px 24px;
  }

  .auth-logo {
    width: min(172px, 62vw);
    margin-bottom: 30px;
  }

  .wrapper {
    --card-width: min(100%, 320px);
  }

  .flip-card__inner {
    height: 600px;
  }

  .flip-card__front,
  .flip-card__back {
    padding: 28px 20px;
  }

  .social-auth {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .social-auth__button {
    height: 50px;
    gap: 8px;
    padding: 0 10px;
    font-size: 16px;
  }

  .social-auth__button svg {
    width: 24px;
    height: 24px;
  }

  .card-side::before,
  .card-side::after {
    width: 92px;
    font-size: 14px;
  }

  .card-side::before {
    right: 68px;
  }

  .card-side::after {
    left: 68px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    border-right: 0;
    border-bottom: 2px solid var(--main-color);
  }

  .app-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .app-nav__item {
    min-width: 0;
    padding: 0 8px;
    text-align: center;
  }

  .user-box {
    margin-top: 0;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .training-panel {
    height: auto;
  }
}

@media (max-width: 640px) {
  .app-workspace,
  .app-sidebar {
    padding: 18px;
  }

  .workspace-header {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-actions {
    width: 100%;
  }

  .outline-button {
    width: 100%;
  }

  .chat-panel {
    min-height: 520px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .send-button {
    width: 100%;
  }

  .message {
    max-width: 92%;
  }

  .message.has-code {
    width: 92%;
  }

  .message-materials {
    align-items: flex-start;
    gap: 5px;
  }

  .message-materials__label {
    flex-basis: 100%;
    font-size: 11px;
  }

  .message-materials__chip {
    max-width: 100%;
    min-height: 22px;
    padding: 3px 8px;
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .app-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-header h1 {
    font-size: 34px;
  }
}

/* Chat-first workspace */
.mobile-app-bar,
.sidebar-overlay {
  display: none;
}

.mobile-icon-button,
.sidebar-close {
  cursor: pointer;
  background: transparent;
  border: 0;
  color: var(--font-color);
}

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

.sidebar-head .app-mark {
  flex: 1 1 auto;
}

.sidebar-close {
  display: none;
}

.app-shell {
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  gap: 18px;
  height: 100vh;
  padding: 18px;
}

.new-chat-button {
  min-height: 44px;
  cursor: pointer;
  background: var(--brand-green);
  border: 2px solid var(--main-color);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--main-color);
  color: #ffffff;
  font-size: 15px;
  font-weight: 950;
}

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

.chat-thread-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: stretch;
  min-height: 44px;
  background: rgba(33, 37, 41, 0.045);
  border: 0;
  border-radius: 13px;
  color: var(--font-color);
  transition:
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

.chat-thread-item:hover {
  background: rgba(33, 37, 41, 0.075);
}

.chat-thread-item.is-active {
  background: #d6f0df;
  box-shadow: inset 0 0 0 2px rgba(31, 146, 79, 0.45);
}

.chat-thread-item.is-pinned::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 7px;
  width: 4px;
  content: "";
  background: var(--brand-green);
  border-radius: 999px;
}

.chat-thread-item.is-pinned .chat-thread {
  padding-left: 18px;
}

.chat-thread-item.is-archived {
  background: rgba(255, 255, 255, 0.72);
}

.chat-thread {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 8px 2px 8px 14px;
  cursor: pointer;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
}

.thread-menu-button {
  align-self: center;
  width: 30px;
  height: 30px;
  margin: 0 4px 0 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--font-color);
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
}

.thread-menu-button:hover,
.thread-menu-button[aria-expanded="true"] {
  background: rgba(33, 37, 41, 0.09);
}

.thread-actions-menu {
  position: absolute;
  top: 34px;
  right: 4px;
  z-index: 10;
  display: grid;
  min-width: 178px;
  padding: 8px;
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--main-color);
}

.thread-actions-menu button {
  min-height: 34px;
  padding: 0 10px;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--font-color);
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}

.thread-actions-menu button:hover {
  background: #e8edf5;
}

.thread-actions-menu button.is-danger {
  color: #b42318;
}

.chat-thread strong,
.chat-thread span {
  overflow-wrap: anywhere;
  white-space: normal;
}

.chat-thread strong {
  font-size: 13px;
  font-weight: 950;
  line-height: 1.15;
}

.chat-thread span {
  color: var(--font-color-sub);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.empty-threads {
  margin: 0;
  padding: 10px 4px;
  color: var(--font-color-sub);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.user-box {
  width: 100%;
  color: var(--font-color);
  text-align: left;
}

.profile-toggle {
  cursor: pointer;
}

.profile-toggle:hover {
  background: #bfe5ce;
}

.app-workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  padding: 18px 24px 24px;
  overflow: hidden;
}

.start-screen {
  display: grid;
  align-content: start;
  justify-items: center;
  min-height: 0;
  padding: clamp(104px, 18vh, 180px) 24px 24px;
}

.start-mark {
  display: block;
  width: min(86px, 26vw);
  height: auto;
  margin-bottom: 28px;
}

.start-form {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  width: min(760px, 100%);
  min-height: 66px;
  padding: 8px;
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 999px;
  box-shadow: 5px 5px 0 var(--main-color);
}

.start-input {
  min-width: 0;
  height: 46px;
  max-height: 132px;
  padding: 12px 10px;
  resize: none;
  overflow-y: hidden;
  background: transparent;
  border: 0;
  color: var(--font-color);
  font: inherit;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.25;
  outline: none;
}

.attach-button,
.voice-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--font-color);
  font-size: 30px;
  font-weight: 800;
}

.voice-button {
  background: var(--brand-green);
  border: 2px solid var(--main-color);
  color: #ffffff;
}

.send-icon-button {
  display: inline-grid;
  place-items: center;
}

.send-icon {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.35;
}

.send-button .send-icon {
  display: none;
}

.attach-button:hover,
.voice-button:hover {
  background: #bfe5ce;
  color: var(--font-color);
}

.attach-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--font-color-sub);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.attach-status[data-state="success"] {
  color: var(--brand-green);
}

.attach-status[data-state="error"] {
  color: #b91c1c;
}

.attach-status[data-state="warning"] {
  color: #9a5b00;
}

.chat-view {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.chat-log {
  min-height: 0;
  padding: 28px 8px 18px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.message {
  max-width: min(78%, 680px);
}

.composer-block {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 0 4px;
  background: linear-gradient(180deg, transparent, rgba(243, 246, 245, 0.94) 42%);
}

.chat-form {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 66px;
  gap: 10px;
  padding: 8px;
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 999px;
  box-shadow: 5px 5px 0 var(--main-color);
}

.chat-form .chat-input {
  height: 48px;
  max-height: 132px;
  padding: 13px 12px 12px 16px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  font-size: 17px;
}

.chat-form .chat-attach-button {
  color: var(--font-color);
  font-size: 30px;
}

.chat-form .send-button {
  min-width: 126px;
  height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  box-shadow: none;
}

.chat-attach-status {
  min-height: 18px;
  margin: 8px 14px 0;
  color: var(--font-color-sub);
  text-align: left;
  text-shadow: none;
}

.chat-attach-status[data-state="success"] {
  color: var(--brand-green);
}

.chat-attach-status[data-state="error"] {
  color: #b91c1c;
}

.chat-attach-status[data-state="warning"] {
  color: #9a5b00;
}

.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(33, 37, 41, 0.18);
}

.profile-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 260px;
  z-index: 11;
  display: flex;
  width: min(500px, calc(100vw - 280px));
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(33, 37, 41, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(33, 37, 41, 0.045) 1px, transparent 1px),
    #ffffff;
  background-size: 30px 30px;
  border-right: 2px solid var(--main-color);
  box-shadow: 8px 0 0 var(--main-color);
}

.profile-panel__header {
  display: flex;
  justify-content: flex-end;
}

.archive-panel {
  display: grid;
  gap: 8px;
  padding: 8px;
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 8px;
  box-shadow: 5px 5px 0 var(--main-color);
}

.archive-folder {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 78px;
  padding: 10px 12px;
  cursor: pointer;
  background: #f7f8fb;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  color: var(--font-color);
  text-align: left;
}

.archive-folder:hover,
.archive-folder.is-open {
  background: #bfe5ce;
}

.archive-folder__icon {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.archive-folder::after {
  content: "›";
  color: var(--font-color-sub);
  font-size: 28px;
  font-weight: 950;
  line-height: 1;
  transition: transform 0.18s ease;
}

.archive-folder.is-open::after {
  transform: rotate(90deg);
}

.archive-folder strong,
.archive-folder small {
  display: block;
}

.archive-folder strong {
  font-size: 17px;
  font-weight: 950;
  line-height: 1.1;
}

.archive-folder small {
  margin-top: 3px;
  color: var(--font-color-sub);
  font-size: 12px;
  font-weight: 800;
}

.archived-chat-list {
  display: grid;
  gap: 6px;
  padding: 4px;
}

.icon-button {
  display: inline-grid;
  width: 50px;
  height: 50px;
  place-items: center;
  cursor: pointer;
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--main-color);
  color: var(--font-color);
  font-size: 18px;
  font-weight: 950;
}

.knowledge-panel {
  background: #ffffff;
  border: 2px solid var(--main-color);
  border-radius: 8px;
  box-shadow: 5px 5px 0 var(--main-color);
}

.knowledge-panel {
  height: auto;
  min-height: 0;
  gap: 12px;
  padding: 18px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: auto;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    height: auto;
  }

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

  .app-workspace {
    height: calc(100vh - 184px);
    min-height: 620px;
  }

  .profile-panel {
    left: 0;
    width: min(440px, 92vw);
  }
}

@media (max-width: 640px) {
  .app-workspace {
    height: calc(100vh - 244px);
    min-height: 560px;
    padding: 16px;
  }

  .start-screen {
    padding: clamp(42px, 9vh, 72px) 8px 20px;
  }

  .chat-list {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: 44px minmax(0, 1fr) 48px;
    min-height: 62px;
  }

  .chat-form .chat-attach-button {
    width: 44px;
    height: 44px;
  }

  .chat-form .send-button {
    min-width: 48px;
    width: 48px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .chat-form .send-button span {
    display: none;
  }

  .chat-form .send-button .send-icon {
    display: block;
    color: #ffffff;
  }

  .profile-panel {
    width: 100vw;
    box-shadow: none;
  }
}

@media (max-width: 760px) {
  body,
  body.is-app-mode,
  body.is-app-mode.is-start-mode,
  body.is-app-mode.is-chat-mode {
    background: var(--paper-grid);
    background-size: var(--paper-grid-size);
    color: var(--font-color);
  }

  body.is-app-mode .animated-background,
  body.is-app-mode.is-start-mode .animated-background {
    display: none !important;
  }

  .auth-shell,
  .auth-panel,
  .app-shell,
  .app-workspace,
  .start-screen,
  .chat-view {
    background: transparent;
    color: var(--font-color);
  }

  .mobile-app-bar,
  .start-form,
  .chat-form,
  .app-sidebar,
  .profile-panel,
  .message,
  .code-block {
    color-scheme: only light;
    forced-color-adjust: none;
  }

  input,
  textarea,
  select,
  .flip-card__input,
  .verification-code-input {
    font-size: 16px;
  }

  body.is-app-mode {
    overflow: hidden;
  }

  body.is-sidebar-open {
    overflow: hidden;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: calc(58px + env(safe-area-inset-top)) minmax(0, 1fr);
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .mobile-app-bar {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    min-height: calc(58px + env(safe-area-inset-top));
    padding: calc(7px + env(safe-area-inset-top)) 12px 7px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 2px solid var(--main-color);
    backdrop-filter: blur(10px);
  }

  .mobile-icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-icon-button:focus-visible,
  .sidebar-close:focus-visible {
    outline: 3px solid rgba(31, 146, 79, 0.35);
    outline-offset: 2px;
  }

  .mobile-menu-button {
    position: relative;
    width: 42px;
    height: 42px;
    background: #ffffff;
    border: 2px solid var(--main-color);
    box-shadow: 3px 3px 0 var(--main-color);
    color: var(--main-color);
    transition:
      transform 0.16s ease,
      box-shadow 0.16s ease,
      background-color 0.16s ease;
  }

  .mobile-menu-button span {
    position: absolute;
    left: 10px;
    display: block;
    width: 18px;
    height: 3px;
    background: currentColor;
    border-radius: 999px;
    transform-origin: center;
    transition:
      transform 0.18s ease,
      opacity 0.12s ease,
      top 0.18s ease;
  }

  .mobile-menu-button span:nth-child(1) {
    top: 12px;
  }

  .mobile-menu-button span:nth-child(2) {
    top: 19px;
  }

  .mobile-menu-button span:nth-child(3) {
    top: 26px;
  }

  .mobile-menu-button:active {
    box-shadow: 1px 1px 0 var(--main-color);
    transform: translate(2px, 2px);
  }

  .app-shell.is-sidebar-open .mobile-menu-button {
    background: var(--brand-green-soft);
  }

  .app-shell.is-sidebar-open .mobile-menu-button span:nth-child(1) {
    top: 19px;
    transform: rotate(45deg);
  }

  .app-shell.is-sidebar-open .mobile-menu-button span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .app-shell.is-sidebar-open .mobile-menu-button span:nth-child(3) {
    top: 19px;
    transform: rotate(-45deg);
  }

  .mobile-app-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    gap: 8px;
    color: var(--font-color);
    line-height: 1;
  }

  .mobile-app-brand img {
    width: 34px;
    height: 34px;
    object-fit: contain;
  }

  .mobile-app-brand div {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

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

  .mobile-app-brand strong {
    font-size: 16px;
    font-weight: 950;
  }

  .mobile-app-brand span {
    color: var(--font-color-sub);
    font-size: 11px;
    font-weight: 850;
  }

  .mobile-profile-button .user-avatar {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .sidebar-overlay:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 18;
    display: block;
    background: rgba(33, 37, 41, 0.32);
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 19;
    display: flex;
    width: min(318px, 84vw);
    height: 100dvh;
    max-height: 100dvh;
    padding: 14px;
    overflow-y: auto;
    background: #ffffff;
    color: var(--font-color);
    border-right: 2px solid var(--main-color);
    border-bottom: 0;
    box-shadow: 7px 0 0 var(--main-color);
    transform: translateX(calc(-100% - 10px));
    transition: transform 0.22s ease;
  }

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

  .sidebar-head {
    min-height: 48px;
  }

  .sidebar-head .app-mark {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
  }

  .sidebar-head .app-mark__image {
    width: 46px;
  }

  .sidebar-head .app-mark__text strong {
    font-size: 18px;
  }

  .sidebar-head .app-mark__text span {
    font-size: 13px;
  }

  .sidebar-close {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
  }

  .chat-list {
    grid-template-columns: 1fr;
  }

  .app-workspace {
    grid-row: 2;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .start-screen,
  .chat-view,
  .chat-panel {
    height: 100%;
    min-height: 0;
  }

  .start-screen {
    align-content: start;
    padding: clamp(116px, 18svh, 164px) 16px calc(20px + env(safe-area-inset-bottom));
  }

  .start-mark {
    width: 74px;
    margin-bottom: 30px;
  }

  .attach-status {
    color: var(--font-color-sub);
    text-shadow: none;
  }

  .attach-status[data-state="success"] {
    color: var(--brand-green);
  }

  .attach-status[data-state="error"] {
    color: #b91c1c;
  }

  .attach-status[data-state="warning"] {
    color: #9a5b00;
  }

  .start-form {
    grid-template-columns: 44px minmax(0, 1fr) 48px;
    min-height: 62px;
    padding: 7px;
  }

  .start-input {
    height: 44px;
    max-height: 116px;
    padding: 11px 8px;
    font-size: 16px;
  }

  .attach-button,
  .voice-button {
    width: 44px;
    height: 44px;
  }

  .chat-panel {
    max-width: none;
  }

  .chat-log {
    gap: 12px;
    padding: 14px 12px 12px;
    overflow-y: auto;
  }

  .message,
  .message.has-code {
    width: auto;
    max-width: 92%;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.42;
  }

  .message.bot {
    max-width: 94%;
  }

  .message.user {
    max-width: 86%;
  }

  .message-actions {
    margin-top: 6px;
  }

  .code-block {
    max-width: 100%;
  }

  .code-block pre {
    padding: 12px;
    font-size: 12px;
  }

  .composer-block {
    position: sticky;
    bottom: 0;
    padding: 10px 12px calc(11px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(247, 248, 251, 0.98) 34%);
  }

  .chat-form {
    grid-template-columns: 44px minmax(0, 1fr) 48px;
    min-height: 60px;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
  }

  .chat-form .chat-input {
    height: 44px;
    max-height: 116px;
    min-width: 0;
    padding: 11px 8px;
    font-size: 16px;
  }

  .chat-form .send-button {
    min-width: 48px;
    width: 48px;
    height: 48px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .chat-form .send-button span {
    display: none;
  }

  .chat-form .send-button .send-icon {
    display: block;
    color: #ffffff;
  }

  .chat-attach-status {
    margin: 6px 10px 0;
    font-size: 12px;
  }

  .profile-panel {
    left: 0;
    width: 100vw;
    max-width: none;
    top: calc(58px + env(safe-area-inset-top));
    padding: 16px;
    box-shadow: none;
  }
}

@media (max-width: 360px) {
  .mobile-app-brand span {
    display: none;
  }

  .mobile-app-brand strong {
    font-size: 15px;
  }

  .message,
  .message.has-code {
    max-width: 96%;
  }

  .message-materials__chip {
    flex-basis: 100%;
    max-width: 100%;
  }
}
