/* Within — postcode analysis tool.
   Shares the map's ink-and-petrol palette, but this is a working document
   rather than a map: dense, scannable, and legible at a glance. */

/* styles.css locks the viewport for the map page (the map pans; the page
   must not scroll). This page is a normal document — unlock it. */
html, body { height: auto; overflow: visible; }

.analysis-page {
  background: #f2f4f5;
  color: #0b1220;
  font-family: Inter, system-ui, sans-serif;
  min-height: 100vh;
}

.an-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; padding: 1.4rem 1.75rem 1.1rem;
  background: #fff; border-bottom: 1px solid rgba(11, 18, 32, 0.1);
}
.an-head h1 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.01em;
}
.an-head .strap { margin: 0.15rem 0 0; color: rgba(11, 18, 32, 0.55); font-size: 0.88rem; }
.an-nav a {
  font-size: 0.85rem; color: #0e7c66; text-decoration: none; font-weight: 600;
  border: 1px solid rgba(14, 124, 102, 0.3); border-radius: 7px; padding: 6px 12px;
}
.an-nav a:hover { background: rgba(14, 124, 102, 0.08); }

.an-main {
  display: grid; grid-template-columns: minmax(320px, 400px) 1fr;
  gap: 1.25rem; padding: 1.25rem 1.75rem 3rem; align-items: start;
}
@media (max-width: 900px) { .an-main { grid-template-columns: 1fr; } }

.an-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.an-block {
  background: #fff; border: 1px solid rgba(11, 18, 32, 0.09);
  border-radius: 11px; padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.an-block-head { display: flex; align-items: center; justify-content: space-between; }
.an-block h2 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 0.82rem; font-weight: 600; margin: 0;
  text-transform: uppercase; letter-spacing: 0.05em; color: rgba(11, 18, 32, 0.55);
}
.an-count {
  font-variant-numeric: tabular-nums; font-size: 0.78rem; font-weight: 600;
  color: #0e7c66; background: rgba(14, 124, 102, 0.1);
  border-radius: 20px; padding: 1px 9px;
}
.an-hint { margin: 0; font-size: 0.79rem; color: rgba(11, 18, 32, 0.5); line-height: 1.45; }
.an-hint code {
  font-size: 0.92em; background: rgba(11, 18, 32, 0.055);
  padding: 1px 5px; border-radius: 4px;
}
.an-note { margin: 0; font-size: 0.73rem; color: rgba(11, 18, 32, 0.42); }
.an-warn { margin: 0; font-size: 0.78rem; color: #8a2f2f; }

textarea, input[type="text"], select {
  width: 100%; font: inherit; font-size: 0.85rem; color: #0b1220;
  background: #fbfcfc; border: 1px solid rgba(11, 18, 32, 0.15);
  border-radius: 8px; padding: 8px 10px;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5; }
textarea:focus, input:focus, select:focus {
  outline: 2px solid rgba(14, 124, 102, 0.4); outline-offset: 1px; border-color: transparent;
}
input[type="color"] {
  width: 100%; height: 34px; padding: 2px; cursor: pointer;
  border: 1px solid rgba(11, 18, 32, 0.15); border-radius: 8px; background: #fff;
}

.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; }
.an-grid label, .an-block > label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.75rem; font-weight: 600; color: rgba(11, 18, 32, 0.6);
}
.an-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.an-file { position: relative; overflow: hidden; display: inline-block; }
.an-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.an-file span, .an-ghost {
  display: inline-block; font: inherit; font-size: 0.78rem; font-weight: 600;
  color: #0e7c66; background: transparent; cursor: pointer;
  border: 1px solid rgba(14, 124, 102, 0.32); border-radius: 7px; padding: 5px 11px;
}
.an-ghost:hover, .an-file:hover span { background: rgba(14, 124, 102, 0.08); }
.an-logo { max-height: 30px; max-width: 90px; object-fit: contain; }

/* Property rows */
.prop-row { display: grid; grid-template-columns: 1fr 100px auto auto; gap: 6px; align-items: center; }
.prop-row + .prop-row { margin-top: 6px; }
.prop-row .cur {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.7rem; font-weight: 600; color: rgba(11, 18, 32, 0.55); white-space: nowrap;
}
.prop-row .cur input { accent-color: #0e7c66; }
.prop-del {
  border: 0; background: transparent; cursor: pointer; font-size: 1.05rem; line-height: 1;
  color: rgba(11, 18, 32, 0.32); padding: 0 3px;
}
.prop-del:hover { color: #8a2f2f; }

.an-actions { display: flex; gap: 0.6rem; }
.an-primary, .an-secondary {
  flex: 1; font: inherit; font-size: 0.88rem; font-weight: 600;
  padding: 11px 14px; border-radius: 9px; cursor: pointer; border: 0;
}
.an-primary { background: #0e7c66; color: #fff; }
.an-primary:hover { background: #0c6a58; }
.an-secondary {
  background: #fff; color: #1d2f8f; border: 1px solid rgba(29, 47, 143, 0.32);
}
.an-secondary:hover:not(:disabled) { background: rgba(29, 47, 143, 0.07); }
.an-primary:disabled, .an-secondary:disabled { opacity: 0.45; cursor: default; }
.an-status { margin: 0; font-size: 0.8rem; color: rgba(11, 18, 32, 0.6); min-height: 1.2em; }
.an-status.error { color: #8a2f2f; }

/* Results */
.an-lede {
  margin: 0; font-size: 0.85rem; line-height: 1.5;
  background: rgba(14, 124, 102, 0.06); border-left: 3px solid #0e7c66;
  border-radius: 0 6px 6px 0; padding: 8px 11px;
}
.an-scroll { overflow-x: auto; }
.an-tall { max-height: 460px; overflow-y: auto; }
.an-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.an-table th {
  text-align: left; font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(11, 18, 32, 0.45); font-weight: 600; padding: 6px 8px;
  border-bottom: 1px solid rgba(11, 18, 32, 0.13);
  position: sticky; top: 0; background: #fff;
}
.an-table td { padding: 5px 8px; border-bottom: 1px solid rgba(11, 18, 32, 0.055); }
.an-table td.num, .an-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.an-table tr.best td { background: rgba(14, 124, 102, 0.08); font-weight: 600; }
.an-table tr.excluded td { color: rgba(11, 18, 32, 0.35); font-style: italic; }
.an-table .muted { color: rgba(11, 18, 32, 0.45); }
.up { color: #8a2f2f; }
.down { color: #0e7c66; }

/* Impact bar */
.impact { display: flex; height: 8px; border-radius: 4px; overflow: hidden; min-width: 84px; }
.impact i { display: block; height: 100%; }
.impact .s { background: #0e7c66; }
.impact .n { background: #c3cad1; }
.impact .l { background: #a3392f; }

.an-empty { align-self: stretch; }
.an-empty-inner {
  background: #fff; border: 1px dashed rgba(11, 18, 32, 0.16); border-radius: 11px;
  padding: 2.5rem 2rem; text-align: center; color: rgba(11, 18, 32, 0.55);
}
.an-empty-inner h2 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.05rem; margin: 0 0 0.4rem; color: #0b1220;
}
.an-empty-inner p { margin: 0 0 0.4rem; font-size: 0.87rem; }

/* Service-pattern explainer */
.an-speed-note {
  border-left: 2px solid rgba(14, 124, 102, 0.4);
  padding-left: 9px; margin-top: 2px;
}
.an-details { margin-top: 2px; }
.an-details summary {
  cursor: pointer; font-size: 0.78rem; font-weight: 600; color: #0e7c66;
  list-style: none; padding: 2px 0;
}
.an-details summary::-webkit-details-marker { display: none; }
.an-details summary::before { content: "＋ "; font-weight: 400; }
.an-details[open] summary::before { content: "－ "; }
.an-details summary:hover { text-decoration: underline; }
.an-defs { margin: 6px 0 0; font-size: 0.79rem; line-height: 1.5; }
.an-defs dt {
  font-weight: 700; color: #0b1220; margin-top: 8px;
}
.an-defs dt:first-child { margin-top: 0; }
.an-defs dd {
  margin: 2px 0 0; color: rgba(11, 18, 32, 0.62);
}
.an-defs dd strong { color: #0b1220; }
