:root {
  color-scheme: dark light;
}

:root {
  --bg: #0b1020;
  --panel: #121832;
  --text: #e9ebf3;
  --muted: #a5adbc;
  --brand: #4db3ff;
  --line: #26315a;
  --accent: #7ee1d5;

  --bg-gradient: linear-gradient(180deg, #0b1020, #0a0f1f);

  /* NEW: default field background (dark mode) */
  --field-bg: #0b1020;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    /* Soft bluish background – not pure white */
    --bg: #f5f7fb;

    /* Panels/cards stay clean and white */
    --panel: #ffffff;

    /* Very dark navy-ish text instead of flat black */
    --text: #020617;

    /* Muted copy (helper text, labels) */
    --muted: #ffffff;

    /* Your primary brand color */
    --brand: #63b9f3;

    /* Subtle cool border/lines */
    --line: #e2e8f0;

    /* Accent for hovers / highlights (slightly punchier than brand) */
    --accent: #38bdf8;

    /* Light gradient with a hint of blue */
    --bg-gradient: linear-gradient(180deg, #f9fbff, #e4f1ff);

    --field-bg: #f9fafb; /* NEW */
  }
}

:root[data-theme="dark"] {
  --bg: #0b1020;
  --panel: #121832;
  --text: #e9ebf3;
  --muted: #a5adbc;
  --brand: #4db3ff;
  --line: #26315a;
  --accent: #7ee1d5;

  --bg-gradient: linear-gradient(180deg, #0b1020, #0a0f1f);

  /* NEW: default field background (dark mode) */
  --field-bg: #0b1020;
}

:root[data-theme="light"] {
  /* Soft bluish background – not pure white */
  --bg: #f5f7fb;

  /* Panels/cards stay clean and white */
  --panel: #ffffff;

  /* Very dark navy-ish text instead of flat black */
  --text: #020617;

  /* Muted copy (helper text, labels) */
  --muted: #6b7280;

  /* Your primary brand color */
  --brand: #63b9f3;

  /* Subtle cool border/lines */
  --line: #e2e8f0;

  /* Accent for hovers / highlights (slightly punchier than brand) */
  --accent: #38bdf8;

  /* Light gradient with a hint of blue */
  --bg-gradient: linear-gradient(180deg, #f9fbff, #e4f1ff);
  --field-bg: #f9fafb; /* NEW */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-gradient);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial,
    sans-serif;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--panel); /* <-- matches footer in light mode */
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.1;
}
.nav-link.active,
.nav-link:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(110, 168, 254, 0.15);
}
.nav-item {
  position: relative;
}
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 100%;
}
.nav-dropdown-toggle::after {
  content: "▾";
  font-size: 0.75rem;
  opacity: 0.8;
}
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  padding: 10px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
  z-index: 20;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
}
.nav-dropdown-menu .nav-link {
  display: block;
  width: 100%;
}
.nav-dropdown-menu .nav-link:not(.active) {
  border-color: transparent;
  background: transparent;
}
.nav-dropdown-menu .nav-link.active {
  background: var(--brand);
  color: #020617;
  box-shadow: 0 8px 24px rgba(99, 185, 243, 0.35);
}
.auth-cta {
  display: flex;
  gap: 10px;
  align-items: center;
}
.btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #020617;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: box-shadow 0.15s ease, transform 0.1s ease,
    background-color 0.15s ease;
}
.btn:hover {
  box-shadow: 0 12px 30px rgba(99, 185, 243, 0.35);
  transform: translateY(-1px);
}
.btn-ghost:hover {
  border-color: var(--band);
}
.button-row {
  display: flex;
  justify-content: flex-end; /* or space-between/center, if you prefer */
  gap: 0.75rem;
  margin-top: 1rem;
}

.button-row .btn {
  display: inline-flex; /* so we can center the text */
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
}

.container {
  max-width: 1100px;
  margin: 22px auto;
  padding: 0 16px;
}
.container.narrow {
  max-width: 560px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.thumb {
  height: 120px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: radial-gradient(
      ellipse at 30% 20%,
      rgba(110, 168, 254, 0.25),
      transparent 60%
    ),
    radial-gradient(
      ellipse at 70% 80%,
      rgba(126, 225, 213, 0.2),
      transparent 60%
    );
}
.mt {
  margin-top: 20px;
}
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 16px; /* breathing room between stacked reports */
  overflow: auto;
}
.table-wrap iframe {
  width: 100%;
  border: none;
  min-height: 70vh;
}
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #0d6efd;
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  font-weight: 600;
  font-size: 16px;
  min-width: 240px;
  max-width: 360px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}
.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
tr:last-child td {
  border-bottom: none;
}
.muted {
  color: var(--muted);
}
.empty {
  color: var(--muted);
  padding: 16px;
}
.form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 10px;
}
label {
  display: grid;
  gap: 6px;
}
/* input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1020;
  color: var(--text);
} */
input,
select,
textarea {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--field-bg); /* <-- uses theme var */
  color: var(--text);
  font: inherit;
}
input[type="color"] {
  padding: 0; /* color inputs don’t need text-style padding */
  background: transparent; /* or background: initial; */
  border-radius: 6px; /* optional: keep it a bit rounded */
  cursor: pointer;
  width: 100%; /* so it fills the grid cell nicely */
  height: 32px; /* tweak as you like */
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(99, 185, 243, 0.4);
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.error {
  color: #ff8a8a;
}
.g-recaptcha {
  margin: 0.5rem 0;
}
[data-recaptcha-error="true"] {
  margin: 0 0 0.35rem;
}
.logo {
  width: 5%;
  height: 5%;
  vertical-align: middle;
  margin-right: 6px;
}
.brand a {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.auth-cta .when-logged-in {
  display: none;
}
.auth-cta .when-logged-out {
  display: inline-flex;
  gap: 0.5rem;
}

body.auth-in .auth-cta .when-logged-in {
  display: inline-flex;
  gap: 0.5rem;
}
body.auth-in .auth-cta .when-logged-out {
  display: none;
}

[hidden] {
  display: none !important;
}

/* input,
select {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1020;
  color: var(--text);
  font: inherit;
} */
/* input,
select {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
} */

/* Enhanced select styling */
.select-control,
#projectFilter {
  appearance: none; /* remove native arrow */
  -moz-appearance: none;
  -webkit-appearance: none;
  background-color: var(--field-bg); /* <-- theme-aware off-white in light */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%A5ADBC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;

  padding-right: 36px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Hover matches your nav-link hover */
.select-control:hover,
#projectFilter:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(110, 168, 254, 0.15);
}

/* Focus ring consistent with site */
.select-control:focus,
#projectFilter:focus,
input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(110, 168, 254, 0.25);
}

/* Disabled state */
.select-control:disabled,
#projectFilter:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Options in dark mode (Firefox/desktop) */
#projectFilter option {
  color: white; /* option popup has light bg on many UAs */
}

/* Keep date inputs aligned nicely next to the select */
#startDate,
#endDate {
  min-width: 12ch;
}

/* --- Contact/Footer --- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  margin-top: 3rem;
}
.site-footer .container {
  padding: 2rem 1rem;
}
.footer-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}
@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns: 1.2fr 2fr;
  }
}
.footer-brand {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.logo.small {
  width: 48px;
  height: 48px;
}
.footer-title {
  margin: 0 0 0.25rem;
}

.contact-form {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
}
.contact-form h3 {
  margin: 0 0 0.75rem;
}
.contact-form .row {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
@media (min-width: 640px) {
  .contact-form .row {
    grid-template-columns: 1fr 1fr;
  }
}
.contact-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.95rem;
}
.contact-form input,
.contact-form textarea {
  background: var(--field-bg); /* <-- matches theme */
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  outline: none;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(77, 179, 255, 0.25);
}
.contact-form .full {
  display: grid;
  margin-bottom: 0.75rem;
}
.contact-form .consent {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 1rem;
}
.contact-form .btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-progress {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--text);
  border-top-color: transparent;
  display: none;
  animation: spin 1s linear infinite;
}
.btn.loading .btn-text {
  opacity: 0.6;
}
.btn.loading .btn-progress {
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.form-feedback {
  margin-top: 0.75rem;
  min-height: 1.25rem;
}
.footer-bottom {
  border-top: 1px solid var(--line);
  padding: 0.75rem 1rem;
  text-align: center;
  grid-column: 1 / -1;
  width: 100%;
}

/* Honeypot hidden */
.hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Layout rows */
.contact-form .labels-row,
.contact-form .inputs-row {
  display: grid;
  gap: 0.75rem;
  margin: 0.5rem 0;
}

/* Column helpers */
.contact-form .two-col {
  grid-template-columns: 1fr 1fr;
}
.contact-form .one-col {
  grid-template-columns: 1fr;
}

/* Label + inputs look/feel */
.contact-form label {
  font-size: 0.95rem;
  color: var(--muted);
}
.contact-form input,
.contact-form textarea {
  width: 100%;
}

/* Full-width button */
.btn.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* Mobile: stack columns */
@media (max-width: 640px) {
  .contact-form .two-col {
    grid-template-columns: 1fr;
  }
}

/* Tab bar wrapper */
.tab {
  display: inline-flex;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--panel);
  border-radius: 999px;
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}

/* Tab buttons */
.tab button {
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.1s ease;
}

/* Hover */
.tab button:hover {
  color: var(--text);
  background: rgba(99, 185, 243, 0.08); /* subtle brand-tinted hover */
}

/* Active/current tab */
.tab button.active {
  background: var(--brand);
  color: #020617; /* works for both themes as foreground over brand */
  box-shadow: 0 8px 24px rgba(99, 185, 243, 0.35);
  transform: translateY(-1px);
}

/* Tab content panel */
.tabcontent {
  display: none;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
}

/* Base snackbar appearance (both save + cancel) */
.snackbar {
  position: fixed;
  left: 50%;
  bottom: 24px;

  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  visibility: hidden;

  max-width: 420px;
  width: calc(100% - 32px);
  padding: 0.75rem 1rem;

  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;

  font-size: 0.95rem;
  z-index: 1000;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.65);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  pointer-events: none;
}

/* Light theme tweak */
:root[data-theme="light"] .snackbar {
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.4);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

/* Show state */
.snackbar.show {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);

  animation: snackbar-in 0.25s ease-out, snackbar-out 0.3s ease-in 2.8s;
}

/* Shared keyframes */
@keyframes snackbar-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes snackbar-out {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
}

/* Pill label */
.snackbar .pill {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(99, 185, 243, 0.12);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Two-column layout for labels + inputs inside userPreferences */
.labels-row.two-col,
.inputs-row.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1rem;
  row-gap: 0.5rem;
}

/* Make labels and selects fill their grid cell nicely */
label {
  display: block;
}

.select-control {
  width: 100%;
}

.theme-section {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.theme-section .section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.theme-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.theme-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.theme-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.theme-card-header h4 {
  margin: 0;
  font-size: 0.98rem;
}

.theme-card-header .muted {
  margin: 0;
  font-size: 0.8rem;
}

.theme-chip {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Theme preview block */
.theme-preview {
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  padding: 0.6rem;
  display: grid;
  gap: 0.5rem;

  /* local preview vars (overridden via JS) */
  --preview-bg: #f5f7fb;
  --preview-panel: #ffffff;
  --preview-text: #020617;
  --preview-muted: #6b7280;
  --preview-brand: #63b9f3;
  --preview-line: #e2e8f0;

  background: var(--preview-bg);
}

.theme-preview-header {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--preview-muted),
    var(--preview-panel)
  );
  opacity: 0.9;
}

.theme-preview-body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.theme-preview-panel {
  flex: 1;
  max-width: 260px;
  border-radius: 0.75rem;
  background: var(--preview-panel);
  border: 1px solid var(--preview-line);
  padding: 0.6rem 0.75rem;
  display: grid;
  gap: 0.4rem;
}

.theme-preview-line {
  height: 6px;
  border-radius: 999px;
  background: var(--preview-line);
}

.theme-preview-line.short {
  width: 60%;
}

.theme-preview-btn {
  margin-top: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--preview-brand);
  background: var(--preview-brand);
  color: #020617;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  justify-self: flex-start;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  margin-right: 0.5rem;
  font-size: 1.1rem;
  text-decoration: none;
  color: #fff;
}
.icon-btn img {
  width: 1.15rem;
  height: 1.15rem;
}
