:root {
  --ink: #17212b;
  --muted: #68727d;
  --line: #dde3ea;
  --panel: #ffffff;
  --bg: #f6f8fb;
  --navy: #18344f;
  --teal: #0f766e;
  --gold: #b7791f;
  --red: #b42318;
  --green: #28724a;
  --shadow: 0 20px 50px rgba(24, 52, 79, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(24, 52, 79, 0.08), transparent 320px),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

.app-shell {
  position: relative;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 88px 28px 28px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 18px 0 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.intro {
  max-width: 740px;
  margin: 16px 0 0;
  color: #40505f;
  font-size: 1.03rem;
  line-height: 1.65;
}

.site-nav {
  position: absolute;
  top: 28px;
  right: 28px;
  z-index: 5;
}

.nav-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.nav-toggle-label {
  display: none;
  place-items: center;
  width: 54px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  background: rgba(24, 52, 79, 0.95);
  cursor: pointer;
}

.nav-toggle-label span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
}

.nav-toggle-label span + span {
  margin-top: 6px;
}

.nav-menu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 8px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(31, 69, 126, 0.94), rgba(27, 82, 158, 0.94)),
    var(--navy);
  box-shadow: 0 16px 38px rgba(24, 52, 79, 0.18);
}

.nav-menu a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 4px;
  padding: 0 14px;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.nav-menu a[href="membership.html"],
.nav-menu a[href="login.html"],
.nav-menu a[href="signup.html"] {
  display: none;
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  background: rgba(255, 255, 255, 0.13);
  outline: 0;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  color: #fff;
  background: var(--navy);
}

.secondary {
  color: var(--navy);
  background: #fff;
  border-color: var(--line);
}

.danger {
  color: #fff;
  background: var(--red);
}

.text-link {
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.account-strip {
  margin: -8px 0 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  color: #40505f;
  background: #fff;
  box-shadow: 0 10px 28px rgba(24, 52, 79, 0.08);
  line-height: 1.45;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 36px auto 0;
  padding: 24px 0 4px;
  color: var(--muted);
  text-align: center;
}

.site-footer a {
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration: underline;
}

.content-page {
  display: grid;
  justify-content: center;
}

.content-page .tool-panel {
  width: min(820px, 100%);
}

.legal-copy {
  line-height: 1.7;
}

.legal-copy h3 {
  margin: 18px 0 6px;
  color: var(--navy);
  font-size: 1rem;
}

.legal-copy p {
  margin: 0 0 12px;
  color: #40505f;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.upload-panel,
.dashboard {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.upload-panel {
  border-radius: 8px;
  padding: 18px;
  position: sticky;
  top: 18px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  border: 2px dashed #a8b7c6;
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: #fbfcfe;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--teal);
  background: #eefaf8;
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-zone strong {
  color: var(--ink);
  margin-top: 12px;
  font-size: 1.05rem;
}

.drop-zone small {
  display: block;
  margin-top: 8px;
  line-height: 1.4;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  font-weight: 900;
}

.field-help {
  padding: 18px 2px 10px;
}

.upload-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.upload-actions button {
  width: 100%;
}

.field-help h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.field-help p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.helper-copy {
  margin-top: 8px !important;
  font-size: 0.92rem;
}

.column-mapping {
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.column-mapping summary {
  color: var(--navy);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
}

.mapping-fields {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

code {
  color: var(--navy);
  background: #edf2f7;
  border-radius: 4px;
  padding: 2px 5px;
}

.status-card {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard {
  border-radius: 8px;
  overflow: hidden;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.metrics article {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.metrics article:last-child {
  border-right: 0;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
}

.controls {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr 1fr;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: #4b5966;
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bfccd8;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
}

.allocation-layout {
  display: grid;
  gap: 22px;
}

.guide-layout {
  display: grid;
  gap: 22px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.guide-table table {
  min-width: 640px;
}

.membership-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}

.pricing-hero {
  display: grid;
  place-items: center;
  padding: 34px 0 56px;
  text-align: center;
}

.pricing-hero h1 {
  font-size: 2rem;
  line-height: 1.1;
}

.pricing-hero .intro {
  max-width: 640px;
  margin: 18px auto 0;
}

.pricing-hero .site-nav {
  justify-content: center;
}

.pricing-accent {
  display: block;
  width: 44px;
  height: 4px;
  margin: 56px auto 0;
  background: #e3314b;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 360px));
  justify-content: center;
  gap: 18px;
}

.pricing-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(24, 52, 79, 0.12);
}

.pricing-card header {
  padding: 16px 18px;
  background: #f5f5f5;
  text-align: center;
}

.pricing-card h2 {
  margin: 0;
  color: #0b2545;
  font-size: 1.32rem;
  font-weight: 400;
}

.pricing-card h2 strong {
  font-weight: 900;
}

.pricing-body {
  display: grid;
  align-content: start;
  gap: 26px;
  padding: 26px 48px 24px;
}

.price-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  color: #08264a;
}

.price-line strong {
  font-size: 3rem;
  line-height: 1;
}

.price-line span:first-child {
  font-size: 0.95rem;
}

.price-line span:last-child {
  font-size: 1rem;
}

.feature-list {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #0f2235;
  font-size: 0.92rem;
}

.feature-list li {
  position: relative;
  padding-left: 28px;
  line-height: 1.35;
}

.feature-list li::before {
  content: "";
  position: absolute;
  top: 0.35em;
  left: 0;
  width: 12px;
  height: 7px;
  border-bottom: 2px solid #e3314b;
  border-left: 2px solid #e3314b;
  transform: rotate(-45deg);
}

.pricing-button {
  justify-self: center;
  min-height: 38px;
  margin-top: 8px;
  border-radius: 2px;
  padding: 0 20px;
  background: #3f61c8;
}

.featured-plan {
  border-color: #cbd6f4;
}

.compact-grid {
  grid-template-columns: minmax(320px, 520px);
}

.auth-page-grid {
  display: grid;
  grid-template-columns: minmax(320px, 520px);
  justify-content: center;
  gap: 22px;
  align-items: start;
}

.auth-page-grid + .messages {
  width: min(520px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.account-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.account-actions[hidden] {
  display: none;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}

.auth-form {
  align-content: start;
}

.membership-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: #40505f;
  background: #fbfcfe;
  line-height: 1.45;
}

.membership-status strong,
.membership-status span,
.membership-status small {
  display: block;
}

.membership-status span,
.membership-status small {
  margin-top: 6px;
  color: var(--muted);
}

.turnstile-box {
  min-height: 65px;
}

.muted-box {
  display: grid;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #fbfcfe;
  line-height: 1.45;
}

.tier-list {
  display: grid;
  gap: 10px;
}

.tier-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.tier-list strong,
.tier-list span {
  display: block;
}

.tier-list span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.panel-body p {
  margin: 0;
  color: #40505f;
  line-height: 1.6;
}

.allocation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.tool-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.danger-panel {
  border-color: #f7b4a6;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.08rem;
}

.panel-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-actions select {
  width: 160px;
}

.panel-actions input {
  width: 190px;
}

.saved-status {
  margin: 0;
  padding: 12px 18px;
}

.panel-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.order-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-table {
  min-width: 620px;
}

.order-table th,
.order-table td {
  padding: 10px;
}

.order-table input {
  min-height: 38px;
}

.allocation-edit {
  min-width: 110px;
  min-height: 36px;
}

.icon-button {
  width: 46px;
  min-width: 46px;
  padding: 0;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.summary-strip article {
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.summary-strip article:last-child {
  border-right: 0;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.summary-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 1.5rem;
}

input:disabled,
select:disabled {
  color: #8a96a3;
  background: #f0f3f7;
}

.messages {
  display: grid;
  gap: 10px;
  padding: 14px 18px 0;
}

.message {
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.45;
  font-size: 0.94rem;
}

.message.error {
  color: #7a271a;
  background: #fff1ed;
  border: 1px solid #f7b4a6;
}

.message.warning {
  color: #7a4f01;
  background: #fffaeb;
  border: 1px solid #f6d78a;
}

.message.success {
  color: #175c40;
  background: #ecfdf3;
  border: 1px solid #a6e9c3;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 340px);
  min-height: 360px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.allocation-table table {
  min-width: 1120px;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #344252;
  background: #eef3f8;
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f7fafc;
}

.empty-row td {
  height: 240px;
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.pill.expired {
  color: #fff;
  background: var(--red);
}

.pill.expiring {
  color: #4d3300;
  background: #f6c453;
}

.pill.valid {
  color: #fff;
  background: var(--green);
}

.pill.noExpiry {
  color: var(--navy);
  background: #dbeafe;
}

.fifo-rank {
  color: var(--teal);
  font-weight: 900;
}

@media (max-width: 1180px) {
  .app-shell {
    padding: 20px;
  }

  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero {
    display: grid;
    justify-content: start;
    justify-items: start;
  }

  .hero {
    align-items: start;
  }

  .site-nav {
    display: grid;
    position: static;
    align-self: start;
    order: -1;
    width: 100%;
    margin-bottom: 20px;
    justify-content: end;
    justify-items: end;
    text-align: left;
  }

  .nav-toggle-label {
    display: inline-grid;
  }

  .nav-menu {
    display: none;
    width: min(100%, 320px);
    margin-top: 6px;
    margin-left: auto;
    padding: 10px;
    border-radius: 4px;
  }

  .nav-toggle:checked ~ .nav-menu {
    display: grid;
  }

  .nav-menu a {
    min-height: 40px;
    justify-content: flex-start;
  }

  .pricing-hero {
    place-items: start;
    text-align: left;
  }

  .pricing-hero .intro {
    margin-left: 0;
    margin-right: 0;
  }

  .pricing-hero .site-nav {
    justify-content: end;
  }

  .pricing-accent {
    margin-left: 0;
    margin-right: 0;
  }

  .upload-panel {
    position: static;
  }

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

  .allocation-grid {
    grid-template-columns: 1fr;
  }

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

  .membership-grid {
    grid-template-columns: 1fr;
  }

  .pricing-grid {
    grid-template-columns: minmax(280px, 420px);
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 14px;
  }

  .metrics,
  .controls,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .pricing-body {
    padding: 24px 28px;
  }

  .metrics article {
    border-right: 0;
  }

  .table-wrap {
    max-height: none;
  }
}
