:root {
    --bg: #f7f6f3;
    --surface: #ffffff;
    --surface-2: #fafaf9;
    --border: #ebe9e4;
    --border-strong: #d6d3ce;
    --text: #1c1917;
    --text-2: #57534e;
    --text-3: #a8a29e;
    --primary: #1c1917;
    --primary-hover: #292524;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --soon: #f59e0b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 16px rgba(0,0,0,0.04);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
body { display: flex; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* ============ SIDEBAR (DARK) ============ */
.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: #0f0f10;
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    padding: 22px 14px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    color: rgba(255,255,255,0.85);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.brand-logo {
    width: 30px; height: 30px;
    background: #fff;
    color: #0f0f10;
    border-radius: 8px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.brand-name { font-size: 16px; font-weight: 600; color: #fafafa; }
.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 10px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.nav-item svg { color: rgba(255,255,255,0.45); transition: color 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item:hover svg { color: #fff; }
.nav-item.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.nav-item.active svg { color: #fff; }

.sidebar-foot {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 14px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.me {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 6px 8px;
    margin: -6px -8px;
    border-radius: 8px;
    color: inherit;
    transition: background 0.15s;
}
.me:hover { background: rgba(255,255,255,0.06); }
.me.is-active { background: rgba(255,255,255,0.1); }
.me-avatar {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 12px;
    color: #fafafa;
    border: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    overflow: hidden;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-info { min-width: 0; }
.me-name { font-size: 13px; font-weight: 600; color: #fafafa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 11px; color: rgba(255,255,255,0.5); }
.logout-form { margin: 0; }
.logout-btn {
    background: none; border: none; color: rgba(255,255,255,0.5); padding: 6px;
    border-radius: 6px; display: flex; align-items: center;
}
.logout-btn:hover { background: rgba(255,255,255,0.08); color: #fca5a5; }

/* ============ MAIN ============ */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Flash */
.flash {
    margin: 14px 24px 0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ============ SPLIT (clients) ============ */
.split {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: 100vh;
    background: var(--bg);
}
.pane { background: var(--surface); overflow-y: auto; }
.pane-list {
    border-right: 1px solid var(--border);
}
.pane-detail { background: var(--surface); }

.pane-head {
    padding: 24px 20px 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 5;
}
.pane-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pane-title-row h2 { font-size: 18px; }
.count-pill {
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
}
.pane-search {
    position: relative;
    margin-bottom: 10px;
}
.pane-search svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
}
.pane-search input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 8px;
    padding: 9px 12px 9px 34px;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.pane-search input:focus { border-color: var(--border-strong); background: #fff; }

/* Client list */
.client-list { list-style: none; padding: 8px; margin: 0; }
.empty-row { padding: 30px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.client-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s;
}
.client-row:hover { background: var(--surface-2); }
.client-row.is-active { background: var(--surface-2); }
.client-row.is-active .client-name { color: var(--text); }

.avatar {
    width: 38px; height: 38px;
    background: #f3f1ec;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
    color: var(--text-2);
    flex-shrink: 0;
}
.avatar-lg { width: 56px; height: 56px; font-size: 18px; border-radius: 12px; }
.client-info { flex: 1; min-width: 0; }
.client-name { font-weight: 600; color: var(--text); font-size: 14px; }
.client-meta { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.dot {
    width: 8px; height: 8px;
    background: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============ DETAIL ============ */
.empty-state {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: var(--text-2);
}
.empty-state-inline { min-height: 240px; }
.empty-icon {
    width: 64px; height: 64px;
    background: var(--surface-2);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 18px;
    color: var(--text-2);
}
.empty-state h2 { margin-bottom: 6px; font-size: 18px; color: var(--text); }
.empty-state p { margin: 4px 0; color: var(--text-2); max-width: 380px; }

.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 28px 32px 18px;
    gap: 16px;
}
.detail-head-main { display: flex; gap: 16px; align-items: center; }
.detail-head h1 { font-size: 22px; margin-bottom: 6px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-2); }
.detail-meta span { display: inline-flex; align-items: center; gap: 6px; }
.detail-meta svg { color: var(--text-3); }
.detail-head-actions { display: flex; gap: 6px; }
.detail-head-actions form { margin: 0; }

.notes-box {
    margin: 0 32px 12px;
    padding: 12px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    color: #78350f;
    font-size: 13px;
}

/* ============ TASKS ============ */
.tasks-section { padding: 12px 24px 80px; }
.tasks-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 8px 8px;
}
.tasks-head h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.task-list { list-style: none; padding: 0; margin: 0; }
.task-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px;
    border-top: 1px solid var(--border);
    transition: background 0.12s;
}
.task-row .task-check { margin-top: 1px; }
.task-row .task-side { margin-top: 0; }
.task-row:hover { background: var(--surface-2); }
.task-row:hover .task-delete { opacity: 1; }

/* Complete circle button (simple binary toggle) */
.task-check {
    position: relative;
    width: 20px; height: 20px;
    border: 1.5px solid var(--border-strong);
    border-radius: 50%;
    background: transparent;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
}
.task-check:hover { border-color: var(--success); }
.task-check-tick { opacity: 0; transition: opacity 0.15s; }
.task-row.status-completed .task-check {
    background: var(--success);
    border-color: var(--success);
}
.task-row.status-completed .task-check-tick { opacity: 1; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--text-3); }
.task-row.is-done .task-desc { color: var(--text-3); }

.task-body { flex: 1; min-width: 0; }
.task-title {
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
    cursor: text;
    border-radius: 4px;
    padding: 1px 4px;
    margin: -1px -4px;
    transition: background 0.12s;
}
.task-title:hover { background: rgba(0,0,0,0.04); }
.task-desc {
    color: var(--text-2);
    font-size: 12.5px;
    margin-top: 2px;
    cursor: text;
    border-radius: 4px;
    padding: 1px 4px;
    margin-left: -4px;
    margin-right: -4px;
    transition: background 0.12s;
}
.task-desc:hover { background: rgba(0,0,0,0.04); }
.task-desc.is-empty { color: var(--text-3); font-style: italic; opacity: 0; transition: opacity 0.12s, background 0.12s; }
.task-row:hover .task-desc.is-empty { opacity: 1; }
.task-row .task-desc.is-empty:focus { opacity: 1; outline: none; }

.client-link { color: var(--text-2); font-weight: 500; }
.client-link:hover { color: var(--text); text-decoration: underline; }

.task-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--border);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
button.chip { cursor: pointer; font-family: inherit; }
button.chip:hover { border-color: var(--border-strong); background: #fff; }

/* Status pill (clickable to change status) */
.chip-status {
    letter-spacing: 0.01em;
    padding: 3px 8px 3px 9px;
    gap: 6px;
}
.chip-status .chip-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
    flex-shrink: 0;
}
.chip-status .chip-caret {
    opacity: 0.55;
    margin-left: 1px;
    transition: opacity 0.15s, transform 0.15s;
}
button.chip-status:hover .chip-caret { opacity: 1; transform: translateY(1px); }
.chip-status.status-assigned    { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.chip-status.status-in_progress { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.chip-status.status-completed   { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
button.chip-status.status-assigned:hover    { background: #e2e8f0; }
button.chip-status.status-in_progress:hover { background: #fef3c7; }
button.chip-status.status-completed:hover   { background: #d1fae5; }

/* Assignee chip */
.chip-assignee { padding: 2px 9px 2px 2px; }
.chip-avatar {
    width: 20px; height: 20px;
    background: #e7e5e4;
    color: var(--text);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}
.chip-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chip-avatar-empty {
    background: transparent;
    border: 1.5px dashed var(--border-strong);
    color: var(--text-3);
    font-weight: 400;
    font-size: 13px;
    line-height: 1;
}
.chip-assignee.is-empty { color: var(--text-3); border-style: dashed; }

/* Due chip */
.chip-due { color: var(--text-2); }
.chip-due.is-empty { color: var(--text-3); border-style: dashed; }
.chip-due.is-overdue { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.chip-due.is-soon { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* Inline edit inputs */
.task-inline-input {
    border: 1.5px solid var(--text);
    border-radius: 6px;
    background: #fff;
    padding: 2px 6px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.task-inline-title { font-size: 14px; font-weight: 500; }
.task-inline-desc { font-size: 12.5px; resize: none; min-height: 22px; }

.chip-edit-select {
    font-family: inherit;
    font-size: 12px;
    border: 1.5px solid var(--text);
    border-radius: 999px;
    padding: 3px 8px;
    background: #fff;
    color: var(--text);
    outline: none;
    cursor: pointer;
}
.chip-edit-due {
    background: #fff;
    border: 1.5px solid var(--text);
    padding: 0 4px 0 8px;
    gap: 4px;
}
.chip-edit-date-input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    color: var(--text);
    padding: 2px 0;
    width: 120px;
}
.chip-edit-clear {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
}
.chip-edit-clear:hover { color: var(--danger); background: #fef2f2; }

.task-delete {
    background: none;
    border: none;
    color: var(--text-3);
    padding: 4px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    cursor: pointer;
}
.task-delete:hover { color: var(--danger); background: #fef2f2; }

/* Inline add task (Asana style) */
.task-add-row {
    border-top: 1px solid var(--border);
    padding: 10px 12px;
}
.task-add-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 8px 0;
    color: var(--text-3);
    font-weight: 500;
    font-size: 14px;
    width: 100%;
    text-align: left;
}
.task-add-trigger:hover { color: var(--text); }
.task-add-form {
    display: none;
    grid-template-columns: 2fr 2fr 140px 140px auto auto;
    gap: 8px;
    align-items: center;
}
.task-add-form.is-open { display: grid; }
.task-add-row.is-open .task-add-trigger { display: none; }
.task-add-form input, .task-add-form select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    outline: none;
    background: #fff;
    min-width: 0;
}
.task-add-form input:focus, .task-add-form select:focus { border-color: var(--text); }

/* ============ BUTTONS ============ */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-weight: 500;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.15s;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-ghost.btn-danger:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

/* ============ PAGE (team/my-tasks) ============ */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 32px 18px;
    gap: 16px;
}
.page-head h1 { font-size: 22px; margin-bottom: 4px; }
.page-head p { margin: 0; font-size: 13px; }

.card {
    margin: 0 32px 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.member-cell { display: flex; align-items: center; gap: 12px; }
.member-cell .strong { font-weight: 600; }
.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}
.badge-admin { background: #eef2ff; color: #4338ca; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; margin-left: 4px; }
.row-actions .btn-ghost { padding: 5px 10px; font-size: 12px; }

/* ============ MODAL ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); animation: fadeIn 0.15s ease-out; }
.modal-card {
    position: relative;
    background: var(--surface);
    border-radius: 14px;
    width: 520px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: pop 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-3);
    width: 30px; height: 30px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 20px 22px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field input, .field textarea, .field select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    outline: none;
    background: var(--surface);
    transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--text); }
.check-field { flex-direction: row; align-items: center; gap: 8px; }
.check-field input { width: 16px; height: 16px; }
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 14px 14px;
}

/* ============ PROFILE ============ */
.profile-card { max-width: 720px; }
.profile-section {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}
.profile-section:last-of-type { border-bottom: none; }
.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    font-weight: 600;
    margin-bottom: 16px;
}
.avatar-edit {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.avatar-edit-preview {
    width: 84px; height: 84px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.avatar-edit-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-2);
}
.avatar-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}
.avatar-upload-label { cursor: pointer; }
.avatar-upload-label input { display: none; }
.profile-foot {
    display: flex;
    justify-content: flex-end;
    padding: 16px 24px;
    background: var(--surface-2);
    border-radius: 0 0 12px 12px;
}
.profile-card .form-grid { padding: 0; }
.profile-card .field input:disabled {
    background: var(--surface-2);
    color: var(--text-3);
    cursor: not-allowed;
}

@media (max-width: 760px) {
    .profile-section { padding: 18px 16px; }
    .profile-foot { padding: 14px 16px; }
    .profile-foot .btn-primary { width: 100%; }
    .avatar-edit { gap: 16px; }
}

/* ============ AUTH ============ */
.auth-body {
    background: var(--bg);
    min-height: 100vh;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 36px 36px 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card p.muted { margin: 0 0 22px; font-size: 13.5px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn-primary { margin-top: 6px; padding: 11px; font-size: 14px; }
.auth-hint { margin-top: 18px; font-size: 12px; text-align: center; }

/* ============ MOBILE HEADER + DRAWER ============ */
.mobile-header { display: none; }
.sidebar-backdrop { display: none; }
.sidebar-close { display: none; }
.mobile-back { display: none; }

/* ============ RESPONSIVE: TABLET ≤ 960px ============ */
@media (max-width: 960px) {
    .split { grid-template-columns: 280px 1fr; }
    .detail-head { padding: 24px 20px 16px; }
    .tasks-section { padding: 8px 16px 80px; }
    .page-head { padding: 22px 20px 14px; }
    .card { margin: 0 20px 24px; }
    .notes-box { margin: 0 20px 12px; }
    .task-add-form { grid-template-columns: 1fr 1fr 120px auto auto; }
    .task-add-form .task-add-desc { grid-column: 1 / -1; }
}

/* ============ RESPONSIVE: MOBILE ≤ 760px ============ */
@media (max-width: 760px) {
    body { display: block; padding-top: 56px; }

    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 56px;
        padding: 0 14px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        z-index: 90;
    }
    .hamburger, .mobile-user {
        background: none;
        border: none;
        width: 38px; height: 38px;
        border-radius: 8px;
        display: flex; align-items: center; justify-content: center;
        color: var(--text);
    }
    .hamburger:hover { background: var(--surface-2); }
    .mobile-brand { display: flex; align-items: center; gap: 9px; flex: 1; font-weight: 600; font-size: 15px; }
    .mobile-brand .brand-logo { width: 26px; height: 26px; font-size: 12px; background: var(--text); color: #fff; }
    .mobile-user { padding: 0; text-decoration: none; color: inherit; }
    .mobile-user .me-avatar {
        width: 32px; height: 32px;
        background: var(--surface-2);
        color: var(--text);
        border: 1px solid var(--border);
        overflow: hidden;
    }
    .mobile-user .me-avatar img { width: 100%; height: 100%; object-fit: cover; }

    /* Sidebar becomes slide-in drawer */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 270px;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 0 32px rgba(0,0,0,0.18);
        padding: 18px 14px 14px;
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-close {
        display: flex;
        position: absolute;
        top: 12px; right: 12px;
        background: none; border: none;
        width: 34px; height: 34px;
        border-radius: 8px;
        align-items: center; justify-content: center;
        color: rgba(255,255,255,0.6);
    }
    .sidebar-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
    .sidebar .brand { padding-top: 6px; padding-right: 40px; }

    .sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }
    .sidebar-backdrop.is-open {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .main { width: 100%; }

    .flash { margin: 12px 14px 0; }

    /* Single-pane navigation: list ⇄ detail */
    .split {
        display: block;
        grid-template-columns: none;
        height: auto;
        min-height: calc(100vh - 56px);
    }
    .pane-list, .pane-detail {
        border-right: none;
        height: auto;
        max-height: none;
    }
    .split.has-selection .pane-list { display: none; }
    .split:not(.has-selection) .pane-detail { display: none; }

    .pane-head { padding: 18px 14px 12px; }
    .pane-title-row h2 { font-size: 17px; }
    .client-list { padding: 6px; }
    .client-row { padding: 10px 10px; }

    .mobile-back {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 14px 16px 6px;
        font-size: 13px;
        font-weight: 500;
        color: var(--text-2);
    }
    .mobile-back:hover { color: var(--text); }

    .detail-head {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px 16px 14px;
        gap: 14px;
    }
    .detail-head-main { gap: 14px; }
    .detail-head .avatar-lg { width: 48px; height: 48px; font-size: 15px; }
    .detail-head h1 { font-size: 19px; }
    .detail-meta { gap: 8px 14px; font-size: 12.5px; }
    .detail-head-actions { width: 100%; }
    .detail-head-actions .btn-ghost { flex: 1; }
    .detail-head-actions form { flex: 1; display: flex; }
    .detail-head-actions form .btn-ghost { width: 100%; }

    .notes-box { margin: 0 16px 12px; }
    .tasks-section { padding: 4px 12px 100px; }
    .tasks-head { padding: 10px 4px 6px; }

    /* Task row reflow */
    .task-row {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 12px 10px;
        gap: 10px;
    }
    .task-body { flex: 1 1 calc(100% - 32px); min-width: 0; }
    .task-side {
        width: calc(100% - 30px);
        margin-left: 30px;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }
    .task-delete { opacity: 1; margin-left: auto; flex-shrink: 0; }
    .task-desc.is-empty { opacity: 1; }
    .chip-edit-date-input { width: 110px; }

    /* Inline task add → stacked */
    .task-add-row { padding: 12px 10px; }
    .task-add-form {
        display: none;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .task-add-form.is-open { display: grid; }
    .task-add-title, .task-add-desc { grid-column: 1 / -1; }
    .task-add-form .btn-primary, .task-add-form .btn-ghost { width: 100%; }

    /* Page header (team / my tasks) */
    .page-head { padding: 20px 16px 12px; flex-wrap: wrap; gap: 10px; }
    .page-head h1 { font-size: 19px; }
    .card { margin: 0 14px 24px; }

    /* Team table → card stack */
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr {
        padding: 14px;
        border-bottom: 1px solid var(--border);
    }
    .data-table tr:last-child { border-bottom: none; }
    .data-table tbody tr:hover { background: transparent; }
    .data-table td {
        padding: 4px 0;
        border-bottom: none;
        font-size: 13.5px;
    }
    .data-table td.row-actions { text-align: left; padding-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
    .data-table td.row-actions form { margin: 0; flex: 1; }
    .data-table td.row-actions .btn-ghost { width: 100%; }
    .data-table td[data-label]:before {
        content: attr(data-label);
        display: inline-block;
        min-width: 70px;
        font-size: 11px;
        font-weight: 600;
        color: var(--text-3);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-right: 8px;
    }
    .member-cell { gap: 10px; }

    /* Modal */
    .modal-card {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 80px);
    }
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px 18px;
    }
    .modal-head { padding: 14px 18px; }
    .modal-foot { padding: 12px 18px; }

    /* Auth */
    .auth-card { padding: 28px 22px 22px; }
}

/* ============ RESPONSIVE: SMALL MOBILE ≤ 380px ============ */
@media (max-width: 380px) {
    .detail-head h1 { font-size: 17px; }
    .pane-head .btn-primary { font-size: 12.5px; }
    .chip { font-size: 11px; padding: 2px 7px; }
    .task-add-form { grid-template-columns: 1fr; }
}
