/* ── Cole Dashboard — Main Stylesheet ─────────────────────────────────────── */

:root {
    --bg:           #0f1117;
    --surface:      #1a1d27;
    --surface-2:    #22263a;
    --border:       #2e3248;
    --accent:       #4f8ef7;
    --accent-hover: #3a7de8;
    --accent-green: #22c55e;
    --accent-amber: #f59e0b;
    --accent-red:   #ef4444;
    --accent-purple:#a855f7;
    --text:         #e8eaf0;
    --text-muted:   #7c8099;
    --text-dim:     #4a4f6a;
    --sidebar-w:    240px;
    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 4px 24px rgba(0,0,0,0.4);
}

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

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    transition: transform 0.25s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.kai-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.cole-icon { font-size: 1.4rem; }

.cole-name {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent);
}

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

.nav-links {
    list-style: none;
    padding: 0.75rem 0;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
    border-radius: 0;
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-link.active {
    color: var(--accent);
    background: rgba(79, 142, 247, 0.1);
    border-right: 2px solid var(--accent);
}

.nav-icon { font-size: 1rem; width: 1.25rem; text-align: center; }

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 1.25rem;
}

.nav-section-label {
    padding: 0.4rem 1.25rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.logout-btn {
    display: block;
    text-align: center;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.logout-btn:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

/* ── Main Content ─────────────────────────────────────────────────────────── */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
}

.top-bar-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notif-bell {
    cursor: pointer;
    font-size: 1.1rem;
    position: relative;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.notif-bell:hover { background: var(--surface-2); }

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent-red);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 4px;
    min-width: 16px;
    text-align: center;
}

.notif-panel {
    position: absolute;
    top: 56px;
    right: 1rem;
    width: 340px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 200;
    max-height: 420px;
    overflow-y: auto;
}

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

.notif-panel-header button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.8rem;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── Grid ─────────────────────────────────────────────────────────────────── */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ── Stat Cards ───────────────────────────────────────────────────────────── */

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 0.3rem;
}

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

/* ── Badges / Pills ───────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-blue   { background: rgba(79,142,247,0.15); color: var(--accent); }
.badge-green  { background: rgba(34,197,94,0.15);  color: var(--accent-green); }
.badge-amber  { background: rgba(245,158,11,0.15); color: var(--accent-amber); }
.badge-red    { background: rgba(239,68,68,0.15);  color: var(--accent-red); }
.badge-purple { background: rgba(168,85,247,0.15); color: var(--accent-purple); }
.badge-gray   { background: rgba(124,128,153,0.15); color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }
.btn-green { background: var(--accent-green); color: white; }
.btn-green:hover { background: #16a34a; color: white; }

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.35rem; }

.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
}

.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-dim); }

select.form-control option { background: var(--surface-2); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Tables ───────────────────────────────────────────────────────────────── */

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Priority Colors ──────────────────────────────────────────────────────── */

.priority-urgent { color: var(--accent-red); }
.priority-high   { color: var(--accent-amber); }
.priority-medium { color: var(--accent); }
.priority-low    { color: var(--text-muted); }

/* ── Habit Checkboxes ─────────────────────────────────────────────────────── */

.habit-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.habit-item:last-child { border-bottom: none; }

.habit-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    background: none;
}

.habit-check.done {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.habit-name { flex: 1; font-size: 0.875rem; }
.habit-name.done { text-decoration: line-through; color: var(--text-muted); }

.pillar-tag {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Pipeline Kanban ──────────────────────────────────────────────────────── */

.pipeline-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.pipeline-col {
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    flex-shrink: 0;
}

.pipeline-col-header {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipeline-count {
    background: var(--surface-2);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.pipeline-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.pipeline-card-name { font-weight: 500; margin-bottom: 0.2rem; }
.pipeline-card-meta { font-size: 0.72rem; color: var(--text-muted); }

/* ── Page Header ──────────────────────────────────────────────────────────── */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-title { font-size: 1rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

/* ── Login Page ───────────────────────────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-logo .cole-icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.login-logo .cole-name { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.login-logo p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.3rem; }

.login-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--accent-red);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: var(--accent-green); }
.alert-error   { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--accent-red); }
.alert-info    { background: rgba(79,142,247,0.1); border: 1px solid rgba(79,142,247,0.3); color: var(--accent); }

/* ── Mood Colors ──────────────────────────────────────────────────────────── */

.mood-great   { color: var(--accent-green); }
.mood-good    { color: #86efac; }
.mood-neutral { color: var(--text-muted); }
.mood-low     { color: var(--accent-amber); }
.mood-rough   { color: var(--accent-red); }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
    }

    .sidebar.open { transform: translateX(0); }

    .menu-toggle { display: block; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    .page-content { padding: 1rem; }
}
