/* OpenChambers — Main Stylesheet */
@import url('./themes/light.css');
@import url('./themes/dark.css');

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

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

/* === Layout === */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* === Navigation === */
.nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    flex: 1;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}
.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}
.nav-link.active {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

/* Power Tools dropdown */
.nav-dropdown-wrapper {
    position: relative;
}
.nav-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}
.nav-dropdown-arrow {
    font-size: 0.65rem;
    transition: transform 0.15s;
}
.nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    padding: 0.35rem 0;
    z-index: 100;
}
.nav-dropdown.open {
    display: block;
}
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.1s;
}
.nav-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}
.nav-dropdown-item.active {
    color: var(--accent-primary);
    font-weight: 600;
}
.nav-dropdown-icon {
    font-size: 1rem;
    width: 1.2rem;
    text-align: center;
}
/* Mobile power tools toggle */
.mobile-power-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    font-family: inherit;
}
.mobile-toggle-arrow {
    font-size: 0.55rem;
}

/* Nav group divider — vertical line between Work and Setup groups */
.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.5rem;
    align-self: center;
    list-style: none;
}

/* Mobile nav section header */
.mobile-nav-section {
    list-style: none;
    padding: 0.5rem 1.25rem 0.25rem;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

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

/* Hamburger — hidden on desktop */
.hamburger-btn {
    display: none;
}

/* === Mobile Menu === */
.mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 250;
}
.mobile-menu.open {
    display: block;
}
.mobile-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
}
.mobile-menu-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.2s ease-out;
}
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
.mobile-menu-header .btn-icon {
    font-size: 1.5rem;
}
.mobile-nav-links {
    list-style: none;
    flex: 1;
    padding: 0.5rem 0;
}
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.15s;
}
.mobile-nav-link:hover {
    background: var(--bg-hover);
    text-decoration: none;
}
.mobile-nav-link.active {
    color: var(--accent-primary);
    font-weight: 600;
    background: var(--bg-hover);
}
.mobile-nav-icon {
    font-size: 1.125rem;
    width: 1.5rem;
    text-align: center;
}
.mobile-menu-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

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

/* === Main Content === */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s, transform 0.15s;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.feed-source-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-left: auto;
    white-space: nowrap;
    transition: color 0.15s;
}

.feed-source-link:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

.card-body {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 0.5rem;
}

.card-footer {
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === Meeting Card === */
.meeting-card {
    cursor: pointer;
    margin-bottom: 0.75rem;
}
.meeting-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.meeting-card .agency-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.keyword-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Relevance badges */
.relevance-high { background: var(--relevance-high-bg); color: var(--relevance-high); }
.relevance-medium { background: var(--relevance-medium-bg); color: var(--relevance-medium); }
.relevance-low { background: var(--relevance-low-bg); color: var(--relevance-low); }
.relevance-none { background: var(--bg-tertiary); color: var(--relevance-none); }

/* Action item badges */
.action-rfp, .action-rfq { background: var(--action-rfp-bg); color: var(--action-rfp); }
.action-hearing { background: var(--action-hearing-bg); color: var(--action-hearing); }
.action-deadline { background: var(--action-deadline-bg); color: var(--action-deadline); }
.action-contract { background: var(--action-contract-bg); color: var(--action-contract); }
.action-plat { background: var(--action-plat-bg); color: var(--action-plat); }
.action-zoning { background: var(--action-zoning-bg); color: var(--action-zoning); }
.action-infrastructure { background: var(--action-infrastructure-bg); color: var(--action-infrastructure); }
.action-budget { background: var(--action-budget-bg); color: var(--action-budget); }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--text-inverse);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 0.4rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 1.125rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.btn-icon:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--action-rfp);
}

/* === Filter Bar === */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar .form-input,
.filter-bar .form-select {
    width: auto;
    min-width: 160px;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.filter-toggle input[type="checkbox"] {
    accent-color: var(--accent-primary);
}
.filter-toggle-label {
    line-height: 1;
}

/* === Grid === */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

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

/* === Stats Row === */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* === Document List === */
.doc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    line-height: 1.4;
}
.doc-item:last-child {
    border-bottom: none;
}

.doc-item a {
    min-width: 0;
    word-break: break-word;
}

.doc-type {
    flex-shrink: 0;
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    min-width: 3.5rem;
    text-align: center;
    white-space: nowrap;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

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

.empty-state-text {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* === Loading === */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* === Skeleton Loader === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-line {
    height: 0.875rem;
    margin-bottom: 0.5rem;
}

.skeleton-card {
    pointer-events: none;
}

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

/* === Action Items List === */
.action-list {
    list-style: none;
}

.action-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    align-items: flex-start;
}
.action-item:last-child {
    border-bottom: none;
}

.action-description {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.action-deadline {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === Meeting Detail Sections === */
.detail-section {
    border-left: 4px solid var(--border-color);
    margin-bottom: 1rem;
}
.detail-section-summary {
    border-left-color: var(--accent-primary);
}
.detail-section-actions {
    border-left-color: var(--action-rfp);
}
.detail-section-docs {
    border-left-color: var(--action-contract);
}

/* === Tooltip === */
.tooltip-trigger {
    cursor: help;
    border-bottom: 1px dotted var(--text-muted);
}
.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 0.5rem;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* === Welcome / Onboarding === */
.welcome-steps {
    text-align: left;
    margin: 1.5rem 0;
}
.welcome-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.welcome-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: var(--text-inverse);
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.welcome-step-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.welcome-step-text strong {
    color: var(--text-primary);
}

/* === Toast === */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
    animation: slideIn 0.2s ease-out;
}
.toast-exit {
    animation: slideOut 0.2s ease-in forwards;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
}
.toast-message {
    flex: 1;
}
.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.125rem;
    padding: 0.25rem;
    line-height: 1;
    flex-shrink: 0;
}
.toast-close:hover {
    color: var(--text-primary);
}

.toast-success { border-left: 4px solid var(--relevance-high); }
.toast-error { border-left: 4px solid var(--action-rfp); }
.toast-info { border-left: 4px solid var(--accent-primary); }
.toast-warning { border-left: 4px solid var(--action-deadline); max-width: 460px; }
.toast-warning .toast-message { display: block; }
.toast-warning code { background: var(--bg-secondary); padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.78rem; }

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

/* === Back Link === */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    transition: color 0.15s;
}
.back-link:hover {
    color: var(--accent-primary);
    text-decoration: none;
}

/* === Tab Bar === */
.tab-bar {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.tab-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover {
    color: var(--text-primary);
}
.tab-btn.tab-active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* === Agency Directory === */
.agency-directory {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.75rem;
}

.directory-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    gap: 0.75rem;
}
.directory-card:hover {
    border-color: var(--accent-primary);
}

.directory-search {
    margin-bottom: 1rem;
}

/* === Platform Badge === */
.platform-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin-left: 0.25rem;
}
.platform-civic_clerk {
    background: rgba(16, 185, 129, 0.1);
    color: var(--relevance-high);
}
.platform-legistar {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-primary);
}

/* === Analyze Button === */
.analyze-btn {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
}
.analyze-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-color: var(--accent-primary);
}
.analyze-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* === Form Messages === */
.form-warning {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    background: rgba(245, 158, 11, 0.1);
    color: var(--action-deadline);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.form-success {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--relevance-high);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* === Help Tooltips === */
.help-banner {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    width: fit-content;
}

.help-banner .info-tip {
    margin-left: 0;
}

.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 50%;
    font-size: 10px;
    cursor: help;
    margin-left: 5px;
    vertical-align: middle;
    font-weight: 700;
    font-family: Georgia, serif;
    flex-shrink: 0;
    line-height: 1;
}

.info-tip:hover {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

.acronym-tip {
    cursor: help;
    border-bottom: 1px dotted var(--text-muted);
    font-weight: inherit;
}

.acronym-tip:hover {
    border-bottom-color: var(--accent-primary);
    color: var(--accent-primary);
}

.tooltip-popup {
    position: fixed;
    z-index: 10000;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    font-style: normal;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: normal;
    width: 260px;
    max-width: calc(100vw - 24px);
    line-height: 1.4;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    pointer-events: none;
    animation: tooltipIn 0.12s ease-out;
}

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

@media (max-width: 768px) {
    .info-tip { width: 20px; height: 20px; font-size: 11px; }
    .tooltip-popup { width: 220px; }
}

/* === Kanban Board === */
.kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    height: calc(100vh - 200px);
    padding-bottom: 0.5rem;
}

/* Hide scrollbar but keep functionality */
.kanban-board::-webkit-scrollbar {
    height: 6px;
}
.kanban-board::-webkit-scrollbar-track {
    background: transparent;
}
.kanban-board::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
.kanban-board::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.kanban-column {
    flex: 0 0 280px;
    min-width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 0.8rem;
}

.kanban-header-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 0.35rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.25);
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.375rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
    border-left: 3px solid var(--border-color);
}

.kanban-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--accent-primary);
    border-left-color: inherit;
}

.kanban-card.kanban-urgency-red {
    border-left-color: #dc2626;
}

.kanban-card.kanban-urgency-amber {
    border-left-color: #d97706;
}

.kanban-card-desc {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.25rem;
    padding-right: 2rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.kanban-card-deadline {
    font-size: 0.7rem;
    color: var(--action-deadline);
    margin-top: 0.2rem;
    font-weight: 500;
}

.kanban-card-detail {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

.kanban-card-summary {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.375rem;
}

.kanban-card-link {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-primary);
}

.kanban-card-link:hover {
    text-decoration: underline;
}

/* === Kanban Card Actions (save/dismiss) === */
.kanban-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.kanban-card-actions .btn-icon {
    font-size: 0.85rem;
    padding: 0.2rem 0.35rem;
    opacity: 0.4;
    transition: opacity 0.15s, color 0.15s;
}

.kanban-card:hover .kanban-card-actions .btn-icon {
    opacity: 0.8;
}

.kanban-card-actions .btn-icon:hover {
    opacity: 1;
}

.kanban-action-dismiss:hover {
    color: var(--action-rfp);
}

.kanban-action-save:hover {
    color: #d97706;
}

.kanban-card.saved {
    border-left-color: #d97706 !important;
}

.kanban-card.saved .kanban-action-save {
    color: #d97706;
    opacity: 1;
}

.kanban-card.dismissing {
    animation: cardDismiss 0.25s ease-out forwards;
}

@keyframes cardDismiss {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); max-height: 0; padding: 0; margin: 0; overflow: hidden; }
}

/* === Board Picker === */
.board-picker-empty {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
}

.board-picker-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.board-picker-search {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.board-picker-search input {
    flex: 1;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
}
.board-picker-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.board-picker-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.board-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
    text-align: left;
    padding: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
}

.board-picker-grid::-webkit-scrollbar {
    width: 5px;
}
.board-picker-grid::-webkit-scrollbar-track {
    background: transparent;
}
.board-picker-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.board-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
    min-width: 0;
}

.board-picker-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-picker-item:hover {
    background: var(--bg-tertiary, rgba(255,255,255,0.04));
}

.board-picker-item input[type="checkbox"] {
    accent-color: var(--accent-primary);
    flex-shrink: 0;
}

.board-picker-item.hidden {
    display: none;
}

.board-picker-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === Add Agency Toggle === */
.add-agency-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    width: 100%;
    justify-content: center;
}

.add-agency-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.add-agency-toggle-icon {
    font-size: 1.1rem;
    font-weight: 700;
    transition: transform 0.2s;
}

.add-agency-toggle.open {
    border-style: solid;
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.add-agency-toggle.open .add-agency-toggle-icon {
    transform: rotate(45deg);
}

/* === Agency Card (click-to-expand) === */
.agency-card-clickable {
    cursor: pointer;
    transition: opacity 0.35s ease, transform 0.25s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.agency-card-clickable:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.agency-card-clickable.card-fading {
    opacity: 0.35;
    transform: scale(0.97);
    pointer-events: none;
}

.agency-card-clickable.card-selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 20%, transparent);
    transform: scale(1.02);
}

/* === Survey Question Spacing === */
.survey-question {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.survey-question:last-of-type {
    border-bottom: none;
}

.survey-checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.survey-radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* === Request List === */
.request-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.kanban-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* === Value Stream Map === */
.vsm-stages {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vsm-stage {
    flex: 1;
    min-width: 0;
}

.vsm-stage-bar-bg {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.vsm-stage-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.vsm-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
}

/* === Insights Drill-Down === */

.insights-intro {
    margin-bottom: 1.25rem;
    animation: fadeIn 0.4s ease;
}

.insights-intro h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.insights-intro p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.insights-pulse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
    gap: 12px;
    margin-bottom: 24px;
    justify-content: center;
}

.insights-pulse-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: opacity 0.35s ease, max-height 0.4s ease, padding 0.4s ease,
                margin 0.4s ease, border-color 0.2s ease, box-shadow 0.2s ease,
                transform 0.25s ease;
    overflow: visible;
}

.sparkline-container {
    display: block;
    width: 100%;
    height: 50px;
}

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

.insights-card-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.insights-pulse-card:hover {
    border-color: var(--accent-primary);
}

.insights-pulse-card.card-fading {
    opacity: 0;
    max-height: 0;
    padding: 0 12px;
    margin: 0;
    pointer-events: none;
    border-width: 0;
    transform: scale(0.9);
}

.insights-pulse-card.card-fading:nth-child(2) { transition-delay: 0.03s; }
.insights-pulse-card.card-fading:nth-child(3) { transition-delay: 0.06s; }
.insights-pulse-card.card-fading:nth-child(4) { transition-delay: 0.09s; }

.insights-pulse-card.card-selected {
    grid-column: 1 / -1;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 20%, transparent);
    transform: scale(1.02);
}

.insights-pulse-card.card-selected .sparkline-container {
    display: none;
}

.insights-pulse-card.card-returning {
    animation: cardReturn 0.4s ease forwards;
}

.insights-temperature-panel,
.insights-explorer-panel {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(12px);
    transition: max-height 0.4s ease, opacity 0.35s ease, transform 0.35s ease;
}

.insights-temperature-panel.panel-visible,
.insights-explorer-panel.panel-visible {
    max-height: 2000px;
    opacity: 1;
    transform: translateY(0);
}

.panel-transforming {
    opacity: 0 !important;
    transform: scale(0.95) !important;
    transition: opacity 0.25s ease, transform 0.25s ease !important;
}

.insights-explorer-panel.panel-entering {
    animation: panelZoomIn 0.35s ease forwards;
}

.insights-back-btn {
    display: none;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 12px;
    transition: color 0.2s, border-color 0.2s;
}

.insights-back-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.insights-back-btn.visible {
    display: inline-flex;
}

.insights-explore-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: opacity 0.2s;
}

.insights-explore-btn:hover {
    opacity: 0.85;
}

.insights-onboard-tip {
    position: absolute;
    z-index: 100;
    background: var(--accent-primary);
    color: #fff;
    font-size: 13px;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    animation: onboardPulse 2s ease-in-out infinite;
    max-width: 260px;
    line-height: 1.4;
}

.insights-onboard-tip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    transform: rotate(45deg);
}

.insights-onboard-tip button {
    background: rgba(255,255,255,0.25);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 3px 10px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

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

.insights-new-badge {
    background: var(--accent-primary);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

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

@keyframes onboardPulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes cardReturn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

/* === Responsive === */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hamburger-btn {
        display: block;
    }

    .main-content {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .insights-pulse-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar .form-input,
    .filter-bar .form-select {
        width: 100%;
    }

    #custom-date-fields {
        flex-direction: column;
        width: 100%;
    }

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

    .btn-icon {
        padding: 0.6rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }

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

    .card-meta {
        flex-wrap: wrap;
    }

    .agency-directory {
        grid-template-columns: 1fr;
    }

    .tab-bar {
        overflow-x: auto;
    }

    .kanban-board {
        flex-direction: column;
        overflow-x: visible;
    }

    .kanban-column {
        flex: none;
        min-width: unset;
        width: 100%;
        max-height: none;
    }

    /* Requests page: stack form and list on mobile */
    #main-content [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* VSM stacks vertically on mobile */
    .vsm-stages {
        flex-direction: column;
        align-items: stretch;
    }

    .vsm-arrow {
        transform: rotate(90deg);
        text-align: center;
    }

    .insights-pulse-grid {
        grid-template-columns: 1fr;
    }
}

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

    .nav {
        padding: 0 1rem;
    }
}

/* === Welcome Wizard === */
.welcome-wizard {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 2rem);
    padding: 2rem 1rem;
}

.welcome-wizard-inner {
    max-width: 600px;
    width: 100%;
}

/* Progress dots */
.welcome-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}

.welcome-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    transition: background 0.3s, transform 0.3s;
}

.welcome-dot.active {
    background: var(--accent-primary);
    transform: scale(1.3);
}

.welcome-dot.done {
    background: var(--relevance-high, #22c55e);
}

.welcome-dot-line {
    width: 40px;
    height: 2px;
    background: var(--border-color);
}

/* Step page */
.welcome-step-page {
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.welcome-hero-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.welcome-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.welcome-subtext {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    margin-top: 1.25rem;
}

/* Tag chips */
.welcome-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.welcome-chip {
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.welcome-chip:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.welcome-chip.selected {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-color: var(--accent-primary);
}

/* Wizard actions */
.welcome-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 2rem;
}

.welcome-skip {
    display: block;
    margin: 1rem auto 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem;
}

.welcome-skip:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* Directory wrapper in wizard */
.welcome-directory-wrapper {
    text-align: left;
    margin: 1rem 0;
    max-height: 420px;
    overflow-y: auto;
}

.welcome-directory-wrapper .agency-directory {
    gap: 0.5rem;
}

/* Note callout */
.welcome-note {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-tertiary, var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* === Setup Prompt (Empty State Guidance) === */
.setup-prompt {
    text-align: center;
    padding: 3rem 1.5rem;
    max-width: 420px;
    margin: 2rem auto;
}

.setup-prompt-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.setup-prompt-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.setup-prompt-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.setup-prompt .btn {
    margin-top: 0.25rem;
}

/* === Analytics Dashboard === */

.analytics-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.analytics-controls .form-select {
    min-width: 200px;
}

.analytics-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.analytics-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.analytics-back-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.analytics-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.analytics-stats-row .stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}

.analytics-stats-row .stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.analytics-stats-row .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.analytics-category-toggles {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.analytics-category-chip {
    padding: 0.3rem 0.75rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.analytics-category-chip:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.analytics-category-chip.active {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-color: var(--accent-primary);
}

/* Agency Scorecard Grid */
.analytics-scorecard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.analytics-scorecard {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}

.analytics-scorecard:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.analytics-scorecard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.analytics-scorecard-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 1.5rem);
}

.analytics-scorecard-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.analytics-scorecard-dot.fresh {
    background: var(--relevance-high, #22c55e);
}

.analytics-scorecard-dot.stale {
    background: var(--text-muted, #6c757d);
}

.analytics-scorecard-metrics {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    padding-top: 0.25rem;
}

.analytics-scorecard-metric {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.analytics-scorecard-metric-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analytics-scorecard-metric-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.analytics-scorecard-sparkline {
    height: 45px;
    width: 100%;
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .analytics-scorecard-grid {
        grid-template-columns: 1fr;
    }

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

    .analytics-controls {
        width: 100%;
    }

    .analytics-controls .form-select {
        width: 100%;
        min-width: unset;
    }

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

/* === Opportunity Score Badges === */
.kanban-card-score {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
}

.score-critical { background: var(--action-rfp); }
.score-high { background: var(--action-deadline); }
.score-medium { background: var(--relevance-medium); }
.score-low { background: var(--text-muted); opacity: 0.6; }

.kanban-card { position: relative; }

.kanban-header-value {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* Pareto Mode Toggle */
.pareto-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 0.75rem;
}

.pareto-mode-toggle button {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
}

.pareto-mode-toggle button:first-child { border-radius: 6px 0 0 6px; }
.pareto-mode-toggle button:last-child { border-radius: 0 6px 6px 0; border-left: none; }

.pareto-mode-toggle button.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* Cost of Waiting */
.kanban-card-cow {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--action-rfp);
    padding: 0.3rem 0.5rem;
    margin: 0.35rem 0;
    background: rgba(220, 38, 38, 0.08);
    border-radius: 4px;
    border-left: 2px solid var(--action-rfp);
}

/* === Digest Modal === */
.digest-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    padding: 2rem;
}

.digest-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.digest-modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.digest-modal-close {
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}
.digest-modal-close:hover {
    color: var(--text-primary);
}

.digest-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.digest-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (max-width: 640px) {
    .digest-modal-overlay {
        padding: 1rem;
    }
    .digest-modal {
        max-height: 92vh;
        border-radius: 8px;
    }
}

/* === Feed View === */

/* When feed layout is active, allow main-content to use more width */
.main-content:has(.feed-layout) {
    max-width: 1600px;
}

/* Feed sidebar layout */
.feed-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.feed-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
}

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

/* Sidebar section */
.filter-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}
.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.filter-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Sort/time pills in sidebar */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.filter-pill {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.filter-pill:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
.filter-pill.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Filter checkboxes */
.filter-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.filter-check input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}
.filter-check-count {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 1.5em;
    text-align: right;
}

/* Bucket expand */
.filter-bucket-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0 0.2rem;
    transition: transform 0.2s;
}
.filter-bucket-items {
    padding-left: 1.25rem;
    display: none;
    margin-top: 0.15rem;
}
.filter-bucket-items.open {
    display: block;
}
.filter-sub-item {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem;
}
.filter-sub-item:last-child {
    border-bottom: none;
}
.filter-sub-name {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.filter-sub-count {
    font-size: 0.65rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 0 0.3rem;
    border-radius: 3px;
    min-width: 1rem;
    text-align: center;
}
.filter-sub-agencies {
    font-size: 0.68rem;
    color: var(--text-muted);
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.8;
}

/* Feed help banner */
.feed-help-banner {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.feed-help-banner p {
    margin: 0;
}
.feed-help-banner strong {
    color: var(--text-primary);
}

/* Mobile filter */
.feed-mobile-filter-btn {
    display: none;
    margin-bottom: 1rem;
}

.feed-card {
    position: relative;
}

.feed-star-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.15s ease, transform 0.15s ease;
    z-index: 1;
}

.feed-star-btn:hover {
    color: #f59e0b;
    transform: scale(1.15);
}

.feed-star-btn.starred {
    color: #f59e0b;
}

/* Date-aware badges on feed cards */
.feed-date-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
}
.feed-date-today {
    background: #059669;
    color: #fff;
}
.feed-date-upcoming {
    background: #2563eb;
    color: #fff;
}

.feed-card-expanded {
    border-top: 1px solid var(--border-color);
    padding: 1rem 0 0.5rem;
    margin-top: 0.75rem;
    animation: fadeIn 0.2s ease-out;
}

.feed-card-expanded h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.4rem;
}

.feed-card-expanded p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

/* Action item list in expanded card */
.feed-action-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem;
}

.feed-action-list li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.82rem;
    line-height: 1.45;
}

.feed-action-list li:last-child {
    border-bottom: none;
}

.feed-action-type {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 10%, transparent);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    white-space: nowrap;
}

.feed-action-desc {
    color: var(--text-secondary);
}

/* Document list in expanded card */
.feed-doc-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem;
}

.feed-doc-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.82rem;
}

.feed-doc-list li:last-child {
    border-bottom: none;
}

.feed-doc-type {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    min-width: 2.5rem;
    text-align: center;
}

.feed-doc-title {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-more-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 0.25rem 0 0.75rem;
}

.feed-card.expanded {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@media (max-width: 768px) {
    .feed-layout {
        flex-direction: column;
    }
    .feed-sidebar {
        display: none;
        width: 100%;
        position: static;
        max-height: none;
    }
    .feed-sidebar.open {
        display: block;
    }
    .feed-mobile-filter-btn {
        display: inline-flex;
    }
}

/* === Mini Calendar === */
.feed-calendar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
}

.mini-calendar {
    font-size: 0.78rem;
}

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

.cal-month-label {
    font-weight: 600;
    font-size: 0.85rem;
}

.cal-nav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
}

.cal-nav:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

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

.cal-day {
    position: relative;
    text-align: center;
    padding: 0.25rem 0;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.5;
    min-height: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.cal-day:hover:not(.cal-day-empty) {
    background: var(--bg-hover);
}

.cal-day-empty {
    cursor: default;
}

.cal-day-today {
    font-weight: 700;
    color: white;
    background: var(--accent-primary);
    border-radius: 4px;
}

.cal-day-today:hover {
    opacity: 0.85;
}

.cal-day-selected {
    font-weight: 600;
    outline: 2.5px solid var(--accent-primary);
    outline-offset: -1px;
    border-radius: 4px;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
}

.cal-day-selected.cal-day-today {
    outline-color: var(--text-primary);
    color: white;
}

.cal-day-has-meetings {
    font-weight: 600;
    color: var(--text-primary);
}

.cal-dot {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin: 2px auto 0;
}

.cal-dot-low { background: var(--accent-primary); opacity: 0.5; }
.cal-dot-med { background: var(--accent-primary); opacity: 0.8; }
.cal-dot-high { background: var(--accent-primary); opacity: 1.0; width: 8px; height: 8px; margin-top: 1px; }

.cal-day-today .cal-dot {
    background: white;
    opacity: 0.9;
}

.cal-day-selected .cal-dot {
    background: var(--accent-primary);
    opacity: 1;
}

.cal-selection-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding: 0.35rem 0.5rem;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cal-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.cal-clear-btn:hover {
    color: var(--text-primary);
}

@media (max-width: 1100px) {
    .feed-calendar {
        display: none;
    }
}

/* === Auth Modal === */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease-out;
}

.auth-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.auth-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-muted);
    padding: 0.25rem;
    line-height: 1;
}

.auth-modal-close:hover {
    color: var(--text-primary);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

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

.auth-tab:hover:not(.active) {
    color: var(--text-secondary);
}

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

.auth-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.auth-field .form-input {
    width: 100%;
}

.auth-error {
    color: #dc2626;
    font-size: 0.82rem;
    min-height: 1.2em;
}

.auth-submit {
    width: 100%;
    padding: 0.65rem;
    font-size: 0.9rem;
}

.auth-forgot {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0;
}

.auth-forgot:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* Nav user display */
.nav-user {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Admin Dashboard === */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.admin-card {
    padding: 1.25rem;
}

.admin-card h3 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.admin-card-wide {
    grid-column: 1 / -1;
}

.admin-card-loading {
    text-align: center;
    padding: 1.5rem;
}

.admin-card-loading .spinner {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.admin-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.admin-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.admin-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 300px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.admin-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.35rem 0.5rem;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
}

.admin-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.admin-table tr:hover td {
    background: var(--bg-hover);
}

.admin-status-completed { background: #dcfce7; color: #166534; }
.admin-status-running { background: #dbeafe; color: #1e40af; }
.admin-status-failed { background: #fee2e2; color: #991b1b; }
.admin-status-pending { background: #fef3c7; color: #92400e; }
.admin-status-added { background: #dcfce7; color: #166534; }
.admin-status-declined { background: #fee2e2; color: #991b1b; }

.admin-role-admin {
    background: var(--accent-primary);
    color: white;
}

@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .admin-card-wide {
        grid-column: 1;
    }
}

/* === Digest History === */
.digest-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.digest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

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

.digest-row-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.digest-date {
    color: var(--text-secondary);
    font-weight: 500;
}

.digest-count {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.digest-status-delivered { background: #dcfce7; color: #166534; }
.digest-status-pending { background: #fef3c7; color: #92400e; }
.digest-status-failed { background: #fee2e2; color: #991b1b; }

/* === Summary Status Messages === */
.summary-pending {
    font-style: italic;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.summary-unavailable {
    font-style: italic;
    font-size: 0.82rem;
    color: var(--text-muted);
    opacity: 0.75;
}
