:root {
  --ink: #102033;
  --navy: #132841;
  --blue: #2d66a8;
  --teal: #347866;
  --green: #2d6a4f;
  --amber: #a3651d;
  --paper: #ffffff;
  --mist: #f6f8fa;
  --cream: #f5f1e8;
  --soft-blue: #edf5fc;
  --soft-green: #edf8f2;
  --soft-amber: #fff7e8;
  --slate: #5a6675;
  --muted: #7a8795;
  --line: #d8e2ea;
  --strong-line: #c7d4df;
  --shadow: 0 24px 70px rgba(19, 40, 65, 0.16);
  --soft-shadow: 0 12px 34px rgba(19, 40, 65, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 16%, rgba(45, 102, 168, 0.1), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(52, 120, 102, 0.12), transparent 26%),
    var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.shell {
  width: min(1500px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0 20px;
}

.appbar {
  min-height: 74px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(216, 226, 234, 0.9);
  border-radius: 24px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.brand,
.appbar-actions,
.section-heading,
.tabs,
.phone-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  color: #fff;
  background: var(--navy);
  font-size: 19px;
  font-weight: 950;
}

.brand span,
.eyebrow,
.section-heading span,
.resident-proof-row span,
.renewal-alert span,
.home-tile span,
.output-card span,
.empty-state span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  margin-top: 2px;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.1;
}

.appbar-center {
  min-width: 0;
  text-align: center;
}

.appbar-center strong {
  display: block;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.2;
}

.appbar-center span {
  display: block;
  margin-top: 3px;
  color: var(--slate);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 750;
}

.appbar-actions {
  gap: 10px;
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 10px 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
  box-shadow: 0 12px 26px rgba(19, 40, 65, 0.2);
}

.button.secondary,
.button.ghost {
  color: var(--navy);
  background: #fff;
  border-color: var(--strong-line);
}

.stage {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(470px, 1fr) minmax(340px, 390px);
  gap: 16px;
  align-items: stretch;
  margin-top: 16px;
}

.phone-wrap,
.workbench,
.output-panel {
  min-width: 0;
}

.phone-wrap {
  display: flex;
  justify-content: center;
}

.phone {
  width: 100%;
  max-width: 420px;
  min-height: 760px;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(180px, 1fr) auto auto;
  overflow: hidden;
  border: 10px solid #17263a;
  border-radius: 44px;
  background: #f9fbfc;
  box-shadow: var(--shadow);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 12px 22px 4px;
  color: var(--navy);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.resident-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 20px 12px;
  background: #fff;
}

.resident-header span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.resident-header h1 {
  margin: 5px 0 0;
  color: var(--navy);
  font-size: 27px;
  line-height: 1.02;
  letter-spacing: 0;
}

.pill {
  border: 1px solid #cfe1d8;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--green);
  background: var(--soft-green);
  font-size: 12px;
  font-weight: 950;
}

.renewal-alert {
  margin: 0 16px 14px;
  border: 1px solid #cbdbe7;
  border-radius: 22px;
  padding: 15px;
  background:
    radial-gradient(circle at 100% 0, rgba(45, 102, 168, 0.12), transparent 35%),
    #f5f9fc;
}

.renewal-alert strong {
  display: block;
  margin: 6px 0;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.12;
}

.renewal-alert p {
  margin: 0;
  color: var(--slate);
  font-size: 13px;
  line-height: 1.38;
  font-weight: 680;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 0 16px 14px;
}

.home-tile {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.home-tile strong {
  display: block;
  margin-top: 7px;
  color: var(--navy);
  font-size: 15px;
  line-height: 1.14;
}

.home-tile.selected {
  border-color: rgba(52, 120, 102, 0.48);
  background: linear-gradient(180deg, #f2fbf6, #fff);
  box-shadow: 0 10px 20px rgba(52, 120, 102, 0.1);
}

.chat-card {
  min-height: 0;
  overflow: auto;
  margin: 0 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  background: #fff;
}

.bubble {
  width: fit-content;
  max-width: 94%;
  border-radius: 19px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.36;
  font-weight: 720;
}

.bubble + .bubble {
  margin-top: 10px;
}

.bubble.assistant {
  color: #26323e;
  background: #edf3f7;
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.bubble.resident {
  margin-left: auto;
  color: #fff;
  background: var(--navy);
  border-bottom-right-radius: 6px;
}

.phone-actions {
  gap: 10px;
  padding: 14px 16px 12px;
}

.phone-actions .button {
  flex: 1;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  border-top: 1px solid var(--line);
  padding: 10px 10px 12px;
  background: #fff;
}

.bottom-nav span {
  border-radius: 12px;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.bottom-nav .active {
  color: var(--navy);
  background: var(--soft-blue);
}

.workbench {
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
  gap: 14px;
}

.thesis-card,
.agent-card,
.resident-proof-row article,
.output-panel {
  border: 1px solid rgba(216, 226, 234, 0.92);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--soft-shadow);
}

.thesis-card {
  padding: 24px;
}

.thesis-card h2 {
  max-width: 760px;
  margin: 8px 0 10px;
  color: var(--navy);
  font-size: clamp(28px, 3.2vw, 52px);
  line-height: 0.98;
  letter-spacing: 0;
}

.thesis-card p {
  max-width: 760px;
  margin: 0;
  color: var(--slate);
  font-size: 16px;
  line-height: 1.42;
  font-weight: 700;
}

.agent-card {
  overflow: hidden;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.section-heading.compact {
  border-bottom: 0;
  padding-bottom: 12px;
}

.section-heading strong {
  display: block;
  margin-top: 5px;
  color: var(--navy);
  font-size: 21px;
  line-height: 1.1;
}

.section-heading em {
  flex: 0 0 auto;
  border: 1px solid #cfe1d8;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--green);
  background: var(--soft-green);
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
}

.agent-steps {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.agent-steps article {
  position: relative;
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: #fff;
  transition: border 180ms ease, background 180ms ease, transform 180ms ease;
}

.agent-steps article:last-child {
  grid-column: span 2;
}

.agent-steps article span {
  display: inline-grid;
  width: 34px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: var(--blue);
  background: var(--soft-blue);
  font-size: 12px;
  font-weight: 950;
}

.agent-steps strong {
  display: block;
  margin: 12px 0 6px;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.1;
}

.agent-steps p {
  margin: 0;
  color: var(--slate);
  font-size: 13px;
  line-height: 1.36;
  font-weight: 700;
}

.agent-steps article.active {
  border-color: rgba(45, 102, 168, 0.52);
  background: #f5f9fe;
  transform: translateY(-2px);
}

.agent-steps article.done {
  border-color: rgba(52, 120, 102, 0.48);
  background: #f4fbf7;
}

.resident-proof-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.resident-proof-row article {
  min-height: 126px;
  padding: 16px;
}

.resident-proof-row strong {
  display: block;
  margin: 9px 0 6px;
  color: var(--navy);
  font-size: 20px;
  line-height: 1.08;
}

.resident-proof-row p {
  margin: 0;
  color: var(--slate);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.output-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.tabs {
  gap: 8px;
  padding: 0 16px 14px;
}

.tabs button {
  flex: 1;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--slate);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.tabs .active {
  color: #fff;
  border-color: var(--navy);
  background: var(--navy);
}

.output-body {
  min-height: 0;
  overflow: auto;
  padding: 0 16px 18px;
}

.empty-state,
.output-card,
.compare-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: #fff;
}

.empty-state strong,
.output-card strong,
.compare-card strong {
  display: block;
  margin: 8px 0 7px;
  color: var(--navy);
  font-size: 21px;
  line-height: 1.1;
}

.empty-state p,
.output-card p,
.compare-card p,
.output-card li {
  color: var(--slate);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 700;
}

.empty-state p,
.output-card p,
.compare-card p {
  margin: 0;
}

.output-card + .output-card,
.compare-card + .compare-card {
  margin-top: 10px;
}

.output-card.recommended,
.compare-card.recommended {
  border-color: rgba(52, 120, 102, 0.45);
  background: linear-gradient(180deg, #f1fbf6, #fff);
}

.output-card.warning {
  border-color: rgba(163, 101, 29, 0.45);
  background: linear-gradient(180deg, #fff8ea, #fff);
}

.mini-metric {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.mini-metric div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.75);
}

.mini-metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-metric strong {
  margin: 4px 0 0;
  font-size: 16px;
}

.output-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.generated {
  animation: reveal 260ms ease both;
}

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

@media (max-width: 1240px) {
  .shell {
    width: min(980px, calc(100vw - 24px));
  }

  .appbar,
  .stage {
    grid-template-columns: 1fr;
  }

  .appbar-center {
    text-align: left;
  }

  .appbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .phone {
    max-width: 430px;
  }
}

@media (max-width: 740px) {
  .shell {
    width: min(100vw - 18px, 520px);
    padding-top: 9px;
  }

  .appbar {
    grid-template-columns: 1fr;
    gap: 12px;
    border-radius: 20px;
  }

  .appbar-center {
    display: none;
  }

  .appbar-actions,
  .agent-steps,
  .resident-proof-row,
  .mini-metric {
    grid-template-columns: 1fr;
  }

  .agent-steps article:last-child {
    grid-column: span 1;
  }

  .phone {
    min-height: 680px;
    border-width: 7px;
    border-radius: 36px;
  }

  .resident-header h1 {
    font-size: 24px;
  }

  .thesis-card h2 {
    font-size: 31px;
  }

  .phone-actions,
  .tabs {
    display: grid;
    grid-template-columns: 1fr;
  }
}
