/* Minimal, bright aesthetic */
:root{
  --bg: #f9fafb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2588eb;
  --primary-ink: #ffffff;
  --ring: #93c5fd;
  --border: #e5e7eb;
  --success: #10b981;
  --header-h: 50px;
}

*{ box-sizing: border-box; }
html,body{ margin:0; padding:0; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji"; color: var(--text); background: var(--bg); }
.container{ max-width: 1100px; margin: 0 auto; padding: 1.25rem; }

.site-header {
  width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.6));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10; 
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between; /* pushes brand left and nav right */
  padding: 0 1.25rem; /* keep some breathing room */
  max-width: 100%; /* override container constraint */
}
.brand{ font-weight:700; text-decoration:none; color:var(--text); }
.nav{  align-items: center; display:flex; gap:.75rem; }
.nav-link{ color:var(--muted); text-decoration:none; padding:.5rem .75rem; border-radius:.5rem; }
.nav-link:hover{ background:#eef2ff; color:#1e3a8a; }

.site-footer{ border-top:1px solid var(--border); margin-top:3rem; }
.site-footer p{ color:var(--muted); font-size:.9rem; }

.tools-grid{ display:grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap:1rem; margin-top:1rem; }
.tool-card{ 
  background: var(--card); 
  border:2px solid var(--border); /* thicker border */
  border-radius: 1rem; 
  padding: 1.25rem; 
  display:flex; flex-direction:column; gap:.5rem; 
  text-decoration:none; color:inherit; 
}
.tool-badge{ font-size:.75rem; color:#1e3a8a; background:#e0e7ff; border-radius:999px; padding:.25rem .6rem; width:max-content; }
.button{ 
  display:inline-flex; align-items:center; justify-content:center; 
  border:2px solid var(--border); /* thicker border */
  padding:.65rem .9rem; border-radius:.75rem; background:#fff; 
  cursor:pointer; text-decoration:none; color: var(--text); 
}
.button:hover{ background:#f8fafc; }
.button.primary{ background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.button.primary:hover{ filter: brightness(0.96); }
.button.success{ background: var(--success); color:#fff; border-color: transparent; }
.button.ghost{ background:transparent; }

.panel{ background: var(--card); border:2px solid var(--border); /* thicker border */ border-radius: 1rem; padding: 1.25rem; margin-top: 1rem; box-shadow: 0 6px 24px rgba(15,23,42,0.04); }
h1{ font-size:1.6rem; margin:.25rem 0 .5rem; }
h2{ font-size:1.2rem; margin:.25rem 0 .75rem; }
.muted{ color: var(--muted); }

.simple-form{ display:grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 1rem 1.25rem; margin-top: .5rem; }
.form-row{ display:flex; flex-direction:column; gap:.35rem; }
label{ font-weight:600; font-size:.95rem; }
input[type="date"], input[type="text"], input[type="number"], input[list], select{
  border:2px solid var(--border); /* thicker border */
  background:#fff; padding:.6rem .7rem; border-radius:.75rem; 
  outline:none; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus{ border-color: var(--ring); box-shadow: 0 0 0 4px rgba(147,197,253,0.3); }

.progress-wrap{ display:flex; flex-direction:column; gap:.5rem; }
.progress{ position:relative; width:100%; height:10px; border:2px solid var(--border); border-radius:999px; overflow:hidden; background:#f3f4f6; }
.progress .bar{ height:100%; width:0%; background: var(--primary); transition: width .25s; }
.progress.indeterminate .bar{ width:40%; animation: indet 1.4s infinite; }
@keyframes indet{ 0%{ transform: translateX(-60%);} 50%{ transform: translateX(40%);} 100%{ transform: translateX(140%);} }
.progress-text{ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size:.92rem; }

.brand-logo {
  height: 50px; /* larger logo */
}

.nav-logo {
  height: 30px; /* larger nav logo */
  margin-left: 10px;
}

/* Larger icons in nav only */
.nav i {
  font-size: 1.5rem;
}

/* ------- Layout helpers ------- */
.center {
  min-height: calc(100vh - 120px); /* leaves room for header */
  display: grid;
  place-items: start center; /* align slightly under header */
  padding-top: 3rem;
  padding-bottom: 3rem;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99,102,241,0.1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(16,185,129,0.08), transparent 55%);
}

/* ------- Card ------- */
.card-modern {
  background: #fff;
  border-radius: 18px;
  padding: 24px 26px;
  box-shadow:
    0 10px 30px rgba(0,0,0,.08),
    0 2px 8px rgba(0,0,0,.06);
  border: 1px solid rgba(0,0,0,.06);
}

.glass {
  backdrop-filter: blur(10px);
}

.fade-in {
  opacity: 0;
  animation: fadeIn .45s ease-out forwards;
}
@keyframes fadeIn { to { opacity: 1 } }

/* ------- Typography ------- */
.title { font-size: 1.6rem; font-weight: 700; color: #111827; }
.subtitle { color: #6b7280; font-size: .95rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: 1.25rem; }

/* ------- Form ------- */
.form {
  display: grid;
  gap: .75rem;
}

.form label {
  font-size: .85rem;
  font-weight: 600;
  color: #374151;
}

.form input[type="text"],
.form input[type="password"],
.form input:not([type]) {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.form input::placeholder { color: #9ca3af; }

.form input:focus {
  outline: none;
  border-color: #6366f1; /* indigo */
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ------- Button ------- */
.cta {
  height: 44px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(90deg, #6366f1, #10b981);
  color: #fff;
  transition: transform .05s ease, box-shadow .2s ease, filter .2s ease;
}

.cta:hover { filter: brightness(1.03); }
.cta:active { transform: translateY(1px); }

/* ------- Flash messages (optional) ------- */
.flash-area { margin: 1rem auto; max-width: 720px; }
.flash {
  padding: .75rem 1rem;
  border-radius: 10px;
  margin-bottom: .5rem;
  font-weight: 600;
}
.flash.danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash.success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }

/* ------- Small screens ------- */
@media (max-width: 480px) {
  .card-modern { padding: 20px; border-radius: 16px; }
  .title { font-size: 1.35rem; }
}

/* ------- Optional: dark mode if body has .dark ------- */
body.dark .card-modern { background: rgba(17,24,39,.6); border-color: rgba(255,255,255,.08); }
body.dark .title { color: #f3f4f6; }
body.dark .subtitle, body.dark label { color: #cbd5e1; }
body.dark .form input { background: #0f172a; border-color: #1f2937; color: #e5e7eb; }
body.dark .form input::placeholder { color: #6b7280; }

/* Container */
.user-menu {
  position: relative;
  display: inline-block;
}

/* Avatar button */
.user-avatar {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}
.user-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* Dropdown hidden by default */
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  margin-top: .5rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  padding: .75rem;
  min-width: 180px;
  z-index: 100;
}

/* Show on hover */
.user-menu:hover .user-dropdown {
  display: block;
}

/* Dropdown items */
.user-dropdown .user-label {
  display: block;
  font-size: .85rem;
  color: #374151;
  margin-bottom: .5rem;
}
.user-dropdown a {
  display: block;
  padding: .4rem .6rem;
  border-radius: 6px;
  text-decoration: none;
  color: #111827;
  font-weight: 500;
}
.user-dropdown a:hover {
  background: #f3f4f6;
}

/* ===== Home layout with left image rail + vertical tools ===== */
.home-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.side-rail {
  position: sticky;
  top: var(--header-h);                 /* sits just under the sticky header */
  height: calc(100vh - var(--header-h) - 1px);
  align-self: start;
}

.side-rail-img {
  width: 100%;
  height: 100%;         /* fill the rail’s full height */
  display: block;
  border-radius: 0;      /* ← no curved edges */
  border: 0;             /* remove border */
  box-shadow: none;      /* remove shadow */
  background: transparent;
  object-fit: cover;     /* image covers the entire rail without gaps */
}

.container:has(.home-layout.fullwidth) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* Vertical list */
.tool-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.page-title { margin: .25rem 0 .25rem; }

/* Each tool row */
.tool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  transition: transform .08s ease, box-shadow .18s ease, border-color .18s ease;
}

.tool-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(15,23,42,0.06);
  border-color: #dbeafe; /* subtle accent on hover */
}

.tool-text h3 {
  margin: .15rem 0 .25rem;
  font-size: 1.05rem;
}
.tool-text p { margin: 0; }

/* Mobile: stack, image on top, full width */
@media (max-width: 900px) {
  .home-layout {
    grid-template-columns: 1fr;
  }
  .side-rail { position: static; }
}

/* Make home layout span entire screen */
.home-layout.fullwidth {
  max-width: 100%;
  margin: 0;
  padding: 2rem;
  grid-template-columns: 400px 1fr; /* left image bigger, right fills rest */
}

/* Override container behavior on homepage */
body .home-layout.fullwidth {
  width: 100%;
}

/* Let tool list expand */
.home-layout.fullwidth .tool-list {
  width: 100%;
}

/* Kill the container constraints only on home layout */
.container:has(.home-layout.fullwidth) {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.home-layout.fullwidth {
  margin: 0;
  padding: 0; /* remove that 2rem you had */
  width: 100%;
  grid-template-columns: 400px 1fr;
}


.home-layout.fullwidth .tool-list {
  max-width: 1000px;   /* or 800px depending on your taste */
  width: 100%;        /* still responsive */
}

/* Keep the whole layout flush with edges */
.home-layout.fullwidth {
  margin: 0;
  padding: 0;
  width: 100%;
  grid-template-columns: 400px 1fr; /* left column fixed for the image */
  justify-content: start;           /* don't center it */
}

/* Make only the tools column scroll on the homepage */
body:has(.home-layout.fullwidth) {
  overflow: hidden; /* page itself doesn't scroll */
}

.home-layout.fullwidth {
  height: calc(100vh - var(--header-h)); /* fills viewport under the header */
}

.home-layout.fullwidth .tool-list {
  height: 100%;
  overflow-y: auto;      /* this is the scroller */
  padding-right: .75rem; /* room for scrollbar so cards don’t hug it */
}


/* ── Tool 4 compatibility layer (maps Bootstrap-ish classes to your theme) ── */

.viewport-center { max-width: 1080px; margin: 48px auto; padding: 0 16px; }

/* Grid */
.row.g-3 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}
.col-md-4 { grid-column: span 4; min-width: 0; }
.col-12   { grid-column: 1 / -1; }

/* Labels */
.form-label {
  display: block;
  margin: 0 0 6px;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
}

/* Inputs & selects */
.form-control,
.form-select {
  width: 100%;
  padding: .6rem .7rem;
  border: 2px solid var(--border);
  border-radius: .75rem;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 4px rgba(147,197,253,.3);
}

/* Input group (pages + suffix) */
.input-group { display: flex; align-items: stretch; }
.input-group > .form-control {
  border-right: 0;
  border-radius: .75rem 0 0 .75rem;
}
.input-group-text {
  display: inline-flex;
  align-items: center;
  padding: .6rem .7rem;
  border: 2px solid var(--border);
  border-left: 0;
  border-radius: 0 .75rem .75rem 0;
  background: #f3f4f6;
  color: #374151;
  font-size: 14px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--border);
  padding: .65rem .9rem; border-radius: .75rem;
  background: #fff; color: var(--text);
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: filter .12s, background .12s, border-color .12s;
}
.btn:hover { background: #f8fafc; }
.cta-btn, .btn-primary { background: var(--primary); color: #fff; border-color: transparent; }
.cta-btn:hover, .btn-primary:hover { filter: brightness(.96); }
.btn-outline-secondary { background: transparent; color: #374151; border-color: var(--border); }
.btn-outline-secondary:hover { background: #f9fafb; }
.btn-success { background: var(--success); color: #fff; border-color: transparent; }

/* Status box */
#statusBox {
  background: #FAFAFB;
  border: 1px solid #EEF0F4;
  border-radius: 12px;
  padding: 14px 16px;
}

.progress-wrap .progress-text { display: none !important; }

/* Active state for filter buttons */
.filter-bar .button.active,
.filter-bar .button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.filter-bar .button {
  transition: background .15s, box-shadow .15s, color .15s, border-color .15s;
}


/* tutorial link by the title */
.tutorial-link {
  font-size: 0.9rem;
  margin-left: .75rem;
  text-decoration: underline;
  color: var(--link, #2563eb);
  cursor: pointer;
}
.tutorial-link:hover { opacity: .9; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}
.modal-overlay.show { display: flex; }

.modal {
  background: #fff;
  width: min(960px, 100%);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  overflow: hidden;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.modal-title { margin: 0; font-size: 1.05rem; }
.modal-close {
  appearance: none; border: 0; background: transparent;
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}

.modal-body { padding: 0; }

/* 16:9 responsive video */
.video-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
}
.video-wrap iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.video-placeholder {
  padding: 2rem 1.5rem;
  color: #6b7280; /* muted */
  text-align: center;
}

/* title left, button right */
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
}
.panel-head h1{ margin:0; }

/* optional: on narrow screens stack title over button */
@media (max-width: 560px){
  .panel-head{ flex-wrap:wrap; }
  .panel-head .button{ margin-left:auto; } /* keeps it to the right when wrapping */
}

.tutorial-btn.button.primary{
  background-color:#1e66ff;
  color:#fff;
  border-color:transparent;
}
.tutorial-btn.button.primary:hover{ background-color:#1956d6; }

/* Dropdown styling */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-btn {
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  padding: 0.5rem 1rem;
  color: #333;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #fff;
  min-width: 180px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  z-index: 1000;
  border-radius: 6px;
}

.dropdown-content a {
  display: block;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #333;
}

.dropdown-content a:hover {
  background-color: #f0f0f0;
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* Results table expansion */
.results-container {
  width: 100%;
  max-width: 100vw;   /* allow full viewport width */
  overflow-x: visible; /* kill horizontal scroll */
}

.results-container table {
  width: 100%;        /* stretch table to container */
  table-layout: auto; /* let cells size based on content */
  border-collapse: collapse;
}

.results-container th,
.results-container td {
  white-space: nowrap; /* prevent wrapping */
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

/* widen container just for pages that need big tables */
.container--wide {
  max-width: 1600px;        /* stretch wider than default 1100px */
  width: 100%;
}

@media (min-width: 1900px) {
  .container--wide { max-width: 90vw; }  /* allow breathing room on ultrawide screens */
}

/* table rules */
#rpmTable {
  width: 100%;
  table-layout: auto;        /* auto size by content */
  border-collapse: collapse;
}

#rpmTable th,
#rpmTable td {
  white-space: nowrap;       /* keep values on one line */
  padding: .5rem .625rem;
}

.container--wide {
  max-width: 100% !important;
  width: 100%;
}
.table-wrap {
  width: 100%;
  overflow-x: auto; /* still allows scroll if screen is too narrow */
}
.table {
  width: 100%;
  table-layout: auto; /* let it expand naturally */
}

/* allow this page to be wider than the default */
.container.container--wide{
  max-width: 1600px;   /* or 90vw, or 1800px — your choice */
  width: 100%;
}

/* make the table fill the space (no forced scroll) */
.table-wrap{ overflow-x: visible; }
#rpmTable{ width: 100%; table-layout: auto; }

.dot{ display:inline-block; width:10px; height:10px; border-radius:999px; vertical-align:middle; }
.dot--green{ background: var(--success); }
.dot--red{ background:#ef4444; }


/* group just the two logos so we can control their spacing independently */
.nav-logos {
  display: flex;
  align-items: center;
  gap: .25rem;            /* tighter space between LP & Ringba */
}

/* bigger logos */
.nav-logo {
  height: 40px;           /* ↑ increase from 30px */
  width: auto;
  display: block;
  margin-left: 0;         /* remove the old extra left margin */
}

/* reduce padding only on the logo links (not all nav links) */
.nav-logo-link {
  padding: .25rem .35rem; /* was .5rem .75rem */
}

/* (optional) keep global nav gap as-is for other items */
.nav { gap: .75rem; }     /* leave this unchanged */

/* add extra space only before the user avatar block */
.nav .user-menu {
  margin-left: 2.00rem;   /* tweak to taste */
}

/* ========================================
  Responsive Styles (Mobile) - FINAL
========================================
*/
@media (max-width: 900px) {

  /* --- 1. General Layout --- */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .side-rail {
    display: none;
  }
  .home-layout {
    grid-template-columns: 1fr;
  }
  .home-layout .tool-list {
    width: 100%;
    max-width: 100%;
    padding: 0;
    height: auto;
  }
  body:has(.home-layout.fullwidth) {
    overflow: auto;
  }
  .tool-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* --- 2. Header & Navigation --- */
  .header-inner {
    justify-content: space-between;
  }
  .nav-toggle {
    display: block;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0.5rem;
  }
  body.nav-open .nav-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
  }
  .hamburger-icon {
    display: block;
    width: 24px;
    height: 3px;
    background: #333;
    position: relative;
    transition: background .2s ease-out;
  }
  .hamburger-icon::before, .hamburger-icon::after {
    content: '';
    display: block;
    width: 24px;
    height: 3px;
    background: #333;
    position: absolute;
    transition: all .2s ease-out;
  }
  .hamburger-icon::before { top: -8px; }
  .hamburger-icon::after { top: 8px; }

  .nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    padding-top: 6rem;
    z-index: 1000;
  }

  /* --- 3. Mobile Nav "Open" State --- */
  body.nav-open {
    overflow: hidden;
  }
  body.nav-open .nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    overflow-y: auto;
    /* 👇 KEY FIX: Force items to the top, not the center 👇 */
    justify-content: flex-start;
  }
  body.nav-open .hamburger-icon {
    background: transparent;
  }
  body.nav-open .hamburger-icon::before {
    transform: rotate(45deg);
    top: 0;
  }
  body.nav-open .hamburger-icon::after {
    transform: rotate(-45deg);
    top: 0;
  }

  /* Style all nav items */
  .nav .nav-link,
  .nav .user-menu {
    font-size: 1.2rem;
    margin-left: 0; /* Reset desktop margin */
  }
  
  /* Target logo images inside their links */
  .nav .nav-link .nav-logo {
    height: 30px;
    width: auto;
  }

  /* Fix dropdown menu */
  .nav .dropdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
  }
  .nav .dropdown-content {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    list-style-type: none; /* Force remove bullets */
  }
  .nav .dropdown-content a {
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
  }

  /* --- 4. Forms (Tools 9, 10) --- */
  .simple-form .form-row {
    grid-column: 1 / -1 !important;
  }
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  .simple-form .actions,
  .form-grid > div:has(> .button) {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .simple-form .actions .button,
  .form-grid .button {
    width: 100%;
  }
  
  /* --- 5. Tables (Tools 8, 9, 10) --- */
  
  /* Make wrappers scrollable */
  .table-wrap,
  .results-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 8px;
  }
  
  /* 👇 KEY FIX: Force tables to be wide, not 100% 👇 */
  .table-wrap table,
  .results-container table {
    width: auto; /* Let table be as wide as its content */
    min-width: 100%; /* But not narrower than the screen */
    table-layout: auto; /* Override any desktop fixed layout */
  }
  
  /* Force table cells to not wrap */
  .table-wrap table th,
  .table-wrap table td,
  .results-container table th,
  .results-container table td {
    white-space: nowrap;
  }
  
} /* End of @media query */

/* --- Mobile nav base (hidden) --- */
@media (max-width: 900px) {
  .nav {
    display: block;                 /* let it exist for transform to work */
    position: fixed;
    inset: 0 0 0 auto;              /* anchor to right */
    width: min(90vw, 360px);
    height: 100vh;
    background: #ffffff;
    transform: translateX(100%);    /* off-canvas by default */
    transition: transform .25s ease-out;
    z-index: 1001;
    padding: 5rem 1rem 1.25rem;
    overflow-y: auto;
    box-shadow: -8px 0 24px rgba(0,0,0,.08);
  }
  body.nav-open .nav { transform: translateX(0); }

  /* stack nav items */
  .nav .nav-link,
  .nav .dropdown,
  .nav .user-menu { 
    display: block;
    margin: 0 .25rem 0.5rem;
  }

  /* overlay behind the drawer */
  .nav-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1000;
  }
  body.nav-open .nav-overlay { display: block; }
  .nav-overlay[hidden] { display: none !important; }

  /* turn hover dropdowns into click dropdowns on mobile */
  .dropdown .dropdown-content,
  .user-menu .user-dropdown {
    display: none !important;       /* kill hover */
    position: static;
    box-shadow: none;
    border: 0;
    padding: 0;
    margin-top: .25rem;
    background: transparent;
  }
  .dropdown.open .dropdown-content,
  .user-menu.open .user-dropdown {
    display: block !important;
  }

  /* tidy dropdown items */
  .dropdown-content a,
  .user-dropdown a {
    padding: .6rem .7rem;
    border-radius: 8px;
  }

  /* avoid body-wide scroll lock bugs on iOS */
  body.nav-open { overflow: hidden; }
}

/* prefer click over hover even on desktop for the avatar (hover is unreliable with touchpads) */
@media (min-width: 901px) {
  .user-menu:hover .user-dropdown { display: none; } /* cancel hover */
  .user-menu.open .user-dropdown { display: block; }
}

/* optional: reduce motion */
@media (prefers-reduced-motion: reduce) {
  .nav { transition: none; }
}

/* ensure header sits above overlay */
.site-header { z-index: 1002; }

/* ===== FINAL mobile/drawer overrides — append at END of styles.css ===== */

/* Ensure header stays above the drawer/overlay */
.site-header { z-index: 1002; }

/* Overlay control */
.nav-overlay{ position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:1000; display:none; }
.nav-overlay[hidden]{ display:none !important; }

/* Base burger styles (if not present) */
.nav-toggle{ background:transparent; border:0; cursor:pointer; padding:.5rem; z-index:1003; display:none; }
.hamburger-icon{ display:block; width:24px; height:3px; background:#333; position:relative; transition:background .2s ease; }
.hamburger-icon::before,.hamburger-icon::after{
  content:""; position:absolute; left:0; width:24px; height:3px; background:#333; transition:all .2s ease;
}
.hamburger-icon::before{ top:-8px; } .hamburger-icon::after{ top:8px; }

/* Mobile drawer */
@media (max-width: 900px) {
  .nav-toggle{ display:block; }

  /* Off-canvas drawer replaces any older full-screen flex nav */
  .nav{
    display:block !important;     /* drawer needs to exist for transform */
    position:fixed; inset:0 0 0 auto;
    width:min(90vw, 360px); height:100vh;
    background:#fff; transform:translateX(100%);
    transition:transform .25s ease-out;
    z-index:1001; padding:5rem 1rem 1.25rem;
    overflow-y:auto; box-shadow:-8px 0 24px rgba(0,0,0,.08);
  }
  body.nav-open .nav{ transform:translateX(0); }
  body.nav-open{ overflow:hidden; }
  body.nav-open .nav-overlay{ display:block; }

  /* Stack items */
  .nav .nav-link, .nav .dropdown, .nav .user-menu{
    display:block; margin:0 .25rem .5rem;
  }

  /* Tap-to-open dropdowns (disable hover) */
  .dropdown .dropdown-content,
  .user-menu .user-dropdown{
    display:none !important; position:static; box-shadow:none; border:0; padding:0; margin-top:.25rem; background:transparent;
  }
  .dropdown.open .dropdown-content,
  .user-menu.open .user-dropdown{ display:block !important; }

  /* Turn burger into X when open */
  body.nav-open .hamburger-icon{ background:transparent; }
  body.nav-open .hamburger-icon::before{ transform:rotate(45deg); top:0; }
  body.nav-open .hamburger-icon::after{ transform:rotate(-45deg); top:0; }
}

/* Desktop: avatar menu should be click-based (not hover) */
@media (min-width: 901px) {
  .user-menu:hover .user-dropdown { display: none !important; }
  .user-menu.open .user-dropdown { display: block !important; }
}
