/* v3_layout.css - CryptoForenses enterprise shell */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 70;
    display: grid;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(219, 228, 239, 0.92);
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 24px rgba(15, 31, 61, 0.05);
}

.topbar-main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.shell-nav-toggle,
.sidebar-close {
    appearance: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: var(--surface-card);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(15, 31, 61, 0.04);
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.shell-nav-toggle:hover,
.shell-nav-toggle:focus-visible,
.sidebar-close:hover,
.sidebar-close:focus-visible {
    outline: none;
    transform: translateY(-1px);
    border-color: var(--border-strong);
    background: var(--primary-soft);
    box-shadow: var(--shadow-glow);
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
}

.brand-panel {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid var(--border-subtle);
    background: var(--surface-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.brand-lockup {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-primary {
    font-size: 0.91rem;
    font-weight: 800;
    line-height: 1.05;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.brand-secondary {
    margin-top: 1px;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.user-nav {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.topbar-note {
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.user-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-subtle);
    background: var(--surface-light);
    color: var(--text-soft);
    font-size: 0.72rem;
    white-space: nowrap;
}

.user-chip strong {
    color: var(--text-primary);
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.shell-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 64;
    background: rgba(22, 32, 51, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.shell-nav-open .shell-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.layout-body {
    width: min(100%, var(--shell-max-width));
    margin: 0 auto;
    padding: 14px 12px 78px;
    overflow-x: clip;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 65;
    width: min(82vw, 286px);
    height: 100vh;
    padding: 14px 14px 20px;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    background: var(--surface-sidebar);
    border-right: 1px solid var(--border-subtle);
    box-shadow: 18px 0 36px rgba(15, 31, 61, 0.09);
    transform: translateX(-104%);
    transition: transform 0.24s ease;
    overflow-y: auto;
}

.shell-nav-open .sidebar {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
}

.sidebar-header > div,
.sidebar-panel,
.sidebar nav,
.sidebar nav a span:last-child {
    min-width: 0;
}

.sidebar-panel {
    padding: 13px 14px;
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
}

.sidebar-heading {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.sidebar-meta {
    margin-top: 6px;
    color: var(--text-primary);
    font-size: 0.86rem;
    line-height: 1.45;
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.sidebar nav a,
.nav-disabled-item {
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
}

.sidebar nav a {
    color: var(--text-soft);
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.sidebar nav a:hover,
.sidebar nav a:focus-visible {
    outline: none;
    transform: translateX(1px);
    background: #f3f7fd;
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.sidebar nav a.active {
    color: var(--primary-color);
    background: linear-gradient(180deg, #edf4ff 0%, #e8f1ff 100%);
    border-color: #c8d9ff;
}

.nav-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
}

.sidebar nav a.active .nav-icon {
    background: var(--primary-color);
    color: var(--text-inverse);
}

.nav-disabled-item {
    color: var(--text-muted);
    background: var(--surface-light);
    border-color: var(--border-subtle);
}

.nav-disabled-item small {
    margin-left: auto;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-section-label {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.main-content {
    min-width: 0;
}

.content-shell,
.content-shell--narrow {
    width: 100%;
}

.content-shell {
    max-width: 1080px;
}

.content-shell--narrow {
    max-width: 880px;
}

.shell-header {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    min-width: 0;
}

.shell-title {
    margin: 0;
    font-size: clamp(1.48rem, 3.2vw, 2.2rem);
    line-height: 1.06;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.shell-subtitle {
    margin: 8px 0 0;
    max-width: 68ch;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.58;
}

.shell-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.shell-actions > * {
    flex: 1 1 100%;
}

.mobile-tabs {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 62;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 6px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(219, 228, 239, 0.95);
    box-shadow: var(--shadow-lg);
}

.mobile-tabs a {
    min-height: 46px;
    padding: 6px 4px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 700;
    min-width: 0;
}

.mobile-tabs a > span:first-child {
    font-size: 0.78rem;
    line-height: 1;
}

.mobile-tabs a.active {
    background: var(--primary-soft);
    color: var(--primary-color);
}

.footer-disclaimer {
    margin-top: auto;
    padding: 14px 14px 78px;
    color: var(--text-muted);
    text-align: center;
}

.footer-brand {
    margin-bottom: 10px;
}

.footer-logo {
    width: 112px;
    height: auto;
    object-fit: contain;
}

.footer-copy {
    margin-bottom: 10px;
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 700;
}

.footer-legal-grid {
    display: grid;
    gap: 6px;
    max-width: 760px;
    margin: 0 auto;
}

.footer-legal-grid p {
    margin: 0;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--border-subtle);
    font-size: 0.72rem;
    line-height: 1.42;
    overflow-wrap: anywhere;
}

.login-layout {
    min-height: 100vh;
    padding: 18px 14px 28px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 26%),
        radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.06), transparent 22%),
        var(--bg-shell);
}

.login-container,
.legal-container {
    width: min(100%, 1180px);
    margin: 0 auto;
}

.login-header {
    margin-bottom: var(--space-6);
}

.login-shell-grid {
    display: grid;
    gap: var(--space-5);
}

.auth-shell-card {
    padding: clamp(22px, 4vw, 34px);
}

@media (min-width: 720px) {
    .shell-actions > * {
        flex: initial;
    }
}

@media (min-width: 980px) {
    .shell-nav-toggle,
    .sidebar-close,
    .shell-sidebar-backdrop,
    .mobile-tabs {
        display: none;
    }

    .topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: var(--space-4);
        padding: 10px 24px;
    }

    .layout-body {
        display: grid;
        grid-template-columns: minmax(216px, 240px) minmax(0, 1fr);
        gap: var(--space-5);
        padding: 18px 24px var(--space-8);
    }

    .sidebar {
        position: sticky;
        top: 70px;
        width: 100%;
        height: auto;
        max-height: calc(100vh - 86px);
        transform: none;
        border-radius: 20px;
    }

    .user-nav {
        align-items: end;
    }

    .footer-disclaimer {
        padding-bottom: 20px;
    }
}

@media (min-width: 960px) {
    .login-shell-grid {
        grid-template-columns: minmax(0, 1.05fr) minmax(340px, 420px);
    }
}

@media (max-width: 639px) {
    .topbar-note {
        display: none;
    }

    .topbar-actions {
        width: 100%;
    }

    .topbar-actions .topbar-secondary-action {
        display: none;
    }

    .topbar-actions .btn {
        flex: 1 1 auto;
        min-height: 36px;
        padding-inline: 12px;
        min-width: 0;
    }

    .brand-primary {
        font-size: 0.94rem;
    }

    .brand-secondary {
        font-size: 0.66rem;
    }

    .footer-logo {
        width: 124px;
    }

    .user-chip:nth-child(n+2) {
        display: none;
    }

    .mobile-tabs {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
}

@media (max-width: 979px) {
    .sidebar-panel {
        display: none;
    }

    .sidebar-header {
        padding-top: 2px;
    }
}
