:root {
  --green: #079437;
  --green-dark: #08782f;
  --green-soft: #edf8f0;
  --green-pale: #f4fbf5;
  --blue-soft: #edf7ff;
  --text: #071426;
  --muted: #63708a;
  --line: #dde5ea;
  --line-soft: #edf1f3;
  --bg: #ffffff;
  --panel: #ffffff;
  --shadow: 0 12px 36px rgba(17, 31, 47, 0.07);
  --shadow-soft: 0 8px 22px rgba(17, 31, 47, 0.05);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 86px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #fff;
}

.boot-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  animation: pulse 1.4s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { transform: scale(0.98); opacity: 0.78; }
  to { transform: scale(1.03); opacity: 1; }
}

.auth-page {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 34px 22px 50px;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 70%, rgba(108, 185, 120, 0.18), transparent 32%),
    radial-gradient(circle at 78% 65%, rgba(119, 181, 131, 0.09), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
}

.auth-page::before {
  content: "";
  position: absolute;
  left: -110px;
  bottom: -140px;
  width: 630px;
  height: 680px;
  background:
    radial-gradient(ellipse at 48% 45%, rgba(117, 187, 133, 0.26), transparent 42%),
    radial-gradient(ellipse at 30% 62%, rgba(53, 142, 73, 0.2), transparent 40%),
    linear-gradient(32deg, transparent 35%, rgba(57, 142, 66, 0.18) 36%, rgba(57, 142, 66, 0.18) 38%, transparent 39%);
  border-radius: 44% 56% 0 0;
  filter: blur(0.3px);
  opacity: 0.84;
}

.leaf-cluster {
  position: absolute;
  left: 22px;
  bottom: 42px;
  width: 210px;
  height: 380px;
  pointer-events: none;
}

.leaf-cluster span {
  position: absolute;
  width: 44px;
  height: 95px;
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, rgba(161, 213, 101, 0.72), rgba(10, 121, 44, 0.82));
  transform-origin: bottom center;
  box-shadow: inset 10px -8px 18px rgba(255, 255, 255, 0.3);
}

.leaf-cluster span:nth-child(1) { left: 42px; bottom: 22px; transform: rotate(-34deg); }
.leaf-cluster span:nth-child(2) { left: 88px; bottom: 92px; transform: rotate(28deg) scale(0.9); }
.leaf-cluster span:nth-child(3) { left: 14px; bottom: 130px; transform: rotate(-22deg) scale(0.8); }
.leaf-cluster span:nth-child(4) { left: 112px; bottom: 190px; transform: rotate(18deg) scale(0.72); }
.leaf-cluster span:nth-child(5) { left: 58px; bottom: 246px; transform: rotate(-26deg) scale(0.65); }

.birds {
  position: absolute;
  left: 88px;
  top: 250px;
  color: rgba(35, 145, 92, 0.42);
  font-size: 26px;
  letter-spacing: 22px;
}

.auth-brand {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 560px;
}

.auth-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  display: block;
  margin: 0 auto 18px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-brand h2 {
  margin: 18px 0 0;
  font-size: 23px;
  line-height: 1.3;
  font-weight: 800;
}

.auth-brand h2 span {
  color: var(--green);
}

.auth-brand p {
  margin: 12px auto 0;
  max-width: 520px;
  color: #63708a;
  font-size: 19px;
  line-height: 1.45;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(636px, 100%);
  margin-top: 34px;
  padding: 36px 56px 38px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.auth-card h3 {
  margin: 0;
  text-align: center;
  font-size: 28px;
  line-height: 1.15;
}

.auth-card .lead {
  margin: 12px 0 28px;
  color: #65728c;
  text-align: center;
  font-size: 17px;
}

.field {
  margin-bottom: 18px;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: #0c172b;
  font-size: 14px;
  font-weight: 750;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 16px;
  color: var(--green);
}

.input-shell input,
.input-shell textarea,
.input-shell select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.input-shell textarea {
  min-height: 54px;
  padding: 15px 0;
  resize: none;
}

.input-shell input::placeholder,
.input-shell textarea::placeholder {
  color: #8a98af;
}

.icon-btn,
.ghost-icon,
.round-icon {
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
}

.icon-btn:hover {
  background: var(--green-soft);
}

.auth-link-row {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 28px;
}

.link {
  color: var(--green);
  text-decoration: none;
  font-weight: 750;
  border: 0;
  background: transparent;
  padding: 0;
}

.primary-btn,
.secondary-btn,
.outline-btn,
.soft-btn,
.danger-btn {
  min-height: 44px;
  border-radius: 9px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #11a947, #078c35);
  box-shadow: 0 12px 24px rgba(8, 148, 55, 0.18);
}

.primary-btn:hover,
.secondary-btn:hover,
.outline-btn:hover,
.soft-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  color: var(--green);
  background: #fff;
  border-color: rgba(7, 148, 55, 0.34);
}

.outline-btn {
  color: #18243a;
  background: #fff;
  border-color: var(--line);
}

.soft-btn {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: rgba(7, 148, 55, 0.12);
}

.danger-btn {
  color: #d52222;
  background: #fff4f4;
}

.full-btn {
  width: 100%;
  min-height: 62px;
  font-size: 20px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #63708a;
  margin: 30px 0 26px;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.auth-switch {
  text-align: center;
  color: #65728c;
  font-size: 18px;
}

.agree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 22px;
  color: #21304a;
  font-size: 15px;
}

.agree-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.app-shell {
  height: 100dvh;
  background: #fff;
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-h);
  flex: 0 0 var(--header-h);
  display: grid;
  grid-template-columns: 340px minmax(420px, 660px) 260px;
  align-items: center;
  gap: 20px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.96);
  position: relative;
  z-index: 20;
}

.brand-only {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-only a {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.brand-only img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  transform: scale(1.68);
  transform-origin: center;
}

.mobile-menu-btn {
  display: none;
}

.lang-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.select-card {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  grid-template-columns: 32px 1fr 24px;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #fff;
  color: #0b1730;
}

.select-card small {
  display: block;
  color: #69758e;
  font-size: 12px;
  margin-bottom: 3px;
}

.select-card select {
  width: 100%;
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.user-menu {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0b1730;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 4px 8px;
}

.avatar,
.avatar-lg,
.avatar-xl {
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #07351a;
  font-weight: 850;
  background: linear-gradient(135deg, #f1faf3, #c8ecd1);
  border: 1px solid rgba(17, 52, 31, 0.07);
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar {
  width: 46px;
  height: 46px;
  font-size: 15px;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 22px;
}

.avatar-xl {
  width: 132px;
  height: 132px;
  font-size: 34px;
}

.page-wrap {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 28px;
  width: 100%;
  height: calc(100dvh - var(--header-h));
  min-height: 0;
  max-width: 1680px;
  margin: 0 auto;
  padding: 14px 30px 16px;
  overflow: hidden;
}

.page-wrap.chat {
  grid-template-columns: 280px minmax(0, 1120px);
  justify-content: center;
}

.page-wrap.authless {
  display: block;
  max-width: 980px;
}

.sidebar,
.rightbar,
.panel,
.thought-card,
.answer-card,
.agent-card,
.profile-hero,
.settings-card,
.drawer,
.policy-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.sidebar,
.rightbar {
  align-self: start;
  padding: 18px;
  position: relative;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
}

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

.nav-item,
.topic-row,
.activity-row,
.collection-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border-radius: 9px;
  color: #17243b;
  text-decoration: none;
  padding: 0 12px;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 15px;
}

.nav-item.active,
.topic-row.active {
  color: #057d2d;
  background: linear-gradient(90deg, #eef8f0, #f7fbf8);
  font-weight: 800;
}

.sidebar h3,
.rightbar h3,
.panel h3,
.settings-card h3 {
  margin: 0 0 16px;
  font-size: 17px;
}

.section-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 12px 0 16px;
}

.count {
  margin-left: auto;
  color: #42506a;
  background: #eaf6ed;
  min-width: 36px;
  text-align: center;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 13px;
}

.main-column {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
}

.chat-stream {
  width: min(1120px, 100%);
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}

.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2px 10px;
  scrollbar-width: thin;
}

.chat-scroll.empty-chat {
  padding-bottom: 0;
}

.question-row {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 14px;
  margin: 12px 0 12px;
}

.question-bubble {
  max-width: 820px;
  min-height: 52px;
  padding: 16px 22px;
  border-radius: 10px;
  background: linear-gradient(90deg, #eef6ee, #f8fbf8);
  display: flex;
  align-items: center;
  gap: 18px;
  color: #122035;
  box-shadow: var(--shadow-soft);
}

.time {
  color: #63708a;
  font-size: 12px;
  white-space: nowrap;
}

.thinking-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 26px 6px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  margin-bottom: 10px;
}

.thinking-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.thinking-head > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.thinking-card.collapsed {
  padding-bottom: 14px;
}

.thinking-card.collapsed .thinking-head {
  margin-bottom: 8px;
}

.thinking-card.collapsed .thinking-chevron {
  transform: rotate(-90deg);
}

.thinking-chevron {
  transition: transform 0.16s ease;
}

.thinking-summary {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.agent-list {
  display: grid;
  gap: 8px;
}

.agent-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  min-height: 58px;
  border-radius: 9px;
  padding: 9px 16px;
  background: linear-gradient(90deg, #eef7ef, #f8fbf8);
  animation: agentIn 0.24s ease both;
}

.agent-row.blue {
  background: linear-gradient(90deg, #edf7ff, #f6fbff);
}

@keyframes agentIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.bot-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--green);
}

.agent-name {
  color: #06812f;
  font-weight: 850;
  font-size: 13px;
}

.agent-row.blue .agent-name {
  color: #1262a3;
}

.agent-message {
  color: #25314a;
  font-size: 13.5px;
  line-height: 1.35;
}

.answer-card {
  padding: 16px 26px;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.answer-text {
  color: #1a263b;
  line-height: 1.55;
  font-size: 16px;
}

.source-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.source-strip a,
.source-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #38506d;
  text-decoration: none;
  font-size: 12px;
  background: #fff;
}

.answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.opinion-prompt {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 24px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-soft);
}

.prompt-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.prompt-left strong {
  display: block;
  margin-bottom: 4px;
}

.prompt-left span {
  color: var(--muted);
  font-size: 14px;
}

.people-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 20px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.strip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 800;
}

.mini-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.mini-card,
.related-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.mini-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.mini-card strong {
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eaf6ed;
  color: #08782f;
  font-size: 12px;
  font-weight: 750;
}

.mini-card p,
.related-card p {
  margin: 0;
  color: #25314a;
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}

.mini-thought-link {
  display: block;
  color: #25314a;
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}

.mini-thought-link:hover {
  color: var(--green-dark);
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #41506b;
  text-decoration: none;
}

.meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: #41506b;
  font-size: 13px;
  margin-top: 10px;
}

.composer {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: #fff;
  display: grid;
  grid-template-columns: 46px 1fr 54px;
  gap: 12px;
  align-items: end;
  box-shadow: var(--shadow-soft);
}

.chat-composer {
  flex: 0 0 auto;
  background: #fff;
  padding: 0 2px 0;
}

.chat-composer .composer {
  margin-top: 0;
}

.composer textarea {
  border: 0;
  resize: none;
  min-height: 48px;
  max-height: 170px;
  outline: 0;
  padding: 12px 4px;
  color: var(--text);
  font-size: 16px;
}

.composer small {
  grid-column: 2 / 4;
  color: #687690;
  margin-top: -6px;
}

.mic-btn,
.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  display: grid;
  place-items: center;
}

.mic-btn {
  color: var(--green);
  background: var(--green-soft);
}

.mic-btn.recording {
  color: #fff;
  background: #d91e3a;
  animation: mic 0.9s ease-in-out infinite alternate;
}

@keyframes mic {
  from { box-shadow: 0 0 0 0 rgba(217, 30, 58, 0.25); }
  to { box-shadow: 0 0 0 10px rgba(217, 30, 58, 0); }
}

.send-btn {
  color: #fff;
  background: linear-gradient(135deg, #15a84b, #078331);
}

.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin: 12px 0 20px;
}

.page-title h2 {
  margin: 0 0 8px;
  font-size: 27px;
  line-height: 1.2;
}

.page-title p {
  margin: 0;
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 116px;
  gap: 14px;
  margin-bottom: 22px;
}

.topic-pills {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 0 14px;
  margin-bottom: 16px;
}

.topic-pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 18px;
  color: #22304a;
  white-space: nowrap;
}

.topic-pill.active {
  color: #08782f;
  background: var(--green-soft);
  border-color: rgba(7, 148, 55, 0.28);
  font-weight: 800;
}

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

.thought-card {
  padding: 18px 20px;
  color: inherit;
  text-decoration: none;
}

.thought-top {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 14px;
  align-items: start;
}

.thought-author {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.thought-author strong {
  font-size: 15px;
}

.thought-text {
  display: block;
  margin: 0;
  color: #111c31;
  font-size: 15.5px;
  line-height: 1.55;
  text-decoration: none;
}

.bookmark {
  color: #34435d;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 22px 0;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #34435d;
}

.page-btn.active {
  color: #fff;
  background: var(--green);
}

.right-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: #fff;
  margin-bottom: 16px;
}

.filter-grid {
  display: grid;
  gap: 12px;
}

.filter-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
}

.detail-layout {
  grid-template-columns: 300px minmax(0, 1fr) 300px;
}

.detail-main {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-soft);
}

.detail-main h1 {
  margin: 8px 0 10px;
  font-size: 24px;
  line-height: 1.3;
}

.translated-box {
  background: linear-gradient(90deg, #f0f7ef, #f8fbf8);
  border-radius: 10px;
  padding: 26px 34px;
  color: #1e273b;
  font-size: 18px;
  line-height: 1.9;
  margin: 14px 0;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 100px;
  margin-top: 14px;
}

.action-bar {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #fff;
}

.comments-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px 18px;
}

.comment-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.comment-row:last-child {
  border-bottom: 0;
}

.comment-row p {
  margin: 4px 0 0;
  color: #25314a;
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
  margin-top: 14px;
}

.comment-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 14px;
}

.profile-hero {
  padding: 24px;
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 28px;
  align-items: center;
  margin-bottom: 22px;
}

.profile-copy h2 {
  margin: 0 0 4px;
  font-size: 27px;
}

.profile-copy .username {
  color: #42506b;
  font-weight: 700;
}

.profile-copy p {
  color: #27334d;
  line-height: 1.55;
}

.stats-row {
  display: flex;
  gap: 36px;
  margin-top: 22px;
}

.stat strong {
  display: block;
  font-size: 22px;
}

.stat span {
  color: #42506b;
  font-size: 14px;
}

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

.tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.tab {
  min-height: 54px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #394963;
  font-weight: 800;
  padding: 0 22px;
}

.tab.active {
  color: var(--green);
  border-color: var(--green);
}

.settings-layout {
  grid-template-columns: 290px minmax(0, 1fr) 330px;
}

.settings-card {
  padding: 22px;
  margin-bottom: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  gap: 16px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
}

.toggle input {
  display: none;
}

.toggle span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #7b879a;
  transition: background 0.2s ease;
}

.toggle span::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
}

.toggle input:checked + span {
  background: var(--green);
}

.toggle input:checked + span::after {
  transform: translateX(20px);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 20, 34, 0.12);
  z-index: 40;
}

.drawer {
  position: fixed;
  z-index: 41;
  right: 0;
  top: var(--header-h);
  bottom: 0;
  width: min(560px, 100vw);
  border-radius: 14px 0 0 14px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -18px 0 42px rgba(12, 26, 44, 0.12);
}

.drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.drawer-head h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 24px;
}

.steps {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 20px;
}

.drawer form {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.drawer form .full-btn {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 12px;
  box-shadow: 0 -10px 20px rgba(255, 255, 255, 0.92), 0 12px 24px rgba(8, 148, 55, 0.18);
}

.step {
  border: 0;
  background: transparent;
  text-align: center;
  color: #5f6d86;
  font-size: 12px;
  padding: 0;
}

.step-num {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  margin: 0 auto 6px;
  background: #fff;
  font-weight: 800;
}

.step.active {
  color: var(--green);
  font-weight: 800;
}

.step.active .step-num {
  color: #fff;
  background: var(--green);
}

.accordion {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}

.accordion.open {
  border-color: rgba(7, 148, 55, 0.42);
  background: var(--green-pale);
}

.accordion-head {
  width: 100%;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: 34px 1fr 20px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  color: var(--text);
  text-align: left;
}

.accordion-body {
  padding: 0 14px 14px 60px;
}

.drawer-step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.drawer-topic-pills {
  flex-wrap: wrap;
  overflow: visible;
  padding-bottom: 0;
  margin-bottom: 0;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.choice {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  padding: 12px 14px;
}

.choice.active {
  border-color: rgba(7, 148, 55, 0.46);
  background: var(--green-soft);
}

.preview-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  margin: 10px 0 18px;
}

.policy-card {
  padding: 28px;
  margin: 26px auto;
}

.policy-card h1 {
  margin-top: 0;
}

.policy-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}

.policy-section:last-child {
  border-bottom: 0;
}

.policy-section h3 {
  margin: 0 0 8px;
}

.policy-section p {
  margin: 0;
  color: #31405a;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #0e1b2d;
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  z-index: 80;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.mobile-bottom-nav {
  display: none;
}

.rtl-text {
  direction: rtl;
  text-align: right;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 150px 1fr 120px;
  }

  .page-wrap,
  .detail-layout,
  .settings-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .rightbar {
    grid-column: 2;
    position: static;
  }

  .mini-cards {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    gap: 18px;
  }
}

@media (max-width: 860px) {
  :root {
    --header-h: 76px;
  }

  .auth-page {
    padding: 20px 14px 36px;
  }

  .auth-logo {
    width: 78px;
    height: 78px;
  }

  .auth-brand h1 {
    font-size: 28px;
  }

  .auth-brand h2 {
    font-size: 18px;
  }

  .auth-brand p {
    font-size: 15px;
  }

  .auth-card {
    padding: 26px 18px 28px;
    margin-top: 24px;
    border-radius: 18px;
  }

  .auth-card h3 {
    font-size: 24px;
  }

  .leaf-cluster,
  .birds {
    opacity: 0.32;
  }

  .topbar {
    grid-template-columns: 54px 1fr 58px;
    gap: 10px;
    padding: 0 14px;
  }

  .brand-only img {
    width: 54px;
    height: 54px;
  }

  .lang-controls {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .select-card {
    min-height: 48px;
    grid-template-columns: 24px 1fr;
    padding: 6px 8px;
  }

  .select-card small {
    display: none;
  }

  .select-card select {
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .select-card .chev {
    display: none;
  }

  .user-menu span,
  .user-menu .chev {
    display: none;
  }

  .avatar {
    width: 38px;
    height: 38px;
  }

  .page-wrap,
  .page-wrap.chat,
  .detail-layout,
  .settings-layout {
    display: block;
    height: calc(100dvh - var(--header-h));
    padding: 14px 12px 76px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .page-wrap.chat {
    overflow: hidden;
  }

  .chat-stream {
    height: 100%;
  }

  .chat-scroll {
    padding-bottom: 10px;
  }

  .sidebar,
  .rightbar {
    position: static;
    margin-bottom: 14px;
    max-height: none;
    overflow: visible;
  }

  .sidebar.mobile-collapse {
    display: none;
  }

  .question-row {
    gap: 8px;
  }

  .question-bubble {
    padding: 12px 14px;
    font-size: 14px;
  }

  .thinking-card,
  .answer-card,
  .people-strip,
  .thought-card,
  .detail-main,
  .comments-panel,
  .settings-card,
  .profile-hero {
    border-radius: 12px;
  }

  .thinking-card {
    padding: 12px 12px 6px;
  }

  .thinking-head {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .answer-card {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .agent-row {
    grid-template-columns: 34px 1fr;
    gap: 9px;
    min-height: 54px;
    padding: 8px;
  }

  .agent-name {
    font-size: 12px;
  }

  .agent-message {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.3;
  }

  .agent-row .time {
    font-size: 11px;
  }

  .bot-mark {
    width: 34px;
    height: 34px;
  }

  .opinion-prompt {
    align-items: stretch;
    flex-direction: column;
  }

  .search-row,
  .comment-form,
  .settings-grid,
  .form-grid,
  .choice-row {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }

  .profile-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .profile-actions,
  .stats-row {
    justify-content: center;
    flex-wrap: wrap;
  }

  .tabs {
    overflow-x: auto;
    gap: 0;
  }

  .tab {
    flex: 0 0 auto;
  }

  .drawer {
    top: 0;
    bottom: 0;
    height: 100dvh;
    width: 100vw;
    border-radius: 0;
    padding-bottom: 74px;
  }

  .steps {
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    overflow-x: auto;
  }

  .accordion-body {
    padding-left: 14px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: 66px;
    background: #fff;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    border: 0;
    background: #fff;
    color: #3d4c66;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 750;
  }

  .mobile-bottom-nav .active {
    color: var(--green);
  }
}
