/* LusoInsights signed-in shell: sidebar, rail, drawer, theme tokens (nav-2026-10-31) */

:root {
  --page: linear-gradient(135deg, #fbf9f4 0%, #f6e8d3 55%, #f0dab9 100%);
  --side: rgba(255, 255, 255, .55);
  --drawer: #f5f3ee;
  --blur: blur(18px) saturate(130%);
  --line: rgba(26, 37, 53, .10);
  --ink: #1a2535;
  --muted: #34445c;
  --dim: #4d5c72;
  --goldink: #86561b;
  --panel: rgba(255, 255, 255, .60);
  --pline: rgba(26, 37, 53, .12);
  --chip: rgba(255, 255, 255, .65);
  --cline: rgba(26, 37, 53, .16);
  --navon: rgba(226, 178, 115, .42);
  --track: rgba(26, 37, 53, .12);
  --tag: rgba(26, 37, 53, .22);
  --dash: rgba(26, 37, 53, .28);
  --feat: linear-gradient(135deg, rgba(226, 178, 115, .45), rgba(255, 255, 255, .65));
  --featline: rgba(134, 86, 27, .40);
  --scrim: rgba(26, 37, 53, .28);
  --switch-off: rgba(26, 37, 53, .30);
  --shadow: 0 1px 4px rgba(26, 37, 53, .08);
  --danger: #8c3c3c;
  --sidew: 264px;
  --topbar: 64px;
}

:root.dark {
  --page: #1a2535;
  --side: #0c1622;
  --drawer: #0c1622;
  --blur: none;
  --line: rgba(245, 243, 238, .08);
  --ink: #f5f3ee;
  --muted: #b7c0cb;
  --dim: #8c99aa;
  --goldink: #e2b273;
  --panel: rgba(245, 243, 238, .05);
  --pline: rgba(245, 243, 238, .10);
  --chip: rgba(245, 243, 238, .06);
  --cline: rgba(245, 243, 238, .12);
  --navon: rgba(226, 178, 115, .14);
  --track: rgba(245, 243, 238, .12);
  --tag: rgba(245, 243, 238, .18);
  --dash: rgba(245, 243, 238, .20);
  --feat: linear-gradient(135deg, rgba(226, 178, 115, .16), rgba(245, 243, 238, .05));
  --featline: rgba(226, 178, 115, .35);
  --scrim: rgba(12, 22, 34, .62);
  --switch-off: rgba(245, 243, 238, .25);
  --shadow: none;
  --danger: #e59a9a;
}

/* Solid fallback where backdrop-filter is unsupported (light theme only sets a blur) */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --side: #f5f3ee;
    --panel: #f5f3ee;
    --chip: #f5f3ee;
    --feat: #f6e8d3;
  }
  :root.dark {
    --side: #0c1622;
    --panel: #1a2535;
    --chip: #1a2535;
    --feat: #1a2535;
  }
}

/* ---------- App page theming ---------- */
html.li-app { background: #f5f3ee; }
html.li-app.dark { background: #1a2535; }

html.li-app body {
  background: var(--page);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  padding-left: var(--sidew);
}

html.li-app .navbar { display: none; }

html.li-app h1,
html.li-app h2,
html.li-app h3,
html.li-app h4 { color: var(--ink); }
html.li-app p { color: var(--muted); }

html.li-app .members-header,
html.li-app .dashboard-header,
html.li-app .forex-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
}
html.li-app .members-header p,
html.li-app .dashboard-header p,
html.li-app .forex-header p { color: var(--muted); }
html.li-app .members-header h1,
html.li-app .dashboard-header h1,
html.li-app .forex-header h1 { color: var(--ink); }

html.li-app .members-body,
html.li-app .dashboard-body,
html.li-app .forex-body,
html.li-app .auth-guard-loading { background: transparent; }

html.li-app .brief-card,
html.li-app .brief-content,
html.li-app .kpi-card,
html.li-app .chart-card,
html.li-app .forex-card,
html.li-app .dashboard-embed,
html.li-app .account-panel,
html.li-app .identity-card,
html.li-app .indicators-table,
html.li-app .forex-table {
  background: var(--panel);
  border-color: var(--pline);
  color: var(--ink);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}
html.li-app .brief-content p,
html.li-app .brief-content li,
html.li-app .brief-title,
html.li-app .kpi-value,
html.li-app .chart-title,
html.li-app .indicators-table td,
html.li-app .forex-table td { color: var(--ink); }
html.li-app .brief-summary,
html.li-app .kpi-label,
html.li-app .kpi-period,
html.li-app .loading-msg,
html.li-app .forex-updated,
html.li-app .data-footnote { color: var(--muted); }
html.li-app .brief-date,
html.li-app .brief-content h2,
html.li-app .section-label { color: var(--goldink); }
html.li-app .brief-content h2 { border-bottom-color: var(--pline); }

html.li-app .indicators-table tbody tr:hover,
html.li-app .forex-table tbody tr:hover { background: var(--navon); }
html.li-app .indicators-table thead tr,
html.li-app .forex-table thead tr { background: var(--chip); }

html.li-app .country-tab,
html.li-app .filter-tab,
html.li-app .view-toggle button {
  background: var(--chip);
  border-color: var(--cline);
  color: var(--muted);
}
html.li-app .country-tab.active,
html.li-app .filter-tab.active,
html.li-app .view-toggle button.active {
  background: #e2b273;
  border-color: #e2b273;
  color: #1a2535;
}
html.li-app .field input {
  background: var(--chip);
  border-color: var(--cline);
  color: var(--ink);
}

/* Footer: dark shell keeps the slate variables from main.css; the light shell swaps them (all text 4.5:1 or better
   against the lightest and darkest part of the peach page background). */
html.li-app .footer {
  background: transparent;
  border-top: 1px solid var(--line);
}
html.li-app:not(.dark) .footer {
  --ft-head: #86561b;
  --ft-luso: #86561b;
  --ft-ins: #1a2535;
  --ft-text: #34445c;
  --ft-link: #34445c;
  --ft-hover: #86561b;
  --ft-line: rgba(26, 37, 53, 0.15);
}
html.li-app:not(.dark) .footer .footer-mark-dark { display: none; }
html.li-app:not(.dark) .footer .footer-mark-light { display: block; }

html.li-app :focus-visible {
  outline: 2px solid var(--goldink);
  outline-offset: 2px;
}

/* ---------- Sidebar ---------- */
.li-top,
.li-scrim { display: none; }

.li-side {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 900;
  width: var(--sidew);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 16px;
  background: var(--side);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-body, system-ui, sans-serif);
  overflow: hidden;
}

.li-shell .icon { width: 20px; height: 20px; vertical-align: 0; }

.li-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px;
}

.li-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-radius: 10px;
  color: var(--ink);
}
.li-logo img { width: 36px; height: 36px; flex: none; }
.li-word {
  font-family: var(--font-display, Georgia, serif);
  font-weight: 700;
  font-size: 1.3125rem;
  line-height: 1;
  color: var(--ink);
}
.li-word .ins { color: var(--goldink); }

.li-iconbtn {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--cline);
  background: var(--chip);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.li-iconbtn:hover { color: var(--ink); }
.li-close { display: none; }

.li-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.li-group-title {
  font-family: var(--font-mono, 'DM Mono', ui-monospace, monospace);
  font-size: 0.6875rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0 14px 6px;
}
.li-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.li-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9063rem;
  font-weight: 500;
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
}
.li-link:hover { color: var(--ink); background: var(--chip); }
.li-link[aria-current="page"] {
  background: var(--navon);
  color: var(--ink);
  font-weight: 700;
}
.li-link[aria-current="page"] .icon { color: var(--goldink); }

.li-foot { flex: none; display: flex; flex-direction: column; gap: 14px; }

.li-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--cline);
  background: var(--chip);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}
.li-toggle-main { display: inline-flex; align-items: center; gap: 10px; }
.li-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex: none;
  border-radius: 99px;
  background: var(--switch-off);
}
.li-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f5f3ee;
  transition: transform .18s ease;
}
.li-toggle[aria-pressed="true"] .li-switch { background: #e2b273; }
.li-toggle[aria-pressed="true"] .li-switch::after { transform: translateX(18px); }

.li-plan {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--pline);
}
.li-plan-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.li-plan-name { font-size: 0.875rem; font-weight: 700; color: var(--ink); }
.li-plan-meta {
  font-family: var(--font-mono, 'DM Mono', ui-monospace, monospace);
  font-size: 0.6875rem;
  color: var(--muted);
}
.li-bar {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}
.li-bar::-webkit-progress-bar { background: var(--track); }
.li-bar::-webkit-progress-value { background: #e2b273; border-radius: 99px; }
.li-bar::-moz-progress-bar { background: #e2b273; border-radius: 99px; }
.li-plan-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--goldink);
}
.li-plan-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 12px;
  background: #e2b273;
  color: #1a2535;
  font-size: 0.875rem;
  font-weight: 700;
}

.li-account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 10px;
  border-radius: 14px;
  color: var(--ink);
}
.li-account:hover { background: var(--chip); }
.li-avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: #e2b273;
  color: #1a2535;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9375rem;
}
.li-account-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.li-account-name {
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.li-account-sub { font-size: 0.75rem; color: var(--dim); }

/* ---------- Collapsed rail (desktop only) ---------- */
@media (min-width: 900px) {
  html.li-rail { --sidew: 84px; }

  html.li-rail .li-side { overflow: visible; align-items: center; padding: 16px 12px; gap: 14px; }
  html.li-rail .li-head { flex-direction: column; padding: 0; }
  html.li-rail .li-word,
  html.li-rail .li-group-title,
  html.li-rail .li-label,
  html.li-rail .li-plan,
  html.li-rail .li-account-text,
  html.li-rail .li-toggle-text,
  html.li-rail .li-switch { display: none; }
  html.li-rail .li-scroll { overflow: visible; align-items: center; gap: 14px; }
  html.li-rail .li-group { align-items: center; }
  html.li-rail .li-link,
  html.li-rail .li-toggle,
  html.li-rail .li-account {
    width: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
  }
  html.li-rail .li-foot { align-items: center; }

  html.li-rail .li-link::after,
  html.li-rail .li-toggle::after,
  html.li-rail .li-account::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 10px;
    background: #1a2535;
    color: #f5f3ee;
    font-size: 0.8438rem;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
  }
  html.li-rail .li-link:hover::after,
  html.li-rail .li-link:focus-visible::after,
  html.li-rail .li-toggle:hover::after,
  html.li-rail .li-toggle:focus-visible::after,
  html.li-rail .li-account:hover::after,
  html.li-rail .li-account:focus-visible::after { opacity: 1; }
  html.li-rail .li-account { position: relative; }
  html.li-rail .li-toggle { position: relative; }
}

/* ---------- Mobile: top bar + drawer ---------- */
@media (max-width: 899px) {
  html.li-app body { padding-left: 0; padding-top: var(--topbar); }

  .li-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 800;
    height: var(--topbar);
    box-sizing: border-box;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    background: var(--side);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--line);
  }
  .li-top .li-logo { justify-self: center; gap: 8px; }
  .li-top .li-logo img { width: 28px; height: 28px; }
  .li-top .li-word { font-size: 1.1875rem; }
  .li-top .li-menu { border: 0; background: transparent; color: var(--ink); }
  .li-top .li-avatar-link {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }
  .li-top .li-avatar { width: 32px; height: 32px; font-size: 0.875rem; }

  .li-side {
    width: 312px;
    max-width: 88vw;
    background: var(--drawer);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
    padding: 16px 14px;
    gap: 22px;
  }
  html.li-open .li-side {
    transform: translateX(0);
    visibility: visible;
    transition: transform .22s ease, visibility 0s;
  }
  .li-collapse { display: none; }
  .li-close { display: inline-flex; }
  .li-link { min-height: 48px; font-size: 0.9375rem; }

  .li-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 850;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  html.li-open .li-scrim { opacity: 1; pointer-events: auto; }

  html.li-lock,
  html.li-lock body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .li-side,
  .li-scrim,
  .li-switch::after { transition: none; }
}

/* ---------- Short viewports: compact the footer, let the middle scroll ---------- */
@media (max-height: 700px) {
  .li-side { padding-top: 14px; padding-bottom: 12px; gap: 12px; }
  .li-side { overflow-y: auto; overscroll-behavior: contain; }
  .li-scroll { flex: none; overflow: visible; }
  .li-scroll { gap: 14px; }
  .li-group { gap: 2px; }
  .li-group-title { padding-bottom: 2px; }
  .li-foot { gap: 8px; }
  .li-toggle { min-height: 44px; }
  .li-plan { padding: 10px 12px; gap: 4px; }
  .li-bar { display: none; }
  .li-plan-link { min-height: 32px; }
  .li-account { min-height: 48px; }
}
@media (min-width: 900px) and (max-height: 640px) {
  html.li-rail .li-scroll { overflow-y: auto; overflow-x: hidden; }
}

/* ---------- Shared fixes on app pages ---------- */
.auth-guard-loading[hidden] { display: none !important; }
html.li-app .flag { display: inline-block; }
.li-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--goldink);
}
.li-state {
  max-width: 480px;
  margin: 48px auto;
  padding: 36px 28px;
  text-align: center;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--pline);
}
.li-state-title { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.li-state p { font-size: 0.92rem; color: var(--muted); margin: 0 0 20px; }
.li-state p.li-state-error { color: var(--danger); }
.li-state-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 8px;
  background: #e2b273;
  color: #1a2535;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Counts inside the active Jump to link sit on the active tint: use the stronger text token */
.ba-jump-link[aria-current="true"] .ba-count { color: var(--muted); }

/* Locked insight cards (Free accounts): title, country and date only; the text never reaches the browser */
.brief-card.is-locked { cursor: default; opacity: .92; border-style: dashed; }
.brief-card.is-locked:hover { border-color: var(--pline); box-shadow: none; }
.brief-card.is-locked .brief-title { color: var(--ink); }
.lock-note { margin: 6px 0 0; font-size: 0.85rem; color: var(--muted); }
.lock-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--goldink); font-weight: 700; font-size: 0.9rem; }
.lock-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; color: var(--goldink); }
.lock-tag .icon { width: 14px; height: 14px; }
