/* Page frame (same structure as the original pages): sticky top bar + ONE centred 1200px column shared by every
   section (search / tools / stats) so the header and content line up when switching pages. The window scrolls, so
   position: sticky and scrollIntoView in the page scripts keep working. */
.topbar {
    position: sticky; top: 0; z-index: 50; height: var(--top-h); background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--border); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.topbar-in { display: flex; align-items: center; gap: 8px; max-width: 1200px; height: 100%; margin: 0 auto; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand img { flex: none; width: 32px; height: 32px; border-radius: 8px; }
.brand-name { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav-item {
    display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: var(--radius);
    color: var(--text-2); font-size: 14px; font-weight: 600; white-space: nowrap; transition: background-color .15s, color .15s;
}
.topnav-item .icon { color: var(--muted); }
.topnav-item:hover { background: var(--hover); color: var(--text); }
.topnav-item.active, .topnav-item.active:hover { background: var(--primary-soft); color: var(--primary); }
.topnav-item.active .icon { color: var(--primary); }
.topbar-logout { color: var(--muted); }

/* overflow-x: clip (not hidden) = safety net against any too-wide content without creating a scroll container */
.main { min-width: 0; overflow-x: clip; }
.page { max-width: 1200px; margin: 0 auto; padding: 24px 24px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.page-head > div { min-width: 0; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--text); overflow-wrap: anywhere; }
.page-sub { margin-top: 4px; font-size: 14px; color: var(--muted); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs .icon { color: var(--placeholder); }

/* ── Login (no top bar) ── */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 36px 28px 28px; border-radius: 20px; box-shadow: var(--shadow-md); text-align: center; }
.auth-logo { display: block; width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 14px; }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.auth-sub { max-width: 300px; margin: 8px auto 24px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.auth-card .alert { margin-bottom: 16px; text-align: left; }
.auth-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }

@media (max-width: 760px) {
    .topbar-in { padding: 0 12px; gap: 4px; }
    .page { padding: 16px 16px 40px; }
    .page-head { margin-bottom: 16px; }
    .page-title { font-size: 19px; }
    .page-sub { font-size: 13px; }
}
@media (max-width: 480px) {
    .brand-name { display: none; }
    .topnav-item { padding: 0 10px; gap: 6px; }
    /* three sections do not fit 360px with labels: inactive ones become icon-only (label kept for screen readers) */
    .topnav-item:not(.active) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .auth-card { padding: 26px 20px 22px; border-radius: 16px; }
}
