:root {
  font:
    15px/1.6 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #243d36;
  background: #f4f6f5;
  --ink: #173e32;
  --muted: #64756e;
  --green: #22654e;
  --line: #dfe7e2;
  --soft: #edf4ef;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--green);
}
main {
  max-width: 760px;
  margin: 7vh auto;
  padding: 28px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(30px, 3.2vw, 44px);
  letter-spacing: -1.5px;
  line-height: 1.16;
  margin-bottom: 14px;
  font-weight: 650;
  color: var(--ink);
}
h2 {
  font-size: 21px;
  letter-spacing: -0.45px;
  line-height: 1.35;
  margin: 5px 0 14px;
}
h3 {
  font-size: 17px;
  line-height: 1.5;
}
p {
  color: var(--muted);
  margin-bottom: 16px;
}
small {
  font-size: 10px;
  letter-spacing: 1.65px;
  font-weight: 750;
  color: var(--green);
}
section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  margin: 24px 0;
}
button {
  background: var(--green);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  padding: 11px 18px;
  font: 600 13px/1.5 inherit;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition:
    background 0.16s,
    border-color 0.16s;
}
button:hover {
  background: #174d3a;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: #ccd9d1;
}
button.secondary:hover {
  background: var(--soft);
  border-color: #a8bfb0;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
.table-wrap:focus-visible {
  outline: 3px solid #83b6ff;
  outline-offset: 3px;
}
form {
  margin: 8px 0;
}
input {
  width: 100%;
  padding: 12px 14px;
  min-height: 46px;
  border: 1px solid #cbd8d0;
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: white;
}
input::placeholder {
  color: #85938b;
  font-size: 13px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #40564b;
}
.note {
  font-size: 12px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
[role="status"]:empty {
  display: none;
}
summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--green);
  padding: 10px 0;
}
details[open] > summary {
  margin-bottom: 8px;
}
dl {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 2fr;
  gap: 8px 16px;
  font-size: 13px;
}
dt {
  font-weight: 600;
}
dd {
  margin: 0;
  overflow-wrap: anywhere;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}
#login-form,
#activation-form {
  display: grid;
  gap: 14px;
  width: 100%;
}
/* Authenticated workspace */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  background: #173d31;
  color: #fff;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-decoration: none;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.8px;
  padding: 0 10px;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 42px;
  border: 1px solid #628172;
  border-radius: 10px;
  font-size: 30px;
  font-weight: 400;
  color: #ccedaa;
}
.brand-sub {
  display: block;
  font-size: 9px;
  letter-spacing: 3.5px;
  color: #bdd3c4;
}
.nav-label {
  font-size: 9px;
  letter-spacing: 1.6px;
  color: #a8c2b4;
  margin: 48px 10px 14px;
}
.sidebar nav {
  display: grid;
  gap: 7px;
}
.sidebar nav a {
  color: #dae8df;
  text-decoration: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.sidebar nav a:first-child {
  background: #2b5343;
  color: #fff;
}
.sidebar nav a:hover {
  background: #34604d;
}
.sidebar nav span {
  font-size: 20px;
  line-height: 1;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 24px 10px 0;
}
.sidebar-bottom p {
  color: #b5cbbd;
  font-size: 12px;
  margin: 14px 0 22px;
}
.sidebar-bottom button {
  width: 100%;
  background: transparent;
  color: #e1eee6;
  border-color: #537460;
}
.pilot-badge {
  font-size: 9px;
  letter-spacing: 1.2px;
  border: 1px solid #5e7c6c;
  padding: 6px 9px;
  border-radius: 5px;
  color: #dbefc5;
}
.app-shell {
  margin-left: 232px;
}
.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  font-size: 12px;
  font-weight: 600;
  color: #65786d;
}
.breadcrumb {
  color: #8a988e;
  font-weight: 400;
  margin-left: 12px;
}
.private-badge {
  font-size: 11px;
  background: var(--soft);
  color: #476752;
  padding: 5px 10px;
  border-radius: 20px;
}
.admin main {
  max-width: 1250px;
  margin: 0 auto;
  padding: 38px 40px 20px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-bottom: 28px;
}
.page-heading small {
  display: block;
  margin-bottom: 12px;
}
.page-heading p {
  font-size: 14px;
  margin: 0;
}
.version-badge {
  font-size: 10px;
  letter-spacing: 1px;
  padding: 6px 10px;
  background: #e8eee9;
  border-radius: 6px;
  white-space: nowrap;
  margin-top: 4px;
}
.workflow {
  padding: 0;
  margin: 0 0 28px;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
}
.workflow li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 19px 24px;
}
.workflow li + li {
  border-left: 1px solid var(--line);
}
.workflow li > span {
  font-size: 13px;
  background: #edf3e7;
  color: #587140;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.workflow strong {
  font-size: 13px;
  font-weight: 650;
}
.workflow p {
  font-size: 11px;
  margin: 1px 0 0;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.section-heading h2 {
  margin-bottom: 4px;
}
.section-heading + p {
  margin-top: 12px;
  font-size: 13px;
}
.tag {
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 8px;
  color: var(--muted);
  white-space: nowrap;
}
#catalog-form {
  display: block;
  margin-top: 20px;
}
.search-row {
  display: flex;
  gap: 10px;
}
.search-row input {
  flex: 1;
  min-width: 0;
}
.search-row button {
  white-space: nowrap;
}
.search-row button span {
  margin-left: 14px;
}
#candidates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.candidate {
  background: #fafcf9;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.candidate h3 {
  font-size: 15px;
}
.candidate p {
  font-size: 11px;
}
.candidate button {
  margin-top: 14px;
}
#selection {
  padding: 0;
  border: 0;
  background: none;
}
#selection > .section-heading {
  margin-bottom: 16px;
}
#selection-content > h3 {
  font-size: 22px;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin-bottom: 7px;
}
#selection-content > p {
  font-size: 12px;
  margin-bottom: 4px;
}
#selection-content > details {
  margin: 10px 0 20px;
}
#selection-content > details dl {
  background: white;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.analysis-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.analysis-card {
  margin: 0;
  min-width: 0;
  padding: 24px;
}
.analysis-card > p,
.analysis-card > div > p {
  font-size: 13px;
}
.analysis-card:first-child,
.scenarios-card {
  grid-column: 1/-1;
}
.cost-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0;
}
.cost-grid label {
  font-size: 12px;
}
.cost-grid input {
  font-variant-numeric: tabular-nums;
}
.economic-result {
  background: #f2f6f1;
  border: 1px solid #dee7db;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.economic-result > p {
  margin: 0;
  font-size: 12px;
}
.economic-result[data-state="invalid"],
.economic-result[data-state="negative"] {
  background: #fff3f0;
  border-color: #eed0c9;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
  gap: 20px;
}
.metric {
  display: flex;
  flex-direction: column;
}
.metric + .metric {
  border-left: 1px solid #d4dfd3;
  padding-left: 20px;
}
.metric span {
  font-size: 11px;
  color: #58715c;
}
.metric strong {
  font-size: clamp(22px, 2.5vw, 32px);
  letter-spacing: -0.8px;
  color: #24523a;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.economic-result[data-state="negative"] .metric:first-child strong {
  color: #9c3527;
}
.offer-action {
  float: right;
  margin: 0 0 16px 16px;
}
.offer-status {
  clear: both;
}
.offer-choice {
  display: flex;
  align-items: start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.offer-choice input {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--green);
}
.analysis-card details button {
  margin: 5px 5px 10px 0;
}
.scenarios-card > input {
  max-width: 420px;
  margin: 0 10px 14px 0;
}
.scenarios-card > button {
  margin: 0 8px 10px 0;
}
.scenarios-card > h3 {
  margin: 24px 0 12px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 18px 0;
  max-width: 100%;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
}
th {
  font-size: 10px;
  color: #597061;
  background: #f3f6f2;
  white-space: nowrap;
}
td {
  font-variant-numeric: tabular-nums;
}
td:first-child {
  min-width: 160px;
  font-weight: 600;
}
td:not(:first-child) {
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: 0;
}
td button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}
.backup-panel {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 20px;
}
.backup-panel > p {
  font-size: 12px;
}
.backup-panel input {
  max-width: 500px;
  font-size: 12px;
}
.empty-state {
  padding: 24px;
  border: 1px dashed #bdcdbf;
  border-radius: 10px;
  text-align: center;
  background: #fafcf9;
}
.evidence-note {
  padding: 15px 18px;
  border-left: 3px solid #b9c7a7;
  margin-top: 20px;
  background: #edf1e7;
}
.connection-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.connection-actions form {
  margin: 0;
}
#integration {
  scroll-margin-top: 20px;
}
#integration h2 {
  margin-top: 4px;
}
#integration > .note {
  margin: 14px 0 0;
}
#status {
  font-size: 13px;
}
.admin footer {
  display: flex;
  justify-content: space-between;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: #788a7e;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  background: white;
  padding: 12px;
  z-index: 10;
}
.skip-link:focus {
  top: 10px;
}
@media (min-width: 1500px) {
  .admin main {
    padding-top: 48px;
  }
}
@media (max-width: 1100px) {
  .sidebar {
    width: 200px;
    padding: 28px 14px;
  }
  .app-shell {
    margin-left: 200px;
  }
  .admin main {
    padding: 28px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .workflow li {
    padding: 16px;
  }
  .cost-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tag {
    white-space: normal;
  }
  .brand {
    font-size: 20px;
  }
  .analysis-sections {
    gap: 16px;
  }
  .analysis-card {
    padding: 20px;
  }
}
@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
  }
  .brand {
    padding: 0;
    font-size: 20px;
  }
  .brand-icon {
    height: 34px;
    width: 32px;
    font-size: 26px;
  }
  .nav-label,
  .sidebar-bottom > p,
  .pilot-badge {
    display: none;
  }
  .sidebar nav {
    grid-column: 1/-1;
    grid-row: 2;
    display: flex;
    gap: 5px;
    overflow: auto;
  }
  .sidebar nav a {
    white-space: nowrap;
    font-size: 11px;
    padding: 8px;
  }
  .sidebar nav span {
    font-size: 16px;
  }
  .sidebar-bottom {
    margin: 0;
    padding: 0;
  }
  .sidebar-bottom button {
    min-height: 36px;
    font-size: 11px;
    padding: 8px 12px;
  }
  .app-shell {
    margin: 0;
  }
  .topbar {
    height: 52px;
    padding: 0 20px;
  }
  .admin main {
    padding: 26px 20px;
  }
  .page-heading {
    gap: 10px;
  }
  .page-heading small {
    font-size: 9px;
  }
  h1 {
    font-size: 32px;
  }
  .version-badge {
    display: none;
  }
  .workflow li {
    padding: 14px 10px;
    gap: 8px;
  }
  .workflow li > span {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }
  .workflow p {
    display: none;
  }
  .workflow strong {
    font-size: 11px;
  }
  .analysis-sections {
    grid-template-columns: 1fr;
  }
  .analysis-card:first-child,
  .scenarios-card {
    grid-column: auto;
  }
  .section-heading {
    gap: 12px;
  }
  .section-heading .tag {
    display: none;
  }
  section {
    padding: 20px;
  }
  .section-heading h2 {
    font-size: 19px;
  }
  .section-heading button {
    font-size: 11px;
    padding: 8px 10px;
  }
  .metrics {
    gap: 10px;
  }
  .metric + .metric {
    padding-left: 10px;
  }
  .metric strong {
    font-size: 23px;
  }
  .metric span {
    font-size: 10px;
  }
  .economic-result {
    padding: 15px;
  }
  .admin footer {
    gap: 15px;
  }
  .connection-actions {
    flex-wrap: wrap;
  }
  #candidates {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 420px) {
  .admin main {
    padding: 24px 14px;
  }
  .search-row {
    flex-direction: column;
  }
  .cost-grid {
    gap: 14px 10px;
  }
  .cost-grid label {
    min-height: 38px;
    font-size: 11px;
  }
  .cost-grid input {
    padding: 10px;
    font-size: 14px;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .metric + .metric {
    padding: 12px 0 0;
    border-left: 0;
    border-top: 1px solid #d4dfd3;
  }
  .metric strong {
    font-size: 28px;
  }
  .metric span {
    font-size: 11px;
  }
  .offer-action {
    float: none;
    margin: 0 0 12px;
  }
  .breadcrumb {
    display: none;
  }
  .scenarios-card > input {
    margin-right: 0;
  }
  h1 {
    font-size: 29px;
  }
  .admin footer {
    display: block;
  }
  .admin footer span {
    display: block;
  }
  .workflow li {
    gap: 5px;
    padding: 12px 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.score-panel { grid-column: 1 / -1; border-top: 3px solid #6b8960; }
.score-criterion { border-top: 1px solid var(--line); padding: 14px 0; font-size: 13px; }
.score-criterion p { margin: 5px 0 0; }

#portfolio-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr)); gap:16px; margin:20px 0; }
#portfolio-list button { margin-right:8px; }
#report-dialog { width:min(1050px,94vw); max-height:90vh; padding:26px; border:1px solid var(--line); border-radius:14px; color:var(--ink); }
#report-dialog::backdrop { background:#173d3180; }
.report-actions { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom:20px; }
.report-actions h2 { margin-right:auto; }
#report-content { overflow-wrap:anywhere; }
#report-content h1 { font-size:26px; }
#report-content h2 { margin-top:28px; }
#report-content table { font-size:12px; }
#report-content td { white-space:normal; min-width:0; }
#report-content dl { grid-template-columns:150px minmax(0,1fr); }
@media print {
 body:has(#report-dialog[open]) .sidebar, body:has(#report-dialog[open]) .topbar, body:has(#report-dialog[open]) main > :not(#report-dialog) { display:none!important; }
 body:has(#report-dialog[open]) .app-shell, body:has(#report-dialog[open]) main { margin:0; padding:0; max-width:none; }
 #report-dialog[open] { position:static; display:block; max-height:none; overflow:visible; width:100%; max-width:none; margin:0; border:0; padding:0; }
 #report-dialog .report-actions, #report-dialog>.note { display:none; }
 #report-dialog::backdrop { display:none; }
 #report-content tr { break-inside:avoid; }
 #report-content h2 { break-after:avoid; }
}
