:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --panel: #fffdfa;
  --line: #d8d2c7;
  --ink: #252422;
  --muted: #706c64;
  --accent: #86604a;
  --accent-strong: #5f3d2f;
  --gold: #e2b735;
  --blue: #2f5f8f;
  --green: #34715f;
  --danger: #9f3d33;
  --shadow: 0 16px 34px rgba(37, 36, 34, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171615;
  --panel: #23201d;
  --line: #403a33;
  --ink: #eee8dc;
  --muted: #b9b0a4;
  --accent: #c59a77;
  --accent-strong: #d6b18e;
  --gold: #e1bd4a;
  --blue: #8fb9df;
  --green: #8bc4ad;
  --danger: #f08b7f;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

.admin-page {
  background: #f7f7f4;
}

.admin-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-summary article {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #d9ddd8;
  border-radius: 8px;
  background: #fff;
}

.admin-summary span {
  color: #66706c;
  font-size: 12px;
  font-weight: 800;
}

.admin-summary strong {
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.15;
}

.admin-panel {
  margin-top: 16px;
}

.admin-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

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

.admin-grant-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 0.5fr) minmax(220px, 1.6fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d9ddd8;
  border-radius: 8px;
  background: #fff;
}

.admin-grant-form label {
  display: grid;
  gap: 6px;
  color: #4f5955;
  font-size: 12px;
  font-weight: 850;
}

.admin-grant-form input {
  width: 100%;
  height: 40px;
  border: 1px solid #cfd6d2;
  border-radius: 6px;
  background: #fff;
  color: #202322;
  font: inherit;
  font-size: 14px;
  padding: 0 10px;
}

.admin-balance {
  color: #16633a;
  font-weight: 850;
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid #d9ddd8;
  border-radius: 8px;
  background: #fff;
}

.admin-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #ecefed;
  color: #202322;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f4f2;
  color: #4f5955;
  font-size: 12px;
  font-weight: 850;
}

.admin-table td span {
  display: block;
  color: #68726e;
  font-size: 12px;
}

.admin-table .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.admin-table code {
  font-size: 12px;
}

.admin-select {
  min-width: 190px;
  height: 34px;
  padding: 6px 9px;
  border: 1px solid #cfd8d3;
  border-radius: 6px;
  background: #fff;
  color: #202322;
  font: inherit;
  font-size: 12px;
}

.prompt-preview {
  max-width: 360px;
  color: #505956;
}

.component-breakdown {
  min-width: 300px;
}

.component-line {
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr);
  gap: 2px 8px;
  padding: 6px 0;
  border-bottom: 1px solid #eef1ef;
}

.component-line:last-child {
  border-bottom: 0;
}

.component-line > span:not(.admin-status) {
  grid-column: 2;
  color: #68726e;
  font-size: 12px;
}

.component-line > strong {
  color: #202322;
  font-size: 12px;
}

.admin-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 800;
}

.admin-status.ok {
  background: #e4f5ec;
  color: #16633a;
}

.admin-status.bad {
  background: #fde8e4;
  color: #8f2d20;
}

.admin-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: #66706c;
  font-size: 13px;
}

.admin-message[data-kind="error"] {
  color: #9f3d33;
}

@media (max-width: 980px) {
  .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grant-form {
    grid-template-columns: 1fr;
  }
}

.marketing-page {
  min-height: 100vh;
  background: #f7f5ef;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px 22px 8px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.site-brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.site-brand-title {
  color: var(--ink);
  font-size: 24px;
  font-weight: 780;
  line-height: 1.08;
}

.site-brand-mode {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link,
.nav-cta,
.primary-action,
.secondary-action,
.google-button,
.ghost-button,
.text-button {
  height: 44px;
  border-radius: 8px;
}

.nav-link,
.ghost-button,
.text-button {
  min-width: auto;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

.nav-cta,
.primary-action {
  min-width: 128px;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
}

.secondary-action {
  min-width: 112px;
  border-color: var(--line);
  background: #f4f0e8;
  color: var(--ink);
}

.hero,
.proof-section,
.product-section,
.cta-section {
  max-width: 1220px;
  margin: 0 auto;
  padding: 58px 22px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.55fr);
  align-items: center;
  gap: 44px;
  min-height: 0;
  padding-top: 76px;
  padding-bottom: 84px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 840px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 76px;
  line-height: 0.98;
}

.hero-lead {
  max-width: 790px;
  margin: 24px 0 0;
  color: #4f4b46;
  font-size: 20px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-score {
  display: grid;
  gap: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-score img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 8px;
}

.score-label,
.score-rank {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.hero-score strong {
  display: block;
  margin: 6px 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 82px;
  line-height: 1;
}

.section-heading {
  max-width: 820px;
  margin-bottom: 24px;
}

.section-heading h2,
.cta-section h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 44px;
  line-height: 1.1;
}

.section-heading p:not(.eyebrow),
.cta-section p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

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

.benchmark-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.benchmark-panel h3 {
  margin: 0;
  font-size: 22px;
}

.benchmark-panel p {
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.benchmark-open {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.benchmark-open img {
  display: block;
  width: 100%;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #f8f6f1;
}

.benchmark-open:hover img {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(254, 199, 78, 0.28);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.feature-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.feature-grid h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.feature-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.cta-section {
  margin-bottom: 38px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
  background: #f7f5ef;
}

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

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid #e6dccd;
  border-radius: 8px;
  background: #fff8ea;
}

.auth-brand-mark {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.auth-brand h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.22;
}

.auth-brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

.google-button {
  width: 100%;
  margin-top: 12px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.auth-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-message[data-tone="error"] {
  color: var(--danger);
}

.auth-message[data-tone="success"] {
  color: #047857;
}

.text-button {
  margin-top: 8px;
  padding: 0;
  color: var(--accent-strong);
}

.account-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.account-profile {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.account-avatar,
.settings-avatar-preview {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(95, 61, 47, 0.22);
  border-radius: 50%;
  background: #efe7db;
  background-position: center;
  background-size: cover;
  color: var(--accent-strong);
  font-weight: 800;
}

.account-avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.account-avatar.has-image,
.settings-avatar-preview.has-image {
  color: transparent;
}

.icon-button {
  display: grid;
  place-items: center;
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-color: var(--line);
  background: #f4f0e8;
  color: var(--ink);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 23, 21, 0.72);
}

.lightbox-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(94vw, 1500px);
  height: min(92vh, 980px);
  margin: 4vh auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.lightbox-header h2 {
  margin: 0;
  font-size: 18px;
}

.lightbox-close {
  min-width: 38px;
  width: 38px;
  height: 38px;
  border-color: var(--line);
  background: #f4f0e8;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.lightbox-body {
  overflow: auto;
  padding: 16px;
  background: #f8f6f1;
}

.lightbox-body img {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: calc(92vh - 94px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.github-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.github-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 23, 21, 0.58);
}

.github-modal-dialog {
  position: relative;
  width: min(92vw, 560px);
  margin: 12vh auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
  overflow: hidden;
}

.github-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.github-modal-header h2 {
  margin: 0;
  font-size: 24px;
}

.github-modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.github-modal-close {
  min-width: 36px;
  width: 36px;
  height: 36px;
  border-color: var(--line);
  background: #f4f0e8;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.github-modal-body {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
}

.github-wizard-step {
  border-left: 3px solid var(--gold);
  padding-left: 12px;
}

.github-wizard-step strong {
  display: block;
  font-size: 14px;
}

.github-wizard-step p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.github-wizard-notice {
  padding: 10px 12px;
  border: 1px solid rgba(159, 61, 51, 0.28);
  border-radius: 8px;
  background: rgba(159, 61, 51, 0.07);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.github-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 23, 21, 0.58);
}

.settings-modal-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(92vw, 760px);
  max-height: 88vh;
  margin: 6vh auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
  overflow: hidden;
}

.settings-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.settings-modal-header h2 {
  margin: 0;
  font-size: 24px;
}

.settings-modal-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-modal-close {
  min-width: 36px;
  width: 36px;
  height: 36px;
  border-color: var(--line);
  background: #f4f0e8;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.settings-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  overflow-y: auto;
  padding: 16px 20px;
}

.settings-section {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(216, 210, 199, 0.75);
}

.settings-section:first-child {
  grid-row: span 2;
}

.settings-section h3 {
  margin: 0;
  font-size: 16px;
}

.settings-section label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.label-with-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.help-tip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f0e8;
  color: var(--muted);
  cursor: help;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.help-bubble {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: min(340px, 78vw);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
}

.label-with-help:hover .help-bubble,
.help-tip:focus + .help-bubble {
  display: block;
}

.settings-section input,
.settings-section select,
.settings-section textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
}

.settings-section input,
.settings-section select {
  height: 42px;
  padding: 0 11px;
}

.settings-section textarea {
  grid-column: auto;
  min-height: 88px;
  padding: 10px 11px;
  resize: vertical;
}

.settings-section input:focus,
.settings-section select:focus,
.settings-section textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(226, 183, 53, 0.24);
}

.settings-section input:disabled {
  background: #f4f0e8;
  color: var(--muted);
}

.profile-editor {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-avatar-preview {
  width: 72px;
  height: 72px;
  font-size: 24px;
}

.profile-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}

.avatar-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.avatar-crop-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 23, 21, 0.72);
}

.avatar-crop-dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(94vw, 520px);
  max-height: 92vh;
  margin: 4vh auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.avatar-crop-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.avatar-crop-header h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.avatar-crop-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.avatar-crop-close {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-color: var(--line);
  background: #f4f0e8;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.avatar-crop-body {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-height: 0;
  padding: 18px;
}

#avatarCropCanvas {
  width: min(360px, calc(100vw - 56px));
  height: min(360px, calc(100vw - 56px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #efe7db;
  cursor: grab;
  touch-action: none;
}

#avatarCropCanvas:active {
  cursor: grabbing;
}

.avatar-crop-control {
  display: grid;
  width: min(360px, 100%);
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.avatar-crop-control input {
  width: 100%;
}

.avatar-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
}

.settings-message {
  min-height: 20px;
  margin: 0;
  color: var(--green);
  font-size: 13px;
}

.small-button {
  min-width: 88px;
  height: 38px;
}

button,
textarea,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
  gap: 14px;
}

.workspace-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2ef;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workspace-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border-bottom: 1px solid rgba(95, 61, 47, 0.12);
}

.workspace-sidebar-title {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-icon-button {
  display: grid;
  place-items: center;
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(95, 61, 47, 0.16);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.sidebar-icon-button.compact {
  min-width: 26px;
  width: 26px;
  height: 26px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-icon-button.compact.danger {
  font-size: 16px;
}

.sidebar-icon-button:hover,
.project-section.active .project-row .sidebar-icon-button:hover,
.chat-row.active .sidebar-icon-button:hover {
  border-color: rgba(95, 61, 47, 0.22);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.project-list {
  min-height: 0;
  overflow-y: auto;
  padding: 10px 8px 14px;
}

.sidebar-empty,
.chat-empty {
  padding: 10px 8px;
  color: var(--muted);
  font-size: 12px;
}

.project-section {
  margin-bottom: 8px;
}

.project-row,
.chat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
}

.project-row {
  min-height: 34px;
}

.chat-row {
  min-height: 30px;
  margin: 1px 0;
}

.project-section.active > .project-row {
  background: rgba(255, 255, 255, 0.72);
}

.chat-row.active {
  background: rgba(226, 183, 53, 0.22);
}

.project-name,
.chat-name {
  display: block;
  min-width: 0;
  width: 100%;
  height: auto;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-name {
  padding: 7px 6px 7px 20px;
  color: #4f5753;
  font-size: 12px;
  font-weight: 700;
}

.project-actions,
.chat-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  opacity: 0;
}

.project-row:hover .project-actions,
.chat-row:hover .chat-actions,
.project-row:focus-within .project-actions,
.chat-row:focus-within .chat-actions,
.project-section.active > .project-row .project-actions,
.chat-row.active .chat-actions {
  opacity: 1;
}

.chat-list {
  margin: 2px 0 8px;
}

.workspace-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 84px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 260px;
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-title {
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 24px;
  font-weight: 780;
  letter-spacing: 0;
  line-height: 1.08;
}

.brand-subline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 18px;
}

.brand-mode {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  margin: 0;
  letter-spacing: 0;
}

.brand-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.brand-status::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.brand-status[data-tone="error"] {
  color: var(--danger);
}

.brand-status[data-tone="error"]::before {
  background: var(--danger);
}

.chat-region {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.messages {
  height: 100%;
  overflow-y: auto;
  padding: 22px;
}

:root[data-text-size="small"] .messages,
:root[data-text-size="small"] textarea {
  font-size: 14px;
}

:root[data-text-size="medium"] .messages,
:root[data-text-size="medium"] textarea {
  font-size: 15px;
}

:root[data-text-size="large"] .messages,
:root[data-text-size="large"] textarea {
  font-size: 17px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 100%;
  color: var(--muted);
  font-size: 15px;
}

.message {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  max-width: 920px;
  margin: 0 0 18px;
}

.message.user {
  margin-left: auto;
}

.message.assistant {
  margin-right: auto;
}

.message.error .bubble {
  border-color: rgba(159, 61, 51, 0.45);
  color: var(--danger);
}

.speaker {
  padding-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  text-transform: uppercase;
}

.message.user .speaker,
.message.assistant .speaker {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  text-transform: none;
}

.speaker-avatar,
.speaker-mark {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.speaker-avatar {
  display: grid;
  place-items: center;
  border: 1px solid rgba(95, 61, 47, 0.2);
  border-radius: 50%;
  background: #efe7db;
  background-position: center;
  background-size: cover;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 800;
}

.speaker-avatar.has-image {
  color: transparent;
}

.speaker-mark {
  object-fit: contain;
}

.bubble {
  position: relative;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bubble.markdown-body {
  white-space: normal;
}

.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1.02em;
  line-height: 1.45;
  font-weight: 750;
}

.markdown-body p {
  margin: 0 0 13px;
}

.markdown-body p:last-child,
.markdown-body ul:last-child,
.markdown-body ol:last-child,
.markdown-body blockquote:last-child,
.markdown-body pre:last-child,
.markdown-body .markdown-table-wrap:last-child {
  margin-bottom: 0;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 13px;
  padding-left: 1.35em;
}

.markdown-body li {
  margin: 3px 0;
}

.markdown-body blockquote {
  margin: 0 0 13px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid rgba(52, 113, 95, 0.28);
  color: var(--muted);
}

.markdown-body code {
  padding: 1px 5px;
  border: 1px solid rgba(32, 31, 29, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.74);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.markdown-body pre {
  margin: 0 0 13px;
  padding: 10px 12px;
  overflow-x: auto;
  border: 1px solid rgba(32, 31, 29, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  white-space: pre;
}

.markdown-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.9em;
}

.markdown-table-wrap {
  margin: 0 0 13px;
  overflow-x: auto;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94em;
}

.markdown-body th,
.markdown-body td {
  padding: 7px 9px;
  border: 1px solid rgba(52, 113, 95, 0.2);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: rgba(52, 113, 95, 0.08);
  font-weight: 700;
}

.message.user .bubble {
  border-color: rgba(47, 95, 143, 0.34);
  background: #edf4fb;
}

.message.assistant .bubble {
  border-color: rgba(52, 113, 95, 0.28);
  background: #f6fbf8;
}

.message.assistant .bubble.has-copy-action {
  padding-right: 54px;
}

.message-copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-color: rgba(52, 113, 95, 0.24);
  background: #ecf5ef;
  color: var(--green);
}

.message-copy-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.message-copy-button[data-state="success"] {
  border-color: rgba(52, 113, 95, 0.36);
  background: #dfeee5;
}

.message-copy-button:hover:not(:disabled),
.message-copy-button:focus-visible {
  border-color: rgba(52, 113, 95, 0.46);
  background: #e1efe6;
}

.message-copy-button:disabled {
  opacity: 1;
}

.message.pending .bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 40px;
}

.thinking span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-strong);
  opacity: 0.3;
  animation: thinkingPulse 1.1s infinite ease-in-out;
}

.thinking span:nth-child(2) {
  animation-delay: 0.16s;
}

.thinking span:nth-child(3) {
  animation-delay: 0.32s;
}

.thinking-text {
  font-size: 14px;
}

@keyframes thinkingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.3;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer.drag-over {
  border-color: var(--accent-strong);
  background: #fff9df;
  box-shadow: 0 0 0 3px rgba(226, 183, 53, 0.22), var(--shadow);
}

.github-import {
  display: grid;
  order: 4;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.github-import input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.github-import input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(226, 183, 53, 0.24);
}

.github-import button {
  height: 38px;
  font-size: 13px;
}

.github-import button.is-loading {
  position: relative;
  padding-left: 34px;
}

.github-import button.is-loading::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(37, 36, 34, 0.22);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.github-import-message {
  display: flex;
  align-items: center;
  gap: 7px;
  order: 5;
  grid-column: 1 / -1;
  min-height: 18px;
  margin: -2px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.github-import-message:empty {
  display: none;
}

.github-import-message[data-tone="error"] {
  color: var(--danger);
}

.github-import-message[data-tone="success"] {
  color: var(--green);
}

.github-import-message[data-tone="loading"] {
  color: var(--muted);
}

.mini-spinner {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(112, 108, 100, 0.24);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.github-import-message .inline-action {
  min-width: auto;
  height: 28px;
  margin-left: 8px;
  padding: 0 10px;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
  font-size: 12px;
  vertical-align: middle;
}

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

#prompt {
  order: 1;
  grid-column: 1;
  width: 100%;
  max-height: 180px;
  min-height: 38px;
  padding: 9px 12px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  order: 3;
  grid-column: 1 / -1;
  gap: 8px;
  min-height: 0;
}

.attachment-tray:empty {
  display: none;
}

.attachment-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  max-width: min(420px, 100%);
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.attachment-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  background: #eee7dc;
}

.attachment-file-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #eee7dc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.attachment-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.attachment-remove {
  min-width: 30px;
  width: 30px;
  height: 30px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.message-attachment {
  max-width: 240px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.message-attachment img {
  display: block;
  max-width: 220px;
  max-height: 160px;
  border-radius: 6px;
  object-fit: contain;
}

.message-attachment-name {
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-name a {
  color: inherit;
}

#prompt:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(226, 183, 53, 0.28);
}

.composer-actions {
  display: flex;
  align-items: stretch;
  order: 2;
  grid-column: 2;
  gap: 8px;
}

.composer-actions button {
  height: 38px;
  min-width: 86px;
  padding: 0 16px;
  font-size: 13px;
}

button {
  min-width: 86px;
  height: 48px;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  background: var(--accent-strong);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  border-color: var(--line);
  background: #f4f0e8;
  color: var(--ink);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:root[data-theme="dark"] .marketing-page,
:root[data-theme="dark"] .auth-page {
  background: var(--bg);
}

:root[data-theme="dark"] .hero-lead {
  color: #d4cabc;
}

:root[data-theme="dark"] .auth-brand {
  border-color: var(--line);
  background: #2a241e;
}

:root[data-theme="dark"] .auth-brand-mark {
  background: #181716;
}

:root[data-theme="dark"] button,
:root[data-theme="dark"] .nav-cta,
:root[data-theme="dark"] .primary-action {
  color: #171615;
}

:root[data-theme="dark"] .nav-link,
:root[data-theme="dark"] .ghost-button,
:root[data-theme="dark"] .text-button,
:root[data-theme="dark"] .benchmark-open,
:root[data-theme="dark"] .attachment-remove {
  color: var(--ink);
}

:root[data-theme="dark"] button.secondary,
:root[data-theme="dark"] .secondary-action,
:root[data-theme="dark"] .google-button,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .lightbox-close,
:root[data-theme="dark"] .github-modal-close,
:root[data-theme="dark"] .settings-modal-close,
:root[data-theme="dark"] .avatar-crop-close {
  border-color: var(--line);
  background: #302b25;
  color: var(--ink);
}

:root[data-theme="dark"] .auth-form input,
:root[data-theme="dark"] .settings-section input,
:root[data-theme="dark"] .settings-section select,
:root[data-theme="dark"] .settings-section textarea,
:root[data-theme="dark"] .github-import input,
:root[data-theme="dark"] textarea {
  border-color: var(--line);
  background: #181716;
  color: var(--ink);
}

:root[data-theme="dark"] .settings-section input:disabled {
  background: #2b2722;
  color: var(--muted);
}

:root[data-theme="dark"] .help-tip {
  background: #302b25;
  color: var(--ink);
}

:root[data-theme="dark"] .help-bubble {
  border-color: var(--line);
  background: #23201d;
  color: var(--ink);
}

:root[data-theme="dark"] .account-avatar,
:root[data-theme="dark"] .settings-avatar-preview,
:root[data-theme="dark"] .speaker-avatar {
  border-color: rgba(214, 177, 142, 0.24);
  background-color: #342d25;
  color: var(--accent-strong);
}

:root[data-theme="dark"] .benchmark-open img,
:root[data-theme="dark"] .lightbox-body {
  background: #181716;
}

:root[data-theme="dark"] .bubble,
:root[data-theme="dark"] .attachment-chip {
  background: #2a2621;
}

:root[data-theme="dark"] .message.user .bubble {
  border-color: rgba(143, 185, 223, 0.38);
  background: #202a35;
}

:root[data-theme="dark"] .message.assistant .bubble {
  border-color: rgba(139, 196, 173, 0.34);
  background: #1d2b25;
}

:root[data-theme="dark"] .message-copy-button {
  border-color: rgba(139, 196, 173, 0.28);
  background: #243830;
  color: var(--green);
}

:root[data-theme="dark"] .message-copy-button:hover:not(:disabled),
:root[data-theme="dark"] .message-copy-button:focus-visible,
:root[data-theme="dark"] .message-copy-button[data-state="success"] {
  border-color: rgba(139, 196, 173, 0.5);
  background: #2a473c;
}

:root[data-theme="dark"] .composer.drag-over {
  background: #302715;
}

:root[data-theme="dark"] .attachment-thumb,
:root[data-theme="dark"] .attachment-file-icon {
  background: #38322c;
}

:root[data-theme="dark"] .message-attachment {
  background: rgba(24, 23, 22, 0.72);
}

:root[data-theme="dark"] #avatarCropCanvas {
  background: #342d25;
}

:root[data-theme="dark"] .workspace-sidebar {
  background: #202723;
}

:root[data-theme="dark"] .workspace-sidebar-head {
  border-bottom-color: rgba(214, 177, 142, 0.18);
}

:root[data-theme="dark"] .sidebar-icon-button,
:root[data-theme="dark"] .project-section.active > .project-row {
  border-color: rgba(214, 177, 142, 0.18);
  background: #2a312d;
  color: var(--ink);
}

:root[data-theme="dark"] .sidebar-icon-button.compact {
  background: transparent;
  color: var(--muted);
}

:root[data-theme="dark"] .chat-row.active {
  background: rgba(139, 196, 173, 0.18);
}

:root[data-theme="dark"] .chat-name {
  color: #c4cdc7;
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 34px;
  }

  .hero h1 {
    font-size: 48px;
  }

  .hero-lead {
    font-size: 17px;
  }

  .benchmark-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .proof-section,
  .product-section,
  .cta-section {
    padding: 38px 14px;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 10px;
    gap: 10px;
  }

  .workspace-sidebar {
    max-height: 34vh;
  }

  .workspace-main {
    min-height: 0;
  }

  .topbar,
  .composer {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .messages {
    padding: 14px;
  }

  .message {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .speaker {
    text-align: left;
  }

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

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

  #prompt,
  .github-import,
  .attachment-tray,
  .composer-actions {
    grid-column: 1;
  }

  .github-import {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    grid-row: auto;
  }

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

  .github-modal-dialog {
    width: calc(100vw - 22px);
    margin: 7vh auto;
  }

  .github-modal-actions {
    flex-direction: column-reverse;
  }

  .github-modal-actions button {
    width: 100%;
  }

  .settings-modal-dialog {
    width: calc(100vw - 22px);
    margin: 5vh auto;
  }

  .avatar-crop-dialog {
    width: calc(100vw - 22px);
    margin: 4vh auto;
  }

  .settings-modal-body {
    grid-template-columns: 1fr;
  }

  .settings-section:first-child {
    grid-row: auto;
  }

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

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

  .avatar-crop-actions {
    flex-direction: column-reverse;
  }

  .avatar-crop-actions button {
    width: 100%;
  }
}
