:root {
    /* Ardacar Design System Tokenleri */
    --color-bg: #000000;
    --color-surface: #0e0e0e;
    --color-surface-hover: #1a1a1a;
    --color-primary: #f1c40f;
    --color-primary-hover: #d4ac0d;
    --color-white: #ffffff;
    --color-text-muted: #888888;
    --color-border: #222222;
    --color-border-hover: #333333;

    --font-main: 'Outfit', sans-serif;

    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 4px;

    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-white);
    height: 100vh;
    overflow: hidden;
    font-size: 1rem;
    /* Base minimum */
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100%;
    z-index: 99;
    transition: transform 0.3s ease;
}

/* Collapsed State for Sidebar */
.sidebar.closed {
    transform: translateX(-100%);
}

@media (min-width: 769px) {

    /* Desktop: Sidebar is fixed, main content pushes over */
    .app-container {
        padding-left: 0;
    }

    /* When sidebar is closed on desktop, main content expands */
    body.sidebar-closed .main-content {
        margin-left: 0 !important;
    }

    body.sidebar-closed .sidebar {
        transform: translateX(-100%);
    }
}

@media (max-width: 768px) {

    /* Mobile: Sidebar creates overlay style */
    .sidebar {
        width: 100%;
        max-width: 280px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    /* On mobile, hidden by default unless active */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 2.5rem;
    letter-spacing: 0.5px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-header h3 {
    font-size: 1rem;
    /* Bumped up */
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 1px;
    font-weight: 600;
}

.icon-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-white);
    cursor: pointer;
    transition: 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.icon-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.icon-btn-large {
    background: transparent;
    border: none;
    color: var(--color-white);
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 10px;
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: 0.2s;
}

.icon-btn-large:hover {
    color: var(--color-primary);
}

.portfolios-list ul {
    list-style: none;
}

.portfolio-item {
    margin-bottom: 6px;
}

.portfolio-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-size: 1rem;
}

.portfolio-link i {
    font-size: 1rem;
}

.portfolio-link:hover {
    background: var(--color-surface-hover);
    color: var(--color-white);
}

.portfolio-link.active {
    background: var(--color-surface-hover);
    color: var(--color-primary);
    border-color: var(--color-border);
}

/* Sidebar Charts Nav */
.sidebar-nav-charts {
    margin-top: 2rem;
    padding-top: 1rem;
}

.sidebar-nav-charts .nav-item {
    font-size: 1.05rem;
    /* Bumped up from 0.9 */
    padding: 12px;
}

.sidebar-nav-charts .nav-item.active {
    color: var(--color-primary);
    background: var(--color-surface-hover);
    border-right: 3px solid var(--color-primary);
}


.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.nav-item {
    background: none;
    border: none;
    color: var(--color-text-muted);
    width: 100%;
    text-align: left;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s ease;
    font-family: inherit;
    font-weight: 500;
    font-size: 1rem;
}

.nav-item:hover {
    color: var(--color-white);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--color-bg);
    transition: margin-left 0.3s ease;
}

.top-bar {
    padding: 2rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-bg);
}

.top-bar h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-white);
    letter-spacing: -0.5px;
}

.total-balance-display {
    text-align: right;
}

.total-balance-display .label {
    display: block;
    font-size: 1rem;
    /* Bumped up */
    color: var(--color-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-balance-display .amount {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
}

/* Reduce padding on mobile */
@media(max-width:768px) {
    .content-area {
        padding: 1rem;
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--color-border);
}

.empty-state h2 {
    color: var(--color-white);
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1.2rem;
}

.empty-state p {
    font-size: 1rem;
}


/* Buttons */
.primary-btn {
    background: var(--color-primary);
    color: #000000;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.primary-btn:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

.secondary-btn {
    background: transparent;
    color: var(--color-white);
    border: 1px solid var(--color-border);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.secondary-btn:hover {
    background: var(--color-surface-hover);
    border-color: #444;
}

/* Cards & Portfolio View */
.cat-group {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

@media(max-width:768px) {
    .cat-group {
        padding: 1rem;
    }
}

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: 10px;
}

.cat-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-white);
    display: flex;
    align-items: center;
    gap: 12px;
}

.subcat-group {
    margin-top: 1.5rem;
    margin-left: 0.5rem;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    /* background: #000 removed as requested */
    border-radius: var(--radius-md);
}

@media(max-width:768px) {
    .subcat-group {
        padding: 1rem;
        margin-left: 0;
    }
}


.subcat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 5px;
}

.subcat-header h3 {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Table / Items List */
.items-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.items-table th,
.items-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 1rem;
}

@media(max-width:768px) {

    .items-table th,
    .items-table td {
        padding: 10px;
    }

    .items-table {
        font-size: 1rem;
    }

    /* Ensure readable on mobile */
}


.items-table th {
    font-size: 0.9rem;
    /* Slightly smaller for headers is OK, but keeping readable */
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.02);
}

.items-table tr:last-child td {
    border-bottom: none;
}

.items-table tr:hover td {
    background: var(--color-surface);
}

.action-row {
    margin-top: 10px;
    text-align: right;
}

/* Chart View Styling */
.chart-view-container {
    display: flex;
    gap: 30px;
    height: 100%;
    align-items: stretch;
    flex-wrap: wrap;
    padding-bottom: 50px;
}

.chart-box {
    flex: 3;
    min-width: 300px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media(max-width:768px) {
    .chart-box {
        min-height: 400px;
        height: auto;
        padding: 1rem;
    }
}

.chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 1;
}

.chart-center-text .label {
    display: block;
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-center-text .value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-white);
}

.chart-legend-box {
    flex: 2;
    min-width: 300px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    min-height: 600px;
    /* Removed overflow-y: auto to allow full expansion */
}

@media(max-width:768px) {
    .chart-legend-box {
        height: auto;
        max-height: none;
    }
}

.chart-legend-header {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--color-white);
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.legend-item {
    padding: 14px;
    margin-bottom: 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: 0.2s ease;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--color-border);
}

.legend-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.legend-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    /* Square/rounded dot looks more modern */
}

.legend-percent {
    font-weight: 700;
    color: var(--color-white);
    font-size: 1.2rem;
}

.legend-value {
    font-size: 1rem;
    color: var(--color-text-muted);
    text-align: right;
    margin-bottom: 8px;
    font-family: var(--font-main);
    /* Removed monospace */
    font-weight: 500;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

/* Modal */
.hidden {
    display: none !important;
}

.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    background: var(--color-surface);
    width: 450px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    z-index: 1001;
    overflow: hidden;
}

@media(max-width:500px) {
    .modal-content {
        width: 90%;
    }
}


.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
}

.close-modal:hover {
    color: var(--color-white);
}

.modal-body {
    padding: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 1rem;
    color: var(--color-text-muted);
}

.input-group input,
.input-group select {
    width: 100%;
    background: #000;
    border: 1px solid var(--color-border);
    padding: 14px;
    border-radius: var(--radius-md);
    color: var(--color-white);
    font-family: var(--font-main);
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--color-primary);
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--color-border);
    background: rgba(0, 0, 0, 0.2);
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Utilities */
.text-right {
    text-align: right;
}

.font-bold {
    font-weight: 700;
}

.add-btn-small {
    font-size: 1rem;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.add-btn-small:hover {
    border-color: var(--color-white);
    color: var(--color-white);
}

.delete-btn {
    color: #666;
    cursor: pointer;
    margin-left: 12px;
    transition: 0.2s;
}

.delete-btn:hover {
    color: #d63031;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}



.input-readonly {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--color-text-muted) !important;
    cursor: not-allowed;
    border-color: transparent !important;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
}

.login-box {
    background: var(--color-surface);
    padding: 3rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

@media(max-width:500px) {
    .login-box {
        width: 90%;
        padding: 2rem;
    }
}

.login-logo {
    font-size: 3rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--color-white);
    font-weight: 600;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--color-primary);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: 0.2s;
}

.login-btn:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
}