:root {
  --ink: #111a2b;
  --secondary: #4c5c70;
  --blue: #1456df;
  --line: #d8e2ee;
  --glass: #ffffffd9;
  background: #f3f6fb;
  color: var(--ink);
}

body { background: radial-gradient(ellipse at 94% 0, #dceafd 0, transparent 42%) #f3f6fb; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.topbar {
  min-height: 68px;
  padding: 12px max(26px, calc((100% - 1190px) / 2));
  color: var(--ink);
  background: #ffffffb8;
  border-bottom: 1px solid #ffffff;
  box-shadow: 0 5px 20px #202f5008;
  backdrop-filter: blur(20px) saturate(150%);
  position: relative;
  z-index: 2;
}

.brand { gap: 10px; text-decoration: none; color: inherit; }
.brand strong { font-size: 21px; font-weight: 800; letter-spacing: -.07em; line-height: 1.04; }
.brand small { margin-top: 4px; color: var(--secondary); font-size: 11px; }
.brand-mark {
  background: linear-gradient(160deg, #75afff, #245fee 65%, #1843b7);
  border-radius: 13px;
  box-shadow: inset 0 1px 1px #ffffffa0, 0 4px 10px #1456df42;
  color: white;
  position: relative;
  flex: none;
}

.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  transform: rotate(-14deg) skew(-5deg);
}

.brand-mark::after { inset: 15px; background: currentColor; border: 0; border-radius: 50%; }
.top-actions .btn { text-decoration: none; }
.top-actions form { margin: 0; }
.top-actions .btn, .glass-dialog .btn, .mapit-page .btn, .home-view .btn {
  background: #ffffffa8;
  color: #19304a;
  border-color: #cfdbeb;
  border-radius: 999px;
}

.btn.primary {
  background: linear-gradient(175deg, #347af8, #154ed9);
  color: white;
  border-color: #124bcc;
  box-shadow: inset 0 1px 0 #ffffff52, 0 5px 12px #144ccd24;
}

.btn.primary:hover { background: linear-gradient(175deg, #286bec, #1042bf); color: white; }
.top-actions .btn:hover, .mapit-page .btn:not(.primary):hover, .glass-dialog .btn:not(.primary):hover,
.home-view .btn:not(.primary):hover { background: #e9f1ff; }
.file-menu { position: relative; }
.file-menu summary { cursor: pointer; list-style: none; }
.file-menu summary::-webkit-details-marker { display: none; }
.file-menu-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  display: grid;
  gap: 5px;
  width: max-content;
  max-width: min(240px, 58vw);
  padding: 8px;
  background: #f9fbff;
  border: 1px solid #fff;
  border-radius: 16px;
  box-shadow: 0 12px 36px #1c395d28;
}

.file-menu-panel .btn { justify-content: flex-start; border-radius: 10px; border: 0; background: transparent; }
.file-menu-panel .account-name { padding: 5px 8px; color: var(--secondary); overflow-wrap: anywhere; }
.home-view { max-width: 1242px; padding: 42px 26px 36px; }
.welcome {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1fr);
  min-height: 378px;
  gap: clamp(24px, 6vw, 78px);
  padding: clamp(28px, 4.6vw, 62px);
  border: 1px solid #fff;
  border-radius: 36px;
  color: var(--ink);
  background: radial-gradient(ellipse at 100% 100%, #c9dff1 0, transparent 64%),
    linear-gradient(130deg, #fff, #edf4fc 65%, #dcebf8);
  box-shadow: 0 20px 65px #234a7f17;
}

.welcome h1 {
  margin: 0;
  font-size: clamp(45px, 6.3vw, 86px);
  line-height: .98;
  letter-spacing: -.079em;
  font-weight: 780;
}

.welcome h1 span { color: #245bd0; }
.welcome p { margin: 21px 0 25px; max-width: 34ch; color: var(--secondary); font-size: 17px; line-height: 1.55; }
.welcome .btn.big { padding-inline: 22px; font-size: 14px; }
.welcome .btn.big span { font-size: 17px; line-height: 1; }
.welcome-visual {
  align-self: center;
  position: relative;
  isolation: isolate;
  padding: 9px;
  border: 1px solid #ffffffd9;
  border-radius: 29px;
  background: linear-gradient(140deg, #fff9, #ffffff2e);
  box-shadow: inset 0 1px 0 #fff, 0 26px 45px #0a419134;
}

.welcome-visual img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1.64;
  object-fit: cover;
  border-radius: 21px;
  background: #27435b;
}

.survey-target {
  position: absolute;
  bottom: 22px;
  right: 22px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff8f;
  border-radius: 50%;
  background: #e8f5ff44;
  box-shadow: inset 0 1px 0 #fff8;
  backdrop-filter: blur(12px);
}

.survey-target::after { content: ""; width: 11px; height: 11px; border: 2px solid white; border-radius: 50%; }
.home-heading { margin: 36px 0 14px; }
.home-heading h2 { font-size: clamp(22px, 2.45vw, 30px); font-weight: 760; letter-spacing: -.055em; margin: 0; }
.home-heading span { color: var(--secondary); }
.survey-card, .empty-state {
  border: 1px solid #fff;
  border-radius: 22px;
  background: var(--glass);
  box-shadow: 0 7px 24px #214b7c0c;
  padding: 20px;
}

.survey-card small, .empty-state, .privacy-note { color: var(--secondary); }
.survey-card h3 { overflow-wrap: anywhere; }
.survey-card .btn.danger { color: #a51e32; }
.empty-state { min-height: 75px; display: grid; align-content: center; }
.empty-state p { margin: 0; font-size: 14px; }
.empty-state strong { color: var(--ink); }
.empty-map { color: var(--blue); background: #eaf1ff; border-radius: 12px; font-size: 23px; width: 35px; height: 35px; }
.privacy-note { display: flex; align-items: baseline; gap: 8px; margin: 17px 0 0; padding: 0; background: none; border: 0; font-size: 12px; }
.local-indicator { width: 7px; height: 7px; border-radius: 50%; background: #18784f; flex: none; }
.editor-head { background: #fdfdff; }
.tool.active, .equipment-button.active { background: #ebf2ff; border-color: #7ca9f5; color: #133e96; }
.page-tab.active { background: #174fcb; border-color: #174fcb; }
.field input[type="range"], .layer-toggles input { accent-color: var(--blue); }
.editor-title small { color: var(--secondary); }

.glass-dialog, #mapPicker.glass-dialog {
  width: min(calc(100% - 30px), 630px);
  max-height: calc(100dvh - 36px);
  padding: clamp(18px, 3.2vw, 32px);
  border: 1px solid #fff;
  border-radius: 28px;
  color: var(--ink);
  background: #f8fbfff5;
  box-shadow: 0 30px 105px #152d6266, inset 0 1px 0 #fff;
}

#mapPicker.glass-dialog { width: min(calc(100% - 30px), 740px); }
.glass-dialog::backdrop, #mapPicker.glass-dialog::backdrop {
  background: #101c3973;
  backdrop-filter: blur(9px);
}

.dialog-heading { display: flex; align-items: flex-start; gap: 18px; justify-content: space-between; margin-bottom: 21px; }
.dialog-heading h2 { margin: 0; font-size: clamp(23px, 4vw, 34px); letter-spacing: -.055em; }
.dialog-heading p { color: var(--secondary); line-height: 1.5; margin: 6px 0 0; }
.dialog-heading p:empty { display: none; }
.glass-dialog .dialog-close { line-height: 1; }
.site-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.site-custom-fields { display: contents; }
.site-field-wide { grid-column: 1 / -1; }
.site-field { display: grid; align-content: start; gap: 6px; font-size: 13px; font-weight: 650; min-width: 0; }
.site-field :is(input, textarea, select) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #cbd8e7;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font: 400 16px / 1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-field textarea { resize: vertical; }
.site-field span, .site-field small { overflow-wrap: anywhere; }
.site-field small { font-size: 12px; font-weight: 400; color: var(--secondary); }
.dialog-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 21px; }
.dialog-actions p { margin: 0; font-size: 13px; color: var(--secondary); }
.dialog-actions .btn { margin-left: auto; }
.glass-dialog .btn.primary, .mapit-page .btn.primary, .home-view .btn.primary { color: white; background: linear-gradient(175deg, #347af8, #154ed9); border-color: #124bcc; }
.glass-dialog .btn.primary:hover, .mapit-page .btn.primary:hover, .home-view .btn.primary:hover { background: #164aca; }

.mapit-page { max-width: 980px; margin: auto; padding: 34px 24px 48px; }
.mapit-auth { max-width: 480px; padding-top: max(34px, 8vh); }
.mapit-card {
  padding: clamp(18px, 4vw, 39px);
  border: 1px solid #fff;
  border-radius: 25px;
  background: var(--glass);
  box-shadow: 0 17px 55px #1c3d7619;
}

.mapit-page h1 { margin: 0; font-size: clamp(32px, 5.5vw, 49px); letter-spacing: -.067em; }
.mapit-auth .site-field { margin: 17px 0; }
.mapit-page p { color: var(--secondary); line-height: 1.5; }
.mapit-page [role="alert"] { color: #aa1c36; }
.mapit-page a { color: #154db4; }
.kit-fields-header, .kit-field-title, .kit-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.kit-fields-header { margin-top: 23px; }
.kit-fields { display: grid; gap: 10px; }
.kit-field { padding: 14px; background: #f8faff; border: 1px solid var(--line); border-radius: 16px; }
.kit-field-title h3 { margin: 0 0 8px; font-size: 15px; overflow-wrap: anywhere; }
.kit-controls { justify-content: flex-start; gap: 5px; }
.kit-controls .btn { padding: 4px 10px; min-height: 34px; }
.kit-controls .danger { color: #a51e32; }
.kit-toggles { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 13px; font-size: 13px; }
.kit-toggles label { display: inline-flex; align-items: center; gap: 5px; }
.kit-toggles input { accent-color: var(--blue); }
.kit-field [hidden] { display: none; }

@media (max-width: 700px) {
  .topbar { min-height: 59px; padding: 9px 13px; gap: 7px; }
  .brand { gap: 7px; }
  .brand strong { font-size: 19px; }
  .brand small { font-size: 10px; }
  .brand-mark { border-radius: 11px; }
  .brand-mark::before { inset: 9px; }
  .brand-mark::after { inset: 13px; }
  .top-actions { gap: 4px; }
  .top-actions .btn { padding: 6px 8px; }
  .home-view { padding: 20px 14px 26px; }
  .welcome { gap: 22px; padding: 24px; min-height: 0; border-radius: 26px; }
  .welcome p { font-size: 15px; margin: 15px 0 18px; }
  .welcome-visual { border-radius: 19px; padding: 5px; }
  .welcome-visual img { border-radius: 14px; }
  .home-heading { margin-top: 27px; }
}

@media (max-width: 535px) {
  .welcome, .site-fields { grid-template-columns: minmax(0, 1fr); }
  .welcome-visual img { aspect-ratio: 1.94; }
  .survey-target { right: 13px; bottom: 13px; width: 29px; height: 29px; }
  .site-fields { gap: 12px; }
  .mapit-page { padding-inline: 13px; }
}

/* Prism belongs to the landing page and the form opened from it. */
body:has(#homeView:not(.hidden)):not(:has(#mapPicker[open])) {
  background: #edeafa;
  min-height: 100dvh;
}
body:has(#homeView:not(.hidden)):not(:has(#mapPicker[open])) .topbar {
  background: #edeafa;
  border-bottom: 1px solid #48308526;
  box-shadow: none;
}
body:has(#homeView:not(.hidden)):not(:has(#mapPicker[open])) .brand-mark {
  background: #6343db;
}
#homeView { color: #292046; }
#homeView .welcome {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 320px;
  padding: clamp(26px, 5vw, 72px);
  overflow: hidden;
  border: 1px solid white;
  border-radius: 26px;
  background: radial-gradient(at 85% 10%, #d5f4ff, transparent 45%), linear-gradient(155deg, #d5c6ff, #f7f5ff 74%);
  box-shadow: inset 0 1px white, 0 12px 28px #55329813;
}
.workspace-label, #homeView .home-heading h2 {
  color: #514668;
  font: 700 12px/1.5 ui-monospace, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}
#homeView .welcome h1 {
  margin: 6px 0 20px;
  font-size: clamp(46px, 6vw, 78px);
  letter-spacing: -.065em;
  line-height: 1;
  color: #292046;
}
#homeView .btn.primary, body:has(#homeView:not(.hidden)) #siteDetails .btn.primary {
  color: white;
  background: #6343db;
  border-color: #5937d0;
  box-shadow: inset 0 1px 0 #ffffff55;
}
#homeView #newSurveyBtn { border-radius: 16px; min-height: 48px; font-size: 16px; }
#homeView .survey-card, #homeView .empty-state {
  background: #ffffffaa;
  border: 1px solid #4c318724;
  border-radius: 18px;
  box-shadow: none;
}
.prism-sheets {
  position: absolute;
  right: 18%;
  top: 29%;
  width: clamp(100px, 14vw, 180px);
  aspect-ratio: 1.12;
  transform: rotate(-12deg) skewX(13deg);
  pointer-events: none;
  z-index: -1;
}
.prism-sheets i {
  position: absolute;
  inset: 0;
  border: 1.5px solid white;
  border-radius: 18%;
  transform: rotate(38deg) scaleY(.65);
  background: linear-gradient(115deg, #8167f0cf, #d9cbffb9);
  box-shadow: 2px 8px 17px #48338838;
}
.prism-sheets i:nth-child(2) {
  translate: 0 -16%;
  background: linear-gradient(125deg, #e8e2ffcc, #8ed3ffbb);
}
.prism-sheets i:last-child {
  translate: 0 -32%;
  background: repeating-linear-gradient(45deg, #ffffff30 0 14px, #ffffffa0 15px 16px), linear-gradient(135deg, #e7e8ffca, #b6e2ffc9);
}
body:has(#homeView:not(.hidden)) #siteDetails[open] {
  max-height: 88dvh;
  overflow: auto;
  border: 1px solid #fff;
  border-radius: 26px;
  background: #f7f4fff5;
  box-shadow: 0 18px 60px #30284938;
  transform-origin: 50% 70%;
}
body:has(#homeView:not(.hidden)) #siteDetails :is(input, select, textarea) { font-size: 16px; }
@media (prefers-reduced-motion: no-preference) {
  .prism-sheets i:last-child { animation: prism-float 4s ease-in-out infinite alternate; }
  body:has(#homeView:not(.hidden)) #siteDetails[open] { animation: prism-expand .45s cubic-bezier(.18,.82,.22,1); }
}
@keyframes prism-float { to { translate: 0 -39%; } }
@keyframes prism-expand { from { transform: scale(.78); opacity: .1; } }
@media (max-width: 650px) {
  #homeView { padding: 16px 17px 24px; }
  #homeView .welcome { align-items: flex-end; min-height: 328px; padding: 135px 24px 24px; }
  .prism-sheets { top: 18px; right: 21%; }
}

.company-dashboard {
  padding: clamp(20px, 4vw, 42px);
  margin-bottom: 18px;
  border-radius: 24px;
  background: linear-gradient(125deg, #ddd3ff, #f2efff 65%, #ddf4ff);
  color: #292046;
}
.company-dashboard h1 { margin: 6px 0; font-size: clamp(28px, 5vw, 48px); letter-spacing: -.05em; }
.company-dashboard small { color: #57468a; font-weight: 700; }
.company-dashboard p { margin: 0; }

.company-logo { display: block; max-width: 118px; max-height: 38px; object-fit: contain; }
.company-logo[hidden], .company-logo:not([hidden]) + .brand-mark { display: none; }
.editor-logo { max-width: 72px; max-height: 30px; }
.kit-branding { border: 1px solid #ded9ec; border-radius: 16px; padding: 16px; margin: 0 0 18px; display: grid; gap: 10px; }
.kit-branding legend { font-weight: 700; }
.kit-branding img { max-width: min(100%,240px); max-height: 80px; }
.kit-branding button { justify-self: start; }

body.dev-kit-workspace { background: radial-gradient(ellipse at 90% 0, #ddf4ff, transparent 42%) #edeafa; min-height: 100dvh; }
.dev-kit-workspace .brand-mark { background: #6343db; }
.dev-kit-workspace .mapit-page .btn.primary { background: #6343db; border-color: #5937d0; }
.dev-kit-workspace .mapit-page .btn.primary:hover { background: #5133bf; }

.legal-document { max-width: 760px; margin: auto; }
.legal-document .legal-text { white-space: pre-wrap; overflow-wrap: anywhere; color: #292046; }

#iosSetup { display: block; }
#iosSetup[hidden] { display: none; }
#iosSetup summary { cursor: pointer; font-weight: 650; }
