:root {
    /* ЦВЕТОВА ПАЛИТРА (Deep Space Dark Theme) */
    --bg-body: #0b0e14;       /* Много тъмно синьо/черно */
    --bg-sidebar: #111827;    /* Малко по-светло за sidebar */
    --bg-panel: #1f2937;      /* Панели */
    --bg-input: #111827;      /* Инпути */
    --bg-hover: #374151;
    
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    
    --accent: #3b82f6;        /* Bright Blue */
    --accent-hover: #2563eb;
    
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    --border: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    outline: none;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; /* Скролва само main-content */
}

/* --- LAYOUT --- */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 40px; height: 40px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.logo-text h1 { font-size: 1.2rem; font-weight: 700; line-height: 1; }
.logo-text span { font-size: 0.8rem; color: var(--text-muted); }

.nav-menu { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; margin-left: 10px; font-weight: 600; letter-spacing: 1px; }

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 16px;
    border-radius: var(--radius);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    transition: 0.2s;
}

.nav-btn i { width: 20px; }
.nav-btn:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-btn.active { background: rgba(59, 130, 246, 0.15); color: var(--accent); border-left: 3px solid var(--accent); }

.badge { background: var(--bg-body); padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; border: 1px solid var(--border); }

.sidebar-footer { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-top: auto; }

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow-y: auto; /* Скрол само тук */
    gap: 25px;
}

/* --- STATS HEADER --- */
.top-header {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.05);
}
.stat-icon.blue { color: var(--accent); }
.stat-icon.orange { color: var(--warning); }
.stat-icon.green { color: var(--success); }

.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--text-main); line-height: 1.2; }

/* --- WORKSPACE SPLIT --- */
.workspace-grid {
    display: grid;
    grid-template-columns: 350px 1fr; /* Фиксирана лява част, разтеглива дясна */
    gap: 25px;
    height: 100%;
}

/* --- PANEL STYLES --- */
.editor-panel, .list-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.panel-header {
    padding: 15px 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}
.panel-header.space-between { justify-content: space-between; }
.panel-header h2 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }

/* --- FORM --- */
.form-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.full-width { grid-column: span 2; }

.input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

textarea { height: 120px; resize: vertical; }

.btn-primary {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
}
.btn-secondary:hover { background: var(--bg-hover); color: white; }

/* --- SEARCH & LIST --- */
.search-wrap {
    position: relative;
    width: 250px;
}
.search-wrap i {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}
.search-wrap input { padding-left: 30px; font-size: 0.85rem; }

.tasks-container {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 600px; /* Скрол вътре в списъка */
}

/* --- TASK CARD --- */
.task-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    border-left: 4px solid var(--accent); /* Default normal */
    transition: transform 0.2s, box-shadow 0.2s;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: #4b5563;
}

.task-card.priority-high { border-left-color: var(--danger); }
.task-card.priority-low { border-left-color: var(--success); }
.task-card.archived { opacity: 0.6; filter: grayscale(0.8); }

.card-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.card-title { font-weight: 600; font-size: 1rem; color: var(--text-main); }
.card-ver { 
    background: var(--bg-hover); 
    padding: 2px 8px; 
    border-radius: 4px; 
    font-size: 0.75rem; 
    color: var(--accent);
    font-family: monospace;
}

.card-body {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.card-date { font-size: 0.75rem; color: #6b7280; display: flex; gap: 5px; align-items: center; }

.card-actions { display: flex; gap: 6px; }

.icon-btn {
    width: 28px; height: 28px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.icon-btn:hover { background: var(--bg-hover); color: white; }
.icon-btn.done:hover { border-color: var(--success); color: var(--success); }
.icon-btn.edit:hover { border-color: var(--warning); color: var(--warning); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }

/* --- NOTIFICATIONS --- */
#notify-container {
    position: fixed; top: 20px; right: 20px; z-index: 999;
    display: flex; flex-direction: column; gap: 10px;
}
.notify {
    background: var(--bg-panel); border: 1px solid var(--border);
    padding: 12px 20px; border-radius: var(--radius);
    color: white; box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease; display: flex; align-items: center; gap: 10px;
}
.notify-success { border-left: 4px solid var(--success); }
.notify-error { border-left: 4px solid var(--danger); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile */
@media (max-width: 900px) {
    .app-layout { flex-direction: column; overflow-y: auto; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px; border-bottom: 1px solid var(--border); border-right: none; }
    .nav-menu { flex-direction: row; }
    .nav-label, .sidebar-footer { display: none; }
    .workspace-grid { grid-template-columns: 1fr; }
    .top-header { grid-template-columns: 1fr; }
}