:root {
  color-scheme: light;
  --ink: #17231d;
  --muted: #65736b;
  --paper: #f3f5ef;
  --card: #fffef9;
  --line: #dce2da;
  --green: #176b4d;
  --green-dark: #0d4d36;
  --sun: #f2b544;
  --danger: #a8382c;
  --shadow: 0 18px 50px rgba(27, 50, 39, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 76px; padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 254, 249, 0.92); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  color: white; background: var(--green); font-size: 13px; font-weight: 800; letter-spacing: .08em;
  box-shadow: inset -7px -7px 0 rgba(242, 181, 68, .2);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { color: var(--muted); margin-top: 1px; }
.account { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.account-icon { width: 27px; height: 27px; padding: 5px; border-radius: 50%; fill: none; stroke: white; stroke-width: 1.8; stroke-linecap: round; background: var(--green); box-shadow: inset 0 -8px 0 rgba(255,255,255,.18); }
.nav-link { color: var(--green); font-weight: 750; text-decoration: none; }

main { max-width: 1180px; margin: 0 auto; padding: 56px 24px 90px; }
.login-panel { min-height: calc(100vh - 190px); display: grid; grid-template-columns: 1.2fr .8fr; gap: 70px; align-items: center; }
.login-copy { max-width: 620px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(40px, 6vw, 72px); line-height: .98; letter-spacing: -.045em; margin-bottom: 26px; }
h2 { font-size: 27px; letter-spacing: -.025em; margin-bottom: 6px; }
h3 { font-size: 19px; margin-bottom: 5px; }
.login-copy > p:last-child { max-width: 520px; font-size: 18px; line-height: 1.65; color: var(--muted); }
.eyebrow { margin-bottom: 10px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-card { padding: 32px; }

label { display: grid; gap: 7px; color: #46544c; font-size: 13px; font-weight: 700; }
.field-label { display: flex; align-items: center; gap: 6px; }
.info-icon {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 18px; height: 18px; padding: 0; border: 1px solid #9eaaa2; border-radius: 50%;
  color: var(--green); background: white; font-size: 11px; font-weight: 800; line-height: 1;
}
.info-icon::after {
  content: attr(data-info); position: absolute; left: 50%; bottom: calc(100% + 9px);
  width: min(260px, 75vw); padding: 9px 11px; border-radius: 8px;
  color: white; background: #263b31; box-shadow: var(--shadow); font-size: 12px;
  font-weight: 500; line-height: 1.4; text-align: left; transform: translateX(-50%);
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 100;
}
.info-icon:hover::after, .info-icon:focus-visible::after, .info-icon.open::after { opacity: 1; visibility: visible; }
.field-hint { color: var(--muted); font-size: 11px; font-weight: 500; }
input, select {
  width: 100%; min-width: 0; padding: 11px 12px; color: var(--ink); background: white;
  border: 1px solid #cbd4cc; border-radius: 9px; outline: none;
}
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 77, .12); }
input:disabled { color: var(--muted); background: #edf0ec; }
.login-card label { margin: 25px 0 18px; }
.login-card input { padding: 14px; }

.button { border: 0; border-radius: 9px; padding: 10px 15px; font-weight: 750; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--green-dark); background: #dfece5; }
.button.ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.button.danger { color: var(--danger); background: #fae9e6; }
.icon-button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: #edf0ec; font-size: 24px; }
.small-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.small-actions .button { padding: 7px 10px; font-size: 12px; }

.hero, .section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.hero h1 { font-size: clamp(38px, 5vw, 58px); margin-bottom: 10px; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 34px 0 58px; }
.summary article { padding: 22px 24px; background: var(--green-dark); color: white; border-radius: 18px; }
.summary article:nth-child(2) { background: var(--green); }
.summary article:nth-child(3) { color: var(--ink); background: var(--sun); }
.summary span, .summary strong { display: block; }
.summary span { opacity: .75; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.summary strong { margin-top: 5px; font-size: 28px; }

.content-section + .content-section { margin-top: 64px; }
.section-heading { margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 0; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; }
.profile-card { padding: 21px; }
.profile-card .meta { min-height: 45px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.profile-card .metric { margin: 18px 0; display: flex; align-items: baseline; gap: 7px; }
.profile-card .metric strong { font-size: 30px; }
.profile-card footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.key { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

.site-list { display: grid; gap: 20px; }
.site-card { overflow: hidden; }
.site-header { padding: 23px 25px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.site-header p { margin: 0; color: var(--muted); font-size: 14px; }
.array-table { width: 100%; border-collapse: collapse; }
.array-table th, .array-table td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #e8ece7; font-size: 14px; }
.array-table th { color: var(--muted); background: #fafbf7; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.array-table tr:last-child td { border-bottom: 0; }
.array-name strong, .array-name span { display: block; }
.array-name span { margin-top: 3px; }
.empty { padding: 28px; color: var(--muted); text-align: center; border: 1px dashed #cbd4cc; border-radius: 16px; }
.site-card .empty { border: 0; border-radius: 0; }

.message { min-height: 20px; margin: 12px 0; font-size: 14px; }
.message.success { color: var(--green); }
.message.error { color: var(--danger); }

.tabs { display: flex; gap: 5px; margin: 8px 0 34px; padding: 5px; width: fit-content; border: 1px solid var(--line); border-radius: 12px; background: #eef2ed; }
.analysis-filter { display: grid; grid-template-columns: 1fr 1fr 1fr 1.7fr auto; gap: 16px; align-items: end; padding: 22px; margin: 24px 0; }
.analysis-checkbox { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 9px; min-height: 43px; }
.analysis-checkbox input { width: auto; }
.analysis-note { padding: 14px 18px; border-left: 4px solid var(--sun); background: #fff9e9; color: #4c514b; }
.analysis-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin: 24px 0; }
.analysis-source { padding: 24px; border-top: 5px solid var(--green); }
.analysis-source.icon { border-top-color: #d15f20; }
.analysis-bias { margin: 8px 0; font-size: 38px; line-height: 1; font-weight: 850; letter-spacing: -.04em; }
.analysis-source dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0 0; }
.analysis-source dl div { padding: 12px; border-radius: 12px; background: var(--paper); }
.analysis-source dt { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.metric-label { display: inline-flex; align-items: center; gap: 5px; }
.analysis-source .info-icon { width: 16px; height: 16px; font-size: 10px; text-transform: none; }
.analysis-source dd { margin: 4px 0 0; font-weight: 800; }
.analysis-card { margin-top: 20px; padding: 24px; }
.section-heading.compact { margin-bottom: 18px; }
.analysis-table { width: 100%; border-collapse: collapse; }
.analysis-table th, .analysis-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.analysis-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.positive-error { color: #a03a22; }
.negative-error { color: var(--green); }
.tab { padding: 9px 24px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-weight: 750; }
.tab.active { color: white; background: var(--green); }
.api-intro, .api-card { padding: 24px; }
.api-intro { margin-bottom: 18px; }
.api-intro p:last-child { margin-bottom: 0; }
.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.key-row, .endpoint-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.key-row:last-child, .endpoint-row:last-child { border-bottom: 0; }
.endpoint-row { display: grid; }
.endpoint-row code { overflow-wrap: anywhere; color: var(--green-dark); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre { margin: 12px 0; padding: 14px; overflow-x: auto; border-radius: 9px; color: #eef7f1; background: #263b31; white-space: pre-wrap; overflow-wrap: anywhere; }

.app-footer { padding: 0 24px 28px; color: var(--muted); text-align: center; font-size: 12px; }

dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 20px; background: var(--card); box-shadow: 0 24px 90px rgba(10, 30, 20, .3); }
dialog::backdrop { background: rgba(17, 31, 24, .55); backdrop-filter: blur(4px); }
dialog form, .dialog-content { padding: 27px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.coordinate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.coordinate-mode { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; }
.coordinate-mode legend { padding: 0 5px; color: #46544c; font-size: 13px; font-weight: 700; }
.coordinate-mode label { display: flex; align-items: center; gap: 8px; }
.coordinate-mode input { width: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.site-map { height: 300px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }

[hidden] { display: none !important; }
.analysis-summary { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.analysis-source.solcast { border-top: 4px solid #6456aa; }
.analysis-filter { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

@media (max-width: 760px) {
  .topbar { padding: 12px 18px; height: auto; min-height: 76px; flex-wrap: wrap; gap: 12px; }
  main { padding: 34px 16px 70px; }
  .login-panel { grid-template-columns: 1fr; gap: 28px; align-content: center; }
  .login-copy h1 { font-size: 46px; }
  .summary { grid-template-columns: 1fr; }
  .analysis-filter, .analysis-summary { grid-template-columns: 1fr; }
  .analysis-source dl { grid-template-columns: 1fr; }
  .hero, .section-heading, .site-header { align-items: stretch; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .coordinate-fields, .api-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
  .array-table { min-width: 720px; }
  .account #account-name { display: none; }
}
