:root {
  --bg: #fff3f8;
  --bg-soft: #fff8fb;
  --paper: rgba(255, 248, 251, 0.84);
  --ink: #2d1823;
  --ink-soft: #6f5562;
  --line: rgba(92, 39, 64, 0.10);
  --line-strong: rgba(92, 39, 64, 0.18);
  --accent: #e05b9b;
  --accent-dark: #b83f78;
  --success: #1b8758;
  --danger: #b23d62;
  --warning: #b17719;
  --muted: #7c6270;
  --shadow: 0 24px 60px rgba(104, 43, 72, 0.10);
  --radius-xl: 32px;
  --radius-lg: 24px;
}

html,
body {
  min-height: 100vh;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(224, 91, 155, 0.16), transparent 28%),
    radial-gradient(circle at 90% 15%, rgba(244, 168, 205, 0.18), transparent 24%),
    linear-gradient(180deg, #fff7fb 0%, #fff0f6 50%, #fde8f1 100%);
}

.app-shell {
  position: relative;
  overflow: hidden;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: fixed;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}

.app-shell::before {
  top: -8rem;
  right: -8rem;
  background: rgba(224, 91, 155, 0.22);
}

.app-shell::after {
  bottom: -10rem;
  left: -8rem;
  background: rgba(245, 153, 194, 0.22);
}

.site-header,
.page-content {
  position: relative;
  z-index: 1;
}

.site-header {
  padding: 2.1rem 0 1.2rem;
}

.page-content {
  padding-bottom: 5rem;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  height: 58px;
  object-fit: contain;
}

.brand-payoff {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.logout-form {
  margin: 0;
}

.logout-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.88);
}

.hero-block,
.results-hero {
  margin-bottom: 2rem;
}

.hero-block {
  min-height: calc(100vh - 165px);
  display: flex;
  align-items: center;
}

.hero-block > .row {
  width: 100%;
}

.hero-copy {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 2rem 2rem 0;
}

.eyebrow,
.panel-topline,
.story-kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.display-title {
  margin: 0 0 1.2rem;
  font-family: "DM Serif Display", serif;
  font-size: clamp(3.2rem, 7vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  max-width: 11ch;
}

.display-title-sm {
  max-width: none;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
}

.hero-lead {
  max-width: 34rem;
  font-size: clamp(1.08rem, 1.7vw, 1.28rem);
  line-height: 1.55;
  color: var(--ink-soft);
}

.hero-lead-sm {
  max-width: 64ch;
}

.hero-notes {
  display: grid;
  gap: 0.9rem;
  margin-top: 2rem;
}

.hero-note {
  display: grid;
  gap: 0.15rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.hero-note strong {
  font-size: 1rem;
}

.hero-note span {
  color: var(--ink-soft);
}

.upload-panel,
.data-panel,
.filter-panel {
  background: var(--paper);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: clamp(1.5rem, 3vw, 2.4rem);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.panel-title {
  margin: 0.65rem 0 0.45rem;
  font-family: "DM Serif Display", serif;
  font-size: clamp(2.15rem, 4.4vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.panel-subtitle {
  margin: 0 0 1.8rem;
  color: var(--ink-soft);
  font-size: 1rem;
}

.app-label {
  margin-bottom: 0.55rem;
  font-weight: 700;
  color: var(--ink);
}

.app-input {
  min-height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
}

.app-input:focus {
  border-color: rgba(224, 91, 155, 0.65);
  box-shadow: 0 0 0 0.25rem rgba(224, 91, 155, 0.12);
}

.field-help {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.field-error {
  margin-top: 0.45rem;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 700;
}

.auth-hero {
  min-height: calc(100vh - 180px);
}

.auth-panel {
  min-height: auto;
}

.btn-app-primary,
.btn-app-secondary {
  min-height: 56px;
  border-radius: 999px;
  padding: 0.95rem 1.4rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.btn-app-primary {
  position: relative;
  color: #fff;
  border: none;
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
  box-shadow: 0 16px 30px rgba(224, 91, 155, 0.24);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn-app-primary:hover,
.btn-app-primary:focus {
  color: #fff;
  background: linear-gradient(135deg, #a9386e 0%, #d64d91 100%);
  box-shadow: 0 20px 36px rgba(224, 91, 155, 0.30);
  transform: translateY(-1px);
}

.btn-app-primary:disabled {
  opacity: 0.78;
  transform: none;
}

.submit-loading {
  display: none;
}

.submit-button.is-loading .submit-label {
  display: none;
}

.submit-button.is-loading .submit-loading {
  display: inline;
}

.btn-app-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line-strong);
}

.btn-app-secondary:hover,
.btn-app-secondary:focus {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.metrics-grid {
  display: grid;
  gap: 1rem;
}
.metric-panel,
.upload-panel,
.data-panel,
.filter-panel {
  border-color: rgba(255, 255, 255, 0.68);
}

.metric-panel {
  padding: 1.6rem;
  background: rgba(255, 248, 251, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.results-title-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  padding-left: 12rem;
}

.results-title-wrap .display-title {
  margin-bottom: 0;
  text-align: center;
}

.results-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.metrics-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 1.5rem;
}

.metric-panel {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-panel span {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.metric-panel strong {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric-panel-success strong {
  color: var(--success);
}

.metric-panel-danger strong {
  color: var(--danger);
}

.metric-panel-warning strong {
  color: var(--warning);
}

.metric-panel-muted strong {
  color: var(--muted);
}

.panel-header,
.panel-body {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1rem;
}

.panel-body {
  padding-bottom: 1.5rem;
}

.panel-section-title {
  font-size: clamp(1.45rem, 2.2vw, 1.8rem);
  font-weight: 800;
  line-height: 1.2;
}

.table-title-wrap {
  flex: 1;
  text-align: center;
  padding-left: 48px;
}

.table-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  padding: 0 0.9rem;
  border-radius: 999px;
  font-weight: 800;
}

.table-badge-success {
  background: rgba(27, 135, 88, 0.10);
  color: var(--success);
}

.table-badge-danger {
  background: rgba(178, 61, 98, 0.10);
  color: var(--danger);
}

.table-badge-warning {
  background: rgba(154, 106, 18, 0.12);
  color: var(--warning);
}

.table-badge-secondary {
  background: rgba(103, 91, 79, 0.12);
  color: var(--muted);
}

/*
 * Allow tables to scroll horizontally when they contain many columns.  The
 * previous implementation hid overflow which prevented users from seeing
 * additional data.  We now enable horizontal scrolling and preserve
 * vertical borders.  When used alongside Bootstrap's ``table-responsive``
 * class this provides a consistent scroll experience on both desktop and
 * mobile devices.
 */
.app-table-wrap {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(255, 255, 255, 0.62);
  /* prevent cell contents from wrapping onto multiple lines to keep the row
     height manageable and the horizontal scroll bar functional */
  white-space: nowrap;
}

.app-table {
  margin: 0;
}

.app-table thead th {
  padding: 1rem;
  border: none;
  background: rgba(252, 232, 241, 0.95);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-table tbody td {
  padding: 1rem;
  border-color: rgba(48, 35, 20, 0.08);
  color: var(--ink);
  font-size: 0.95rem;
  white-space: nowrap;
}

.app-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.72);
}

.empty-state {
  color: var(--ink-soft);
}

.app-alert {
  border: none;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

table tbody tr.hidden-row {
  display: none;
}

.hidden-panel {
  display: none;
}

.result-tabs {
  justify-content: center;
  gap: 0.75rem;
}

.result-tabs .nav-link {
  border: 1px solid rgba(68, 35, 54, 0.14);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 800;
  padding: 0.9rem 1.45rem;
}

.result-tabs .nav-link.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 16px 36px rgba(194, 61, 128, 0.22);
}

code {
  color: var(--accent-dark);
}

@media (max-width: 1199.98px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .hero-block {
    min-height: auto;
    align-items: stretch;
  }

  .hero-copy {
    padding: 1.5rem 0 0.5rem;
  }

  .display-title {
    max-width: 100%;
  }

  .results-head {
    flex-direction: column;
    align-items: center;
  }

  .results-title-wrap {
    padding-left: 0;
  }
}

@media (max-width: 767.98px) {
  .site-header {
    padding-top: 1.2rem;
    padding-bottom: 0.5rem;
  }

  .brand-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
  }

  .header-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.6rem;
  }

  .brand-logo {
    height: 48px;
  }

  .brand-payoff {
    font-size: 0.72rem;
  }

  .upload-panel,
  .metric-panel {
    padding: 1.25rem;
  }

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

  .panel-header,
  .panel-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .panel-header {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 575.98px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .results-actions {
    width: 100%;
  }

  .results-actions .btn {
    width: 100%;
  }
}
