:root {
  color-scheme: light;
  --ink: #122b28;
  --muted: #526964;
  --forest: #102e2b;
  --forest-hover: #22443e;
  --green: #1c5d50;
  --green-hover: #17483f;
  --linen: #f5f8f7;
  --surface: #fff;
  --line: #d9e4e0;
  --mint: #e8f2ee;
  --warm: #faf4e8;
  --warm-edge: #bd8434;
  --focus: #257b9c;
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--linen);
  font-synthesis: none;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

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

a,
button,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

a {
  color: var(--green);
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  font-weight: 650;
}

h2 {
  font-size: 1.23rem;
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  font-weight: 680;
}

.button {
  display: inline-flex;
  width: fit-content;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  text-align: center;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 650;
}

.button.primary {
  color: white;
  background: var(--green);
}

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

.button.secondary,
.button.google {
  border-color: var(--line);
  background: var(--surface);
}

.button.secondary:hover:not(:disabled),
.button.google:hover {
  background: var(--mint);
}

.button.quiet {
  color: var(--green);
}

.button.quiet:hover {
  background: var(--mint);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.28rem;
  font-weight: 710;
  letter-spacing: -0.05em;
}

.brand-mark {
  border-radius: 8px;
}

.sandbox-label {
  width: fit-content;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 630;
  white-space: nowrap;
}

.auth-layout {
  display: grid;
  min-height: 100svh;
  grid-template-columns: minmax(17rem, 2fr) 3fr;
}

.auth-identity {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 27rem;
  padding: clamp(1.25rem, 5vw, 4rem);
  background: var(--forest);
  color: white;
}

.auth-brand-title {
  max-width: 6ch;
  color: #d6e9e2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 7vw, 6rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.auth-identity .sandbox-label {
  color: #b6cec7;
}

.auth-content {
  display: flex;
  width: min(100%, 33rem);
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 6vw, 4rem);
}

.auth-content .button.google,
.form-stack .button.primary {
  width: 100%;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.auth-links .button {
  padding-inline: 0.25rem;
}

.form-stack {
  display: grid;
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 650;
}

.field input,
.composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.68rem 0.75rem;
  border: 1px solid #aabeb7;
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font-size: 1rem;
  font-weight: 400;
}

.setup-page {
  display: grid;
  min-height: 100svh;
  grid-template-rows: auto 1fr auto;
  gap: 2rem;
  padding: clamp(1.5rem, 5vw, 4rem);
}

.setup-card {
  display: grid;
  width: min(100%, 29rem);
  gap: 1.1rem;
  place-self: center;
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.setup-card p,
.settings-panel p,
.empty-state p {
  color: var(--muted);
}

.workspace-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  padding: 1.25rem;
  color: #eef8f3;
  background: var(--forest);
}

.sidebar :where(button, select):focus-visible {
  outline-color: #9de2f4;
}

.workspace-actions {
  display: grid;
  gap: 0.15rem;
}

.workspace-select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.5rem 0.6rem;
  border: 1px solid #467368;
  border-radius: 7px;
  color: #fbfffc;
  background: var(--forest-hover);
  font-size: 1rem;
  font-weight: 650;
}

.workspace-actions .button,
.sidebar-footer .button {
  color: #d8ebe4;
  padding-inline: 0.4rem;
}

.sidebar .button:hover {
  color: white;
  background: var(--forest-hover);
}

.navigation {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.navigation button {
  min-height: 44px;
  padding: 0.5rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #d8ebe4;
  background: transparent;
  text-align: left;
  font-size: 0.89rem;
  font-weight: 650;
}

.navigation button:hover,
.navigation button[aria-current="page"] {
  color: white;
  background: var(--forest-hover);
}

.navigation button[aria-current="page"] {
  border-color: #53776c;
}

.sidebar-footer {
  display: grid;
  gap: 0.35rem;
  margin-top: auto;
}

.account-email {
  min-width: 0;
  color: #c8dfd6;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

.main-panel {
  width: min(100%, 94rem);
  min-width: 0;
  padding: clamp(1rem, 4vw, 3.5rem);
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: 1.25rem;
}

.page-content,
.conversation-detail,
.conversation-list {
  min-width: 0;
}

.inbox-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 20rem) minmax(0, 1fr);
  min-height: min(38rem, 72svh);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.conversation-list {
  border-inline-end: 1px solid var(--line);
}

.conversation-row {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 0.18rem;
  padding: 0.85rem 0.95rem;
  border: 0;
  border-inline-start: 4px solid transparent;
  border-block-end: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
  text-align: start;
}

.conversation-row:focus-visible {
  outline-offset: -3px;
}

.conversation-row:hover,
.conversation-row[aria-pressed="true"] {
  background: var(--mint);
}

.conversation-row[aria-pressed="true"] {
  border-inline-start-color: var(--green);
}

.row-name,
.thread-title,
.composer-actions,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.row-name strong {
  overflow-wrap: anywhere;
}

.channel {
  flex: 0 1 auto;
  max-width: 9rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #34514a;
  background: var(--surface);
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 0.7rem;
  font-weight: 650;
}

.row-property,
.preview {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.row-property {
  font-weight: 650;
}

.thread-header {
  display: grid;
  gap: 0.5rem;
  padding: clamp(0.85rem, 2.5vw, 1.35rem);
  border-block-end: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.thread-header p {
  margin-block-start: 0.2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.thread-messages {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  min-height: 10rem;
  max-height: 45svh;
  overflow: auto;
  margin: 0;
  padding: clamp(0.85rem, 2.5vw, 1.35rem);
  list-style: none;
}

.message {
  width: fit-content;
  max-width: min(92%, 38rem);
  padding: 0.62rem 0.78rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--linen);
  overflow-wrap: anywhere;
}

.message.is-host {
  justify-self: end;
  background: var(--mint);
}

.message-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.7rem;
  margin-block-end: 0.2rem;
  color: var(--muted);
  font-size: 0.77rem;
}

.message-byline strong {
  color: var(--ink);
}

.message-text,
.review-dialog blockquote {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.composer {
  display: grid;
  gap: 0.65rem;
  margin: 0 clamp(0.85rem, 2.5vw, 1.35rem) 1.35rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.composer.is-draft {
  border-inline-start: 4px solid var(--warm-edge);
  background: var(--warm);
}

.composer textarea {
  resize: vertical;
}

.composer-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.sent-indicator {
  color: var(--green);
  font-size: 0.83rem;
  font-weight: 680;
}

.feedback {
  color: #72531b;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.feedback:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.main-panel > .feedback:not(:empty) {
  margin-block-end: 0.7rem;
}

.review-dialog {
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
}

.review-dialog::backdrop {
  background: rgb(16 46 43 / 65%);
}

.review-dialog p {
  margin-block-start: 0.35rem;
  color: var(--muted);
}

.review-dialog blockquote {
  margin: 0.85rem 0;
  padding: 0.7rem;
  border-inline-start: 4px solid var(--warm-edge);
  background: var(--warm);
}

.dialog-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.settings-panel,
.empty-state {
  width: min(100%, 52rem);
  display: grid;
  gap: 0.8rem;
  padding: clamp(0.9rem, 3vw, 1.45rem);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding-block: 0.8rem;
}

.setting-row + .setting-row {
  border-block-start: 1px solid var(--line);
}

.setting-row p {
  margin-block-start: 0.25rem;
}

.loading {
  padding: 1rem;
  color: var(--muted);
}

.status-page {
  display: grid;
  min-height: 80svh;
  place-content: center;
  justify-items: start;
  gap: 0.7rem;
  padding: 1.5rem;
}

.mobile-back {
  display: none;
}

@media (max-width: 62rem) {
  .workspace-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem 1rem;
    padding: 0.75rem 1rem;
  }

  .workspace-actions {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .workspace-select {
    max-width: 20rem;
  }

  .workspace-actions .button {
    flex-shrink: 0;
  }

  .navigation {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-footer {
    grid-column: 3;
    grid-row: 1;
    justify-items: end;
    margin: 0;
  }

  .account-email {
    display: none;
  }
}

@media (max-width: 40rem) {
  .auth-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .auth-identity {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.3rem 0.75rem;
    min-height: auto;
    padding: 0.95rem 1.15rem;
  }

  .auth-brand-title {
    grid-row: 2;
    max-width: none;
    margin-inline-start: 2.78rem;
    font-size: 1rem;
    letter-spacing: 0;
  }

  .auth-identity .sandbox-label {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
  }

  .auth-content {
    justify-content: flex-start;
    padding-block-start: 2.35rem;
  }

  .sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .workspace-actions {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .sidebar-footer {
    grid-row: 1;
    grid-column: 2;
  }

  .navigation {
    grid-row: 3;
  }

  .inbox-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .conversation-list {
    border-inline-end: 0;
  }

  .inbox-layout:not(.show-detail) .conversation-detail,
  .inbox-layout.show-detail .conversation-list {
    display: none;
  }

  .conversation-row:last-child {
    border-block-end: 0;
  }

  .mobile-back {
    display: inline-flex;
  }

  .message {
    max-width: 96%;
  }
}
