:root {
    --primary: #354965;
    --secondary: #71C9C6;
    --accent: #FF4800;
    --bkgd: #ffffff;
    --dark-bkgd: #ffffff;
    --dark-bkgd-2: #f5f5f5;
    --light-link: #FF4800;
    --dark-link: #354965;
    --dark-text: #1a1a1a;
    --light-text: #1a1a1a;
    --primary-rgb: rgba(53, 73, 101, 0.08);
    --accent-rgb: rgba(255, 72, 0, 0.80);
    --light-accent-rgb: rgb(236, 248, 254);
    --dark-rgb: rgba(53, 73, 101, 0.12);
    --dark-rgb-low: rgba(53, 73, 101, 0.15);
    --light-rgb: rgb(255, 255, 255);
    --light-primary-bkgd: #555555;
    --button-radius: 8px;
    --teal: #71C9C6;
    --orange: #FF4800;
    --yellow: #FFDC62;
    --cream: #E6DFCF;
    --navy: #354965;
    --font-heading: 'Josefin Sans', Helvetica, Arial, sans-serif;
    --font-body: 'Open Sans', Arial, sans-serif;
}

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

body {
    font-family: var(--font-body), -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--dark-bkgd);
    color: var(--dark-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header-content,
.tabs,
.tab-content,
.section-content,
.detail-content,
.tasks-view,
.clients-view,
.reviews-view {
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.header {
    background-color: var(--navy);
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(53, 73, 101, 0.3);
    margin-left: 240px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.header-logo {
    width: auto;
    object-fit: contain;
    max-width: 200px;
    padding-top: 8px;
}

.header-separator {
    font-size: 1.5rem;
    color: var(--teal);
    font-weight: 300;
}

.header h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--cream);
    margin: 0;
    flex-grow: 1;
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info-text {
    color: var(--cream);
    font-size: 0.9rem;
}

.user-role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: var(--teal);
    color: var(--navy);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.user-role-badge.admin {
    background-color: var(--orange);
    color: #fff;
}

.user-role-badge.read-only {
    background-color: var(--dark-rgb-low);
    color: var(--light-text);
}

.logout-button {
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--cream);
    border: 1px solid rgba(230, 223, 207, 0.3);
    border-radius: var(--button-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.logout-button:hover {
    background-color: var(--orange);
    border-color: var(--orange);
    color: #fff;
}

.tabs {
    display: flex;
    background-color: #f8f8f8;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    padding: 1rem 2rem;
    cursor: pointer;
    border: none;
    background: none;
    color: #666;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.tab:hover {
    color: var(--navy);
    background-color: rgba(113, 201, 198, 0.1);
}

.tab.active {
    color: var(--orange);
    border-bottom: 3px solid var(--orange);
}

.tab-content {
    display: none !important;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.tab-content.active {
    display: block !important;
}

.tab-content.project-overview.active,
.tab-content.project-detail.active,
.tab-content.client-detail.active {
    display: flex !important;
}

/* Tab 1 - Project Overview */
.project-overview {
    width: 100%;
}

.project-list {
    width: 280px;
    background-color: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
}

.project-list h2 {
    padding: 1rem;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-item {
    padding: 1rem;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.project-item:hover {
    background-color: rgba(113, 201, 198, 0.1);
}

.project-item.selected {
    background-color: rgba(113, 201, 198, 0.15);
    border-left-color: var(--orange);
}

.project-item h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.project-item .project-client {
    font-size: 0.7rem;
    color: var(--orange);
    margin-bottom: 0.25rem;
    opacity: 0.85;
}

.project-item .status {
    font-size: 0.75rem;
    color: var(--light-primary-bkgd);
}

.project-item.all-projects {
    border-bottom: 1px solid #e0e0e0;
    background-color: rgba(53, 73, 101, 0.06);
}

.project-item.all-projects h3 {
    color: var(--orange);
    font-weight: 600;
}

.project-item.all-projects:hover {
    background-color: rgba(53, 73, 101, 0.1);
}

.project-item.all-projects.selected {
    background-color: rgba(53, 73, 101, 0.1);
    border-left-color: var(--orange);
}

.eisenhower-matrix {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1rem;
    padding: 1rem;
    align-content: start;
}

.quadrant {
    background-color: #f9f9f9;
    padding: 1rem;
    overflow-y: auto;
    border-radius: 15px;
    min-height: 0;
    height: 500px;
    border: 1px solid #e8e8e8;
}

/* Subtle narrow scrollbar for Eisenhower matrix quadrants */
.quadrant::-webkit-scrollbar {
    width: 6px;
}

.quadrant::-webkit-scrollbar-track {
    background: transparent;
}

.quadrant::-webkit-scrollbar-thumb {
    background-color: rgba(53, 73, 101, 0.2);
    border-radius: 3px;
}

.quadrant::-webkit-scrollbar-thumb:hover {
    background-color: rgba(53, 73, 101, 0.35);
}

/* Firefox scrollbar styling */
.quadrant {
    scrollbar-width: thin;
    scrollbar-color: rgba(53, 73, 101, 0.2) transparent;
}

.quadrant h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quadrant.urgent h3 { color: #e94560; }
.quadrant.todo h3 { color: #f39c12; }
.quadrant.assign h3 { color: var(--secondary); }
.quadrant.backlog h3 { color: #9b59b6; }

.task-card {
    background-color: #ffffff;
    padding: 0.75rem;
    border-radius: var(--button-radius);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    border-left: 3px solid;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.quadrant.urgent .task-card { border-left-color: #e94560; }
.quadrant.todo .task-card { border-left-color: #f39c12; }
.quadrant.assign .task-card { border-left-color: var(--secondary); }
.quadrant.backlog .task-card { border-left-color: #9b59b6; }

.task-card.completed { border-left-color: #27ae60 !important; }

.task-card .task-status {
    font-size: 0.7rem;
    color: var(--light-primary-bkgd);
    margin-top: 0.25rem;
}

.task-card .task-project {
    font-size: 0.7rem;
    color: var(--orange);
    margin-top: 0.25rem;
    font-style: italic;
}

.task-card .task-client {
    font-size: 0.65rem;
    color: var(--secondary);
    margin-top: 0.15rem;
    opacity: 0.8;
}

/* Tab 2 - Project Detail */
.project-detail {
    width: 100%;
}

.project-filter {
    width: 280px;
    background-color: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    padding: 1rem;
}

.project-filter h2 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.project-filter select {
    width: 100%;
    padding: 0.75rem;
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    color: var(--dark-text);
    border-radius: var(--button-radius);
    font-size: 0.9rem;
}

.project-filter .completed-projects-header {
    margin-top: 1.5rem;
}

.detail-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.detail-header {
    margin-bottom: 2rem;
}

.detail-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.detail-header .meta {
    display: flex;
    gap: 2rem;
    color: var(--light-primary-bkgd);
    font-size: 0.9rem;
}

.detail-header .meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.client-link {
    color: var(--orange);
    cursor: pointer;
    text-decoration: underline;
}

.project-link {
    color: var(--secondary);
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.project-link:hover {
    color: var(--accent);
    opacity: 0.8;
}

.detail-section {
    background-color: #f9f9f9;
    border: 1px solid #e8e8e8;
    border-radius: var(--button-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-section h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--orange);
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th,
.detail-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--dark-rgb-low);
    font-size: 0.85rem;
}

.detail-table th {
    color: var(--navy);
    font-weight: 600;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: calc(var(--button-radius) / 2);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.pending { background-color: #f39c12; color: #fff; }
.status-badge.not-started { background-color: #6c757d; color: #fff; }
.status-badge.in-progress { background-color: var(--teal); color: var(--navy); }
.status-badge.completed { background-color: #27ae60; color: #fff; }

.cp-task-expand-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--teal);
    background: #fff;
    color: var(--teal);
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cp-task-expand-btn:hover {
    background: var(--teal);
    color: #fff;
}

.cp-task-detail-row {
    background: #fcf8f1;
}

.cp-task-detail-cell {
    padding: 0;
    border-bottom: 1px solid #e7dcc8;
}

.cp-task-detail-card {
    padding: 1.25rem;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 242, 231, 0.98)),
        radial-gradient(circle at top right, rgba(226, 132, 43, 0.15), transparent 45%);
}

.cp-task-detail-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.cp-task-detail-title {
    font-family: var(--font-heading);
    color: var(--navy);
    font-size: 1rem;
    font-weight: 700;
}

.cp-task-detail-meta {
    margin-top: 0.35rem;
    color: #6b7280;
    font-size: 0.8rem;
}

.cp-task-detail-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cp-task-detail-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(53, 73, 101, 0.08);
    color: var(--navy);
    font-size: 0.75rem;
    font-weight: 600;
}

.cp-task-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.cp-task-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.cp-task-field span {
    color: var(--navy);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cp-task-textarea {
    min-height: 140px;
    padding: 0.9rem 1rem;
    border: 1px solid #d9d1c4;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--dark-text);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
}

.cp-task-textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(46, 166, 163, 0.15);
}

.cp-task-textarea:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.cp-task-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.cp-task-save-btn {
    border: 0;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    font-weight: 700;
    padding: 0.75rem 1.2rem;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.cp-task-save-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.cp-task-save-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

.cp-task-readonly-note {
    margin-top: 1rem;
    color: #6b7280;
    font-size: 0.85rem;
}

/* Tab 3 - Client Detail */
.client-detail {
    width: 100%;
}

.client-filter {
    width: 280px;
    background-color: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    padding: 1rem;
}

.client-filter h2 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.client-filter select {
    width: 100%;
    padding: 0.75rem;
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    color: var(--dark-text);
    border-radius: var(--button-radius);
    font-size: 0.9rem;
}

.no-client-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--light-primary-bkgd);
    font-size: 1rem;
}

/* Clickable rows in tables */
.clickable-row:hover {
    background-color: var(--dark-rgb-low);
}

/* Legacy clients-view styles - kept for compatibility */
.clients-view {
    width: 100%;
    padding: 2rem;
    overflow-y: auto;
}

.clients-view h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.clients-table {
    width: 100%;
    background-color: #ffffff;
    border-radius: var(--button-radius);
    overflow: hidden;
    border-collapse: collapse;
    border: 1px solid #e8e8e8;
}

.clients-table th,
.clients-table td {
    padding: 0;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--dark-rgb-low);
    height: 40px;
    line-height: 40px;
    vertical-align: middle;
}

.clients-table th {
    background-color: var(--navy);
    color: var(--cream);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clients-table .client-row {
    cursor: pointer;
    height: 40px;
}

.clients-table .client-row td {
    height: 40px;
    line-height: 40px;
}

.clients-table .client-row:hover {
    background-color: var(--dark-rgb-low);
}

.clients-table .contact-count {
    color: var(--light-primary-bkgd);
    font-size: 0.85rem;
}

.clients-table .expand-icon {
    display: inline-block;
    width: 20px;
    transition: transform 0.2s ease;
}

.clients-table .expand-icon.expanded {
    transform: rotate(90deg);
}

.contacts-row {
    display: none;
    background-color: var(--dark-bkgd);
}

.contacts-row.expanded {
    display: table-row;
}

.contacts-row td {
    padding: 0;
    height: auto;
}

.contacts-container {
    padding: 1rem 1rem 1rem 2.5rem;
}

.contacts-table {
    width: 100%;
    background-color: var(--primary);
    border-radius: calc(var(--button-radius) * 0.75);
    border-collapse: collapse;
}

.contacts-table th,
.contacts-table td {
    padding: 0.5rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--dark-rgb-low);
    height: 36px;
    font-size: 0.85rem;
}

.contacts-table th {
    background-color: var(--dark-rgb);
    color: var(--light-primary-bkgd);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.contacts-table tr:last-child td {
    border-bottom: none;
}

.no-project-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--light-primary-bkgd);
    font-size: 1rem;
}

/* Tab 4 - Agent Tasks (Request Queue) */
.tasks-view {
    width: 100%;
    padding: 2rem;
    overflow-y: auto;
}

.tasks-view h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.tasks-description {
    color: var(--light-primary-bkgd);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.task-description-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Source badges */
.source-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: calc(var(--button-radius) / 2);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.source-badge.source-email {
    background-color: var(--accent);
    color: var(--dark-bkgd);
}

.source-badge.source-dashboard {
    background-color: var(--secondary);
    color: var(--light-text);
}

.source-badge.source-api {
    background-color: #9b59b6;
    color: var(--light-text);
}

.source-badge.source-scheduled {
    background-color: #f39c12;
    color: var(--dark-bkgd);
}

/* Failed status badge */
.status-badge.failed {
    background-color: #e94560;
    color: var(--light-text);
}

/* Project links in tasks table */
.task-project-link {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.task-project-link:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.tasks-table {
    width: 100%;
    background-color: #ffffff;
    border-radius: var(--button-radius);
    overflow: hidden;
    border-collapse: collapse;
    border: 1px solid #e8e8e8;
}

.tasks-table th,
.tasks-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--dark-rgb-low);
}

.tasks-table th {
    background-color: var(--navy);
    color: var(--cream);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tasks-table tbody tr {
    transition: background-color 0.2s ease;
}

.tasks-table tbody tr:hover {
    background-color: var(--dark-rgb-low);
}

/* Task status indicators */
.tasks-table tbody tr.overdue {
    background-color: rgba(233, 69, 96, 0.15);
    font-weight: 500;
}

.tasks-table tbody tr.overdue:hover {
    background-color: rgba(233, 69, 96, 0.25);
}

.tasks-table tbody tr.in-progress {
    background-color: rgba(24, 140, 175, 0.15);
}

.tasks-table tbody tr.in-progress:hover {
    background-color: rgba(24, 140, 175, 0.25);
}

.tasks-table tbody tr.completed {
    background-color: rgba(39, 174, 96, 0.15);
    opacity: 0.7;
}

.tasks-table tbody tr.completed:hover {
    background-color: rgba(39, 174, 96, 0.25);
}

/* ============================================
   EXPAND RECORD BUTTONS (Project & Client)
   ============================================ */

.expand-project-btn,
.expand-record-btn {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--orange);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
}

.expand-project-btn:hover,
.expand-record-btn:hover {
    background-color: #e04000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 72, 0, 0.3);
}

.expand-project-btn:active,
.expand-record-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Mobile Footer Styles */
.mobile-footer {
    display: none;
    background-color: var(--navy);
    border-top: 1px solid rgba(53, 73, 101, 0.3);
    padding: 1rem;
    flex-shrink: 0;
    margin-top: auto;
}

.mobile-footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.mobile-user-info {
    color: var(--cream);
    font-size: 0.85rem;
    line-height: 1.4;
}

.mobile-logout-button {
    padding: 0.5rem 1.5rem;
    background-color: var(--dark-bkgd);
    color: var(--light-text);
    border: 1px solid var(--dark-rgb-low);
    border-radius: var(--button-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.mobile-logout-button:hover {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

/* Mobile devices (up to 768px) */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
        margin-left: 0;
    }

    .header-content {
        gap: 0.75rem;
    }

    .header-separator {
        font-size: 1.25rem;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    /* Hide user info in header on mobile */
    .header-user-info {
        display: none !important;
    }

    /* Show mobile footer on mobile */
    .mobile-footer {
        display: block;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .tab-content {
        flex: 1;
        min-height: 0;
        overflow: auto;
    }

    /* Project Overview - Stack vertically on mobile */
    .tab-content.project-overview.active {
        display: block !important;
        flex-direction: column;
    }

    .project-list {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--dark-rgb-low);
        max-height: 200px;
        overflow-y: auto;
    }

    .project-list h2 {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }

    .project-item {
        padding: 0.75rem 1rem;
    }

    .project-item h3 {
        font-size: 0.9rem;
    }

    /* Eisenhower Matrix - Stack into 1 column on mobile */
    .eisenhower-matrix {
        display: flex;
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .quadrant {
        padding: 0.75rem;
        min-height: 150px;
    }

    .quadrant h3 {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }

    .task-card {
        padding: 0.6rem;
        font-size: 0.8rem;
    }

    /* Project Detail - Stack vertically on mobile */
    .tab-content.project-detail.active {
        display: block !important;
        flex-direction: column;
    }

    .project-filter {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--dark-rgb-low);
        padding: 0.75rem 1rem;
    }

    .project-filter h2 {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    /* Client Detail - Stack vertically on mobile */
    .tab-content.client-detail.active {
        display: block !important;
        flex-direction: column;
    }

    .client-filter {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--dark-rgb-low);
        padding: 0.75rem 1rem;
    }

    .client-filter h2 {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .detail-content {
        padding: 1rem;
    }

    .detail-header h2 {
        font-size: 1.25rem;
    }

    .detail-header .meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .detail-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .detail-section h3 {
        font-size: 0.95rem;
    }

    /* Card-based layout for tables on mobile */
    .detail-table,
    .clients-table,
    .tasks-table {
        display: block;
        overflow-x: visible;
    }

    /* Detail Table - Card Layout */
    .detail-table thead,
    .detail-table tbody,
    .detail-table th,
    .detail-table td,
    .detail-table tr {
        display: block;
    }

    .detail-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .detail-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--dark-rgb-low);
        border-radius: calc(var(--button-radius) * 0.75);
        background-color: var(--primary-rgb);
    }

    .detail-table td {
        position: relative;
        padding-left: 40%;
        text-align: left;
        border-bottom: 1px solid var(--dark-rgb-low);
    }

    .detail-table td:before {
        position: absolute;
        left: 0.75rem;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        content: attr(data-label);
        font-weight: 500;
        color: var(--light-primary-bkgd);
        text-align: left;
    }

    /* Style first field (topic row) with bold text and darker background */
    .detail-table td:first-child {
        font-weight: 600;
        background-color: var(--dark-rgb);
        border-top-left-radius: calc(var(--button-radius) * 0.75);
        border-top-right-radius: calc(var(--button-radius) * 0.75);
    }

    /* Clients Table - Card Layout */
    .clients-table thead,
    .clients-table tbody,
    .clients-table th,
    .clients-table td,
    .clients-table tr {
        display: block;
    }

    .clients-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .clients-table .client-row {
        margin-bottom: 1rem;
        border: 1px solid var(--dark-rgb-low);
        border-radius: calc(var(--button-radius) * 0.75);
        background-color: var(--primary-rgb);
        height: auto;
    }

    .clients-table .client-row td {
        position: relative;
        padding: 0.75rem 0.75rem 0.75rem 40%;
        text-align: left;
        border-bottom: 1px solid var(--dark-rgb-low);
        height: auto;
        line-height: 1.4;
    }

    .clients-table .client-row td:last-child {
        border-bottom: none;
    }

    .clients-table .client-row td:before {
        position: absolute;
        left: 0.75rem;
        top: 0.75rem;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 500;
        color: var(--light-primary-bkgd);
        text-align: left;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .clients-table .client-row td:nth-of-type(1):before { content: "Company"; }
    .clients-table .client-row td:nth-of-type(2):before { content: "Email"; }
    .clients-table .client-row td:nth-of-type(3):before { content: "Phone"; }
    .clients-table .client-row td:nth-of-type(4):before { content: "Address"; }
    .clients-table .client-row td:nth-of-type(5):before { content: "Contacts"; }

    /* Style first field (Company) with bold text and darker background */
    .clients-table .client-row td:first-child {
        font-weight: 600;
        background-color: var(--dark-rgb);
        border-top-left-radius: calc(var(--button-radius) * 0.75);
        border-top-right-radius: calc(var(--button-radius) * 0.75);
    }

    .clients-table .expand-icon {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
    }

    .clients-table .contact-count {
        display: inline-block;
        width: 100%;
    }

    /* Contacts nested table on mobile */
    .contacts-row {
        display: none;
        margin-bottom: 1rem;
        padding: 0;
    }

    .contacts-row.expanded {
        display: block;
    }

    .contacts-row td {
        padding: 0;
    }

    .contacts-container {
        padding: 0.75rem;
    }

    .contacts-table {
        border-radius: calc(var(--button-radius) * 0.5);
    }

    .contacts-table thead,
    .contacts-table tbody,
    .contacts-table th,
    .contacts-table td,
    .contacts-table tr {
        display: block;
    }

    .contacts-table thead {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .contacts-table tbody tr {
        margin-bottom: 0.5rem;
        border: 1px solid var(--dark-rgb-low);
        border-radius: calc(var(--button-radius) * 0.5);
        background-color: var(--dark-bkgd);
    }

    .contacts-table td {
        position: relative;
        padding: 0.5rem 0.5rem 0.5rem 35%;
        text-align: left;
        border-bottom: 1px solid var(--dark-rgb-low);
        height: auto;
    }

    .contacts-table td:last-child {
        border-bottom: none;
    }

    .contacts-table td:before {
        position: absolute;
        left: 0.5rem;
        top: 0.5rem;
        width: 30%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 500;
        color: var(--light-primary-bkgd);
        text-align: left;
        font-size: 0.7rem;
        text-transform: uppercase;
    }

    .contacts-table td:nth-of-type(1):before { content: "Name"; }
    .contacts-table td:nth-of-type(2):before { content: "Role"; }
    .contacts-table td:nth-of-type(3):before { content: "Email"; }
    .contacts-table td:nth-of-type(4):before { content: "Phone"; }

    /* Style first field (Name) with bold text and darker background */
    .contacts-table td:first-child {
        font-weight: 600;
        background-color: var(--primary);
        border-top-left-radius: calc(var(--button-radius) * 0.5);
        border-top-right-radius: calc(var(--button-radius) * 0.5);
    }

    /* Tasks Table - Card Layout */
    .tasks-table thead,
    .tasks-table tbody,
    .tasks-table th,
    .tasks-table td,
    .tasks-table tr {
        display: block;
    }

    .tasks-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .tasks-table tbody tr {
        margin-bottom: 1rem;
        border: 1px solid var(--dark-rgb-low);
        border-radius: calc(var(--button-radius) * 0.75);
        background-color: var(--primary-rgb);
    }

    .tasks-table tbody tr.overdue {
        border-left: 4px solid #e94560;
    }

    .tasks-table tbody tr.in-progress {
        border-left: 4px solid var(--secondary);
    }

    .tasks-table tbody tr.completed {
        border-left: 4px solid #27ae60;
    }

    .tasks-table td {
        position: relative;
        padding: 0.75rem 0.75rem 0.75rem 40%;
        text-align: left;
        border-bottom: 1px solid var(--dark-rgb-low);
    }

    .tasks-table td:last-child {
        border-bottom: none;
    }

    .tasks-table td:before {
        position: absolute;
        left: 0.75rem;
        top: 0.75rem;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 500;
        color: var(--light-primary-bkgd);
        text-align: left;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .tasks-table td:nth-of-type(1):before { content: "Task"; }
    .tasks-table td:nth-of-type(2):before { content: "Description"; }
    .tasks-table td:nth-of-type(3):before { content: "Source"; }
    .tasks-table td:nth-of-type(4):before { content: "Project"; }
    .tasks-table td:nth-of-type(5):before { content: "Request Date"; }
    .tasks-table td:nth-of-type(6):before { content: "Status"; }

    .task-description-cell {
        max-width: none;
        white-space: normal;
    }

    /* Style first field (Task) with bold text and darker background */
    .tasks-table td:first-child {
        font-weight: 600;
        background-color: var(--dark-rgb);
        border-top-left-radius: calc(var(--button-radius) * 0.75);
        border-top-right-radius: calc(var(--button-radius) * 0.75);
    }

    /* Clients View */
    .clients-view {
        padding: 1rem;
    }

    .clients-view h2 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    /* Tasks View */
    .tasks-view {
        padding: 1rem;
    }

    .tasks-view h2 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
}

/* Tablets (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .header {
        padding: 0.875rem 1.5rem;
    }

    .header-separator {
        font-size: 1.4rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .tab {
        padding: 0.875rem 1.5rem;
    }

    .project-list {
        width: 240px;
    }

    .project-filter {
        width: 240px;
    }

    .client-filter {
        width: 240px;
    }

    .eisenhower-matrix {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .quadrant {
        padding: 0.875rem;
    }

    .detail-content {
        padding: 1.5rem;
    }

    .clients-view {
        padding: 1.5rem;
    }
}

/* Large desktops (1440px and above) */
@media (min-width: 1440px) {
    .header {
        padding: 1.25rem 2.5rem;
    }

    .header-separator {
        font-size: 1.75rem;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .project-list {
        width: 320px;
    }

    .project-filter {
        width: 320px;
    }

    .client-filter {
        width: 320px;
    }

    .detail-content {
        padding: 2.5rem;
    }

    .clients-view {
        padding: 2.5rem;
    }
}

/* Reviews Section Styles */
.reviews-view {
    padding: 2rem;
}

.reviews-container {
    max-width: 1200px;
    margin: 0 auto;
}

.no-reviews {
    text-align: center;
    padding: 3rem;
    color: var(--dark-text);
    font-size: 1.1rem;
}

.review-card {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: var(--button-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--dark-rgb-low);
}

.review-agent {
    color: var(--orange);
    font-weight: 600;
}

.review-timestamp {
    color: var(--dark-text);
    font-size: 0.9rem;
}

.review-context {
    background: rgba(113, 201, 198, 0.1);
    border-left: 3px solid var(--teal);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.review-context div {
    margin: 0.5rem 0;
}

.review-question {
    padding: 1rem 0;
    font-size: 1.1rem;
}

.review-question strong {
    color: var(--accent);
}

.review-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

.review-option-btn {
    background: var(--orange);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: all 0.2s ease;
}

.review-option-btn:hover {
    background: #e04000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 72, 0, 0.3);
}

.review-custom-response {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.custom-response-input {
    flex: 1;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    color: var(--dark-text);
    padding: 0.75rem;
    border-radius: var(--button-radius);
    font-size: 1rem;
}

.submit-custom-btn {
    background: var(--secondary);
    color: var(--light-text);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--button-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.submit-custom-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

.review-free-form {
    margin-top: 1rem;
}

.review-textarea {
    width: 100%;
    min-height: 100px;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    color: var(--dark-text);
    padding: 0.75rem;
    border-radius: var(--button-radius);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.submit-response-btn {
    background: var(--accent);
    color: var(--dark-bkgd);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--button-radius);
    cursor: pointer;
    font-weight: 600;
    margin-top: 0.75rem;
    transition: all 0.2s ease;
}

.submit-response-btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(60, 181, 242, 0.3);
}

/* Badge for pending reviews count */
.badge {
    background: #ff4444;
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    font-weight: 700;
}

.badge.hidden {
    display: none;
}

/* Notification animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Mobile responsiveness for reviews */
@media (max-width: 768px) {
    .reviews-view {
        padding: 1rem;
    }

    .review-card {
        padding: 1rem;
    }

    .review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .review-options {
        flex-direction: column;
    }

    .review-option-btn {
        width: 100%;
    }

    .review-custom-response {
        flex-direction: column;
    }

    .submit-custom-btn {
        width: 100%;
    }
}

/* ============================================
   AUTO-REFRESH INDICATOR
   ============================================ */

.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgb(175, 175, 175);
    background-color: var(--dark-rgb-low);
    padding: 0.4rem 0.75rem;
    border-radius: var(--button-radius);
    margin-right: 1rem;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.refresh-indicator:hover {
    opacity: 1;
}

.refresh-dot {
    width: 8px;
    height: 8px;
    background-color: #27ae60;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile responsiveness for refresh indicator */
@media (max-width: 768px) {
    .refresh-indicator {
        display: none; /* Hide on mobile to save space */
    }
}

/* ============================================
   NOTES SECTION - MARKDOWN STYLING
   ============================================ */

.notes-list {
    list-style-type: disc;
}

.notes-list li {
    line-height: 1.6;
}

/* Bold text in notes */
.notes-list strong {
    color: var(--navy);
    font-weight: 600;
}

/* Italic text in notes */
.notes-list em {
    color: var(--light-primary-bkgd);
    font-style: italic;
}

/* Inline code in notes */
.notes-list code {
    background-color: rgba(53, 73, 101, 0.08);
    color: var(--navy);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

/* Links in notes */
.notes-list a {
    color: var(--orange);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.notes-list a:hover {
    border-bottom-color: var(--orange);
}

/* ============================================
   DOCUMENTATION GROUPS BY DATE
   ============================================ */

.doc-group {
    margin-bottom: 1.5rem;
}

.doc-group-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0.75rem;
}

.doc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-item {
    margin-bottom: 0.5rem;
}

.doc-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--orange);
    text-decoration: none;
    border-radius: calc(var(--button-radius) * 0.5);
    transition: background-color 0.2s ease, padding-left 0.2s ease;
}

.doc-link:hover {
    background-color: rgba(113, 201, 198, 0.1);
    padding-left: 1rem;
}

.doc-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-size {
    font-size: 0.8rem;
    color: var(--light-primary-bkgd);
    opacity: 0.8;
    margin-left: 1rem;
    flex-shrink: 0;
}

/* Mobile responsiveness for documentation groups */
@media (max-width: 768px) {
    .doc-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .doc-size {
        margin-left: 0;
        font-size: 0.75rem;
    }

    .doc-name {
        white-space: normal;
        word-break: break-word;
    }
}

/* ============================================
   ASSETS SECTION
   ============================================ */

.assets-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.asset-group {
    margin-bottom: 0.5rem;
}

.asset-group-header {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--dark-rgb-low);
    margin-bottom: 0.75rem;
}

.asset-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

.asset-item {
    background-color: #ffffff;
    border-radius: calc(var(--button-radius) * 0.75);
    overflow: hidden;
    transition: all 0.2s ease;
    border: 1px solid #e8e8e8;
}

.asset-item:hover {
    border-color: var(--teal);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.asset-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--dark-text);
    text-decoration: none;
    gap: 0.5rem;
}

/* Image asset card with thumbnail */
.asset-item.asset-image {
    display: flex;
    flex-direction: column;
}

.asset-item.asset-image .asset-link {
    flex-direction: column;
    padding: 0;
    gap: 0;
}

.asset-thumbnail-container {
    width: 100%;
    height: 140px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    position: relative;
}

.asset-thumbnail {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.asset-item.asset-image:hover .asset-thumbnail {
    transform: scale(1.05);
}

/* Loading state for image thumbnails */
.asset-thumbnail-container.loading {
    background: linear-gradient(90deg, rgba(0,0,0,0.2) 25%, rgba(255,255,255,0.05) 50%, rgba(0,0,0,0.2) 75%);
    background-size: 200% 100%;
    animation: thumbnailLoading 1.5s ease-in-out infinite;
}

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

/* Fallback icon when image fails to load */
.asset-thumbnail-fallback {
    font-size: 2.5rem;
    color: var(--light-primary-bkgd);
    opacity: 0.6;
}

/* Image asset info bar below thumbnail */
.asset-image-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: rgba(0, 0, 0, 0.15);
    gap: 0.5rem;
}

.asset-image-info .asset-name {
    flex: 1;
    min-width: 0;
}

.asset-image-info .asset-size {
    flex-shrink: 0;
}

.asset-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.asset-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.asset-size {
    font-size: 0.75rem;
    color: var(--light-primary-bkgd);
    opacity: 0.8;
    flex-shrink: 0;
}

/* Mobile responsiveness for assets */
@media (max-width: 768px) {
    .asset-list {
        grid-template-columns: 1fr;
    }

    .asset-link {
        padding: 0.6rem;
    }

    .asset-name {
        font-size: 0.85rem;
        white-space: normal;
        word-break: break-word;
    }

    .asset-icon {
        font-size: 1.1rem;
        width: 24px;
    }

    .asset-thumbnail-container {
        height: 120px;
    }

    .asset-image-info {
        padding: 0.5rem 0.6rem;
    }

    .asset-image-info .asset-name {
        font-size: 0.85rem;
        white-space: normal;
        word-break: break-word;
    }
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--navy);
    color: var(--cream);
    border: 1px solid rgba(53, 73, 101, 0.3);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--orange);
    color: #ffffff;
    border-color: var(--orange);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 72, 0, 0.3);
}

.back-to-top:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 1.5rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

/* ============================================
   NOTES TAB
   ============================================ */

.notes-view {
    padding: 2rem;
    max-width: 900px;
}

.notes-view h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 0.25rem;
}

.notes-description {
    color: var(--light-primary-bkgd);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.notes-input-area {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.notes-textarea {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--dark-rgb-low);
    border-radius: var(--button-radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--dark-text);
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s ease;
    background: var(--bkgd);
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--teal);
}

.notes-submit-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--orange);
    color: #ffffff;
    border: none;
    border-radius: var(--button-radius);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.notes-submit-btn:hover {
    background-color: var(--navy);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(53, 73, 101, 0.3);
}

.notes-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.notes-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--light-primary-bkgd);
    font-size: 0.95rem;
    font-style: italic;
}

.notes-date-separator {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1.25rem 0 0.5rem 0;
    border-bottom: 2px solid var(--dark-rgb-low);
    margin-bottom: 0.75rem;
}

.notes-date-separator:first-child {
    padding-top: 0;
}

.notes-entry {
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--teal);
    background: var(--primary-rgb);
    border-radius: 0 var(--button-radius) var(--button-radius) 0;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease;
}

.notes-entry:hover {
    background: var(--dark-rgb);
}

.notes-entry-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.notes-entry-time {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--orange);
    letter-spacing: 0.3px;
}

.notes-entry-author {
    font-size: 0.8rem;
    color: var(--light-primary-bkgd);
}

.notes-delete-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--light-primary-bkgd);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 0.25rem;
    opacity: 0;
    transition: all 0.2s ease;
}

.notes-entry:hover .notes-delete-btn {
    opacity: 0.5;
}

.notes-delete-btn:hover {
    opacity: 1 !important;
    color: #ff4444;
}

.notes-entry-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--dark-text);
}

.notes-entry-content p {
    margin-bottom: 0.5rem;
}

.notes-entry-content p:last-child {
    margin-bottom: 0;
}

.notes-entry-content code {
    background: var(--dark-rgb);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.notes-entry-content ul,
.notes-entry-content ol {
    margin-left: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */

.tabs {
    display: none !important; /* Hide old horizontal tabs */
}

.app-layout {
    display: flex;
    min-height: calc(100vh - 70px);
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--navy);
  color: #fff;
  overflow-y: auto;
  padding: 0.5rem 0;
    padding-top: 0.5rem;
  border-right: 1px solid rgba(255,255,255,0.1);
  position: fixed;
  top: 0;
  height: 100vh;
  padding-top: 100px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-right: auto;
}

.sidebar-group {
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.6);
    transition: color 0.2s;
}

.sidebar-group-header:hover {
    color: rgba(255,255,255,0.9);
}

.sidebar-chevron {
    font-size: 0.65rem;
    transition: transform 0.2s;
}

.sidebar-group.collapsed .sidebar-chevron {
    transform: rotate(-90deg);
}

.sidebar-group.collapsed .sidebar-group-items {
    display: none;
}

.sidebar-group-items {
    padding-bottom: 0.25rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.5rem 1.5rem;
    cursor: pointer;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    transition: all 0.15s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-item.active {
    background: rgba(113, 201, 198, 0.15);
    color: var(--teal);
    border-left-color: var(--teal);
    font-weight: 600;
}

.unread-badge {
    background: var(--orange);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 1.5rem 2rem;
    overflow-y: auto;
    margin-left: 240px;
}

.section-content {
    display: none !important;
}

.section-content.active {
    display: block !important;
}

.section-description {
    color: var(--light-primary-bkgd);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

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

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    max-height: 600px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #fafafa;
}

.chat-message {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
}

.chat-message.sent {
    align-items: flex-end;
}

.chat-message.received {
    align-items: flex-start;
}

.chat-bubble {
    max-width: 70%;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
}

.chat-message.sent .chat-bubble {
    background: var(--navy);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.received .chat-bubble {
    background: #fff;
    border: 1px solid #e0e0e0;
    color: var(--dark-text);
    border-bottom-left-radius: 4px;
}

.chat-meta {
    font-size: 0.7rem;
    color: #999;
    margin-top: 0.2rem;
    padding: 0 0.25rem;
}

.chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.chat-textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.chat-send-btn {
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: var(--teal);
}

/* ========================================
   DAILY LOGS STYLES
   ======================================== */

.daily-log-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.daily-log-date-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.daily-log-date-nav input[type="date"] {
    padding: 0.4rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.daily-log-user-toggle {
    display: flex;
    gap: 0.25rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.btn-sm:hover {
    background: #f0f0f0;
}

.btn-sm.btn-active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.primary-btn {
    padding: 0.5rem 1.25rem;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: var(--teal);
}

.daily-log-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.daily-log-section label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
    min-height: 24px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--light-accent-rgb);
    border: 1px solid rgba(53, 73, 101, 0.15);
    border-radius: 16px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.tag-item .tag-remove {
    cursor: pointer;
    color: #999;
    font-weight: bold;
    margin-left: 0.2rem;
}

.tag-item .tag-remove:hover {
    color: var(--orange);
}

.tag-input-row {
    display: flex;
    gap: 0.35rem;
}

.tag-input-row input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.daily-log-section textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    resize: vertical;
}

/* Team logs read-only view */
.team-log-entry {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fafafa;
}

.team-log-entry h4 {
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.team-log-entry .log-items {
    margin: 0.25rem 0;
}

.team-log-entry .log-items span {
    display: inline-block;
    background: var(--light-accent-rgb);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin: 0.15rem 0.15rem 0.15rem 0;
}

/* ========================================
   MEETING AGENDA STYLES
   ======================================== */

.agenda-controls {
    margin-bottom: 1rem;
}

.agenda-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #fff;
    transition: border-color 0.15s;
}

.agenda-item:hover {
    border-color: var(--teal);
}

.agenda-item .agenda-status {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 2px;
}

.agenda-item .agenda-status.resolved {
    background: var(--teal);
    border-color: var(--teal);
}

.agenda-item .agenda-body {
    flex: 1;
}

.agenda-item .agenda-title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.agenda-item .agenda-meta {
    font-size: 0.75rem;
    color: #999;
}

.agenda-item.resolved .agenda-title {
    text-decoration: line-through;
    opacity: 0.6;
}

/* ========================================
   DOCKSIDE SALES STYLES
   ======================================== */

.dockside-event-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.dockside-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #fafafa;
    cursor: pointer;
    transition: background 0.15s;
}

.dockside-event-header:hover {
    background: #f0f0f0;
}

.dockside-event-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--navy);
}

.dockside-event-date {
    font-size: 0.85rem;
    color: #666;
}

.dockside-event-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
}

.dockside-event-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dockside-event-stats .stat-value {
    font-weight: 700;
    color: var(--navy);
}

.dockside-event-stats .stat-label {
    color: #999;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.dockside-event-body {
    display: none;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e0e0e0;
}

.dockside-event-body.open {
    display: block;
}

/* Fish slips table */
.fish-slip-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fish-slip-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.fish-slip-number {
    font-weight: 700;
    color: var(--navy);
}

.fish-slip-detail {
    font-size: 0.85rem;
    color: #666;
}

.fish-slip-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-sent {
    background: rgba(113, 201, 198, 0.2);
    color: #1a8a86;
}

.badge-pending {
    background: rgba(255, 220, 98, 0.3);
    color: #8a6b00;
}

.badge-paid {
    background: rgba(113, 201, 198, 0.2);
    color: #1a8a86;
}

/* Payment summary cards */
.payment-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.payment-summary-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    background: #fff;
}

.payment-summary-card h4 {
    color: var(--navy);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.payment-summary-card .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.payment-summary-card .summary-row.balance {
    border-top: 2px solid var(--navy);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-weight: 700;
}

.payment-summary-card .summary-row.balance.owed {
    color: var(--orange);
}

/* Form modal overlay */
.form-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.form-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.form-modal-content h3 {
    margin-bottom: 1rem;
    color: var(--navy);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.btn-cancel {
    padding: 0.5rem 1.25rem;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* ========================================
   FILTER GROUP
   ======================================== */

.filter-group {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-group select {
    padding: 0.35rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    background: #fff;
}

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

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 70px;
        height: calc(100vh - 70px);
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 15px rgba(0,0,0,0.2);
    }

    .sidebar-toggle {
        display: block;
    }

    .header {
        margin-left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

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

    .daily-log-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .dockside-event-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .fish-slip-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .payment-summary-cards {
        grid-template-columns: 1fr;
    }

    .cp-task-table-wrap {
        overflow-x: visible !important;
    }

    .cp-task-detail-header {
        flex-direction: column;
    }

    .cp-task-detail-grid {
        grid-template-columns: 1fr;
    }

    .cp-task-actions {
        justify-content: stretch;
    }

    .cp-task-save-btn {
        width: 100%;
    }

    .notes-input-area {
        flex-direction: column;
    }

    .notes-submit-btn {
        width: 100%;
    }

    .notes-view {
        padding: 1rem;
    }
}

/* ========================================
   PHASE 2+: SHARED MARKETING / SECTION STYLES
   ======================================== */

.section-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group select, .filter-group input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: var(--button-radius);
    font-size: 0.85rem;
}

/* Duplicate alert banner */
.duplicate-alert {
    background: #fff3e0;
    border: 1px solid #ff9800;
    border-left: 4px solid #ff9800;
    color: #e65100;
    padding: 0.75rem 1rem;
    border-radius: var(--button-radius);
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

/* Summary card */
.summary-card {
    background: var(--cream);
    border: 1px solid #d5cfc2;
    border-radius: var(--button-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Progress bar */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Channel badges */
.channel-email { background: #e3f2fd; color: #1565c0; }
.channel-phone { background: #e8f5e9; color: #2e7d32; }
.channel-social { background: #fce4ec; color: #c62828; }
.channel-in-person { background: #fff3e0; color: #e65100; }

/* Sentiment dots */
.sentiment-positive { color: #27ae60; font-weight: 500; }
.sentiment-neutral { color: #999; font-weight: 500; }
.sentiment-negative { color: #e74c3c; font-weight: 500; }

/* Brand asset grid */
.brand-asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.brand-asset-card {
    border: 1px solid #e8e8e8;
    border-radius: var(--button-radius);
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
    background: #fff;
}

.brand-asset-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.brand-asset-card img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.brand-asset-name {
    display: block;
    font-size: 0.75rem;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Form modal overlay — full-screen dark backdrop */
.form-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/*
 * Inner white box when nested inside .form-modal-overlay.
 * Higher specificity (2 classes) overrides the single-class .form-modal
 * overlay rule above so position/display don't bleed through.
 */
.form-modal-overlay .form-modal {
    background: #fff;
    border-radius: var(--button-radius);
    padding: 2rem;
    width: 92%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    /* Reset overlay properties from the earlier .form-modal rule */
    position: relative;
    display: block;
    top: auto; left: auto; right: auto; bottom: auto;
    z-index: auto;
    align-items: initial;
    justify-content: initial;
}

.form-modal-overlay .form-modal h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    color: var(--navy);
    font-size: 1.1rem;
}

.form-modal-overlay .form-modal .form-group {
    display: block;
    margin-bottom: 1rem;
}

.form-modal-overlay .form-modal .form-group label {
    display: block;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.form-modal-overlay .form-modal .form-group input,
.form-modal-overlay .form-modal .form-group select,
.form-modal-overlay .form-modal .form-group textarea {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: var(--button-radius);
    font-size: 0.9rem;
    box-sizing: border-box;
    font-family: var(--font-body);
}

.form-modal-overlay .form-modal .form-group input:focus,
.form-modal-overlay .form-modal .form-group select:focus,
.form-modal-overlay .form-modal .form-group textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(113,201,198,0.2);
}

/* Two-column row inside a modal */
.form-modal-overlay .form-modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    justify-content: flex-end;
}

/* Modal header with title + close button */
.form-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 0.5rem;
}

.form-modal-header h3 {
    margin: 0;
    color: var(--navy);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Close (×) button used in modal headers */
.form-modal-close,
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0 2px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.form-modal-close:hover,
.modal-close-btn:hover {
    color: var(--navy);
}

/* Override the generic h3 margin inside overlay modals that use a header div */
.form-modal-overlay .form-modal .form-modal-header h3 {
    margin-bottom: 0;
}

/* ========================================
   CALENDAR WIDGET
   ======================================== */

.cal-widget {
    background: #f8f9fb;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    max-width: 360px;
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.cal-month-label {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 0.5px;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-header-cell {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    padding: 4px 0 6px;
    letter-spacing: 0.5px;
}

.cal-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #555;
    position: relative;
    gap: 2px;
}

.cal-day-num {
    line-height: 1;
}

.cal-cell.today .cal-day-num {
    background: var(--navy);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
}

.cal-cell.has-entries {
    cursor: pointer;
}

.cal-cell.has-entries:hover {
    background: rgba(113,201,198,0.15);
}

.cal-cell.selected {
    background: rgba(113,201,198,0.25);
    border: 1px solid var(--teal);
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--teal);
    display: block;
}

.cal-cell.today .cal-dot {
    background: var(--orange);
}

.cal-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

/* ========================================
   MEETING CARDS & AGENDA ACCORDION
   ======================================== */

.meeting-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.meeting-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8f9fb;
    cursor: pointer;
    user-select: none;
    gap: 1rem;
}

.meeting-card-header:hover {
    background: #f0f3f8;
}

.meeting-card-title {
    font-weight: 700;
    color: var(--navy);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meeting-card-meta {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
}

.meeting-card-body {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid #e2e8f0;
}

.expand-arrow {
    font-size: 0.7rem;
    color: var(--teal);
    width: 14px;
    display: inline-block;
}

.agenda-accordion {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.agenda-accordion.resolved {
    opacity: 0.6;
}

.agenda-accordion-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: #fff;
    cursor: pointer;
    user-select: none;
    font-size: 0.88rem;
}

.agenda-accordion-header:hover {
    background: #f8f9fb;
}

.agenda-accordion-status {
    width: 14px;
    height: 14px;
    min-width: 14px;
    border-radius: 50%;
    border: 2px solid var(--teal);
    cursor: pointer;
}

.agenda-accordion-status.resolved {
    background: var(--teal);
}

.agenda-accordion-title {
    flex: 1;
    color: var(--navy);
    font-weight: 600;
}

.agenda-accordion-by {
    font-size: 0.75rem;
    color: #999;
    white-space: nowrap;
}

.agenda-accordion-body {
    padding: 0.75rem;
    background: #fafbfc;
    border-top: 1px solid #e9ecef;
}

/* ========================================
   NOTES THREAD (agenda items + task notes)
   ======================================== */

.notes-thread {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    max-height: 240px;
    overflow-y: auto;
}

.note-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
}

.note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    font-size: 0.78rem;
}

.note-header strong {
    color: var(--navy);
    font-weight: 700;
}

.note-time {
    color: #aaa;
}

.note-body {
    font-size: 0.88rem;
    color: #333;
    line-height: 1.5;
    white-space: pre-wrap;
}

.notes-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.notes-input-row textarea {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    resize: vertical;
    min-height: 58px;
}

.notes-input-row textarea:focus {
    outline: none;
    border-color: var(--teal);
}

.notes-empty {
    text-align: center;
    padding: 0.75rem;
    color: #bbb;
    font-size: 0.82rem;
    font-style: italic;
}

/* Warning row for below-par items */
.row-warning {
    background: #fff8e1 !important;
}

/* Inventory grid */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Timeline entries */
.timeline-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timeline-entry {
    background: #f9f9f9;
    border: 1px solid #e8e8e8;
    border-radius: var(--button-radius);
    padding: 0.75rem 1rem;
}

/* Funnel bar */
.funnel-bar {
    display: flex;
    height: 36px;
    border-radius: var(--button-radius);
    overflow: hidden;
    gap: 2px;
    margin-bottom: 0.5rem;
}

.funnel-stage-block {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 24px;
}

/* Check-in / Check-out buttons (tablet-friendly) */
.checkin-btn, .checkout-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--button-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 120px;
    text-align: center;
}

.checkin-btn {
    background: #27ae60;
    color: #fff;
}

.checkout-btn {
    background: var(--accent);
    color: #fff;
}

.checkin-card.no-show {
    border-left: 4px solid #e74c3c;
    background: #fff5f5;
}

/* Finance summary cards */
.finance-summary-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: var(--button-radius);
    padding: 1.25rem;
    text-align: center;
}

.finance-card-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-bottom: 0.25rem;
}

.finance-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy);
}

/* Overdue row */
.row-overdue {
    background: #ffebee !important;
}

/* ========================================
   AI CHAT STYLES
   ======================================== */

.ai-chat-header {
    margin-bottom: 1rem;
}

.ai-chat-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.ai-chat-conv-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ai-chat-conv-controls select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
}

#ai-chat-conv-select {
    max-width: 260px;
}

.ai-chat-notice {
    padding: 1rem 1.25rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    margin-bottom: 1rem;
}

.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 300px);
    max-height: 650px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: #f8f9fa;
}

/* Welcome screen */
.ai-chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    min-height: 300px;
}

.ai-chat-welcome-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.ai-chat-welcome h3 {
    color: var(--navy);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.ai-chat-welcome p {
    color: #666;
    max-width: 500px;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.ai-suggestion-btn {
    background: #fff;
    border: 1px solid var(--teal);
    color: var(--navy);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggestion-btn:hover {
    background: var(--teal);
    color: #fff;
}

/* Messages */
.ai-msg {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.ai-msg-user {
    align-items: flex-end;
}

.ai-msg-assistant {
    align-items: flex-start;
}

.ai-msg-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-msg-user .ai-msg-bubble {
    background: var(--navy);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-msg-assistant .ai-msg-bubble {
    background: #fff;
    border: 1px solid #e0e0e0;
    color: var(--dark-text);
    border-bottom-left-radius: 4px;
}

.ai-msg-assistant .ai-msg-bubble h1,
.ai-msg-assistant .ai-msg-bubble h2,
.ai-msg-assistant .ai-msg-bubble h3 {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.ai-msg-assistant .ai-msg-bubble ul,
.ai-msg-assistant .ai-msg-bubble ol {
    padding-left: 1.25rem;
    margin: 0.25rem 0;
}

.ai-msg-assistant .ai-msg-bubble code {
    background: #f0f0f0;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.ai-msg-assistant .ai-msg-bubble pre {
    background: #f5f5f5;
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.ai-msg-assistant .ai-msg-bubble pre code {
    background: none;
    padding: 0;
}

.ai-msg-error .ai-msg-bubble {
    background: #fff5f5;
    border-color: #e74c3c;
    color: #c0392b;
}

.ai-msg-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: #999;
    margin-top: 0.25rem;
    padding: 0 0.25rem;
    flex-wrap: wrap;
}

.ai-msg-sender {
    font-weight: 600;
}

.ai-files-badge {
    background: var(--teal);
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.65rem;
    cursor: help;
}

.ai-edits-badge {
    background: var(--accent);
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.65rem;
}

.ai-tokens-badge {
    background: #e0e0e0;
    color: #666;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.65rem;
}

/* Thinking animation */
.ai-thinking-dots span {
    animation: aiDot 1.4s infinite;
    animation-fill-mode: both;
}

.ai-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiDot {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* Input area */
.ai-chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.ai-chat-textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.4;
}

.ai-chat-textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(113, 201, 198, 0.2);
}

.ai-chat-send-btn {
    background: var(--teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}

.ai-chat-send-btn:hover {
    background: var(--navy);
}

.ai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-chat-container {
        height: calc(100vh - 350px);
        max-height: none;
    }

    .ai-msg-bubble {
        max-width: 90%;
    }

    .ai-chat-conv-controls {
        flex-direction: column;
        width: 100%;
    }

    #ai-chat-conv-select {
        max-width: none;
        width: 100%;
    }
}

.ai-db-badge {
    background: #2ecc71;
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.65rem;
    cursor: help;
}

/* ========================================
   KNOWLEDGE BROWSER STYLES
   ======================================== */

.kb-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.kb-search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

.kb-search-input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(113, 201, 198, 0.2);
}

.kb-count {
    color: #999;
    font-size: 0.85rem;
    white-space: nowrap;
}

.kb-tree {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kb-folder-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.kb-folder-header:hover {
    background: #eee;
}

.kb-folder-icon { font-size: 1rem; }

.kb-folder-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--navy);
}

.kb-folder-count {
    background: var(--teal);
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kb-folder-files {
    padding-left: 1.5rem;
}

.kb-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.kb-file:hover {
    background: #f0f0f0;
}

.kb-file-icon { font-size: 0.85rem; }

.kb-file-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--dark-text);
}

.kb-file-size {
    font-size: 0.75rem;
    color: #999;
}

/* Knowledge Viewer */
.kb-viewer-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.kb-viewer-path {
    font-size: 0.85rem;
    color: #666;
    font-family: monospace;
}

.kb-viewer-body {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 1.5rem;
    line-height: 1.6;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.kb-viewer-body h1, .kb-viewer-body h2, .kb-viewer-body h3 {
    color: var(--navy);
    margin-top: 1rem;
}

.kb-viewer-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.kb-viewer-body th, .kb-viewer-body td {
    border: 1px solid #ddd;
    padding: 0.35rem 0.5rem;
    text-align: left;
}

.kb-viewer-body th {
    background: #f5f5f5;
    font-weight: 600;
}

/* ========================================
   AUDIT LOG STYLES
   ======================================== */

.audit-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.audit-controls select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
}

.audit-summary {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.audit-table {
    font-size: 0.8rem;
}

.audit-table td {
    vertical-align: top;
    padding: 0.4rem 0.5rem;
}

/* ========================================
   FILE UPLOAD STYLES
   ======================================== */

.upload-dropzone {
    border: 2px dashed var(--border-color, #ccc);
    border-radius: 10px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafafa;
    user-select: none;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--accent-color, #0077cc);
    background: #f0f7ff;
}

.upload-dropzone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.upload-dropzone-text {
    font-size: 1rem;
    color: #444;
    margin-bottom: 0.25rem;
}

.upload-dropzone-sub {
    font-size: 0.8rem;
    color: #999;
}

.upload-queue-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 0.85rem;
}

.upload-queue-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-queue-item-size {
    color: #888;
    font-size: 0.78rem;
    white-space: nowrap;
}

.upload-queue-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #c00;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

/* Upload log table */
.upload-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.upload-log-table th {
    background: #f5f5f5;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
    white-space: nowrap;
}

.upload-log-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.upload-log-table tr:hover td {
    background: #fafafa;
}

.upload-path-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: #333;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-path-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    color: #333;
}

.copy-path-btn:hover {
    background: #e0e8ff;
    border-color: var(--accent-color, #0077cc);
    color: var(--accent-color, #0077cc);
}

.copy-path-btn.copied {
    background: #e6f4ea;
    border-color: #4caf50;
    color: #2e7d32;
}

.upload-delete-btn {
    background: none;
    border: none;
    color: #c00;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.upload-delete-btn:hover {
    background: #fff0f0;
}

.upload-status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.upload-status-ok   { background: #e6f4ea; color: #2e7d32; }
.upload-status-fail { background: #fff0f0; color: #c00; }
