/* Levels / login / form pages — must scroll when content is tall */

html.levels-page,
body.levels-page,
html:has(body.levels-page),
html:has(body.app-shell),
body.app-shell {
  height: auto !important;
  max-height: none !important;
  min-height: 100%;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

body.levels-page,
body.app-shell {
  color: #c8d8ff;
  background: #05070f;
}

.levels-shell {
  position: relative;
  z-index: 1;
  width: min(1100px, 94vw);
  margin: 0 auto;
  padding: 2rem 0 4rem;
  min-height: auto;
  overflow: visible;
}

/* Levels page inside app shell */
.app-main .levels-header-inline {
  text-align: left;
  margin-bottom: 1.25rem;
}

.app-main .levels-header-inline .levels-title {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e8f0ff;
  text-shadow: none;
}

.app-main .levels-header-inline .levels-sub {
  margin-top: 0.35rem;
}

.app-main .levels-tabs {
  justify-content: flex-start;
  margin-top: 1rem;
}



.levels-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.levels-home {
  display: inline-block;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  text-decoration: none;
  color: #9aafd8;
  margin-bottom: 0.75rem;
}

.levels-home:hover {
  color: #fff;
}

.levels-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e8f0ff;
  text-shadow: 0 0 24px rgba(140, 170, 255, 0.35);
}

.levels-sub {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: #7f93b8;
  font-family: system-ui, sans-serif;
}

.levels-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.levels-tabs .tab {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: #a8bce0;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(140, 170, 255, 0.2);
  border-radius: 999px;
  background: rgba(8, 12, 28, 0.55);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.levels-user-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.text-btn {
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #9aafd8;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-btn:hover {
  color: #fff;
}

/* Center login card in the viewport */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

body.login-page .login-shell {
  width: min(420px, 100%);
  max-width: 420px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

body.login-page .levels-header {
  text-align: center;
  margin-bottom: 1rem;
}

.login-form {
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.35rem 1.3rem 1.4rem;
  border-radius: 14px;
  border: 1px solid rgba(140, 170, 255, 0.18);
  background: rgba(4, 8, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: system-ui, sans-serif;
  text-align: left;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.login-form .primary-btn {
  margin-top: 0.35rem;
  width: 100%;
}


/* ── Dashboard ─────────────────────────────────────────── */

.dashboard-shell {
  max-width: 720px;
}

.dashboard-nav {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.dash-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(140, 170, 255, 0.22);
  background: rgba(4, 8, 20, 0.72);
  backdrop-filter: blur(10px);
  text-decoration: none;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.dash-card:hover {
  border-color: rgba(180, 210, 255, 0.55);
  background: rgba(20, 32, 60, 0.75);
  box-shadow: 0 0 24px rgba(80, 120, 220, 0.2);
}

.dash-card-title {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e8f0ff;
}

.dash-card-desc {
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: #8aa0c8;
}

.dashboard-actions {
  margin-top: 1.75rem;
  display: flex;
  justify-content: center;
}

.logout-btn {
  min-width: 10rem;
}


.levels-tabs .tab:hover {
  color: #fff;
  border-color: rgba(180, 200, 255, 0.45);
}

.levels-tabs .tab.is-active {
  color: #fff;
  border-color: rgba(180, 210, 255, 0.65);
  background: rgba(40, 70, 140, 0.45);
  box-shadow: 0 0 18px rgba(100, 140, 255, 0.2);
}

.levels-meta {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.9rem;
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  color: #8aa0c8;
  flex-wrap: wrap;
}

#levels-status.is-error {
  color: #ff8f8f;
}

.table-wrap {
  margin-top: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(140, 170, 255, 0.18);
  background: rgba(4, 8, 20, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  overflow: auto;
  max-height: min(70vh, 720px);
}

.levels-table {
  width: 100%;
  border-collapse: collapse;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.88rem;
}

.levels-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(12, 20, 40, 0.95);
}

.levels-table th {
  text-align: left;
  padding: 0.75rem 0.85rem;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9eb4dc;
  border-bottom: 1px solid rgba(140, 170, 255, 0.2);
  white-space: nowrap;
}

.levels-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(100, 130, 180, 0.1);
  color: #d0dcff;
  vertical-align: middle;
}

.levels-table tbody tr:hover td {
  background: rgba(60, 90, 160, 0.12);
}

.col-price {
  font-weight: 500;
  color: #fff;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.84rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.st-fresh {
  color: #9dffc2;
  background: rgba(40, 120, 70, 0.25);
  border-color: rgba(100, 220, 140, 0.35);
}

.st-tapped {
  color: #ffd59a;
  background: rgba(140, 90, 20, 0.28);
  border-color: rgba(255, 190, 90, 0.35);
}

.st-weak {
  color: #c8b0ff;
  background: rgba(80, 50, 140, 0.28);
  border-color: rgba(170, 130, 255, 0.35);
}

.st-other {
  color: #b8c8e8;
  background: rgba(50, 70, 110, 0.3);
  border-color: rgba(140, 160, 200, 0.3);
}

@media (max-width: 700px) {
  .col-type,
  .col-origin,
  .col-taps {
    display: none;
  }

  .levels-table th,
  .levels-table td {
    padding: 0.55rem 0.6rem;
  }
}

/* ── Forms ─────────────────────────────────────────────── */

.levels-form {
  margin-top: 0.5rem;
  text-align: left;
  font-family: system-ui, -apple-system, sans-serif;
}

.form-section {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.15rem 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(140, 170, 255, 0.18);
  background: rgba(4, 8, 20, 0.72);
  backdrop-filter: blur(10px);
}

.form-section h2 {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9eb4dc;
  margin-bottom: 0.9rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #8aa0c8;
}

.field.is-required .field-label::after {
  content: " *";
  color: #ff9a9a;
}

.field input {
  width: 100%;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(140, 170, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #e8f0ff;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.88rem;
}

.field input:focus {
  outline: none;
  border-color: rgba(160, 200, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(80, 120, 220, 0.25);
}

.form-help {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: #7f93b8;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.primary-btn {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid rgba(160, 200, 255, 0.55);
  background: rgba(40, 70, 140, 0.55);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.primary-btn:hover:not(:disabled) {
  background: rgba(60, 100, 180, 0.7);
  box-shadow: 0 0 20px rgba(100, 140, 255, 0.3);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.form-status {
  font-size: 0.82rem;
  color: #8aa0c8;
}

.form-status.is-error {
  color: #ff8f8f;
}

/* ── Summary after submit ─────────────────────────────── */

.summary-panel {
  margin-top: 0.5rem;
  text-align: left;
  font-family: system-ui, -apple-system, sans-serif;
}

.summary-head h2 {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e8f0ff;
}

.muted {
  color: #7f93b8;
  font-size: 0.8rem;
}

.bias-block {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(180, 160, 255, 0.25);
  background: rgba(20, 12, 40, 0.55);
}

.bias-block h3 {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c8b8ff;
  margin-bottom: 0.75rem;
}

.tf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.tf-card {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(140, 170, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
}

.tf-daily { border-color: rgba(120, 180, 255, 0.4); }
.tf-weekly { border-color: rgba(255, 170, 80, 0.4); }
.tf-monthly { border-color: rgba(190, 120, 255, 0.4); }

.tf-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9eb4dc;
}

.tf-status {
  margin-top: 0.25rem;
  font-weight: 600;
  color: #fff;
  font-size: 0.92rem;
}

.tf-reason {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: #9aafd0;
  line-height: 1.35;
}

.bias-line {
  font-size: 0.84rem;
  color: #d0dcff;
  margin-top: 0.4rem;
  line-height: 1.4;
}

.sum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.sum-card {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(140, 170, 255, 0.18);
  background: rgba(4, 8, 20, 0.72);
}

.sum-card h3 {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9eb4dc;
  margin-bottom: 0.5rem;
}

.sum-promoted {
  border-color: rgba(255, 220, 80, 0.45);
  background: rgba(60, 50, 10, 0.35);
}

.sum-promoted h3 { color: #ffe28a; }

.sum-tapped {
  border-color: rgba(255, 160, 80, 0.4);
}

.sum-best h3 { color: #9dffc2; }

.sum-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sum-card li {
  font-size: 0.84rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(100, 130, 180, 0.12);
  color: #d0dcff;
}

.sum-card li:last-child { border-bottom: none; }

.table-section h3 {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c8d8ff;
  margin-bottom: 0.35rem;
}

.cell-input,
.cell-select {
  width: 100%;
  min-width: 4.5rem;
  padding: 0.3rem 0.35rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
}

.cell-input:disabled,
.cell-select:disabled {
  opacity: 1;
  color: inherit;
  -webkit-text-fill-color: inherit;
}

.cell-input:not(:disabled),
.cell-select:not(:disabled) {
  border-color: rgba(160, 200, 255, 0.45);
  background: rgba(0, 0, 0, 0.4);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(140, 170, 255, 0.3);
  background: rgba(20, 30, 55, 0.7);
  color: #d8e4ff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.icon-btn:hover {
  border-color: rgba(180, 210, 255, 0.65);
  color: #fff;
}

.col-actions {
  white-space: nowrap;
  width: 88px;
}

.editable-table .badge {
  margin-right: 0.25rem;
}

