/* ─── CSS Variables ────────────────────────────────────────────────────────── */
:root {
    --bg:           #f8fafc;
    --bg-card:      #ffffff;
    --bg-header:    #ffffff;
    --border:       #e2e8f0;
    --border-hover: #94a3b8;
    --text-1:       #1e293b;
    --text-2:       #475569;
    --text-3:       #94a3b8;
    --accent:       #3b82f6;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.1);
    --radius:       4px;
    --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html.dark {
    --bg:           #0f172a;
    --bg-card:      #1e293b;
    --bg-header:    #1e293b;
    --border:       #334155;
    --border-hover: #64748b;
    --text-1:       #f1f5f9;
    --text-2:       #94a3b8;
    --text-3:       #475569;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.4);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-1);
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── App shell ────────────────────────────────────────────────────────────── */
#appContainer {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
.app-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 10;
}

.header-top {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.logo-icon {
    color: var(--accent);
    font-size: 22px;
    font-variation-settings: 'FILL' 1;
}

.logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.02em;
}

.search-input {
    flex: 1;
    height: 30px;
    padding: 0 12px 0 32px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-1);
    font-family: var(--font);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }

.sign-out-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font);
    letter-spacing: 0.04em;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.sign-out-btn .material-symbols-outlined { font-size: 15px; }
.sign-out-btn:hover { background: var(--bg); border-color: var(--border-hover); color: var(--text-1); }

/* ─── Project filter bar ───────────────────────────────────────────────────── */
.header-projects {
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    overflow-x: auto;
}
.header-projects::-webkit-scrollbar { height: 0; }

.add-task-header-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px 4px 8px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font);
    letter-spacing: 0.05em;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.add-task-header-btn:hover { background: #2563eb; }
.add-task-header-btn .material-symbols-outlined { font-size: 16px; }

.new-project-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px 4px 6px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font);
    letter-spacing: 0.05em;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
    transition: border-color 0.15s, color 0.15s;
}
.new-project-btn:hover { border-color: var(--accent); color: var(--accent); }
.new-project-btn .material-symbols-outlined { font-size: 16px; }

.projects-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Project chips */
.project-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    position: relative;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.project-chip.chip-inactive { opacity: 0.45; }
.project-chip.chip-inactive:hover { opacity: 0.75; }

.chip-checkbox {
    width: 11px;
    height: 11px;
    cursor: pointer;
    accent-color: currentColor;
    flex-shrink: 0;
}

.chip-name { cursor: pointer; user-select: none; }
.chip-name:hover { text-decoration: underline; }

.chip-del {
    display: none;
    background: none;
    border: none;
    color: currentColor;
    opacity: 0.6;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 0 0 2px;
    font-family: var(--font);
}
.project-chip:hover .chip-del { display: inline; }
.chip-del:hover { opacity: 1; }

/* ─── Kanban main ──────────────────────────────────────────────────────────── */
.kanban-main {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-start;
}
.kanban-main::-webkit-scrollbar { height: 5px; }
.kanban-main::-webkit-scrollbar-track { background: transparent; }
.kanban-main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ─── Kanban columns ───────────────────────────────────────────────────────── */
.kanban-col-wrap {
    flex-shrink: 0;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    max-height: 100%;
}

.kanban-col-wrap[data-status="Blocked"] { opacity: 0.72; transition: opacity 0.2s; }
.kanban-col-wrap[data-status="Blocked"]:hover { opacity: 1; }

.kanban-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
    flex-shrink: 0;
}

.col-title-group {
    display: flex;
    align-items: center;
    gap: 7px;
}

.col-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-2);
}

/* Count badge — uniform blue across all columns */
.task-count {
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    padding: 0 4px;
    background: #dbeafe;
    color: #2563eb;
}
html.dark .task-count { background: #1e3a5f; color: #60a5fa; }


/* ─── Tasks container ──────────────────────────────────────────────────────── */
.tasks-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    flex: 1;
    min-height: 40px;
}
.tasks-container::-webkit-scrollbar { width: 3px; }
.tasks-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.tasks-container.drag-over {
    background: rgba(59,130,246,0.06);
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    border-radius: var(--radius);
}

/* ─── Task cards ───────────────────────────────────────────────────────────── */
.task-card {
    display: flex;
    align-items: stretch;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 48px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
}
.task-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}
.task-card.dragging { opacity: 0.45; }


/* Left stripe — project color */
.card-stripe {
    width: 5px;
    flex-shrink: 0;
    border-radius: var(--radius) 0 0 var(--radius);
}

/* Card body */
.card-body {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.card-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* Right tab — priority indicator (vertical text) */
.priority-tab {
    width: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.priority-tab span {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    user-select: none;
}

.priority-tab.High   { background: #fee2e2; color: #dc2626; }
.priority-tab.Medium { background: #ffedd5; color: #ea580c; }
.priority-tab.Low    { background: #dbeafe; color: #2563eb; }

html.dark .priority-tab.High   { background: #3f0a0a; color: #f87171; }
html.dark .priority-tab.Medium { background: #3d1407; color: #fb923c; }
html.dark .priority-tab.Low    { background: #172554; color: #60a5fa; }

/* ─── Dark mode toggle ─────────────────────────────────────────────────────── */
.dark-mode-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.15s;
    z-index: 50;
    color: var(--text-2);
}
.dark-mode-toggle:hover { transform: scale(1.08); }
.dark-mode-toggle .material-symbols-outlined { font-size: 18px; }

.dark-icon  { display: block; }
.light-icon { display: none; }
html.dark .dark-icon  { display: none; }
html.dark .light-icon { display: block; }

/* ─── Modals ───────────────────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
}
.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-card);
    padding: 28px;
    border-radius: 8px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-md);
    position: relative;
    border: 1px solid var(--border);
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-1);
}

.close {
    position: absolute;
    right: 16px;
    top: 14px;
    font-size: 22px;
    color: var(--text-3);
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}
.close:hover { color: var(--text-1); }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-1);
    font-family: var(--font);
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

input[type="color"] { height: 36px; cursor: pointer; }

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}
.form-actions button { flex: 1; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    transition: background 0.15s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: var(--border); color: var(--text-2); }
.btn-secondary:hover { background: var(--border-hover); color: var(--text-1); }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }

/* ─── Auth screen ──────────────────────────────────────────────────────────── */
.auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f8fafc;
}

.auth-container {
    width: 100%;
    max-width: 380px;
    background: white;
    padding: 36px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.auth-container h1 {
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: #f1f5f9;
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    transition: background 0.15s;
}
.auth-tab.active { background: #3b82f6; color: white; }

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font);
    color: #1e293b;
    transition: border-color 0.15s;
}
.auth-form input:focus { outline: none; border-color: #3b82f6; }

.auth-form button {
    padding: 10px;
    font-size: 14px;
    font-family: var(--font);
}

.auth-error   { color: #dc2626; font-size: 12px; min-height: 18px; }
.auth-message { color: #16a34a; font-size: 12px; min-height: 18px; }
