/* 
 * Foxz/Wildfire Client Portal
 * Design System: Black/White, Instrument Sans, Apple Aesthetic
 */

/* ============================================
   FONTS & VARIABLES
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&display=swap');

:root {
    /* Colors - Black/White Only */
    --black: #000000;
    --white: #FFFFFF;
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #E5E5E5;
    --gray-300: #D4D4D4;
    --gray-400: #A3A3A3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    
    /* Status Colors (minimal use) */
    --status-pending: #737373;
    --status-progress: #000000;
    --status-review: #525252;
    --status-completed: #404040;
    
    /* Typography */
    --font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;
    --font-size-5xl: 3.5rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Shadows - Subtle */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.10);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--black);
    letter-spacing: -0.02em;
}

h1 { font-size: var(--font-size-4xl); font-weight: 700; }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p { margin-bottom: var(--space-4); color: var(--gray-600); }

a {
    color: var(--black);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}
a:hover { opacity: 0.7; }

.text-muted { color: var(--gray-500); }
.text-small { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ============================================
   LAYOUT
   ============================================ */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 960px; }
.container-lg { max-width: 1200px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

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

/* Spacing utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

/* ============================================
   APP LAYOUT
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--black);
    color: var(--white);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.sidebar-logo {
    padding: var(--space-3) 0;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-800);
    display: block;
    text-decoration: none;
    color: var(--white);
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 100%;
    height: auto;
    max-height: 60px;
    object-fit: contain;
    display: block;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-4);
    margin-bottom: 2px;
    border-radius: var(--radius-md);
    color: var(--gray-400);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: var(--gray-800);
    color: var(--white);
    opacity: 1;
}

.nav-item.active {
    background: var(--white);
    color: var(--black);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active svg {
    opacity: 1;
}

.nav-badge {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

.nav-divider {
    height: 1px;
    background: var(--gray-800);
    margin: 12px 0;
}

.nav-label {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
    padding: var(--space-1) var(--space-4);
    margin-bottom: 2px;
}

.sidebar-user {
    padding-top: var(--space-6);
    border-top: 1px solid var(--gray-800);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s;
    margin-top: auto;
}

.sidebar-user:hover {
    opacity: 0.85;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

/* Sidebar bottom section */
.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid var(--gray-800);
    padding-top: var(--space-4);
}

.sidebar-bottom .sidebar-user {
    padding-top: 0;
    border-top: none;
    margin-top: 0;
    padding: var(--space-3) 0;
}

.sidebar-logout {
    display: none; /* Hidden on desktop, shown on mobile */
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: var(--space-8);
    padding-top: calc(var(--space-8) + 60px);
}

/* Top Bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    height: 60px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    z-index: 50;
}

.app-layout.has-timer .top-bar {
    top: 36px;
}

.app-layout.has-timer .main-content {
    padding-top: calc(var(--space-8) + 60px + 36px);
}

.global-search-wrapper {
    position: relative;
    width: 400px;
}

.global-search-input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 14px;
    background: var(--gray-50);
    transition: all 0.15s ease;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--black);
    background: white;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.global-search-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--gray-400);
    pointer-events: none;
}

.global-search-wrapper .search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    max-height: 450px;
    overflow-y: auto;
    z-index: 200;
    display: none;
}

.global-search-wrapper .search-results.active {
    display: block;
}

/* Search Result Items */
.search-result-item {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--black);
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s ease;
}

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

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
}

.search-result-meta {
    font-size: 12px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.search-client {
    font-weight: 500;
    color: var(--gray-600);
}

.search-result-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--gray-100);
    color: var(--gray-600);
}

.search-date {
    color: var(--gray-400);
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
}

.top-bar-user:hover {
    color: var(--black);
}

.logout-btn {
    color: var(--gray-500) !important;
}

.logout-btn:hover {
    color: var(--black) !important;
    background: var(--gray-100);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.card-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: var(--font-size-lg);
    margin: 0;
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--black);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--gray-800);
}

.btn-secondary {
    background: var(--white);
    color: var(--black);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--black);
}

.btn-danger {
    background: var(--black);
    color: var(--white);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-base);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--gray-800);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-10);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--black);
    margin-top: var(--space-1);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--black);
}

/* ============================================
   AVATAR
   ============================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-initials {
    background: var(--gray-200);
    color: var(--gray-600);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-pending { background: #f3f4f6; color: #4b5563; }
.badge-assigned { background: #dbeafe; color: #1d4ed8; }
.badge-progress { background: #fef3c7; color: #b45309; }
.badge-review { background: #e9d5ff; color: #7c3aed; }
.badge-revision { background: #fce7f3; color: #be185d; }
.badge-completed { background: #bbf7d0; color: #15803d; }
.badge-cancelled { background: #e5e7eb; color: #6b7280; }

.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.priority-standard { background: var(--gray-400); }
.priority-high { background: var(--gray-700); }
.priority-urgent { background: var(--black); }

/* Rush badge for display */
.rush-badge-display {
    display: inline-block;
    background: #fef3c7;
    color: #d97706;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-6);
}

.tab {
    padding: var(--space-3) var(--space-4);
    color: var(--gray-500);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-sm);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Ensures horizontal scroll on mobile */
}

.table th,
.table td {
    padding: var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.table th {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* ============================================
   TASK LIST / KANBAN
   ============================================ */
.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.task-item:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
}

.task-item.dragging {
    opacity: 0.5;
    box-shadow: var(--shadow-lg);
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-weight: 500;
    color: var(--black);
    margin-bottom: var(--space-1);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

.task-comments-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--gray-400);
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--gray-100);
}

.task-comments-indicator svg {
    width: 14px;
    height: 14px;
}

.task-comments-indicator.has-new {
    color: var(--primary);
    background: #eff6ff;
}

.task-comments-indicator .new-badge {
    background: var(--primary);
    color: white;
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
    min-height: 600px;
}

.kanban-column {
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-2) var(--space-4);
}

.kanban-column-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-700);
}

.kanban-column-count {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    background: var(--white);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
}

.kanban-tasks {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 200px;
}

.kanban-tasks.drag-over {
    background: var(--gray-200);
    border-radius: var(--radius-md);
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-6);
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--black);
    line-height: 1;
    margin-bottom: var(--space-2);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
}

/* ============================================
   ALERTS & MESSAGES
   ============================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.alert-success {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
}

.alert-error {
    background: var(--gray-900);
    color: var(--white);
}

.alert-info {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
    font-size: var(--font-size-lg);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--gray-500);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: none;
    border: none;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--black);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* ============================================
   DROPZONE
   ============================================ */
.dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: var(--space-10);
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--black);
    background: var(--gray-50);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    color: var(--gray-400);
}

.dropzone-text {
    color: var(--gray-600);
    margin-bottom: var(--space-1);
}

.dropzone-hint {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-6);
    color: var(--gray-300);
}

.empty-state h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--gray-500);
    max-width: 400px;
    margin: 0 auto var(--space-6);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
}

.login-left {
    flex: 1;
    background: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
}

.login-brand {
    text-align: center;
    color: var(--white);
}

.login-brand img {
    max-width: 200px;
    margin-bottom: var(--space-8);
    filter: brightness(0) invert(1);
}

.login-brand h1 {
    font-size: var(--font-size-4xl);
    color: var(--white);
    margin-bottom: var(--space-4);
}

.login-brand p {
    color: var(--gray-400);
    font-size: var(--font-size-lg);
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    background: var(--white);
}

.login-form {
    width: 100%;
    max-width: 400px;
}

.login-form h2 {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-2);
}

.login-form p {
    color: var(--gray-500);
    margin-bottom: var(--space-8);
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notification-bell {
    position: relative;
}

.notification-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--black);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    margin-top: var(--space-2);
    z-index: 100;
}

.notification-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--gray-50);
}

.notification-item.unread {
    background: var(--gray-50);
}

/* ============================================
   TIMER
   ============================================ */
.timer-display {
    font-family: var(--font-family);
    font-size: var(--font-size-2xl);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--black);
}

.timer-controls {
    display: flex;
    gap: var(--space-2);
}

.timer-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.timer-btn-start {
    background: var(--black);
    color: var(--white);
}

.timer-btn-pause {
    background: var(--gray-200);
    color: var(--black);
}

.timer-btn-stop {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: var(--space-4);
    }
    
    .login-page {
        flex-direction: column;
    }
    
    .login-left {
        padding: var(--space-8) var(--space-4);
    }
    
    .login-brand h1 {
        font-size: var(--font-size-2xl);
    }
    
    .kanban-board {
        grid-template-columns: 1fr;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .modal {
        max-width: 100%;
        margin: var(--space-4);
        max-height: calc(100vh - 32px);
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cursor-pointer { cursor: pointer; }
.cursor-grab { cursor: grab; }
.cursor-grabbing { cursor: grabbing; }

.border-t { border-top: 1px solid var(--gray-200); }
.border-b { border-bottom: 1px solid var(--gray-200); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded-full { border-radius: var(--radius-full); }

/* Responsive visibility utilities */
.show-mobile { display: none !important; }
.hide-mobile { display: block; }
.hide-mobile-inline { display: inline; }
.hide-mobile-flex { display: flex; }

@media (max-width: 768px) {
    .show-mobile { display: block !important; }
    .show-mobile-flex { display: flex !important; }
    .hide-mobile { display: none !important; }
    .hide-mobile-inline { display: none !important; }
    .hide-mobile-flex { display: none !important; }
    
    /* Mobile-specific flex utilities */
    .flex-col-mobile { flex-direction: column; }
    .items-stretch-mobile { align-items: stretch; }
    .gap-3-mobile { gap: var(--space-3); }
    .w-full-mobile { width: 100%; }
    .text-center-mobile { text-align: center; }
}

/* ============================================
   PERSISTENT TIMER BAR
   ============================================ */
.timer-bar {
    position: fixed;
    top: 0;
    left: 260px; /* Start after sidebar */
    right: 0;
    height: 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-bar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #333;
    font-size: 13px;
}

.timer-display {
    font-family: 'SF Mono', Monaco, monospace;
    font-weight: 700;
    font-size: 15px;
    color: #dc3545;
}

.timer-separator {
    color: #ccc;
}

.timer-task {
    font-weight: 500;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    text-decoration: none;
}

.timer-task:hover {
    text-decoration: underline;
}

.timer-project {
    color: #666;
    font-size: 12px;
}

.timer-stop-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 8px;
}

.timer-stop-btn:hover {
    background: #c82333;
}

/* Timer bar only affects main content, not sidebar */
.app-layout.has-timer .main-content {
    padding-top: calc(var(--space-8) + 100px); /* Extra space for timer + top-bar */
}

.app-layout.has-timer .top-bar {
    top: 40px;
}

/* ============================================
   GLOBAL SEARCH
   ============================================ */
.sidebar-search {
    padding: 0 var(--space-4) var(--space-4);
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--gray-400);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: var(--gray-50);
    transition: all 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--black);
    background: white;
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
    transition: background 0.1s ease;
}

.search-result-item:hover {
    background: var(--gray-50);
}

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

.search-result-title {
    font-weight: 500;
    color: var(--black);
    margin-bottom: 2px;
}

.search-result-meta {
    font-size: 11px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-result-badge {
    display: inline-block;
    padding: 1px 6px;
    background: var(--gray-100);
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--gray-500);
    font-size: 13px;
}

/* ============================================
   EMOJI REACTIONS
   ============================================ */
.emoji-picker {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.emoji-btn {
    padding: 4px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s ease;
}

.emoji-btn:hover {
    background: var(--gray-50);
    transform: scale(1.1);
}

.emoji-btn.active {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.emoji-count {
    font-size: 11px;
    color: var(--gray-600);
    margin-left: 2px;
}

.comment-reactions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}

.reaction-badge:hover {
    background: var(--gray-100);
}

/* ============================================
   TOP HEADER BAR
   ============================================ */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px 0 280px;
    z-index: 999;
}

.top-header-left {
    display: flex;
    align-items: center;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-header-user {
    font-size: 13px;
    color: var(--gray-600);
}

.top-header-link {
    font-size: 13px;
    color: var(--gray-600);
    text-decoration: none;
}

.top-header-link:hover {
    color: var(--black);
}

.top-header-logout {
    font-size: 13px;
    color: var(--gray-500);
    text-decoration: none;
    padding: 6px 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

.top-header-logout:hover {
    background: var(--gray-200);
    color: var(--black);
}

/* Mini Timer in Top Header */
.mini-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #8B0000 0%, #B22222 100%);
    padding: 4px 12px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 12px;
}

.mini-timer-icon {
    width: 14px;
    height: 14px;
    stroke: white;
    animation: spin 4s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mini-timer-display {
    font-family: 'SF Mono', Monaco, monospace;
    font-weight: 600;
}

.mini-timer-task {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-timer-stop {
    background: white;
    color: #8B0000;
    border: none;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

/* Adjust app layout for top header */
.app-layout {
    padding-top: 0;
}

.sidebar {
    top: 0;
    height: 100vh;
}

/* Sidebar logo full width */
.sidebar-logo {
    display: block;
    padding: var(--space-5);
    text-decoration: none;
    border-bottom: 1px solid var(--gray-800);
}

.sidebar-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
}

/* ============================================
   TOP SEARCH BAR (in main content)
   ============================================ */
.top-search-bar {
    margin-bottom: var(--space-6);
}

.search-container {
    position: relative;
    max-width: 600px;
}

.top-search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background: var(--white);
    transition: all 0.15s ease;
}

.top-search-input:focus {
    outline: none;
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.search-container .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--gray-400);
    pointer-events: none;
}

.top-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    max-height: 450px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.top-search-results.active {
    display: block;
}

/* ============================================
   DELETE CONFIRM MODAL
   ============================================ */
.confirm-modal {
    max-width: 400px;
}

.confirm-modal .modal-body {
    text-align: center;
    padding: 32px;
}

.confirm-modal .confirm-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: #fff5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal .confirm-icon svg {
    width: 30px;
    height: 30px;
    stroke: #dc3545;
}

.confirm-modal h3 {
    margin-bottom: 8px;
}

.confirm-modal p {
    color: var(--gray-600);
    margin-bottom: 24px;
}

.confirm-modal .modal-footer {
    justify-content: center;
    gap: 12px;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #000;
    border: none;
}

.btn-warning:hover {
    background: #e0a800;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notifications-wrapper {
    position: relative;
}

.notification-bell {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    position: relative;
    transition: background 0.15s ease;
}

.notification-bell:hover {
    background: var(--gray-100);
}

.notification-bell svg {
    stroke: var(--gray-600);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 200;
    display: none;
}

.notifications-dropdown.active {
    display: block;
}

.notifications-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-actions {
    display: flex;
    gap: 12px;
}

.mark-read-link,
.clear-read-link {
    font-size: 12px;
    color: var(--gray-500);
    cursor: pointer;
    text-decoration: none;
}

.mark-read-link:hover,
.clear-read-link:hover {
    color: var(--primary);
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-50);
    text-decoration: none;
    color: var(--black);
    transition: background 0.15s ease;
}

.notification-item:hover {
    background: var(--gray-50);
}

.notification-item.unread {
    background: #f0f7ff;
}

.notification-item.unread:hover {
    background: #e0efff;
}

.notification-title {
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 2px;
}

.notification-message {
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: var(--gray-400);
}

.notification-empty {
    padding: 32px;
    text-align: center;
    color: var(--gray-400);
}

/* ============================================
   UNDO TOAST
   ============================================ */
.undo-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: #333;
    color: white;
    border-radius: 8px;
    overflow: hidden;
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.undo-toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.undo-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
}

.undo-message {
    font-size: 14px;
}

.undo-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.undo-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

.undo-timer-bar {
    height: 3px;
    background: #22c55e;
    width: 100%;
    animation: undo-countdown 6s linear forwards;
}

@keyframes undo-countdown {
    from { width: 100%; }
    to { width: 0%; }
}

/* ============================================
   TASK CHECKBOX IN LIST
   ============================================ */
.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.task-checkbox:hover {
    border-color: #22c55e;
    background: #f0fdf4;
}

.task-checkbox.checked {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}

.task-checkbox svg {
    width: 12px;
    height: 12px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.task-checkbox:hover svg,
.task-checkbox.checked svg {
    opacity: 1;
}

/* ============================================
   SMOOTH DRAG AND DROP
   ============================================ */
.task-row {
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.task-row.dragging {
    opacity: 0.8;
    transform: scale(1.02) rotate(1deg);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 100;
}

.task-list.drag-over {
    background: #e8f4ff;
    border-radius: 8px;
}

.drop-placeholder {
    height: 54px;
    border: 2px dashed #007bff;
    border-radius: 8px;
    background: rgba(0,123,255,0.05);
    margin-bottom: 6px;
}

/* Completed task row */
.task-row.is-completed {
    opacity: 0.5;
}

.task-row.is-completed .task-title {
    text-decoration: line-through;
    color: var(--gray-500);
}

/* Time entry row with actions */
.time-entry-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

.time-entry-row:last-child {
    border-bottom: none;
}

.time-entry-date {
    width: 50px;
    font-weight: 500;
}

.time-entry-times {
    flex: 1;
    color: var(--gray-600);
}

.time-entry-duration {
    width: 60px;
    text-align: right;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, monospace;
}

.time-entry-user {
    width: 60px;
}

.time-entry-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.time-entry-row:hover .time-entry-actions {
    opacity: 1;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 11px;
}

.text-danger {
    color: #dc3545 !important;
}

/* Confirm modal icon */
.confirm-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff0f0;
}

.confirm-icon svg {
    width: 30px;
    height: 30px;
    stroke: #dc3545;
}

.confirm-icon.text-danger {
    background: #fff0f0;
}

.confirm-icon.text-danger svg {
    stroke: #dc3545;
}

/* ============================================
   PRIVATE TASK INDICATOR
   ============================================ */
.private-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    font-size: 11px;
    color: #856404;
}

.private-badge svg {
    width: 12px;
    height: 12px;
}

/* ============================================
   INLINE TITLE EDITING
   ============================================ */
.inline-title-edit {
    position: relative;
}

.title-display {
    cursor: pointer;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
}

.title-display:hover {
    background: var(--gray-100);
}

.title-form {
    display: none;
}

.title-form.active {
    display: block;
}

.title-input {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    padding: 4px 8px;
    border: 2px solid var(--black);
    border-radius: var(--radius-md);
    width: 100%;
    margin-bottom: 4px;
}

.title-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.title-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   COMPLETION CHECKBOX
   ============================================ */
.completion-checkbox {
    margin-top: 8px;
}

.task-check {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--gray-400);
}

.task-check:hover {
    border-color: #22c55e;
    color: #22c55e;
    transform: scale(1.1);
}

.task-check.checked {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}

.task-check.checked:hover {
    background: #ef4444;
    border-color: #ef4444;
}

/* ============================================
   TOGGLE BUTTON GROUP
   ============================================ */
.btn-toggle-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.btn-toggle {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    background: white;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--gray-600);
}

.btn-toggle:not(:last-child) {
    border-right: 1px solid var(--gray-200);
}

.btn-toggle:hover {
    background: var(--gray-50);
}

.btn-toggle.active {
    background: var(--black);
    color: white;
}

/* ============================================
   COMPLETED LIST VIEW
   ============================================ */
.completed-list {
    padding: 0;
}

.completed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s ease;
}

.completed-item:hover {
    background: var(--gray-50);
}

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

.completed-check {
    width: 24px;
    height: 24px;
    background: #22c55e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.completed-check svg {
    width: 14px;
    height: 14px;
    stroke: white;
}

.completed-main {
    flex: 1;
    min-width: 0;
}

.completed-title {
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: line-through;
    display: block;
}

.completed-title:hover {
    color: var(--black);
}

.completed-meta {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

.completed-assignee {
    flex-shrink: 0;
}

/* ============================================
   SEARCH COMPLETED STYLING
   ============================================ */
.search-result-completed {
    background: #f8fdf8;
}

.search-result-completed .search-result-title {
    color: var(--gray-500);
    text-decoration: line-through;
}

.completed-check-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    margin-right: 6px;
    text-decoration: none !important;
}

/* ============================================
   IMPROVED TASK ROW SPACING
   ============================================ */
.task-row {
    padding: 12px 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    background: white;
    border: 1px solid var(--gray-100);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, margin 0.15s ease;
    position: relative;
}

.task-row:hover {
    border-color: var(--gray-200);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* More space when dragging */
.task-row.dragging {
    margin: 16px 0;
}

.task-list.drag-over .task-row {
    margin-bottom: 12px;
}

/* ============================================
   IMPROVED TASK CHECKBOX IN LIST
   ============================================ */
.task-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    background: white;
    margin-right: 4px;
}

.task-checkbox:hover {
    border-color: #22c55e;
    background: #f0fdf4;
    transform: scale(1.1);
}

.task-checkbox.checked {
    background: #22c55e;
    border-color: #22c55e;
}

.task-checkbox svg {
    width: 12px;
    height: 12px;
    opacity: 0;
    transition: opacity 0.15s ease;
    stroke: white;
}

.task-checkbox:hover svg {
    opacity: 0.5;
    stroke: #22c55e;
}

.task-checkbox.checked svg {
    opacity: 1;
    stroke: white;
}

.task-checkbox.checked:hover {
    background: #ef4444;
    border-color: #ef4444;
}

/* ============================================
   TASK VIEW QUICK CONTROLS
   ============================================ */
.task-quick-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    align-items: flex-end;
}

.quick-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-control label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    letter-spacing: 0.5px;
}

.quick-control .form-select {
    min-width: 120px;
    padding: 6px 10px;
    font-size: 13px;
}

.quick-control .form-input {
    min-width: 120px;
    padding: 6px 10px;
    font-size: 13px;
}

.quick-control .btn {
    white-space: nowrap;
}

/* Project Search Dropdown */
.project-search-wrapper {
    position: relative;
}

.project-search-input {
    padding-right: 30px !important;
}

.project-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
}

.project-clear-btn:hover {
    color: var(--gray-600);
}

.project-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    margin-top: 4px;
}

.project-dropdown.active {
    display: block;
}

.project-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-50);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.project-item:hover {
    background: var(--gray-50);
}

.project-item.no-results {
    color: var(--gray-400);
    font-style: italic;
    cursor: default;
}

.project-item.no-results:hover {
    background: transparent;
}

.project-name {
    font-weight: 500;
    font-size: 13px;
}

.project-client {
    font-size: 11px;
    color: var(--gray-400);
}

/* ============================================
   CLIENT UPDATES SECTION
   ============================================ */
.client-updates {
    border-top: 2px solid #007bff;
    margin-top: 24px;
    padding-top: 24px;
}

.client-updates h4 {
    color: #007bff;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.update-message {
    padding: 16px;
    background: #f0f7ff;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border-left: 3px solid #007bff;
}

.update-message.from-client {
    background: #fff9f0;
    border-left-color: #f59e0b;
}

.update-meta {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 8px;
}

/* ============================================
   TASK VIEW COMPLETION BUTTON
   ============================================ */
.task-complete-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--gray-300);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.task-complete-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--gray-300);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.task-complete-btn:hover {
    border-color: #22c55e;
    background: #f0fdf4;
    transform: scale(1.1);
}

.task-complete-btn:hover svg {
    stroke: #22c55e;
    opacity: 1;
}

.task-complete-btn.checked {
    background: #22c55e;
    border-color: #22c55e;
}

.task-complete-btn.checked svg {
    stroke: white;
    opacity: 1;
}

.task-complete-btn.checked:hover {
    background: #ef4444;
    border-color: #ef4444;
}

/* Time entry notes */
.time-entry-notes {
    font-size: 11px;
    color: var(--gray-500);
    font-style: italic;
    margin-top: 2px;
}

/* Comment actions */
.comment-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.comment-item:hover .comment-actions {
    opacity: 1;
}

.comment-edit-form {
    margin-top: 8px;
}

/* Toast Notifications */
.notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 380px;
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.notification-toast.show {
    transform: translateX(0);
}

.toast-icon {
    width: 36px;
    height: 36px;
    background: #111827;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    background: #f3f4f6;
    color: #6b7280;
}

/* Login Notification Modal */
.login-notifications-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.login-notifications-modal.show {
    opacity: 1;
    visibility: visible;
}

.login-notifications-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.login-notifications-modal.show .login-notifications-content {
    transform: scale(1);
}

.login-notifications-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.login-notifications-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
}

.login-notifications-body {
    max-height: 400px;
    overflow-y: auto;
}

.login-notification-item {
    padding: 16px 24px;
    border-bottom: 1px solid #f3f4f6;
    display: block;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.login-notification-item:hover {
    background: #f9fafb;
}

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

.login-notifications-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

/* ============================================
   MOBILE RESPONSIVE - COMPREHENSIVE
   ============================================ */

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--gray-700);
    border-radius: var(--radius-md);
    transition: background 0.15s;
}

.mobile-menu-btn:hover {
    background: var(--gray-100);
}

/* Mobile Close Button in Sidebar */
.mobile-close-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--white);
    border-radius: var(--radius-md);
}

.sidebar-header-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-800);
}

.sidebar-header-mobile .sidebar-logo {
    margin-bottom: 0;
    padding: 0;
    border: none;
}

.mobile-spacer {
    flex: 1;
}

/* Body scroll lock when menu open */
body.menu-open {
    overflow: hidden;
}

/* ============================================
   APP-LIKE ENHANCEMENTS (All Screens)
   ============================================ */

/* Smooth scrolling everywhere */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Better focus states for accessibility */
:focus-visible {
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

/* Active/pressed states for touch feedback */
.btn:active,
.nav-item:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Only apply scale effect to clickable cards, not form-containing cards */
.task-row:active {
    transform: scale(0.99);
}

/* Prevent text selection on interactive elements */
.btn, .nav-item, .tab, .badge {
    -webkit-user-select: none;
    user-select: none;
}

/* Floating Action Button (FAB) - for client "New Request" */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--black);
    color: var(--white);
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.fab:active {
    transform: scale(0.95);
}

.fab svg {
    width: 24px;
    height: 24px;
}

/* App-like card interactions */
.card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Sticky page headers */
.page-header-sticky {
    position: sticky;
    top: 0;
    background: var(--gray-50);
    z-index: 10;
    padding: var(--space-4) 0;
    margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-6)) var(--space-4);
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

/* Pull-to-refresh indicator placeholder */
.ptr-indicator {
    text-align: center;
    padding: var(--space-4);
    color: var(--gray-400);
    font-size: var(--font-size-sm);
}

/* Loading skeleton animation */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 0px, var(--gray-50) 40px, var(--gray-100) 80px);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--gray-500);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: var(--space-2);
    color: var(--gray-700);
}

/* ===== TABLET BREAKPOINT (1024px) ===== */
@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    
    /* Make cards stack better */
    .task-detail-grid {
        grid-template-columns: 1fr;
    }
    
    /* Client view - stack layout */
    .client-layout {
        grid-template-columns: 1fr;
    }
}

/* ===== MOBILE BREAKPOINT (768px) ===== */
@media (max-width: 768px) {
    /* ---- Core Layout ---- */
    
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Sidebar - slide in from left with app-like animation */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 85vw;
        max-width: 320px;
        z-index: 100;
        box-shadow: none;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    
    /* Main content full width - app-like */
    .main-content {
        margin-left: 0;
        padding: var(--space-4);
        padding-bottom: calc(80px + env(safe-area-inset-bottom)); /* Room for FAB */
        min-height: 100vh;
    }
    
    /* Sticky top bar - app-like header */
    .top-bar {
        position: sticky;
        top: 0;
        background: var(--white);
        z-index: 40;
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
        gap: 8px;
        margin: -12px -12px 12px -12px;
        border-bottom: 1px solid var(--gray-100);
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    /* Hide desktop elements on mobile */
    .top-bar-user span,
    .logout-btn span,
    .logout-btn svg + span {
        display: none;
    }
    
    .logout-btn {
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .top-bar-user {
        padding: 6px;
    }
    
    /* ---- Search ---- */
    .global-search-wrapper {
        flex: 1;
        max-width: none;
    }
    
    .global-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        height: 44px;
        border-radius: var(--radius-lg);
    }
    
    .search-results {
        position: fixed;
        top: 70px;
        left: var(--space-4);
        right: var(--space-4);
        max-height: 60vh;
        border-radius: var(--radius-lg);
        box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    }
    
    /* ---- Typography ---- */
    h1 {
        font-size: var(--font-size-xl);
        line-height: 1.3;
    }
    
    h2 {
        font-size: var(--font-size-lg);
    }
    
    h3 {
        font-size: var(--font-size-base);
    }
    
    /* ---- Layout helpers ---- */
    .flex.justify-between {
        flex-wrap: wrap;
        gap: var(--space-3);
    }
    
    .mb-8 { margin-bottom: var(--space-6); }
    .mb-6 { margin-bottom: var(--space-4); }
    .gap-8 { gap: var(--space-4); }
    .gap-6 { gap: var(--space-3); }
    
    /* ---- Cards - app-like ---- */
    .card {
        border-radius: var(--radius-lg);
        border: none;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        margin-left: calc(-1 * var(--space-4));
        margin-right: calc(-1 * var(--space-4));
        border-radius: 0;
    }
    
    .card + .card {
        margin-top: var(--space-3);
    }
    
    .card-header {
        padding: var(--space-4);
        border-bottom: 1px solid var(--gray-100);
    }
    
    .card-body {
        padding: var(--space-4);
    }
    
    /* ---- Grids ---- */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .kanban-board {
        grid-template-columns: 1fr;
    }
    
    /* ---- Task list - app-like cards ---- */
    .task-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
        padding: var(--space-4);
        border-radius: var(--radius-lg);
        margin-bottom: var(--space-2);
        background: var(--white);
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    
    .task-row:active {
        transform: scale(0.99);
        box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }
    
    .task-row .task-title {
        font-size: var(--font-size-base);
        font-weight: 600;
    }
    
    .task-meta {
        width: 100%;
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .task-list {
        gap: var(--space-2);
    }
    
    /* ---- Buttons - large touch targets ---- */
    .btn {
        min-height: 48px;
        padding: 14px 24px;
        font-size: var(--font-size-base);
        border-radius: var(--radius-lg);
        transition: transform 0.1s ease, opacity 0.1s ease;
    }
    
    .btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 10px 16px;
    }
    
    /* Full-width buttons on mobile when in flex containers */
    .flex.gap-2 .btn,
    .flex.gap-3 .btn {
        flex: 1;
        justify-content: center;
    }
    
    /* ---- Form inputs - app-like ---- */
    .form-input,
    .form-select,
    .form-textarea {
        min-height: 48px;
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px;
        border-radius: var(--radius-lg);
        border: 1px solid var(--gray-200);
        background: var(--white);
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    
    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        border-color: var(--black);
        box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
        outline: none;
    }
    
    .form-textarea {
        min-height: 100px;
    }
    
    .form-label {
        font-weight: 600;
        margin-bottom: var(--space-2);
    }
    
    .form-group {
        margin-bottom: var(--space-4);
    }
    
    /* ---- Tables - horizontal scroll ---- */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 calc(-1 * var(--space-4));
        padding: 0 var(--space-4);
    }
    
    .table {
        min-width: 600px;
    }
    
    .table th, .table td {
        padding: var(--space-3);
        font-size: var(--font-size-sm);
    }
    
    /* ---- Modal - full screen slide-up on mobile ---- */
    .modal-backdrop {
        padding: 0;
        align-items: flex-end;
    }
    
    .modal {
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 90vh;
        animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .modal-header {
        padding: var(--space-4);
        border-bottom: 1px solid var(--gray-100);
        position: sticky;
        top: 0;
        background: var(--white);
        z-index: 1;
    }
    
    .modal-body {
        padding: var(--space-4);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-footer {
        padding: var(--space-4);
        border-top: 1px solid var(--gray-100);
        position: sticky;
        bottom: 0;
        background: var(--white);
        padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    }
    
    /* Modal drag handle indicator */
    .modal::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--gray-300);
        border-radius: 2px;
        margin: var(--space-2) auto var(--space-3);
    }
    
    /* ---- Login page ---- */
    .login-page {
        flex-direction: column;
        min-height: 100vh;
    }
    
    .login-left {
        padding: var(--space-8) var(--space-4);
        min-height: auto;
        flex: 0;
    }
    
    .login-right {
        padding: var(--space-6) var(--space-4);
        flex: 1;
    }
    
    .login-brand h1 {
        font-size: var(--font-size-xl);
    }
    
    .login-form h2 {
        font-size: var(--font-size-xl);
    }
    
    /* ---- Notifications dropdown - app-like ---- */
    .notifications-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    }
    
    .notifications-dropdown::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--gray-300);
        border-radius: 2px;
        margin: var(--space-2) auto;
    }
    
    .notifications-header {
        position: sticky;
        top: 0;
        background: var(--white);
        z-index: 1;
        padding: var(--space-3) var(--space-4);
    }
    
    .notifications-list {
        max-height: calc(70vh - 100px);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .notification-item {
        padding: var(--space-4);
        min-height: 60px;
    }
    
    /* ---- Stats cards - app-like ---- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    
    .stat-card {
        padding: var(--space-4);
        border-radius: var(--radius-lg);
        text-align: center;
    }
    
    .stat-value {
        font-size: var(--font-size-2xl);
    }
    
    .stat-label {
        font-size: var(--font-size-xs);
    }
    
    /* Avatar sizes */
    .avatar-sm {
        width: 32px;
        height: 32px;
    }
    
    /* ---- Timer bar - compact ---- */
    .timer-bar {
        font-size: var(--font-size-xs);
        height: 36px;
        left: 0; /* Full width on mobile */
    }
    
    .timer-bar-inner {
        padding: 6px var(--space-4);
        flex-wrap: nowrap;
        gap: var(--space-2);
    }
    
    .timer-project {
        display: none;
    }
    
    .timer-task {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* ---- Dashboard - app-like ---- */
    .quick-actions {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .quick-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* ---- Task view - optimized for mobile ---- */
    .task-detail-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .task-detail-sidebar {
        order: -1; /* Put sidebar info first on mobile */
    }
    
    /* Task header on mobile */
    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    
    .task-header .badge {
        align-self: flex-start;
    }
    
    /* ---- Comments - app-like chat ---- */
    .comments-container {
        margin: 0 calc(-1 * var(--space-4));
    }
    
    .comments-thread {
        padding: var(--space-4);
        max-height: 50vh;
    }
    
    .comment-bubble {
        max-width: 85%;
        padding: var(--space-3);
        border-radius: var(--radius-lg);
    }
    
    .comment-input-wrapper {
        flex-direction: column;
        gap: var(--space-3);
        padding: var(--space-4);
        background: var(--gray-50);
        border-top: 1px solid var(--gray-100);
    }
    
    .comment-input-wrapper .avatar {
        display: none;
    }
    
    .comment-input-area {
        width: 100%;
    }
    
    .comment-form-footer {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .comment-form-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    #commentTextarea,
    #clientCommentTextarea {
        min-height: 80px;
        border-radius: var(--radius-lg);
    }
    
    /* ---- File upload - app-like ---- */
    .file-drop-zone {
        padding: var(--space-6);
        border-radius: var(--radius-lg);
        border: 2px dashed var(--gray-300);
        text-align: center;
    }
    
    .file-list {
        gap: var(--space-2);
    }
    
    .file-item {
        padding: var(--space-3);
        border-radius: var(--radius-md);
    }
    
    /* ---- Client task view ---- */
    .client-task-layout {
        flex-direction: column;
    }
    
    /* ---- Pagination - app-like ---- */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-2);
    }
    
    .pagination a,
    .pagination span {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* ---- Hide elements on mobile ---- */
    .hide-mobile {
        display: none !important;
    }
    
    /* ---- Action buttons ---- */
    .row-actions {
        display: flex;
        gap: var(--space-2);
        flex-wrap: wrap;
    }
    
    .row-actions .btn {
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }
    
    /* ---- Alerts - app-like ---- */
    .alert {
        padding: var(--space-4);
        font-size: var(--font-size-sm);
        border-radius: var(--radius-lg);
        margin: 0 calc(-1 * var(--space-4)) var(--space-4);
        border-radius: 0;
    }
    
    /* ---- Floating Action Button - mobile position ---- */
    .fab {
        bottom: calc(20px + env(safe-area-inset-bottom));
        right: 20px;
        width: 60px;
        height: 60px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    }
    
    .fab svg {
        width: 26px;
        height: 26px;
    }
    
    /* ---- Badges - app-like ---- */
    .badge {
        padding: 6px 12px;
        font-size: var(--font-size-xs);
        border-radius: var(--radius-full);
    }
    
    /* ---- Tabs - horizontal scroll ---- */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: var(--space-1);
        padding-bottom: var(--space-2);
        margin-bottom: var(--space-4);
    }
    
    .tab {
        flex-shrink: 0;
        white-space: nowrap;
        padding: var(--space-3) var(--space-4);
        min-height: 44px;
    }
    
    /* ---- Navigation items in sidebar - larger for touch ---- */
    .sidebar .nav-item {
        padding: 14px var(--space-4);
        min-height: 52px;
        font-size: var(--font-size-base);
    }
    
    .sidebar .nav-item svg {
        width: 22px;
        height: 22px;
    }
    
    /* ---- Select/Dropdown - native feel ---- */
    .form-select {
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 20px;
        padding-right: 44px;
    }
    
    /* ---- Container adjustments ---- */
    .container,
    .container-sm,
    .container-md,
    .container-lg {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }
    
    /* ---- Back links ---- */
    a[href*="dashboard"] .flex.items-center,
    .text-muted.flex.items-center {
        padding: var(--space-2) 0;
    }
}

/* ===== SMALL MOBILE BREAKPOINT (480px) ===== */
@media (max-width: 480px) {
    /* ---- Core - very compact ---- */
    .main-content {
        padding: var(--space-3);
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
    
    .top-bar {
        padding: var(--space-2) var(--space-3);
    }
    
    h1 {
        font-size: var(--font-size-lg);
    }
    
    h2 {
        font-size: var(--font-size-base);
    }
    
    .card-header, .card-body {
        padding: var(--space-3);
    }
    
    /* ---- Page headers - stack everything ---- */
    .page-header,
    .flex.justify-between.items-center {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    
    .page-header .btn,
    .flex.justify-between .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* ---- Filters - stack ---- */
    .filter-bar {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .filter-bar .form-select,
    .filter-bar .form-input {
        width: 100%;
    }
    
    /* ---- Stats - 2 column compact ---- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }
    
    .stat-card {
        padding: var(--space-3);
    }
    
    .stat-value {
        font-size: var(--font-size-xl);
    }
    
    /* ---- Task rows - compact ---- */
    .task-row {
        padding: var(--space-3);
    }
    
    .task-row .task-title {
        font-size: var(--font-size-sm);
    }
    
    /* ---- Search results ---- */
    .search-results {
        position: fixed;
        left: var(--space-3);
        right: var(--space-3);
        top: 55px;
    }
    
    /* ---- Tabs - compact scroll ---- */
    .tabs {
        gap: 0;
        margin: 0 calc(-1 * var(--space-3));
        padding: 0 var(--space-3) var(--space-2);
    }
    
    .tab {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-sm);
    }
    
    /* ---- Sidebar user - hide name ---- */
    .sidebar-user-info {
        display: none;
    }
    
    .sidebar-user {
        justify-content: center;
    }
    
    /* ---- Badges - compact ---- */
    .badge {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    /* Comments more compact */
    .comment-bubble {
        padding: var(--space-3);
    }
    
    /* Date/time inputs full width */
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"] {
        width: 100%;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-item {
        padding: 16px var(--space-4);
        min-height: 52px;
    }
    
    .btn {
        min-height: 48px;
    }
    
    /* Use active states instead of hover */
    .btn:hover {
        transform: none;
        box-shadow: none;
    }
    
    .btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
    
    .card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .task-row:hover {
        transform: none;
        background: transparent;
    }
    
    .task-row:active {
        background: var(--gray-50);
    }
    
    /* Checkboxes and radio buttons larger */
    input[type="checkbox"],
    input[type="radio"] {
        width: 24px;
        height: 24px;
        cursor: pointer;
    }
    
    /* Links more tappable - remove extra padding that might cause issues */
    a {
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    /* Dropdown items larger */
    .dropdown-item {
        padding: 16px;
        min-height: 52px;
    }
    
    /* Notification items */
    .notification-item {
        min-height: 60px;
    }
    
    /* Remove any problematic hover states */
    .nav-item:hover {
        background: transparent;
    }
    
    .nav-item:active {
        background: var(--gray-800);
    }
    
    .nav-item.active:active {
        background: var(--white);
    }
    
    /* Improve scrolling feel */
    .notifications-list,
    .comments-thread,
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Make selects easier to tap */
    .form-select {
        cursor: pointer;
    }
}

/* ===== iOS SAFE AREA SUPPORT ===== */
@supports (padding: max(0px)) {
    .sidebar {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    }
    
    .main-content {
        padding-right: max(var(--space-4), env(safe-area-inset-right));
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    }
    
    .timer-bar-inner {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 896px) and (orientation: landscape) {
    .sidebar {
        width: 240px;
    }
    
    .login-page {
        flex-direction: row;
    }
    
    .modal {
        max-height: 100vh;
        margin: var(--space-4);
        border-radius: var(--radius-lg);
    }
}

/* ===== CRITICAL MOBILE FIXES ===== */
@media (max-width: 768px) {
    /* Force task view grid to stack */
    .grid[style*="350px"],
    .task-view-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: var(--space-4) !important;
    }
    
    .task-view-grid > div {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Task quick controls - horizontal scroll or wrap */
    .task-quick-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }
    
    .quick-control {
        flex: 1 1 calc(50% - 8px);
        min-width: 120px;
    }
    
    /* Task settings bar - stack on mobile */
    .task-settings-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .settings-divider {
        width: 100%;
        height: 1px;
    }
    
    .settings-group {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .settings-toggles {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .setting-toggle {
        flex: 1;
        min-width: 70px;
        padding: 8px 10px;
        font-size: 11px;
    }
    
    /* Dashboard stats - ensure 2x2 grid works */
    .stats-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    
    .stat-card {
        padding: 12px !important;
        min-width: 0 !important;
    }
    
    .stat-value {
        font-size: 20px !important;
    }
    
    .stat-label {
        font-size: 11px !important;
    }
    
    /* Task cards on tasks page - fix spacing */
    .task-row {
        padding: 12px !important;
        margin: 0 !important;
    }
    
    .task-row .task-title {
        font-size: 14px;
        word-break: break-word;
    }
    
    /* Page headers - ensure stacking */
    .flex.justify-between.items-center.mb-6,
    .flex.justify-between.items-center.mb-8 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    
    /* Buttons in headers - full width */
    .flex.justify-between .btn {
        width: 100% !important;
    }
    
    /* My Tasks / Recent Activity cards */
    .grid.grid-2 {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* Admin stats at bottom */
    .grid.grid-3 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Task sections headers */
    .task-section-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Overdue/Today sections */
    .task-section {
        margin: 0 -12px;
        padding: 0 12px;
    }
    
    /* Task completion checkbox */
    .completion-checkbox {
        flex-shrink: 0;
    }
    
    /* Task title area */
    .task-view-title {
        font-size: 18px !important;
        word-break: break-word;
    }
    
    /* Proofing links card */
    .proofing-link-item {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* Comments */
    .comment-bubble {
        max-width: 100% !important;
    }
    
    /* Attachments grid */
    .attachments-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Time tracking section */
    .time-tracking-section {
        padding: 12px;
    }
    
    /* Sidebar cards (now stacked below main) */
    .card.mb-6 {
        margin-bottom: 12px !important;
    }
    
    /* Filter dropdowns - full width */
    .filter-bar select,
    .filter-bar .form-select {
        width: 100% !important;
        margin-bottom: 8px;
    }
    
    /* Tab navigation on clients page */
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        margin: 0 -16px;
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .tab {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 12px;
        padding: 8px 12px;
    }
    
    /* Project search dropdown */
    .project-dropdown {
        max-height: 200px;
    }
    
    /* Assignee dropdown */
    .assignee-dropdown {
        width: calc(100vw - 32px) !important;
        max-width: 300px;
    }
    
    /* Main content padding */
    .main-content {
        padding: 12px !important;
    }
    
    /* Ensure nothing overflows */
    .card,
    .card-body,
    .card-header {
        overflow: hidden;
        word-wrap: break-word;
    }
    
    /* Hide labels on very small screens for settings */
    .toggle-label {
        display: none;
    }
    
    .setting-toggle {
        padding: 8px;
        min-width: auto;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .quick-control {
        flex: 1 1 100%;
    }
    
    .setting-toggle {
        flex: 1 1 auto;
    }
    
    h1 {
        font-size: 20px !important;
    }
    
    .main-content {
        padding: 8px !important;
    }
}

/* ============================================
   COMPREHENSIVE MOBILE FIXES
   ============================================ */
@media (max-width: 768px) {
    /* ---- Fix top gap on mobile ---- */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .app-layout {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    
    /* Top bar - tight to top */
    .top-bar {
        margin-top: 0 !important;
        padding-top: max(8px, env(safe-area-inset-top)) !important;
    }
    
    /* ---- CRITICAL: Task View 2-Column Layout ---- */
    .task-view-grid,
    div[style*="grid-template-columns: 1fr 350px"],
    div[style*="grid-template-columns:1fr 350px"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    /* Ensure sidebar comes after main on mobile */
    .task-view-grid > div:first-child {
        order: 1;
    }
    .task-view-grid > div:last-child {
        order: 2;
    }
    
    /* ---- Task Quick Controls (Status/Priority/etc row) ---- */
    .task-quick-controls {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        padding: 12px !important;
    }
    
    .quick-control {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 120px !important;
    }
    
    .quick-control .form-select,
    .quick-control .form-input {
        width: 100% !important;
        font-size: 13px !important;
    }
    
    /* ---- Task Settings Bar (Flag/Recurring/etc) ---- */
    .task-settings-bar {
        flex-wrap: wrap !important;
        gap: 12px !important;
        padding: 12px !important;
    }
    
    .settings-group {
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100%;
    }
    
    .settings-group-label {
        width: 100%;
        margin-bottom: 4px;
    }
    
    .settings-toggles {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100%;
    }
    
    .setting-toggle {
        flex: 1 1 auto !important;
        min-width: 70px !important;
        padding: 8px 10px !important;
        font-size: 11px !important;
    }
    
    .settings-divider {
        display: none !important;
    }
    
    /* ---- Tasks Page - Task Cards ---- */
    .task-section {
        margin-left: -12px !important;
        margin-right: -12px !important;
        padding: 0 12px !important;
    }
    
    .task-section-header {
        padding: 0 12px !important;
    }
    
    .task-row,
    .task-card,
    .task-item {
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 0 8px 0 !important;
        overflow: hidden !important;
    }
    
    .task-row .task-title,
    .task-card .task-title {
        font-size: 14px !important;
        line-height: 1.3 !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* ---- Page Title + New Button ---- */
    .flex.justify-between.items-center,
    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    
    .flex.justify-between.items-center > h1,
    .page-header > h1 {
        margin-bottom: 0 !important;
    }
    
    .flex.justify-between.items-center > .btn,
    .page-header > .btn,
    .flex.justify-between.items-center > a.btn {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }
    
    /* ---- Dashboard Stats Grid ---- */
    .stats-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
        overflow: hidden !important;
    }
    
    .stat-card {
        min-width: 0 !important;
        overflow: hidden !important;
    }
    
    /* ---- Dashboard My Tasks / Recent Activity ---- */
    .grid.grid-2.gap-8,
    .grid.grid-2 {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    /* ---- Admin stats row ---- */
    .grid.grid-3.gap-6 {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    /* ---- Task View Title Area ---- */
    .flex.items-start.gap-4 {
        gap: 12px !important;
    }
    
    .task-view-title,
    .flex.items-start.gap-4 h1 {
        font-size: 18px !important;
        line-height: 1.3 !important;
        word-break: break-word !important;
    }
    
    /* ---- Prevent horizontal overflow ---- */
    .main-content {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        padding: 12px !important;
        padding-top: 12px !important; /* Top bar is sticky, no extra padding needed */
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
    }
    
    /* Page title spacing - more room below top bar */
    .main-content > h1:first-of-type,
    .main-content > .flex:first-child h1,
    .main-content > div:first-child > h1 {
        margin-top: 8px !important;
    }
    
    .card {
        max-width: 100% !important;
        overflow: hidden !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .card-body {
        overflow-x: auto !important;
        padding: 12px !important;
    }
    
    .card-header {
        padding: 12px !important;
    }
    
    /* ---- Task completion checkbox ---- */
    .completion-checkbox,
    .task-complete-btn {
        flex-shrink: 0 !important;
    }
    
    /* ---- Time tracking card ---- */
    .time-tracking-card {
        width: 100% !important;
    }
    
    /* ---- Proofing links ---- */
    .proofing-link-item {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    /* ---- Shared Project Files ---- */
    .shared-file-item {
        padding: 10px !important;
    }
    
    /* ---- Attachments ---- */
    .attachments-grid {
        grid-template-columns: 1fr !important;
    }
    
    .attachment-item {
        max-width: 100% !important;
    }
    
    /* ---- Comments ---- */
    .comment-bubble {
        max-width: 100% !important;
    }
    
    /* ---- WYSIWYG Editor ---- */
    .wysiwyg-editor,
    .ql-container {
        min-height: 100px !important;
    }
    
    .ql-toolbar {
        flex-wrap: wrap !important;
    }
    
    /* ---- Editing indicator ---- */
    .editing-indicator {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }
    
    .desc-header-right {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    /* ---- Filter bar ---- */
    .filter-bar {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .filter-bar > * {
        width: 100% !important;
    }
    
    /* ---- Client access control in older layout ---- */
    .client-access-control {
        width: 100% !important;
    }
    
    .client-access-buttons {
        flex-direction: row !important;
        gap: 6px !important;
    }
    
    .client-access-btn {
        padding: 8px !important;
        font-size: 10px !important;
    }
    
    .access-icon {
        font-size: 16px !important;
    }
    
    .access-label {
        font-size: 9px !important;
    }
    
    /* ---- Modal fixes ---- */
    .modal {
        margin: 16px !important;
        max-height: calc(100vh - 32px) !important;
        width: calc(100% - 32px) !important;
        max-width: none !important;
    }
    
    .modal-body {
        max-height: calc(100vh - 180px) !important;
        overflow-y: auto !important;
    }
    
    /* ---- Hide avatar/logout on mobile (keep in sidebar menu) ---- */
    .hide-on-mobile {
        display: none !important;
    }
    
    /* ---- Top bar search gets more room ---- */
    .global-search-wrapper {
        flex: 1 !important;
        max-width: none !important;
    }
    
    .global-search-input {
        width: 100% !important;
    }
    
    .top-bar-actions {
        gap: 8px !important;
    }
    
    /* ---- Sidebar layout and user section ---- */
    .sidebar {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding-bottom: 0 !important;
    }
    
    .sidebar-header-mobile {
        flex-shrink: 0 !important;
    }
    
    .sidebar-nav {
        flex: 1 !important;
        overflow-y: auto !important;
        padding-bottom: 8px !important;
        min-height: 0 !important; /* Allow shrinking */
    }
    
    .sidebar-user {
        flex-shrink: 0 !important;
        padding: 16px !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
        margin-top: 0 !important;
        border-top: 1px solid rgba(255,255,255,0.15) !important;
        background: #111 !important;
    }
    
    .sidebar-user-info {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .sidebar-user-name {
        font-size: 14px !important;
        color: white !important;
    }
    
    .sidebar-user-role {
        font-size: 11px !important;
        color: #9ca3af !important;
    }
    
    /* Sidebar bottom section with user and logout */
    .sidebar-bottom {
        flex-shrink: 0 !important;
        border-top: 1px solid rgba(255,255,255,0.15) !important;
        background: #111 !important;
        padding: 12px 16px !important;
        padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }
    
    .sidebar-bottom .sidebar-user {
        padding: 0 0 10px 0 !important;
        border-top: none !important;
        background: transparent !important;
    }
    
    .sidebar-logout {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 10px 12px !important;
        color: #ef4444 !important;
        text-decoration: none !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        border-radius: 8px !important;
        background: rgba(239, 68, 68, 0.1) !important;
        transition: background 0.2s !important;
    }
    
    .sidebar-logout:hover {
        background: rgba(239, 68, 68, 0.2) !important;
    }
    
    .sidebar-logout svg {
        flex-shrink: 0 !important;
    }
    
    /* ---- Task row - compact clean layout ---- */
    .task-row {
        padding: 10px 12px !important;
    }
    
    .task-main {
        text-align: left !important;
    }
    
    .task-title {
        text-align: left !important;
        display: block !important;
    }
    
    .task-meta {
        justify-content: flex-start !important;
        text-align: left !important;
    }
}

/* ============================================
   SEARCHABLE SELECT DROPDOWN
   ============================================ */
.searchable-select-wrapper {
    position: relative;
}

.searchable-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-800);
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: left;
}

.searchable-select-trigger:hover {
    border-color: var(--gray-400);
}

.searchable-select-wrapper.open .searchable-select-trigger {
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
}

.searchable-select-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-arrow {
    flex-shrink: 0;
    margin-left: 8px;
    color: var(--gray-500);
    transition: transform 0.2s;
}

.searchable-select-wrapper.open .searchable-select-arrow {
    transform: rotate(180deg);
}

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    max-height: 350px;
    overflow: hidden;
}

.searchable-select-wrapper.open .searchable-select-dropdown {
    display: block;
}

.searchable-select-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.searchable-select-search svg {
    flex-shrink: 0;
    color: var(--gray-400);
}

.searchable-select-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    color: var(--gray-800);
}

.searchable-select-search input::placeholder {
    color: var(--gray-400);
}

.searchable-select-options {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
}

.searchable-select-group {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    margin-top: 4px;
}

.searchable-select-group:first-child {
    margin-top: 0;
    border-top: none;
}

.searchable-select-option {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700);
    transition: background 0.1s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.searchable-select-option:hover {
    background: var(--gray-100);
}

.searchable-select-option.selected {
    background: var(--gray-100);
    font-weight: 500;
    color: var(--black);
}

.searchable-select-option .client-star {
    color: var(--primary);
    font-size: 12px;
    margin-left: auto;
}

/* Avatar styles for dropdown */
.select-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.select-avatar-initials {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.select-avatar-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.searchable-select-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.searchable-select-text .select-avatar {
    width: 20px;
    height: 20px;
}

/* Mobile adjustments for searchable select */
@media (max-width: 768px) {
    .searchable-select-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 70vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border: none;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    }
    
    .searchable-select-search {
        padding: 14px 16px;
    }
    
    .searchable-select-search input {
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    .searchable-select-option {
        padding: 14px 16px;
    }
    
    .searchable-select-options {
        max-height: calc(70vh - 60px);
    }
}

/* ============================================
   MOBILE TASK DATE PICKER
   ============================================ */
.mobile-date-btn {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    flex-shrink: 0;
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.mobile-date-btn:hover {
    background: var(--gray-200);
}

.mobile-date-btn:active {
    background: var(--gray-300);
    transform: scale(0.95);
}

.mobile-date-btn svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    .mobile-date-btn {
        display: flex !important;
    }
    
    .task-row {
        position: relative;
        padding-bottom: 50px !important;
    }
}

/* Mobile date picker modal */
.mobile-date-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    align-items: flex-end;
    justify-content: center;
}

.mobile-date-modal.open {
    display: flex;
}

.mobile-date-modal-content {
    background: white;
    width: 100%;
    max-width: 400px;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mobile-date-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.mobile-date-modal-title {
    flex: 1;
    min-width: 0;
}

.mobile-date-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    display: block;
    margin-bottom: 4px;
}

.mobile-date-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mobile-date-modal-close {
    background: var(--gray-100);
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--gray-500);
    border-radius: 50%;
    margin-left: 12px;
    flex-shrink: 0;
}

.mobile-date-modal-close:active {
    background: var(--gray-200);
}

/* Current date display - tappable */
.mobile-date-current {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.15s ease;
}

.mobile-date-current:active {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.mobile-date-current svg:first-child {
    color: var(--primary-color);
    flex-shrink: 0;
}

.mobile-date-current span {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-900);
}

.mobile-date-chevron {
    color: var(--gray-400);
    flex-shrink: 0;
}

.mobile-date-input-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Quick date options */
.mobile-date-quick-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.quick-date-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-date-btn:active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(0.98);
}

.quick-date-btn:active .quick-date-text,
.quick-date-btn:active .quick-date-day {
    color: white;
}

.quick-date-icon {
    font-size: 20px;
}

.quick-date-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
}

.quick-date-day {
    font-size: 12px;
    color: var(--gray-500);
}

/* Actions */
.mobile-date-actions {
    display: flex;
    gap: 12px;
}

.mobile-date-actions .btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mobile-date-actions .btn-ghost {
    background: var(--gray-100);
    color: var(--gray-700);
}

.mobile-date-actions .btn-ghost:active {
    background: var(--gray-200);
}

.mobile-date-actions .btn-primary {
    background: var(--primary-color);
    color: white;
}

.mobile-date-actions .btn-primary:active {
    opacity: 0.9;
}

/* ============================================
   STATUS DOTS FOR DROPDOWN
   ============================================ */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.status-dot.status-pending { background-color: #9ca3af; }
.status-dot.status-assigned { background-color: #3b82f6; }
.status-dot.status-in-progress { background-color: #f59e0b; }
.status-dot.status-in-review { background-color: #8b5cf6; }
.status-dot.status-review { background-color: #8b5cf6; }
.status-dot.status-revision { background-color: #f97316; }
.status-dot.status-in-revision { background-color: #f97316; }
.status-dot.status-completed { background-color: #10b981; }
.status-dot.status-on-hold { background-color: #ef4444; }

/* ============================================
   MOBILE FILTERS BAR & MODAL
   ============================================ */
.mobile-filters-bar {
    display: none;
    padding: 12px 0;
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-filter-chips {
    display: flex;
    gap: 8px;
    min-width: max-content;
}

.mobile-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.mobile-filter-chip:hover {
    border-color: var(--gray-400);
}

.mobile-filter-chip.active {
    background: var(--black);
    color: white;
    border-color: var(--black);
}

.mobile-filter-chip .filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--primary);
    color: white;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
}

.mobile-filter-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    align-items: flex-end;
    justify-content: center;
}

.mobile-filter-modal.open {
    display: flex;
}

.mobile-filter-modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mobile-filter-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.mobile-filter-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.mobile-filter-modal-header button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--gray-500);
}

.mobile-filter-form {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.mobile-filter-group {
    margin-bottom: 16px;
}

.mobile-filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.mobile-filter-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px; /* Prevents iOS zoom */
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: white;
    color: var(--gray-800);
}

.mobile-filter-actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.mobile-filter-actions .btn {
    flex: 1;
}

@media (max-width: 768px) {
    .mobile-filters-bar {
        display: block;
    }
    
    /* Hide desktop sidebar on mobile */
    .filters-sidebar {
        display: none !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar,
    .top-bar,
    .mobile-menu-btn,
    .timer-bar,
    .btn,
    .notifications-wrapper {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
