:root { --bg:#0a0a0a; --card:#111; --text:#eee; --muted:#999; --line:#222; }
* { box-sizing: border-box; }
body.bg { margin:0; font-family: Inter, ui-sans-serif, system-ui; color: var(--text); background: radial-gradient(circle at 10% 0%, #0c0c0c, #000); }
.nav { display:flex; justify-content:space-between; align-items:center; padding:12px 20px; border-bottom:1px solid var(--line); position:sticky; top:0; backdrop-filter: blur(6px); background: rgba(0,0,0,0.5); }
.brand { display:flex; align-items:center; gap:10px; }
.logo { width:28px; height:28px; filter: grayscale(1) invert(1); }
.logo-lg { width:64px; height:64px; filter: grayscale(1) invert(1); margin-bottom:8px; }
.brandname { font-weight:700; letter-spacing:.5px; }
.menu a { color: var(--muted); text-decoration:none; margin: 0 8px; }
.menu a:hover { color: var(--text); }
.container { max-width:1200px; margin: 24px auto; padding: 0 16px; }
.h2 { font-size:22px; margin: 8px 0 16px; }
.center-card { width:min(420px, 92vw); margin:60px auto; background:linear-gradient(180deg, #111, #080808); border:1px solid #1b1b1b; border-radius:16px; padding:24px; box-shadow: 0 10px 40px rgba(255,255,255,0.02); text-align:center; }
.title { margin:0 0 6px; }
.alert { background:#1a1a1a; border:1px solid #2a2a2a; padding:8px 10px; border-radius:8px; margin-bottom:10px; }
.form { display:grid; gap:10px; text-align:left; }
.form label { display:grid; gap:6px; font-size:14px; color:#ddd; }
.form input, .form select { background:#0c0c0c; color:#eee; border:1px solid #2a2a2a; border-radius:10px; padding:10px 12px; }
.btn { background:#eaeaea; color:#000; border:none; padding:10px 14px; border-radius:12px; cursor:pointer; font-weight:600; }
.btn.secondary { background:#181818; color:#ddd; border:1px solid #2a2a2a; }
.btn.small { padding:6px 10px; border-radius:8px; font-size:12px; }
.btn.danger { background:#2b0000; color:#fff; border:1px solid #500; }
.toolbar { display:flex; gap:10px; align-items:center; margin: 10px 0 16px; }
.muted { color: var(--muted); font-size:12px; }
.grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap:14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.tile { display:block; padding:18px; border:1px solid #1f1f1f; border-radius:18px; background: linear-gradient(180deg,#111,#0b0b0b); text-decoration:none; color:#fff; font-weight:600; text-align:center; }
.tile:hover { border-color:#2a2a2a; transform: translateY(-2px); transition: 120ms; }
.table { width:100%; border-collapse: collapse; background:#0d0d0d; border:1px solid #1c1c1c; border-radius:12px; overflow:hidden; }
.table th, .table td { border-bottom:1px solid #1a1a1a; padding:10px; font-size:14px; }
.table th { text-align:left; color:#ccc; background:#111; }
.hoverable tbody tr:hover { background:#0f0f0f; }
.right { text-align:right; }
.linklike { color:#fff; text-decoration:underline; cursor:pointer; }
.subtable { width:100%; border-collapse: collapse; }
.subtable td { padding:6px 8px; border-bottom:1px dashed #222; }
.pager { display:flex; gap:6px; margin:14px 0; }
.page { padding:6px 10px; border-radius:8px; border:1px solid #222; }
.page.current { background:#fff; color:#000; border-color:#fff; }
.modal { position:fixed; inset:0; background:rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; }
.modal-card { background:#0f0f0f; border:1px solid #1f1f1f; padding:18px; border-radius:12px; width:min(420px,92vw); display:grid; gap:10px; }
.cards { display:grid; grid-template-columns: repeat(auto-fill, minmax(360px,1fr)); gap:16px; }
.card { background:#101010; border:1px solid #1f1f1f; border-radius:14px; padding:12px; }
.card-header { font-weight:700; margin-bottom:8px; }
.filters { display:flex; flex-wrap:wrap; gap:8px 12px; align-items:end; margin: 8px 0 16px; }
.row { display:flex; gap:10px; justify-content:flex-end; }
.row-actions { visibility:hidden; display:flex; gap:6px; }
.hoverable tbody tr:hover .row-actions { visibility:visible; }

/* ==== Public landing hero ==== */
.logo-xxl { width:84px; height:84px; filter: grayscale(1) invert(1); margin-bottom:18px; opacity:.95; }

.hero { position:relative; min-height:calc(100vh - 72px); display:grid; place-items:center; overflow:hidden; }
.hero-inner {
  width:min(900px, 92vw);
  text-align:center;
  padding: 48px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  box-shadow: 0 18px 80px rgba(255,255,255,0.04), inset 0 0 40px rgba(255,255,255,0.02);
  backdrop-filter: blur(6px);
}
.hero-title {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
  margin: 6px 0 10px;
  letter-spacing: .4px;
}
.hero-title .accent {
  background: linear-gradient(90deg, #fff, #cfcfcf);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  color: #cfcfcf;
  max-width: 720px;
  margin: 0 auto 18px;
  font-size: 15px;
}
.inline-link { color:#fff; text-decoration: underline; text-underline-offset: 3px; }

.hero-actions { display:flex; gap:12px; justify-content:center; margin: 18px 0 8px; }
.btn.primary { background:#fff; color:#000; }
.btn.ghost { background:transparent; color:#e1e1e1; border:1px solid #2a2a2a; }
.btn.ghost:hover { background:#121212; }

.hero-footnote { margin-top: 12px; color:#9a9a9a; font-size:12px; }

/* Subtle animated beams */
.beams { position:absolute; inset:0; pointer-events:none; overflow:hidden; }
.beams span {
  position:absolute; left:-20%; width:140%; height:2px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  filter: blur(0.3px);
  animation: drift 9s linear infinite;
}
.beams span:nth-child(1){ top:18%; animation-delay:0s; opacity:.6; }
.beams span:nth-child(2){ top:38%; animation-delay:1.2s; opacity:.35; }
.beams span:nth-child(3){ top:58%; animation-delay:2.4s; opacity:.5; }
.beams span:nth-child(4){ top:78%; animation-delay:3.6s; opacity:.3; }
@keyframes drift { from { transform: translateX(-10%) } to { transform: translateX(10%) } }

/* Solid black background for pages that set plain_bg */
.bg-plain { margin:0; font-family: Inter, ui-sans-serif, system-ui; color: var(--text); background: #000; }

/* Make the public hero flat (no box) */
.hero.flat .hero-inner {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 48px 20px; /* keep spacing */
}

/* Remove decorative lines if any remain */
.hero .beams { display: none !important; }

/* Title + logo row */
.title-with-logo {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .title-with-logo.center { justify-content: center; }
  .title-with-logo.left   { justify-content: flex-start; }
  
  /* Inline logo next to headings — keep original colors */
  .logo-inline { width: 32px; height: 32px; filter: none; opacity: 1; mix-blend-mode: normal; }
  
  /* If your logo is dark and can vanish on black, use this optional badge: */
  .logo-inline-badge {
    display:inline-flex; align-items:center; justify-content:center;
    width: 40px; height: 40px; border-radius: 9999px;
    background: #fff; box-shadow: 0 2px 12px rgba(255,255,255,0.15);
  }
  .logo-inline-badge > img { max-width: 70%; max-height: 70%; }
  
 /* ==== Sidebar (slide-in) ==== */
.sidebar {
    position: fixed; top:0; left:0; bottom:0; width: 240px;
    background:#0a0a0a; border-right:1px solid #1c1c1c;
    padding:12px; display:flex; flex-direction:column; gap:12px; z-index:20;
    transform: translateX(0); transition: transform .22s ease-out;
  }
  .sidebar .sb-top { display:flex; align-items:center; gap:10px; }
  .sb-user { display:flex; align-items:center; gap:10px; overflow:hidden; }
  .sb-username { white-space:nowrap; text-overflow:ellipsis; overflow:hidden; font-weight:600; }
  .sb-menu { display:flex; flex-direction:column; gap:4px; padding:6px 0; overflow:auto; }
  .sb-item { display:block; padding:10px 12px; border-radius:10px; color:#ddd; text-decoration:none; }
  .sb-item:hover { background:#121212; color:#fff; }
  .sb-bottom { margin-top:auto; display:flex; flex-direction:column; gap:6px; }
  .sb-ver { font-size:11px; padding:0 10px; }
  
  /* Collapsed: sidebar completely hidden (off-canvas) */
  body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  
  /* Content spacing relative to sidebar */
  .content { margin-left: 240px; padding: 24px 16px; transition: margin-left .22s ease-out; }
  body.sidebar-collapsed .content { margin-left: 0; }
  body.no-sidebar .content { margin-left: 0; }
  
/* Floating arrow toggle — docked mid-left so it never covers titles */
.sb-fab {
    position: fixed;
    top: 50%;                      /* center vertically */
    left: 220px;                   /* hugs the sidebar edge when open */
    transform: translateY(-50%);   /* true vertical centering */
    z-index: 30;
    width: 38px; height: 38px;     /* a bit smaller */
    display: grid; place-items: center;
    background:#181818; color:#eee;
    border:1px solid #2a2a2a; border-radius:9999px;
    padding:0; cursor:pointer;
    box-shadow: 0 4px 18px rgba(0,0,0,.35);
    transition: left .22s ease-out, background .15s;
  }
  .sb-fab:hover { background:#1f1f1f; }
  .sb-fab .icon { display:inline-block; transition: transform .2s ease; }
  
  /* When collapsed: slide to the screen edge and flip the arrow */
  body.sidebar-collapsed .sb-fab { left: 12px; }
  body.sidebar-collapsed .sb-fab .icon { transform: rotate(180deg); }
  
  /* Mobile: keep it clear of top nav chrome */
  @media (max-width: 780px) {
    .sb-fab { top: 60%; }          /* nudge a bit lower on small screens */
  }
  
  /* Keep logo helpers */
  .logo-wrap.s { width:36px; height:36px; }
  /* defaults */
:root { --sb-font-size: 14px; --sb-username-size: 14px; --sb-ver-size: 11px; }

.sidebar .sb-item       { font-size: var(--sb-font-size); }
.sidebar .sb-username   { font-size: var(--sb-username-size); }
.sidebar .sb-ver        { font-size: var(--sb-ver-size); }

/* presets you can toggle on <body> */
body.sb-text-sm  { --sb-font-size: 12px; --sb-username-size: 12px; --sb-ver-size: 10px; }
body.sb-text-md  { --sb-font-size: 14px; --sb-username-size: 14px; --sb-ver-size: 11px; } /* default */
body.sb-text-lg  { --sb-font-size: 16px; --sb-username-size: 16px; --sb-ver-size: 12px; }

/* ==== Tile grid (unchanged) ==== */
.tile-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap:16px; }

/* ==== Circular tile with centered, uncropped image ==== */
.tile-figure { display:flex; flex-direction:column; align-items:center; text-decoration:none; color:#eee; }

.tile-figure .thumb {
  width: 180px;                 /* base size; scales via media queries below */
  aspect-ratio: 1 / 1;          /* always a square */
  border-radius: 9999px;        /* makes it a circle */
  background:#0f0f0f;
  border:1px solid #1f1f1f;
  display:flex; align-items:center; justify-content:center;
  overflow: hidden;             /* keep the circle shape clean */
  padding: 14px;                /* breathing room for contain-fit images */
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tile-figure .thumb:hover { transform: translateY(-2px); border-color:#2a2a2a; box-shadow: 0 6px 24px rgba(0,0,0,.35); }

/* Image: center and fit WITHOUT crop */
.tile-figure .thumb img {
  width: 100%; height: 100%;
  object-fit: contain;          /* no crop */
  object-position: center;      /* centered */
  display:block;
}

/* Label under the circle (not bold) */
.tile-figure .caption {
  margin-top:10px;
  font-weight: 400;             /* ensure not bold */
  color:#d8d8d8;
  text-align:center;
  line-height:1.3;
}

/* Responsive sizes */
@media (min-width: 900px) { .tile-figure .thumb { width: 200px; } }
@media (max-width: 599px) { .tile-figure .thumb { width: 150px; padding: 12px; } }


/* ===== Modal ===== */
.modal.hidden { display:none; }
.modal { position: fixed; inset:0; z-index: 40; }
.modal-backdrop { position:absolute; inset:0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.modal-card {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(720px, 92vw);
  background: #0b0b0b; border:1px solid #1f1f1f; border-radius: 16px;
  box-shadow: 0 20px 80px rgba(0,0,0,.6);
}
.modal-head, .modal-foot { padding: 14px 16px; border-bottom:1px solid #141414; }
.modal-foot { border-top:1px solid #141414; border-bottom:none; display:flex; gap:10px; justify-content:flex-end; }
.modal-body { padding: 16px; display:flex; flex-direction:column; gap:12px; }
.modal-head { display:flex; align-items:center; justify-content:space-between; }
.icon-btn { background:#151515; color:#ddd; border:1px solid #2a2a2a; border-radius:8px; padding:6px 10px; cursor:pointer; }
.icon-btn:hover { background:#1c1c1c; }

/* Simple grids */
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display:grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px){ .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Inputs with no labels (just placeholders) */
.in { background:#0e0e0e; color:#eee; border:1px solid #262626; border-radius:10px; padding:10px 12px; width:100%; }
.in::placeholder { color:#8d8d8d; }
.ck { display:flex; align-items:center; gap:8px; color:#ccc; }

/* Filter chips above table */
.filter-chips { display:flex; flex-wrap:wrap; gap:8px; margin: 6px 0 12px; }
.chip {
  background:#121212; border:1px solid #222; color:#ddd;
  padding:6px 10px; border-radius:999px; font-size: 12px;
}

/* Pagination: unselected white (not blue) */
.pager a { color:#fff !important; border:1px solid #2a2a2a; background:transparent; }
.pager a:hover { background:#121212; }
.pager a.active { background:#0f0f0f; color:#fff; border-color:#2a2a2a; }
/* small title above each date range group */
.range-title {
    color:#cfcfcf; font-weight:600; margin: 4px 0 8px;
  }
  
  /* White calendar icon inside <input type="date"> (WebKit/Blink) */
  .in.date::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.3); opacity: 1;
  }
  .in.date::-webkit-datetime-edit { color:#eee; }
  
  /* Firefox has limited styling hooks; the input text color is already light */
/* Chart filter popover sizing & spacing */
.popover-card{
    width: 340px;                 /* more room */
    padding: 14px;
    border-radius: 14px;
  }
  .popover .in{ width:100%; }     /* inputs stretch to full card width */
  #cf-range{ margin-bottom: 10px; }
  
  /* The custom-from/to group should be vertical with nice spacing */
  #cf-custom-row{
    display:none;                 /* shown only when 'custom' */
    flex-direction: column;       /* stack vertically */
    gap: 10px;
  }
  
  /* On very small screens, give it even more breathing room */
  @media (max-width: 420px){
    .popover-card{ width: 92vw; }
  }
  .area-gender .filter-btn,
  .area-age .filter-btn,
  .area-country .filter-btn { display: none !important; }
  .hidden { display: none !important; }
