:root {
  color-scheme: light;
  --bg: #F7F9FB;
  --text: #001840;
  --card: #ffffff;
  --line: #005098;
  --blue: #005098;
  --green: #206818;
  --error-bg: #fee2e2;
  --error-ink: #450a0a;
  --error-line: #7f1d1d;
  --ok-bg: #dcfce7;
  --ok-ink: #052e16;
  --ok-line: #166534;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.4;
}

.brand,
main,
.site-footer {
  max-width: 36rem;
  margin-right: auto;
  margin-left: auto;
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-left: max(1rem, env(safe-area-inset-left));
}

.brand {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.4rem;
  min-height: 48px;
  padding-top: max(0.65rem, env(safe-area-inset-top));
}

.brand-mark {
  display: block;
  width: auto;
  height: 36px;
  flex: none;
}

.brand-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.4rem;
  min-width: 0;
  flex: 1;
}

.brand-text h1 {
  margin: 0;
}

.brand-org {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-block {
  margin: 0 0 0.85rem;
}

.profile-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.profile-pending {
  margin: 0;
}

.remember-email {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.35rem 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.remember-email input {
  width: auto;
  min-height: 1.25rem;
  margin: 0.15rem 0 0;
  flex: none;
}

main {
  padding-top: 0.75rem;
  padding-bottom: 0.5rem;
}

.access-gate {
  margin: 1.25rem 0 0.5rem;
}

.access-gate h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.access-gate p {
  margin: 0;
}

.access-modes {
  margin-top: 1.1rem;
}

.access-mode-label {
  margin: 0 0 0.35rem;
  font-weight: 800;
  color: var(--blue);
}

.account-form label {
  margin-top: 0.75rem;
}

.account-form .button {
  margin-top: 1rem;
}

.account-change-lead {
  margin: 0.5rem 0 0;
}

.account-gate-messages {
  margin-top: 0.85rem;
}

.account-gate-messages.is-error {
  color: var(--error-ink);
}

.account-gate-messages.is-ok {
  color: var(--ok-ink);
}

.install-help {
  margin: 1rem 0 0.75rem;
  padding: 0.85rem 0.9rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 10px;
}

.install-help h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.install-lead {
  margin: 0 0 0.55rem;
}

.install-steps {
  margin: 0 0 0.35rem;
  padding-left: 1.25rem;
}

.install-steps li {
  margin: 0.35rem 0;
}

.install-help .button {
  margin-top: 0.65rem;
}

.site-footer {
  padding-top: 0.25rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  font-size: 0.95rem;
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--blue);
  font-weight: 700;
}

h1 {
  margin: 0;
  flex: none;
  font-size: clamp(0.95rem, 4vw, 1.35rem);
  line-height: 1.15;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-credit {
  margin: 0;
  flex: none;
  color: var(--blue);
  font-size: clamp(0.72rem, 2.8vw, 0.9rem);
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
}

h2 {
  margin: 1.25rem 0 0;
  font-size: 1.15rem;
}

.legend,
.optional {
  color: var(--text);
  font-weight: 500;
}

.legend {
  margin: 0.35rem 0 0.25rem;
}

.optional {
  font-weight: 600;
}

label {
  display: block;
  margin-top: 1rem;
  font-weight: 800;
}

input[type="text"],
input[type="email"] {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 10px;
}

input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
}

.button {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  border-radius: 10px;
  cursor: pointer;
}

.secondary {
  color: #ffffff;
  background: var(--blue);
  border: 3px solid var(--blue);
}

.send {
  min-height: 56px;
  margin-top: 0.25rem;
  color: #ffffff;
  background: var(--green);
  border: 3px solid var(--green);
  font-size: 1.15rem;
}

.button:focus-visible,
input:focus-visible,
.site-footer a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.position {
  margin: 0.6rem 0 0;
  font-weight: 700;
}

.position strong {
  font-variant-numeric: tabular-nums;
  white-space: pre-line;
}

.location-title,
.location-line {
  margin: 0.35rem 0 0;
}

.note {
  margin: 0.4rem 0 0;
  color: var(--line);
  font-size: 0.95rem;
}

.photo {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 12px;
}

.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--bg);
  border-radius: 8px;
}

.photo-title {
  margin: 0.6rem 0 0;
  font-weight: 800;
}

.photo label {
  margin-top: 0.6rem;
}

.delete {
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--line);
}

.members-panel {
  margin-top: 0.75rem;
}

.members-title {
  margin: 0;
  font-weight: 800;
}

.members-hint {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.members-list {
  margin-top: 0.4rem;
  display: grid;
  gap: 0.35rem;
}

.member-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  min-height: 48px;
  padding: 0.35rem 0.5rem;
  font-weight: 600;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.member-option input {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}

.messages {
  margin-top: 1rem;
}

.messages p {
  margin: 0.4rem 0 0;
  padding: 0.75rem;
  font-weight: 800;
  border-radius: 10px;
}

.messages.is-error p {
  color: var(--error-ink);
  background: var(--error-bg);
  border: 2px solid var(--error-line);
}

.messages.is-ok p {
  color: var(--ok-ink);
  background: var(--ok-bg);
  border: 2px solid var(--ok-line);
}
