:root {
  color-scheme: dark;
  --page: #101316;
  --panel: #1a1f23;
  --raised: #242a2f;
  --line: #343c43;
  --muted: #96a1aa;
  --text: #f4f7f8;
  --orange: #ff6633;
  --orange-bright: #ff845c;
  --green: #68d19a;
  --red: #ff8181;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, #333b42 0, transparent 42%),
    linear-gradient(145deg, #14181b, #0d0f11 72%);
}
a { color: inherit; }
button, input, select { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 4.5rem); line-height: .95; letter-spacing: -.06em; margin-bottom: 14px; }
h2 { letter-spacing: -.035em; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange-bright);
  font-size: .73rem;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.lead { max-width: 620px; color: #c0c8cd; font-size: 1.12rem; line-height: 1.65; }
.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: #15181a;
  background: var(--orange);
  font-size: 1.25rem;
  font-weight: 950;
}

.login-layout {
  width: min(1140px, calc(100% - 40px));
  min-height: 100vh;
  margin: auto;
  display: grid;
  grid-template-columns: 1.2fr minmax(340px, .72fr);
  align-items: center;
  gap: clamp(48px, 8vw, 120px);
  padding: 60px 0;
}
.login-brand .brand-mark { margin-bottom: 44px; }
.login-card, .panel, .capture-card, .stat {
  border: 1px solid var(--line);
  background: rgba(27, 32, 36, .92);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}
.login-card { padding: 34px; border-radius: 24px; }
.login-card h2 { margin-bottom: 8px; font-size: 2rem; }
.login-card > div > p:last-child, .page-heading p, .capture-heading p, .empty-state p { color: var(--muted); }
.fine-print { margin: 22px 0 0; color: #758089; font-size: .75rem; text-align: center; }

.stack { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #cbd2d7; font-size: .82rem; font-weight: 750; }
input, select {
  width: 100%;
  border: 1px solid #46515a;
  border-radius: 11px;
  padding: 13px 14px;
  color: var(--text);
  background: #111518;
  outline: none;
}
input:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 102, 51, .14); }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 11px 17px;
  color: var(--text);
  background: none;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: #fff; background: linear-gradient(#f36a3c, #dc4e20); box-shadow: 0 7px 20px rgba(219, 75, 28, .22); }
.button-secondary { border-color: #59646d; background: #30373d; }
.button-ghost { border-color: var(--line); background: rgba(255,255,255,.025); }
.button-small { min-height: 36px; padding: 7px 12px; font-size: .78rem; }
.button:hover { filter: brightness(1.09); }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(70, 79, 87, .75);
  background: rgba(15, 18, 21, .88);
  backdrop-filter: blur(18px);
}
.brand-link { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-link > span:last-child { display: grid; }
.brand-link small { color: var(--muted); font-size: .67rem; text-transform: uppercase; letter-spacing: .1em; }
.topbar nav { display: flex; align-items: center; gap: 12px; }
.topbar form { margin: 0; }
.admin-chip { color: #aab3ba; font-size: .78rem; }

.portal { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 90px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 38px; }
.page-heading h1 { margin-bottom: 10px; }
.page-heading p { margin-bottom: 0; }
.back-link { display: inline-block; margin-bottom: 30px; color: #b7c0c6; font-weight: 750; text-decoration: none; }
.back-link:hover { color: white; }

.alert { margin-bottom: 22px; border: 1px solid; border-radius: 12px; padding: 13px 15px; line-height: 1.45; }
.alert-success { border-color: rgba(104,209,154,.42); color: #b8f1d1; background: rgba(45,116,78,.2); }
.alert-error { border-color: rgba(255,129,129,.42); color: #ffc1c1; background: rgba(134,44,44,.2); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { padding: 22px; border-radius: 17px; }
.stat span { color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.stat strong { display: block; margin-top: 6px; font-size: 2rem; }

.project-list { display: grid; gap: 11px; }
.project-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 22px;
  padding: 19px 21px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(28,33,37,.85);
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.project-row:hover { transform: translateY(-2px); border-color: #59636c; background: #20262a; }
.project-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; color: #191c1e; background: var(--orange); font-weight: 950; }
.project-main { display: grid; gap: 5px; min-width: 0; }
.project-main strong { overflow: hidden; font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.project-main small, .project-metric small { color: var(--muted); }
.project-metric { display: grid; min-width: 72px; gap: 3px; text-align: right; }
.row-arrow { color: var(--orange-bright); font-size: 1.3rem; }

.project-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; margin-bottom: 48px; }
.panel { padding: 27px; border-radius: 18px; }
.panel-muted { background: rgba(24,29,33,.62); box-shadow: none; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin-bottom: 10px; }
.address-groups { display: grid; gap: 18px; margin: 18px 0 23px; }
.street-group { display: grid; gap: 9px; }
.street-group h3 { margin: 0; color: #aeb8bf; font-size: .82rem; letter-spacing: .04em; }
.address-list { display: flex; flex-wrap: wrap; gap: 9px; }
.address-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 48px;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid #424c54;
  border-radius: 999px;
  color: #aeb7bd;
  background: #20262a;
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background .15s ease, transform .15s ease;
}
.address-chip:hover { transform: translateY(-1px); border-color: #69757f; color: #fff; }
.address-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #69737b; }
.address-chip-ready {
  border-color: rgba(104, 209, 154, .45);
  color: #a9e9c5;
  background: rgba(50, 127, 85, .17);
}
.address-chip-ready .address-status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(104, 209, 154, .12);
}
.address-chip-selected {
  border-color: var(--orange);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 102, 51, .12);
}
.address-chip-ready.address-chip-selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(104, 209, 154, .16);
}
.inline-form { border-top: 1px solid var(--line); padding-top: 18px; }
summary { color: #cbd2d7; font-weight: 800; cursor: pointer; }
.inline-form form { margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 13px; }
.form-panel { max-width: 760px; }
.form-panel .form-grid { grid-template-columns: 1fr 180px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }

.number-picker {
  display: grid;
  gap: 16px;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: rgba(12, 15, 17, .38);
}
.number-picker legend {
  padding: 0 7px;
  color: #d8dee2;
  font-size: .82rem;
  font-weight: 800;
}
.number-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 11px;
  border: 1px solid #424b53;
  border-radius: 11px;
  padding: 12px;
  background: #20262a;
  cursor: pointer;
}
.choice-card:has(input:checked) {
  border-color: var(--orange);
  background: rgba(255, 102, 51, .1);
  box-shadow: 0 0 0 2px rgba(255, 102, 51, .08);
}
.choice-card input { width: auto; margin: 0; accent-color: var(--orange); }
.choice-card span { display: grid; gap: 2px; }
.choice-card small { color: var(--muted); font-weight: 500; }
.range-panel[hidden], [data-number-panel][hidden] { display: none; }
.range-grid { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 11px; }
.range-preview { margin: 10px 0 0; color: var(--green); font-size: .78rem; font-weight: 750; }

.meta-list { display: grid; gap: 0; margin: 0; }
.meta-list > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 15px; padding: 12px 0; border-top: 1px solid var(--line); }
.meta-list > div:first-child { border-top: 0; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: .72rem; }

.section-heading { margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 0; font-size: 2rem; }
.section-heading p { margin: 8px 0 0; color: var(--muted); }
.captures-section { display: grid; gap: 18px; }
.capture-card { padding: 25px; border-radius: 19px; }
.capture-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.capture-heading h3 { margin-bottom: 7px; font-size: 1.45rem; }
.capture-heading p { margin-bottom: 0; }
.status-pill { border: 1px solid rgba(104,209,154,.35); border-radius: 999px; padding: 7px 10px; color: #9ee4bc; background: rgba(50,127,85,.18); font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }

.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.photo-card { overflow: hidden; margin: 0; border: 1px solid #374047; border-radius: 12px; background: #111518; }
.photo-viewer-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  margin: 0;
  border: 0;
  padding: 0;
  color: white;
  background: #080a0b;
  cursor: pointer;
}
.photo-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.photo-card:hover img { transform: scale(1.025); }
.viewer-hint {
  position: absolute;
  right: 9px;
  bottom: 9px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: 6px 9px;
  color: #fff;
  background: rgba(10, 12, 14, .78);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .04em;
  backdrop-filter: blur(8px);
}
.photo-card figcaption { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; font-size: .7rem; }
.photo-card figcaption span { overflow: hidden; color: #aeb7bd; text-overflow: ellipsis; white-space: nowrap; }
.photo-card figcaption a { color: var(--orange-bright); font-weight: 800; text-decoration: none; }
.technical { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.technical .meta-list { margin-top: 12px; }
.empty-state { padding: 44px; border: 1px dashed #3d464d; border-radius: 17px; text-align: center; background: rgba(25,29,33,.55); }
.empty-state h3 { margin-bottom: 8px; }

body.panorama-open { overflow: hidden; }
.panorama-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  padding: 20px;
  background: rgba(4, 6, 7, .92);
  backdrop-filter: blur(12px);
}
.panorama-modal[hidden] { display: none; }
.panorama-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1500px, 100%);
  height: 100%;
  margin: auto;
  overflow: hidden;
  border: 1px solid #3c454c;
  border-radius: 20px;
  background: #111518;
  box-shadow: 0 35px 100px rgba(0, 0, 0, .55);
}
.panorama-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #191e22;
}
.panorama-header h2 { margin: 0; font-size: 1.15rem; }
.panorama-header p:last-child { margin: 5px 0 0; color: var(--muted); font-size: .76rem; }
.panorama-actions { display: flex; gap: 9px; }
.panorama-stage { min-height: 0; background: #050607; }
.panorama-navigation {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  background: #191e22;
}
.panorama-navigation p { margin: 0; color: var(--muted); font-size: .76rem; text-align: center; }
.panorama-navigation button:disabled { opacity: .35; cursor: default; filter: none; }
.horizon-control {
  width: min(500px, 100%);
  margin: 0 auto;
}
.horizon-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
}
.horizon-label output {
  min-width: 42px;
  color: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.horizon-input {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.horizon-input input { width: 100%; accent-color: var(--orange); }
.horizon-input input:disabled { opacity: .45; }
.panorama-stage .pnlm-load-box { color: #fff; background: rgba(12, 15, 17, .82); }
.panorama-stage .pnlm-about-msg { display: none !important; }

@media (max-width: 900px) {
  .login-layout, .project-grid { grid-template-columns: 1fr; }
  .login-layout { align-content: center; gap: 40px; }
  .login-brand .brand-mark { margin-bottom: 24px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .project-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .project-metric { display: none; }
}

@media (max-width: 620px) {
  .portal { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .topbar { padding: 0 12px; }
  .admin-chip { display: none; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat { display: flex; align-items: center; justify-content: space-between; }
  .stat strong { margin: 0; }
  .project-row { gap: 12px; padding: 15px; }
  .project-main small { display: none; }
  .photo-grid { grid-template-columns: 1fr; }
  .form-grid, .form-panel .form-grid, .range-grid, .number-mode { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .capture-heading { flex-direction: column; }
  .panorama-modal { padding: 0; }
  .panorama-dialog { border: 0; border-radius: 0; }
  .panorama-header { align-items: flex-start; }
  .panorama-actions { align-items: stretch; flex-direction: column-reverse; }
  .panorama-navigation { grid-template-columns: 1fr 1fr; }
  .horizon-control { grid-column: 1 / -1; grid-row: 1; }
  .panorama-navigation > button { grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
