@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================
   DARK MINIMAL DESIGN — Clean & Polished
   ============================================ */

:root {
    /* Background */
    --bg-deep: #000000;
    --bg-surface: #0a0a0a;
    --bg-elevated: #141416;
    --bg-elevated-2: #1e1e22;

    /* Glass */
    --glass-bg: rgba(20, 20, 22, 0.85);
    --glass-bg-hover: rgba(30, 30, 34, 0.9);
    --glass-bg-strong: rgba(30, 30, 34, 0.6);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-border-hover: rgba(255, 255, 255, 0.12);
    --glass-blur: blur(20px);
    --glass-blur-strong: blur(40px);

    /* Accent — subdued teal */
    --rainbow: conic-gradient(
        from 0deg,
        #4ECDC4, #45B7AA, #3DA296, #4ECDC4
    );
    --accent: #4ECDC4;
    --accent-light: #6ED8D0;
    --accent-glow: rgba(78, 205, 196, 0.10);
    --accent-glow-strong: rgba(78, 205, 196, 0.20);
    --accent-gradient: linear-gradient(135deg, #4ECDC4, #3AAFA9);

    /* Green accent */
    --green-accent: #34c759;
    --green-glow: rgba(52, 199, 89, 0.2);

    /* Text */
    --text-high: rgba(255, 255, 255, 0.92);
    --text-mid: rgba(255, 255, 255, 0.50);
    --text-low: rgba(255, 255, 255, 0.30);
    --text-ghost: rgba(255, 255, 255, 0.12);

    /* Semantic */
    --success: #34c759;
    --success-glow: rgba(52, 199, 89, 0.15);
    --warning: #ff9f0a;
    --warning-glow: rgba(255, 159, 10, 0.15);
    --danger: #ff453a;
    --danger-glow: rgba(255, 69, 58, 0.15);

    /* Layout */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --radius-pill: 100px;
    --sidebar-width: 220px;
    --sidebar-collapsed: 60px;

    /* Shadows */
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 6px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(78, 205, 196, 0.06);

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
    background: var(--bg-deep);
    color: var(--text-high);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================
   AMBIENT BACKGROUND (very subtle)
   ============================================ */

.bg-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.07;
    animation: orbFloat 30s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(78, 205, 196, 0.3) 0%, transparent 70%);
    top: -15%;
    left: -10%;
    animation-duration: 35s;
}

.bg-orb:nth-child(2) {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(58, 175, 169, 0.2) 0%, transparent 70%);
    bottom: -15%;
    right: -10%;
    animation-duration: 40s;
    animation-delay: -10s;
}

.bg-orb:nth-child(3) {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(78, 205, 196, 0.15) 0%, transparent 70%);
    top: 40%;
    left: 40%;
    animation-duration: 32s;
    animation-delay: -5s;
}

.bg-orb:nth-child(4) {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(52, 199, 89, 0.10) 0%, transparent 70%);
    top: 60%;
    left: 10%;
    animation-duration: 28s;
    animation-delay: -15s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.03); }
    66% { transform: translate(-20px, 30px) scale(0.97); }
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.10);
}

/* ============================================
   SIDEBAR — Compact & clean
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: var(--glass-blur-strong);
    -webkit-backdrop-filter: var(--glass-blur-strong);
    border-right: 1px solid var(--glass-border);
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    padding: 0 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: white;
    position: relative;
    overflow: hidden;
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.10) 50%,
        transparent 60%
    );
    animation: shimmer 5s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%) rotate(45deg); }
    50% { transform: translateX(100%) rotate(45deg); }
}

.logo span {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-high);
}

/* Navigation */
.nav-links {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-mid);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.25s var(--ease-out-expo);
    font-size: 13px;
    font-weight: 500;
}

.nav-links a .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    transition: transform 0.25s var(--ease-spring);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links a .nav-icon svg {
    flex-shrink: 0;
}

.nav-links a:hover {
    color: var(--text-high);
    background: var(--glass-bg);
}

.nav-links a:hover .nav-icon {
    transform: scale(1.1);
}

.nav-links a.active {
    background: rgba(78, 205, 196, 0.08);
    color: var(--accent-light);
    font-weight: 600;
    border: 1px solid rgba(78, 205, 196, 0.12);
}

/* Nav footer */
.nav-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    font-size: 11px;
    color: var(--text-low);
    border-top: 1px solid var(--glass-border);
    margin-top: 8px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-ghost);
    flex-shrink: 0;
}

.status-indicator.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulseGlow 2.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 4px var(--success); }
    50% { box-shadow: 0 0 10px var(--success), 0 0 20px rgba(52, 199, 89, 0.3); }
}

.collapse-btn {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-low);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.collapse-btn:hover {
    background: rgba(78, 205, 196, 0.10);
    border-color: rgba(78, 205, 196, 0.20);
    color: var(--accent-light);
    transform: none;
    box-shadow: none;
}

.collapse-btn:active {
    transform: scale(0.95);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.content {
    margin-left: var(--sidebar-width);
    padding: 36px 40px;
    flex: 1;
    max-width: 1100px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    animation: contentFadeIn 0.5s var(--ease-out-expo) forwards;
}

@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page header */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.8px;
    color: var(--text-high);
    line-height: 1.2;
}

.subtitle {
    color: var(--text-low);
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   CARD — Clean elevated surface
   ============================================ */

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 16px;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    animation: cardAppear 0.5s var(--ease-out-expo) backwards;
}

.card:nth-child(1) { animation-delay: 0.03s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.09s; }
.card:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5) { animation-delay: 0.15s; }

@keyframes cardAppear {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.card:hover {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
}

.card h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--text-high);
    letter-spacing: -0.2px;
    position: relative;
    z-index: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.card-header h2 {
    margin-bottom: 0;
}

/* ============================================
   STATS GRID
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--ease-out-expo);
    animation: cardAppear 0.5s var(--ease-out-expo) backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.03s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.13s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }

.stat-card:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 34px;
    font-weight: 800;
    color: var(--text-high);
    line-height: 1.1;
}

.stat-label {
    color: var(--text-low);
    margin-top: 6px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   GRID LAYOUT
   ============================================ */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* ============================================
   TASKS — Swipe-to-reveal (iOS style)
   ============================================ */

.task-list {
    list-style: none;
    position: relative;
    z-index: 1;
}

.task-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 6px;
}

.task-item:last-child {
    margin-bottom: 0;
}

.task-item-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px 16px 56px;
    background: rgba(20, 20, 22, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    position: relative;
    z-index: 0;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                background 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease;
    cursor: pointer;
}

.task-item-content:hover {
    background: rgba(30, 30, 34, 0.8);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Priority left border indicators */
.task-item-content.priority-high {
    border-left: 3px solid var(--danger);
}
.task-item-content.priority-medium {
    border-left: 3px solid var(--warning);
}
.task-item-content.priority-low {
    border-left: 3px solid var(--success);
}

/* Completed task styling */
.task-item-completed {
    opacity: 0.6;
}
.task-item-completed .task-title {
    text-decoration: line-through;
    color: var(--text-low);
}

/* Task badges row */
.task-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 2px;
}

.task-item-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.task-item.swiped .task-item-actions {
    opacity: 1;
    pointer-events: auto;
}

.task-item-actions .action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #fff;
    transition: opacity 0.2s ease;
    padding: 0;
}

.task-item-actions .action-polish {
    background: #45B7D1;
}

.task-item-actions .action-delete {
    background: var(--danger);
}

.task-item-actions .action-btn:hover {
    opacity: 0.85;
}

/* Desktop: show on hover */
@media (hover: hover) and (pointer: fine) {
    .task-item:hover .task-item-actions {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Touch: swiped class applied via JS */
.task-item.swiped .task-item-content {
    transform: translateX(-140px);
}

.task-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.task-title {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-desc {
    font-size: 12px;
    color: var(--text-low);
    line-height: 1.5;
}

.priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: none;
}

.priority.priority-high { background: var(--danger); box-shadow: 0 0 6px var(--danger-glow); }
.priority.priority-medium { background: var(--warning); box-shadow: 0 0 6px var(--warning-glow); }
.priority.priority-low { background: var(--success); box-shadow: 0 0 6px var(--success-glow); }

/* Legacy .task-actions hidden — replaced by swipe actions */
.task-actions {
    display: none;
}

/* Project color badge */
.badge-project-colored {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    max-width: fit-content;
    cursor: pointer;
    transition: opacity 0.2s;
}

.badge-project-colored:hover {
    opacity: 0.8;
}

/* Color picker for project badges */
.project-color-picker {
    position: absolute;
    z-index: 100;
    background: var(--bg-elevated-2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 180px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.project-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.project-color-swatch:hover {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.project-color-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* ============================================
   PROVIDERS
   ============================================ */

.provider-list {
    list-style: none;
    position: relative;
    z-index: 1;
}

.provider-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-transform: capitalize;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}

.provider-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-mid);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.badge-project {
    background: var(--accent-glow);
    color: var(--accent-light);
    border-color: rgba(78, 205, 196, 0.15);
}

.badge-high {
    background: var(--danger-glow);
    color: var(--danger);
    border-color: rgba(255, 69, 58, 0.2);
}

.badge-medium {
    background: var(--warning-glow);
    color: var(--warning);
    border-color: rgba(255, 159, 10, 0.2);
}

.badge-low {
    background: var(--success-glow);
    color: var(--success);
    border-color: rgba(52, 199, 89, 0.2);
}

.empty-state {
    color: var(--text-low);
    padding: 24px 0;
    text-align: center;
    font-size: 14px;
}

/* ============================================
   FORMS
   ============================================ */

input, textarea, select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-high);
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    outline: none;
    transition: all 0.25s ease;
}

input::placeholder, textarea::placeholder {
    color: var(--text-low);
}

input:focus, textarea:focus, select:focus {
    border-color: rgba(78, 205, 196, 0.3);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.06);
    background: rgba(255, 255, 255, 0.05);
}

select {
    width: auto;
    min-width: 150px;
    cursor: pointer;
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%235a5a5e'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-inline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-row select { flex: 1; }

.search-bar {
    display: flex;
    gap: 10px;
}

.search-bar input { flex: 1; }

/* ============================================
   BUTTONS
   ============================================ */

button, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.25s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

button[type="submit"], .btn-complete {
    background: var(--accent-gradient);
    color: white;
}

button[type="submit"]:hover, .btn-complete:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow-strong);
}

button:active {
    transform: translateY(0) scale(0.97);
}

.btn-secondary {
    background: var(--bg-elevated-2);
    color: var(--text-high);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border-hover);
}

.btn-complete {
    padding: 7px 16px;
    font-size: 12px;
}

.btn-delete {
    padding: 7px 10px;
    font-size: 12px;
    background: transparent;
    color: var(--text-low);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-delete:hover {
    color: var(--danger);
    background: var(--danger-glow);
    border-color: rgba(255, 69, 58, 0.3);
}

.btn-ai-polish {
    padding: 7px 10px;
    font-size: 14px;
    background: transparent;
    color: var(--text-low);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-ai-polish:hover {
    color: var(--accent-light);
    background: var(--accent-glow);
    border-color: rgba(78, 205, 196, 0.2);
}

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

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(255, 69, 58, 0.3);
    border-radius: var(--radius-pill);
}

.btn-danger:hover {
    background: var(--danger-glow);
}

/* ============================================
   CHAT
   ============================================ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 320px;
    position: relative;
    z-index: 1;
}

.chat-container-full {
    height: calc(100vh - 160px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.chat-message {
    padding: 12px 18px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    max-width: 80%;
    font-size: 14px;
    line-height: 1.65;
    animation: msgAppear 0.3s var(--ease-out-expo) forwards;
    position: relative;
}

@keyframes msgAppear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    background: rgba(78, 205, 196, 0.12);
    color: var(--text-high);
    margin-left: auto;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(78, 205, 196, 0.15);
}

.chat-message.assistant {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
}

/* Timestamp on hover */
.chat-message .msg-time {
    position: absolute;
    top: -18px;
    font-size: 10px;
    color: var(--text-low);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
}

.chat-message.user .msg-time { right: 4px; }
.chat-message.assistant .msg-time { left: 4px; }
.chat-message:hover .msg-time { opacity: 1; }

/* Chat image thumbnails in user messages */
.chat-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.chat-image-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
}
.chat-image-thumb:hover {
    opacity: 0.85;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* ============================================
   MARKDOWN IN CHAT MESSAGES — CRITICAL
   ============================================ */

/* Headers */
.chat-message h1,
.chat-message h2,
.chat-message h3,
.chat-message h4,
.chat-message h5,
.chat-message h6 {
    font-weight: 700;
    margin: 16px 0 8px 0;
    line-height: 1.3;
    color: var(--text-high);
}

.chat-message h1:first-child,
.chat-message h2:first-child,
.chat-message h3:first-child,
.chat-message h4:first-child {
    margin-top: 4px;
}

.chat-message h1 { font-size: 1.5em; }
.chat-message h2 { font-size: 1.3em; }
.chat-message h3 { font-size: 1.15em; }
.chat-message h4 { font-size: 1.05em; }
.chat-message h5 { font-size: 1em; }
.chat-message h6 { font-size: 0.95em; color: var(--text-mid); }

/* Bold & italic */
.chat-message strong {
    color: var(--text-high);
    font-weight: 700;
}

.chat-message em {
    font-style: italic;
    color: var(--text-high);
    opacity: 0.85;
}

/* Lists */
.chat-message ul,
.chat-message ol {
    margin: 8px 0;
    padding-left: 22px;
}

.chat-message li {
    margin-bottom: 4px;
    line-height: 1.55;
}

.chat-message li::marker {
    color: var(--text-low);
}

/* Inline code */
.chat-message code {
    background: rgba(255, 255, 255, 0.07);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    color: var(--accent-light);
}

/* Code blocks */
.chat-message pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    padding: 14px 16px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.55;
}

.chat-message pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: var(--text-high);
}

/* Blockquotes */
.chat-message blockquote {
    border-left: 3px solid rgba(78, 205, 196, 0.4);
    padding: 8px 16px;
    margin: 10px 0;
    background: rgba(78, 205, 196, 0.04);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    color: var(--text-mid);
    font-style: italic;
}

/* Horizontal rule */
.chat-message hr {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 14px 0;
}

/* Chat input area */
.chat-input-wrapper {
    position: relative;
    margin-top: 12px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: transform 0.15s ease-out;
}

.chat-input {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    position: relative;
}

.chat-input textarea {
    flex: 1;
    border-radius: var(--radius);
    padding: 12px 20px;
    resize: none;
    min-height: 44px;
    max-height: 150px;
    line-height: 1.4;
    overflow-y: auto;
}

/* chat-send-btn styled in bottom section */

/* Send button in stop mode */
.chat-send-btn.is-stop {
    background: var(--danger-glow);
    color: var(--danger);
    border-color: rgba(255, 69, 58, 0.3);
}

.chat-send-btn.is-stop:hover {
    background: rgba(255, 69, 58, 0.25);
}

/* Voice input button */
.chat-voice-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-mid);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}
.chat-voice-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}
.chat-voice-btn.recording {
    background: var(--danger-glow);
    border-color: var(--danger);
    color: var(--danger);
    animation: voicePulse 1.5s ease-in-out infinite;
}
.chat-voice-btn.transcribing {
    opacity: 0.5;
    cursor: wait;
    font-size: 12px;
}
@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(255, 69, 58, 0); }
}

/* Mic button — reusable voice input trigger */
.mic-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-mid);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.mic-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}
.mic-btn.recording {
    background: var(--danger-glow);
    border-color: var(--danger);
    color: var(--danger);
    animation: voicePulse 1.5s ease-in-out infinite;
}
.mic-btn.transcribing {
    opacity: 0.5;
    cursor: wait;
    font-size: 12px;
}

/* Status indicator for voice recording */
.mic-status {
    position: absolute;
    bottom: -18px;
    right: 0;
    font-size: 11px;
    color: var(--danger);
    animation: fadeInUp 0.2s ease;
    white-space: nowrap;
    pointer-events: none;
}

/* In chat form, position near the send button area */
.chat-input .mic-status {
    bottom: -16px;
    right: 50px;
}

/* Textarea + mic button inline layout */
.textarea-with-mic {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}
.textarea-with-mic .tool-textarea {
    margin-bottom: 0;
    flex: 1;
}
.textarea-with-mic .mic-btn {
    margin-top: 6px;
}

/* Input with inline mic button */
.input-with-mic {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-mic input {
    flex: 1;
    padding-right: 42px;
}
.mic-btn-inline {
    position: absolute;
    right: 4px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.mic-btn-inline:hover {
    background: var(--accent-glow);
    color: var(--accent);
}
.mic-btn-inline.recording {
    background: var(--danger-glow);
    color: var(--danger);
    animation: voicePulse 1.5s ease-in-out infinite;
}
.mic-btn-inline.transcribing {
    opacity: 0.5;
    cursor: wait;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Chat full page */
.chat-fullpage {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 72px);
}

/* Controls row: mode selector + mic */
.chat-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

/* ============================================
   MEMORY
   ============================================ */

.memory-list {
    list-style: none;
    position: relative;
    z-index: 1;
}

.memory-item {
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: all 0.2s ease;
    position: relative;
}

.memory-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.memory-item-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.memory-content {
    margin-bottom: 6px;
    line-height: 1.55;
    font-size: 14px;
    color: var(--text-high);
}

.memory-meta {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.source {
    color: var(--text-low);
}

/* Memory actions */
.memory-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.btn-mem-edit,
.btn-mem-delete {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-low);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-mem-edit:hover {
    color: var(--accent-light);
    background: var(--accent-glow);
    border-color: rgba(78, 205, 196, 0.2);
}

.btn-mem-delete:hover {
    color: var(--danger);
    background: var(--danger-glow);
    border-color: rgba(255, 69, 58, 0.3);
}

/* Memory edit form */
.memory-edit-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memory-edit-textarea {
    font-size: 13px;
    line-height: 1.5;
}

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

.memory-edit-actions button {
    padding: 6px 14px;
    font-size: 12px;
}

/* Garbage/low-value highlight */
.memory-item.is-garbage {
    opacity: 0.5;
    border-left: 2px solid var(--warning);
}

/* Knowledge base entries */
.knowledge-item {
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: all 0.2s ease;
    position: relative;
}

.knowledge-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.knowledge-item-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.knowledge-topic {
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-light);
    margin-bottom: 4px;
}

.knowledge-text {
    font-size: 13px;
    color: var(--text-mid);
    line-height: 1.5;
}

.knowledge-meta {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    font-size: 11px;
}

.knowledge-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

/* ============================================
   MODAL
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100;
    animation: modalFadeIn 0.25s ease forwards;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border-hover);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 540px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    animation: modalSlideUp 0.35s var(--ease-out-expo) forwards;
    margin: auto 0;
    flex-shrink: 0;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
}

.modal-content pre {
    white-space: pre-wrap;
    margin: 14px 0;
    color: var(--text-mid);
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-actions-wrap {
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================
   PROJECT / TASK DETAIL
   ============================================ */

.project-card {
    margin-bottom: 6px;
}

.project-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-low);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 9px;
    border-radius: var(--radius-pill);
}

.task-detail-content {
    max-width: 600px;
    padding: 28px;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--bg-elevated);
    color: var(--text-mid);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--bg-elevated-2);
    color: var(--text-high);
    border-color: var(--glass-border-hover);
}

.task-detail-header {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.task-detail-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}

.task-detail-desc {
    color: var(--text-mid);
    line-height: 1.65;
    white-space: pre-wrap;
    margin: 14px 0;
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 14px;
}

.task-detail-desc a {
    color: var(--accent-light);
    word-break: break-all;
    transition: color 0.2s ease;
}

.task-detail-desc a:hover {
    color: #6ED8D0;
}

.task-detail-meta {
    display: flex;
    gap: 14px;
    color: var(--text-low);
    font-size: 12px;
    margin-bottom: 18px;
}

/* ============================================
   PROJECT TABS
   ============================================ */

.project-tab {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--glass-border);
    background: var(--bg-elevated);
    color: var(--text-mid);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
}

.project-tab:hover {
    background: var(--bg-elevated-2);
    color: var(--text-high);
}

.project-tab.active {
    background: rgba(78, 205, 196, 0.10);
    border-color: rgba(78, 205, 196, 0.20);
    color: var(--accent-light);
    font-weight: 600;
}

.project-tab .tab-count {
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.85em;
}

/* ============================================
   PROFILE
   ============================================ */

.profile-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.profile-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.profile-card .card-header h2 {
    margin-bottom: 0;
}

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

.btn-edit, .btn-clear {
    padding: 7px 16px;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-edit {
    background: var(--accent-glow);
    color: var(--accent-light);
    border: 1px solid rgba(78, 205, 196, 0.15);
}

.btn-edit:hover {
    background: rgba(78, 205, 196, 0.15);
}

.btn-clear {
    background: transparent;
    color: var(--text-low);
    border: 1px solid var(--glass-border);
}

.btn-clear:hover {
    color: var(--danger);
    border-color: rgba(255, 69, 58, 0.3);
    background: var(--danger-glow);
}

.field-dict {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dict-row {
    display: flex;
    gap: 12px;
    padding: 5px 0;
}

.dict-key {
    color: var(--text-mid);
    min-width: 120px;
    font-weight: 500;
    font-size: 13px;
}

.profile-list {
    list-style: none;
}

.profile-list-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
}

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

.profile-list-item:hover {
    padding-left: 6px;
}

.field-editor textarea {
    width: 100%;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    margin-bottom: 10px;
}

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

/* Collapsible profile sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapse-chevron {
    display: inline-block;
    font-size: 14px;
    color: var(--text-low);
    transition: transform 0.25s ease;
    flex-shrink: 0;
    line-height: 1;
}

.collapsible-header.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

.collapsible-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.3s ease, opacity 0.25s ease;
    opacity: 1;
}

.collapsible-body.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.profile-card .field-editor.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.collapsible-header.collapsed {
    margin-bottom: 0;
}

/* ============================================
   AI SETTINGS
   ============================================ */

.settings-section {
    margin-top: 32px;
}

.settings-section .section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-high);
    margin-bottom: 16px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.setting-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-high);
    margin-bottom: 4px;
}

.setting-description {
    font-size: 12px;
    color: var(--text-low);
    margin-bottom: 12px;
}

.setting-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-high);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
}

.setting-select:focus {
    border-color: rgba(78, 205, 196, 0.3);
    outline: none;
}

.setting-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.setting-status {
    font-size: 12px;
    color: var(--text-low);
}

.api-status-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.api-status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-mid);
}

.api-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.api-dot.active {
    background: #4caf50;
}

.api-dot.inactive {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   NOTIFICATION DOT
   ============================================ */

.notification-dot {
    width: 18px;
    height: 18px;
    background: var(--danger);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

/* ============================================
   LOADING SHIMMER
   ============================================ */

.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-elevated) 25%,
        var(--bg-elevated-2) 50%,
        var(--bg-elevated) 75%
    );
    background-size: 200% 100%;
    animation: loadingShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes loadingShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   HIDDEN
   ============================================ */

.hidden {
    display: none !important;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px !important;
}

.typing-indicator .typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-light);
    animation: typingPulse 1.4s ease-in-out infinite;
}

.typing-indicator .typing-dot:nth-child(2) {
    animation-delay: 0.15s;
    background: var(--accent);
}

.typing-indicator .typing-dot:nth-child(3) {
    animation-delay: 0.3s;
    background: var(--success);
}

@keyframes typingPulse {
    0%, 100% {
        transform: scale(0.6);
        opacity: 0.3;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Bottom nav section */
.nav-bottom {
    border-top: 1px solid var(--glass-border);
    padding-top: 8px;
    margin-top: 8px;
}

.nav-links-bottom {
    flex: 0 !important;
}

.nav-links-bottom a {
    font-size: 12px;
    padding: 8px 12px;
    color: var(--text-low);
}

.nav-link-muted {
    opacity: 0.7;
}

.nav-link-muted:hover {
    opacity: 1;
}

/* ============================================
   OKR — Objectives & Key Results
   ============================================ */

.page-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.okr-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 14px !important;
    font-size: 12px !important;
    min-height: unset !important;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-mid);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-icon:hover {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    color: var(--text-high);
    transform: translateY(-1px);
}

.btn-icon-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-glow);
}

.btn-danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
}

.btn-danger:hover {
    background: #e03e34 !important;
    box-shadow: 0 4px 16px var(--danger-glow) !important;
}

/* ── OKR Stats ── */

.okr-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.okr-stat {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
    flex: 1;
    animation: cardAppear 0.5s var(--ease-out-expo) backwards;
    transition: all 0.3s var(--ease-out-expo);
}

.okr-stat:hover {
    transform: translateY(-2px);
    border-color: var(--glass-border-hover);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.okr-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-high);
    line-height: 1.2;
}

.okr-stat-label {
    color: var(--text-low);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Ring chart in stats */
.okr-stat-ring {
    display: flex;
    justify-content: center;
}

.okr-ring {
    width: 54px;
    height: 54px;
}

.okr-ring-bg {
    fill: none;
    stroke: var(--glass-border);
    stroke-width: 3;
}

.okr-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.6s var(--ease-out-expo);
}

.okr-ring-text {
    fill: var(--text-high);
    font-size: 9px;
    font-weight: 700;
    text-anchor: middle;
    font-family: 'Inter', sans-serif;
}

/* ── OKR Cards ── */

.okr-cards-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.okr-list-view {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.okr-list-view .okr-card {
    padding: 12px 16px;
}

.okr-list-view .okr-card-desc,
.okr-list-view .okr-no-kr {
    display: none;
}

.okr-card {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    animation: cardAppear 0.5s var(--ease-out-expo) backwards;
}

.okr-card:hover {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.okr-card.archived {
    opacity: 0.5;
}

.okr-card.archived .okr-card-title {
    text-decoration: line-through;
    color: var(--text-low);
}

/* Card header */
.okr-card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.okr-card-color {
    width: 4px;
    border-radius: 4px;
    align-self: stretch;
    min-height: 40px;
    flex-shrink: 0;
}

.okr-card-info {
    flex: 1;
    min-width: 0;
}

.okr-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-high);
    margin-bottom: 4px;
    line-height: 1.3;
}

.okr-card-desc {
    font-size: 13px;
    color: var(--text-mid);
    line-height: 1.5;
    margin-bottom: 8px;
}

.okr-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.okr-badge {
    display: inline-block;
    padding: 2px 10px;
    background: transparent;
    border: 1px solid;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}

.okr-date {
    font-size: 11px;
    color: var(--text-low);
    font-weight: 500;
}

/* Progress ring in card */
.okr-card-progress-ring {
    flex-shrink: 0;
}

.okr-ring-sm {
    width: 46px;
    height: 46px;
}

.okr-ring-text-sm {
    fill: var(--text-high);
    font-size: 9px;
    font-weight: 700;
    text-anchor: middle;
    font-family: 'Inter', sans-serif;
}

/* Card actions */
.okr-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.okr-card:hover .okr-card-actions {
    opacity: 1;
}

/* Progress bar */
.okr-progress-bar {
    height: 4px;
    background: var(--glass-border);
    border-radius: 4px;
    margin: 14px 0 10px;
    overflow: hidden;
}

.okr-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s var(--ease-out-expo);
}

/* KR list */
.okr-kr-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.okr-kr-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.okr-kr-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.okr-kr-bar-wrap {
    width: 60px;
    height: 4px;
    background: var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.okr-kr-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s var(--ease-out-expo);
}

.okr-kr-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.okr-kr-title {
    font-size: 13px;
    color: var(--text-mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.okr-kr-value {
    font-size: 12px;
    color: var(--text-low);
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.okr-kr-delete {
    width: 22px;
    height: 22px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.okr-kr-item:hover .okr-kr-delete {
    opacity: 1;
}

.okr-no-kr {
    padding: 12px 0 4px;
    font-size: 12px;
    color: var(--text-ghost);
    text-align: center;
}

.okr-add-kr-btn {
    margin-top: 8px;
    background: transparent;
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-xs);
    color: var(--text-low);
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.okr-add-kr-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
    transform: none;
    box-shadow: none;
}

/* ── OKR Modals ── */

.okr-modal-content {
    max-width: 560px;
}

.okr-modal-sm {
    max-width: 400px;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-high);
}

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-mid);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--glass-bg-hover);
    color: var(--text-high);
    transform: none;
    box-shadow: none;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-mid);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* KR section in create modal */
.okr-kr-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.okr-kr-section > label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-mid);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.okr-kr-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.okr-kr-input-row input[type="text"] {
    flex: 3;
}

.okr-kr-input-row input[type="number"] {
    flex: 1;
    min-width: 70px;
}

.okr-kr-input-row select {
    flex: 0;
    min-width: 60px;
}

/* KR update modal */
.kr-update-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 16px;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-high);
}

.kr-update-display #kr-update-sep {
    font-size: 20px;
    color: var(--text-low);
    font-weight: 400;
}

.kr-update-display #kr-update-target,
.kr-update-display #kr-update-unit {
    font-size: 18px;
    color: var(--text-low);
    font-weight: 500;
}

.okr-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--glass-border);
    border-radius: 6px;
    outline: none;
    margin-bottom: 12px;
}

.okr-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.3);
    transition: transform 0.15s ease;
}

.okr-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.okr-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.kr-value-input {
    width: 100%;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

/* Settings categories */
.settings-cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.settings-cat-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.settings-cat-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-high);
}

/* OKR card entrance animation */
.okr-card-enter {
    animation: taskItemEnter 0.35s var(--ease-out-expo) both;
}

/* ============================================
   PROJECTS GRID
   ============================================ */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.project-grid-card {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 160px;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    animation: cardAppear 0.5s var(--ease-out-expo) backwards;
    animation-delay: calc(var(--card-index, 0) * 0.05s);
}

.project-grid-card:hover {
    border-color: var(--glass-border-hover);
    background: var(--glass-bg-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}

.project-grid-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-grid-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-high);
    line-height: 1.3;
    word-break: break-word;
    margin-top: auto;
}

.project-grid-count {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-high);
    line-height: 1;
}

.project-grid-label {
    font-size: 12px;
    color: var(--text-low);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============================================
   SUBTLE HOVER EFFECTS
   ============================================ */

/* Smooth transitions on all interactive elements */
a, button, .card, .task-item, .memory-item,
.knowledge-item, .stat-card, .project-tile,
.project-tab, .okr-card, .project-grid-card {
    transition: all 0.3s var(--ease-out-expo);
}

/* --- Card hover shadow (subtle) --- */
.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.okr-card:hover,
.project-grid-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* --- Task item hover (handled by .task-item-content) --- */

/* --- Nav link hover --- */
.nav-links a:hover {
    box-shadow: none;
}

/* --- Nav link active glow bar --- */
.nav-links a.active {
    position: relative;
}

.nav-links a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 50%;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
}

/* --- Button hover glow (submit & complete) --- */
button[type="submit"]::after,
.btn-complete::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--accent-gradient);
    opacity: 0;
    filter: blur(10px);
    z-index: -1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

button[type="submit"]:hover::after,
.btn-complete:hover::after {
    opacity: 0.3;
}

/* ============================================
   ANIMATIONS
   ============================================ */

/* Card appear */
@keyframes cardAppearEnhanced {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation-name: cardAppearEnhanced;
    animation-duration: 0.45s;
    animation-timing-function: var(--ease-out-expo);
}

.stat-card {
    animation-name: cardAppearEnhanced;
    animation-duration: 0.45s;
    animation-timing-function: var(--ease-out-expo);
}

.okr-card {
    animation-name: cardAppearEnhanced;
    animation-duration: 0.45s;
    animation-timing-function: var(--ease-out-expo);
}

.project-grid-card {
    animation-name: cardAppearEnhanced;
    animation-duration: 0.45s;
    animation-timing-function: var(--ease-out-expo);
}

/* Chat message animation */
@keyframes msgAppearEnhanced {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message {
    animation: msgAppearEnhanced 0.3s var(--ease-out-expo) forwards;
}

/* Modal backdrop animation */
@keyframes modalFadeInEnhanced {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
}

/* Modal animations moved to main .modal / .modal-content rules */

/* Page content entrance */
.content {
    animation: contentFadeIn 0.5s var(--ease-out-expo) forwards;
}

/* ============================================
   EFFECTS (minimal)
   ============================================ */

/* --- Page header: clean white text --- */
.page-header h1 {
    color: var(--text-high);
    -webkit-text-fill-color: unset;
    background: none;
}

/* --- Card: subtle border highlight on hover --- */
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--accent-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.card:hover::before {
    opacity: 0.15;
}

/* --- Stat card subtle border --- */
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--accent-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.stat-card:hover::before {
    opacity: 0.3;
}

.stat-card:hover .stat-value {
    color: var(--accent-light);
    transition: all 0.3s ease;
}

/* --- Task item staggered entrance --- */
.task-list .task-item {
    opacity: 0;
    animation: taskSlideIn 0.35s var(--ease-out-expo) forwards;
}

.task-list .task-item:nth-child(1) { animation-delay: 0.02s; }
.task-list .task-item:nth-child(2) { animation-delay: 0.04s; }
.task-list .task-item:nth-child(3) { animation-delay: 0.06s; }
.task-list .task-item:nth-child(4) { animation-delay: 0.08s; }
.task-list .task-item:nth-child(5) { animation-delay: 0.10s; }
.task-list .task-item:nth-child(6) { animation-delay: 0.12s; }
.task-list .task-item:nth-child(7) { animation-delay: 0.14s; }
.task-list .task-item:nth-child(8) { animation-delay: 0.16s; }
.task-list .task-item:nth-child(9) { animation-delay: 0.18s; }
.task-list .task-item:nth-child(10) { animation-delay: 0.20s; }

@keyframes taskSlideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Task item hover (handled by swipe system) --- */

/* --- Chat bubble effects --- */
.chat-message.user {
    box-shadow: 0 2px 10px rgba(78, 205, 196, 0.10);
}

.chat-message.user:hover {
    box-shadow: 0 4px 16px rgba(78, 205, 196, 0.15);
    transition: all 0.2s ease;
}

.chat-message.assistant {
    position: relative;
}

.chat-message.assistant:hover {
    border-color: rgba(78, 205, 196, 0.12);
    transition: all 0.2s ease;
}

/* --- Typing indicator glow pulse --- */
.typing-indicator {
    position: relative;
}

.typing-indicator::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: var(--accent-gradient);
    opacity: 0.10;
    filter: blur(8px);
    animation: typingGlow 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes typingGlow {
    0%, 100% { opacity: 0.06; transform: scale(1); }
    50% { opacity: 0.15; transform: scale(1.01); }
}

.typing-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-light);
    margin: 0 2px;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* --- Sidebar logo --- */
.logo-icon {
    position: relative;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 12px;
    background: var(--accent-gradient);
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.logo:hover .logo-icon::before {
    opacity: 0.3;
}

/* --- Input focus glow --- */
input:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.06);
}

/* --- Modal backdrop --- */
.modal:not(.hidden) {
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(78, 205, 196, 0.03) 0%,
        transparent 50%
    ),
    rgba(0, 0, 0, 0.75);
}

/* --- Status indicator pulse --- */
.status-indicator.online {
    position: relative;
}

.status-indicator.online::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--success);
    opacity: 0;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.8); }
}

/* --- Smooth page content entrance --- */
@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Priority dot glow --- */
.priority.priority-high {
    box-shadow: 0 0 6px rgba(255, 69, 58, 0.3);
}

.priority.priority-medium {
    box-shadow: 0 0 5px rgba(255, 159, 10, 0.25);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* --- Tablet: sidebar collapses to icons only --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed);
        padding: 20px 6px;
    }
    .sidebar .logo span,
    .sidebar .nav-text,
    .sidebar .nav-footer span {
        display: none;
    }
    .sidebar .logo {
        justify-content: center;
    }
    .nav-links a {
        justify-content: center;
        padding: 12px;
    }
    .content {
        margin-left: var(--sidebar-collapsed);
    }
    .nav-footer {
        justify-content: center;
    }
    .collapse-btn {
        display: none;
    }
}

/* --- Mobile header + burger menu --- */
.mobile-header,
.burger-menu,
.burger-overlay {
    display: none;
}

@media (max-width: 768px) {
    /* Hide sidebar completely on mobile */
    .sidebar {
        display: none;
    }

    /* Mobile top header */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 16px;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--glass-border);
        z-index: 200;
    }

    .mobile-header-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 700;
        font-size: 16px;
        color: var(--text-high);
    }

    .mobile-header-logo .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    /* Burger button */
    .burger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 40px;
        height: 40px;
        padding: 8px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 210;
    }

    .burger-btn span {
        display: block;
        width: 100%;
        height: 2px;
        background: var(--text-high);
        border-radius: 2px;
        transition: all 0.3s var(--ease-out-expo);
        transform-origin: center;
    }

    .burger-btn.open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .burger-btn.open span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    .burger-btn.open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Overlay */
    .burger-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 190;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .burger-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    /* Slide-in menu */
    .burger-menu {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        max-width: 80vw;
        height: 100vh;
        height: 100dvh;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        border-left: 1px solid var(--glass-border);
        z-index: 195;
        transform: translateX(100%);
        transition: transform 0.35s var(--ease-out-expo);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .burger-menu.open {
        transform: translateX(0);
    }

    .burger-menu-inner {
        padding: 76px 20px 40px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .burger-link {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        color: var(--text-mid);
        text-decoration: none;
        font-size: 15px;
        font-weight: 500;
        border-radius: var(--radius-sm);
        transition: all 0.2s;
    }

    .burger-link:hover {
        background: var(--bg-elevated-2);
        color: var(--text-high);
    }

    .burger-link.active {
        color: var(--accent);
        background: var(--accent-glow);
    }

    .burger-link .nav-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        flex-shrink: 0;
    }

    .burger-divider {
        height: 1px;
        background: var(--glass-border);
        margin: 8px 0;
    }

    body.burger-open {
        overflow: hidden;
    }

    /* Content: top padding for header */
    .content {
        margin-left: 0;
        padding: 16px;
        padding-top: 72px;
        padding-bottom: 24px;
        max-width: 100%;
    }

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

    /* Chat takes full viewport */
    .chat-fullpage {
        height: calc(100vh - 72px);
    }
    .chat-container-full {
        height: calc(100vh - 120px);
    }
    .chat-message {
        max-width: 90%;
    }

    .page-header {
        margin-bottom: 16px;
    }
    .page-header h1 {
        font-size: 22px;
    }
    .card {
        padding: 16px;
    }

    /* Modal compact on mobile */
    .modal-content {
        padding: 20px;
        max-height: 90vh;
    }
    .task-detail-content {
        max-width: 100%;
    }
    .task-detail-desc {
        padding: 10px;
        margin: 8px 0;
        font-size: 13px;
    }

    /* Profile fixes */
    .profile-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .profile-card-actions {
        flex-wrap: wrap;
    }
    .btn-edit, .btn-clear {
        font-size: 11px;
        padding: 6px 12px;
    }
    .collapsible-title h2 {
        font-size: 15px;
    }
    .btn-danger {
        min-width: auto;
        white-space: nowrap;
        padding: 8px 16px;
        font-size: 12px;
    }

    /* Task form row: stack on mobile */
    .form-row {
        flex-wrap: wrap;
    }
    .form-row select {
        min-width: 0;
        flex: 1 1 45%;
    }
    .form-row button {
        flex: 1 1 100%;
    }

    /* Tools tabs scroll on mobile */
    .tools-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .collapse-btn {
        display: none;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 10px;
        padding-top: 66px;
        padding-bottom: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .chat-message {
        max-width: 95%;
        font-size: 13px;
    }
    .chat-input textarea {
        padding: 10px 14px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }
    .page-header h1 {
        font-size: 18px;
    }
    .card {
        padding: 12px;
        border-radius: var(--radius-sm);
    }
    .stat-card {
        padding: 14px;
    }
    .stat-value {
        font-size: 24px;
    }

    /* Chat input area — bigger buttons on mobile */
    .chat-mode-selector {
        gap: 4px;
    }
    .mode-btn {
        font-size: 13px;
        padding: 8px 14px;
    }
    .chat-send-btn {
        width: 48px !important;
        height: 48px !important;
        font-size: 18px !important;
        min-width: 48px;
    }
    .chat-voice-btn {
        width: 48px !important;
        height: 48px !important;
        font-size: 20px !important;
        min-width: 48px;
    }
    .chat-attach-btn {
        width: 48px !important;
        height: 48px !important;
        font-size: 22px !important;
        min-width: 48px;
    }

    /* Bigger buttons everywhere on mobile */
    button[type="submit"],
    .btn-primary,
    .btn-complete {
        padding: 14px 24px !important;
        font-size: 15px !important;
        min-height: 48px;
    }

    .btn-secondary {
        padding: 10px 18px !important;
        font-size: 13px !important;
        min-height: 40px;
    }

    .btn-sm {
        padding: 8px 16px !important;
        font-size: 13px !important;
        min-height: 36px !important;
    }

    /* Task modal — scrollable on small screens */
    .modal {
        padding: 10px;
    }
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-actions-wrap {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .modal-actions-wrap button {
        min-height: 44px;
        font-size: 14px !important;
    }

    /* Swipe actions: no hover reveal on mobile, use touch swipe */
    .task-item:hover .task-item-content {
        transform: none;
    }

    .task-item.swiped .task-item-content {
        transform: translateX(-140px);
    }

    .task-check-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 14px;
        left: 12px;
    }

    /* Tools tabs bigger on mobile */
    .tools-tab {
        padding: 12px 18px;
        font-size: 14px;
        white-space: nowrap;
    }

    .tool-textarea {
        min-height: 120px;
        font-size: 16px;
    }

    .tool-upload-area {
        padding: 20px;
    }

    /* Toggle completed btn */
    #toggle-completed-btn {
        padding: 12px 20px !important;
        font-size: 14px !important;
    }

    /* Form elements bigger */
    input, textarea, select {
        padding: 14px 16px;
        font-size: 16px;
    }

    /* Preview thumbs bigger on mobile */
    .preview-thumb {
        width: 70px;
        height: 70px;
    }

    /* Form row fully stacked */
    .form-row {
        flex-direction: column;
    }
    .form-row select, .form-row button {
        width: 100%;
        flex: none;
    }
}

/* ============================================
   PAGE LOADER — orbital spinner
   ============================================ */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.page-loader.active {
    opacity: 1;
    pointer-events: auto;
}

.loader-orb {
    position: relative;
    width: 60px;
    height: 60px;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
}

.loader-ring:nth-child(1) {
    border-top-color: var(--accent);
    animation: loaderSpin 1s ease-in-out infinite;
}

.loader-ring:nth-child(2) {
    inset: 6px;
    border-right-color: var(--accent-light);
    animation: loaderSpin 1.2s ease-in-out infinite reverse;
}

.loader-ring:nth-child(3) {
    inset: 12px;
    border-bottom-color: var(--success);
    animation: loaderSpin 0.8s ease-in-out infinite;
}

.loader-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent), 0 0 24px rgba(78, 205, 196, 0.3);
    animation: loaderPulse 1s ease-in-out infinite;
}

@keyframes loaderSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loaderPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
}

/* ============================================
   PAGE TRANSITIONS — smooth fade
   ============================================ */

.content {
    animation: pageEnter 0.4s ease-out both;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards stagger in */
.card {
    animation: cardEnter 0.4s ease-out both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stat cards: scale up */
.stat-card {
    animation: statPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes statPop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Burger menu link animation */
@media (max-width: 768px) {
    .burger-menu.open .burger-link {
        animation: burgerLinkIn 0.35s ease-out both;
    }
    .burger-menu.open .burger-link:nth-child(1) { animation-delay: 0.05s; }
    .burger-menu.open .burger-link:nth-child(2) { animation-delay: 0.08s; }
    .burger-menu.open .burger-link:nth-child(3) { animation-delay: 0.11s; }
    .burger-menu.open .burger-link:nth-child(4) { animation-delay: 0.14s; }
    .burger-menu.open .burger-link:nth-child(5) { animation-delay: 0.17s; }
    .burger-menu.open .burger-link:nth-child(6) { animation-delay: 0.20s; }
    .burger-menu.open .burger-link:nth-child(7) { animation-delay: 0.23s; }
    .burger-menu.open .burger-link:nth-child(8) { animation-delay: 0.26s; }

    @keyframes burgerLinkIn {
        from {
            opacity: 0;
            transform: translateX(20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

/* ============================================
   ENHANCED ANIMATIONS & POLISH
   Added: smooth motion, micro-interactions,
   and refined visual feedback
   ============================================ */

/* --- 1. Page Load Animations --- */

/* Sidebar slides in from left */
@keyframes sidebarSlideIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar {
    animation: sidebarSlideIn 0.5s var(--ease-out-expo) forwards;
}

/* Content area: enhanced fade-in + slide-up */
@keyframes contentEnter {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content {
    animation: contentEnter 0.6s var(--ease-out-expo) 0.15s both;
}

/* Staggered card entrance */
@keyframes cardStaggerIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card:nth-child(1) { animation: cardStaggerIn 0.5s var(--ease-out-expo) 0.1s both; }
.card:nth-child(2) { animation: cardStaggerIn 0.5s var(--ease-out-expo) 0.17s both; }
.card:nth-child(3) { animation: cardStaggerIn 0.5s var(--ease-out-expo) 0.24s both; }
.card:nth-child(4) { animation: cardStaggerIn 0.5s var(--ease-out-expo) 0.31s both; }
.card:nth-child(5) { animation: cardStaggerIn 0.5s var(--ease-out-expo) 0.38s both; }
.card:nth-child(6) { animation: cardStaggerIn 0.5s var(--ease-out-expo) 0.45s both; }

/* --- 2. Card Hover Effects --- */

.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(78, 205, 196, 0.08);
}

/* Animated border glow on card hover */
.card:hover::before {
    opacity: 0.25;
    transition: opacity 0.3s ease;
}

/* Stat card hover lift + glow */
.stat-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(78, 205, 196, 0.06);
}

/* --- 3. Chat Message Animations --- */

/* User messages slide from right */
@keyframes msgSlideFromRight {
    from {
        opacity: 0;
        transform: translateX(24px) translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

/* Assistant messages slide from left */
@keyframes msgSlideFromLeft {
    from {
        opacity: 0;
        transform: translateX(-24px) translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

.chat-message.user {
    animation: msgSlideFromRight 0.35s var(--ease-out-expo) forwards;
    will-change: transform, opacity;
}

.chat-message.assistant {
    animation: msgSlideFromLeft 0.35s var(--ease-out-expo) forwards;
    will-change: transform, opacity;
}

/* Smoother typing indicator bounce */
@keyframes typingBounceSmoother {
    0%, 80%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.35;
    }
    40% {
        transform: translateY(-6px) scale(1.15);
        opacity: 1;
    }
}

.typing-indicator .typing-dot {
    animation: typingBounceSmoother 1.6s ease-in-out infinite;
}

.typing-indicator .typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* --- 4. Task / Goal Item Animations --- */

/* Task completion animation */
@keyframes taskComplete {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.97);
        opacity: 0.7;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.5;
    }
}

.task-item.completing {
    animation: taskComplete 0.4s var(--ease-out-expo) forwards;
}

/* OKR card staggered entrance */
.okr-card:nth-child(1) { animation-delay: 0.05s; }
.okr-card:nth-child(2) { animation-delay: 0.10s; }
.okr-card:nth-child(3) { animation-delay: 0.15s; }
.okr-card:nth-child(4) { animation-delay: 0.20s; }
.okr-card:nth-child(5) { animation-delay: 0.25s; }
.okr-card:nth-child(6) { animation-delay: 0.30s; }
.okr-card:nth-child(7) { animation-delay: 0.35s; }
.okr-card:nth-child(8) { animation-delay: 0.40s; }

/* Priority dot pulse for high priority */
@keyframes priorityPulse {
    0%, 100% {
        box-shadow: 0 0 4px var(--danger-glow);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 10px rgba(255, 69, 58, 0.5);
        transform: scale(1.2);
    }
}

.priority.priority-high {
    animation: priorityPulse 2.5s ease-in-out infinite;
}

/* --- 5. Button Animations --- */

/* Subtle lift on hover for all buttons */
button:hover,
.btn-secondary:hover,
.btn-complete:hover,
.btn-delete:hover,
.btn-ai-polish:hover,
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Press down on click */
button:active,
.btn-secondary:active,
.btn-complete:active,
.btn-delete:active,
.btn-ai-polish:active,
.btn-danger:active {
    transform: translateY(0px) scale(0.97);
    transition: transform 0.1s ease;
}

/* Send button glow pulse when in stop state */
@keyframes sendStopPulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(255, 69, 58, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 69, 58, 0.4);
    }
}

.chat-send-btn.is-stop {
    animation: sendStopPulse 1.5s ease-in-out infinite;
}

/* Ripple effect for buttons */
@keyframes btnRipple {
    from {
        transform: scale(0);
        opacity: 0.4;
    }
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}

button {
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
}

button:active::before {
    animation: btnRipple 0.5s ease-out;
}

/* --- 6. Sidebar Improvements --- */

/* Active nav item - animated accent bar */
@keyframes accentBarSlide {
    from {
        height: 0;
        opacity: 0;
    }
    to {
        height: 50%;
        opacity: 1;
    }
}

.nav-links a.active::before {
    animation: accentBarSlide 0.3s var(--ease-out-expo) forwards;
}

/* Nav link hover - smooth background */
.nav-links a {
    position: relative;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(2px);
}

.nav-links a.active:hover {
    transform: translateX(0);
}

/* Logo breathing glow */
@keyframes logoBreathing {
    0%, 100% {
        filter: drop-shadow(0 0 0px transparent);
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(78, 205, 196, 0.25));
    }
}

.logo-icon {
    animation: logoBreathing 4s ease-in-out infinite;
}

/* --- 7. Modal Animations (enhanced) --- */

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal animation overrides consolidated into main rules and .modal-entering/.modal-leaving */

/* --- 8. Scrollbar Styling (enhanced) --- */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(78, 205, 196, 0.15);
    border-radius: 3px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(78, 205, 196, 0.3);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(78, 205, 196, 0.15) rgba(255, 255, 255, 0.02);
}

/* --- 9. Micro-Interactions --- */

/* Input focus - glowing border animation */
@keyframes focusGlow {
    0% {
        box-shadow: 0 0 0 2px rgba(78, 205, 196, 0);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.12), 0 0 16px rgba(78, 205, 196, 0.06);
    }
}

input:focus,
textarea:focus,
select:focus {
    animation: focusGlow 0.3s ease forwards;
    border-color: rgba(78, 205, 196, 0.3);
    outline: none;
}

/* Status indicator enhanced pulse */
@keyframes statusPulseEnhanced {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 0;
        transform: scale(2.2);
    }
    100% {
        opacity: 0;
        transform: scale(2.2);
    }
}

.status-indicator.online::after {
    animation: statusPulseEnhanced 2.5s ease-in-out infinite;
}

/* Badge hover scale */
.badge {
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}

.badge:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Notification dot pulse */
@keyframes notifPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.notification-dot {
    animation: notifPulse 2s ease-in-out infinite;
}

/* Project grid card hover refinement */
.project-grid-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(78, 205, 196, 0.1);
}

/* OKR stat card hover — defined in main OKR section */

/* Memory / Knowledge item hover */
.memory-item,
.knowledge-item {
    transition: all 0.3s var(--ease-out-expo);
}

.memory-item:hover,
.knowledge-item:hover {
    transform: translateX(3px);
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--glass-border-hover);
}

/* OKR card action hover */

/* Task action buttons fade-in with slight slide */
@keyframes taskActionsFadeIn {
    from {
        opacity: 0;
        transform: translateX(4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* task-actions replaced by swipe reveal */

.okr-card:hover .okr-card-actions {
    animation: taskActionsFadeIn 0.2s ease forwards;
}

/* --- Modal enter/leave animations (JS-driven) --- */

.modal.modal-entering {
    animation: backdropFadeIn 0.25s ease forwards;
}

.modal.modal-entering .modal-content {
    animation: modalScaleIn 0.35s var(--ease-out-expo) forwards;
}

@keyframes modalScaleOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
}

@keyframes backdropFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.modal.modal-leaving {
    animation: backdropFadeOut 0.25s ease forwards;
}

.modal.modal-leaving .modal-content {
    animation: modalScaleOut 0.3s var(--ease-out-expo) forwards;
}

/* --- Task/Goal item entrance (JS-driven stagger) --- */

@keyframes taskItemEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-item-enter {
    animation: taskItemEnter 0.35s var(--ease-out-expo) both;
}

/* okr-card-enter defined in main OKR section */

/* --- Button click feedback --- */

.btn-clicked {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease !important;
}

/* ============================================
   IMAGE UPLOAD / GENERATION UI
   ============================================ */

/* --- Slide-down animation --- */

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        max-height: 200px;
        transform: translateY(0);
    }
}

/* --- Image preview area (above chat input) --- */

.image-preview {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 10px;
    animation: slideDown 0.3s ease forwards;
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.image-preview img {
    max-height: 150px;
    max-width: 100%;
    object-fit: contain;
    border-radius: calc(var(--radius) - 4px);
    display: block;
}

/* --- Remove image button (X on preview) --- */

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text-mid);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.remove-image-btn:hover {
    background: var(--danger-glow);
    color: var(--danger);
    border-color: rgba(255, 69, 58, 0.3);
    transform: scale(1.1);
}

/* --- Chat mode selector (row of toggle buttons) --- */

.chat-mode-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.mode-btn {
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-mid);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1.4;
}

.mode-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    color: var(--text-high);
}

.mode-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow), 0 0 4px var(--accent-glow);
}

.mode-btn.active:hover {
    background: var(--accent-glow-strong);
}

/* --- Attach button (inside form, next to textarea) --- */

.chat-attach-btn {
    flex-shrink: 0;
    height: 44px;
    width: 44px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-mid);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.chat-attach-btn:hover {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    color: var(--text-high);
}

.chat-attach-btn:active {
    transform: scale(0.95);
}

/* --- Image in chat messages --- */

.chat-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
    display: block;
    cursor: pointer;
    transition: all 0.2s ease;
    object-fit: contain;
}

.chat-image:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    transform: scale(1.01);
}

/* --- Video in chat messages --- */

.chat-video {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
    display: block;
}

.chat-video-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

/* --- Reduce motion for accessibility --- */
/* ── Tools Page ── */

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

.tools-tab {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-mid);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.tools-tab:hover {
    border-color: var(--accent);
    color: var(--text-main);
}

.tools-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.tool-panel {
    display: none;
}

.tool-panel.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.tool-textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.tool-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.tool-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tool-result {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    animation: fadeIn 0.3s ease;
}

.tool-result.hidden {
    display: none;
}

.tool-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.tool-result-actions {
    display: flex;
    gap: 6px;
}

.tool-result-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    margin: 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

/* ============================================
   TASK INLINE CHECKMARK & DELETE BUTTONS
   ============================================ */

.task-check-btn {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--text-low);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.task-check-btn:hover {
    border-color: var(--success);
    color: var(--success);
    background: var(--success-glow);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.3);
}

.task-del-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-low);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.task-del-btn:hover {
    border-color: rgba(255, 69, 58, 0.3);
    color: var(--danger);
    background: var(--danger-glow);
}

/* ============================================
   MULTI-IMAGE PREVIEW GRID
   ============================================ */

.preview-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
}

.preview-thumb-remove:hover {
    background: var(--danger);
    transform: scale(1.1);
}

/* ============================================
   TOOL IMAGE GENERATION
   ============================================ */

.upload-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px;
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.tool-upload-area:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.tool-upload-area-compact {
    padding: 16px;
    gap: 4px;
}

.tool-upload-area-compact .upload-icon {
    font-size: 22px;
}

.imagegen-uploads {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.imagegen-upload-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.imagegen-upload-section .tool-upload-area {
    margin-bottom: 0;
}

.imagegen-section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 480px) {
    .imagegen-uploads {
        grid-template-columns: 1fr;
    }
}

.appearance-section {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.appearance-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
    list-style: none;
}

.appearance-summary::-webkit-details-marker { display: none; }
.appearance-summary::before {
    content: '>';
    font-size: 11px;
    transition: transform 0.2s;
    color: var(--text-low);
}
details.appearance-section[open] .appearance-summary::before {
    transform: rotate(90deg);
}

.appearance-summary:hover {
    background: rgba(255, 255, 255, 0.04);
}

.appearance-body {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.appearance-hint {
    font-size: 12px;
    color: var(--text-low);
    margin: 8px 0 0;
}

.appearance-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-mid);
}

.appearance-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    flex-shrink: 0;
}

#learn-appearance-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.learn-hint {
    font-size: 12px;
    color: var(--text-low);
}

.avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.avatar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.avatar-ready-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #4caf50;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.avatar-image {
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius);
    object-fit: contain;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.avatar-image:hover {
    transform: scale(1.02);
}

.avatar-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.btn-regenerate-avatar {
    font-size: 12px;
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-mid);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-regenerate-avatar:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

.upload-icon {
    font-size: 28px;
}

.upload-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-high);
}

.upload-hint {
    font-size: 12px;
    color: var(--text-low);
}

.tool-images-preview {
    position: relative;
    padding: 10px;
    margin-bottom: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

.tool-generated-image {
    max-width: 100%;
    border-radius: var(--radius);
    margin-top: 8px;
    border: 1px solid var(--glass-border);
}

.tool-image-caption {
    color: var(--text-mid);
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.5;
}

.tool-result-image {
    text-align: center;
}

/* ============================================
   EDITABLE TOOL RESULTS
   ============================================ */

.tool-result-editable {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-high);
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease;
}

.tool-result-editable:focus {
    border-color: rgba(78, 205, 196, 0.3);
    outline: none;
}

.tool-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* ============================================
   SEARCH TOOL
   ============================================ */

.search-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input-wrap .tool-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm, 8px);
    color: var(--text-high);
    font-size: 14px;
}

.search-input-wrap .tool-input:focus {
    border-color: rgba(78, 205, 196, 0.3);
    outline: none;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-result-card {
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    transition: border-color 0.2s;
}

.search-result-card:hover {
    border-color: rgba(78, 205, 196, 0.2);
}

.search-result-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.search-result-title a {
    color: var(--accent);
    text-decoration: none;
}

.search-result-title a:hover {
    text-decoration: underline;
}

.search-result-content {
    font-size: 13px;
    color: var(--text-mid);
    line-height: 1.5;
}

.search-result-url {
    font-size: 11px;
    color: var(--text-low);
    margin-top: 6px;
    word-break: break-all;
}

/* ============================================
   BIGGER BUTTONS (btn-lg)
   ============================================ */

.btn-lg {
    padding: 14px 28px !important;
    font-size: 15px !important;
    min-height: 48px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
}

/* ============================================
   CHAT SEND BUTTON — Arrow icon
   ============================================ */

.chat-send-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px var(--accent-glow-strong);
}

/* Voice btn inside form — inline with textarea and send */
.chat-input .chat-voice-btn {
    flex-shrink: 0;
}

/* chat-controls-row styled in chat section above */

/* ============================================
   TOOL RESULT TEXT OVERFLOW FIX
   ============================================ */

.tool-result-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* ============================================
   FAB (Floating Action Button)
   ============================================ */

.fab-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(78, 205, 196, 0.3);
    transition: all 0.3s var(--ease-spring);
    z-index: 90;
}

.fab-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(78, 205, 196, 0.4);
}

.fab-btn.fab-active {
    transform: rotate(45deg);
    background: var(--bg-elevated-2);
    color: var(--text-high);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.fab-btn.fab-active svg {
    stroke: var(--text-high);
}

@media (max-width: 768px) {
    .fab-btn {
        bottom: 80px;
        right: 16px;
        width: 50px;
        height: 50px;
    }
}

/* ============================================
   MOBILE DESIGN FIXES — Comprehensive
   ============================================ */

@media (max-width: 768px) {
    /* --- Task list compact layout --- */
    .task-item-content {
        gap: 10px;
        padding: 14px 14px 14px 48px;
    }

    .task-details {
        gap: 4px;
    }

    .task-title {
        font-size: 13.5px;
        white-space: normal;
    }

    .task-desc {
        font-size: 11px;
    }

    /* Priority dot properly sized */
    .priority {
        width: 8px;
        height: 8px;
        min-width: 8px;
    }

    /* Project badge: fit-content, not full width */
    .badge,
    .badge-project,
    .badge-project-colored {
        max-width: fit-content;
        display: inline-block;
        font-size: 10px;
        padding: 2px 8px;
    }

    /* Task check button properly sized */
    .task-check-btn {
        left: 12px;
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 13px;
    }

    /* Swipe actions: better touch handling */
    .task-item-actions .action-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .task-item.swiped .task-item-content {
        transform: translateX(-80px);
    }

    /* --- Chat input area fixes --- */
    /* Bottom nav is 68px + safe-area; content has 16px padding top + bottom nav clearance */
    .chat-fullpage {
        height: calc(100vh - 84px);
    }

    .chat-container-full {
        height: calc(100vh - 84px);
    }

    .chat-input-wrapper {
        margin-top: 8px;
    }

    .chat-input {
        gap: 6px;
        align-items: flex-end;
    }

    .chat-input textarea {
        padding: 10px 14px;
        font-size: 16px;
        min-height: 44px;
        border-radius: var(--radius-sm);
    }

    /* Buttons in a row, properly spaced */
    .chat-send-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 16px;
        flex-shrink: 0;
    }

    .chat-voice-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 18px;
        flex-shrink: 0;
    }

    .chat-attach-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 18px;
        flex-shrink: 0;
    }

    /* Mode toggle compact */
    .chat-mode-selector {
        gap: 4px;
        margin-bottom: 6px;
    }

    .mode-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Chat message width on mobile */
    .chat-message {
        max-width: 88%;
        font-size: 13px;
        padding: 10px 14px;
    }

    /* --- Tools page fixes --- */
    .imagegen-uploads {
        grid-template-columns: 1fr;
    }

    .tool-upload-area {
        padding: 16px;
    }

    .tool-upload-area-compact {
        padding: 14px;
    }

    /* Tool result image fits screen */
    .tool-result-image {
        text-align: center;
    }

    .tool-result-image img {
        max-width: 100%;
        height: auto;
        border-radius: var(--radius-sm);
    }

    /* Tool buttons full width */
    .tool-actions {
        flex-direction: column;
    }

    .tool-actions button {
        width: 100%;
    }

    .tool-result-actions {
        flex-wrap: wrap;
        gap: 4px;
    }

    .tool-edit-actions {
        flex-direction: column;
    }

    .tool-edit-actions button {
        width: 100%;
    }

    /* Search input stacked on smaller screens */
    .search-input-wrap {
        flex-direction: column;
    }

    .search-input-wrap .tool-input {
        width: 100%;
    }

    .search-input-wrap button {
        width: 100%;
    }

    /* --- General spacing fixes --- */
    /* Ensure content doesn't hide behind bottom nav */
    .content {
        padding-bottom: 90px;
    }

    /* Chat page: prevent content scroll that hides the input area */
    .content:has(.chat-fullpage) {
        padding-bottom: 0;
        overflow: hidden;
    }

    /* Cards proper margins */
    .card {
        margin-bottom: 12px;
    }

    /* Modal full width on mobile */
    .modal-content {
        max-width: calc(100vw - 20px);
    }

    /* Image preview grid on mobile */
    .preview-images-grid {
        gap: 6px;
    }

    .preview-thumb {
        width: 60px;
        height: 60px;
    }

    /* Learn appearance wrap: stack on mobile */
    #learn-appearance-wrap {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Avatar image full width */
    .avatar-image {
        max-width: 100%;
    }

    /* --- Task edit modal mobile fixes --- */
    .task-detail-content {
        padding: 20px;
        width: 100%;
        max-width: 100%;
    }

    #detail-edit-mode h2 {
        font-size: 17px;
        margin-bottom: 12px;
    }

    #detail-edit-mode .form-inline {
        gap: 10px;
    }

    /* Stack project & priority selects vertically */
    #edit-task-form .form-row {
        flex-direction: column;
        gap: 8px;
    }

    #edit-task-form .form-row > div {
        width: 100%;
    }

    #edit-task-form .form-row select,
    #edit-task-form .form-row input,
    #edit-task-form .form-row button {
        width: 100%;
        box-sizing: border-box;
    }

    /* Full-width inputs and textareas in edit form */
    #edit-task-form input[type="text"],
    #edit-task-form textarea,
    #edit-task-form input[type="date"],
    #edit-task-form select {
        width: 100%;
        box-sizing: border-box;
    }

    /* Subtasks section */
    #edit-subtasks-section {
        margin-top: 8px;
    }

    #edit-subtasks-list {
        margin: 0;
        padding: 0;
    }

    #edit-subtasks-list li {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 0;
        border-bottom: 1px solid var(--glass-border);
        font-size: 14px;
    }

    #edit-subtasks-list li:last-child {
        border-bottom: none;
    }

    /* New subtask input row */
    #edit-subtasks-section .form-row {
        flex-direction: row;
        gap: 8px;
    }

    #edit-subtasks-section .form-row input {
        flex: 1;
        min-width: 0;
    }

    #edit-subtasks-section .form-row button {
        flex: 0 0 auto;
        width: auto;
        min-width: 44px;
        min-height: 44px;
    }

    /* Edit modal actions */
    #edit-task-form .modal-actions {
        flex-direction: column;
        gap: 8px;
        margin-top: 12px;
    }

    #edit-task-form .modal-actions button {
        width: 100%;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    /* Even more compact on very small screens */
    .task-item-content {
        gap: 8px;
        padding: 12px 12px 12px 46px;
    }

    .task-title {
        font-size: 13px;
    }

    .task-check-btn {
        left: 10px;
        width: 26px;
        height: 26px;
        min-width: 26px;
        font-size: 12px;
    }

    /* Chat input: tighter */
    .chat-input {
        gap: 4px;
    }

    .chat-send-btn,
    .chat-voice-btn,
    .chat-attach-btn {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
    }

    .chat-message {
        max-width: 92%;
    }

    /* Tools: tabs scroll horizontally */
    .tools-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        gap: 6px;
    }

    .tools-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Search results full width */
    .search-results {
        gap: 8px;
    }

    /* Tool result header stack on very small screens */
    .tool-result-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    /* Task edit modal: even tighter on very small screens */
    .task-detail-content {
        padding: 16px;
    }

    #detail-edit-mode h2 {
        font-size: 16px;
    }

    .modal {
        padding: 6px;
    }

    .modal-content {
        max-width: calc(100vw - 12px);
        padding: 16px;
    }

    #edit-task-form label {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   NOTES PAGE
   ============================================ */

.notes-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    backdrop-filter: var(--glass-blur);
}

.notes-search-bar svg {
    color: var(--text-low);
    flex-shrink: 0;
}

.notes-search-bar input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-high);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.notes-search-bar input::placeholder {
    color: var(--text-low);
}

/* Note cards list */
.note-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out-expo);
    backdrop-filter: var(--glass-blur);
}

.note-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card-hover);
}

.note-card.note-pinned {
    border-left: 3px solid var(--accent);
}

.note-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.note-pin-icon {
    font-size: 12px;
    flex-shrink: 0;
}

.note-card-title {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-high);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card-date {
    font-size: 12px;
    color: var(--text-low);
    flex-shrink: 0;
}

.note-card-preview {
    font-size: 13px;
    color: var(--text-mid);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.note-card-tag {
    font-size: 11px;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-weight: 500;
}

/* Empty state */
.notes-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-low);
}

.notes-empty-icon {
    margin-bottom: 16px;
    opacity: 0.3;
}

.notes-empty p {
    font-size: 16px;
    margin-bottom: 4px;
}

.notes-empty-hint {
    font-size: 13px;
    color: var(--text-ghost);
}

/* Note editor modal */
.note-editor-content {
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.note-editor-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 20px 0;
}

.note-title-field {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-high);
    font-size: 20px;
    font-weight: 700;
    font-family: inherit;
    outline: none;
    padding: 0;
}

.note-title-field::placeholder {
    color: var(--text-ghost);
}

.note-editor-actions-top {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.note-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-low);
    cursor: pointer;
    transition: all 0.15s;
}

.note-icon-btn:hover {
    background: var(--bg-elevated-2);
    color: var(--text-high);
}

.note-icon-btn.active {
    color: var(--accent);
    background: var(--accent-glow);
}

/* Editor body */
.note-editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 20px;
    min-height: 0;
    overflow-y: auto;
}

.note-editor-body textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-high);
    font-size: 14px;
    line-height: 1.7;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 200px;
    padding: 0;
}

.note-editor-body textarea::placeholder {
    color: var(--text-ghost);
}

/* Toolbar inside editor */
.note-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
    margin-top: 12px;
}

.note-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--bg-elevated);
    color: var(--text-mid);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.note-toolbar-btn:hover {
    background: var(--bg-elevated-2);
    color: var(--text-high);
    border-color: var(--glass-border-hover);
}

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

/* Mic button special styles */
.note-mic-btn {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.note-mic-btn:hover {
    background: var(--accent-glow-strong);
    color: var(--accent-light);
}

.note-mic-btn.recording {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    animation: mic-pulse 1.5s infinite;
}

.note-mic-btn.transcribing {
    opacity: 0.7;
    cursor: wait;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 69, 58, 0); }
}

.note-mic-label {
    font-size: 13px;
}

.note-mic-status {
    font-size: 12px;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.note-mic-status.active {
    opacity: 1;
}

.note-toolbar-spacer {
    flex: 1;
}

/* Footer with tags and actions */
.note-editor-footer {
    padding: 12px 20px 20px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-tags-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.note-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.note-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-weight: 500;
}

.note-tag button {
    background: none;
    border: none;
    color: var(--text-low);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
    margin-left: 2px;
}

.note-tag button:hover {
    color: var(--danger);
}

.note-tag-input {
    background: none;
    border: none;
    color: var(--text-high);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    width: 120px;
    padding: 3px 0;
}

.note-tag-input::placeholder {
    color: var(--text-ghost);
}

.note-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-save-note {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent-gradient);
    color: #000;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save-note:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow-strong);
}

.btn-save-note:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Spinner for polish button */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--text-ghost);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Due date badges */
.badge-due-date {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(255, 217, 61, 0.15);
    color: #FFD93D;
    margin-left: 6px;
    white-space: nowrap;
}

.badge-due-date.overdue {
    background: rgba(255, 107, 107, 0.15);
    color: #FF6B6B;
    animation: pulse-overdue 2s infinite;
}

@keyframes pulse-overdue {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.task-detail-deadline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 217, 61, 0.08);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #FFD93D;
}

.task-detail-deadline.overdue {
    background: rgba(255, 107, 107, 0.08);
    color: #FF6B6B;
}

/* Subtask progress inline */
.task-subtask-count {
    font-size: 11px;
    color: var(--text-low);
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-subtask-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    width: 40px;
    overflow: hidden;
}

.task-subtask-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ===== CALENDAR ===== */
.calendar-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.calendar-header h2 {
    min-width: 180px;
    text-align: center;
    font-size: 1.3rem;
    text-transform: capitalize;
    margin: 0;
}

.calendar-nav-btn {
    background: var(--bg-elevated, #141416);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
    color: var(--text-high, rgba(255,255,255,0.92));
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.calendar-nav-btn:hover {
    background: var(--bg-elevated-2, #1e1e22);
}

.calendar-today-btn {
    background: var(--accent, #4ECDC4);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.calendar-today-btn:hover {
    opacity: 0.85;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-mid, rgba(255,255,255,0.50));
    margin-bottom: 8px;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.calendar-day {
    min-height: 80px;
    background: var(--bg-elevated, #141416);
    border-radius: 10px;
    padding: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
    border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
}

.calendar-day:hover {
    background: var(--bg-elevated-2, #1e1e22);
    border-color: rgba(255,255,255,0.12);
}

.calendar-day.today {
    border-color: var(--accent, #4ECDC4);
    background: rgba(78, 205, 196, 0.10);
}

.calendar-day.other-month {
    opacity: 0.25;
    border-color: transparent;
}

.calendar-day.selected {
    border-color: var(--accent, #4ECDC4);
    background: rgba(78, 205, 196, 0.15);
}

.calendar-day-number {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-high, rgba(255,255,255,0.92));
    margin-bottom: 4px;
}

.calendar-day.today .calendar-day-number {
    color: var(--accent, #4ECDC4);
    font-size: 0.95rem;
}

.calendar-day-tasks {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-task-dot {
    height: 6px;
    border-radius: 3px;
    font-size: 0;
    overflow: hidden;
    display: none;
}

.calendar-task-pill {
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    line-height: 1.4;
}

/* Day detail panel */
.calendar-day-detail {
    margin-top: 16px;
    background: var(--bg-elevated, #141416);
    border-radius: 14px;
    padding: 16px;
    border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
    animation: calSlideDown 0.2s ease;
}

@keyframes calSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.day-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.day-detail-header h3 {
    font-size: 1.1rem;
    color: var(--text-high);
}

.day-detail-header button {
    background: none;
    border: none;
    color: var(--text-mid, #888);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.day-detail-header button:hover {
    background: var(--bg-elevated-2);
}

.day-detail-task {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-surface, #0a0a0a);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.day-detail-task:hover {
    background: var(--bg-elevated-2, #1e1e22);
}

.day-detail-task .priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.day-detail-task .task-info {
    flex: 1;
    min-width: 0;
}

.day-detail-task .task-info .title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-high);
}

.day-detail-task .task-info .meta {
    font-size: 0.75rem;
    color: var(--text-mid, #888);
    margin-top: 2px;
}

/* Unscheduled section */
.calendar-unscheduled {
    margin-top: 24px;
}

.calendar-unscheduled h3 {
    font-size: 0.95rem;
    color: var(--text-mid, #888);
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s;
}

.calendar-unscheduled h3:hover {
    color: var(--text-high);
}

#unscheduled-count {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .calendar-container {
        padding: 10px;
    }

    .calendar-header {
        gap: 8px;
    }

    .calendar-header h2 {
        font-size: 1.15rem;
        min-width: auto;
        flex: 1;
    }

    .calendar-nav-btn {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        flex-shrink: 0;
    }

    .calendar-today-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .calendar-weekdays {
        font-size: 0.72rem;
        margin-bottom: 4px;
    }

    .calendar-grid {
        gap: 2px;
    }

    .calendar-day {
        min-height: 48px;
        padding: 4px;
        border-radius: 8px;
    }

    .calendar-day-number {
        font-size: 0.8rem;
        font-weight: 700;
    }

    .calendar-task-pill {
        display: none;
    }

    .calendar-task-dot {
        display: block;
        height: 4px;
        margin-top: 1px;
    }
}
