:root {
  --ink: #18312d;
  --muted: #697b77;
  --line: #dce6e2;
  --surface: #ffffff;
  --canvas: #f3f6f4;
  --green-950: #102f2a;
  --green-900: #133b35;
  --green-800: #1b5148;
  --green-700: #22675a;
  --green-100: #dff0e9;
  --green-50: #edf7f3;
  --amber: #9a6514;
  --amber-bg: #fff4d9;
  --red: #a33b36;
  --red-bg: #fff0ee;
  --shadow: 0 18px 48px rgba(25, 57, 51, 0.09);
  --radius: 20px;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 8%, rgba(214, 235, 226, 0.7), transparent 24rem),
    var(--canvas);
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(34, 103, 90, 0.22);
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 20px 20px;
  color: #eff8f5;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), transparent 35%),
    var(--green-950);
  z-index: 20;
}

.brand,
.user-card,
.sidebar-note,
.nav-item,
.topbar,
.section-heading,
.panel-heading,
.composer-footer,
.modal-heading,
.form-row,
.record-topline,
.feedback-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 13px;
  padding: 2px 6px 30px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--green-950);
  background: #b9dfd2;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  font-size: 1.35rem;
  font-weight: 800;
}

.brand-mark.large {
  width: 58px;
  height: 58px;
  margin-inline: auto;
  border-radius: 18px;
  font-size: 1.7rem;
}

.brand strong {
  display: block;
  font-size: 1.15rem;
}

.brand span,
.user-copy span,
.sidebar-note span {
  display: block;
  margin-top: 4px;
  color: #a9c2bb;
  font-size: 0.75rem;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 48px;
  gap: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 13px;
  color: #bcd0ca;
  background: transparent;
  text-align: right;
  transition: 160ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.is-active {
  color: #fff;
  background: rgba(185, 223, 210, 0.13);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  right: 0;
  width: 3px;
  height: 24px;
  border-radius: 3px 0 0 3px;
  background: #8ed0ba;
}

.nav-symbol {
  color: #8ed0ba;
  font-size: 1.1rem;
}

.nav-count {
  margin-right: auto;
  min-width: 22px;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--green-950);
  background: #b9dfd2;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.sidebar-note {
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(185, 223, 210, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.sidebar-note strong {
  font-size: 0.8rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #75d7b5;
  box-shadow: 0 0 0 4px rgba(117, 215, 181, 0.1);
}

.user-card {
  gap: 10px;
  margin-top: 14px;
  padding: 14px 4px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: #eaf7f2;
  background: #28594f;
  font-weight: 800;
}

.user-copy {
  min-width: 0;
  flex: 1;
}

.user-copy strong {
  display: block;
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  font-size: 1.2rem;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 104px;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(24px, 4vw, 58px);
  border-bottom: 1px solid rgba(207, 220, 215, 0.7);
  background: rgba(246, 248, 247, 0.8);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green-700);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 2.3vw, 2rem);
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

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

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid #d8e7e1;
  border-radius: 999px;
  color: #3f665e;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
}

.mobile-menu {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.view {
  display: none;
  padding: clamp(24px, 3vw, 46px) clamp(24px, 4vw, 58px);
  animation: reveal 220ms ease;
}

.view.is-visible {
  display: block;
}

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

.chat-layout {
  width: 100%;
  min-height: calc(100vh - 196px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.chat-feed {
  flex: 1;
  padding-bottom: 26px;
}

.conversation-toolbar,
.conversation-toolbar > div,
.archive-panel-heading {
  display: flex;
  align-items: center;
}

.conversation-toolbar {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.conversation-toolbar > div {
  gap: 8px;
}

.secondary-button.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.7rem;
}

.secondary-button.danger {
  border-color: #edc9c3;
  color: #9b4135;
  background: #fff8f7;
}

.archive-panel {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid #d8e5e0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 32px rgba(31, 74, 65, 0.07);
}

.archive-panel-heading {
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid #e6eeeb;
}

.archive-panel-heading > div {
  display: grid;
  gap: 3px;
}

.archive-panel-heading span,
.archive-item span {
  color: var(--muted);
  font-size: 0.66rem;
}

.archive-list {
  max-height: 310px;
  overflow: auto;
  padding: 7px;
}

.archive-item {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid #edf2f0;
  color: var(--ink);
  background: transparent;
  text-align: right;
}

.archive-item:hover {
  border-radius: 10px;
  background: var(--green-50);
}

.welcome-card {
  max-width: 760px;
  margin: clamp(24px, 8vh, 92px) auto 0;
  text-align: center;
}

.welcome-card > p:not(.eyebrow) {
  max-width: 630px;
  margin: 0 auto 28px;
  color: var(--muted);
  line-height: 1.95;
}

.welcome-orbit {
  position: relative;
  width: 82px;
  height: 82px;
  margin: 0 auto 24px;
  display: grid;
  place-items: center;
  border: 1px solid #bad9cf;
  border-radius: 50%;
}

.welcome-orbit::before,
.welcome-orbit::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(34, 103, 90, 0.15);
  border-radius: 50%;
}

.welcome-orbit::before {
  inset: -9px;
}

.welcome-orbit::after {
  inset: 13px;
  background: var(--green-900);
}

.welcome-orbit span {
  position: relative;
  z-index: 1;
  color: #dff5ed;
  font-size: 1.45rem;
  font-weight: 800;
}

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

.quick-question {
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: #35534d;
  background: rgba(255, 255, 255, 0.72);
  text-align: right;
  line-height: 1.55;
  transition: 150ms ease;
}

.quick-question:hover {
  border-color: #9fc9bb;
  background: var(--surface);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(31, 74, 65, 0.07);
}

.composer {
  position: sticky;
  bottom: 18px;
  overflow: hidden;
  border: 1px solid #ceded8;
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topic-ending {
  position: relative;
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}

.end-topic-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #e5cab7;
  border-radius: 11px;
  color: #a44b18;
  background: #fff8f2;
  font-size: 0.72rem;
  font-weight: 750;
}

.end-topic-button:hover,
.end-topic-button[aria-expanded="true"] {
  border-color: #df9a6c;
  background: #fff0e5;
}

.end-topic-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 45px;
  z-index: 8;
  padding: 16px;
  border: 1px solid #e7c9b5;
  border-radius: 16px;
  background: #fffdfb;
  box-shadow: 0 18px 45px rgba(83, 48, 27, 0.14);
}

.end-topic-heading,
.topic-rating-row,
.topic-comment-toggle,
.topic-stars {
  display: flex;
  align-items: center;
}

.end-topic-heading {
  justify-content: space-between;
  gap: 18px;
}

.end-topic-heading > div {
  display: grid;
  gap: 5px;
}

.end-topic-heading strong {
  color: #61341d;
  font-size: 0.82rem;
}

.end-topic-heading span,
.topic-rating-row > span,
.topic-comment-wrap label {
  color: #886652;
  font-size: 0.68rem;
  line-height: 1.7;
}

.topic-comment-toggle,
.topic-cancel {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #ead8cc;
  border-radius: 9px;
  color: #875137;
  background: #fff;
  font-size: 0.68rem;
}

.topic-comment-toggle {
  gap: 6px;
}

.topic-comment-wrap {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}

.topic-comment-wrap textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid #ead8cc;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  line-height: 1.75;
}

.topic-rating-row {
  gap: 10px;
  margin-top: 13px;
}

.topic-stars {
  gap: 7px;
}

.topic-stars button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #efc59f;
  border-radius: 9px;
  color: #d86a1e;
  background: #fff8ef;
  letter-spacing: 1px;
}

.topic-stars button:hover {
  border-color: #dc7a36;
  color: #b94e09;
  background: #ffead8;
}

.topic-stars .topic-no-rating {
  letter-spacing: 0;
  color: #795b49;
  background: #fff;
}

.topic-cancel {
  margin-right: auto;
}

.topic-boundary {
  display: grid;
  grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr);
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: #9b582e;
}

.topic-boundary > span {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e6b994);
}

.topic-boundary > span:last-child {
  background: linear-gradient(90deg, #e6b994, transparent);
}

.topic-boundary-content {
  display: grid;
  gap: 3px;
  max-width: 520px;
  text-align: center;
}

.topic-boundary-content strong {
  font-size: 0.7rem;
}

.topic-boundary-content span {
  color: #8a7568;
  font-size: 0.64rem;
  line-height: 1.65;
}

.composer textarea {
  width: 100%;
  min-height: 62px;
  max-height: 180px;
  padding: 18px 20px 8px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  line-height: 1.8;
}

.composer-footer {
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px 10px 18px;
}

.composer-footer > span {
  color: #899792;
  font-size: 0.68rem;
}

.send-button,
.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 12px;
  font-weight: 700;
}

.send-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 0;
  color: #fff;
  background: var(--green-900);
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.message {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

.message.user {
  justify-content: flex-start;
}

.message-bubble {
  max-width: min(720px, 88%);
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 5px 18px;
  background: var(--surface);
  line-height: 1.95;
  white-space: pre-wrap;
}

.message-bubble.has-presentation {
  width: 100%;
  max-width: 100%;
}

.message.user .message-bubble {
  border-color: #cce1d9;
  border-radius: 18px 18px 18px 5px;
  background: var(--green-50);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.data-presentation {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #d8e6e1;
  border-radius: 13px;
  background: #fff;
  white-space: normal;
}

.data-presentation-title {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid #e5eeeb;
  color: var(--green-900);
  background: #f4faf7;
  font-size: 0.75rem;
}

.data-table-viewport {
  max-width: 100%;
  overflow: auto;
}

.data-presentation table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}

.data-presentation th,
.data-presentation td {
  min-width: 0;
  padding: 9px 11px;
  border-bottom: 1px solid #edf2f0;
  text-align: right;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.data-presentation [data-column$="Code"],
.data-presentation [data-column="code"] {
  white-space: nowrap;
}

.data-presentation th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #47665f;
  background: #f9fbfa;
  font-weight: 750;
}

.data-presentation tbody tr:nth-child(even) {
  background: #fbfdfc;
}

.review-answer {
  padding: 10px 12px;
  border-right: 3px solid #bdd9d0;
  background: #f7fbf9;
}

.review-comment {
  padding: 9px 12px;
  border-radius: 9px;
  color: #79461e !important;
  background: #fff7ed;
}

.developer-metadata {
  margin-top: 12px;
  border-top: 1px dashed #d1dfda;
  color: #45635d;
  font-size: 0.68rem;
}

.developer-metadata > summary {
  cursor: pointer;
  margin-top: 9px;
  padding: 8px 0;
  color: #2d6f61;
  font-weight: 700;
}

.developer-metadata[open] > summary {
  margin-bottom: 8px;
}

.developer-body {
  padding: 0 2px 5px;
}

.developer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.developer-grid > div {
  display: grid;
  gap: 2px;
}

.developer-grid span {
  color: #72817c;
}

.developer-grid strong {
  color: #26453e;
}

.developer-list-section {
  margin-top: 10px;
}

.developer-list-section h5 {
  margin: 0 0 6px;
  color: #2d6f61;
  font-size: 0.68rem;
}

.developer-list {
  margin: 0;
  padding-right: 16px;
  color: #465e59;
  line-height: 1.95;
}

.developer-empty {
  color: #74857f;
}

.developer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.developer-tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f0f6f2;
  color: #3a5852;
}

.developer-call-list {
  display: grid;
  gap: 5px;
}

.developer-call-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #e5efea;
  border-radius: 8px;
  background: #f8fbf9;
}

.developer-call-item span:first-child {
  color: #2d5d56;
}

.developer-call-item span:last-child {
  color: #64746f;
}

.tool-chip,
.correlation,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.65rem;
}

.tool-chip {
  color: #285a50;
  background: #e5f3ee;
}

.tool-chip.failed {
  color: var(--red);
  background: var(--red-bg);
}

.correlation {
  color: #687974;
  background: #eef2f0;
}

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.thinking i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6cae9b;
  animation: pulse 900ms infinite alternate;
}

.thinking i:nth-child(2) { animation-delay: 180ms; }
.thinking i:nth-child(3) { animation-delay: 360ms; }

@keyframes pulse {
  to { opacity: 0.25; transform: translateY(-3px); }
}

.feedback-row {
  gap: 8px;
  margin-top: 10px;
}

.feedback-row span {
  color: var(--muted);
  font-size: 0.68rem;
}

.feedback-button {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #4e655f;
  background: #fff;
  font-size: 0.68rem;
}

.feedback-button:hover,
.feedback-button.is-selected {
  border-color: #95c6b7;
  color: var(--green-800);
  background: var(--green-50);
}

.section-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.section-heading p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.8;
}

.primary-button,
.secondary-button {
  padding: 0 18px;
}

.primary-button {
  border: 1px solid var(--green-900);
  color: #fff;
  background: var(--green-900);
}

.primary-button:hover {
  background: var(--green-800);
}

.primary-button.full {
  width: 100%;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--green-800);
  background: var(--surface);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card,
.panel {
  border: 1px solid rgba(211, 224, 219, 0.9);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 36px rgba(31, 74, 65, 0.045);
}

.summary-card {
  padding: 20px;
  border-radius: 17px;
}

.summary-card span,
.summary-card small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.summary-card strong {
  display: block;
  margin: 9px 0;
  color: var(--green-900);
  font-size: 1.8rem;
}

.content-grid,
.review-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
}

.panel {
  overflow: hidden;
  border-radius: var(--radius);
}

.panel-heading {
  min-height: 64px;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid #e5ece9;
}

.subtle {
  color: var(--muted);
  font-size: 0.7rem;
}

select,
input,
textarea {
  border: 1px solid #cedbd7;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
}

select {
  min-height: 36px;
  padding: 0 10px 0 28px;
  font-size: 0.72rem;
}

.record-list {
  max-height: 510px;
  overflow: auto;
  padding: 8px;
}

.record-list.wide {
  max-height: none;
}

.record {
  padding: 15px;
  border-bottom: 1px solid #edf1ef;
}

.record:last-child {
  border-bottom: 0;
}

.record-topline {
  justify-content: space-between;
  gap: 10px;
}

.record h4 {
  margin: 0;
  font-size: 0.9rem;
}

.record p {
  margin: 9px 0 0;
  color: #526a64;
  font-size: 0.78rem;
  line-height: 1.8;
}

.record small {
  display: block;
  margin-top: 8px;
  color: #8a9894;
  font-size: 0.65rem;
}

.record-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.record-actions button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 0.7rem;
}

.record-actions .approve {
  border-color: #add4c7;
  color: var(--green-800);
  background: var(--green-50);
}

.record-actions .reject {
  border-color: #edc6c1;
  color: var(--red);
  background: var(--red-bg);
}

.badge {
  color: #49635c;
  background: #eaf0ee;
}

.badge.provisional,
.badge.pending {
  color: var(--amber);
  background: var(--amber-bg);
}

.badge.approved,
.badge.resolved {
  color: var(--green-800);
  background: var(--green-100);
}

.badge.rejected,
.badge.expired {
  color: var(--red);
  background: var(--red-bg);
}

.badge.conflict_review,
.badge.open {
  color: #7253a4;
  background: #f1eaff;
}

.empty-state {
  padding: 38px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
}

.review-layout {
  grid-template-columns: minmax(300px, 0.75fr) minmax(320px, 1.25fr);
}

.form-panel {
  padding-bottom: 20px;
}

.form-panel > label,
.modal > label,
.form-row label {
  display: grid;
  gap: 8px;
}

.form-panel > label {
  margin: 18px 20px;
}

label > span {
  color: #465e58;
  font-size: 0.76rem;
  font-weight: 700;
}

label input,
label textarea,
label select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  outline: 0;
}

label textarea {
  resize: vertical;
  line-height: 1.7;
}

.form-panel > .primary-button {
  margin: 2px 20px 0;
}

.review-explainer {
  padding: 28px;
}

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

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

.settings-inline,
.role-grid,
.settings-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-inline > label {
  flex: 1;
}

.check-label {
  min-height: 44px;
  display: flex !important;
  align-items: center;
  gap: 9px;
}

.check-label input {
  width: 18px;
  height: 18px;
}

.role-grid {
  align-items: start;
}

.role-grid > label {
  flex: 1;
}

.field-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.8;
}

.settings-actions {
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.74rem;
}

.large-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 16px;
  color: var(--green-800);
  background: var(--green-100);
  font-size: 1.5rem;
}

.review-explainer ul {
  padding-right: 20px;
  color: #526a64;
  line-height: 2.1;
}

.export-result {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #cce1d9;
  border-radius: 13px;
  color: #315d53;
  background: var(--green-50);
  font-size: 0.75rem;
  line-height: 1.8;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  padding: 22px;
  place-items: center;
  background: rgba(11, 31, 27, 0.56);
  backdrop-filter: blur(8px);
}

.modal-backdrop.is-open {
  display: grid;
}

.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(8, 30, 25, 0.24);
}

.session-card {
  width: min(470px, 100%);
  text-align: center;
}

.session-card h2 {
  margin-top: 18px;
}

.session-card > p:not(.eyebrow, .form-error) {
  color: var(--muted);
  line-height: 1.9;
}

.session-card label {
  margin: 22px 0 12px;
  text-align: right;
}

.session-card small {
  display: block;
  margin-top: 14px;
  color: #82928d;
  line-height: 1.7;
}

.sara-auth-backdrop {
  padding: 24px;
  overflow: hidden;
  color: #fff7ed;
  background: #130a04;
  backdrop-filter: none;
}

.sara-auth-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 139, 61, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 139, 61, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
}

.sara-auth-splash {
  position: relative;
  z-index: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  min-height: 100dvh;
  color: #fff7ed;
}

.sara-auth-splash-logo,
.sara-auth-logo-frame {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 139, 61, 0.36);
  border-radius: 8px;
  color: #ffb16f;
  background: rgba(54, 25, 8, 0.48);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34), inset 0 0 28px rgba(255, 139, 61, 0.07);
  backdrop-filter: blur(18px);
  font-weight: 800;
}

.sara-auth-splash-logo {
  width: 180px;
  height: 180px;
  font-size: 5.2rem;
  animation: sara-auth-logo-arrive 3s cubic-bezier(0.2, 0.72, 0.25, 1) both;
}

.sara-auth-splash-copy {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  animation: sara-auth-copy-arrive 1.1s 1.65s ease-out both;
}

.sara-auth-splash-copy strong {
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.5;
}

.sara-auth-splash-copy span {
  color: rgba(255, 247, 237, 0.78);
  font-size: 0.88rem;
}

.sara-auth-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: 30px;
  border: 1px solid rgba(255, 139, 61, 0.25);
  border-radius: 8px;
  color: #fff7ed;
  background: rgba(54, 25, 8, 0.8);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.46), inset 0 0 40px rgba(255, 139, 61, 0.04);
  backdrop-filter: blur(20px);
}

.sara-auth-logo-frame {
  width: 107px;
  height: 107px;
  margin: 0 auto 18px;
  border-color: rgba(255, 139, 61, 0.29);
  background: rgba(35, 14, 4, 0.48);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  font-size: 3.2rem;
}

.sara-auth-heading {
  margin-bottom: 26px;
  text-align: center;
}

.sara-auth-heading span {
  color: #ff9b4a;
  font-size: 0.82rem;
}

.sara-auth-heading h2 {
  margin: 7px 0;
  color: #fff7ed;
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.45;
}

.sara-auth-heading p {
  margin: 0;
  color: #c9aa92;
  font-size: 0.9rem;
}

.sara-auth-panel {
  gap: 0;
}

.sara-auth-panel > label {
  display: grid;
  gap: 7px;
  margin-bottom: 17px;
  color: #f3ddca;
  font-size: 0.88rem;
}

.sara-auth-input {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid rgba(255, 139, 61, 0.27);
  border-radius: 8px;
  color: #ff9b4a;
  background: rgba(25, 8, 2, 0.7);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.sara-auth-input:focus-within {
  border-color: #ff8a3d;
  background: rgba(34, 11, 2, 0.92);
  box-shadow: 0 0 0 3px rgba(255, 139, 61, 0.13);
}

.sara-auth-input > svg {
  width: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sara-auth-input input {
  min-width: 0;
  min-height: 48px;
  flex: 1;
  padding: 0;
  border: 0 !important;
  outline: 0;
  color: #fff7ed !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 1rem;
}

.sara-auth-input input::placeholder {
  color: #95725a;
}

.sara-auth-input input:disabled {
  opacity: 0.7;
}

.sara-auth-input button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #ff9b4a;
  background: rgba(255, 139, 61, 0.09);
}

.sara-auth-input button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sara-auth-code-input input {
  text-align: center;
  font-size: 1.25rem;
  letter-spacing: 8px;
}

.sara-auth-code-ready {
  color: #43d19e;
}

.sara-auth-submit {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(255, 160, 79, 0.72);
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #ff9b45, #d95008);
  box-shadow: 0 12px 26px rgba(217, 80, 8, 0.25);
  font-size: 1rem;
  font-weight: 500;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.sara-auth-submit svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sara-auth-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #ffad63, #ee6418);
  box-shadow: 0 16px 30px rgba(217, 80, 8, 0.32);
}

.sara-auth-submit:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.sara-auth-resend {
  width: 100%;
  min-height: 36px;
  margin-top: 10px;
  border: 0;
  color: #ff9b4a;
  background: transparent;
}

.sara-auth-resend:disabled {
  color: #95725a;
  cursor: default;
}

.sara-auth-error,
.sara-auth-notice {
  margin-bottom: 17px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
}

.sara-auth-error {
  border: 1px solid rgba(255, 90, 110, 0.3);
  color: #ff9dad;
  background: rgba(205, 48, 83, 0.12);
}

.sara-auth-notice {
  border: 1px solid rgba(67, 209, 158, 0.3);
  color: #7ee8c1;
  background: rgba(21, 150, 107, 0.12);
}

.sara-auth-spin {
  animation: sara-auth-spin 0.8s linear infinite;
}

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

@keyframes sara-auth-logo-arrive {
  0% { opacity: 0; transform: scale(0.72); filter: blur(14px); }
  55% { opacity: 0.72; transform: scale(0.96); filter: blur(2px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes sara-auth-copy-arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-error {
  min-height: 20px;
  margin-bottom: 7px;
  color: var(--red);
  font-size: 0.72rem;
}

.modal-heading {
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-heading .icon-button {
  color: var(--ink);
}

.modal > label {
  margin-bottom: 16px;
}

.form-row {
  align-items: start;
  gap: 12px;
}

.form-row > label {
  flex: 1;
  margin-bottom: 16px;
}

.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #f0ddb2;
  border-radius: 11px;
  color: #7c601f;
  background: #fff9e9;
  font-size: 0.7rem;
  line-height: 1.8;
}

.toast-region {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 200;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: 380px;
  padding: 12px 16px;
  border: 1px solid #cbded7;
  border-radius: 12px;
  color: #fff;
  background: var(--green-900);
  box-shadow: var(--shadow);
  font-size: 0.76rem;
  animation: toast-in 180ms ease;
}

.toast.error {
  border-color: #c56f68;
  background: #7e2e2a;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

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

[hidden] {
  display: none !important;
}

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

  .sidebar {
    position: fixed;
    right: 0;
    width: min(290px, 84vw);
    transform: translateX(105%);
    transition: transform 200ms ease;
    box-shadow: -20px 0 60px rgba(9, 30, 25, 0.2);
  }

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

  .mobile-menu {
    display: grid;
    place-items: center;
  }

  .content-grid,
  .review-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-wide {
    grid-column: auto;
  }
}

@media (max-width: 680px) {
  .topbar {
    min-height: 86px;
    padding: 17px 18px;
  }

  .connection-state {
    display: none;
  }

  .view {
    padding: 22px 16px 28px;
  }

  .quick-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    margin-top: 24px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading .primary-button,
  .section-heading .secondary-button {
    width: 100%;
  }

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

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

  .end-topic-heading,
  .topic-rating-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topic-comment-toggle,
  .topic-cancel {
    width: 100%;
    justify-content: center;
    margin-right: 0;
  }

  .topic-stars {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

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

  .form-row {
    display: grid;
  }

  .sara-auth-backdrop {
    padding: 10px;
  }

  .sara-auth-panel {
    padding: 20px 17px;
  }

  .sara-auth-logo-frame {
    width: 94px;
    height: 94px;
    margin-bottom: 12px;
  }

  .sara-auth-heading {
    margin-bottom: 18px;
  }

  .sara-auth-heading h2 {
    font-size: 1.5rem;
  }

  .sara-auth-panel > label {
    margin-bottom: 13px;
  }

  .sara-auth-splash-logo {
    width: 150px;
    height: 150px;
    font-size: 4.4rem;
  }

  .settings-inline,
  .role-grid,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

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

  .sara-auth-splash-logo,
  .sara-auth-splash-copy {
    animation: none;
  }
}
