/* components.css — Reusable UI widgets */

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.84rem;
    font-weight: 500;
    border-radius: var(--shape-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--dur-med) var(--ease-out);
    user-select: none;
    white-space: nowrap;
    line-height: 1;
}

.btn i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.2s var(--ease);
}

.btn-primary {
    background: color-mix(in srgb, var(--accent-primary) 90%, #ffffff 10%);
    color: #fff;
    border-color: color-mix(in srgb, var(--accent-primary) 50%, transparent);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25), 0 6px 16px var(--accent-primary-glow);
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--accent-primary) 95%, #ffffff 5%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28), 0 8px 20px var(--accent-primary-glow);
}

.btn-primary:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), 0 3px 8px var(--accent-primary-glow);
}

.btn-secondary {
    background: var(--surface-tonal);
    color: var(--text-secondary);
    border-color: var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-highlight);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn-ghost:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
    border-color: rgba(239, 68, 68, 0.25);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.15);
}

.btn-danger:hover {
    background: var(--accent-danger);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--shape-sm);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn-icon:hover {
    background: var(--state-hover);
    color: var(--text-primary);
    border-color: var(--border-highlight);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.72rem;
    border-radius: 999px;
}

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.badge-success {
    background: var(--accent-success-bg);
    color: var(--accent-success);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.badge-warning {
    background: var(--accent-warning-bg);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-danger {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-info {
    background: var(--accent-info-bg);
    color: var(--accent-info);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.badge-purple {
    background: var(--accent-purple-bg);
    color: var(--accent-purple);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.badge-teal {
    background: var(--accent-teal-bg);
    color: var(--accent-teal);
    border: 1px solid rgba(45, 212, 191, 0.2);
}

.badge-neutral {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    border-radius: var(--shape-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--dur-med) var(--ease-out);
    border: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--surface-tonal-soft), var(--surface-tonal));
    position: relative;
    z-index: 1;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0.5;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3), 0 6px 12px rgba(0, 0, 0, 0.18);
    border-color: var(--border-highlight);
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-tonal) 84%, var(--accent-primary) 16%), var(--surface-tonal));
    z-index: 2;
}

.card:hover::before {
    opacity: 1;
    background: linear-gradient(180deg, var(--accent-primary-glow), transparent);
}

.card-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.card-body {
    padding: 16px 20px 20px;
    flex: 1;
}

/* Color accent strip for card */
.card-accent-left {
    position: relative;
    overflow: hidden;
}

.card-accent-left::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

/* ── Form Controls ──────────────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.form-input,
.form-select,
.form-textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--shape-sm);
    padding: 10px 14px;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
    width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.12);
    outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a5a68' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* Touch Targets on Mobile */
@media (max-width: 768px) {
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        min-height: 44px;
        /* Ensure accessible tap target */
    }

    .form-input,
    .form-select {
        padding: 10px 14px;
        font-size: 1rem;
        /* Prevents iOS auto-zoom */
        min-height: 44px;
        /* Ensure accessible tap target */
    }
}

/* ── Progress Bar ───────────────────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-panel);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-teal));
    border-radius: 3px;
    transition: width 0.5s var(--ease);
}

/* ── Task List ──────────────────────────────────────────────────────────────── */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    transition: background var(--dur-fast);
    cursor: pointer;
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-highlight);
}

.task-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-checkbox:hover {
    border-color: var(--accent-primary);
}

.task-checkbox.checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.task-checkbox.checked::after {
    content: '✓';
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

/* Urgent & Overdue Tasks */
.task-urgent {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.05);
}

.task-urgent:hover {
    border-color: var(--accent-warning);
}

.task-urgent .priority-pip {
    box-shadow: 0 0 8px var(--accent-warning);
    animation: pulse 2s infinite ease-in-out;
}

.task-overdue {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
}

.task-overdue:hover {
    border-color: var(--accent-danger);
}

.task-overdue .priority-pip {
    box-shadow: 0 0 8px var(--accent-danger);
    animation: pulse 1s infinite ease-in-out;
}

.task-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.task-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-title.done {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.task-meta i {
    width: 10px;
    height: 10px;
}

/* Priority pip */
.priority-pip {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-alta .priority-pip,
.priority-alta.priority-pip {
    background: var(--accent-danger);
}

.priority-media .priority-pip,
.priority-media.priority-pip {
    background: var(--accent-warning);
}

.priority-baja .priority-pip,
.priority-baja.priority-pip {
    background: var(--text-muted);
}

/* ── Dashboard Grid ─────────────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-3 {
    grid-column: span 3;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }

    .col-span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 850px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .col-span-2,
    .col-span-3 {
        grid-column: span 1;
    }
}

.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 650px) {
    .two-col-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

.empty-state i {
    width: 36px;
    height: 36px;
    opacity: 0.5;
}

.empty-state p {
    max-width: 240px;
    line-height: 1.6;
}

/* ── Cycle Progress Widget ──────────────────────────────────────────────────── */
.cycle-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cycle-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.cycle-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.cycle-days {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.cycle-pct {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-left: auto;
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: var(--blur-sm);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn var(--dur-fast) ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    /* Prevent modal from overflowing screen height on mobile */
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.26);
    animation: modalSlide var(--dur-med) var(--ease-out);
    overflow: hidden;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    /* Allow scrolling inside the modal if content is too long */
    scrollbar-width: thin;
    scrollbar-color: var(--border-highlight) transparent;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Toast ──────────────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 320px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-2);
    animation: toastIn var(--dur-med) var(--ease-out);
    pointer-events: all;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    border-color: rgba(34, 197, 94, 0.3);
}

.toast-success::before {
    content: '✓';
    color: var(--accent-success);
    font-weight: 700;
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
}

.toast-error::before {
    content: '✕';
    color: var(--accent-danger);
    font-weight: 700;
}

.toast-info::before {
    content: 'ℹ';
    color: var(--accent-info);
}

/* ── Search Overlay ─────────────────────────────────────────────────────────── */
#search-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: var(--blur-sm);
    z-index: 300;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    display: none;
}

#search-overlay.open {
    display: flex;
    animation: fadeIn var(--dur-fast) ease;
}

.search-box {
    width: 100%;
    max-width: 560px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.26);
    overflow: hidden;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.search-input-wrap i {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

#search-input {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    background: none;
}

#search-input::placeholder {
    color: var(--text-muted);
}

.search-results {
    max-height: 380px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background var(--dur-fast);
}

.search-result-item:hover {
    background: var(--bg-surface-hover);
}

.search-hint {
    padding: 10px 18px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.search-section-label {
    padding: 6px 18px 3px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-surface-2);
    border-top: 1px solid var(--border-color);
}

/* ── Project Cards ──────────────────────────────────────────────────────────── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.project-card {
    border-radius: var(--shape-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 18px 20px;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--project-color, var(--accent-primary));
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-highlight);
}

.project-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.project-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--shape-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--project-color, var(--accent-primary));
    flex-shrink: 0;
}

.project-icon i {
    width: 18px;
    height: 18px;
}

.project-card-name {
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.project-card-goal {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.badge-success {
    animation: pulse 4s infinite ease-in-out;
}

.progress-fill {
    transition: width 0.8s var(--ease-out);
}

.project-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* ── Kanban Board ───────────────────────────────────────────────────────────── */
.board-container {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-highlight) transparent;
    height: calc(100vh - var(--topbar-height) - 120px);
    align-items: flex-start;
}

.board-column {
    flex-shrink: 0;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: var(--shape-lg);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    max-height: 100%;
    overflow: hidden;
}

.board-column-header {
    padding: 12px 14px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.board-column-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-column-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-surface-hover);
    border-radius: 10px;
    padding: 1px 6px;
    font-weight: 600;
}

.board-cards {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-highlight) transparent;
}

.board-cards.drag-over {
    background: rgba(94, 106, 210, 0.06);
}

.kanban-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: grab;
    transition: all var(--dur-fast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.kanban-card:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-card-title {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
}

.kanban-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.kanban-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 3px;
}

.kanban-card-date i {
    width: 10px;
    height: 10px;
}

.kanban-card-date.overdue {
    color: var(--accent-danger);
}

.board-add-btn {
    margin: 4px 8px 8px;
    padding: 7px 10px;
    border-radius: var(--shape-sm);
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all var(--dur-fast);
    border: 1px dashed transparent;
    flex-shrink: 0;
}

.board-add-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.03);
}

.board-add-btn i {
    width: 12px;
    height: 12px;
}

/* ── Calendar ───────────────────────────────────────────────────────────────── */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-dow {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-day {
    min-height: 88px;
    border-radius: var(--shape-sm);
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    transition: background var(--dur-fast);
    font-size: 0.8rem;
}

.calendar-day:hover {
    background: var(--bg-surface-hover);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    border-color: var(--accent-primary);
    background: rgba(94, 106, 210, 0.06);
}

.day-number {
    font-weight: 600;
    font-size: 0.8rem;
    align-self: flex-start;
    line-height: 1;
    margin-bottom: 2px;
}

.today .day-number {
    background: var(--accent-primary);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
}

.day-task-dot {
    font-size: 0.68rem;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    line-height: 1.3;
}

/* ── Backlog / List Table ───────────────────────────────────────────────────── */
.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.list-table td {
    padding: 10px 12px;
    font-size: 0.84rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.list-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ── Filter Bar ─────────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--shape-sm);
    padding: 6px 28px 6px 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%235a5a68' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all var(--dur-fast);
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--border-highlight);
    color: var(--text-primary);
}

/* ── Document Editor ────────────────────────────────────────────────────────── */
.doc-editor {
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.doc-block {
    position: relative;
    margin-bottom: 4px;
}

.doc-block-heading {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 10px 0 4px;
    color: var(--text-primary);
    border: none;
    background: none;
    width: 100%;
}

.doc-block-heading2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding: 10px 0 4px;
    color: var(--text-primary);
    border: none;
    background: none;
    width: 100%;
    margin-top: 12px;
}

.doc-block-paragraph {
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--text-secondary);
    padding: 4px 0;
    border: none;
    background: none;
    width: 100%;
    resize: none;
}

.doc-block-divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
    border: none;
}

.doc-checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 0.875rem;
}

.doc-checklist-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.doc-add-block {
    display: flex;
    gap: 6px;
    padding: 16px 0 0;
    flex-wrap: wrap;
}

.doc-autosave {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur-med);
}

.doc-autosave.visible {
    opacity: 1;
}

/* ── Decisions Table ────────────────────────────────────────────────────────── */
.decisions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.decision-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    transition: all var(--dur-fast);
    cursor: pointer;
}

.decision-card:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-md);
}

.decision-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.decision-title {
    font-size: 0.9rem;
    font-weight: 700;
}

.decision-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}

.decision-body {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 8px 16px;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--dur-fast);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* ── Cycle Detail Card ──────────────────────────────────────────────────────── */
.cycle-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--shape-lg);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all var(--dur-fast);
}

.cycle-card:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-md);
}

.cycle-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.cycle-card-title {
    font-size: 1rem;
    font-weight: 700;
}

.cycle-card-goal {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.cycle-card-dates {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
    align-items: center;
}

.cycles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ── Stat Pill ──────────────────────────────────────────────────────────────── */
.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
}

/* ── Scrollbar global override ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
    border-radius: 3px;
}

/* ── Matrix ────────────────────────────────────────────────────────────────── */
.matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .matrix-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
}

.matrix-quadrant {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--shape-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 200px;
    transition: all 0.2s;
}

.matrix-quadrant:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-md);
}

.quadrant-header {
    display: flex;
    gap: 12px;
    align-items: center;
}

.quadrant-number {
    font-size: 1.5rem;
    font-weight: 800;
    opacity: 0.15;
}

.quadrant-action {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.matrix-task-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.matrix-task-item:hover {
    transform: translateX(4px);
    background: var(--bg-surface-hover);
    border-color: var(--border-highlight);
}

.task-color {
    width: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.task-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.task-project {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ── Writing ────────────────────────────────────────────────────────────────── */
.writing-layout {
    display: flex;
    height: calc(100vh - 120px);
    gap: 20px;
    margin-top: 24px;
}

.writing-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    overflow-y: auto;
}

.writing-editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-radius: var(--shape-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.editor-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
}

.editor-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.editor-title-input {
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 100%;
    outline: none;
}

.word-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.editor-body {
    flex: 1;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.manuscript-textarea {
    width: 100%;
    height: 100%;
    padding: 40px 60px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    resize: none;
    overflow-y: auto;
    outline: none;
    scrollbar-width: thin;
}

.writing-ai-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.ai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}

.ai-msg {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 90%;
    box-shadow: var(--shadow-sm);
}

.ai-msg-system {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.ai-msg-user {
    background: var(--accent-primary-bg);
    color: var(--text-primary);
    border: 1px solid rgba(94, 106, 210, 0.4);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-input-wrap {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}

#ai-chat-input {
    font-size: 0.82rem;
    min-height: 40px;
}


/* ── Integrations Hub ────────────────────────────────────────────────────────── */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.integration-card {
    padding: 24px;
    height: 100%;
}

.integration-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.integration-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
}

.integration-services {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.integration-service-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.integration-service-row:hover {
    border-color: var(--border-highlight);
}



/* ── Mobile/Desktop compatibility placeholders ───────────────────────────── */
.compat-placeholder {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-highlight);
    background: var(--bg-surface-2);
}

.compat-placeholder i {
    width: 18px;
    height: 18px;
    color: var(--accent-warning);
    flex-shrink: 0;
    margin-top: 1px;
}

.compat-placeholder-title {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.compat-placeholder-text {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* ── Calendar & Sessions ─────────────────────────────────────────────────────── */
.session-dot {
    font-weight: 600 !important;
    font-size: 0.65rem !important;
    padding: 2px 6px !important;
    margin-top: 2px;
    border-radius: 999px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-left: 2px solid currentColor;
}

/* ── Security / Lock ─────────────────────────────────────────────────────────── */
.hr-text {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 12px 0;
}

.hr-text::before,
.hr-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.hr-text span {
    padding: 0 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
}

.lock-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.4s ease;
}

.lock-container {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

/* ── Writing History & Versions ────────────────────────────────────────────── */
.writing-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    border: 1px solid var(--border-color);
    transition: all var(--dur-fast);
}

.history-item:hover {
    border-color: var(--border-highlight);
    background: var(--bg-surface-hover) !important;
}

/* ── Project Chat / Discussions ─────────────────────────────────────────────── */
.chat-container {
    height: 500px;
    background: var(--bg-surface);
}

.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--border-highlight) transparent;
}

.msg-me div:last-child {
    border-bottom-right-radius: 2px !important;
}

.msg-other div:last-child {
    border-bottom-left-radius: 2px !important;
}

.chat-msg {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .writing-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 160px);
    }

    .writing-sidebar,
    .writing-ai-sidebar {
        width: 100%;
        max-height: 38vh;
    }

    .manuscript-textarea {
        padding: 20px 16px;
        font-size: 1rem;
    }
}

/* ── Kanban Board ───────────────────────────────────────────────────────────── */
.board-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 0 32px 32px;
    align-items: flex-start;
    scrollbar-width: thin;
    scrollbar-color: var(--border-highlight) transparent;
}

.board-column {
    min-width: 300px;
    max-width: 300px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
}

.board-column-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.01);
    border-bottom: 1px solid var(--border-color);
}

.board-column-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.board-column-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-surface-hover);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: auto;
}

.board-cards {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    min-height: 120px; /* Base drop zone height */
    padding-bottom: 60px; /* Extra generous drop zone padding */
    transition: background var(--dur-fast);
}

.board-cards.drag-over {
    background: rgba(94, 106, 210, 0.08);
    border-radius: var(--radius-md);
}

.kanban-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.kanban-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.kanban-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.kanban-card-date.overdue {
    color: var(--accent-danger);
    font-weight: 600;
}

.board-add-btn {
    padding: 12px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    border-top: 1px solid var(--border-color);
    transition: color 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.board-add-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}


/* ──────────────────────────────────────────────────────────────────────────── */
/* Session Switcher (OPCIÓN 3: Multi-Account Google Login)                     */
/* ──────────────────────────────────────────────────────────────────────────── */

.session-switcher-modal-overlay {
    animation: fadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.session-switcher-panel {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.session-item {
    animation: fadeIn 0.2s ease-out;
}

.session-item:hover {
    transform: translateX(2px);
}

.session-item.active {
    box-shadow: 0 0 0 2px var(--accent-primary);
}

.session-avatar {
    flex-shrink: 0;
    user-select: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .session-switcher-panel {
        width: 95% !important;
        max-width: none;
    }
}

/* Session switcher topbar button */
#btn-session-switcher {
    position: relative;
}

#btn-session-switcher::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--accent-teal);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s;
}

#btn-session-switcher:hover::after {
    opacity: 1;
}

/* Session list scrollbar */
#sessions-list {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#sessions-list::-webkit-scrollbar {
    width: 6px;
}

#sessions-list::-webkit-scrollbar-track {
    background: transparent;
}

#sessions-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#sessions-list::-webkit-scrollbar-thumb:hover {
    background: var(--border-highlight);
}

/* ── Mobile Component Optimizations ──────────────────────────────────────────– */

/* Enhanced mobile input handling */
@media (max-width: 768px) {
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px !important;
        /* Prevent zoom on iOS */
        border-radius: var(--radius-md);
        transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
    }

    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        box-shadow: 0 0 0 3px var(--accent-primary-glow);
    }

    /* Better label visibility on mobile */
    label {
        font-size: 0.95rem;
        font-weight: 500;
    }

    /* Wider input fields on mobile */
    .form-group {
        width: 100%;
    }

    /* Full-width textarea on mobile */
    textarea {
        width: 100%;
        max-width: 100%;
    }
}

/* Mobile-specific button optimizations */
@media (max-width: 768px) {
    .btn {
        transition: all var(--dur-fast) var(--ease-out);
        position: relative;
    }

    .btn:active {
        transform: scale(0.98);
    }

    /* Full-width buttons in modals */
    .modal-actions .btn {
        width: 100%;
    }

    /* Better button spacing on mobile */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .btn-group-horizontal {
        display: flex;
        gap: 8px;
    }
}

/* Improved card layout for mobile */
@media (max-width: 768px) {
    .card,
    .task-card,
    .project-card {
        padding: 14px;
        border-radius: var(--radius-md);
        transition: background var(--dur-fast), border-color var(--dur-fast);
    }

    .card:active {
        background: var(--bg-surface-hover);
    }

    /* Better spacing inside cards */
    .card-header,
    .card-content,
    .card-footer {
        padding: 0;
        margin-bottom: 8px;
    }

    .card-footer {
        margin-bottom: 0;
    }
}

/* Mobile list optimizations */
@media (max-width: 768px) {
    .list-item,
    .table-row {
        padding: 12px 14px;
        min-height: 48px;
    }

    /* Stack columns on very small screens */
    .list-table tbody tr {
        display: flex;
        flex-direction: column;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 8px;
        padding: 12px 0;
    }

    .list-table td {
        padding: 8px 0;
        display: block;
    }

    .list-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 8px;
    }
}

/* Modal improvements for mobile */
@media (max-width: 768px) {
    .modal-content,
    [role="dialog"] {
        max-height: 90vh;
        max-width: 100%;
        margin: 16px;
        border-radius: var(--radius-lg);
    }

    .modal-header {
        padding: 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .modal-body {
        padding: 16px;
        overflow-y: auto;
    }

    .modal-actions {
        padding: 16px;
        border-top: 1px solid var(--border-color);
        display: flex;
        gap: 8px;
        flex-direction: column;
    }
}

/* Better dropdown handling on mobile */
@media (max-width: 768px) {
    .dropdown,
    .select-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 60vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin: 0;
    }

    .dropdown-item {
        padding: 14px 16px;
        min-height: 48px;
    }
}

/* Toast notifications on mobile */
@media (max-width: 768px) {
    #toast-container {
        display: flex;
        flex-direction: column;
        gap: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
        max-width: calc(100% - 16px);
    }

    .toast {
        border-radius: var(--radius-md);
        margin: 0;
        max-width: 100%;
    }
}

/* Search overlay mobile optimization */
@media (max-width: 768px) {
    #search-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2000;
        padding: 0;
    }

    .search-box {
        max-height: 80vh;
        border-radius: 0;
        margin: 0;
        margin-top: 16px;
    }

    .search-input-wrap {
        padding: 12px 14px;
        font-size: 16px;
    }

    .search-results {
        max-height: calc(80vh - 60px);
    }
}

/* Command palette mobile optimization */
@media (max-width: 768px) {
    .command-palette {
        max-width: 100%;
        max-height: 80vh;
        border-radius: 0;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .palette-input {
        font-size: 16px;
        padding: 14px 16px;
    }

    .palette-results {
        max-height: calc(80vh - 80px);
    }
}

/* Better icon spacing on mobile */
@media (max-width: 768px) {
    .icon-button,
    .btn-icon {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-icon [data-feather] {
        width: 22px;
        height: 22px;
    }
}

/* Scrollbar styling for mobile */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 8px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: var(--border-highlight);
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--border-color);
    }
}

/* Prevent pinch-zoom on iOS */
@media (max-width: 768px) {
    html,
    body {
        touch-action: pan-x pan-y;
    }

    input,
    textarea,
    select {
        touch-action: manipulation;
    }
}

/* Better visibility of status indicators on mobile */
@media (max-width: 768px) {
    .status-indicator,
    .status-badge {
        min-width: 12px;
        min-height: 12px;
    }

    .sync-status-dot {
        width: 8px;
        height: 8px;
    }

    .ollama-led {
        width: 8px;
        height: 8px;
    }
}
