:root {
    /* Colors */
    --primary-color: #FFB020;
    --primary-dark: #e69d1a;
    --primary-light: #ffc24d;
    --secondary-color: #9AA7B2;
    --success-color: #2EE59D;
    --danger-color: #ef4444;
    --warning-color: #FFB020;
    --info-color: #2EE59D;

    /* Surfaces */
    --background: #0B0F1A;
    --surface: #0d1320;
    --surface-elevated: #131a28;
    --border: #1a2435;
    --border-light: #121A2A;

    /* Typography */
    --text-primary: #E7EEF8;
    --text-secondary: #E7EEF8;
    --text-muted: #9AA7B2;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Layout */
    --sidebar-width: 260px;

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* Transitions */
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow-primary: 0 0 20px rgba(255, 176, 32, 0.15);
}

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

html {
    position: relative;
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-family);
    background: var(--background);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom text selection */
::selection {
    background: rgba(255, 176, 32, 0.3);
    color: #fff;
}

::-moz-selection {
    background: rgba(255, 176, 32, 0.3);
    color: #fff;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1b2635 0%, #020617 100%);
    color: var(--text-primary);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-header {
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    gap: 0.75rem;
}

.sidebar-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    letter-spacing: -0.02em;
}

.sidebar-header h3 i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #FFB020, #ffc24d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
    padding: 0;
    min-width: 0;
    overflow: hidden;
}

.sidebar-logo {
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar.collapsed .logo-container {
    display: none;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-section-label {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.875rem 0;
    margin: 0.25rem 0.5rem;
    gap: 0;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar.collapsed .nav-item::before {
    border-radius: 8px;
}

.sidebar.collapsed .sidebar-user {
    padding: 0.75rem 0.5rem;
    gap: 0;
}

.sidebar.collapsed .sidebar-user-info {
    display: none;
}

.sidebar.collapsed .sidebar-user-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
}

.sidebar.collapsed + .main-content {
    margin-left: 64px;
}

.sidebar-nav {
    padding: 0.5rem 0;
    flex: 1;
    overflow-y: auto;
}

/* Section labels inside sidebar */
.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    padding: 1.25rem 1.5rem 0.5rem;
    transition: all 0.3s ease;
}

.sidebar-section-label:first-child {
    padding-top: 0.75rem;
}

/* User profile section at sidebar bottom */
.sidebar-user {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
    transition: all 0.3s ease;
}


.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #FFB020, #ffc24d);
    color: #0B0F1A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 176, 32, 0.3);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1;
    transition: all 0.3s ease;
}

.sidebar-user-email {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-user-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-profile-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-profile-btn:hover {
    color: var(--primary-color);
}

.sidebar-profile-btn i {
    font-size: 0.8rem;
}

.sidebar-logout-form {
    margin: 0;
}

.sidebar-logout-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sidebar-logout-btn:hover {
    color: #ef4444;
}

.sidebar-logout-btn i {
    font-size: 0.8rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    font-weight: 500;
    margin: 0.25rem 0.75rem;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 176, 32, 0.2), rgba(255, 194, 77, 0.2));
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.nav-item:hover::before,
.nav-item.active::before {
    width: 100%;
}

.nav-item:hover {
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(255, 176, 32, 0.15), rgba(255, 194, 77, 0.1));
    color: white;
    border-left-color: #FFB020;
    box-shadow: 0 2px 8px rgba(255, 176, 32, 0.2);
}

.nav-item i {
    font-size: 1.3rem;
    position: relative;
    z-index: 1;
}

.nav-item span {
    position: relative;
    z-index: 1;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-header {
    background: rgba(11, 15, 26, 0.85);
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.content-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
}

.content-header h1 i {
    font-size: 1.4rem;
    color: var(--primary-color);
}

.content-header h1 svg {
    color: var(--primary-color);
    fill: var(--primary-color);
    width: 1.4rem;
    height: 1.4rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-actions .btn {
    height: auto;
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* ===== Account Select Dropdown ===== */
.account-select.form-control {
    min-width: 180px;
    max-width: 240px;
    background-color: rgba(19, 26, 40, 0.6);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.4rem 0.85rem !important;
    height: auto !important;
    min-height: 38px !important;
    line-height: 1.4 !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    backdrop-filter: blur(4px);
}

.account-select:hover {
    border-color: rgba(255, 176, 32, 0.35);
    background-color: rgba(19, 26, 40, 0.9);
}

.account-select:focus {
    background-color: var(--surface-elevated);
    color: var(--text-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 176, 32, 0.15);
    outline: none;
}

.account-select option {
    background-color: var(--surface);
    color: var(--text-primary);
}

.scope-form-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.scope-apply-btn {
    width: auto;
}

.multi-account-dropdown {
    position: relative;
    min-width: 260px;
}

.multi-account-dropdown .multi-account-toggle {
    cursor: pointer;
}

.multi-account-dropdown .multi-account-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 300;
    margin-top: 0.3rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 0.35rem 0;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-lg);
}

.multi-account-dropdown.open .multi-account-menu {
    display: block;
}

.multi-account-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.85rem;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
}

.multi-account-option:hover {
    background: rgba(148, 163, 184, 0.12);
}

.multi-account-option input[type="checkbox"] {
    margin: 0;
    width: 1rem;
    height: 1rem;
}

.multi-account-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.logout-form {
    margin: 0;
}

.auth-links {
    display: flex;
    gap: 0.75rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: var(--background);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 176, 32, 0.3);
}

.btn-outline-secondary {
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    color: white;
}

.sidebar-toggle-floating {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    border: none;
    padding: 1rem 0.75rem;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    z-index: 999;
    box-shadow: var(--shadow-xl);
    display: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle-floating:hover {
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    transform: translateY(-50%) scale(1.05);
}

.sidebar-toggle-floating i {
    font-size: 1.25rem;
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.menu-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.menu-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #FFB020, #ffc24d);
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-card:hover::before {
    transform: scaleX(1);
}

.menu-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.card-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #FFB020, #ffc24d);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 16px rgba(255, 176, 32, 0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.card-icon i {
    font-size: 2.25rem;
    color: white;
}

.menu-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.menu-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

/* Dashboard home layout */
.dashboard-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.dashboard-kpi-card {
    background: var(--surface-elevated);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kpi-help {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 0.3rem;
    cursor: help;
}

.kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-positive {
    color: #22c55e;
}

.kpi-negative {
    color: #ef4444;
}

.kpi-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.kpi-trend {
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.15rem;
}

.trend-positive {
    color: #22c55e;
}

.trend-negative {
    color: #ef4444;
}

.trend-neutral {
    color: var(--text-muted);
}

.dashboard-main-row {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.1fr);
    gap: 1.75rem;
}

.dashboard-card {
    background: var(--surface);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.dashboard-card-header {
    padding: 1.25rem 1.5rem 0.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dashboard-card-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.dashboard-card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dashboard-card-body {
    padding: 1.25rem 1.5rem 1.5rem 1.5rem;
}

.performance-body {
    padding-top: 0.75rem;
}

.performance-chart-placeholder {
    background: radial-gradient(circle at top left, rgba(255, 176, 32, 0.15), transparent 55%),
                radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.12), transparent 55%),
                var(--surface);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
}

.performance-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.chart-label {
    font-weight: 600;
    color: var(--text-primary);
}

.chart-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.performance-chart-mock {
    position: relative;
    height: 190px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.chart-axis {
    position: absolute;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 999px;
}

.chart-axis-y {
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
}

.chart-axis-x {
    left: 8px;
    right: 8px;
    bottom: 0;
    height: 2px;
}

.chart-line {
    position: absolute;
    inset: 12px 8px 8px 16px;
    border-radius: 999px;
    transform-origin: left bottom;
}

.chart-line-main {
    background: linear-gradient(135deg, #22c55e, #4ade80);
    opacity: 0.9;
    transform: skewX(-8deg) translateY(-4px);
}

.chart-line-shadow {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.5), transparent);
    transform: skewX(-12deg) translateY(14px);
}

.performance-legend {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 0.35rem;
}

.legend-equity {
    background: #22c55e;
}

.legend-dd {
    background: #ef4444;
}

/* Altezza maggiore per il grafico reale nella Performance Overview,
   così la card combacia meglio con la Quick Stats */
.performance-chart-real {
    height: 330px;
}

.text-positive {
    color: #22c55e;
}

.text-negative {
    color: #ef4444;
}

.dashboard-secondary-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.5fr);
    gap: 1.5rem;
}

.dashboard-mid-row {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
    align-items: stretch;
}

.dashboard-left-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    min-height: 0;
}

.dashboard-mini-table-wrap {
    overflow-x: auto;
}

.dashboard-recent-trades-card .dashboard-card-body {
    padding-bottom: 0.75rem;
}

.dashboard-recent-trades-card .dashboard-mini-table th,
.dashboard-recent-trades-card .dashboard-mini-table td {
    padding: 0.42rem 0.4rem;
}

.dashboard-recent-trades-card .dashboard-mini-table tbody tr:last-child td {
    border-bottom: none;
}

.weekly-snapshot-card .dashboard-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-top: 0.7rem;
    min-height: 0;
    overflow: auto;
}

.weekly-snapshot-card {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.weekly-top {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: flex-end;
}

.weekly-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.weekly-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.1;
}

.weekly-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.weekly-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.weekly-pill {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.weekly-pill small {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.weekly-pill strong {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.dashboard-calendar-host {
    display: flex;
    flex-direction: column;
}

.dashboard-calendar-host .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 0 !important;
    flex: 1;
}

.dashboard-calendar-host .card-header,
.dashboard-calendar-host .card-body {
    background: var(--surface);
    border: 0;
}

/* Mantieni identico spazio verticale sopra e sotto il calendario */
.dashboard-calendar-host .card-body {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.dashboard-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.dashboard-mini-table th,
.dashboard-mini-table td {
    padding: 0.55rem 0.45rem;
    border-bottom: 1px solid rgba(26, 36, 53, 0.65);
}

.dashboard-mini-table th {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mini-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.mini-link:hover {
    color: var(--primary-light);
}

.trading-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 0.3rem;
}

.heatmap-cell {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.heatmap-none {
    background: #374151;
}

.heatmap-low {
    background: #22c55e55;
}

.heatmap-mid {
    background: #22c55e99;
}

.heatmap-high {
    background: #16a34a;
}

.heatmap-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    margin-top: 0.75rem;
    color: var(--text-muted);
}

.heatmap-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    margin-right: 0.2rem;
}

.quick-add-dashboard-btn {
    width: auto;
}

/* Gruppo Quick Actions per allinearlo all'altezza della dropdown account (38px) */
.quick-actions-group .btn {
    height: 38px;
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.quick-actions-group > .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.quick-actions-group > .btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.quick-actions-group .quick-actions-toggle {
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 26px;
    border-left: 1px solid rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-actions-menu {
    min-width: 220px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
}

.quick-actions-menu .quick-action-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 0.84rem;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
}

.quick-actions-menu .quick-action-item:hover {
    background: rgba(255, 176, 32, 0.12);
    color: var(--text-primary);
}

.dashboard-account-picker-modal .modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
}

.dashboard-account-picker-help {
    margin-bottom: 0.7rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dashboard-account-picker-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dashboard-account-picker-item {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    width: 100%;
    text-align: left;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.dashboard-account-picker-item:hover {
    border-color: rgba(255, 176, 32, 0.4);
    background: rgba(255, 176, 32, 0.08);
}

.dashboard-account-picker-name {
    font-weight: 600;
}

.onboarding-card .dashboard-card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.onboarding-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.onboarding-progress-track {
    height: 8px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    overflow: hidden;
}

.onboarding-progress-value {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.onboarding-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.onboarding-step a {
    color: inherit;
    text-decoration: none;
}

.onboarding-step.done {
    color: #22c55e;
}

.onboarding-step.locked {
    opacity: 0.45;
    pointer-events: none;
}

.secondary-card .dashboard-card-body {
    padding-top: 0.75rem;
}

.secondary-body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.55rem 0.25rem;
    border-radius: 10px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.activity-item:hover {
    background: rgba(15, 23, 42, 0.75);
    transform: translateY(-1px);
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon i {
    font-size: 1.1rem;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    width: 100%;
    height: 100%;
}

.activity-icon.activity-warning {
    /* Stato evidente per import falliti: cerchio rosso più scuro e semi-trasparente */
    background: rgba(185, 28, 28, 0.55); /* rosso scuro con alpha */
}

.activity-icon.activity-warning i {
    color: #fee2e2; /* icona chiara ma non bianco pieno */
}

.activity-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.activity-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.activity-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.activity-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dashboard-quick-access {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quick-access-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.quick-access-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    display: flex;
    gap: 0.9rem;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.quick-access-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-access-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #FFB020, #ffc24d);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(255, 176, 32, 0.35);
}

.quick-access-icon i,
.quick-access-icon svg {
    color: #0b0f1a;
    font-size: 1.4rem;
}

.quick-access-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.quick-access-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.15rem 0 0.3rem 0;
}

.quick-access-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Login / Register / Auth Pages — Dark Glassmorphism
   ============================================ */

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes authGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes authFloat {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -20px); }
    66% { transform: translate(-20px, 15px); }
}

.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* Ambient glow orbs behind the card */
.auth-container::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 176, 32, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    animation: authFloat 12s ease-in-out infinite;
    pointer-events: none;
}

.auth-container::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: 15%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    animation: authFloat 15s ease-in-out infinite reverse;
    pointer-events: none;
}

.auth-card {
    background: rgba(13, 19, 32, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-2xl);
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
    padding: 2.75rem 2.5rem;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: authFadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Subtle golden glow on top edge */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    border-radius: 2px;
    animation: authGlow 3s ease-in-out infinite;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: block;
    max-width: 200px;
    height: auto;
    margin: 0 auto 1.5rem auto;
}

.auth-header h1 {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.auth-header h1 i {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 0.35rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Auth form inputs — dark theme */
.auth-card .form-control {
    background-color: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 0.8rem 1.1rem;
    font-size: 0.95rem;
    transition: var(--transition-base);
}

.auth-card .form-control:focus {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.12);
    color: var(--text-primary);
    transform: none;
}

.auth-card .form-control::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

.auth-card .form-check-input {
    accent-color: var(--primary-color);
    background-color: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
}

.auth-card .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.auth-card .form-label,
.auth-card .form-check-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.auth-card p {
    color: var(--text-muted);
}

.auth-card a.btn-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.auth-card a.btn-link:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* Auth primary button */
.auth-card .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #0B0F1A;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.85rem 2rem;
    font-size: 1rem;
    box-shadow: 0 4px 16px rgba(255, 176, 32, 0.3);
    transition: var(--transition-base);
    width: 100%;
    letter-spacing: 0.01em;
}

.auth-card .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 176, 32, 0.4);
    color: #0B0F1A;
}

.auth-card .btn-primary:active {
    transform: translateY(0);
}

/* Auth alerts */
.auth-card .alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.auth-card .alert-danger,
.auth-card .text-danger {
    color: #fca5a5;
}

/* Auth footer */
.auth-footer {
    margin-top: 2rem;
    text-align: center;
    color: rgba(148, 163, 184, 0.4);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

/* Auth form-group slightly tighter */
.auth-card .form-group {
    margin-bottom: 1.25rem;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .auth-card {
        padding: 2rem 1.5rem;
        margin: 0 0.5rem;
    }

    .auth-header h1 {
        font-size: 1.35rem;
    }

    .auth-logo {
        max-width: 160px;
    }
}
.form-group {
    margin-bottom: 1.75rem;
}

.form-label {
    display: block;
    margin-bottom: 0.625rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    background-color: var(--surface);
    color: var(--text-primary);
}

select.form-control option {
    background-color: var(--surface);
    color: var(--text-primary);
}

textarea.form-control {
    background-color: var(--surface);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 176, 32, 0.1);
    transform: translateY(-2px);
}

.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #FFB020, #ffc24d);
    color: white;
    width: 100%;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255, 176, 32, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 176, 32, 0.4);
    color: white;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    text-decoration: none;
    padding: 0;
    font-weight: 600;
}

.btn-link:hover {
    color: var(--primary-dark);
}

.text-danger {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: block;
    font-weight: 500;
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

/* Navbar adjustments for dashboard */
.navbar {
    display: none;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Responsive — Tablet (≤ 992px)
   ============================================ */
@media (max-width: 992px) {
    .dashboard-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-mid-row {
        grid-template-columns: 1fr;
    }

    .dashboard-left-stack {
        height: auto;
    }

    .weekly-snapshot-card {
        flex: 0 0 auto;
    }

    .dashboard-secondary-row {
        grid-template-columns: 1fr;
    }

    .footer {
        margin-left: 64px;
    }

    .sidebar.collapsed ~ .footer {
        margin-left: 0;
    }
}

/* ============================================
   Responsive — Mobile (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Sidebar: off-canvas overlay */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: var(--sidebar-width);
        z-index: 1100;
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

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

    .main-content {
        margin-left: 0 !important;
    }

    .sidebar-toggle-floating {
        display: block;
    }

    /* Footer */
    .footer {
        margin-left: 0;
        padding: 1rem;
        font-size: 0.8rem;
    }

    /* Content header */
    .content-header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        min-height: auto;
    }

    .content-header h1 {
        font-size: 1.15rem;
    }

    .content-header h1 i {
        font-size: 1.35rem;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-actions .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Account select dropdown */
    .account-select {
        min-width: 0;
        max-width: 100%;
        width: 100%;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    /* Dashboard content */
    .dashboard-content {
        padding: 1rem;
        gap: 1.25rem;
    }

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

    .dashboard-kpi-card {
        padding: 1rem 1.1rem;
    }

    .kpi-value {
        font-size: 1.15rem;
    }

    .dashboard-secondary-row {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .dashboard-mid-row {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .dashboard-card {
        border-radius: 14px;
    }

    .dashboard-card-header h2 {
        font-size: 1rem;
    }

    /* Menu grid (fallback) */
    .menu-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1.5rem;
    }
}

/* ============================================
   Responsive — Small Mobile (≤ 480px)
   ============================================ */
@media (max-width: 480px) {
    .dashboard-kpi-row {
        grid-template-columns: 1fr;
    }

    .weekly-grid {
        grid-template-columns: 1fr;
    }

    .content-header h1 {
        font-size: 1rem;
    }

    .dashboard-content {
        padding: 0.75rem;
    }
}
