:root {
    --eqds-teal: #19aeb8;
    --eqds-teal-dark: #0b7178;
    --eqds-orange: #f8753f;
    --eqds-orange-dark: #c74c20;
    --eqds-ink: #050505;
    --eqds-muted: #5f6368;
    --eqds-line: #e7e7e7;
    --eqds-panel: #ffffff;
    --eqds-bg: #f7f9fa;
    --eqds-chart-orange: #f8753f;
    --eqds-chart-teal: #19aeb8;
    --eqds-chart-orange-light: #ffb088;
    --eqds-chart-teal-light: #5ecfd6;
    --app-navbar-height: 88px;
}

body {
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--eqds-bg);
    color: var(--eqds-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-kerning: normal;
}

.app-navbar {
    flex-shrink: 0;
    min-height: var(--app-navbar-height);
    background: var(--eqds-panel);
    border-bottom: 1px solid var(--eqds-line);
}

.app-logo {
    height: 58px;
    width: auto;
}

.agency-client-selector {
    gap: 0;
}

.agency-client-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--eqds-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.agency-client-select {
    min-width: 180px;
    font-size: 0.875rem;
    border-color: var(--eqds-line);
    border-radius: 6px;
}

.app-shell {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(25, 174, 184, 0.08), transparent 36%),
        var(--eqds-bg);
}

.sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-width: 232px;
    width: 232px;
    height: 100%;
    min-height: 0;
    background: var(--eqds-panel);
    border-right: 1px solid var(--eqds-line);
    padding: 1rem 0 0;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    overflow: hidden;
}

.sidebar-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.sidebar-title {
    color: var(--eqds-muted);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.sidebar .nav {
    gap: 0;
    width: 100%;
    padding: 0;
    margin: 0;
}

.sidebar .nav-item {
    width: 100%;
}

.sidebar .nav-link {
    position: relative;
    display: block;
    width: 100%;
    color: var(--eqds-ink);
    border-radius: 0;
    font-weight: 400;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    padding: 0.72rem 1rem;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.sidebar .nav-link:hover {
    background: rgba(248, 117, 63, 0.08);
    color: var(--eqds-ink);
}

.sidebar .nav-link:focus-visible {
    background: rgba(248, 117, 63, 0.08);
    color: var(--eqds-ink);
    outline: 2px solid var(--eqds-teal);
    outline-offset: -2px;
}

.sidebar .nav-link.active {
    background: rgba(248, 117, 63, 0.14);
    color: var(--eqds-ink);
    font-weight: 500;
    box-shadow: inset 4px 0 0 var(--eqds-orange);
}

.sidebar .nav-link--back::before {
    content: "";
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    margin-right: 0.5rem;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    vertical-align: 0.05em;
    opacity: 0.75;
}

.sidebar .nav-link--back:hover::before,
.sidebar .nav-link--back:focus-visible::before {
    opacity: 1;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 2rem;
}

.btn-primary {
    --bs-btn-bg: var(--eqds-teal);
    --bs-btn-border-color: var(--eqds-teal);
    --bs-btn-hover-bg: var(--eqds-teal-dark);
    --bs-btn-hover-border-color: var(--eqds-teal-dark);
    --bs-btn-active-bg: var(--eqds-teal-dark);
    --bs-btn-active-border-color: var(--eqds-teal-dark);
}

.btn-outline-secondary {
    --bs-btn-color: var(--eqds-ink);
    --bs-btn-border-color: #cfcfcf;
    --bs-btn-hover-bg: var(--eqds-ink);
    --bs-btn-hover-border-color: var(--eqds-ink);
    --bs-btn-hover-color: #ffffff;
}

.dropdown-item:active {
    background: var(--eqds-teal);
}

/* --- Sidebar account (bottom) --- */
.sidebar-account {
    flex-shrink: 0;
    margin-top: auto;
    border-top: 1px solid var(--eqds-line);
    padding: 0.85rem 1rem 1rem;
}

.sidebar-account-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--eqds-ink);
    border-radius: 8px;
    padding: 0.35rem 0.25rem;
    margin: 0 -0.25rem;
    transition: background 150ms ease;
}

.sidebar-account-user:hover {
    background: rgba(25, 174, 184, 0.08);
    color: var(--eqds-ink);
}

.sidebar-account-user:focus-visible {
    outline: 2px solid var(--eqds-teal);
    outline-offset: 2px;
}

.sidebar-account-user.is-active {
    background: rgba(248, 117, 63, 0.1);
}

.sidebar-account-avatar {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(25, 174, 184, 0.14);
    color: var(--eqds-teal-dark);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
}

.sidebar-account-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sidebar-account-email {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--eqds-ink);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--eqds-muted);
}

.sidebar-account-signout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0.65rem;
    padding: 0.52rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #8b1a0f;
    text-decoration: none;
    text-align: center;
    border: 1.5px solid rgba(217, 48, 37, 0.45);
    border-radius: 6px;
    background: rgba(217, 48, 37, 0.1);
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.sidebar-account-signout:hover {
    color: #ffffff;
    background: #c5221f;
    border-color: #b01c18;
}

.sidebar-account-signout:focus-visible {
    outline: 2px solid #c5221f;
    outline-offset: 2px;
}

/* Sidebar section label + data entry */
.sidebar-title--section {
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--eqds-line);
}
.sidebar .nav-link--data {
    font-size: 0.88rem;
}

@media (max-width: 900px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .app-shell {
        flex: 1 1 auto;
        flex-direction: column;
        min-height: calc(100vh - var(--app-navbar-height));
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        height: auto;
        min-height: auto;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid var(--eqds-line);
        padding: 0.75rem 0 0;
    }

    .sidebar-main {
        overflow: visible;
    }

    .sidebar-account {
        width: 100%;
        margin-top: 0.65rem;
    }

    .app-content {
        overflow: visible;
    }

    .sidebar-title {
        padding: 0 1rem;
    }

    .sidebar .nav {
        flex-direction: row !important;
        flex-wrap: wrap;
    }

    .sidebar .nav-item {
        width: auto;
    }

    .sidebar .nav-link.active {
        box-shadow: inset 0 -4px 0 var(--eqds-orange);
    }

    .sidebar-title--section {
        width: 100%;
        margin-top: 0.5rem;
        padding-top: 0.65rem;
    }

    .app-content {
        padding: 1.25rem;
    }
}
