
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05070b;
  color: #f5f5f5;
}

header {
  background: radial-gradient(circle at top left, #23293a, #05070b);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

header h1 {
  margin: 0;
  font-size: 1.2rem;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
}

.nav-tabs button {
  background: transparent;
  color: #d0d4e4;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  font-size: 0.8rem;
}

.nav-tabs button.active {
  background: #4c6fff;
  color: #fff;
  border-color: #4c6fff;
}

main {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.card {
  background: #0c101b;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.card h2 {
  margin-top: 0;
  font-size: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  margin-top: 0.3rem;
  margin-bottom: 0.1rem;
  color: #c3c7de;
}

input, select, textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 0.25rem 0.4rem;
  background: #05070b;
  color: #f5f5f5;
  font-size: 0.85rem;
}

textarea {
  min-height: 60px;
  resize: vertical;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 0.25rem;
}

th, td {
  border: 1px solid rgba(255,255,255,0.12);
  padding: 0.2rem 0.35rem;
  text-align: left;
}

th {
  background: rgba(255,255,255,0.05);
}

button, .btn {
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: #f5f5f5;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
}

button.primary, .btn.primary {
  background: #4c6fff;
  border-color: #4c6fff;
  color: #fff;
}

button.danger {
  border-color: #ff6b6b;
  color: #ffbaba;
}

button.small, .btn.small {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
}

/* Admin: Global Locations preview chips (high-contrast for readability) */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.loc-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  /* Use a dark chip background so the text stays readable even if the theme changes */
  background-color: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.18);
  color: #f5f5f5;
}

.loc-chip button {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background-color: rgba(255,255,255,0.08);
  color: #f5f5f5;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
}

.loc-chip button:hover {
  border-color: rgba(255,255,255,0.28);
  background-color: rgba(255,255,255,0.14);
}

.wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 8, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.wizard-overlay.hidden {
  display: none;
}

.wizard-card {
  width: min(720px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  background: radial-gradient(circle at top left, #181c26, #050609);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
}

.wizard-section {
  margin-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 0.5rem;
}

#diagList {
  list-style: none;
  padding-left: 0;
  margin: 0;
  font-size: 0.8rem;
}
#diagList li {
  margin-bottom: 0.2rem;
}
.diag-issue {
  color: #ff8080;
}
.diag-warning {
  color: #ffd27f;
}
.diag-info {
  color: #9ce6ff;
}

.rta-canvas-wrapper {
  width: 100%;
  height: 220px;
  background: #05070b;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  margin-top: 0.5rem;
}

#rtaCanvas {
  width: 100%;
  height: 100%;
}


/* Garage Build vs Shop header enhancements */
.header-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edition-badge {
  font-size: 0.7rem;
  color: #9ca3af;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  display: inline-block;
}

/* License overlay adjustments (reuse wizard styles) */
#licenseKeyInput {
  width: 100%;
  min-height: 80px;
  resize: vertical;
}

/* About / License modal */
.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  /* Allow scrolling when content exceeds viewport */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4vh 2vw;
}

.about-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
}

.about-card {
  position: relative;
  /* Wider, less tall layout so content fits without trapping the user */
  width: min(980px, 96vw);
  max-width: none;
  margin: 0 auto;
  max-height: calc(100vh - 8vh);
  overflow-y: auto;
  background: #05070b;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 16px 18px 12px;
  color: #f5f5f5;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
}

.about-card h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}
.about-sub {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: #9ca3af;
}
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}
@media (max-width: 560px) {
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.about-note {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 4px;
}
.about-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #9ca3af;
}
#btnAboutClose {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: #e5e7eb;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}


/* Tools page helpers */
.tool-output {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #020617;
  border-radius: 8px;
  border: 1px solid #1f2937;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
}
.tool-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.level-meter-bar {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #020617;
  border: 1px solid #1f2937;
  overflow: hidden;
}
.level-meter-fill {
  position: absolute;
  inset: 0;
  width: 5%;
  background: linear-gradient(90deg, #22c55e, #f97316, #ef4444);
  transform-origin: left center;
  transform: scaleX(0.1);
  transition: transform 0.1s linear;
}
.trouble-item {
  margin-top: 0.3rem;
}
.trouble-item summary {
  cursor: pointer;
  font-weight: 600;
}
.trouble-item ul {
  margin: 0.35rem 0 0.25rem 1.1rem;
}


/* Demo mode badge */
.demo-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f97316;
  color: #000;
  margin-left: 0.35rem;
}


.page-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  align-items: center;
}


.global-profile-bar {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.global-profile-bar .label {
  font-weight: 600;
  font-size: 0.9rem;
}

.global-profile-bar select {
  min-width: 220px;
}


/* Workflow step tracker */
.step-tracker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}
.step-tracker .step {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #ccc;
  opacity: 0.7;
}
.step-tracker .step.active {
  opacity: 1;
  font-weight: 600;
  border-color: #333;
}


.step-tracker .step.complete {
  background-color: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
  opacity: 1;
}

.step-tracker .step.complete.active {
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.25);
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-left: 0.35rem;
  border-radius: 50%;
  font-size: 0.65rem;
  border: 1px solid #999;
  cursor: pointer;
  background: #f7f7f7;
  padding: 0;
}
.help-icon:hover {
  background: #e0e0e0;
}



/* User Tools page - outline each tool card in red */
#userToolsPage .card-subsection,
#userToolsPage .card-subsection .grid-3 > div,
#userToolsPage .card-subsection .grid-2 > div {
  border: 1px solid #b91c1c;
  border-radius: 4px;
  padding: 0.5rem;
}


/* ===== Master Login Modal ===== */
.bbt-modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
.bbt-modal{
  width:min(520px, calc(100vw - 32px));
  background:#111827;
  border:1px solid rgba(255,255,255,0.12);
  border-radius:14px;
  box-shadow:0 18px 60px rgba(0,0,0,0.55);
  color:#e5e7eb;
}
.bbt-modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,0.10);
}
.bbt-modal-title{
  font-size:16px;
  font-weight:700;
}
.bbt-modal-close{
  background:transparent;
  border:0;
  color:#e5e7eb;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}
.bbt-modal-body{
  padding:14px 16px 10px 16px;
}
.bbt-modal-body .bbt-field{
  margin-bottom:10px;
}
.bbt-modal-body label{
  display:block;
  font-size:12px;
  opacity:0.9;
  margin-bottom:4px;
}
.bbt-modal-body input{
  width:100%;
  padding:10px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.15);
  background:#0b1220;
  color:#e5e7eb;
}
.bbt-modal-error{
  margin-top:8px;
  padding:10px;
  border-radius:10px;
  border:1px solid rgba(239,68,68,0.35);
  background:rgba(239,68,68,0.08);
  color:#fecaca;
  font-size:12px;
}
.bbt-modal-footer{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  padding:12px 16px 16px 16px;
}
.bbt-admin-session-row{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  margin:6px 0 10px 0;
}
.bbt-small-muted{ font-size:12px; opacity:0.8; }


/* Professional polish */
.header-nav { display:flex; align-items:center; gap:0.75rem; }
.nav-tabs { flex-wrap: wrap; row-gap: 0.4rem; }
.nav-tabs button { transition: background 120ms ease, border-color 120ms ease, transform 80ms ease; }
.nav-tabs button:hover { border-color: rgba(255,255,255,0.25); }
.nav-tabs button:active { transform: translateY(1px); }

button, .btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: #f5f5f5;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}
button.small { padding: 0.25rem 0.55rem; border-radius: 999px; font-size: 0.78rem; }
button.danger { background: rgba(255,70,70,0.10); border-color: rgba(255,70,70,0.30); }
button:hover, .btn:hover { border-color: rgba(255,255,255,0.26); background: rgba(255,255,255,0.08); }
button.danger:hover { border-color: rgba(255,70,70,0.55); background: rgba(255,70,70,0.14); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(76,111,255,0.85);
  box-shadow: 0 0 0 3px rgba(76,111,255,0.18);
}

.card h2 { display:flex; align-items:center; gap:0.5rem; }
.card h3 { margin: 0.25rem 0 0.35rem; }
.hint { color: rgba(245,245,245,0.72); line-height: 1.35; }

table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

@media (max-width: 760px) {
  header { align-items: flex-start; gap: 0.75rem; }
  header h1 { font-size: 1.05rem; }
  main { padding: 0.75rem; }
}
