:root {
    --bg-color: #f0f4f8; /* Soft blue-gray background */
    --card-bg: #ffffff;
    --text-main: #1e293b; /* Slate 800 */
    --text-muted: #64748b; /* Slate 500 */
    --accent: #2563eb; /* Blue 600 */
    --accent-hover: #1d4ed8; /* Blue 700 */
    --border: #e2e8f0; /* Slate 200 */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1400px;
    z-index: 1;
}

header {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    margin: 0;
}

header p { 
    color: var(--text-muted); 
    font-size: 1.1rem; 
    margin-top: 0.5rem;
}

/* Global Search Bar */
#global-search {
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    transition: border-color 0.2s;
}
#global-search:focus {
    outline: none;
    border-color: var(--accent);
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.left-col, .right-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 0.75rem;
}

/* Lists and Checkboxes */
.list { list-style: none; }
.list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bg-color);
}
.list li:last-child { border-bottom: none; }

.list li.completed .text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checkbox {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    margin-top: 2px;
    flex-shrink: 0;
    background: white;
}
.checkbox:checked { background: var(--accent); }
.checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.text { flex: 1; font-size: 1.05rem; line-height: 1.4; color: var(--text-main); }
.timestamp { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 4px; }

/* Dynamic Categories */
.category-card { margin-bottom: 1.5rem; }
.category-card:last-child { margin-bottom: 0; }

.markdown-content {
    line-height: 1.6;
    color: var(--text-main);
    font-size: 1.05rem;
}
.markdown-content ul { margin-left: 1.5rem; margin-top: 0.5rem; }
.markdown-content li { margin-bottom: 0.5rem; }

/* Buttons */
.custom-file-upload {
    display: inline-block;
    padding: 8px 16px;
    cursor: pointer;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s, transform 0.2s;
    border: none;
    outline: none;
}
.custom-file-upload:hover { background: var(--accent-hover); }

/* Chat Box */
.ai-chat-card { display: flex; flex-direction: column; height: 500px; }
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}
.chat-msg {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.4;
}
.user-msg {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}
.ai-msg {
    align-self: flex-start;
    background: var(--bg-color);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}
.chat-input-area { display: flex; gap: 10px; }
#chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Outfit';
    font-size: 1rem;
}

/* Raw Notes Log */
.raw-notes-container {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}
.raw-note {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}
.raw-note:last-child { margin-bottom: 0; }

@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    body { padding: 1rem; }
    header { padding: 1.5rem; }
}
