/* ========================================
   Grant Command Center - Stylesheet
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #eab308;
    --warning-light: #fef9c3;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --dark: #1e293b;
    --dark-hover: #334155;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --transition: 150ms ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

img { max-width: 100%; }

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 600;
}

/* --- Top Navigation Bar --- */
.top-nav {
    background: var(--dark);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.top-nav .nav-brand {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
    text-decoration: none;
}

.top-nav .nav-links {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    align-items: center;
}

.top-nav .nav-links a {
    color: var(--gray-300);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.top-nav .nav-links a:hover {
    background: var(--dark-hover);
    color: var(--white);
    text-decoration: none;
}

.top-nav .nav-links a.active {
    background: var(--primary);
    color: var(--white);
}

.top-nav .nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--gray-300);
    font-size: 0.875rem;
}

.top-nav .nav-user a {
    color: var(--gray-300);
    text-decoration: none;
}
.top-nav .nav-user a:hover {
    color: var(--white);
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

/* --- Layout --- */
.page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    color: var(--gray-900);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover { text-decoration: none; }

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

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}
.btn-success:hover {
    background: #15803d;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}
.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

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

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: box-shadow var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
}

/* --- Dashboard Stat Cards --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card .stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-card .stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-card .stat-icon.red { background: var(--danger-light); color: var(--danger); }

.stat-card .stat-info { flex: 1; }

.stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--gray-900);
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* --- Pipeline Stat Cards --- */
.pipeline-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.pipeline-stat {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.875rem 1rem;
    border-left: 4px solid var(--gray-300);
    cursor: pointer;
    transition: box-shadow var(--transition);
}
.pipeline-stat:hover {
    box-shadow: var(--shadow);
}

.pipeline-stat.status-identified { border-left-color: var(--primary); }
.pipeline-stat.status-reviewing { border-left-color: var(--warning); }
.pipeline-stat.status-drafting { border-left-color: #8b5cf6; }
.pipeline-stat.status-submitted { border-left-color: var(--primary); }
.pipeline-stat.status-awarded { border-left-color: var(--success); }
.pipeline-stat.status-rejected { border-left-color: var(--danger); }
.pipeline-stat.status-passed { border-left-color: var(--gray-400); }

.pipeline-stat .ps-count {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.pipeline-stat .ps-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Deadline List --- */
.deadline-list {
    list-style: none;
}

.deadline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-left: 4px solid var(--gray-300);
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
}
.deadline-item:hover {
    background: var(--gray-50);
}
.deadline-item:last-child {
    border-bottom: none;
}

.deadline-item.urgent { border-left-color: var(--danger); }
.deadline-item.soon { border-left-color: var(--warning); }
.deadline-item.upcoming { border-left-color: var(--success); }

.deadline-item .dl-info { flex: 1; }
.deadline-item .dl-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-800);
}
.deadline-item .dl-funder {
    font-size: 0.8125rem;
    color: var(--gray-500);
}
.deadline-item .dl-date {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 1rem;
}
.deadline-item .dl-date.urgent { color: var(--danger); }
.deadline-item .dl-date.soon { color: var(--warning); }
.deadline-item .dl-date.upcoming { color: var(--success); }

/* --- Kanban Board --- */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    min-height: 400px;
}

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.kanban-column-header h3 {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
}

.kanban-column-header .col-count {
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 100px;
}

.kanban-cards.drag-over {
    background: var(--primary-light);
    border-radius: var(--radius);
}

/* --- Grant Cards --- */
.grant-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.875rem;
    cursor: grab;
    transition: box-shadow var(--transition), transform var(--transition);
    border: 1px solid var(--gray-200);
}
.grant-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.grant-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.grant-card .gc-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.375rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grant-card .gc-funder {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.grant-card .gc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.grant-card .gc-deadline {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.grant-card .gc-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

/* --- Badges & Pills --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-score {
    padding: 0.2rem 0.625rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.badge-score.high { background: var(--success-light); color: var(--success); }
.badge-score.medium { background: var(--warning-light); color: #a16207; }
.badge-score.low { background: var(--danger-light); color: var(--danger); }

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 10px;
    text-transform: capitalize;
}

.status-pill.identified { background: var(--primary-light); color: var(--primary); }
.status-pill.reviewing { background: var(--warning-light); color: #a16207; }
.status-pill.drafting { background: #ede9fe; color: #7c3aed; }
.status-pill.submitted { background: var(--primary-light); color: var(--primary); }
.status-pill.awarded { background: var(--success-light); color: var(--success); }
.status-pill.rejected { background: var(--danger-light); color: var(--danger); }
.status-pill.passed { background: var(--gray-200); color: var(--gray-500); }

/* --- List View --- */
.grant-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.grant-list-table thead th {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.grant-list-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

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

.grant-list-table tbody tr:last-child td {
    border-bottom: none;
}

.grant-list-table .gt-title {
    font-weight: 600;
    color: var(--gray-800);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grant-list-table .gt-title a {
    color: inherit;
}
.grant-list-table .gt-title a:hover {
    color: var(--primary);
    text-decoration: none;
}

/* --- Filters Bar --- */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.filters-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.filters-bar label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.filters-bar select,
.filters-bar input[type="text"],
.filters-bar input[type="search"] {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-700);
    font-family: inherit;
}

.filters-bar select:focus,
.filters-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.view-toggle {
    display: flex;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-left: auto;
}

.view-toggle button {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border: none;
    background: var(--white);
    color: var(--gray-500);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    font-family: inherit;
}
.view-toggle button + button {
    border-left: 1px solid var(--gray-300);
}
.view-toggle button.active {
    background: var(--primary);
    color: var(--white);
}

/* --- Modals --- */
.modal-overlay {
    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: 2000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
}

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

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 200ms ease;
}

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

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

.modal-header h2 {
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.25rem;
    line-height: 1;
    transition: color var(--transition);
}
.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group input[type="search"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-800);
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

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

.form-group .form-hint {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
}

/* --- Profile Page --- */
.profile-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.profile-section-header h2 {
    font-size: 1.125rem;
    color: var(--gray-900);
}

.industry-tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.industry-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    font-size: 0.875rem;
}
.industry-tag:hover {
    background: var(--gray-50);
}
.industry-tag input[type="checkbox"]:checked + span {
    color: var(--primary);
    font-weight: 600;
}

/* --- Narrative Tabs --- */
.narrative-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    gap: 0;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.narrative-tab {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
    white-space: nowrap;
    font-family: inherit;
}
.narrative-tab:hover {
    color: var(--gray-700);
}
.narrative-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.narrative-content {
    display: none;
}
.narrative-content.active {
    display: block;
}

/* --- Application Workspace --- */
.workspace-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    min-height: calc(100vh - 140px);
}

.workspace-editor {
    display: flex;
    flex-direction: column;
}

.workspace-editor .editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    flex-wrap: wrap;
}

.workspace-editor textarea {
    flex: 1;
    width: 100%;
    border: 1px solid var(--gray-200);
    padding: 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.7;
    font-family: inherit;
    resize: none;
    outline: none;
}
.workspace-editor textarea:focus {
    border-color: var(--primary);
}

.word-count-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-size: 0.75rem;
    color: var(--gray-500);
}

.word-count-bar .wc-count {
    font-weight: 600;
}

.workspace-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.workspace-sidebar .sidebar-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.sidebar-section-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sidebar-section-body {
    padding: 0.75rem 1rem;
}

/* --- Evidence Library --- */
.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.evidence-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: 1rem;
    transition: box-shadow var(--transition);
}
.evidence-card:hover {
    box-shadow: var(--shadow);
}

.evidence-card .ec-category {
    margin-bottom: 0.5rem;
}

.evidence-card .ec-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
    color: var(--gray-800);
}

.evidence-card .ec-content {
    font-size: 0.8125rem;
    color: var(--gray-600);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.evidence-card .ec-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

.category-badge {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--primary-light);
    color: var(--primary);
}

.category-badge.pilot_results { background: #ede9fe; color: #7c3aed; }
.category-badge.user_stats { background: var(--primary-light); color: var(--primary); }
.category-badge.testimonials { background: var(--success-light); color: var(--success); }
.category-badge.financials { background: var(--warning-light); color: #a16207; }
.category-badge.partnerships { background: #fce7f3; color: #be185d; }
.category-badge.awards { background: #fef3c7; color: #b45309; }
.category-badge.press { background: var(--gray-200); color: var(--gray-600); }

/* --- Alerts & Toasts --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-light);
    color: #15803d;
    border-color: #bbf7d0;
}

.alert-error {
    background: var(--danger-light);
    color: #b91c1c;
    border-color: #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: #a16207;
    border-color: #fde68a;
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary);
    border-color: #bfdbfe;
}

.toast-container {
    position: fixed;
    top: 72px;
    right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideInRight 300ms ease;
    background: var(--white);
    color: var(--gray-800);
    border-left: 4px solid var(--gray-400);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--primary); }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 1.125rem;
    padding: 0;
    line-height: 1;
}

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

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.75rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

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

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray-400);
}

.empty-state .es-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto 1.25rem;
}

/* --- Auth Pages --- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gray-100);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

.auth-logo {
    text-align: center;
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.auth-card h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
}

.auth-form .btn-block {
    margin-top: 0.5rem;
}

.auth-footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 1.25rem;
}

/* --- Sections / Generic --- */
.section-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

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

.section-card-header h2 {
    font-size: 1rem;
    color: var(--gray-800);
}

.section-card-body {
    padding: 1.25rem 1.5rem;
}

/* --- Version History List --- */
.version-list {
    list-style: none;
}

.version-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
}
.version-item:last-child {
    border-bottom: none;
}

.version-item .vi-label {
    color: var(--gray-600);
}

.version-item .vi-date {
    color: var(--gray-400);
    font-size: 0.75rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .top-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 0.75rem 1rem;
    }

    .nav-hamburger {
        display: block;
    }

    .top-nav .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding-top: 0.75rem;
        gap: 0.25rem;
    }

    .top-nav .nav-links.open {
        display: flex;
    }

    .top-nav .nav-links a {
        padding: 0.625rem 0.75rem;
        width: 100%;
    }

    .top-nav .nav-user {
        display: none;
    }

    .top-nav .nav-links.open + .nav-user {
        display: flex;
        width: 100%;
        padding-top: 0.5rem;
        border-top: 1px solid var(--dark-hover);
    }

    .page-wrapper {
        padding: 1rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .workspace-layout {
        grid-template-columns: 1fr;
    }

    .workspace-sidebar {
        order: -1;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-bar .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        margin-left: 0;
    }

    .kanban-board {
        flex-direction: column;
    }

    .kanban-column {
        min-width: 100%;
        max-width: 100%;
    }

    .industry-tags-grid {
        grid-template-columns: 1fr;
    }

    .evidence-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal {
        max-height: 95vh;
    }

    .grant-list-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 1rem;
    }

    .stat-card .stat-number {
        font-size: 1.5rem;
    }

    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .pipeline-stats {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .workspace-editor .editor-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toast {
        min-width: auto;
        max-width: calc(100vw - 2rem);
    }
}
