/* =========================================================
   site.css — MBB Risk Engine (BASE + LAYOUT)
   Target design:
   - Flat dark-blue background (#0a2540)
   - Reference navbar: logo left, menu right (desktop)
   - Mobile: hamburger + dropdown panel
   - Keep TableEngine integration + existing panels/forms/buttons
   NOTE:
   - TableEngine sheet/table rules live in table_engine.bundle.css
   - Status bar rules live in status_bar.css
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root {
  --bg: #0a2540;
  --text: #ffffff;

  --accent: #55b6d3;
  --accent-2: #007bff;

  --panel-bg: rgba(10, 31, 68, 0.88);
  --panel-border: rgba(0, 123, 255, 0.18);

  --radius: 14px;
  --shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.25);

  /* Topbar sizing (taller like reference) */
  --nav-pad-y: 1.95rem;
  --nav-pad-x: 2rem;
  --nav-min-h: 120px;

  /* Optional runtime-measured topbar height (JS can set) */
  --topbar-h: var(--nav-min-h);

  /* Content */
  --content-max: 1200px;

  /* TableEngine token bridge */
  --sheet-header-bg: rgba(11, 59, 123, 0.82);
  --sheet-row-odd: rgba(255, 255, 255, 0.02);
  --sheet-row-even: rgba(255, 255, 255, 0.045);
  --sheet-row-hover: rgba(0, 123, 255, 0.12);
  --sheet-grid: rgba(14, 58, 114, 0.95);
  --sheet-font: 13px;
  --sheet-line: 1.05;
  --sheet-pad-y: 6px;
  --sheet-pad-x: 8px;

  --cell-pad-y: 2px;
  --cell-pad-x: 4px;
  --cell-focus-ring: rgba(85, 182, 211, 0.55);

  --toolbar-ink: rgba(140, 200, 255, 0.92);
  --toolbar-ink-muted: rgba(140, 200, 255, 0.78);
  --toolbar-ink-placeholder: rgba(140, 200, 255, 0.58);

  --sheet-text: rgba(245, 250, 255, 0.96);
  --sheet-text-muted: rgba(230, 245, 255, 0.92);
  --sheet-placeholder: var(--toolbar-ink-placeholder);
}

/* ---------- Base reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

/* Firefox scrollbar (global) */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.34) transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- App layout ---------- */
.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   LEGAL FOOTER sizing tokens (used by toast positioning too)
   ========================================================= */
:root{
  /* Keep these in one place so layout stays stable */
  --statusbar-h: 28px;   /* adjust to match your status_bar.css height */
  --legalbar-h: 34px;    /* visual height of this footer bar */
}

/* =========================================================
   FLASH / SERVER MESSAGES (toast style)
   - MOVED to lower-left corner
   - sits above legal + status bars
   ========================================================= */
.flash-host {
  position: fixed;

  /* Lower-left */
  left: 18px;
  right: auto;

  /* Above fixed bars (status + legal) with a small margin */
  bottom: calc(var(--statusbar-h, 28px) + var(--legalbar-h, 34px) + 12px);
  top: auto;

  /* Above page content; below spinner */
  z-index: 6400;

  max-width: min(520px, calc(100vw - 24px));
  pointer-events: none;
}

.flash-host:empty { display: none; }

.flash-stack { display: grid; gap: 10px; }

.flash-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 31, 68, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: var(--shadow-soft);
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  line-height: 1.25;
}

.flash-toast.error,
.flash-toast.danger { border-color: rgba(255, 90, 90, 0.35); }
.flash-toast.success { border-color: rgba(70, 220, 150, 0.28); }
.flash-toast.warning { border-color: rgba(255, 200, 80, 0.30); }
.flash-toast.info { border-color: rgba(120, 170, 255, 0.30); }

.flash-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.flash-close {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.flash-close:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(85, 182, 211, 0.35);
}

.flash-close:focus-visible {
  outline: 2px solid rgba(85, 182, 211, 0.55);
  outline-offset: 2px;
}

/* =========================================================
   NAVBAR (REFERENCE STYLE)
   ========================================================= */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: var(--nav-pad-y) var(--nav-pad-x);
  min-height: var(--nav-min-h);

  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* =========================================================
   BRAND (inline SVG logo + title + tagline)
   ========================================================= */
.brand {
  display: flex;
  align-items: center;
  gap: 1.05rem;
  text-decoration: none;
}

/* Slightly larger + a touch more glow for better "mark" presence */
.logo-symbol-new {
  width: 64px;
  height: 64px;
  display: block;
  flex: 0 0 64px;

  min-width: 64px;
  min-height: 64px;
  overflow: visible;

  /* slightly tighter “premium” glow at this larger size */
  filter: drop-shadow(0 0 12px rgba(85, 182, 211, 0.24));
  transform: translateY(1px);
  transition: transform 0.25s ease, filter 0.25s ease;
}

.brand:hover .logo-symbol-new {
  transform: translateY(1px) scale(1.04);
  filter: drop-shadow(0 0 16px rgba(85, 182, 211, 0.30));
}

.brand-text {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

/* Title: ONE element => continuous gradient like reference */
.brand-title {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.0;
  white-space: nowrap;

  background: linear-gradient(to right, #ffffff, #55b6d3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tagline aligned to same width as title */
.brand-tagline {
  margin-top: 0.40rem;

  display: flex;
  align-items: center;
  width: 100%;
  justify-content: space-between;

  font-size: 0.78rem;
  font-weight: 300;
  letter-spacing: 3px;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.0;

  color: rgba(255, 255, 255, 0.60);
}

.brand-w { display: inline-block; }

.brand-dot {
  display: inline-block;
  letter-spacing: 0;
  margin: 0 10px;
  color: rgba(255, 255, 255, 0.55);
  flex: 0 0 auto;
}

/* Desktop inline links (menu on the RIGHT) */
.nav-links {
  /* OPTION A: keep menu hard-right even if layout changes */
  margin-left: auto;

  display: flex;
  gap: 2.0rem; /* slightly tighter than 2.5rem */
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.nav-link {
  /* subtle pill hit-area + nicer hover/active */
  padding: 8px 12px;
  border-radius: 12px;

  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.98rem;
  transition: color 0.2s ease, background 0.2s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active,
.nav-link.is-active,
.nav-link[aria-current="page"] {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active::after,
.nav-link.is-active::after,
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), var(--accent-2));
  border-radius: 1px;
}

/* =========================================================
   HAMBURGER + MOBILE MENU
   ========================================================= */
.topmenu-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.topmenu-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(85, 182, 211, 0.35);
  transform: translateY(-1px);
}

.topmenu-btn:active { transform: translateY(0); }

.topmenu-btn:focus-visible {
  outline: 2px solid rgba(85, 182, 211, 0.55);
  outline-offset: 2px;
}

.topmenu-ico {
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.9);
  position: relative;
}

.topmenu-ico::before,
.topmenu-ico::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.9);
}

.topmenu-ico::before { top: -6px; }
.topmenu-ico::after { top: 6px; }

.topmenu-overlay {
  position: fixed;
  inset: 0;
  z-index: 6500;
  background: rgba(0, 0, 0, 0.25);
}

.topmenu-panel {
  position: fixed;

  /* Tie panel position to the tall navbar (desktop/tablet). */
  top: calc(var(--nav-min-h) - 20px);

  right: 16px;
  width: min(420px, calc(100vw - 2rem));
  max-height: calc(100vh - 120px);
  overflow: auto;
  z-index: 6600;
  background: rgba(10, 31, 68, 0.96);
  border: 1px solid rgba(0, 123, 255, 0.20);
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
  padding: 12px;
}

.topmenu-section { padding: 10px 10px 6px; }

.topmenu-title {
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.70);
  margin-bottom: 10px;
}

.topmenu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
  margin: 6px 8px;
  border-radius: 1px;
}

.topmenu-links { display: grid; gap: 8px; }

.topmenu-panel .nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.86);
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.topmenu-panel .nav-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.topmenu-panel .nav-link.active::after,
.topmenu-panel .nav-link.is-active::after,
.topmenu-panel .nav-link[aria-current="page"]::after {
  left: 10px;
  right: 10px;
  bottom: 6px;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.main-content {
  flex: 1;
  padding: 2rem;
}

/* Ensure content never hides behind the fixed bars */
.main-content{
  padding-bottom: calc(2rem + var(--statusbar-h) + var(--legalbar-h) + 10px);
}

.content-wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Optional: page title style if used */
.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 1rem;
  color: rgba(255, 255, 255, 0.92);
}

/* =========================================================
   LEGAL FOOTER (disclaimer + optional contact)
   - fixed, subtle, centered
   - sits ABOVE the status bar
   ========================================================= */
.legal-footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--statusbar-h);
  z-index: 5200;

  display: flex;
  justify-content: center;

  padding: 6px 16px;

  /* Professional “glass” strip */
  background: linear-gradient(
    to top,
    rgba(6, 18, 40, 0.72),
    rgba(6, 18, 40, 0.42)
  );
  backdrop-filter: blur(8px);

  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-inner{
  width: min(var(--content-max), calc(100vw - 32px));
  display: flex;
  align-items: center;

  /* CENTER the footer content */
  justify-content: center;
  text-align: center;

  gap: 10px;

  font-size: 12px;
  line-height: 1.2;
  color: rgba(230, 245, 255, 0.70);
  letter-spacing: 0.2px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legal-text{
  overflow: hidden;
  text-overflow: ellipsis;
}

.legal-sep{
  opacity: 0.55;
  flex: 0 0 auto;
}

.legal-link{
  color: rgba(85, 182, 211, 0.92);
  text-decoration: none;
  border-bottom: 1px solid rgba(85, 182, 211, 0.30);
  flex: 0 0 auto;
}

.legal-link:hover{
  color: rgba(85, 182, 211, 1);
  border-bottom-color: rgba(85, 182, 211, 0.55);
}

/* Small screens: allow wrapping so it never looks cramped */
@media (max-width: 640px){
  .legal-inner{
    white-space: normal;
    flex-wrap: wrap;

    /* still centered when wrapped */
    justify-content: center;
    text-align: center;

    gap: 6px 10px;
  }
}

/* =========================================================
   HOME (hero + features) — refined “reference-like” cards
   ========================================================= */
.hero {
  padding: 4rem 2rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  background: linear-gradient(to right, #ffffff, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 3rem;
  line-height: 1.8;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

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

.feature-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;

  min-height: 220px;
  padding: 26px 26px 22px;
  border-radius: 16px;

  background: rgba(7, 24, 55, 0.72);
  border: 1px solid rgba(120, 170, 255, 0.10);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);

  text-decoration: none;
  color: inherit;

  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  overflow: hidden;
}

.feature-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(900px 240px at 15% 10%,
              rgba(85, 182, 211, 0.10),
              rgba(0, 0, 0, 0) 60%);
  pointer-events: none;
}

.feature-card:hover {
  transform: translateY(-4px);
  background: rgba(7, 24, 55, 0.78);
  border-color: rgba(85, 182, 211, 0.22);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.feature-card:focus-visible {
  outline: 2px solid rgba(85, 182, 211, 0.55);
  outline-offset: 3px;
}

/* Optional icon container (place at top of card) */
.card-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);

  margin-bottom: 8px;
}

.card-ico svg {
  width: 26px;
  height: 26px;
  display: block;
  fill: none;
  stroke: rgba(85, 182, 211, 0.95);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(85, 182, 211, 0.18));
}

.feature-card h3 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  margin: 0;
  color: rgba(255, 255, 255, 0.94);
}

.feature-card p {
  margin: 0;
  color: rgba(230, 245, 255, 0.78);
  line-height: 1.55;
  max-width: 34ch;
}

.feature-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;

  color: rgba(85, 182, 211, 0.92);
  text-decoration: none;
  font-weight: 650;
  font-size: 0.98rem;
  letter-spacing: 0.2px;

  transition: gap 0.18s ease, color 0.18s ease;
}

.feature-card:hover .feature-link {
  gap: 12px;
  color: rgba(85, 182, 211, 1);
}

.feature-link::after {
  content: "→";
  font-weight: 800;
  opacity: 0.9;
}

/* =========================================================
   PANELS
   ========================================================= */
.parameters,
.table-container {
  max-width: var(--content-max);
  margin: 26px auto;
  padding: 26px 28px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  box-shadow: none;
  outline: 1px solid rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: visible;
}

.parameters::before,
.table-container::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  z-index: 0;
  pointer-events: none;
}

.parameters > *,
.table-container > * { position: relative; z-index: 1; }

/* =========================================================
   FORMS
   ========================================================= */
.parameters form { max-width: 760px; }

.form-group {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.form-group label {
  flex: 0 0 210px;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  margin: 0;
}

.form-group .control { flex: 1; display: flex; }

.parameters input,
.parameters select,
.parameters textarea,
.input-field {
  width: 100%;
  max-width: 420px;
  background-color: #0b2b55;
  color: white;
  padding: 12px 15px;
  border: 1px solid rgba(0, 123, 255, 0.55);
  border-radius: 8px;
  font-size: 14px;
  transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: inset 0px 2px 4px rgba(0, 123, 255, 0.12);
}

.parameters input:focus,
.parameters select:focus,
.parameters textarea:focus,
.input-field:focus {
  outline: none;
  background-color: #124080;
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* =========================================================
   NEW: themed form controls inside table panels (but NOT inside tables)
   ========================================================= */
.table-container .form-group :is(input, select, textarea):not(table input):not(table select):not(table textarea),
.table-container :is(input, select, textarea).input-field:not(table input):not(table select):not(table textarea) {
  width: 100%;
  max-width: 420px;
  background-color: #0b2b55;
  color: white;
  padding: 12px 15px;
  border: 1px solid rgba(0, 123, 255, 0.55);
  border-radius: 8px;
  font-size: 14px;
  transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: inset 0px 2px 4px rgba(0, 123, 255, 0.12);
}

.table-container .form-group :is(input, select, textarea):focus:not(table input):not(table select):not(table textarea),
.table-container :is(input, select, textarea).input-field:focus:not(table input):not(table select):not(table textarea) {
  outline: none;
  background-color: #124080;
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* PMB */
.pmb-textarea {
  width: 100%;
  max-width: 820px;
  min-height: 180px;
  background-color: #0b2b55;
  color: white;
  padding: 12px 15px;
  border: 1px solid rgba(0, 123, 255, 0.55);
  border-radius: 8px;
  font-size: 16px;
  resize: vertical;
}

.pmb-textarea:focus {
  outline: none;
  background-color: #124080;
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.pmb-preview {
  margin-top: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.35;
  min-height: 44px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: rgba(235, 245, 255, 0.95);
}

.pmb-preview.valid { border-color: rgba(120, 170, 255, 0.35); }
.pmb-preview.invalid { border-color: rgba(255, 107, 107, 0.45); color: rgba(255, 190, 190, 0.95); }

#prepayment-parameters td input { max-width: 240px; }

/* =========================================================
   BUTTONS
   ========================================================= */
button { font: inherit; cursor: pointer; }

.add-btn,
.delete-btn {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.1;
  border: none;
  border-radius: 8px;
  min-width: auto;
  transform: none !important;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.add-btn {
  background: linear-gradient(to bottom, #1f7a4a, #165638);
  color: white;
  box-shadow: 0px 3px 6px rgba(31, 122, 74, 0.25);
}

.add-btn:hover { background: #206f45; box-shadow: 0px 5px 10px rgba(31, 122, 74, 0.35); }

.delete-btn {
  background: linear-gradient(to bottom, #923b3b, #6b2a2a);
  color: white;
  box-shadow: 0px 3px 6px rgba(146, 59, 59, 0.25);
}

.delete-btn:hover { background: #7f3232; box-shadow: 0px 5px 10px rgba(146, 59, 59, 0.35); }

.btn-primary,
.btn-secondary {
  padding: 0.875rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(180deg, rgba(0, 123, 255, 0.30), rgba(0, 70, 150, 0.25));
  border: 1px solid rgba(0, 123, 255, 0.25);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(180deg, rgba(0, 123, 255, 0.40), rgba(0, 70, 150, 0.35));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); transform: translateY(-2px); }

/* =========================================================
   REMOVED: .notification legacy styles
   (we use flash-host toasts only)
   ========================================================= */

#calculating {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.25);
  align-items: center;
  justify-content: center;
}

#calculating.show { display: flex !important; }

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top: 4px solid var(--accent-2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* =========================================================
   Scrollbars — cross-platform “Mac-like” light gray thumb
   ========================================================= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.30);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-corner { background: transparent; }

/* Ensure TableEngine scroll wrappers match the same scrollbar styling
   (useful if bundled table css tries to override). */
.table-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.34) transparent;
}
.table-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.30);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
.table-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
  border: 3px solid transparent;
  background-clip: padding-box;
}
.table-scroll::-webkit-scrollbar-corner { background: transparent; }

/* =========================================================
   PANEL HELPERS (shared “header + subtle text + footnote”)
   ========================================================= */
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.panel-head-left{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.panel-subtle{
  margin:0;
  opacity:0.9;
  white-space:nowrap;
  color: rgba(230, 245, 255, 0.78);
  font-size: 13px;
}

.panel-footnote{
  margin-top: 10px;
  font-size: 12px;
  color: rgba(230, 245, 255, 0.70);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .topmenu-btn { display: inline-flex; }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1.0rem;
    padding: 1rem;
    min-height: auto;
  }

  .main-content { padding: 1rem; }

  .hero { padding: 2.5rem 1rem; }
  .hero h1 { font-size: 2.2rem; }
  .hero p { font-size: 1.1rem; }

  .features { grid-template-columns: 1fr; padding: 1rem; }

  /* On small screens the navbar height changes (stacked),
     so keep a fixed top for the panel. */
  .topmenu-panel {
    right: 1rem;
    width: calc(100vw - 2rem);
    top: 92px;
  }

  /* Toast width on small screens */
  .flash-host{
    left: 12px;
    max-width: calc(100vw - 24px);
  }
}