:root {
  --bg: #f7f7f3;
  --panel: #ffffff;
  --ink: #171816;
  --muted: #74776f;
  --line: #e1e3dc;
  --soft: #eceee8;
  --green: #536653;
  --green-soft: #e8eee6;
  --error: #a24843;
  --shadow: 0 18px 50px rgba(25, 28, 23, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(18px, env(safe-area-inset-left)) 0 max(18px, env(safe-area-inset-right));
  position: relative;
  z-index: 5;
}
.brand { border: 0; background: transparent; padding: 0; font-size: 24px; font-weight: 760; letter-spacing: -0.06em; cursor: pointer; }
.actions { display: flex; align-items: center; gap: 2px; }
.quiet { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px 9px; border-radius: 9px; }
.quiet:hover, .quiet:focus-visible { background: var(--soft); outline: none; }

.center { min-height: calc(100dvh - 58px); display: grid; place-items: center; padding: 22px; }
.auth { width: min(440px, 100%); margin-top: -4vh; }
.authmark { width: 54px; height: 54px; border-radius: 16px; background: var(--ink); color: white; display: grid; place-items: center; font-size: 32px; font-weight: 760; margin: 0 auto 22px; }
.auth h1 { text-align: center; font-size: 38px; letter-spacing: -0.055em; margin: 0 0 8px; }
.authlead { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 22px; }

.card, .box, .opportunity { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card { border-radius: 24px; padding: 24px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 12px; padding: 3px; margin-bottom: 20px; }
.tab { border: 0; background: transparent; padding: 9px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 650; }
.tab.active { background: white; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.06); }

h2 { font-size: 28px; letter-spacing: -0.045em; margin: 0 0 7px; }
.sub { font-size: 14px; color: var(--muted); line-height: 1.5; margin: 0 0 20px; }
.field { margin: 13px 0; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: white; }
.field input:focus, .field textarea:focus { border-color: #b5b9ae; box-shadow: 0 0 0 3px rgba(83,102,83,.08); }
.field textarea { min-height: 120px; resize: vertical; }
.primary, .secondary { width: 100%; padding: 12px 14px; border-radius: 12px; cursor: pointer; font-weight: 650; }
.primary { border: 0; background: var(--ink); color: white; }
.primary:disabled { opacity: .45; cursor: default; }
.secondary { border: 1px solid var(--line); background: white; margin-top: 10px; }
.error { min-height: 18px; margin-top: 10px; color: var(--error); font-size: 12px; }
.fine { text-align: center; font-size: 11px; color: #989b94; margin: 15px 0 0; }
.code { font-size: 30px; text-align: center; letter-spacing: .18em; font-weight: 700; }
.profile { width: min(700px, 100%); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.app { height: calc(100dvh - 58px); position: relative; }
.thread { width: min(840px, calc(100% - 28px)); height: 100%; overflow: auto; margin: auto; padding: 30px 0 190px; scroll-behavior: smooth; }
.memory { background: var(--green-soft); border: 1px solid #d2ddd0; border-radius: 15px; padding: 11px 13px; color: #4d584e; font-size: 13px; line-height: 1.5; margin-bottom: 22px; }
.memory b { display: block; color: var(--green); font-size: 11px; margin-bottom: 5px; }
.message { font-size: 17px; line-height: 1.56; max-width: 84%; margin: 0 0 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { margin-left: auto; background: #e9eae5; border-radius: 18px; padding: 11px 15px; max-width: 74%; }
.role { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.opportunities { margin: 12px 0 25px; }
.opportunity { border-radius: 18px; padding: 18px 20px; margin-bottom: 13px; }
.kicker { font-size: 10px; color: var(--green); text-transform: uppercase; font-weight: 750; letter-spacing: .07em; margin-bottom: 7px; }
.opportunity h3 { font-size: 20px; letter-spacing: -0.025em; margin: 0 0 5px; }
.meta { font-size: 12px; color: var(--muted); margin-bottom: 11px; }
.opportunity p { font-size: 14px; line-height: 1.52; color: #50544e; }
.opportunity .next { color: var(--muted); }
.opportunity a { display: inline-block; text-decoration: none; background: var(--ink); color: white; padding: 9px 11px; border-radius: 10px; font-size: 12px; }

.dock { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 14px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(247,247,243,0), var(--bg) 42%); }
.box { width: min(840px, 100%); margin: auto; border-radius: 20px; padding: 12px; }
#input { width: 100%; min-height: 48px; max-height: 150px; border: 0; outline: 0; resize: none; background: transparent; font-size: 16px; }
.composerFoot { display: flex; align-items: center; justify-content: space-between; color: #999; font-size: 10px; }
.send { width: 36px; height: 36px; border: 0; border-radius: 11px; background: var(--ink); color: white; cursor: pointer; }
.send:disabled { opacity: .3; cursor: default; }

.recovery { width: min(480px, 100%); }
.recovery .card { text-align: center; }
.recovery .primary { margin-top: 8px; }

@media (max-width: 650px) {
  .topbar { height: 54px; }
  .center { min-height: calc(100dvh - 54px); padding: 16px; }
  .auth { margin-top: -8vh; }
  .auth h1 { font-size: 34px; }
  .card { padding: 21px; }
  .grid { grid-template-columns: 1fr; gap: 0; }
  .thread { padding-top: 20px; }
  .message { max-width: 94%; font-size: 16px; }
  .message.user { max-width: 88%; }
  .quiet { font-size: 12px; padding: 7px; }
}
