/* Base Variables & Theme */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --panel-bg: rgba(20, 30, 54, 0.45);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Neon Accent Colors */
    --accent-primary: #6366f1; /* Indigo */
    --accent-primary-glow: rgba(99, 102, 241, 0.35);
    --accent-secondary: #3b82f6; /* Cyan-blue */
    --accent-success: #10b981; /* Emerald */
    --accent-success-glow: rgba(16, 185, 129, 0.2);
    --accent-danger: #f43f5e; /* Rose */
    --accent-danger-glow: rgba(244, 63, 94, 0.2);
    
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Ambient Glowing Backgrounds */
.background-glows {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.glow-1 {
    position: absolute;
    top: -10%;
    left: 15%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    filter: blur(60px);
}

.glow-2 {
    position: absolute;
    bottom: 10%;
    right: 5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    filter: blur(80px);
}

.glow-3 {
    position: absolute;
    top: 40%;
    left: -10%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    filter: blur(50px);
}

/* App Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glassmorphism Panel style */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Header CSS */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px var(--accent-primary-glow));
}

.logo-text h1 {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px var(--accent-primary-glow));
    transition: transform 0.3s ease;
    margin-bottom: 0.2rem;
}
.logo-text h1:hover {
    transform: scale(1.03);
}

.logo-text span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Language Pill Toggle */
.lang-pill-toggle {
    display: flex;
    align-items: center;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 3px;
    cursor: pointer;
    user-select: none;
    transition: var(--transition-smooth);
}

.lang-pill-option {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.lang-pill-option:not(.active):hover {
    color: var(--text-primary);
}

.lang-pill-option.active {
    background-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.8s infinite;
}

.status-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent-success);
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.col-span-3 {
    grid-column: span 3;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-1 {
    grid-column: span 1;
}

body:not(.manager-mode) .breakdown-section {
    grid-column: span 3;
}

body.manager-mode .breakdown-section {
    grid-column: span 2;
}

/* Key Metrics Cards */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 130px;
}

.main-portfolio-card {
    background: linear-gradient(135deg, rgba(20, 30, 54, 0.6) 0%, rgba(30, 41, 73, 0.4) 100%);
    border-left: 4px solid var(--accent-primary);
}

.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100px;
    height: 100px;
    background: var(--accent-primary);
    filter: blur(50px);
    opacity: 0.15;
    pointer-events: none;
}

.metric-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.sub-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.metric-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.return-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.return-indicator.up {
    color: var(--accent-success);
}

.return-indicator.down {
    color: var(--accent-danger);
}

.indicator-icon {
    font-size: 0.85rem;
}

.return-indicator.down .indicator-icon {
    transform: rotate(180deg);
}

.return-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
    margin-left: 0.3rem;
}

/* Allocation Charts */
.panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
    position: relative;
}

.margin-bottom-lg {
    margin-bottom: 2rem;
}

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

.charts-container {
    display: flex;
    justify-content: space-around;
    gap: 2rem;
    flex-wrap: wrap;
}

.chart-wrapper {
    flex: 1;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-wrapper h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
}

.chart-canvas-holder {
    position: relative;
    width: 200px;
    height: 200px;
}

/* Forms CSS */
.sleek-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-section {
    align-self: start;
    margin-top: 3.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.col-half {
    flex: 1;
    min-width: 0;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

select, input {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    outline: none;
    width: 100%;
}

select:focus, input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
    background-color: rgba(15, 23, 42, 0.85);
}

.btn-action.btn-delete:hover {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
    box-shadow: 0 0 12px var(--accent-danger-glow);
}

/* Settings Button */
.btn-settings {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0.2rem;
}

.btn-settings:hover {
    color: var(--accent-primary);
    transform: rotate(45deg);
}

/* Form Header & Buy/Sell Toggle */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-header .panel-title {
    margin-bottom: 0;
}

.tx-type-toggle {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    overflow: hidden;
}

.tx-type-toggle input[type="radio"] {
    display: none;
}

.tx-toggle-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tx-type-toggle input[type="radio"]:checked + .tx-buy {
    background: var(--accent-success);
    color: white;
}

.tx-type-toggle input[type="radio"]:checked + .tx-sell {
    background: var(--accent-danger);
    color: white;
}

.tx-type-toggle input[type="radio"]:checked + .tx-toggle-btn.tx-dividend {
    background: #eab308;
    color: white;
}

/* Management Modal Lists */
.management-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.management-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}

.management-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.management-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
}

.btn-delete-item {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-delete-item:hover {
    background: var(--accent-danger);
    color: white;
    box-shadow: 0 0 10px var(--accent-danger-glow);
}

.select-with-add {
    display: flex;
    gap: 0.5rem;
}

.select-with-add select {
    flex: 1;
}

.btn-icon-add {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--accent-primary);
    border-radius: 8px;
    width: 46px;
    height: 46px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.btn-icon-add:hover {
    background: var(--accent-primary);
    color: #fff;
}

.hidden-input {
    display: none;
    margin-top: 0.4rem;
    animation: slideDown 0.25s ease-out;
}

.hidden-input.show {
    display: block;
}

.uppercase {
    text-transform: uppercase;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.helper-calc {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    border-left: 2px solid var(--text-muted);
}

.helper-calc span {
    font-weight: 700;
    color: var(--text-secondary);
}

.btn-submit {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border: none;
    color: #ffffff;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.3);
    transition: var(--transition-smooth);
    margin-top: 0.5rem;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.45);
}

/* User Equity Breakdown Section */
.users-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.user-card {
    border: 1px solid var(--panel-border);
    background: rgba(30, 41, 59, 0.4);
    transition: var(--transition-smooth);
}

.user-card.expanded {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-primary-glow);
    background: rgba(99, 102, 241, 0.1);
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.8rem;
}

.user-card:not(.expanded) .user-card-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.user-name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-avatar-icon {
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.user-name {
    font-size: 1.15rem;
    font-weight: 700;
}

.user-share-badge {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

.user-main-stats {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.user-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.user-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.user-stat-value {
    font-size: 1.4rem;
    font-weight: 800;
}

.user-stat-value.sm {
    font-size: 1.05rem;
    font-weight: 600;
}

.user-card-holdings {
    margin-top: 1rem;
}

.user-card-holdings h5 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.holdings-mini-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.holding-mini-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.holding-ticker-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mini-ticker {
    font-weight: 700;
    color: var(--text-primary);
}

.mini-shares {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.holding-performance {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.mini-val {
    font-weight: 600;
}

.mini-gain {
    font-size: 0.7rem;
    font-weight: 500;
}

.gain-positive {
    color: var(--accent-success);
}

.gain-negative {
    color: var(--accent-danger);
}

.offline-warning-icon {
    font-size: 0.75rem;
    color: #eab308; /* Yellow */
    margin-left: 3px;
}

/* Ledger / Table styling */
.ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ledger-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
}

.sleek-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.sleek-table th {
    background: rgba(19, 27, 46, 0.8);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--panel-border);
}

.sleek-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

.sleek-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.sleek-table tbody tr.tx-buy {
    background: rgba(16, 185, 129, 0.08);
}
.sleek-table tbody tr.tx-buy:hover {
    background: rgba(16, 185, 129, 0.15);
}

.sleek-table tbody tr.tx-sell {
    background: rgba(244, 63, 94, 0.08);
}
.sleek-table tbody tr.tx-sell:hover {
    background: rgba(244, 63, 94, 0.15);
}

.sleek-table tbody tr.tx-dividend {
    background: rgba(234, 179, 8, 0.08);
}
.sleek-table tbody tr.tx-dividend:hover {
    background: rgba(234, 179, 8, 0.15);
}

.sleek-table tbody tr:last-child td {
    border-bottom: none;
}

.table-ticker {
    font-weight: 700;
    color: #fff;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    display: inline-block;
}

.table-user {
    font-weight: 500;
}

.btn-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.btn-delete:hover {
    color: var(--accent-danger);
    background: rgba(244, 63, 94, 0.1);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.toast {
    background: rgba(19, 27, 46, 0.95);
    border-left: 4px solid var(--accent-primary);
    border-top: 1px solid var(--panel-border);
    border-right: 1px solid var(--panel-border);
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 280px;
    animation: toastSlideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast.success {
    border-left-color: var(--accent-success);
}

.toast.error {
    border-left-color: var(--accent-danger);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Footer styling */
.app-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--panel-border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.app-footer i {
    font-size: 0.8rem;
    margin: 0 2px;
}

.accent-color {
    color: var(--accent-danger);
}

/* Mobile Collapse Icon (hidden on desktop) */
.collapse-icon {
    display: none;
    transition: transform 0.3s ease;
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .col-span-3 {
        grid-column: span 2;
    }
    .metrics-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .users-breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 800px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .col-span-3, .col-span-2, .col-span-1 {
        grid-column: span 1;
    }
    .metrics-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .users-breakdown-grid {
        grid-template-columns: 1fr;
    }
    .charts-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    .app-header {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

}

/* Manager Mode Styles */
.manager-only {
    display: none !important;
}
body.manager-mode section.manager-only {
    display: block !important;
}
body.manager-mode button.manager-only {
    display: inline-flex !important;
}
body.manager-mode th.manager-only, 
body.manager-mode td.manager-only {
    display: table-cell !important;
}

.header-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.manager-switch-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.switch-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--panel-border);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Edit Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    margin: 1rem;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--panel-border);
}

.modal-content .sleek-form {
    gap: 0.85rem;
}

.modal-content select, .modal-content input {
    padding: 0.6rem 0.8rem;
}

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-close-modal:hover {
    color: var(--accent-danger);
}

/* Triple Date Input Styling */
.triple-date-input {
    display: flex;
    align-items: center;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0 0.5rem;
    transition: var(--transition-smooth);
    width: 100%;
}

.triple-date-input:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
    background-color: rgba(15, 23, 42, 0.85);
}

.triple-date-input .date-part {
    background: transparent;
    border: none !important;
    border-radius: 0;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    padding: 0.75rem 0.2rem;
    text-align: center;
    width: 2.2rem;
    outline: none;
    box-shadow: none !important;
}

.triple-date-input .date-part::placeholder {
    color: var(--text-muted);
}

.triple-date-input .date-sep {
    color: var(--text-secondary);
    font-size: 0.95rem;
    user-select: none;
    padding: 0 0.1rem;
}

/* Ledger Tabs Styling */
.ledger-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.75rem;
    overflow-x: auto;
}

.ledger-tab {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
    outline: none;
}

.ledger-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.ledger-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 12px var(--accent-primary-glow);
}

/* RTL / Hebrew Support */
body.lang-he {
    font-family: 'Calibri', sans-serif;
    text-align: right;
    font-size: 1.25rem;
}

body.lang-he .logo-icon {
    margin-right: 0;
    margin-left: 0.75rem;
}



body.lang-he .ledger-tabs {
    justify-content: flex-start;
}

body.lang-he th,
body.lang-he td {
    text-align: right;
}

body.lang-he .action-buttons {
    justify-content: flex-start;
}

body.lang-he .btn-action {
    margin-right: 0;
    margin-left: 0.5rem;
}

body.lang-he .modal-header h3 {
    text-align: right;
}

body.lang-he .btn-close-modal {
    margin-left: 0;
    margin-right: auto;
}

body.lang-he .main-portfolio-card {
    border-left: none;
    border-right: 4px solid var(--accent-primary);
}

body.lang-he .tx-toggle-btn {
    text-align: center;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .app-container {
        padding: 2rem 0.5rem 1rem 0.5rem;
        gap: 1rem;
    }
    .metrics-row {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    .metric-card {
        min-height: auto;
        padding: 1rem;
    }
    .metric-value {
        font-size: 1.6rem;
    }
    .sub-value {
        font-size: 1.5rem;
    }
    .form-row {
        flex-direction: column;
        gap: 1.2rem;
    }
    .tx-type-toggle {
        flex-wrap: wrap;
    }
    .tx-toggle-btn {
        flex: 1;
        text-align: center;
    }
    .table-container {
        border: none;
        background: transparent;
    }
    .sleek-table, .sleek-table tbody {
        display: block;
        width: 100%;
    }
    .sleek-table thead {
        display: none;
    }
    .sleek-table tr {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem 0.25rem;
        margin-bottom: 1rem;
        border: 1px solid var(--panel-border);
        border-radius: 10px;
        padding: 0.6rem;
        background: rgba(255, 255, 255, 0.02);
    }
    .sleek-table td {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: start;
        padding: 0;
        border-bottom: none;
    }
    .sleek-table td:last-child {
        grid-column: auto;
        flex-direction: column;
        justify-content: flex-end;
        align-items: flex-start;
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }
    body.lang-he .sleek-table td:last-child {
        align-items: flex-start;
    }
    .sleek-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.7rem;
        margin: 0;
        margin-bottom: 0.15rem;
        text-align: start;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .action-buttons, .manager-only {
        justify-content: flex-end;
    }
    body.lang-he .action-buttons, body.lang-he .manager-only {
        justify-content: flex-start;
    }
    
    /* Mobile Accordion for User Cards */
    .collapse-icon {
        display: inline-block;
        margin-left: 0.5rem;
    }
    body.lang-he .collapse-icon {
        margin-left: 0;
        margin-right: 0.5rem;
    }
    .user-card-content {
        display: none;
    }
    .user-card.expanded .user-card-content {
        display: block;
    }
    .user-card.expanded .collapse-icon {
        transform: rotate(180deg);
    }
    .user-card-header {
        cursor: pointer;
    }
    
    /* Edit Modal Scaling for small screens */
    .modal-content {
        margin: 0.5rem;
        max-height: 98vh;
        padding: 1rem;
    }
    .modal-content .sleek-form {
        gap: 0.6rem;
    }
    .modal-header {
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
    }
    .form-group {
        margin-bottom: 0.2rem;
    }
    
    /* Fix grid override in manager mode */
    body.manager-mode .breakdown-section,
    body:not(.manager-mode) .breakdown-section {
        grid-column: span 1 !important;
    }
    
    /* Scale down large title */
    .logo-text h1 {
        font-size: 1.25rem;
        text-align: center;
    }
    .logo-area {
        flex-direction: row;
        justify-content: center;
        text-align: center;
        gap: 0.5rem;
    }
    
    /* Fix ledger header overlap */
    .ledger-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Header Controls layout override for mobile */
    .header-controls {
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        width: 100%;
        gap: 0.5rem;
        transform: scale(0.9); /* compress slightly */
        transform-origin: center top;
    }
    .status-indicator {
        align-self: center;
        padding: 0.4rem 0.6rem;
    }
    .lang-pill-option {
        padding: 4px 8px;
    }
}
