:root {
  color-scheme: light;
  --bg: #e9f1fa;
  --bg-accent: #ffffff;
  --panel: rgba(255, 255, 255, 0.9);
  --text: #10324b;
  --muted: #4c6a82;
  --border: rgba(0, 171, 228, 0.18);
  --brand: #00abe4;
  --brand-dark: #007fa9;
  --shadow: 0 24px 60px rgba(0, 88, 130, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.95), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--bg-accent));
}

.page-shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero {
  max-width: 980px;
  margin-bottom: 2rem;
}

.hero-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1.5rem;
  flex-wrap: nowrap;
}

.hero--compact {
  max-width: 100%;
}

.eyebrow {
  margin: 2.35rem 0 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-dark);
  font-size: 0.8rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  line-height: 1.08;
  white-space: normal;
}

.hero-logo {
  display: block;
  width: min(100%, 240px);
  height: auto;
  margin: 0;
}

.hero-logo-link {
  display: inline-block;
}

.site-links {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: nowrap;
  margin-left: 0;
  padding-top: 0.35rem;
}

.site-links a {
  color: var(--brand-dark);
  text-decoration: none;
  font-family: "Trebuchet MS", sans-serif;
  font-size: 0.95rem;
  white-space: nowrap;
}

.site-links a:hover {
  text-decoration: underline;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 0.8rem;
  border: 1px solid rgba(0, 127, 169, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-dark);
  box-shadow: 0 10px 30px rgba(0, 88, 130, 0.08);
}

.nav-toggle span {
  display: block;
  width: 1.2rem;
  height: 2px;
  margin: 0.18rem 0;
  border-radius: 999px;
  background: currentColor;
  transition: transform 160ms ease, opacity 160ms ease;
}

.intro {

  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  gap: 1.5rem;
}

.auth-panel,
.session-panel {
  display: grid;
  gap: 1.25rem;
  align-items: center;
}

.login-form,
.record-form {
  display: grid;
  gap: 1rem;
}

.form-stepper {
  display: grid;
  gap: 0.3rem;
}

.form-stepper__badge {
  width: fit-content;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(0, 171, 228, 0.12);
  color: var(--brand);
  font-size: 0.84rem;
  font-weight: 700;
}

.form-stepper__title {
  font-family: "Trebuchet MS", sans-serif;
  font-size: 1.1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.form-step {
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

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

.form-grid__wide {
  grid-column: 1 / -1;
}

.login-form {
  max-width: 420px;
}

.auth-copy h2,
.session-panel h2 {
  margin: 0;
}

.record-form label {
  display: grid;
  gap: 0.5rem;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.field-link {
  font-size: 0.84rem;
  font-weight: 600;
  color: #f28c28;
  text-decoration: none;
  white-space: nowrap;
}

.field-link:hover {
  text-decoration: underline;
}

.login-form label {
  display: grid;
  gap: 0.5rem;
}

.record-form span,
.login-form span,
.records-header h2,
.record-card h3 {
  font-family: "Trebuchet MS", sans-serif;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.85);
}

button {
  width: fit-content;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  background: var(--brand);
  color: #fffaf0;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.button-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font: inherit;
}

.danger-button {
  background: transparent;
  color: #c0392b;
  border: 1px solid rgba(192, 57, 43, 0.25);
  font-family: "Trebuchet MS", sans-serif;
}

.danger-button:hover {
  background: rgba(192, 57, 43, 0.08);
}

.hero-action-link {
  border: 1px solid rgba(0, 171, 228, 0.24);
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.9);
}

.hero-action-link:hover {
  background: rgba(0, 171, 228, 0.08);
}

.button-link {
  width: fit-content;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  background: var(--brand);
  color: #ffffff;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--brand-dark);
}

.button-link:hover {
  transform: translateY(-1px);
  background: var(--brand-dark);
}

.secondary-button {
  background: transparent;
  color: var(--brand-dark);
  border: 1px solid var(--border);
}

.secondary-link {
  color: var(--brand-dark);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  background: transparent;
}

.session-label,
.session-meta p {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.session-meta code,
.record-user-id {
  color: var(--brand-dark);
}

.records-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.action-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.records {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}

.record-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(98, 88, 74, 0.12);
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.record-summary-card:hover {
  transform: translateX(2px);
  box-shadow: 0 12px 24px rgba(88, 54, 28, 0.1);
}

.record-summary-card h3 {
  margin: 0.25rem 0 0;
}

.record-summary-card__eyebrow {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.record-card {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(98, 88, 74, 0.12);
}

.record-card__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.record-card__meta h3 {
  margin: 0;
}

.record-card__meta span,
.record-user-id,
.record-email,
.record-location,
.record-notes,
.form-message,
.empty-state {
  color: var(--muted);
}

.record-user-id {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  word-break: break-all;
}

.record-location {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
}

.record-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  min-width: 0;
}

.record-metrics > .table-scroll {
  grid-column: 1 / -1;
}

.report-detail {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.report-total {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.report-total span {
  color: var(--muted);
  font-family: "Trebuchet MS", sans-serif;
}

.report-total strong {
  font-size: 1.1rem;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.market-card {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
}

.market-card h4 {
  margin: 0 0 0.75rem;
  font-family: "Trebuchet MS", sans-serif;
  font-size: 1rem;
}

.market-card .record-location {
  margin: 0.25rem 0;
}

.about-content {
  max-width: 860px;
}

.about-content--wide {
  max-width: none;
}

.about-content h2 {
  margin: 1.5rem 0 0.75rem;
  font-family: "Trebuchet MS", sans-serif;
  font-size: 1.2rem;
}

.about-content p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.75;
}

.about-list {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
  color: var(--muted);
}

.about-list li {
  margin: 0 0 0.55rem;
}

.about-highlight {
  color: var(--text) !important;
  font-family: "Trebuchet MS", sans-serif;
  font-size: 1.15rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.site-footer__disclaimer {
  margin-top: 1.25rem !important;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.site-footer__meta {
  margin-top: 0.9rem !important;
  font-size: 0.84rem;
}

.explain-grid,
.faq-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.explain-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.explain-card,
.faq-item {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
}

.explain-card h3,
.faq-item h3 {
  margin: 0 0 0.6rem;
  font-family: "Trebuchet MS", sans-serif;
  font-size: 1rem;
}

.explain-card p,
.faq-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.detail-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.detail-table th,
.detail-table td {
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.detail-table thead th {
  font-family: "Trebuchet MS", sans-serif;
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.55);
  position: sticky;
  top: 0;
  z-index: 2;
}

.detail-table__header-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-table__header-link:hover {
  text-decoration: underline;
}

.detail-table tbody th {
  min-width: 220px;
  color: var(--text);
  font-family: "Trebuchet MS", sans-serif;
}

.report-detail .detail-table thead th:first-child,
.report-detail .detail-table tbody th {
  position: sticky;
  left: 0;
  background: rgba(255, 255, 255, 0.96);
}

.report-detail .detail-table thead th:first-child {
  z-index: 4;
}

.report-detail .detail-table tbody th {
  z-index: 1;
}

.detail-table__section th {
  padding-top: 1.25rem;
  color: var(--brand-dark);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(181, 209, 231, 0.45);
}

.detail-value--negative {
  color: #c0392b;
  font-weight: 700;
}

.detail-value--positive {
  color: #1f8f4e;
  font-weight: 700;
}

.detail-input {
  width: 100%;
  min-width: 92px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.92);
}

.detail-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.detail-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.detail-save-button {
  padding: 0.55rem 1rem;
  white-space: nowrap;
}

.detail-inline-message {
  margin: 0;
  min-height: 1.2rem;
}

.record-metric {
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.record-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.record-metric strong {
  font-family: "Trebuchet MS", sans-serif;
  font-size: 1rem;
}

.back-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--brand-dark);
  text-decoration: none;
  font-family: "Trebuchet MS", sans-serif;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem;
  flex-wrap: wrap;
  width: 100%;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chart-shell {
  overflow-x: auto;
}

.chart-note {
  margin: 0 0 1rem;
  color: var(--muted);
}

.chart-svg {
  width: 100%;
  min-width: 0;
  height: auto;
  display: block;
}

.chart-axis {
  stroke: rgba(98, 88, 74, 0.55);
  stroke-width: 1.25;
}

.chart-grid-line {
  stroke: rgba(98, 88, 74, 0.15);
  stroke-width: 1;
}

.chart-zero-line {
  stroke: rgba(192, 57, 43, 0.45);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.chart-zero-label {
  fill: rgba(192, 57, 43, 0.9);
  font-size: 12px;
  font-family: "Trebuchet MS", sans-serif;
}

.chart-line {
  fill: none;
  stroke: var(--chart-color);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line--guide {
  stroke-width: 2;
  stroke-dasharray: 7 5;
  opacity: 0.9;
}

.chart-point {
  fill: var(--chart-color);
  stroke: rgba(255, 250, 240, 0.95);
  stroke-width: 2;
}

.chart-point--guide {
  stroke-width: 1.5;
}

.chart-point-label {
  fill: var(--chart-color);
  font-size: 12px;
  font-family: "Trebuchet MS", sans-serif;
  paint-order: stroke;
  stroke: rgba(255, 250, 240, 0.96);
  stroke-width: 4;
  stroke-linejoin: round;
}

.chart-point-label--guide {
  font-size: 11px;
  opacity: 0.95;
}

.chart-svg text {
  fill: var(--muted);
  font-size: 13px;
}

.chart-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
}

.chart-card--wide {
  grid-column: 1 / -1;
}

.chart-card__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.chart-card__header h3 {
  margin: 0;
  font-family: "Trebuchet MS", sans-serif;
  font-size: 1rem;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

.chart-legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--chart-color);
}

.chart-legend__swatch--guide {
  border: 2px dashed var(--chart-color);
  background: transparent;
}

.empty-state {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 1rem, 1100px);
    padding-top: 1.5rem;
  }

  .panel {
    padding: 1rem;
  }

  .hero-topbar {
    position: relative;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.85rem;
    padding-right: 5.5rem;
  }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    right: 0;
    margin-top: 0;
  }

  .site-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 0.35rem 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
  }

  .hero-topbar--menu-open .site-links {
    display: flex;
  }

  .site-links a {
    padding: 0.85rem 1rem;
  }

  .report-detail .detail-table thead th:first-child,
  .report-detail .detail-table tbody th {
    position: static;
    left: auto;
  }

  .report-detail .detail-table {
    min-width: 520px;
    font-size: 0.88rem;
  }

  .report-detail .detail-table th,
  .report-detail .detail-table td {
    padding: 0.7rem 0.45rem;
  }

  .report-detail .detail-table tbody th {
    min-width: 110px;
    max-width: 110px;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .report-detail .detail-table thead th {
    font-size: 0.8rem;
  }

  .report-detail .detail-input {
    min-width: 64px;
    padding: 0.45rem 0.45rem;
  }

  .hero-actions {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .hero-actions .secondary-link,
  .hero-actions .danger-button {
    flex: 1 1 0;
    min-width: 0;
  }

  .hero-topbar--menu-open .nav-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .hero-topbar--menu-open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }

  .hero-topbar--menu-open .nav-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .hero h1 {
    white-space: normal;
  }

  .form-grid,
  .explain-grid,
  .faq-list,
  .record-metrics,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .session-panel,
  .detail-header,
  .records-header,
  .record-card__meta {
    flex-direction: column;
    align-items: flex-start;
  }
}
