:root {
  color-scheme: light;
  --ink: #40121f;
  --ink-soft: #75535c;
  --forest: #641027;
  --forest-deep: #370714;
  --sage: #f0c46f;
  --mint: #fff0d8;
  --cream: #fff7ec;
  --paper: #fffdf8;
  --line: #ead8cf;
  --gold: #e7a63c;
  --danger: #a64242;
  --shadow: 0 20px 55px rgba(85, 12, 35, 0.13);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--cream);
  color: var(--ink);
}

body {
  min-height: 100vh;
}

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

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.eyebrow,
.topbar-kicker {
  margin: 0 0 10px;
  color: #a66a43;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 14px 14px 14px 5px;
  background: var(--forest);
  color: #f5e7cd;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-style: italic;
}

.brand-mark-large {
  width: 58px;
  height: 58px;
  margin-bottom: 34px;
  border-radius: 18px 18px 18px 6px;
  font-size: 32px;
}

.brand-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 2px solid #edbd64;
  border-radius: 14px 14px 14px 5px;
  object-fit: cover;
  object-position: 50% 18%;
  box-shadow: 0 8px 20px rgba(84, 8, 31, 0.18);
}

.brand-avatar-large {
  width: 68px;
  height: 68px;
  margin-bottom: 30px;
  border-radius: 20px 20px 20px 7px;
}

.plain-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 13px;
  padding: 0 19px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  border: 1px solid var(--forest);
  background: var(--forest);
  color: #fff;
  box-shadow: 0 8px 22px rgba(100, 16, 39, 0.18);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(100, 16, 39, 0.13);
}

.primary-button:disabled,
.send-button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

/* Login */

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 0.9fr) minmax(560px, 1.1fr);
  background: var(--paper);
}

.login-card {
  display: flex;
  width: min(520px, 100%);
  justify-self: end;
  flex-direction: column;
  justify-content: center;
  padding: 70px 88px 70px 50px;
}

.login-card h1 {
  max-width: 420px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 5vw, 66px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.login-card h1 span {
  display: block;
  margin-top: 10px;
  color: #9a603d;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.login-copy {
  max-width: 410px;
  margin: 24px 0 36px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.65;
}

.login-form {
  max-width: 410px;
}

.login-form > label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 750;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  width: 100%;
  height: 54px;
  border: 1px solid #e4cfc4;
  border-radius: 14px;
  outline: 0;
  padding: 0 92px 0 16px;
  background: #fff;
  color: var(--ink);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.password-wrap input:focus {
  border-color: #bf765c;
  box-shadow: 0 0 0 4px rgba(188, 110, 78, 0.12);
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 8px;
  height: 54px;
  padding: 0 10px;
  color: #8a5261;
  font-size: 12px;
  font-weight: 750;
}

.form-error {
  min-height: 21px;
  margin: 6px 0;
  color: var(--danger);
  font-size: 12px;
}

.login-button {
  width: 100%;
  justify-content: space-between;
}

.privacy-note {
  max-width: 410px;
  margin: 24px 0 0;
  color: #9a777e;
  font-size: 12px;
}

.login-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 20%, rgba(240, 174, 75, 0.3), transparent 31%),
    linear-gradient(140deg, #741832 0%, #4b0a1e 68%, #29040f 100%);
}

.login-visual::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 46px 46px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent);
}

.login-visual::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(45, 3, 16, 0.84) 0%,
    rgba(58, 5, 20, 0.28) 52%,
    rgba(43, 3, 14, 0.12) 100%
  );
  content: "";
}

.login-mel-portrait {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% center;
  filter: saturate(0.92) contrast(1.02);
}

.visual-orbit {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(221, 235, 225, 0.16);
  border-radius: 50%;
}

.orbit-one {
  top: 8%;
  right: -18%;
  width: 620px;
  height: 620px;
}

.orbit-two {
  right: 8%;
  bottom: -28%;
  width: 500px;
  height: 500px;
}

.preview-card,
.preview-message,
.preview-chip {
  position: absolute;
  z-index: 3;
  backdrop-filter: blur(14px);
  box-shadow: 0 28px 65px rgba(0, 0, 0, 0.23);
}

.preview-card-main {
  top: 8%;
  left: 2%;
  display: flex;
  width: 270px;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.preview-avatar {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  border: 2px solid rgba(247, 190, 91, 0.9);
  object-fit: cover;
  object-position: 50% 18%;
}

.preview-card span,
.preview-card small {
  display: block;
}

.preview-card span {
  font-weight: 750;
}

.preview-card small {
  margin-top: 3px;
  color: #f2c982;
}

.preview-message {
  max-width: 430px;
  border-radius: 23px;
  padding: 20px 22px;
  font-size: 16px;
  line-height: 1.55;
}

.preview-message-question {
  top: 36%;
  right: 10%;
  width: 330px;
  border-bottom-right-radius: 7px;
  background: #fff0d8;
  color: var(--forest-deep);
}

.preview-message-answer {
  top: 52%;
  left: 13%;
  width: min(430px, 68%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-left-radius: 7px;
  background: rgba(255, 255, 255, 0.11);
  color: #fff8ef;
}

.preview-chip {
  top: 72%;
  left: 25%;
  border: 1px solid rgba(215, 235, 222, 0.18);
  border-radius: 999px;
  padding: 11px 16px;
  background: rgba(55, 7, 20, 0.72);
  color: #f5cb82;
  font-size: 12px;
}

/* Application */

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 250px 1fr;
  background: var(--paper);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid rgba(232, 211, 201, 0.82);
  padding: 28px 20px 22px;
  background: #fff4e8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  color: var(--ink);
  text-decoration: none;
}

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

.brand strong {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 500;
}

.brand small {
  margin-top: 1px;
  color: #956c74;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-nav {
  display: grid;
  gap: 7px;
  margin-top: 48px;
}

.nav-item {
  display: flex;
  min-height: 49px;
  align-items: center;
  gap: 13px;
  border: 0;
  border-radius: 13px;
  padding: 0 14px;
  background: transparent;
  color: #895967;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.nav-item.active {
  background: var(--forest);
  color: #fff;
  box-shadow: 0 9px 22px rgba(100, 16, 39, 0.18);
}

.nav-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.chat-icon {
  border: 1.8px solid currentColor;
  border-radius: 6px;
}

.chat-icon::after {
  position: absolute;
  bottom: -4px;
  left: 3px;
  width: 6px;
  height: 6px;
  border-bottom: 1.8px solid currentColor;
  border-left: 1.8px solid currentColor;
  background: inherit;
  content: "";
  transform: skewY(-32deg);
}

.settings-icon {
  border: 1.8px solid currentColor;
  border-radius: 50%;
  box-shadow:
    0 -6px 0 -4px currentColor,
    0 6px 0 -4px currentColor,
    6px 0 0 -4px currentColor,
    -6px 0 0 -4px currentColor;
}

.settings-icon::after {
  position: absolute;
  inset: 4px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
  content: "";
}

.sidebar-spacer {
  flex: 1;
}

.usage-card {
  border: 1px solid #ead8cf;
  border-radius: 16px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.72);
}

.usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.usage-head span {
  color: #956c74;
}

.usage-head strong {
  font-size: 12px;
}

.progress-track {
  height: 5px;
  margin: 11px 0 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1ddd3;
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 300ms ease;
}

.usage-card small {
  color: #9a777e;
  font-size: 10px;
}

.logout-button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 18px 12px 2px;
  background: transparent;
  color: #956c74;
  font-size: 13px;
  cursor: pointer;
}

.workspace {
  display: flex;
  min-width: 0;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 253, 248, 0.93), rgba(255, 253, 248, 0.93)),
    radial-gradient(circle at 30% 20%, #ffe4c6, transparent 34%);
}

.topbar {
  display: flex;
  min-height: 102px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(232, 211, 201, 0.82);
  padding: 22px clamp(25px, 4vw, 62px);
  background: rgba(255, 254, 249, 0.88);
  backdrop-filter: blur(18px);
}

.topbar-kicker {
  margin-bottom: 7px;
}

.topbar h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(23px, 2.2vw, 32px);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #8e6671;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.status-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e6a43c;
  box-shadow: 0 0 0 4px rgba(230, 164, 60, 0.15);
}

.panel {
  min-height: 0;
  flex: 1;
}

.chat-panel {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.profile-banner {
  display: flex;
  width: min(880px, calc(100% - 48px));
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 22px auto 0;
  border: 1px solid #ebd6c9;
  border-radius: 15px;
  padding: 13px 15px 13px 17px;
  background: #fff1dc;
}

.profile-banner strong {
  font-size: 13px;
}

.profile-banner p {
  margin: 3px 0 0;
  color: #8b6871;
  font-size: 11px;
}

.profile-banner button {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--forest);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.message-list {
  width: min(920px, 100%);
  min-height: 0;
  flex: 1;
  align-self: center;
  overflow-y: auto;
  padding: 32px 25px 170px;
  scroll-behavior: smooth;
}

.empty-chat {
  display: flex;
  min-height: calc(100vh - 300px);
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.assistant-emblem {
  position: relative;
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  place-items: center;
  overflow: hidden;
  border: 2px solid #e9b75d;
  border-radius: 24px 24px 24px 8px;
  background: linear-gradient(145deg, #fff1dc, #f5c777);
  color: var(--forest);
  box-shadow: 0 15px 35px rgba(95, 12, 38, 0.14);
  font-family: Georgia, serif;
  font-size: 36px;
  font-style: italic;
}

.assistant-emblem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
}

.assistant-emblem i {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  z-index: 2;
  background: #e6a43c;
}

.empty-chat h3 {
  max-width: 670px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(27px, 3.2vw, 42px);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.empty-chat > p:not(.eyebrow) {
  max-width: 650px;
  margin: 16px auto 27px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.suggestion-grid {
  display: grid;
  width: min(720px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.suggestion-card {
  position: relative;
  min-height: 100px;
  border: 1px solid #eadbd3;
  border-radius: 16px;
  padding: 16px 18px 15px 48px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.suggestion-card:hover {
  border-color: #dda56c;
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(92, 14, 38, 0.09);
}

.suggestion-number {
  position: absolute;
  top: 17px;
  left: 15px;
  color: #bd876e;
  font-family: Georgia, serif;
  font-size: 12px;
}

.suggestion-card strong,
.suggestion-card small {
  display: block;
}

.suggestion-card strong {
  margin-bottom: 6px;
  font-size: 13px;
}

.suggestion-card small {
  color: #896972;
  font-size: 11px;
  line-height: 1.45;
}

.message-row {
  display: flex;
  margin: 0 0 22px;
  gap: 12px;
}

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

.message-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid #e8b763;
  border-radius: 11px 11px 11px 4px;
  object-fit: cover;
  object-position: 50% 18%;
}

.message-bubble {
  max-width: min(690px, 82%);
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.62;
}

.message-row.user .message-bubble {
  border-bottom-right-radius: 5px;
  padding: 13px 17px;
  background: var(--forest);
  color: #fff;
}

.message-row.assistant .message-bubble {
  width: min(690px, calc(100% - 46px));
  border: 1px solid #eadbd3;
  border-bottom-left-radius: 5px;
  padding: 19px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 9px 26px rgba(89, 14, 38, 0.06);
}

.message-bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.advice-section + .advice-section {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid #f0e1d9;
}

.advice-section h5 {
  margin: 0 0 8px;
  color: #a06a55;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.advice-section p {
  color: #5e3440;
}

.advice-section.primary-advice {
  border: 1px solid #efd0aa;
  border-radius: 13px;
  padding: 14px 15px;
  background: #fff1dc;
}

.advice-section.primary-advice h5 {
  color: #8a442d;
}

.message-tools {
  display: flex;
  justify-content: flex-end;
  margin-top: 13px;
}

.copy-button {
  border: 1px solid #eadbd3;
  border-radius: 9px;
  padding: 7px 10px;
  background: #fff;
  color: #865664;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.message-time {
  margin-top: 8px;
  color: #a78990;
  font-size: 9px;
  text-align: right;
}

.typing-bubble {
  display: inline-flex;
  min-width: 66px;
  align-items: center;
  gap: 5px;
  border: 1px solid #eadbd3;
  border-radius: 16px 16px 16px 5px;
  padding: 14px 17px;
  background: white;
}

.typing-bubble i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: typing 1.15s infinite ease-in-out;
  background: #b87957;
}

.typing-bubble i:nth-child(2) {
  animation-delay: 140ms;
}

.typing-bubble i:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.composer-wrap {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  padding: 26px 25px 17px;
  background: linear-gradient(to top, var(--paper) 72%, rgba(255, 254, 249, 0));
}

.composer {
  width: min(820px, 100%);
  margin: 0 auto;
  border: 1px solid #e3c9bd;
  border-radius: 18px;
  padding: 13px 13px 10px 17px;
  background: #fff;
  box-shadow: 0 15px 38px rgba(92, 14, 38, 0.13);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: #c88464;
  box-shadow:
    0 15px 38px rgba(92, 14, 38, 0.13),
    0 0 0 4px rgba(200, 132, 100, 0.11);
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 150px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 2px 3px 8px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #9a777e;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.composer-footer > span {
  color: #ad9196;
  font-size: 9px;
}

.send-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: var(--forest);
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.composer-wrap > p {
  margin: 8px 0 0;
  color: #ad9196;
  font-size: 9px;
  text-align: center;
}

/* Settings */

.settings-panel {
  overflow-y: auto;
  padding: 40px clamp(25px, 5vw, 72px) 100px;
}

.settings-intro,
.settings-form {
  width: min(940px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.settings-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 30px;
}

.settings-intro h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 3.5vw, 44px);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.settings-intro > div:first-child > p:last-child {
  max-width: 590px;
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.completion-card {
  display: flex;
  min-width: 260px;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.completion-ring {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--gold) var(--completion, 0%), #f0ded4 0);
}

.completion-ring::before {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: white;
  content: "";
}

.completion-ring span {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 800;
}

.completion-card strong,
.completion-card small {
  display: block;
}

.completion-card strong {
  font-size: 12px;
}

.completion-card small {
  max-width: 150px;
  margin-top: 4px;
  color: #9a777e;
  font-size: 10px;
  line-height: 1.4;
}

.settings-form {
  display: grid;
  gap: 18px;
}

.settings-section {
  border: 1px solid #eadbd3;
  border-radius: 22px;
  padding: 27px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 30px rgba(34, 72, 60, 0.045);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 24px;
}

.section-heading > span {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 33px;
  place-items: center;
  border-radius: 10px;
  background: var(--mint);
  color: #9a6046;
  font-family: Georgia, serif;
  font-size: 11px;
}

.section-heading h4 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 500;
}

.section-heading p {
  margin: 5px 0 0;
  color: #96727a;
  font-size: 11px;
  line-height: 1.5;
}

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

.field {
  min-width: 0;
}

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

.field > span,
.field > legend {
  display: block;
  margin-bottom: 8px;
  color: #70414e;
  font-size: 11px;
  font-weight: 750;
}

.field b {
  color: var(--gold);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #ead8cf;
  border-radius: 11px;
  outline: 0;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.field input,
.field select {
  min-height: 44px;
}

.field textarea {
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #c88464;
  box-shadow: 0 0 0 3px rgba(200, 132, 100, 0.11);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #ad9196;
}

.field > small {
  display: block;
  margin-top: 6px;
  color: #ad9196;
  font-size: 9px;
}

.market-field {
  display: grid;
  margin: 0;
  border: 0;
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.market-field legend {
  grid-column: 1 / -1;
}

.check-card {
  position: relative;
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 11px;
  border: 1px solid #ead8cf;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}

.check-card:has(input:checked) {
  border-color: #c88464;
  background: #fff4e5;
}

.check-card input {
  position: absolute;
  opacity: 0;
}

.check-control {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1px solid #cfae9d;
  border-radius: 6px;
}

.check-card input:checked + .check-control {
  border-color: var(--forest);
  background: var(--forest);
}

.check-card input:checked + .check-control::after {
  position: absolute;
  top: 3px;
  left: 6px;
  width: 4px;
  height: 8px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  content: "";
  transform: rotate(45deg);
}

.check-card strong,
.check-card small {
  display: block;
}

.check-card strong {
  font-size: 11px;
}

.check-card small {
  margin-top: 3px;
  color: #9a777e;
  font-size: 9px;
}

.advanced-settings {
  margin-top: 22px;
  border-top: 1px solid #f0e1d9;
  padding-top: 17px;
}

.advanced-settings summary {
  width: max-content;
  color: #8d5967;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.advanced-grid {
  margin-top: 18px;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #ead8cf;
  border-radius: 17px;
  padding: 13px 14px 13px 18px;
  background: rgba(255, 254, 249, 0.94);
  box-shadow: 0 16px 40px rgba(27, 66, 54, 0.15);
  backdrop-filter: blur(14px);
}

.settings-actions strong,
.settings-actions small {
  display: block;
}

.settings-actions strong {
  font-size: 11px;
}

.settings-actions small {
  margin-top: 3px;
  color: #9a777e;
  font-size: 9px;
}

.settings-actions.saved strong {
  color: #9a5c37;
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 360px;
  border-radius: 13px;
  padding: 13px 16px;
  background: var(--forest-deep);
  color: white;
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #783b3b;
}

@media (max-width: 900px) {
  .login-shell {
    min-height: 100dvh;
    grid-template-columns: 1fr;
  }

  .login-card {
    width: min(520px, 100%);
    justify-self: center;
    min-height: 100dvh;
    padding: 44px 32px;
  }

  .login-visual {
    display: none;
  }

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

  .sidebar {
    align-items: center;
    padding: 24px 12px;
  }

  .brand > span:last-child,
  .nav-item > span:last-child,
  .usage-card,
  .logout-button:not(:hover) {
    font-size: 0;
  }

  .main-nav {
    width: 100%;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .logout-button {
    justify-content: center;
    padding: 16px;
  }

  .settings-intro {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .login-card {
    justify-content: center;
    padding: 30px 20px;
  }

  .brand-avatar-large {
    width: 64px;
    height: 64px;
  }

  .login-card h1 {
    font-size: 46px;
  }

  .login-copy {
    margin: 18px 0 26px;
    font-size: 15px;
    line-height: 1.55;
  }

  .login-form,
  .privacy-note {
    max-width: none;
  }

  .password-wrap input {
    height: 52px;
  }

  .password-toggle {
    height: 52px;
  }

  .login-button {
    min-height: 54px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    height: 100dvh;
    padding-bottom: 65px;
  }

  .topbar {
    min-height: 82px;
    padding: 15px 18px;
  }

  .topbar-actions .mode-badge {
    display: none;
  }

  .secondary-button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 0;
  }

  .secondary-button span {
    font-size: 18px;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .profile-banner {
    width: calc(100% - 28px);
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-banner button {
    width: 100%;
  }

  .message-list {
    padding: 24px 14px 150px;
  }

  .empty-chat {
    min-height: auto;
    padding: 28px 0 20px;
  }

  .empty-chat h3 {
    font-size: 29px;
  }

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

  .suggestion-card {
    min-height: 85px;
  }

  .message-bubble {
    max-width: 88%;
  }

  .message-row.assistant .message-bubble {
    width: calc(100% - 44px);
  }

  .composer-wrap {
    padding: 22px 12px 10px;
  }

  .composer-footer > span {
    display: none;
  }

  .composer-footer {
    justify-content: flex-end;
  }

  .settings-panel {
    padding: 28px 14px 95px;
  }

  .settings-intro {
    gap: 18px;
  }

  .completion-card {
    width: 100%;
  }

  .settings-section {
    border-radius: 18px;
    padding: 20px 16px;
  }

  .form-grid,
  .market-field {
    grid-template-columns: 1fr;
  }

  .field-wide,
  .market-field legend {
    grid-column: auto;
  }

  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-actions .primary-button {
    width: 100%;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 12;
    display: grid;
    height: 65px;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid #eadbd3;
    background: rgba(248, 249, 245, 0.96);
    backdrop-filter: blur(16px);
  }

  .mobile-nav button {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    border: 0;
    background: transparent;
    color: #956c74;
    font-size: 9px;
    font-weight: 700;
  }

  .mobile-nav button.active {
    color: var(--forest);
  }

  .mobile-nav .nav-icon {
    width: 16px;
    height: 16px;
  }

  .toast {
    right: 14px;
    bottom: 78px;
    left: 14px;
    max-width: none;
  }
}

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