/* THE DESK — Design System
   Warm beige/caramel, coffee-shop-meets-bullet-journal */

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

/* ── Custom Properties ──────────────────────────────────────── */
:root {
    --color-bg: #F5EFE6;
    --color-surface: #FFF9F2;
    --color-surface-alt: #F0E6D8;
    --color-accent: #8B5E3C;
    --color-accent-light: #A67B5B;
    --color-accent-dark: #6B4226;
    --color-text: #3D2B1F;
    --color-text-light: #7A6555;
    --color-text-on-accent: #FFFAF5;
    --color-warning: #C17032;
    --color-success: #6B8F71;
    --color-danger: #B5494B;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(61,43,31,0.08);
    --shadow-md: 0 4px 12px rgba(61,43,31,0.10);
    --shadow-lg: 0 8px 24px rgba(61,43,31,0.12);
    --shadow-hover: 0 6px 16px rgba(61,43,31,0.14);
}

/* ── Base ───────────────────────────────────────────────────── */
html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); }

/* ── Typography ─────────────────────────────────────────────── */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.25rem; }
.text-xl { font-size: 1.5rem; }
.text-2xl { font-size: 2rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-light { color: var(--color-text-light); }
.text-accent { color: var(--color-accent); }
.text-warning { color: var(--color-warning); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }

/* ── Card ───────────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-accent {
    background: var(--color-accent);
    color: var(--color-text-on-accent);
}
.card-accent .text-light { color: rgba(255,250,245,0.7); }
.card-warning { border-left: 3px solid var(--color-warning); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-primary {
    background: var(--color-accent);
    color: var(--color-text-on-accent);
}
.btn-primary:hover { background: var(--color-accent-dark); }
.btn-secondary {
    background: var(--color-surface-alt);
    color: var(--color-text);
}
.btn-secondary:hover { background: #E5D9CB; }
.btn-ghost {
    background: transparent;
    color: var(--color-text-light);
}
.btn-ghost:hover { background: var(--color-surface-alt); color: var(--color-text); }
.btn-sm { padding: var(--space-xs) var(--space-sm); font-size: 0.75rem; }
.btn-icon {
    width: 36px; height: 36px;
    padding: 0; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: none; cursor: pointer;
    background: transparent; color: var(--color-text-light);
    transition: all 0.15s ease;
}
.btn-icon:hover { background: var(--color-surface-alt); color: var(--color-text); }

/* ── Forms ──────────────────────────────────────────────────── */
.input, .select, .textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-surface-alt);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--color-accent-light);
    box-shadow: 0 0 0 3px rgba(139,94,60,0.1);
}
.textarea { resize: vertical; min-height: 80px; }
.form-group { margin-bottom: var(--space-md); }
.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }

/* ── Header ─────────────────────────────────────────────────── */
.header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) var(--space-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}
.header-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: -0.02em;
}
.header-center { display: flex; align-items: center; gap: var(--space-md); }
.header-right { display: flex; align-items: center; gap: var(--space-md); }
.header-user { font-size: 0.875rem; font-weight: 500; color: var(--color-text-light); }

/* Voice button */
.btn-voice {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--color-accent);
    color: var(--color-text-on-accent);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}
.btn-voice:hover { background: var(--color-accent-dark); transform: scale(1.05); }
.btn-voice.recording {
    background: var(--color-danger);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(181,73,75,0.4); }
    50% { box-shadow: 0 0 0 12px rgba(181,73,75,0); }
}

/* Notification bell */
.btn-notif { position: relative; }
.badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--color-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}

/* ── Main Layout ────────────────────────────────────────────── */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-xl);
}

/* ── Briefing Card ──────────────────────────────────────────── */
.briefing {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
}
.briefing-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-sm);
}
.briefing-title { font-size: 1.25rem; font-weight: 700; }
.briefing-summary { font-size: 0.875rem; color: var(--color-text-light); margin-bottom: var(--space-sm); }
.briefing-items { list-style: none; }
.briefing-items li {
    padding: var(--space-xs) 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-surface-alt);
}
.briefing-items li:last-child { border-bottom: none; }
.briefing-completed {
    margin-top: var(--space-sm);
    font-size: 0.875rem;
    color: var(--color-success);
    font-weight: 500;
}
.briefing.collapsed .briefing-body { display: none; }
.briefing-toggle {
    background: none; border: none; cursor: pointer;
    color: var(--color-text-light); font-size: 1.2rem;
    transition: transform 0.2s;
}
.briefing.collapsed .briefing-toggle { transform: rotate(-90deg); }

/* ── Tab Bar ────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.tab {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: var(--color-surface);
    color: var(--color-text-light);
    transition: all 0.15s ease;
}
.tab:hover { background: var(--color-surface-alt); color: var(--color-text); }
.tab.active {
    background: var(--color-accent);
    color: var(--color-text-on-accent);
}
.tab .tab-count {
    display: inline-block;
    min-width: 20px; height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: rgba(0,0,0,0.1);
    font-size: 0.7rem;
    line-height: 20px;
    text-align: center;
    margin-left: var(--space-xs);
}
.tab.active .tab-count { background: rgba(255,255,255,0.25); }

/* ── Pipeline ───────────────────────────────────────────────── */
.pipeline-container {
    overflow-x: auto;
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-lg);
    -webkit-overflow-scrolling: touch;
}
.pipeline {
    display: flex;
    gap: var(--space-md);
    min-height: 200px;
}
.stage-column {
    flex: 0 0 220px;
    min-height: 150px;
}
.stage-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    padding: var(--space-sm) var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.stage-count {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--color-surface-alt);
    font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center;
}
.stage-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-height: 60px;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.stage-cards.sortable-ghost-class { background: rgba(139,94,60,0.05); }

/* ── Project Card ───────────────────────────────────────────── */
.project-card {
    padding: var(--space-md);
    cursor: grab;
    user-select: none;
}
.project-card:active { cursor: grabbing; }
.project-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.75rem;
    color: var(--color-text-light);
}
.project-card-days {
    font-weight: 600;
}
.project-card-days.warning { color: var(--color-warning); }
.project-card-tasks {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Drag states */
.sortable-chosen { opacity: 0.9; transform: rotate(2deg); box-shadow: var(--shadow-lg) !important; }
.sortable-ghost {
    opacity: 0.3;
    background: var(--color-accent-light) !important;
}
.sortable-drag { box-shadow: var(--shadow-lg) !important; }

/* ── Bottom Grid ────────────────────────────────────────────── */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

/* Due Today */
.due-today { padding: var(--space-lg); }
.due-today-header {
    font-size: 1rem; font-weight: 600;
    margin-bottom: var(--space-md);
}
.task-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-surface-alt);
    font-size: 0.875rem;
}
.task-item:last-child { border-bottom: none; }
.task-checkbox {
    width: 18px; height: 18px;
    border-radius: 4px;
    border: 2px solid var(--color-accent-light);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
    background: transparent;
}
.task-checkbox:hover { border-color: var(--color-accent); background: rgba(139,94,60,0.05); }
.task-checkbox.checked {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}
.task-item.done .task-title { text-decoration: line-through; color: var(--color-text-light); }
.task-title { flex: 1; }
.task-project { font-size: 0.75rem; color: var(--color-text-light); }
.task-due {
    font-size: 0.75rem; color: var(--color-text-light);
    white-space: nowrap;
}
.task-due.overdue { color: var(--color-danger); font-weight: 500; }

/* Needs Attention */
.needs-attention { padding: var(--space-lg); }
.needs-attention-header {
    font-size: 1rem; font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-text-on-accent);
}
.attention-item {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    font-size: 0.875rem;
    cursor: pointer;
    transition: opacity 0.15s;
}
.attention-item:hover { opacity: 0.8; }
.attention-item:last-child { border-bottom: none; }
.attention-label { font-weight: 500; }
.attention-detail { font-size: 0.75rem; opacity: 0.7; margin-top: 2px; }

/* ── Project Detail Panel ───────────────────────────────────── */
.panel-overlay {
    position: fixed; inset: 0;
    background: rgba(61,43,31,0.3);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.panel-overlay.open { opacity: 1; pointer-events: all; }

.panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 50%;
    min-width: 400px;
    max-width: 700px;
    background: var(--color-surface);
    box-shadow: -8px 0 32px rgba(61,43,31,0.15);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.panel.open { transform: translateX(0); }

.panel-header {
    display: flex; align-items: center; gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-surface-alt);
    flex-shrink: 0;
}
.panel-back { font-size: 1.2rem; }
.panel-title { flex: 1; }
.panel-title h2 { font-size: 1.25rem; font-weight: 700; }
.panel-title .panel-subtitle { font-size: 0.875rem; color: var(--color-text-light); }

.panel-body { flex: 1; padding: var(--space-lg); overflow-y: auto; }

.panel-section {
    margin-bottom: var(--space-xl);
}
.panel-section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Client info */
.client-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-xs) var(--space-md);
    font-size: 0.875rem;
    margin-bottom: var(--space-lg);
}
.client-info-label { color: var(--color-text-light); }

/* Stage progress */
.stage-progress {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}
.stage-pip {
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--color-surface-alt);
    color: var(--color-text-light);
    transition: all 0.15s;
    cursor: pointer;
}
.stage-pip.completed { background: var(--color-success); color: white; }
.stage-pip.current { background: var(--color-accent); color: var(--color-text-on-accent); }
.stage-pip:hover { transform: scale(1.05); }

/* Tasks in panel */
.panel-task {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-surface-alt);
}
.panel-task:last-child { border-bottom: none; }
.panel-task-info { flex: 1; }
.panel-task-title { font-size: 0.875rem; }
.panel-task-meta {
    font-size: 0.75rem;
    color: var(--color-text-light);
    display: flex; gap: var(--space-sm);
    margin-top: 2px;
}
.panel-task.done .panel-task-title { text-decoration: line-through; color: var(--color-text-light); }

/* Inline task add */
.task-add-form {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}
.task-add-form .input { flex: 1; }

/* Activity log */
.activity-item {
    display: flex; gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 0.8rem;
    color: var(--color-text-light);
}
.activity-date { flex-shrink: 0; font-weight: 500; width: 60px; }
.activity-text { flex: 1; }

/* Notes */
.note-item {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(61,43,31,0.4);
    z-index: 300;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-surface-alt);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: var(--space-lg); }
.modal-footer {
    display: flex; justify-content: flex-end; gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-surface-alt);
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast-container {
    position: fixed; top: var(--space-lg); right: var(--space-lg);
    z-index: 400;
    display: flex; flex-direction: column; gap: var(--space-sm);
}
.toast {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--color-text);
    color: var(--color-text-on-accent);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}
.toast.show { transform: translateX(0); }
.toast-success { background: var(--color-success); }
.toast-warning { background: var(--color-warning); }
.toast-error { background: var(--color-danger); }

/* ── Notifications Dropdown ─────────────────────────────────── */
.notif-dropdown {
    position: absolute; top: 100%; right: 0;
    width: 320px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 150;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-surface-alt);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.875rem; font-weight: 600;
}
.notif-item {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-surface-alt);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.1s;
}
.notif-item:hover { background: var(--color-surface-alt); }
.notif-item:last-child { border-bottom: none; }
.notif-severity-warning { border-left: 3px solid var(--color-warning); }
.notif-severity-urgent { border-left: 3px solid var(--color-danger); }
.notif-empty {
    padding: var(--space-xl);
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* ── FAB (Add Project) ──────────────────────────────────────── */
.fab {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--color-accent);
    color: var(--color-text-on-accent);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
    z-index: 50;
}
.fab:hover { background: var(--color-accent-dark); transform: scale(1.1); }

/* ── Login Page ─────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}
.login-card {
    width: 100%;
    max-width: 380px;
    padding: var(--space-2xl);
    text-align: center;
}
.login-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}
.login-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: var(--space-xl);
}
.login-error {
    color: var(--color-danger);
    font-size: 0.8rem;
    margin-top: var(--space-sm);
    display: none;
}
.login-error.show { display: block; }
.login-form .input {
    text-align: center;
    font-size: 1rem;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}
.login-form .btn {
    width: 100%;
    padding: var(--space-md);
    font-size: 1rem;
    justify-content: center;
}

/* ── Empty States ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--color-text-light);
    font-size: 0.875rem;
}

/* ── Utility ────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .panel { width: 70%; min-width: 350px; }
    .bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .header { padding: var(--space-md); }
    .main { padding: var(--space-md); }
    .panel { width: 100%; min-width: 0; }
    .stage-column { flex: 0 0 180px; }
    .form-row { grid-template-columns: 1fr; }
}
