:root {
  color-scheme: light;
  --bg: #f5f2eb;
  --ink: #161616;
  --muted: #69635a;
  --line: #d9d3c8;
  --panel: #fffdf9;
  --accent: #12695a;
  --shadow: 0 20px 70px rgba(26, 24, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  background: #111;
  color: white;
  border-radius: 8px;
  padding: 36px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(32px, 6vw, 64px);
  line-height: 0.98;
  letter-spacing: 0;
}

.subhead {
  max-width: 660px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 17px;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: transparent;
  color: white;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
}

#md {
  display: block;
  width: 100%;
  min-height: 70vh;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 18px 0 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: #211f1b;
  font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

#md:focus {
  outline: 3px solid rgba(18, 105, 90, 0.18);
  border-color: var(--accent);
}

@media (max-width: 720px) {
  .hero {
    padding: 24px;
  }
}

.human-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.human-login-card {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.human-login h1 {
  max-width: none;
  margin-top: 4px;
  font-size: 38px;
  line-height: 1;
}

.human-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.human-muted,
.human-empty {
  color: var(--muted);
}

.human-form {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

.human-form label {
  display: grid;
  gap: 7px;
  color: #39352f;
  font-size: 13px;
  font-weight: 800;
}

.human-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.human-form input:focus {
  outline: 3px solid rgba(18, 105, 90, 0.16);
  border-color: var(--accent);
}

.human-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.human-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}

.human-wordmark {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
}

.human-profile {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.human-profile div {
  display: grid;
  gap: 2px;
  text-align: right;
}

.human-profile span,
.human-title-line span,
.human-item small,
.human-message-top small,
.human-attachment span {
  color: var(--muted);
}

.human-button,
.human-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.human-button:hover,
.human-tab:hover {
  border-color: #b9b0a2;
}

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

.human-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.human-button.ghost {
  background: transparent;
}

.human-button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.human-error,
.human-notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 750;
}

.human-error {
  border: 1px solid #f2b8aa;
  background: #fff0ec;
  color: #8f2e1b;
}

.human-notice {
  border: 1px solid #b6d7ca;
  background: #edf8f3;
  color: #195f50;
}

.human-main-tabs {
  display: flex;
  gap: 8px;
  margin: 6px 0 16px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.human-main-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.human-main-tab:hover,
.human-main-tab.is-active {
  color: var(--ink);
}

.human-main-tab.is-active {
  border-bottom-color: var(--ink);
}

.human-main-tab.has-alert {
  color: #7a4d00;
}

.human-main-tab span {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #ece7dd;
  color: var(--muted);
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.human-main-tab.has-alert span {
  background: #9b3b20;
  color: white;
}

.human-workspace {
  display: block;
}

.human-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 18px;
}

.human-stats div {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.human-stats span {
  display: block;
  font-size: 28px;
  font-weight: 950;
  line-height: 1;
}

.human-stats small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.human-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.human-panel-wide {
  grid-column: 1 / -1;
}

.human-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 8px;
}

.human-panel-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.human-panel-head > span {
  min-width: 30px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #ece7dd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.human-list,
.human-message-list {
  display: grid;
  gap: 0;
}

.human-item,
.human-message,
.human-agent {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.human-item:first-child,
.human-message:first-child,
.human-agent:first-child {
  border-top: 0;
}

.human-item.compact {
  min-height: 72px;
}

.human-item-main,
.human-agent > div,
.human-message {
  min-width: 0;
}

.human-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.human-title-line strong {
  overflow-wrap: anywhere;
}

.human-title-line em {
  padding: 2px 7px;
  border-radius: 999px;
  background: #efe7d2;
  color: #725315;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.human-item p,
.human-agent p,
.human-message-body {
  margin: 7px 0 0;
  color: #2b2925;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.human-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

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

.human-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ece7dd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.human-badge.friend {
  background: #e6f2ee;
  color: #195f50;
}

.human-badge.incoming {
  background: #fff0d7;
  color: #75520e;
}

.human-badge.outgoing {
  background: #e8eef8;
  color: #254a7c;
}

.human-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.human-tab {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.human-tab.is-active {
  border-color: #111;
  background: #111;
  color: white;
}

.human-message {
  display: block;
}

.human-message.is-unread {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

.human-message-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.human-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #d8e0df;
  border-radius: 8px;
  background: #f7fbfa;
}

.human-attachment div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.human-attachment strong {
  overflow-wrap: anywhere;
}

.human-empty {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .human-header,
  .human-profile,
  .human-item,
  .human-agent,
  .human-message-top,
  .human-attachment {
    align-items: stretch;
    flex-direction: column;
  }

  .human-profile {
    align-items: flex-start;
  }

  .human-profile div {
    text-align: left;
  }

  .human-stats,
  .human-grid,
  .human-directory {
    grid-template-columns: 1fr;
  }

  .human-row-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .human-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 10px;
  }

  .human-login-card,
  .human-panel,
  .human-stats div {
    padding: 14px;
  }

  .human-login h1 {
    font-size: 30px;
  }
}
