:root {
  --color-background: #fff8ed;
  --color-surface: #ffffff;
  --color-text: #202020;
  --color-muted: #6f6a63;
  --color-border: #d9d0c4;

  --color-primary: #ef6a5b;
  --color-primary-dark: #c94e42;
  --color-secondary: #78a7b8;
  --color-accent: #e7b84f;

  --color-success: #3f8f68;
  --color-error: #b84545;

  --font-body:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  --radius-small: 10px;
  --radius-medium: 18px;
  --radius-large: 28px;

  --shadow-soft:
    0 12px 32px rgba(48, 38, 26, 0.1);

  --page-width: 760px;
  --transition-fast: 160ms ease;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--color-background);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--color-text);
  background:
    radial-gradient(
      circle at 15% 20%,
      rgba(239, 106, 91, 0.1),
      transparent 30%
    ),
    radial-gradient(
      circle at 85% 80%,
      rgba(120, 167, 184, 0.12),
      transparent 32%
    ),
    var(--color-background);
  font-family: var(--font-body);
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.page-shell {
  width: min(
    calc(100% - 32px),
    var(--page-width)
  );
  margin: 0 auto;
  padding: 32px 0 64px;
}

.centered-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: 100%;
  padding: 28px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-soft);
}

.stack {
  display: grid;
  gap: 18px;
}

.stack-small {
  display: grid;
  gap: 10px;
}

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

.row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 7vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

p {
  margin-bottom: 0;
}

.muted {
  color: var(--color-muted);
}

.field {
  display: grid;
  gap: 7px;
}

label {
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  color: var(--color-text);
  background: #fffdfa;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-secondary);
  box-shadow:
    0 0 0 4px rgba(120, 167, 184, 0.2);
}

.code-input {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 1.6rem;
  font-weight: 800;
}

.button {
  min-height: 50px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  color: white;
  background: var(--color-primary);
  box-shadow:
    0 8px 18px rgba(239, 106, 91, 0.24);
}

.button-primary:hover {
  background: var(--color-primary-dark);
}

.button-secondary {
  color: var(--color-text);
  background: var(--color-accent);
}

.button-quiet {
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
}

.notice {
  padding: 13px 15px;
  border-radius: var(--radius-small);
  background: rgba(120, 167, 184, 0.13);
}

.notice-error {
  color: var(--color-error);
  background: rgba(184, 69, 69, 0.1);
}

.notice-success {
  color: var(--color-success);
  background: rgba(63, 143, 104, 0.11);
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fade-in 320ms ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--page-width));
    padding-top: 18px;
  }

  .centered-page {
    padding: 10px;
  }

  .card {
    padding: 22px 18px;
    border-radius: var(--radius-medium);
  }

  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
.portal-credentials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.credential-box,
.admin-item,
.response-card {
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: #fffdfa;
}

.credential-value {
  display: block;
  margin: 8px 0 14px;
  font-size: clamp(2rem, 8vw, 3.5rem);
  letter-spacing: 0.08em;
}

.section-heading-row {
  justify-content: space-between;
}

iframe {
  display: block;
  width: 100%;
  border: 0;
}

[hidden],
.hidden {
  display: none !important;
}

[data-type="error"] {
  color: var(--color-error);
}

[data-type="success"] {
  color: var(--color-success);
}

@media (max-width: 640px) {
  .portal-credentials {
    grid-template-columns: 1fr;
  }
}

/* Dark interface */
:root {
  --color-background: #090a0d;
  --color-surface: #12141a;
  --color-text: #f4f1ea;
  --color-muted: #aaa7a0;
  --color-border: #30333c;
  --color-primary: #f07768;
  --color-primary-dark: #d45d50;
  --color-secondary: #7bb2c6;
  --color-accent: #e7b84f;
  --color-success: #72c69a;
  --color-error: #ff8b8b;
  --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.38);
}

html { color-scheme: dark; }
body {
  background:
    radial-gradient(circle at 15% 20%, rgba(239, 106, 91, 0.10), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(120, 167, 184, 0.10), transparent 32%),
    var(--color-background);
}
input, textarea, select { background: #0d0f14; }

.home-card { text-align: center; }
.home-form { justify-items: center; }
.compact-field { width: min(30vw, 220px); min-width: 145px; text-align: left; }
.home-code-input { width: 100%; }
.home-view-button { width: min(40vw, 290px); min-width: 170px; }
.compact-control { width: min(100%, 260px); }
.compact-button { width: min(100%, 280px); }
.auth-card { max-width: 520px; }
.received-message { font: inherit; letter-spacing: normal; }
.contact-links { display: flex; flex-wrap: wrap; gap: 14px; }
.contact-links[hidden] { display: none; }
.contact-links a { text-decoration: underline; text-underline-offset: 3px; }
.portal-heading-row { justify-content: space-between; align-items: flex-start; }
.portal-heading-row h1 { margin-bottom: 0; }

@media (max-width: 520px) {
  .compact-field { width: 46vw; }
  .home-view-button { width: 58vw; }
  .card { padding: 22px; }
}

/* Visual cleanup: uniform near-black background and compact portal details */
:root {
  --color-background: #0a0b0d;
  --color-surface: #121317;
  --color-surface-raised: #17191e;
  --color-input: #101216;
  --color-border: #30333a;
}

html,
body {
  background: var(--color-background);
}

body {
  background-image: none;
}

.card,
.credential-box,
.admin-item,
.response-card {
  color: var(--color-text);
  background: var(--color-surface);
  border-color: var(--color-border);
}

input,
textarea,
select {
  color: var(--color-text);
  background: var(--color-input);
  border-color: var(--color-border);
}

input::placeholder,
textarea::placeholder {
  color: #777b84;
  opacity: 1;
}

.portal-credentials {
  grid-template-columns: repeat(2, minmax(0, 230px));
  gap: 12px;
}

.credential-box {
  min-width: 0;
  padding: 14px;
  border-radius: 14px;
}

.credential-box .muted {
  font-size: 0.82rem;
}

.credential-value {
  min-width: 0;
  margin: 4px 0 10px;
  font-size: clamp(1.35rem, 4vw, 2.25rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.credential-value.is-unavailable {
  font-size: clamp(0.82rem, 2.3vw, 1.05rem);
  letter-spacing: 0;
}

.credential-box .button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.credential-box .notice {
  padding: 10px 11px;
  font-size: 0.82rem;
}

.response-card {
  padding: 16px;
}

.response-card > div {
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.response-card > div:first-of-type {
  padding-top: 0;
  border-top: 0;
}

#portal-message[hidden] {
  display: none;
}

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

@media (max-width: 430px) {
  .portal-credentials {
    grid-template-columns: 1fr;
  }
}


/* Compact primary actions requested for admin and registration pages. */
.fitted-action-button {
  width: fit-content;
  min-width: 0;
  padding-inline: 1.25rem;
  align-self: flex-start;
}

/* Site-wide compact, centered actions. */
.button,
.fitted-action-button,
.compact-button,
.home-view-button {
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  justify-self: center;
  align-self: center;
  margin-inline: auto;
  padding-inline: 1.25rem;
  text-align: center;
}

.row-wrap:has(.button) {
  justify-content: center;
}

.section-heading-row {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.button-sync {
  color: #ffffff;
  background: #162d73;
  box-shadow: 0 8px 20px rgba(22, 45, 115, 0.35);
}

.button-sync:hover {
  background: #1d3b91;
}

.button-danger {
  color: #ffdada;
  background: #451b24;
  border: 1px solid #74313e;
}

.button-danger:hover {
  background: #5b222e;
}

#tally-form-container,
#tally-form-container iframe {
  background: var(--color-background) !important;
  color-scheme: dark;
}

.received-message {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
}

#admin-message:empty {
  display: none;
}

@media (max-width: 600px) {
  .button,
  .fitted-action-button,
  .compact-button,
  .home-view-button {
    width: fit-content;
  }
}
