:root {
  --n-bg: #08090b;
  --n-surface: #0e1014;
  --n-surface-2: #14171c;
  --n-surface-3: #1b1f26;
  --n-line: rgba(255, 255, 255, 0.06);
  --n-line-strong: rgba(255, 255, 255, 0.1);
  --n-fg: #f2f4f7;
  --n-fg-2: #a8aeb8;
  --n-fg-3: #6b7280;
  --n-fg-4: #454b54;
  --n-blue: #2ea8ff;
  --n-blue-deep: #0e78c4;
  --n-blue-soft: rgba(46, 168, 255, 0.12);
  --n-red: #e5383b;
  --n-red-soft: rgba(229, 56, 59, 0.14);
  --n-green: #3fb950;
  --n-green-soft: rgba(63, 185, 80, 0.14);
  --n-yellow: #f5c542;
  --n-yellow-soft: rgba(245, 197, 66, 0.14);
  --n-purple: #9d7bff;
  --n-radius: 8px;
  --n-font-ui: "Space Grotesk", system-ui, sans-serif;
  --n-font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; max-width: 100%; overflow-x: clip; background: var(--n-bg); }
body.nclub-body { margin: 0; color: var(--n-fg); font-family: var(--n-font-ui); letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; flex-shrink: 0; }
::selection { background: rgba(46, 168, 255, 0.28); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--n-bg); }
::-webkit-scrollbar-thumb { background: var(--n-surface-3); border-radius: 4px; }
*:focus-visible { outline: 2px solid var(--n-blue); outline-offset: 2px; }
.htmx-indicator { opacity: 0; transition: opacity 180ms ease-in; }
.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request { opacity: 1; }
.search-loading {
  height: 0; margin: -20px 0 20px; overflow: hidden; pointer-events: none;
  color: var(--n-fg-3); font-family: var(--n-font-mono); font-size: 11px;
  transition: opacity 180ms ease-in, height 180ms ease-in, margin 180ms ease-in;
}
.search-loading.htmx-request {
  height: 34px; margin: -20px 0 20px;
}
.search-loading-bar {
  position: relative; height: 2px; overflow: hidden; border-radius: 999px;
  background: var(--n-surface-3);
}
.search-loading-bar::before {
  content: ""; position: absolute; inset: 0; width: 38%;
  border-radius: inherit; background: linear-gradient(90deg, transparent, var(--n-blue), transparent);
  animation: search-loading-sweep 950ms ease-in-out infinite;
}
.search-loading-copy {
  display: flex; align-items: center; gap: 8px; min-height: 30px;
}
.search-loading-dot {
  width: 6px; height: 6px; border-radius: 999px; background: var(--n-blue);
  box-shadow: 0 0 0 0 rgba(46, 168, 255, 0.35);
  animation: search-loading-pulse 950ms ease-in-out infinite;
}

.app-shell { min-height: 100vh; display: flex; background: var(--n-bg); }
.app-sidebar {
  position: sticky; top: 0; width: 232px; height: 100vh; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 18px 16px 14px;
  background: var(--n-surface); border-right: 1px solid var(--n-line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px 18px; border-bottom: 1px solid var(--n-line); margin-bottom: 14px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center;
  background: var(--n-surface-2); border: 1px solid var(--n-line-strong);
  color: var(--n-fg); font-family: var(--n-font-mono); font-weight: 700;
}
.brand-title { display: block; margin: 0; color: var(--n-fg); font-size: 14px; font-weight: 600; line-height: 1; }
.brand-title span { color: var(--n-blue); }
.brand-subtitle { display: block; margin-top: 4px; color: var(--n-fg-3); font-family: var(--n-font-mono); font-size: 9px; letter-spacing: 0.08em; }
.nav-section-label { padding: 4px 12px 6px; color: var(--n-fg-4); font-family: var(--n-font-mono); font-size: 10px; letter-spacing: 0.08em; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav-link {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 34px;
  padding: 8px 10px; border-radius: 6px; color: var(--n-fg-2); font-size: 13px; line-height: 1.2;
}
.side-nav-link:hover, .side-nav-link.is-active { background: var(--n-surface-3); color: var(--n-fg); }
.side-nav-link.is-active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--n-blue);
}
.side-nav-icon { width: 18px; color: var(--n-fg-3); text-align: center; }
.side-nav-link.is-active .side-nav-icon { color: var(--n-blue); }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--n-radius);
  background: var(--n-surface-2); border: 1px solid var(--n-line);
}
.avatar {
  width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: 6px;
  background: linear-gradient(135deg, var(--n-blue-deep), var(--n-blue));
  color: #fff; font-family: var(--n-font-mono); font-size: 12px; font-weight: 700; text-transform: uppercase;
}
.app-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.app-topbar {
  min-height: 64px; display: flex; align-items: center; gap: 16px; padding: 14px 24px;
  border-bottom: 1px solid var(--n-line); background: rgba(8, 9, 11, 0.96); backdrop-filter: blur(16px);
}
.page-kicker, .section-kicker { color: var(--n-fg-3); font-family: var(--n-font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.page-title { margin: 0; color: var(--n-fg); font-size: 22px; font-weight: 600; line-height: 1.15; }
.page-subtitle { margin-top: 4px; color: var(--n-fg-3); font-family: var(--n-font-mono); font-size: 11px; }
.topbar-search {
  width: min(320px, 36vw); display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-radius: 6px; background: var(--n-surface); border: 1px solid var(--n-line); color: var(--n-fg-3);
}
.topbar-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--n-fg); font: inherit; font-size: 13px; }
.app-content { width: 100%; max-width: 1220px; margin: 0 auto; padding: 24px; }
.app-content.is-wide { max-width: none; }
.mobile-topbar,
.mobile-bottom-nav,
.mobile-nav-sheet,
.mobile-nav-sheet-backdrop {
  display: none;
}

.n-card { background: var(--n-surface-2); border: 1px solid var(--n-line); border-radius: var(--n-radius); }
.n-card-hover { transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.n-card-hover:hover { border-color: rgba(46, 168, 255, 0.42); background: var(--n-surface-3); transform: translateY(-1px); }
.n-panel { padding: 18px; background: var(--n-surface); border: 1px solid var(--n-line); border-radius: var(--n-radius); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-title { margin: 3px 0 0; color: var(--n-fg); font-size: 17px; font-weight: 600; line-height: 1.2; }
.n-grid { display: grid; gap: 14px; }
.n-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.n-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.n-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px;
  padding: 8px 12px; border-radius: 6px; border: 1px solid var(--n-line-strong);
  background: var(--n-surface-2); color: var(--n-fg); font-family: var(--n-font-ui);
  font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer;
}
.btn:hover { border-color: rgba(46, 168, 255, 0.45); }
.btn-primary { border-color: transparent; background: var(--n-blue); color: #04111e; }
.btn-ghost { background: transparent; }
.chip, .model-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 5px 9px;
  border-radius: 999px; background: var(--n-surface); border: 1px solid var(--n-line);
  color: var(--n-fg-2); font-size: 12px; line-height: 1;
}
input:not(:checked) + .model-chip {
  border-color: var(--n-line);
  background: var(--n-surface);
  color: var(--n-fg-2);
}
.chip.is-active,
.model-chip.is-active,
input:checked + .model-chip {
  border-color: rgba(46, 168, 255, 0.55);
  background: var(--n-blue-soft);
  color: var(--n-blue);
}
.metric-card { padding: 15px; min-height: 98px; }
.metric-value { color: var(--n-fg); font-family: var(--n-font-mono); font-size: 28px; font-weight: 700; line-height: 1; }
.metric-label { margin-top: 8px; color: var(--n-fg-3); font-size: 12px; }
.muted { color: var(--n-fg-3); }
.mono { font-family: var(--n-font-mono); }
.media-ph {
  min-height: 120px; border-radius: var(--n-radius); border: 1px solid var(--n-line);
  background: linear-gradient(135deg, rgba(46, 168, 255, 0.2), rgba(8, 9, 11, 0.1)), radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.12), transparent 28%), var(--n-surface-3);
}
.form-control {
  width: 100%; min-height: 38px; padding: 9px 11px; border-radius: 6px;
  border: 1px solid var(--n-line-strong); background: var(--n-surface); color: var(--n-fg); font: inherit; font-size: 14px;
}
.form-control::placeholder { color: var(--n-fg-3); }
.form-control:focus { border-color: var(--n-blue); outline: 0; }
.auth-form input {
  width: 100%; min-height: 42px; padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--n-line-strong); background: var(--n-surface); color: var(--n-fg); font: inherit; font-size: 14px;
}
.auth-form input::placeholder { color: var(--n-fg-3); }
.auth-form input:focus { border-color: var(--n-blue); outline: 0; }
.auth-form label { display: block; margin-bottom: 7px; color: var(--n-fg-2); font-size: 13px; font-weight: 600; }
.auth-form .errorlist { margin: 7px 0 0; padding: 0; list-style: none; color: #ffb4b6; font-size: 13px; }
.flash-stack { padding: 16px 24px 0; }
.flash-message {
  max-width: 1220px; margin: 0 auto 8px; padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--n-line); background: var(--n-surface-2); color: var(--n-fg-2); font-size: 13px;
  animation: fade-in 220ms ease-out, fade-out 300ms ease-in 4.7s forwards;
}
.flash-message.success { border-color: rgba(63, 185, 80, 0.34); background: var(--n-green-soft); color: #b7f7c0; }
.flash-message.error { border-color: rgba(229, 56, 59, 0.34); background: var(--n-red-soft); color: #ffb4b6; }

.prose-n { color: var(--n-fg-2); line-height: 1.75; }
.prose-n { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.prose-n h1, .prose-n h2, .prose-n h3, .prose-n h4 { color: var(--n-fg); font-weight: 600; line-height: 1.2; margin: 1.5em 0 0.55em; }
.prose-n h1 { font-size: 1.7rem; }
.prose-n h2 { font-size: 1.35rem; border-bottom: 1px solid var(--n-line); padding-bottom: 0.45em; }
.prose-n h3 { font-size: 1.1rem; }
.prose-n p { margin: 0 0 1em; }
.prose-n ul, .prose-n ol { padding-left: 1.35em; margin: 0 0 1em; }
.prose-n li { margin-bottom: 0.35em; }
.prose-n a { color: var(--n-blue); text-decoration: underline; text-underline-offset: 2px; }
.prose-n code { padding: 0.15em 0.38em; border-radius: 4px; border: 1px solid var(--n-line); background: var(--n-surface); color: #b6dcff; font-size: 0.9em; }
.prose-n pre { padding: 1em; overflow-x: auto; border-radius: var(--n-radius); border: 1px solid var(--n-line); background: var(--n-surface); }
.prose-n pre code { padding: 0; border: 0; background: transparent; color: var(--n-fg); }
.prose-n table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 0.92rem; }
.prose-n th, .prose-n td { padding: 0.6em 0.75em; border: 1px solid var(--n-line); }
.prose-n th { color: var(--n-fg); background: var(--n-surface); text-align: left; }
.prose-n blockquote { margin: 1em 0; padding-left: 1em; border-left: 3px solid var(--n-blue); color: var(--n-fg-2); }

@keyframes fade-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes search-loading-sweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes search-loading-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(46, 168, 255, 0.35); } 50% { box-shadow: 0 0 0 5px rgba(46, 168, 255, 0); } }

@media (max-width: 1020px) {
  .app-sidebar { display: none; }
  .app-shell { display: block; min-height: 100vh; padding-bottom: 76px; }
  .mobile-topbar {
    position: sticky; top: 0; z-index: 40; min-height: 56px; display: flex; align-items: center;
    justify-content: space-between; gap: 12px; padding: 12px 16px;
    background: rgba(8, 9, 11, 0.96); border-bottom: 1px solid var(--n-line); backdrop-filter: blur(16px);
  }
  /* Reflow the topbar as the in-page header below the sticky mobile-topbar. */
  .app-topbar {
    min-height: 0; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 12px 16px;
    backdrop-filter: none; background: var(--n-bg);
  }
  .app-topbar .page-subtitle { display: none; }
  .app-topbar .btn { min-height: 44px; }
  .mobile-bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 8px 8px 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(14, 16, 20, 0.97); border-top: 1px solid var(--n-line); backdrop-filter: blur(18px);
  }
  .mobile-tab { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 7px; color: var(--n-fg-3); font-size: 10px; line-height: 1; cursor: pointer; }
  .mobile-tab.is-active { background: var(--n-blue-soft); color: var(--n-blue); }

  /* "Više" nav sheet — pure-CSS :checked toggle, slides up over the bottom nav. */
  .mobile-nav-sheet-backdrop {
    position: fixed; inset: 0; z-index: 55; display: block; opacity: 0; pointer-events: none;
    visibility: hidden; width: 100vw; background: rgba(0, 0, 0, 0.55); transition: opacity 200ms ease, visibility 200ms ease;
  }
  .mobile-nav-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; width: 100vw; max-width: 100vw; max-height: 80vh; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
    background: var(--n-surface); border-top: 1px solid var(--n-line-strong);
    border-radius: 14px 14px 0 0; box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.45);
    transform: translateY(calc(100% + 1px)); visibility: hidden; pointer-events: none;
    transition: transform 220ms ease, visibility 220ms ease;
  }
  .mobile-nav-sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 8px 10px; position: sticky; top: 0; background: var(--n-surface);
  }
  .mobile-nav-sheet-title { color: var(--n-fg-3); font-family: var(--n-font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
  .mobile-nav-sheet-close {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
    color: var(--n-fg-2); font-size: 16px; cursor: pointer;
  }
  .mobile-nav-sheet-close:hover { background: var(--n-surface-3); color: var(--n-fg); }
  .mobile-sheet-link {
    display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px;
    border-radius: 8px; color: var(--n-fg-2); font-size: 14px; line-height: 1.2;
  }
  .mobile-sheet-link:hover { background: var(--n-surface-3); color: var(--n-fg); }
  .mobile-sheet-link.is-active { background: var(--n-blue-soft); color: var(--n-blue); }
  .mobile-sheet-icon { width: 20px; text-align: center; color: var(--n-fg-3); }
  .mobile-sheet-link.is-active .mobile-sheet-icon { color: var(--n-blue); }
  #nav-sheet-toggle:checked ~ .mobile-nav-sheet-backdrop { opacity: 1; pointer-events: auto; visibility: visible; }
  #nav-sheet-toggle:checked ~ .mobile-nav-sheet { transform: translateY(0); visibility: visible; pointer-events: auto; }

  .app-content { padding: 18px 14px 24px; }
  .topbar-search { display: none; }
  .n-grid-2, .n-grid-3, .n-grid-4 { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
}

@media (min-width: 1021px) and (max-width: 1180px) {
  .app-content { padding: 20px; }
  .n-grid-3, .n-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Sheet + backdrop are mobile-only; keep them fully hidden on desktop. */
@media (min-width: 1021px) {
  .mobile-nav-sheet, .mobile-nav-sheet-backdrop { display: none; }
}

@media (min-width: 720px) and (max-width: 1020px) {
  .n-grid-2, .n-grid-3, .n-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.article-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}
.article-detail-layout > * { min-width: 0; }

.map-page-shell {
  position: relative;
  min-height: 520px;
  height: calc(100svh - 90px - 48px);
}
.app-content.is-map-full {
  max-width: none;
  padding: 24px;
}

@media (max-width: 1180px) {
  .article-detail-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1020px) {
  .app-content.is-map-full { padding: 0 14px 14px; }
  .map-page-shell {
    min-height: 520px;
    height: calc(100svh - 56px - 66px - 76px - 14px);
  }
}
