/* Wrenna design system, from the "Wrenna portal" canvas: D2 mark, sage palette,
   Fraunces headings with Manrope text (the canvas's default pairing). */

/* Fonts are self-hosted: loading them from Google would send every visitor's IP address
   to a third party. Files from Google Fonts (SIL Open Font License), split the way Google
   splits them: "latin" covers ó, ³, ± and punctuation; "latin-ext" covers ą ę ł ń ś ź ż ć.
   unicode-range lets the browser download latin-ext only when a page needs it.
   Manrope is a variable font, so one file serves every weight from 400 to 700. */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-500-latin-ext.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-600-latin.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-600-latin-ext.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ink: #1D231D;
  --ink-muted: #4E564C;
  --ink-subtle: #596157;
  --paper: #F5F4EE;
  --surface: #FFFFFF;
  --line: #DEDDD2;
  --line-strong: #CFCFC4;

  --sage-50: #F1F4EE;
  --sage-100: #E3E9DE;
  --sage-200: #C9D5C0;
  --sage-300: #AEBFA4;
  --sage-500: #728A68;
  --sage-700: #465842;
  --sage-800: #354235;
  --sage-900: #243024;
  --on-sage-100: #2F3D2C;

  --clay: #B4572A;
  --water: #2E5E8C;

  --accent: var(--sage-700);
  --accent-hover: var(--sage-900);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-wordmark: "IBM Plex Sans", "Segoe UI", sans-serif;

  --gutter: clamp(20px, 5.5vw, 80px);
  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-float: 0 12px 32px -12px rgba(36, 48, 36, 0.35);

  /* Bootstrap bridge: pages still built from Bootstrap classes pick up the palette */
  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-secondary-color: var(--ink-subtle);
  --bs-border-color: var(--line);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 70, 88, 66;
  --bs-link-hover-color: var(--accent-hover);
  --bs-link-hover-color-rgb: 36, 48, 36;
  --bs-primary: var(--accent);
  --bs-primary-rgb: 70, 88, 66;
}

.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-bg: var(--accent-hover);
  --bs-btn-active-border-color: var(--accent-hover);
  --bs-btn-disabled-bg: var(--accent);
  --bs-btn-disabled-border-color: var(--accent);
  --bs-btn-focus-shadow-rgb: 70, 88, 66;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--sage-500);
  box-shadow: 0 0 0 0.2rem rgba(70, 88, 66, 0.25);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.alert-success {
  --bs-alert-color: var(--on-sage-100);
  --bs-alert-bg: var(--sage-100);
  --bs-alert-border-color: var(--sage-200);
}

/* Base */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 3px solid var(--sage-500);
  outline-offset: 2px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--sage-900);
  color: #FFFFFF;
}

.skip-link:focus {
  top: 16px;
  color: #FFFFFF;
}

/* The D2 mark with its "renna" wordmark */

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  color: var(--sage-900);
  text-decoration: none;
}

.brand:hover {
  color: var(--sage-900);
}

.brand-mark {
  display: block;
  flex-shrink: 0;
}

.brand-word {
  font-family: var(--font-wordmark);
  font-weight: 600;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Buttons */

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button--primary {
  background: var(--accent);
  color: #FFFFFF;
}

.button--primary:hover {
  background: var(--accent-hover);
  color: #FFFFFF;
}

.button--secondary {
  background: var(--surface);
  border-color: var(--sage-200);
  color: var(--sage-900);
}

.button--secondary:hover {
  background: var(--sage-50);
  color: var(--sage-900);
}

.button--large {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 10px;
  font-size: 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Account menu (both headers) */

.account-menu {
  position: relative;
}

.account-menu > summary {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  cursor: pointer;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
}

.account-menu-name {
  margin-bottom: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-subtle);
}

.account-menu-panel form {
  margin: 0;
}

.account-menu-panel a,
.account-menu-panel button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.account-menu-panel a:hover,
.account-menu-panel button:hover {
  background: var(--sage-50);
}

/* Public site */

.site-header {
  min-height: 88px;
  padding: 12px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 48px;
}

.site-nav {
  flex-grow: 1;
  display: flex;
  gap: 8px;
}

.site-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover {
  background: var(--sage-100);
  color: var(--sage-900);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
}

.page h1,
.portal-main h1 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.site-footer {
  min-height: 80px;
  padding: 16px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-subtle);
}

.site-footer p {
  flex-grow: 1;
  margin: 0;
}

.site-footer a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink-subtle);
}

@media (max-width: 960px) {
  .site-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }
}

/* Home page */

.full-bleed {
  flex: 1 0 auto;
}

.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero {
  padding: 48px var(--gutter) 96px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 64px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(40px, 4.6vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.lead {
  max-width: 540px;
  margin: 0;
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.compare-preview {
  position: relative;
  height: 540px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #B7BD98;
  box-shadow: 0 24px 48px -24px rgba(36, 48, 36, 0.45);
}

.compare-preview svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.compare-after {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 52%);
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 52%;
  width: 3px;
  margin-left: -1.5px;
  background: #FFFFFF;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 52%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 8px rgba(29, 35, 29, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-handle svg {
  position: static;
  width: 20px;
  height: 20px;
}

.compare-date {
  position: absolute;
  top: 20px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(29, 35, 29, 0.8);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.compare-date--before { right: calc(48% + 12px); }
.compare-date--after { left: calc(52% + 12px); }

.sample-pill {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--sage-800);
  font-size: 12px;
  font-weight: 600;
}

.compare-summary {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.compare-summary-label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--ink-subtle);
}

.compare-summary-value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 36px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-note {
  color: var(--ink-subtle);
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.swatch--cut { background: var(--clay); }
.swatch--fill { background: var(--water); }

.section {
  padding: 80px var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.section--white {
  background: var(--surface);
}

.section-heading {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section h2,
.contact-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 3.2vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.step {
  padding: 28px;
  border-radius: 16px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.step h3,
.feature h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
}

.step p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.feature {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature h3 {
  font-size: 21px;
}

.feature p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--sage-100);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section--dark {
  background: var(--sage-900);
  color: #F1F4EE;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 64px;
}

.section--dark .eyebrow { color: var(--sage-300); }
.section--dark h2 { color: #FFFFFF; }

.section-copy {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section--dark .section-copy p:last-child {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
  color: #CDD7C6;
}

.specs {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #3A4A39;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
}

.spec {
  padding: 22px 24px;
  background: #2B382B;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec dt {
  font-size: 13px;
  font-weight: 400;
  color: var(--sage-300);
}

.spec dd {
  margin: 0;
  font-size: 22px;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
}

.contact {
  padding: 80px var(--gutter);
}

.contact-card {
  padding: 56px;
  border-radius: 24px;
  background: var(--sage-100);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 48px;
}

.contact-card > div {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-card p {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
  color: var(--sage-800);
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 16px;
  color: var(--sage-900);
}

.contact-details a {
  color: inherit;
}

@media (max-width: 1100px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .hero,
  .section--dark,
  .contact-card {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero { padding-bottom: 64px; }
  .compare-preview { height: 420px; }
  .contact-card { padding: 32px; }
}

@media (max-width: 760px) {
  .steps,
  .features { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .compare-date { top: 60px; }
}

/* Portal (logged-in app) */

.portal-header {
  min-height: 72px;
  padding: 12px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 40px;
}

.portal-nav {
  flex-grow: 1;
  display: flex;
  gap: 4px;
}

.portal-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  white-space: nowrap;
}

.portal-nav a:hover {
  background: var(--sage-50);
  color: var(--sage-900);
}

.portal-nav a[aria-current="page"] {
  background: var(--sage-100);
  color: var(--sage-900);
}

.org-badge {
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  white-space: nowrap;
}

.org-badge-initials {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--sage-100);
  color: var(--on-sage-100);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.org-badge-more {
  color: var(--ink-subtle);
}

.portal-main {
  flex: 1 0 auto;
  padding: 28px 40px 40px;
}

.portal-footer {
  padding: 12px 40px;
  display: flex;
  flex-wrap: wrap;
  /* The links are 44 px tall (touch targets); without this the © text sat at the top of the row */
  align-items: center;
  gap: 4px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-subtle);
}

.portal-footer a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink-subtle);
}

@media (max-width: 760px) {
  .portal-header { padding: 12px 16px; }
  .portal-nav { order: 3; width: 100%; overflow-x: auto; }
  .portal-main { padding: 20px 16px 32px; }
  .portal-footer { padding: 8px 16px; }
}

/* Portal pages: Pulpit and the site view */

.page-head {
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.page-head > div {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
}

.page-kicker {
  font-size: 14px;
  color: var(--ink-subtle);
}

.trail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-subtle);
}

.trail a {
  color: var(--ink-subtle);
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.dashboard h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
}

.panel-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.panel-empty {
  margin: 0;
  font-size: 14px;
  color: var(--ink-subtle);
}

.empty-state {
  margin: 0;
  padding: 28px;
  border: 2px dashed var(--sage-200);
  border-radius: var(--radius-lg);
  background: #F8FAF6;
  color: var(--ink-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill--ready { background: var(--sage-100); color: var(--on-sage-100); }
.status-pill--processing { background: #FBF0D9; color: #7A4F0E; }
.status-pill--error { background: #F6E1DC; color: #8E2B1F; }
.status-pill--none { background: #ECEBE4; color: var(--ink-muted); }
/* Finished, but nothing for the map: only files to download (the original photos, say) */
.status-pill--files { background: #E3EBF3; color: #24496D; }

.stats {
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label,
.stat-note {
  font-size: 13px;
  color: var(--ink-subtle);
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat--alert { border-color: #E9C3BA; }
.stat--alert .stat-label,
.stat--alert .stat-value { color: #8E2B1F; }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: start;
  gap: 24px;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.site-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.site-card-media {
  position: relative;
  height: 132px;
  background: var(--sage-50);
}

.terrain-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.site-card-media .status-pill {
  position: absolute;
  top: 12px;
  left: 12px;
}

.site-card-body {
  flex-grow: 1;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-card-body h3 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.site-card-meta {
  font-size: 13px;
  color: var(--ink-subtle);
}

/* Its own line under the name, cut short with "…" (the full address is in the title) */
.site-card-address {
  display: block;
  margin: 2px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.site-card-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.site-card-row span:first-child {
  color: var(--ink-subtle);
}

.card-link {
  margin-top: auto;
  align-self: flex-start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.activity {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.activity li {
  display: flex;
  gap: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.activity time {
  width: 44px;
  flex-shrink: 0;
  padding-top: 2px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.activity strong {
  display: block;
  font-weight: 600;
}

.activity-text { color: var(--ink-muted); }
.activity-text--error { color: #8E2B1F; }

/* Site view: the map fills the window under the portal header; panels float over it */

.portal-main--map {
  padding: 0;
  display: flex;
}

.map-page {
  position: relative;
  flex-grow: 1;
  display: flex;
  min-height: 420px; /* a short window still gets a usable map */
}

.map-stage {
  position: relative;
  flex-grow: 1;
  overflow: hidden;
  padding: 32px;
  background: var(--sage-50);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.map-panels {
  position: absolute;
  top: 16px;
  max-height: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* The space between panels belongs to the map */
  pointer-events: none;
}

.map-panels > * {
  pointer-events: auto;
}

.map-panels--start {
  left: 16px;
  width: 288px;
}

.map-panels--end {
  right: 16px;
  width: 320px;
}

.map-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-float);
}

.map-title {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-title h1 {
  margin: 0;
  font-size: 24px;
}

/* Panels fold with <details>: no script needed, and the keyboard works */
.map-panel > summary {
  min-height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.map-panel > summary::-webkit-details-marker {
  display: none;
}

/* A chevron: down when folded, up when open */
.map-panel > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

.map-panel[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.map-panel-count {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sage-100);
  color: var(--on-sage-100);
  font-size: 12px;
  letter-spacing: 0;
}

/* A long flight list scrolls inside its panel instead of running off the map */
.map-flights ol {
  max-height: min(60vh, calc(100vh - 300px));
  margin: 0;
  padding: 0 12px 12px;
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-flights .panel-empty,
.map-details > :not(summary) {
  margin: 0 16px 16px;
}

/* With its parameters and the layers open above it, the flight's details may not fit beside the
   map: they scroll inside their panel instead of running off it, under a title that stays put */
.map-details[open] {
  min-height: 46px;
  overflow-y: auto;
}

/* Its own background, so what scrolls under it doesn't show through. Not "inherit": <summary>
   inherits from the slot it's placed in, inside <details>, which has none */
.map-details > summary {
  position: sticky;
  top: 0;
  background: var(--surface);
}

/* The map itself (OpenLayers draws into it), and what sits over it */
.map-canvas {
  position: absolute;
  inset: 0;
  text-align: left;
}

.map-status,
.map-readout {
  position: absolute;
  z-index: 1;
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(29, 35, 29, 0.12);
  font-size: 14px;
  color: var(--ink-muted);
}

.map-status {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.map-readout {
  left: 16px;
  bottom: 48px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* OpenLayers' own buttons: zoom and full screen bottom right, out of the panels' way */
.map-canvas .ol-zoom {
  top: auto;
  left: auto;
  right: 16px;
  bottom: 16px;
}

.map-canvas .ol-full-screen {
  top: auto;
  right: 16px;
  bottom: 88px;
}

.map-canvas .ol-scale-line {
  left: 16px;
  bottom: 16px;
}

.map-canvas .ol-control button {
  width: 36px;
  height: 36px;
  background: var(--surface);
  color: var(--sage-900);
  font-size: 18px;
}

.map-canvas .ol-control button:hover,
.map-canvas .ol-control button:focus {
  background: var(--sage-50);
  color: var(--sage-900);
}

/* "Warstwy": a checkbox per layer, a colour scale under each elevation layer */
.map-layer-list {
  min-width: 0;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}

.map-layer {
  min-height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.map-layer input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.map-layer:has(input:disabled) {
  color: var(--ink-subtle);
  cursor: default;
}

.map-layer-hint {
  margin: -6px 16px 8px 44px;
  font-size: 12px;
  color: var(--ink-subtle);
}

/* "Podkład": the base map, under the flight's own layers */
.map-layer-list + .map-layer-list {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.map-layer-heading {
  margin: 0;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-subtle);
}

.map-layer-note {
  margin: 0 16px 4px;
  font-size: 12px;
  color: var(--ink-subtle);
}

/* Whose tiles the base map shows: bottom right, beside the zoom buttons */
.map-attribution {
  position: absolute;
  z-index: 1;
  right: 64px;
  bottom: 16px;
  margin: 0;
  padding: 2px 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
  font-size: 12px;
}

.map-attribution a {
  color: var(--ink-muted);
}

.map-legend {
  margin: -4px 16px 10px 44px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-legend[hidden] {
  display: none;
}

/* The same five colours as map-viewer.js, low to high */
.map-legend-ramp {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, rgb(44, 123, 182), rgb(171, 217, 233), rgb(255, 255, 191), rgb(253, 174, 97), rgb(215, 25, 28));
}

.map-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-subtle);
  font-variant-numeric: tabular-nums;
}

/* One compact row per flight, so the list takes as little of the map as it can */
.map-flights .capture-item {
  min-height: 44px;
  padding: 6px 10px 6px 12px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.map-flights .capture-item-date {
  width: auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.map-flights .capture-item-date strong {
  font-size: 16px;
}

.map-flights .capture-item-date span {
  font-size: 12px;
}

.capture-item {
  padding: 12px 14px;
  border: 1px solid #E6E5DC;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.capture-item:hover {
  border-color: var(--sage-300);
  color: var(--ink);
}

.capture-item[aria-current="true"] {
  border-color: var(--accent);
  background: var(--sage-50);
}

.capture-item-date {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.capture-item-date strong {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
}

.capture-item-date span {
  font-size: 13px;
  color: var(--ink-subtle);
  font-variant-numeric: tabular-nums;
}

.viewer-message {
  position: relative;
  max-width: 360px;
  padding: 18px 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(29, 35, 29, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-muted);
}

.viewer-message strong {
  font-size: 16px;
  color: var(--ink);
}

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px 12px;
  font-size: 14px;
}

.facts dt {
  font-weight: 400;
  color: var(--ink-subtle);
}

.facts dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Each label and value in a <div>: on one line while they fit, else the value goes under its label */
.facts--pairs {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.facts--pairs > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
}

.facts--pairs dd {
  min-width: 0;
  margin-left: auto;
  overflow-wrap: anywhere;
}

/* Running text reads from the left, under its label */
.facts--pairs .facts-text dd {
  flex-basis: 100%;
  text-align: left;
}

/* "Pliki do pobrania" (_FileDownloads): one row per stored file, the whole row a link */
.file-downloads {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-download {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--sage-200);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sage-900);
  text-decoration: none;
}

.file-download:hover {
  background: var(--sage-50);
  color: var(--sage-900);
}

.file-download-icon {
  flex-shrink: 0;
  color: var(--accent);
}

.file-download-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.file-download-name {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.file-download-meta {
  font-size: 12px;
  color: var(--ink-subtle);
  font-variant-numeric: tabular-nums;
}

/* Over the layers of a flight whose added files are being processed, or failed to be */
.map-layer-status {
  margin: 0 16px 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #FBF0D9;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #5E3C08;
}

.map-layer-status[data-status="Failed"] {
  background: #F6E1DC;
  color: #8E2B1F;
}

/* A second group in the flight's details (Parametry pomiaru), set off by a rule */
.map-details > .map-details-heading {
  margin-bottom: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-subtle);
}

.note {
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 10px;
  background: var(--sage-50);
  font-size: 13px;
  line-height: 1.5;
  color: var(--sage-800);
}

@media (max-width: 1100px) {
  .dashboard { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .site-grid { grid-template-columns: 1fr; }

  /* On a phone the panels sit above the map rather than covering it */
  .map-page { flex-direction: column; }
  .map-panels {
    position: static;
    order: -1;
    width: auto;
    max-height: none;
    padding: 12px 16px 0;
  }
  /* About three flights, then scroll, so the map itself shows on the first screen */
  .map-flights ol { max-height: 28vh; }
  .map-stage { min-height: 60vh; }
}

/* Upload page (Prześlij nalot) */

.page-lead {
  max-width: 760px;
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-muted);
}

/* Long text pages (Polityka prywatności): a readable line length */
.legal {
  max-width: 760px;
  line-height: 1.6;
}

.legal h2 {
  margin: 40px 0 12px;
  font-size: 22px;
}

.legal h3 {
  margin: 24px 0 8px;
  font-size: 17px;
}

.legal ul,
.legal ol {
  padding-left: 20px;
}

/* The terms' numbered points: a little air between them */
.legal li + li {
  margin-top: 6px;
}

/* Under the login button: logging in accepts the terms (Regulamin § 5) */
.login-terms {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.legal-table {
  width: 100%;
  margin-bottom: 16px;
  border-collapse: collapse;
  font-size: 15px;
}

.legal-table th,
.legal-table td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.legal-table code {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  align-items: start;
  gap: 24px;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-section,
.queue {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-section h2,
.queue h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
}

.form-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.form-section-note,
.field-hint {
  font-size: 13px;
  color: var(--ink-subtle);
}

.field-hint {
  margin: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.field-grid--assign {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field--span2 { grid-column: span 2; }
.field--span3 { grid-column: span 3; }

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--sage-800);
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.field input::placeholder {
  color: #8A9087;
}

/* Added by the tag helpers to fields that failed validation */
.field .input-validation-error {
  border-color: #8E2B1F;
}

.field-error {
  font-size: 13px;
  color: #8E2B1F;
}

.form-errors {
  padding: 14px 18px;
  border: 1px solid #E9C3BA;
  border-radius: var(--radius-lg);
  background: #FFF8F6;
  font-size: 14px;
  color: #6E2419;
}

.form-errors ul {
  margin: 0;
  padding-left: 18px;
}

/* The summary is always rendered; it only has content after a failed post */
.form-errors.validation-summary-valid {
  display: none;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.file-slot {
  min-width: 0;
  padding: 16px;
  border: 2px dashed var(--sage-200);
  border-radius: 12px;
  background: #F8FAF6;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-slot:focus-within {
  border-color: var(--sage-500);
}

/* The photo archive gets a row of its own under the map files */
.file-slot--wide {
  grid-column: 1 / -1;
}

.file-slot-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.file-slot-head label {
  font-size: 14px;
  font-weight: 700;
}

.file-slot-head span {
  font-size: 12px;
  color: var(--ink-subtle);
}

.file-slot input[type="file"] {
  width: 100%;
  font-size: 14px;
  color: var(--ink-muted);
}

.file-slot input[type="file"]::file-selector-button {
  min-height: 44px;
  margin-right: 12px;
  padding: 0 14px;
  border: 1px solid var(--sage-200);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--sage-900);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.file-slot input[type="file"]::file-selector-button:hover {
  background: var(--sage-50);
}

.file-slot-progress {
  width: 100%;
  height: 6px;
  appearance: none;
  border: none;
  border-radius: 3px;
  background: #ECEBE4;
  overflow: hidden;
}

.file-slot-status {
  font-size: 13px;
  color: var(--ink-subtle);
}

.file-slot-status:empty {
  display: none;
}

.file-slot-status.field-validation-error {
  color: #8E2B1F;
}

.file-slot:has(.input-validation-error) {
  border-color: #E9C3BA;
}

.form-success {
  margin: 0 0 20px;
  padding: 14px 18px;
  border: 1px solid var(--sage-200);
  border-radius: var(--radius-lg);
  background: var(--sage-50);
  font-size: 14px;
  color: var(--on-sage-100);
}

.file-slot-progress::-webkit-progress-bar { background: #ECEBE4; }
.file-slot-progress::-webkit-progress-value { background: var(--accent); }
.file-slot-progress::-moz-progress-bar { background: var(--accent); }

.form-actions {
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.form-actions p {
  flex: 1 1 240px;
  margin: 0;
  font-size: 13px;
  color: var(--ink-subtle);
}

.queue-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-item {
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-item:hover {
  border-color: var(--sage-300);
}

/* data-status changes live (capture-progress.js), so the colours follow it rather than a class */
.queue-item[data-status="Uploading"],
.queue-item[data-status="Processing"] { border-color: #EAD9B5; background: #FFFCF5; }
.queue-item[data-status="Failed"] { border-color: #E9C3BA; background: #FFF8F6; }

.queue-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.queue-item-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.queue-item-head .status-pill {
  flex-shrink: 0;
}

.queue-item-head a {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

/* The whole card is the link's click target */
.queue-item-head a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.queue-item-meta {
  font-size: 13px;
  color: var(--ink-subtle);
  font-variant-numeric: tabular-nums;
}

/* "Napraw" on a failed capture: sits above the card-wide link so it can be clicked itself */
.queue-item-action {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* A capture's files and processing (Pages/sites/capture.cshtml) */
.capture-files {
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.capture-state,
.capture-file-panel,
.capture-info-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.capture-state h2,
.capture-file-panel h2,
.capture-info-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
}

.capture-state-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.capture-state-actions,
.capture-file-actions,
.capture-file-upload {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.capture-file-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.capture-file {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.capture-file form {
  margin: 0;
}

.capture-file-current {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 14px;
  color: var(--ink-muted);
}

.capture-file-name {
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.capture-file-missing {
  color: var(--ink-subtle);
}

/* Why processing couldn't put a file added later on the map: only that file failed */
.capture-file-failure {
  margin: 0;
  font-size: 13px;
  color: #8E2B1F;
}

/* Fields this user may no longer change (CaptureChanges): shown, not editable */
.capture-info-form input[readonly],
.capture-info-form select:disabled {
  background: var(--sage-50);
  color: var(--ink-muted);
}

.capture-info-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* "Historia zmian" (admins only): one change a line, the time first */
.capture-log {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.capture-log li {
  display: flex;
  gap: 12px;
}

.capture-log time {
  flex-shrink: 0;
  width: 120px;
  color: var(--ink-subtle);
}

.capture-log li > span {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  overflow-wrap: anywhere;
}

.capture-log-meta {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--ink-subtle);
}

.capture-file-upload {
  flex: 1 1 360px;
}

.capture-file-upload input[type="file"] {
  flex: 1 1 220px;
  min-width: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.capture-file-upload input[type="file"]::file-selector-button {
  min-height: 44px;
  margin-right: 12px;
  padding: 0 14px;
  border: 1px solid var(--sage-200);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--sage-900);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.capture-file-upload .file-slot-progress,
.capture-file-upload .file-slot-status {
  flex-basis: 100%;
}

.page-message {
  margin: 0 0 20px;
}

/* What a capture is doing right now (_CaptureProgress.cshtml) */
.capture-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* display: flex above would otherwise beat the hidden attribute */
.capture-progress[hidden] {
  display: none;
}

[data-status="Failed"] .capture-progress-label {
  color: #6E2419;
}

.capture-progress-bar {
  width: 100%;
  height: 6px;
  appearance: none;
  border: none;
  border-radius: 3px;
  background: #F1E6CE;
  overflow: hidden;
}

.capture-progress-bar::-webkit-progress-bar { background: #F1E6CE; }
.capture-progress-bar::-webkit-progress-value { background: #B7791F; transition: width 0.4s ease; }
.capture-progress-bar::-moz-progress-bar { background: #B7791F; }

.viewer-message .capture-progress {
  margin: 4px 0;
}

@media (max-width: 1100px) {
  .upload-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .field-grid,
  .field-grid--assign,
  .file-grid { grid-template-columns: 1fr; }
  .field--span2,
  .field--span3 { grid-column: auto; }
  .form-section,
  .queue { padding: 18px; }
}

/* New site (Nowa budowa) */

.site-form {
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  resize: vertical;
}

.field-optional {
  margin-left: 4px;
  font-weight: 400;
  color: var(--ink-subtle);
}

.field-grid--coordinates {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* A text field with its button beside it; the button moves under it when there's no room */
.field-with-button {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-with-button input {
  flex: 1 1 220px;
  min-width: 0;
}

.field-with-button .button {
  flex: none;
  height: 44px;
}

/* A short list of radio choices, one per line */
.choice-list {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.choice-list legend {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sage-800);
}

.choice {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  cursor: pointer;
}

.choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* The location picker: a map box with its hint and attribution over it */
.site-picker {
  position: relative;
  height: 380px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sage-50);
}

.site-picker[hidden] {
  display: none;
}

.site-map {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.site-map-hint {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 8px 12px;
  transform: translate(-50%, -50%);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(29, 35, 29, 0.12);
  font-size: 14px;
  text-align: center;
  color: var(--ink-muted);
  pointer-events: none;
}

.site-picker .map-attribution {
  right: 8px;
  bottom: 8px;
}

.site-map .ol-control button {
  width: 36px;
  height: 36px;
  background: var(--surface);
  color: var(--sage-900);
  font-size: 18px;
}

/* "Podkład" under the picker: the choices in a row */
.site-picker-bases .map-layer-list {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 20px;
}

.site-picker-bases .map-layer-heading,
.site-picker-bases .map-layer {
  padding: 0;
}

.site-picker-bases .map-layer-note {
  flex-basis: 100%;
  margin: 0;
}

@media (max-width: 760px) {
  .field-grid--coordinates { grid-template-columns: 1fr; }
  .site-picker { height: 300px; }
}

/* Edit site (Edycja budowy): the form, then archiving, in one column */

.site-edit {
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* The column's gap spaces these; their own margins would add to it */
.site-edit .form-success,
.site-edit .note {
  margin: 0;
}

/* "Edytuj budowę" under the site's name on its map page */
.map-title-link {
  align-self: flex-start;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}

/* Who has access (_SiteFormSections, "Dostęp"): an organisation, what it may do, and "Usuń" on the
   extra ones. A fixed last column, so the managing organisation's row lines up with the others. */
.access-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 88px;
  align-items: start;
  gap: 12px 16px;
}

/* As tall as a label, so "Usuń" lines up with the selects beside it */
.field-label-space {
  font-size: 13px;
}

.field-label-space::before {
  content: "\00a0";
}

.access-row-action .button {
  align-self: flex-start;
}

.shared-orgs {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shared-orgs legend {
  margin: 4px 0 4px;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--sage-900);
}

.shared-org-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shared-org-list li {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* What archiving does, before it's done */
.confirm-panel {
  max-width: 720px;
}

.confirm-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
  line-height: 1.5;
}

/* Archived sites under the Pulpit's cards, for admins */
.archived-sites {
  margin-top: 20px;
  font-size: 14px;
}

.archived-sites > summary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--sage-800);
}

.archived-sites > summary::-webkit-details-marker {
  display: none;
}

/* A chevron, as on the map panels: down when folded, up when open */
.archived-sites > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.archived-sites[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.archived-sites ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.archived-sites li {
  min-height: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}

@media (max-width: 760px) {
  .access-row { grid-template-columns: 1fr; }
  .access-row .field-label-space { display: none; }
}

/* Irreversible actions: deleting an account */
.button--danger {
  background: var(--surface);
  border-color: #E9C3BA;
  color: #8E2B1F;
}

.button--danger:hover {
  background: #FFF8F6;
  color: #6E2419;
}

/* Logowanie: one narrow column in the middle */
.login-page {
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-page h1 {
  margin: 4px 0 0;
}

.login-help {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* Short pages in one narrow column (the error page, Wylogowanie, Zmiana hasła); its gap spaces them */
.narrow-page {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.narrow-page h1,
.narrow-page .page-lead,
.narrow-page .field-hint,
.narrow-page .form-success,
.narrow-page .note {
  margin: 0;
}

/* On the page itself rather than in a panel, so it needs an edge to stand out */
.narrow-page .note {
  border: 1px solid var(--sage-200);
}

/* Users and organisations (/admin/Manage-User-Org): the three forms, then the lists */
.admin-page {
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-page .form-success {
  margin: 0;
}

/* Three across on a wide screen, one on a phone */
.admin-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
  gap: 20px;
}

.admin-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.admin-list > li {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.admin-list > li:first-child {
  padding-top: 0;
  border-top: 0;
}

.admin-list-main {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-list-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.admin-list-meta {
  font-size: 13px;
  color: var(--ink-subtle);
}

.admin-list-actions {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-org + .admin-org {
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
}

.admin-org h3 {
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 16px;
  font-weight: 700;
}

.admin-org h3 code {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-subtle);
}

/* The delete step's heading carries the badge in the text font, as in the list */
.confirm-panel .access-badge {
  font-family: var(--font-body);
}

/* The panel's gap spaces the refusal */
.confirm-panel .form-errors {
  margin: 0;
}

/* Access levels (/admin/Access) */

.access-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.access-badge--public { background: var(--sage-100); color: var(--on-sage-100); }
.access-badge--signedin { background: #E3ECF5; color: #1F4466; }
.access-badge--admin { background: #F4E4DA; color: #7A3A18; }

/* Telegram alerts (/admin/Alerts) */

.alerts-panel {
  max-width: 760px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 15px;
  line-height: 1.6;
}

.alerts-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.alerts-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
}

.alerts-panel p {
  margin: 0;
}

.alerts-panel code {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.alerts-panel form {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

/* Cookie consent banner */

.consent-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.consent-banner p {
  flex: 1 1 320px;
  margin: 0;
  line-height: 1.5;
}

.consent-banner form {
  margin: 0;
}
