/* ═══════════════════════════════════════════
   Universem Dashboard — Custom CSS for Dash
   Colors from brand guidelines
   ═══════════════════════════════════════════ */

@import url('tokens.css');

:root {
    /* ── Aliases → tokens.css (back-compat for legacy --navy / --cyan / etc.) ── */
    --navy:        var(--u-navy);
    --navy-deep:   var(--u-navy-deep);
    --cyan:        var(--u-cyan);
    --cyan-light:  var(--u-cyan-light);
    --cyan-muted:  var(--u-cyan-muted);
    --yellow:      var(--u-yellow);
    --yellow-light:var(--u-yellow-light);
    --coral:       var(--u-coral);
    --teal-dark:   var(--u-teal-dark);
    --white:       var(--u-white);
    --off-white:   var(--u-off-white);
    --gray-50:     var(--u-gray-50);
    --gray-100:    var(--u-gray-100);
    --gray-200:    var(--u-gray-200);
    --gray-400:    var(--u-gray-400);
    --gray-600:    var(--u-gray-600);
    --gray-800:    var(--u-gray-800);

    /* ── Secondary brand colors (not in tokens.css — kept local) ── */
    --lime: #E7FFB3;
    --slate: #395E66;
    --orange: #FF8552;
    --pink: #F9E0D9;

    /* ── Text-on-surface derivations (kept local; no --u-* counterpart) ── */
    --u-yellow-ink: #B8960A;  /* readable text on --u-yellow backgrounds */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
    background: var(--off-white) !important;
    color: var(--gray-800);
    overflow-x: hidden;
}

/* ── Kill Dash default margins ── */
#react-entry-point,
._dash-loading {
    font-family: 'DM Sans', sans-serif !important;
}

.dash-table-container {
    font-family: 'DM Sans', sans-serif !important;
}

/* ═══════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════ */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    bottom: -120px;
    left: -80px;
    width: 400px;
    height: 400px;
    background: var(--cyan);
    border-radius: 50%;
    opacity: 0.08;
    filter: blur(60px);
}

.login-wrapper::after {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 300px;
    height: 300px;
    background: var(--yellow);
    border-radius: 50%;
    opacity: 0.06;
    filter: blur(40px);
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 48px 40px;
    width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--cyan);
    border-radius: 14px;
    font-weight: 700;
    color: var(--navy);
    font-size: 22px;
    margin-bottom: 16px;
    position: relative;
}

.login-logo-mark::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: var(--yellow);
    border-radius: 50%;
    opacity: 0.6;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
}

.login-title span {
    color: var(--cyan);
}

.login-subtitle {
    font-size: 14px;
    color: var(--gray-400);
    margin-top: 4px;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-100);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: var(--gray-800);
    transition: border-color 0.2s;
    outline: none;
    background: var(--gray-50);
}

.login-field input:focus {
    border-color: var(--cyan);
    background: var(--white);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.login-btn:hover {
    background: var(--navy-deep);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27, 42, 74, 0.3);
}

.login-error {
    color: var(--coral);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    margin-top: 12px;
}

/* ═══════════════════════════════════════════
   MAIN LAYOUT
   ═══════════════════════════════════════════ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1200;
    overflow: visible;
    transition: width 0.3s ease, padding 0.3s ease, transform 0.3s ease;
}

.sidebar::before {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -40px;
    width: 200px;
    height: 200px;
    background: var(--cyan);
    border-radius: 50%;
    opacity: 0.12;
    filter: blur(40px);
    pointer-events: none;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 40%;
    right: -60px;
    width: 140px;
    height: 140px;
    background: var(--yellow);
    border-radius: 50%;
    opacity: 0.08;
    filter: blur(30px);
    pointer-events: none;
}

.sidebar-logo-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.sidebar-logo-mark {
    width: 38px;
    height: 38px;
    background: var(--cyan);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--navy);
    font-size: 16px;
    position: relative;
    flex-shrink: 0;
}

.sidebar-logo-mark::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    background: var(--yellow);
    border-radius: 50%;
    opacity: 0.6;
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.05;
}

.sidebar-logo-main {
    font-weight: 700;
    font-size: 18px;
    color: var(--white);
    letter-spacing: 0.5px;
}

.sidebar-logo-sub {
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-200);
    letter-spacing: 0.2px;
}

.sidebar-logo-sub span {
    color: var(--cyan);
}

.nav-section {
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.nav-section.collapsed {
    margin-bottom: 8px;
}

.nav-label-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    padding: 6px 12px;
    margin: 0 -12px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-label-toggle:hover {
    color: var(--gray-200);
    background: rgba(255, 255, 255, 0.05);
}

.nav-label-arrow {
    font-size: 8px;
    transition: transform 0.2s ease;
    transform: rotate(90deg);
    color: var(--gray-400);
    flex-shrink: 0;
    order: -1;
}

.nav-label-toggle:hover .nav-label-arrow {
    color: var(--gray-200);
}

.nav-section.collapsed .nav-label-arrow {
    transform: rotate(0deg);
}

.nav-section-items {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 1;
}

.nav-section.collapsed .nav-section-items {
    max-height: 0;
    opacity: 0;
}

/* In collapsed sidebar: ignore accordion, show all icons, hide labels */
.sidebar.collapsed .nav-section.collapsed .nav-section-items {
    max-height: 500px;
    opacity: 1;
}

.sidebar.collapsed .nav-label-toggle {
    display: none;
}

.sidebar.collapsed .nav-section.collapsed {
    margin-bottom: 4px;
}

#sidebar-admin-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: var(--gray-400);
    margin-bottom: 4px;
    padding-left: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
    border-radius: 10px;
    color: var(--gray-200);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1px;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
    text-decoration: none;
    transform: translateX(2px);
}

.nav-item.active {
    background: rgba(19, 205, 200, 0.12);
    color: var(--cyan-light) !important;
    box-shadow: inset 0 0 12px rgba(19, 205, 200, 0.06);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--cyan);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
    stroke-width: 1.6;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    margin-top: auto;
    flex-shrink: 0;
    padding: 10px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    min-height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--cyan), var(--teal-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    line-height: normal;
    color: var(--white);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--gray-400);
}

.logout-btn {
    margin-left: auto;
    padding: 7px 12px;
    min-width: 86px;
    border: 1px solid rgba(221, 226, 234, 0.75);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--gray-200);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(242, 107, 91, 0.18);
    border-color: rgba(242, 107, 91, 0.55);
    color: var(--white);
}

.logout-btn:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.sidebar.collapsed .logout-btn,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-version {
    display: none;
}

/* ── Main content area ── */
.main-content {
    position: relative;
    z-index: 1;
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    min-width: 0;
    /* Prevent overflow */
}

.main-content.collapsed {
    margin-left: 80px;
}

.sidebar.auth-hidden {
    display: none;
}

.main-content.auth-shell {
    margin-left: 0;
}

.sidebar.collapsed {
    width: 80px;
    min-width: 80px;
    padding: 28px 12px;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-user-name,
.sidebar.collapsed .sidebar-user-role,
.sidebar.collapsed .nav-item span:not(:first-child) {
    /* span:not(:first-child) matches the text label since icon is in a span? No, icon is in Span, label is text node or div? Check layout.py */
    display: none !important;
}

/* Specifically target the text part of nav-item in layout.py */
.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .sidebar-logo-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo-mark {
    margin: 0;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 11px 0;
}

.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: 8px 0;
    margin-bottom: 4px;
}

.sidebar.collapsed #sidebar-admin-section {
    margin-top: 10px;
    padding-top: 8px;
}

/* Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 50%;
    /* Center vertically */
    transform: translateY(-50%);
    right: -12px;
    /* Overlap right edge */
    width: 24px;
    height: 24px;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--navy);
    font-size: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    /* Ensure it's on top */
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--gray-50);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar.collapsed .sidebar-toggle {
    right: -12px;
    /* Keep it on the edge */
    transform: translateY(-50%) rotate(180deg);
}

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1300;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s,
                color 0.2s,
                border-radius 0.2s,
                box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

/* ── Top bar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 36px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.4px;
}

.page-title span {
    color: var(--cyan);
}

.page-breadcrumb {
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 500;
    margin-top: 2px;
}

.topbar-filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    border: 1px solid var(--gray-100);
    cursor: pointer;
}

.filter-pill:hover {
    border-color: var(--cyan);
}

/* ── Page content ── */
.page-content {
    padding: 24px 36px;
    flex: 1;
    min-width: 0;
    /* Prevents flex item from overflowing due to wide content */
}

/* ═══════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════ */

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--white);
    border-radius: 16px;
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--gray-100);
    transition: all 0.2s;
}

.kpi-card:hover {
    border-color: var(--cyan);
    box-shadow: 0 4px 20px rgba(0, 212, 200, 0.08);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.kpi-card.cyan::before {
    background: var(--cyan);
}

.kpi-card.yellow::before {
    background: var(--yellow);
}

.kpi-card.coral::before {
    background: var(--coral);
}

.kpi-card.navy::before {
    background: var(--navy);
}

.kpi-card .blob {
    position: absolute;
    bottom: -20px;
    right: -10px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.06;
    pointer-events: none;
}

.kpi-card.cyan .blob {
    background: var(--cyan);
}

.kpi-card.yellow .blob {
    background: var(--yellow);
}

.kpi-card.coral .blob {
    background: var(--coral);
}

.kpi-card.navy .blob {
    background: var(--navy);
    opacity: 0.08;
}

.kpi-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 6px;
}

.kpi-sub {
    font-size: 12px;
    color: var(--gray-400);
}

/* ═══════════════════════════════════════════
   CARDS / CHART CONTAINERS
   ═══════════════════════════════════════════ */

.chart-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--gray-100);
    margin-bottom: 20px;
    min-width: 0;
    /* Critical for grid/flex overflow prevention */
    max-width: 100%;
}

.chart-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 16px;
}

.charts-grid-2 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.charts-grid-equal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.charts-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ═══════════════════════════════════════════
   DROPDOWNS (Dash dcc.Dropdown override)
   ═══════════════════════════════════════════ */

.dash-dropdown .Select-control {
    border: 1.5px solid var(--gray-100) !important;
    border-radius: 10px !important;
    background: var(--white) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 13px !important;
    min-height: 40px !important;
}

.dash-dropdown .Select-control:hover {
    border-color: var(--cyan) !important;
}

.dash-dropdown .Select-value-label,
.dash-dropdown .Select-placeholder {
    font-family: 'DM Sans', sans-serif !important;
    font-size: 13px !important;
    color: var(--gray-600) !important;
}

.dash-dropdown .Select-menu-outer {
    border-radius: 10px !important;
    border: 1.5px solid var(--gray-100) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 13px !important;
    max-height: 320px !important;
}

/* Cap menu inner scroll so a very long prompt list doesn't push content
   below the fold — react-select caps by default but we want it explicit. */
.dash-dropdown .Select-menu {
    max-height: 320px !important;
}

/* Hide native number-input spinners — on Firefox/macOS they render as
   large ± buttons flanking the value (cf. Radius field in pm-create) and
   truncate the visible value. step=… still works via keyboard arrows. */
.field-input[type="number"]::-webkit-inner-spin-button,
.field-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.field-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.filter-row {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-item {
    min-width: 200px;
    flex: 1;
}

.gpt-scope-item,
.scope-item {
    max-width: 420px;
    flex: 0 0 420px;
}

.gpt-scope-toggle,
.scope-toggle {
    background: var(--white);
    border: 1.5px solid var(--gray-100);
    border-radius: 10px;
    padding: 10px 12px;
}

.aio-chart-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 14px;
    align-items: start;
}

.aio-legend-box {
    max-height: 500px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    background: var(--white);
    padding: 10px 12px;
}

.aio-legend-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.aio-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--gray-600);
}

.aio-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex: 0 0 10px;
}

.filter-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-400);
    margin-bottom: 6px;
}

/* ═══════════════════════════════════════════
   DATA TABLES
   ═══════════════════════════════════════════ */

.dash-table-container .dash-spreadsheet-container {
    border-radius: 12px !important;
    overflow: hidden;
    border: 1px solid var(--gray-100) !important;
}

.dash-table-container .dash-header {
    background: var(--gray-50) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    color: var(--cyan) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 2px solid var(--gray-100) !important;
}

.dash-table-container .dash-cell {
    font-family: 'DM Sans', sans-serif !important;
    font-size: 13px !important;
    color: var(--gray-800) !important;
    border-bottom: 1px solid var(--gray-50) !important;
    padding: 10px 12px !important;
}

.dash-table-container .dash-cell.focused {
    border: 1px solid var(--cyan) !important;
    outline: none !important;
}

/* ═══════════════════════════════════════════
   PLOTLY CHART OVERRIDES
   ═══════════════════════════════════════════ */

.js-plotly-plot .plotly .modebar {
    right: 10px !important;
    top: 5px !important;
}

.js-plotly-plot .plotly .modebar-btn {
    font-size: 14px !important;
}

/* ═══════════════════════════════════════════
   PROJECT PILL (topbar)
   ═══════════════════════════════════════════ */

.project-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--navy);
    color: var(--white);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cyan);
    flex-shrink: 0;
}

.project-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════
   LOADING PLACEHOLDERS (spinner + quote)
   ═══════════════════════════════════════════ */

.loading-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--gray-100);
    padding: 32px 24px;
}

/* Spinner ring */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--gray-100);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Quote container */
.loading-quote {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0;
    animation: fadeInQuote 0.5s ease-out 0.3s forwards;
}

/* Big emoji icon */
.loading-quote-icon {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 2px;
    animation: floatIcon 2s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

/* Main quote line */
.loading-quote-main {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-style: italic;
    color: var(--gray-600);
    letter-spacing: 0.1px;
}

/* Reply / second line */
.loading-quote-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    font-style: italic;
    color: var(--cyan);
}

/* Author attribution */
.loading-quote-author {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

@keyframes fadeInQuote {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    min-height: 240px;
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--gray-400);
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 13px;
    color: var(--gray-400);
    max-width: 320px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card {
    animation: fadeInUp 0.4s ease both;
}

.kpi-card:nth-child(1) {
    animation-delay: 0.05s;
}

.kpi-card:nth-child(2) {
    animation-delay: 0.1s;
}

.kpi-card:nth-child(3) {
    animation-delay: 0.15s;
}

.kpi-card:nth-child(4) {
    animation-delay: 0.2s;
}

.chart-card {
    animation: fadeInUp 0.4s ease both;
    animation-delay: 0.2s;
}

/* ═══════════════════════════════════════════
   DATE DROPDOWN (compact)
   ═══════════════════════════════════════════ */

.date-dropdown .Select-control {
    min-height: 34px !important;
    border-radius: 8px !important;
}

.date-dropdown .Select-value-label,
.date-dropdown .Select-placeholder {
    font-size: 12.5px !important;
    line-height: 32px !important;
}

/* ═══════════════════════════════════════════
   EXPORT BUTTON
   ═══════════════════════════════════════════ */

.export-btn-small,
.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 6px 14px;
    background: var(--white);
    border: 1.5px solid var(--gray-100);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}

.export-btn-small:hover,
.export-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(0, 212, 200, 0.04);
}

/* ═══════════════════════════════════════════
   TABLE IMPROVEMENTS
   ═══════════════════════════════════════════ */

.dash-table-container {
    width: 100%;
    overflow: hidden;
}

.dash-table-container .dash-spreadsheet-container {
    max-height: 600px;
    overflow: auto !important;
}

.dash-table-container .dash-spreadsheet-inner {
    min-width: 100% !important;
}

.dash-table-container table {
    table-layout: auto !important;
    width: 100% !important;
}

/* Zebra striping */
.dash-table-container tr:nth-child(even) td {
    background-color: var(--gray-50) !important;
}

/* Hover rows */
.dash-table-container tr:hover td {
    background-color: rgba(19, 205, 200, 0.06) !important;
}

/* Sticky header */
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
}

/* Tooltip */
.dash-table-tooltip {
    max-width: 500px !important;
    white-space: normal !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 12px !important;
}

/* Cell text wrapping — allow expanding */
.dash-cell-value {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════
   COMPARISON KPI DELTA (domain vs domain)
   ═══════════════════════════════════════════ */

.kpi-value span {
    font-weight: 500;
    margin-left: 4px;
}

/* ═══════════════════════════════════════════
   TEMPORAL KPI DELTA (period vs period)
   ═══════════════════════════════════════════ */

.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.kpi-delta.positive {
    background: rgba(0, 212, 200, 0.14);
    color: var(--u-teal-dark);
}

.kpi-delta.negative {
    background: rgba(242, 107, 91, 0.10);
    color: var(--u-coral);
}

.kpi-delta.neutral {
    background: var(--gray-50);
    color: var(--gray-400);
}

.kpi-delta-value {
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════
   ALERTS PAGE
   ═══════════════════════════════════════════ */

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 22px;
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--gray-100);
    transition: all 0.2s;
    animation: fadeInUp 0.3s ease both;
}

.alert-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.alert-card.alert-positive {
    border-left: 4px solid var(--u-cyan);
}

.alert-card.alert-negative {
    border-left: 4px solid var(--coral);
}

.alert-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.alert-icon-positive {
    background: rgba(0, 212, 200, 0.14);
    color: var(--u-teal-dark);
}

.alert-icon-negative {
    background: rgba(242, 107, 91, 0.12);
    color: var(--u-coral);
}

.alert-body {
    flex: 1;
    min-width: 0;
}

.alert-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    margin-bottom: 4px;
}

.alert-message {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 2px;
}

.alert-detail {
    font-size: 12px;
    color: var(--gray-400);
    font-variant-numeric: tabular-nums;
}

.alerts-empty {
    text-align: center;
    padding: 80px 20px;
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--gray-100);
}

.alerts-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 212, 200, 0.14);
    color: var(--u-teal-dark);
    font-size: 24px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.alerts-empty-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 6px;
}

.alerts-empty-sub {
    font-size: 13px;
    color: var(--gray-400);
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Full breakpoints
   ═══════════════════════════════════════════ */

/* ── Touch-friendly base rules ── */
@media (pointer: coarse) {
    /* Larger tap targets on touch devices */
    .nav-item {
        padding: 10px 12px;
        min-height: 44px;
    }

    .filter-pill,
    .export-btn,
    .export-btn-small {
        min-height: 44px;
        padding: 10px 16px;
    }

    .logout-btn {
        min-height: 44px;
    }

    .dash-dropdown .Select-control {
        min-height: 44px !important;
    }
}

/* ── Large desktops (default, > 1400px) ── */
/* No changes needed, this is the base layout */

/* ── Medium desktops / small laptops ── */
@media (max-width: 1400px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid-2,
    .charts-grid-equal {
        grid-template-columns: 1fr;
    }

    .charts-grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .aio-chart-shell {
        grid-template-columns: 1fr;
    }

    .aio-legend-box {
        max-height: 220px;
    }
}

/* ── Tablets / narrow desktops ── */
@media (max-width: 1200px) {
    /* Auto-collapse sidebar */
    .sidebar {
        width: 80px;
        min-width: 80px;
        padding: 28px 12px;
    }

    .sidebar .sidebar-logo-text,
    .sidebar .nav-label,
    .sidebar .sidebar-user-name,
    .sidebar .sidebar-user-role,
    .sidebar .nav-text {
        display: none;
    }

    .sidebar .sidebar-logo-link {
        text-decoration: none;
        color: inherit;
        display: block;
    }

    .sidebar .sidebar-logo {
        justify-content: center;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 11px 0;
    }

    .sidebar .sidebar-footer {
        justify-content: center;
        padding: 14px 0;
    }

    .sidebar .logout-btn {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }

    .main-content {
        margin-left: 80px;
    }

    .page-content {
        padding: 20px 24px;
    }

    .topbar {
        padding: 14px 24px;
    }

    .page-title {
        font-size: 20px;
    }

    /* Admin/PM pages adapt */
    .admin-page,
    .pm-page {
        max-width: 100%;
        padding: 20px 24px;
    }
}

/* ── Tablets portrait / large phones ── */
@media (max-width: 900px) {
    /* Sidebar becomes overlay */
    .sidebar {
        width: 280px;
        min-width: 280px;
        padding: 28px 20px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
        z-index: 1200;
    }

    .sidebar.collapsed {
        /* On mobile, collapsed = hidden off-screen */
        width: 280px;
        min-width: 280px;
        padding: 28px 20px;
        transform: translateX(-100%);
    }

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

    /* Restore all sidebar text in mobile overlay */
    .sidebar .sidebar-logo-text,
    .sidebar .nav-label,
    .sidebar .sidebar-user-name,
    .sidebar .sidebar-user-role,
    .sidebar .nav-text,
    .sidebar.collapsed .sidebar-logo-text,
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .sidebar-user-name,
    .sidebar.collapsed .sidebar-user-role,
    .sidebar.collapsed .nav-text {
        display: block !important;
    }

    .sidebar .nav-item,
    .sidebar.collapsed .nav-item {
        justify-content: flex-start;
        padding: 11px 12px;
    }

    .sidebar .sidebar-footer,
    .sidebar.collapsed .sidebar-footer {
        justify-content: flex-start;
        padding: 14px;
    }

    .sidebar .sidebar-logo,
    .sidebar.collapsed .sidebar-logo {
        justify-content: flex-start;
    }

    .sidebar .logout-btn,
    .sidebar.collapsed .logout-btn {
        display: inline-flex !important;
        margin-left: auto;
        min-width: 86px;
    }

    .sidebar.collapsed .sidebar-user-info {
        display: flex !important;
    }

    /* On mobile, collapsed = overlay ouvert → la version reste visible. */
    .sidebar.collapsed .sidebar-version {
        display: block !important;
    }

    /* Accordion: show toggle labels in mobile overlay */
    .sidebar.collapsed .nav-label-toggle {
        display: flex !important;
    }

    .sidebar-toggle {
        display: none;
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    /* Slide burger to the right edge of sidebar when overlay is open */
    .sidebar.mobile-open ~ .mobile-menu-toggle {
        left: 240px;
        background: var(--navy-deep);
        color: var(--cyan);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        border-radius: 0 10px 10px 0;
    }

    /* Overlay backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1100;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    .sidebar-backdrop.visible {
        display: block;
    }

    .main-content,
    .main-content.collapsed {
        margin-left: 0;
    }

    .topbar {
        padding: 14px 20px;
        padding-left: 68px; /* Room for burger toggle */
    }

    /* Pages without topbar (project selector, admin) need top clearance for burger */
    .main-content > .project-selector:first-child,
    .main-content > .admin-page:first-child,
    .main-content > .pm-page:first-child {
        padding-top: 60px;
    }

    .page-content {
        padding: 16px 16px;
    }

    /* ── Charts: mobile-friendly ── */
    .js-plotly-plot .plotly .legend {
        font-size: 10px !important;
    }

    .chart-card .js-plotly-plot {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Override inline heights on mobile to prevent oversized charts */
    .chart-card .dash-graph {
        height: auto !important;
        min-height: 260px;
        max-height: 420px;
    }

    /* Give plotly more bottom room for legend below chart */
    .chart-card .js-plotly-plot .plotly .main-svg {
        overflow: visible;
    }

    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kpi-card {
        padding: 16px 18px;
    }

    .kpi-value {
        font-size: 24px;
    }

    .charts-grid-2,
    .charts-grid-equal,
    .charts-grid-3 {
        grid-template-columns: 1fr;
    }

    .chart-card {
        padding: 16px;
    }

    /* Charts: ensure plotly fills container properly */
    .chart-card .js-plotly-plot {
        width: 100% !important;
    }

    .filter-row {
        flex-direction: column;
        gap: 10px;
    }

    .filter-item {
        min-width: 100%;
    }

    .gpt-scope-item,
    .scope-item {
        max-width: 100%;
        flex: 1 1 100%;
    }

    /* Table horizontal scroll */
    .dash-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dash-table-container .dash-spreadsheet-container {
        max-height: 400px;
    }

    .topbar-filters {
        gap: 8px;
    }

    .page-title {
        font-size: 18px;
    }

    .page-breadcrumb {
        display: none;
    }

    /* Project pill compact */
    .project-pill {
        padding: 4px 10px;
        font-size: 12px;
        max-width: 160px;
    }

    /* Project selector grid */
    .project-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }

    .project-card {
        padding: 12px;
    }

    .project-selector-title {
        font-size: 20px;
    }

    /* Admin/PM pages */
    .admin-page,
    .pm-page {
        max-width: 100%;
        padding: 16px;
    }

    .admin-section,
    .pm-section {
        padding: 20px 18px;
    }

    .admin-form,
    .pm-form {
        max-width: 100%;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    /* Admin clients grid → stack */
    .admin-clients-grid {
        grid-template-columns: 1fr;
    }

    .admin-clients-grid .grid-header:nth-child(2),
    .admin-clients-grid .grid-header:nth-child(3) {
        display: none;
    }

    .admin-clients-grid .grid-cell:nth-child(3n+2),
    .admin-clients-grid .grid-cell:nth-child(3n+3) {
        display: none;
    }

    /* Alert cards compact */
    .alert-card {
        padding: 14px 16px;
        gap: 12px;
    }

    .alert-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    /* Loading placeholder responsive */
    .loading-placeholder {
        padding: 24px 16px;
    }

    /* Legend boxes: constrain height */
    .aio-legend-box {
        max-height: 180px;
    }
}

/* ── Mobile phones ── */
@media (max-width: 600px) {
    .kpi-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .kpi-card {
        padding: 14px 16px;
        border-radius: 12px;
    }

    .kpi-value {
        font-size: 22px;
    }

    .kpi-label {
        font-size: 11px;
        letter-spacing: 0.6px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 14px;
        padding-left: 68px;
    }

    .topbar-filters {
        width: 100%;
        flex-wrap: wrap;
    }

    .topbar-filters > div {
        flex: 1;
        min-width: 0;
    }

    /* Project pill: full width on mobile */
    .project-pill {
        max-width: 100%;
        flex: 0 0 100%;
        order: -1;
        margin-bottom: 4px;
    }

    .page-title {
        font-size: 17px;
        letter-spacing: -0.2px;
    }

    .page-content {
        padding: 12px 12px;
    }

    .chart-card {
        padding: 12px;
        border-radius: 12px;
        margin-bottom: 12px;
    }

    .chart-card-title {
        font-size: 13px;
        margin-bottom: 10px;
    }

    /* Charts: cap height on phones */
    .chart-card .dash-graph {
        max-height: 340px !important;
        min-height: 220px;
    }

    .export-btn,
    .export-btn-small {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Filter scope items */
    .gpt-scope-item,
    .scope-item {
        max-width: 100%;
        flex: 1 1 100%;
    }

    .gpt-scope-toggle,
    .scope-toggle {
        padding: 8px 10px;
    }

    /* Project selector */
    .project-selector {
        padding: 16px;
        border-radius: 12px;
    }

    .project-selector-title {
        font-size: 18px;
    }

    .project-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* Admin pages */
    .admin-page,
    .pm-page {
        padding: 12px;
    }

    .admin-section,
    .pm-section {
        padding: 16px 14px;
        border-radius: 12px;
    }

    .section-header {
        gap: 8px;
    }

    .section-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .section-title {
        font-size: 14px;
    }

    .btn-row {
        flex-direction: column;
    }

    .btn-admin-primary,
    .btn-admin-cyan,
    .btn-admin-outline,
    .btn-admin-danger {
        width: 100%;
        justify-content: center;
    }

    /* Upload zone */
    .upload-zone {
        padding: 16px 12px;
    }

    /* Login responsive */
    .login-card {
        width: 92vw;
        padding: 28px 20px;
        margin: 12px;
        border-radius: 16px;
    }

    .login-logo-mark {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .login-title {
        font-size: 18px;
    }

    .login-subtitle {
        font-size: 13px;
    }

    .login-field input {
        padding: 14px 14px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .login-btn {
        padding: 16px;
        font-size: 16px;
    }

    /* Alerts compact */
    .alert-card {
        padding: 12px 14px;
        gap: 10px;
    }

    .alert-message {
        font-size: 13px;
    }

    .alerts-empty {
        padding: 48px 16px;
    }

    /* Empty state compact */
    .empty-state {
        padding: 32px 16px;
        min-height: 180px;
    }

    .empty-state-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .empty-state-title {
        font-size: 14px;
    }

    .empty-state-text {
        font-size: 12px;
    }

    /* Loading placeholder compact */
    .loading-placeholder {
        padding: 20px 12px;
        gap: 12px;
    }

    .loading-quote-main,
    .loading-quote-sub {
        font-size: 12px;
    }
}

/* ── Very small phones (≤ 380px) ── */
@media (max-width: 380px) {
    .topbar {
        padding-left: 64px;
        padding-right: 10px;
    }

    .page-title {
        font-size: 15px;
    }

    .kpi-value {
        font-size: 20px;
    }

    .page-content {
        padding: 10px 8px;
    }

    .chart-card {
        padding: 10px;
    }

    .login-card {
        width: 96vw;
        padding: 24px 16px;
        margin: 8px;
    }

    .project-pill {
        font-size: 11px;
        padding: 3px 8px;
    }
}

/* ═══════════════════════════════════════════
   iOS-SPECIFIC FIXES
   ═══════════════════════════════════════════ */

/* Prevent iOS bounce scroll on body */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-overflow-scrolling: touch;
    }

    /* Fix iOS input zoom (font-size < 16px triggers zoom) */
    .login-field input,
    .field-input,
    .dash-dropdown .Select-control input {
        font-size: 16px !important;
    }

    /* Safe area insets for notched devices */
    .sidebar {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .page-content {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .topbar {
        padding-top: max(14px, env(safe-area-inset-top));
    }
}

/* ═══════════════════════════════════════════
   LANDSCAPE PHONES
   ═══════════════════════════════════════════ */

@media (max-height: 500px) and (orientation: landscape) {
    .sidebar.mobile-open {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .sidebar .nav-item {
        padding: 6px 12px;
        min-height: 36px;
    }

    .sidebar-footer {
        padding: 8px;
        margin-bottom: 4px;
    }

    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .topbar {
        padding: 8px 20px;
        padding-left: 56px;
    }
}


/* ── Admin Project Selector ── */
.project-selector {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 16px;
    padding: 24px;
}

.project-selector-title {
    margin: 0;
    color: var(--navy);
    font-size: 24px;
    font-weight: 700;
}

.project-selector-subtitle {
    margin-top: 6px;
    color: var(--gray-400);
    font-size: 14px;
}

.project-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.project-card {
    display: block;
    text-decoration: none;
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    background: var(--gray-50);
    padding: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.project-card:hover {
    transform: translateY(-1px);
    border-color: var(--cyan);
    box-shadow: 0 8px 20px rgba(27, 42, 74, 0.08);
}

.project-card.active {
    border-color: var(--cyan);
    background: rgba(0, 212, 200, 0.08);
}

.project-card-title {
    color: var(--navy);
    font-size: 15px;
    font-weight: 700;
}

.project-card-sub {
    margin-top: 4px;
    color: var(--gray-400);
    font-size: 12px;
}

.project-empty {
    color: var(--gray-400);
    font-size: 14px;
    padding: 12px;
}

/* ═══════════════════════════════════════════
   ADMIN & PROJECT MANAGEMENT PAGES
   ═══════════════════════════════════════════ */

.admin-page,
.pm-page,
.admin-page {
    max-width: 960px;
    padding: 24px 36px;
}

.admin-page .page-header,
.pm-page .page-header {
    margin-bottom: 28px;
}

.admin-page .page-header h1,
.pm-page .page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 4px;
}

.admin-page .page-header p,
.pm-page .page-header p {
    color: var(--gray-400);
    font-size: 14px;
}

/* Section cards */
.admin-section,
.pm-section {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 16px;
    padding: 28px 28px 24px;
    margin-bottom: 20px;
    animation: fadeInUp 0.4s ease both;
    position: relative;
    overflow: visible;
}

/* Ensure dropdown menus in earlier sections render above later sections */
.pm-section:nth-child(1) { z-index: 10; }
.pm-section:nth-child(2) { z-index: 9; }
.pm-section:nth-child(3) { z-index: 8; }
.pm-section:nth-child(4) { z-index: 7; }
.pm-section:nth-child(5) { z-index: 6; }

.admin-section:nth-child(2) { animation-delay: 0.05s; }
.admin-section:nth-child(3) { animation-delay: 0.10s; }
.admin-section:nth-child(4) { animation-delay: 0.15s; }
.admin-section:nth-child(5) { animation-delay: 0.20s; }
.admin-section:nth-child(6) { animation-delay: 0.25s; }

.pm-section:nth-child(2) { animation-delay: 0.05s; }
.pm-section:nth-child(3) { animation-delay: 0.10s; }
.pm-section:nth-child(4) { animation-delay: 0.15s; }
.pm-section:nth-child(5) { animation-delay: 0.20s; }

/* Section headers */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.section-icon.cyan {
    background: rgba(0, 212, 200, 0.12);
    color: var(--cyan);
}

.section-icon.navy {
    background: rgba(27, 42, 74, 0.08);
    color: var(--navy);
}

.section-icon.coral {
    background: rgba(242, 107, 91, 0.10);
    color: var(--coral);
}

.section-icon.yellow {
    background: rgba(245, 200, 66, 0.15);
    color: var(--u-yellow-ink);
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
}

.section-hint {
    color: var(--gray-400);
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.5;
}

/* Step-up 2FA banner (admin page) */
.admin-stepup-banner {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 14px;
    border: 1.5px solid transparent;
}

.admin-stepup-banner--locked {
    background: rgba(242, 107, 91, 0.10);
    border-color: rgba(242, 107, 91, 0.35);
    color: #8a2f22;
}

.admin-stepup-banner--unlocked {
    background: rgba(0, 212, 200, 0.10);
    border-color: rgba(0, 212, 200, 0.35);
    color: #006e66;
}

/* Small inline badge next to a section title signaling gated action */
.admin-section-badge {
    margin-left: auto;
    background: rgba(242, 107, 91, 0.12);
    color: #8a2f22;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Form fields */
.admin-form,
.pm-form {
    display: grid;
    gap: 16px;
    max-width: 560px;
}

/* Admin /admin : inputs plus larges — les consultants ont besoin de voir
   les mots de passe temporaires entiers, les codes 2FA, les emails longs,
   et les dropdowns multi-client empilent plusieurs tags. 560px était OK
   pour /projects/manage mais trop étroit ici (Corentin, 2026-04-22). */
.admin-form {
    max-width: 720px;
}

/* Sous-section Add client user : champs encore un peu plus larges pour que
   la dropdown multi-client tienne 4-5 tags sans scroll horizontal. */
.admin-subsection .admin-form,
.admin-subsection {
    max-width: 720px;
}

.field-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.field-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-100);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    background: var(--white);
    outline: none;
    color: var(--gray-800);
    transition: border-color 0.2s, background 0.2s;
    min-height: 44px;
    box-sizing: border-box;
}

.field-input:focus {
    border-color: var(--cyan);
    background: var(--white);
}

.field-input::placeholder {
    color: var(--gray-200);
}

/* Buttons */
.btn-admin-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    background: var(--navy);
    color: var(--white);
    font-weight: 600;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-admin-primary:hover {
    background: var(--navy-deep);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27, 42, 74, 0.2);
}

.btn-admin-cyan {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    background: var(--cyan);
    color: var(--navy);
    font-weight: 700;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-admin-cyan:hover {
    background: var(--cyan-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 200, 0.25);
}

.btn-admin-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: 1.5px solid var(--gray-100);
    border-radius: 10px;
    background: var(--white);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-admin-outline:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(0, 212, 200, 0.04);
}

.btn-admin-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border: 2px solid var(--coral);
    border-radius: 10px;
    background: transparent;
    color: var(--coral);
    font-weight: 700;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-admin-danger:hover {
    background: rgba(242, 107, 91, 0.08);
    transform: translateY(-1px);
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Upload zones */
.upload-zone {
    border: 2px dashed var(--gray-100);
    border-radius: 12px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    background: var(--white);
    transition: all 0.2s;
    font-size: 13px;
    color: var(--gray-400);
}

.upload-zone:hover {
    border-color: var(--cyan);
    background: rgba(0, 212, 200, 0.03);
}

.upload-zone a {
    color: var(--cyan) !important;
    font-weight: 600;
    text-decoration: none;
}

/* Action result messages */
.action-result {
    margin-top: 12px;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 8px;
    line-height: 1.5;
}

/* Admin clients table */
.admin-clients-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0;
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    overflow: hidden;
}

.admin-clients-grid .grid-header {
    background: var(--gray-50);
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gray-400);
    border-bottom: 1px solid var(--gray-100);
}

.admin-clients-grid .grid-cell {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-50);
}

.admin-clients-grid .grid-cell:nth-child(6n+4),
.admin-clients-grid .grid-cell:nth-child(6n+5),
.admin-clients-grid .grid-cell:nth-child(6n+6) {
    background: rgba(0, 0, 0, 0.01);
}

/* Services checklist */
.services-checklist label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-100);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}

.services-checklist label:hover {
    border-color: var(--cyan);
}

.services-checklist input:checked + label,
.services-checklist label.checked {
    background: rgba(0, 212, 200, 0.08);
    border-color: var(--cyan);
    color: var(--navy);
}

/* Grid helpers for form */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}
