/* CK Data — brand tokens */
:root {
  --ck-gold: #F0A030;
  --ck-navy: #2C3E50;
  --ck-green: #2ECC71;
  --ck-red: #E74C3C;

  /* Sector colors */
  --ck-equities: #5B8DEF;
  --ck-metals: #F0A030;
  --ck-energy: #E25822;
  --ck-fx: #2ECC71;
  --ck-agricultural: #8BC34A;
  --ck-treasuries: #9B59B6;
}

[data-mantine-color-scheme="dark"] {
  --mantine-color-body: #1a1b1e;
}

/* ── Login overlay (transparent paywall) ────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 14, 0.6);
  backdrop-filter: blur(4px);
  animation: overlay-fade-in 0.4s ease;
}
@keyframes overlay-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes card-slide-up {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes accent-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Card ── */
.login-overlay-card {
  position: relative;
  overflow: visible;
  background: rgba(30, 31, 36, 0.92);
  border: 1px solid rgba(240, 160, 48, 0.12);
  border-radius: 16px;
  padding: 0 36px 32px;
  width: calc(100% - 32px);
  max-width: 400px;
  box-shadow:
    0 0 0 1px rgba(240, 160, 48, 0.06),
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 16px 56px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(1.4);
  animation: card-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Gold accent bar at top */
.login-overlay-accent {
  height: 3px;
  margin: 0 -36px 16px;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--ck-gold) 30%,
    #ffd078 50%,
    var(--ck-gold) 70%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: accent-shimmer 3s ease-in-out infinite;
  opacity: 0.85;
}

/* ── Logo ── */
.login-overlay-logo {
  text-align: center;
  margin-bottom: 12px;
}
.login-overlay-logo-img {
  height: 38px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(240, 160, 48, 0.2));
}

/* ── Header (lock + text) ── */
.login-overlay-header {
  text-align: center;
  margin-bottom: 18px;
}
.login-overlay-lock-icon {
  font-size: 20px;
  margin-bottom: 6px;
  filter: grayscale(0.2);
}
.login-overlay-header h3 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
  color: #f5f6f7;
  letter-spacing: -0.3px;
}
.login-overlay-header p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #909296;
  max-width: 300px;
  margin-inline: auto;
}

/* ── Form fields ── */
.login-overlay-field {
  margin-bottom: 14px;
}
.login-overlay-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #868e96;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
/* Dash dcc.Input renders <div class="login-overlay-input"><input/></div> */
.login-overlay-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.login-overlay-input input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  background: rgba(20, 21, 24, 0.7);
  border: 1px solid #2e3035;
  border-radius: 10px;
  color: #f5f6f7;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-overlay-field > div {
  width: 100%;
}
.login-overlay-input input::placeholder {
  color: #4a4d54;
}
.login-overlay-input input:focus {
  border-color: var(--ck-gold);
  box-shadow: 0 0 0 3px rgba(240, 160, 48, 0.1);
}

/* ── Primary button ── */
.login-overlay-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 0;
  margin-top: 6px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--ck-gold) 0%, #d88e2a 100%);
  color: #1a1b1e;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 12px rgba(240, 160, 48, 0.25);
}
.login-overlay-btn-primary:hover {
  background: linear-gradient(135deg, #f5b040 0%, #e09530 100%);
  box-shadow: 0 4px 20px rgba(240, 160, 48, 0.35);
  transform: translateY(-1px);
}

/* ── X / Twitter button ── */
.login-overlay-btn-x {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: #000;
  color: #fff;
  border: 1px solid #2a2c31;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
  letter-spacing: 0.2px;
}
.login-overlay-btn-x:hover {
  background: #161616;
  border-color: #444;
  color: #fff !important;
  transform: translateY(-1px);
}

/* ── Divider ── */
.login-overlay-divider-text {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  font-size: 11px;
  color: #4a4d54;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}
.login-overlay-divider-text::before,
.login-overlay-divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #2e3035, transparent);
}

/* ── Footer / Disclaimer ── */
.login-overlay-footer {
  margin-top: 22px;
}
.login-overlay-footer-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, #2e3035, transparent);
  margin-bottom: 14px;
}
.login-overlay-disclaimer {
  margin: 0;
  padding: 0 8px;
  font-size: 11px;
  line-height: 1.55;
  color: #5c5f66;
  text-align: center;
}

/* Keep anchors clean inside nav */
a { text-decoration: none; }
a:hover { color: var(--app-dimmed, #9aa1ad) !important; }

/* --- AG Grid: Settlement Board --- */
.ag-grid-products {
    border: 1px solid var(--app-border, #2a2c31);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.ag-grid-products .ag-root-wrapper {
    border: none !important;
    background: transparent !important;
}
.ag-grid-products .ag-header {
    border-bottom: 1px solid var(--app-border, #2a2c31) !important;
    background: transparent !important;
}
.ag-grid-products .ag-header-cell,
.ag-grid-products .ag-header-group-cell {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.24px;
    text-transform: uppercase;
    color: var(--app-dimmed, #9aa1ad);
}
.ag-grid-products .ag-header-cell-label {
    justify-content: flex-start;
}
.ag-grid-products .ag-right-aligned-header .ag-header-cell-label {
    flex-direction: row;
}
.ag-grid-products .ag-cell {
    font-size: 11px;
    font-weight: 400;
    line-height: 1.25;
    display: flex;
    align-items: center;
    color: var(--app-text, #f5f6f7);
    border-right: 1px solid rgba(128,128,128,0.15);
}
.ag-grid-products .ag-cell:last-child {
    border-right: none;
}
.ag-grid-products .ag-header-cell {
    border-right: 1px solid rgba(128,128,128,0.15);
}
.ag-grid-products .ag-header-cell:last-child {
    border-right: none;
}
.ag-grid-products .ag-row {
    background: transparent !important;
    border-bottom: 1px solid rgba(128,128,128,0.15);
}
.ag-grid-products .ag-row-odd {
    background: transparent !important;
}
.ag-grid-products .ag-row:hover {
    background: color-mix(in srgb, var(--app-hover, #1d1f24) 72%, transparent) !important;
}
.ag-grid-products .ag-value-pos {
    color: #4ade80;
    font-weight: 700;
}
.ag-grid-products .ag-value-neg {
    color: #f87171;
    font-weight: 700;
}

/* --- Light theme overrides --- */
[data-mantine-color-scheme='light'] {
    --app-bg: #ffffff;
    --app-surface: #ffffff;
    --app-surface-2: #f7f7f8;
    --app-border: #e6e7eb;
    --app-text: #111214;
    --app-dimmed: #6b7280;
    --app-hover: #f1f2f4;
}
[data-mantine-color-scheme='light'] .ag-grid-products .ag-value-pos {
    color: #15803d;
}
[data-mantine-color-scheme='light'] .ag-grid-products .ag-value-neg {
    color: #b91c1c;
}
/* --- Dark theme overrides --- */
[data-mantine-color-scheme='dark'] {
    --app-bg: #0b0b0c;
    --app-surface: #121214;
    --app-surface-2: #17181b;
    --app-border: #2a2c31;
    --app-text: #f5f6f7;
    --app-dimmed: #9aa1ad;
    --app-hover: #1d1f24;
}

/* --- Sidebar hover-popover rows --- */
.sidebar-hover-row {
    transition: background 0.12s ease;
    cursor: pointer;
}
.sidebar-hover-row:hover {
    background: var(--app-hover, rgba(255,255,255,0.06));
}

/* --- Docs TOC anchor links --- */
html { scroll-behavior: smooth; }
.toc-link:hover { color: var(--ck-gold) !important; }
.toc-section-link:hover { opacity: 0.8; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE LAYOUT
   ═══════════════════════════════════════════════════════════════ */

/* Sticky footer: content pushes footer to bottom on short pages */
.mantine-AppShell-main {
    display: flex !important;
    flex-direction: column !important;
    min-height: calc(100vh - 50px);   /* 50px = header height */
}
.mantine-AppShell-main > * {
    width: 100%;
}

/* Banner: wrap on narrow screens */
@media (max-width: 768px) {
    .ck-banner-inner {
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
        padding: 10px 12px !important;
    }
    .ck-banner-inner > * {
        flex-shrink: 1;
    }
}
@media (max-width: 480px) {
    .ck-banner-inner {
        padding: 8px !important;
    }
    .ck-banner-tagline {
        display: none !important;
    }
}

/* KPI pills: allow wrapping on small screens */
@media (max-width: 992px) {
    .mantine-Group-root[id*="kpis"] {
        flex-wrap: wrap;
    }
}

/* Footer: compact single-line bar (inside AppShellFooter, height=72) */
.ck-footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 72px;
    font-size: 11px;
    color: var(--mantine-color-dimmed);
    flex-wrap: nowrap;
    white-space: nowrap;
}
.ck-footer-brand {
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--mantine-color-text);
}
.ck-footer-link {
    color: var(--mantine-color-dimmed);
    text-decoration: none;
    font-weight: 600;
    font-size: 11px;
}
.ck-footer-link:hover { color: var(--mantine-color-text); }
.ck-footer-disclaimer {
    font-size: 9px;
    opacity: 0.6;
}
@media (max-width: 600px) {
    .ck-footer-inner { gap: 6px; font-size: 9px; }
    .ck-footer-disclaimer { display: none; }
}

/* Data cards only: reduce padding on smaller screens.
   Scoped to grid cards via .ck-data-card — does NOT touch docs, home, etc. */
@media (max-width: 768px) {
    .ck-data-card {
        padding: 12px !important;
    }
}
@media (max-width: 480px) {
    .ck-data-card {
        padding: 8px !important;
    }
}

/* AG Grid: horizontal scroll on narrow screens */
@media (max-width: 768px) {
    .ag-grid-products {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* --- AG Grid Tooltips (themed, compact) --- */
.ag-tooltip {
    font-size: 10px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    line-height: 1.3 !important;
    max-width: 240px !important;
}
[data-mantine-color-scheme='dark'] .ag-tooltip {
    background: #1e1f23 !important;
    color: #d0d0d0 !important;
    border: 1px solid #3a3c42 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}
[data-mantine-color-scheme='light'] .ag-tooltip {
    background: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #d0d1d5 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
}
