:root {
  --ink: #16221d;
  --muted: #66736d;
  --paper: #f5f2e9;
  --panel: #fffdf8;
  --line: #dcd8cc;
  --green: #0b6b4f;
  --green-dark: #084c39;
  --green-soft: #dcece5;
  --amber: #a76b13;
  --amber-soft: #f4e8cc;
  --red: #a64034;
  --red-soft: #f4dfdb;
  --blue: #2f5c88;
  --blue-soft: #dfe9f3;
  --shadow: 0 18px 50px rgba(22, 34, 29, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -10%, rgba(34, 114, 82, 0.11), transparent 30rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a { color: inherit; }

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--green-dark);
  color: white;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 1.05rem; }
.brand small { color: var(--muted); font-size: .76rem; }

.local-badge,
.privacy-note {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.45);
  font-size: .75rem;
  font-weight: 650;
}

main { padding: 56px 0 70px; }

.hero { max-width: 780px; margin-bottom: 40px; }
.hero h1,
.result-header h1,
.empty-state h1 {
  margin: 8px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: 1.05;
}
.hero h1 { font-size: clamp(2.8rem, 7vw, 5.8rem); }
.hero p { max-width: 680px; color: var(--muted); font-size: 1.08rem; }
.eyebrow,
.step {
  color: var(--green);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.workspace-grid,
.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr);
  gap: 22px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 28px;
}

.panel-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.panel h2,
.section-heading h2 { margin: 4px 0 20px; line-height: 1.2; }

form { display: grid; gap: 12px; }
label,
legend { font-weight: 750; font-size: .88rem; }
fieldset { border: 0; padding: 0; margin: 14px 0 3px; }
legend { margin-bottom: 9px; }

input[type="text"],
input[type="password"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11,107,79,.12);
}
.ticker-input { position: relative; }
.ticker-input span {
  position: absolute;
  left: 16px;
  top: 12px;
  color: var(--muted);
  font-weight: 800;
}
.ticker-input input { padding: 12px 15px 12px 34px; font-weight: 800; letter-spacing: .04em; }
select { padding: 12px 14px; }
#peer_symbols { padding: 12px 14px; }
.field-help { margin: -5px 0 0; color: var(--muted); font-size: .78rem; }

.segmented { display: grid; gap: 8px; }
.segmented.three { grid-template-columns: repeat(3, 1fr); }
.segmented.two { grid-template-columns: repeat(2, 1fr); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex;
  min-height: 58px;
  flex-direction: column;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: center;
  transition: .15s ease;
}
.segmented small { color: var(--muted); font-size: .7rem; font-weight: 500; }
.segmented input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px var(--green);
}

.primary-button {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
  min-height: 52px;
  border: 0;
  border-radius: 13px;
  background: var(--green-dark);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s, opacity .15s;
}
.primary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .75; cursor: wait; }
.button-loading { display: none; }
.is-loading .button-label { display: none; }
.is-loading .button-loading { display: inline; }
.inline-button { display: inline-flex; padding: 0 24px; }

.method-panel { background: var(--ink); color: white; }
.method-panel .step { color: #85d1b4; }
.method-panel h2 { max-width: 330px; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.method-list { list-style: none; padding: 0; margin: 26px 0; }
.method-list li { display: grid; grid-template-columns: 38px 1fr; gap: 10px; padding: 14px 0; border-top: 1px solid rgba(255,255,255,.15); }
.method-list li > span { color: #85d1b4; font-size: .72rem; font-weight: 800; }
.method-list p { margin: 2px 0 0; color: #b9c2be; font-size: .83rem; }
.method-note { padding: 16px; border-radius: 14px; background: rgba(255,255,255,.08); }
.method-note p { margin: 4px 0 0; color: #c8d0cc; font-size: .82rem; }

.alert { display: grid; gap: 3px; padding: 14px 16px; margin: 0 0 18px; border: 1px solid #e2aca4; border-radius: 12px; background: var(--red-soft); color: #68251d; }
.alert span { font-size: .85rem; }

.history-section { margin-top: 60px; }
.section-heading > span { color: var(--muted); font-size: .8rem; }
.history-list { border-top: 1px solid var(--line); }
.history-row {
  display: grid;
  grid-template-columns: 90px minmax(180px, 1fr) 90px 190px 20px;
  gap: 14px;
  align-items: center;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.history-row:hover { background: rgba(255,255,255,.35); }
.history-company { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row time { color: var(--muted); font-size: .78rem; }
.ticker-chip { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 8px; background: var(--ink); color: white; font-size: .76rem; font-weight: 850; letter-spacing: .04em; }
.ticker-chip.large { padding: 7px 12px; font-size: .9rem; }

.action { width: fit-content; padding: 5px 9px; border-radius: 999px; font-size: .7rem; font-weight: 850; }
.action-buy { color: var(--green-dark); background: var(--green-soft); }
.action-hold { color: var(--blue); background: var(--blue-soft); }
.action-sell { color: var(--red); background: var(--red-soft); }
.action-watch { color: var(--amber); background: var(--amber-soft); }
.action-pending { color: var(--muted); background: #ebe9e2; }

.back-link { color: var(--muted); font-size: .85rem; text-decoration: none; }
.result-title-row { display: flex; justify-content: space-between; gap: 32px; align-items: flex-end; margin-top: 28px; }
.symbol-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.result-header h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); }
.result-header p { color: var(--muted); }
.recommendation { min-width: 190px; padding: 18px 20px; border-radius: 18px; text-align: right; }
.recommendation small,
.recommendation strong,
.recommendation span { display: block; }
.recommendation strong { margin: 2px 0; font-size: 2rem; line-height: 1; }
.recommendation span { font-size: .74rem; }

.market-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 35px 0 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.52);
  overflow: hidden;
}
.market-strip div { padding: 17px 20px; border-right: 1px solid var(--line); }
.market-strip div:last-child { border-right: 0; }
.market-strip small,
.market-strip strong { display: block; }
.market-strip small { color: var(--muted); font-size: .7rem; }
.market-strip strong { margin-top: 3px; }
.positive { color: var(--green); }
.negative { color: var(--red); }

.thesis-card h2 { max-width: 760px; font-family: Georgia, serif; font-size: 1.85rem; font-weight: 500; }
.decision-factors { margin: 25px 0 0; padding-left: 28px; }
.decision-factors li { padding: 12px 0 12px 8px; border-top: 1px solid var(--line); }
.decision-factors li::marker { color: var(--green-dark); font-weight: 800; }
.decision-factors p { margin: 5px 0 0; }
.thesis-card .indicator-guide .case-grid { padding: 0 20px 20px; margin-top: 0; }
.case-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 25px; }
.case-grid > div { padding-top: 16px; border-top: 3px solid var(--green); }
.case-grid > div:last-child { border-color: var(--red); }
.case-grid h3,
.entry-card h3 { margin: 0 0 8px; font-size: .84rem; }
.case-grid ul,
.entry-card ul,
.spaced-list { margin: 0; padding-left: 19px; color: #445049; font-size: .88rem; }
.case-grid li,
.entry-card li,
.spaced-list li { margin-bottom: 8px; }
.entry-card { background: #edf2ee; box-shadow: none; }
.entry-card h2 { font-family: Georgia, serif; font-weight: 500; }
.entry-card h3:not(:first-of-type) { margin-top: 22px; }

.evidence-card { margin-top: 22px; }
.evidence-table { border-top: 1px solid var(--line); }
.evidence-row { display: grid; grid-template-columns: 160px 125px 1fr; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .84rem; }
.evidence-value { color: var(--green-dark); font-weight: 800; }
.evidence-row > * { overflow-wrap: anywhere; }
.data-caption { color: var(--muted); font-size: .8rem; }
.financial-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.financial-metrics > div { padding: 16px; background: #f2f3ed; border-radius: 12px; }
.financial-metrics small, .financial-metrics strong, .financial-metrics span { display: block; }
.financial-metrics strong { margin: 5px 0; font-size: 1.25rem; }
.financial-metrics span { color: var(--muted); font-size: .72rem; }
.table-scroll { overflow-x: auto; }
.financial-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.financial-table th, .financial-table td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.financial-table th:first-child { text-align: left; }
.financial-table small { display: block; color: var(--muted); font-size: .72rem; font-weight: 400; }
.indicator-guide > p, .indicator-guide > ul { margin: 0 20px 16px; }
.lower-grid { margin-top: 22px; grid-template-columns: 1fr 1fr; }
.muted-panel { background: #efede6; box-shadow: none; }
.indicator-guide { margin-top: 22px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.35); }
.indicator-guide summary { padding: 16px 20px; cursor: pointer; font-weight: 750; }
.indicator-guide > div { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 24px; padding: 0 20px 16px; color: var(--muted); font-size: .83rem; }

.empty-state { min-height: 55vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }

footer { padding: 22px 0 35px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }

@media (max-width: 850px) {
  .workspace-grid,
  .result-grid { grid-template-columns: 1fr; }
  .result-title-row { align-items: flex-start; flex-direction: column; }
  .recommendation { text-align: left; }
  .market-strip { grid-template-columns: 1fr 1fr; }
  .market-strip div:nth-child(2) { border-right: 0; }
  .market-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .history-row { grid-template-columns: 75px 1fr 75px 18px; }
  .history-row time { display: none; }
}

@media (max-width: 580px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  main { padding-top: 32px; }
  .hero h1 { font-size: 3rem; }
  .panel { padding: 20px; border-radius: 16px; }
  .panel-heading { flex-direction: column; }
  .segmented.three { grid-template-columns: 1fr; }
  .case-grid,
  .indicator-guide > div { grid-template-columns: 1fr; }
  .market-strip { grid-template-columns: 1fr; }
  .market-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
  .market-strip div:last-child { border-bottom: 0; }
  .evidence-row { grid-template-columns: 1fr; gap: 4px; }
  .history-row { grid-template-columns: 68px 1fr 18px; }
  .history-row .action { display: none; }
  .privacy-note { display: none; }
}

/* Account access and settings */
.account-hero { max-width: 760px; margin-inline: auto; text-align: center; }
.account-hero h1 { font-size: clamp(2.3rem, 4.5vw, 3.8rem); }
.account-hero p { margin-inline: auto; }
.account-panel { max-width: 560px; margin: 0 auto 24px; }
.account-panel h2 { margin-bottom: 16px; }
.account-panel p { line-height: 1.6; }
.admin-model-option { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.account-panel code { overflow-wrap: anywhere; }
.account-panel input[name="reason"] { padding: 12px 14px; }
.account-panel dd { margin: 8px 0 16px; overflow-wrap: anywhere; }
.account-panel input[type="password"] { padding: 12px 14px; }
.account-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-block: 24px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; padding: 12px 22px; border-radius: 12px; background: #133f35; color: #fff; text-decoration: none; font-weight: 650; }
.button-link.secondary { background: #edf3ef; color: #133f35; }
.account-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.account-nav form { margin: 0; }
.account-nav button { margin: 0; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; }
@media (max-width: 700px) {
  .site-header { flex-wrap: wrap; gap: 18px; }
  .account-nav { width: 100%; gap: 14px; font-size: .9rem; }
}

.invitation-table-wrap { overflow-x: auto; margin-top: 1.5rem; }
.invitation-table { width: 100%; border-collapse: collapse; text-align: left; }
.invitation-table th, .invitation-table td { padding: .75rem; border-bottom: 1px solid var(--border, #ddd); }
.invitation-table td { vertical-align: top; }
#invitation-code, #generated-invitation { padding: 12px 14px; }
.account-panel form + .field-help { margin-top: 12px; }

#invitation-message {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

#invitation-message + .field-help { margin-top: 8px; }
