/* Contract Hunter — Light theme, responsive */

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #e0e0e0;
    --text: #1a1a1a;
    --text-muted: #666;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --yellow: #ca8a04;
    --yellow-bg: #fef9c3;
    --red: #dc2626;
    --red-bg: #fee2e2;
    --gray: #9ca3af;
    --gray-bg: #f3f4f6;
    --sidebar-w: 200px;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.sidebar .logo {
    font-weight: 700;
    font-size: 1rem;
    padding: 0 1.25rem 1.5rem;
    color: var(--primary);
}

.sidebar ul { list-style: none; }

.sidebar a {
    display: block;
    padding: 0.6rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.sidebar a:hover { background: var(--bg); color: var(--text); }
.sidebar a.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: #eff6ff;
    font-weight: 600;
}

/* Logout */
.nav-logout { padding: 0 1.25rem; margin-top: auto; }
.logout-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.85rem; cursor: pointer; padding: 0.4rem 0;
}
.logout-btn:hover { color: var(--red); }

/* Main content */
.content {
    margin-left: var(--sidebar-w);
    padding: 1.5rem 2rem;
    flex: 1;
    max-width: 1200px;
}

/* Page header */
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stats-bar .stat strong {
    color: var(--text);
}

/* Filters */
.filters {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filters form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filters select, .filters input[type="range"] {
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
}

.score-filter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.score-filter strong { color: var(--text); min-width: 1.5em; }

.filter-count {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Job cards */
.job-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.job-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.job-title {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    flex: 1;
}

.job-title:hover { color: var(--primary); }

.job-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.job-card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.job-card-angle {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.4rem;
}

/* Dimension mini-bars */
.dim-bars {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.dim-bar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 120px;
    flex: 1;
}

.dim-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    width: 48px;
    flex-shrink: 0;
}

.dim-track {
    flex: 1;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    min-width: 40px;
}

.dim-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.dim-fill-high { background: var(--green); }
.dim-fill-medium { background: var(--yellow); }
.dim-fill-low { background: var(--red); }

.dim-val {
    font-size: 0.72rem;
    font-weight: 600;
    width: 1.2rem;
    text-align: right;
    color: var(--text-muted);
    font-family: "SF Mono", Monaco, monospace;
}

/* Legacy fallback - keep for dashboard cards */
.job-card-dims {
    display: flex;
    gap: 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: "SF Mono", Monaco, monospace;
    margin-bottom: 0.5rem;
}

.job-card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Score badges */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.score-big { width: 3.5rem; height: 3.5rem; font-size: 1.1rem; }

.score-high { background: var(--green-bg); color: var(--green); }
.score-medium { background: var(--yellow-bg); color: var(--yellow); }
.score-low { background: var(--gray-bg); color: var(--gray); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
}

.btn:hover { background: var(--bg); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

.btn-skip { color: var(--red); border-color: var(--red); }
.btn-skip:hover { background: var(--red-bg); }
.btn-bookmark { color: var(--yellow); border-color: var(--yellow); }
.btn-bookmark:hover { background: var(--yellow-bg); }
.btn-analyze { color: var(--primary); border-color: var(--primary); }
.btn-analyze:hover { background: #eff6ff; }
.btn-chat { color: var(--green); border-color: var(--green); }
.btn-chat:hover { background: var(--green-bg); }
.btn-link { color: var(--text-muted); }

/* ==============================
   Job Detail — Redesigned
   ============================== */
.job-detail { max-width: 900px; }

/* Hero: Score ring + title */
.detail-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.detail-score-ring {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.score-ring-high { background: #d1fae5; border: 3px solid #059669; }
.score-ring-medium { background: #fef3c7; border: 3px solid #d97706; }
.score-ring-low { background: #ffe4e6; border: 3px solid #e11d48; }

.detail-score-num {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.score-ring-high .detail-score-num { color: #059669; }
.score-ring-medium .detail-score-num { color: #d97706; }
.score-ring-low .detail-score-num { color: #e11d48; }

.detail-score-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.detail-hero-text { flex: 1; }

.detail-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: 0.3rem;
}

.detail-status {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--gray-bg);
    color: var(--text-muted);
}

.detail-status-analyzed { background: #d1fae5; color: #059669; }
.detail-status-applied { background: #d1fae5; color: #059669; }
.detail-status-scored { background: #dbeafe; color: var(--primary); }
.detail-status-skipped { background: var(--red-bg); color: var(--red); }

/* Meta grid */
.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.detail-meta-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.detail-meta-value {
    font-size: 0.88rem;
    color: var(--text);
}

/* Skill pills */
.detail-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.skill-pill {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #dbeafe;
}

/* Legacy skill tag (keep for dashboard) */
.skill-tag {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    margin: 0.1rem 0.2rem;
}

/* Detail cards */
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.detail-card-analysis {
    border-left: 4px solid var(--primary);
}

.detail-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Score bars (detail page) */
.detail-score-bars { margin-bottom: 1rem; }

.detail-bar-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}

.detail-bar-label {
    width: 120px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-bar-track {
    flex: 1;
    height: 10px;
    background: var(--bg);
    border-radius: 5px;
    overflow: hidden;
}

.detail-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

.detail-bar-high { background: #059669; }
.detail-bar-medium { background: #d97706; }
.detail-bar-low { background: #e11d48; }

.detail-bar-val {
    width: 1.8rem;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: "SF Mono", Monaco, "Cascadia Mono", monospace;
}

.detail-bar-val-high { color: #059669; }
.detail-bar-val-medium { color: #d97706; }
.detail-bar-val-low { color: #e11d48; }

/* Key angle */
.detail-angle {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    margin-bottom: 0.75rem;
}

.detail-angle-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.detail-angle p {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text);
}

/* Expandable sections */
.detail-expandable {
    margin-bottom: 0.5rem;
}

.detail-expandable > summary {
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    padding: 0.3rem 0;
}

.detail-expandable > summary:hover { color: var(--primary-hover); }

.detail-expandable p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
}

/* Flag pills */
.detail-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.75rem;
}

.flag-pill {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.flag-green { background: #d1fae5; color: #059669; }
.flag-red { background: #ffe4e6; color: #e11d48; }

/* Analysis grid */
.detail-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
    margin-bottom: 0.75rem;
}

.detail-analysis-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.detail-analysis-full { grid-column: 1 / -1; }

.detail-analysis-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.detail-analysis-grid p,
.detail-hooks p,
.detail-hooks li {
    font-size: 0.88rem;
    line-height: 1.5;
}

.detail-hooks {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.detail-hooks ol,
.detail-hooks ul {
    margin: 0.4rem 0 0 1.25rem;
    font-size: 0.88rem;
    line-height: 1.6;
}

.detail-hooks li { margin-bottom: 0.4rem; }

/* Proposal draft text */
.detail-draft-text {
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.btn-copy {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-copy:hover { background: #eff6ff; }

/* Detail list (interview prep etc.) */
.detail-list {
    margin: 0 0 0 1.25rem;
    font-size: 0.88rem;
    line-height: 1.6;
}

.detail-list li { margin-bottom: 0.5rem; }

/* Description text */
.description-text {
    white-space: pre-wrap;
    font-size: 0.85rem;
    line-height: 1.6;
    max-height: 600px;
    overflow-y: auto;
}

/* Detail actions bar */
.detail-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: sticky;
    bottom: 1rem;
}

/* Legacy feedback note (keep for backwards compat) */
.feedback-note {
    margin-top: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--yellow-bg);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

/* Legacy meta-row (keep for other pages) */
.meta-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
}

.chat-context {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
    background: #eff6ff;
    border-radius: var(--radius);
    display: inline-block;
}

.chat-context a { color: var(--primary); }
.clear-context { margin-left: 0.5rem; color: var(--red) !important; font-size: 0.8rem; }

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

.chat-msg {
    max-width: 80%;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.chat-user {
    margin-left: auto;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-assistant {
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}

.chat-msg-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

.chat-msg-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.thinking-indicator {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.thinking-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
}

.chat-input input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    outline: none;
}

.chat-input input:focus { border-color: var(--primary); }

.chat-input button {
    padding: 0.6rem 1.2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
}

.chat-input button:hover { background: var(--primary-hover); }
.chat-input button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2.5rem;
    width: 340px;
    text-align: center;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.login-card input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.login-card button {
    width: 100%;
    padding: 0.6rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
}

.login-card button:hover { background: var(--primary-hover); }

/* Alerts */
.alert {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* HTMX indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* ==============================
   Phase 2: Proposals
   ============================== */

.proposals-list { max-width: 900px; }

.proposal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.proposal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.proposal-job-title {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    flex: 1;
}
.proposal-job-title:hover { color: var(--primary); }

.proposal-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.status-drafted { background: var(--gray-bg); color: var(--gray); }
.status-submitted { background: #dbeafe; color: var(--primary); }
.status-viewed { background: var(--yellow-bg); color: var(--yellow); }
.status-shortlisted { background: #fef3c7; color: #b45309; }
.status-interview { background: #e0e7ff; color: #4338ca; }
.status-hired { background: var(--green-bg); color: var(--green); }
.status-rejected { background: var(--red-bg); color: var(--red); }
.status-withdrawn { background: var(--gray-bg); color: var(--text-muted); }

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

.score-sm { width: 1.8rem; height: 1.8rem; font-size: 0.7rem; }

.proposal-draft {
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.proposal-draft summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 0.8rem;
}

.proposal-draft-text {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-size: 0.82rem;
    max-height: 400px;
    overflow-y: auto;
}

.proposal-actions {
    display: flex;
    gap: 0.5rem;
}

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

/* ==============================
   Phase 2: Insights
   ============================== */

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.insight-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.insight-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

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

.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.section-card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.section-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

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

.cost-period h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.cost-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    padding: 0.2rem 0;
}

.cost-total {
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
    padding-top: 0.35rem;
    font-weight: 600;
}

/* Histogram */
.histogram {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 230px;
    padding: 0 0.5rem;
}

.histogram-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.histogram-bar {
    width: 100%;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.histogram-count {
    font-size: 0.65rem;
    color: white;
    font-weight: 600;
    padding-top: 2px;
}

.histogram-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Calibration table */
.calibration-table, .run-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.calibration-table th, .run-table th {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.calibration-table td, .run-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--bg);
}

.calibration-table tr:hover, .run-table tr:hover {
    background: var(--bg);
}

.action-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.action-skip { background: var(--red-bg); color: var(--red); }
.action-bookmark { background: var(--yellow-bg); color: var(--yellow); }
.action-apply { background: var(--green-bg); color: var(--green); }
.action-applied { background: var(--green-bg); color: var(--green); }
.action-no_feedback { background: var(--gray-bg); color: var(--gray); }

/* Applied button */
.btn-applied { color: var(--green); border-color: var(--green); }
.btn-applied:hover { background: var(--green-bg); }

/* Feedback grid */
.feedback-grid {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.feedback-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feedback-stat strong {
    font-size: 1.25rem;
}

/* ==============================
   Phase 3: Proposal Outcomes
   ============================== */

/* Funnel bar */
.funnel-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.funnel-bar-insights {
    margin-bottom: 0;
}

.funnel-stage {
    text-align: center;
    min-width: 60px;
}

.funnel-count {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.funnel-arrow {
    color: var(--gray);
    font-size: 1.1rem;
}

.funnel-rejected {
    text-align: center;
    min-width: 60px;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.funnel-rejected .funnel-count {
    color: var(--red);
}

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

/* Rejection reason tag */
.rejection-reason-tag {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--red-bg);
    color: var(--red);
}

/* Reject picker */
.reject-picker {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--red-bg);
    border-radius: var(--radius);
}

.reject-picker-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--red);
    margin-right: 0.25rem;
}

/* New button variants */
.btn-reject { color: var(--red); border-color: var(--red); }
.btn-reject:hover { background: var(--red-bg); }
.btn-hired { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.btn-hired:hover { background: #bbf7d0; }

/* ==============================
   Sessions
   ============================== */

/* Page header with actions */
.page-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.page-header h1 { margin-bottom: 0; }

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* Session badge (current session indicator) */
.session-badge {
    font-family: "SF Mono", Monaco, monospace;
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
}

/* Filter bar */
.filter-bar {
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

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

.filter-group label {
    color: var(--text-muted);
    font-weight: 600;
}

.filter-btn {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.82rem;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid transparent;
}

.filter-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

/* Source & mode badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-web { background: #dbeafe; color: var(--primary); }
.badge-telegram { background: #e0e7ff; color: #4338ca; }
.badge-chat { background: var(--green-bg); color: var(--green); }
.badge-task { background: var(--yellow-bg); color: var(--yellow); }

/* Sessions list */
.sessions-list { max-width: 900px; }

.session-date-header {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.75rem 0 0.4rem;
    margin-top: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.session-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-top: 0.5rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}

.session-card:hover {
    border-color: var(--primary);
}

.session-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.session-id {
    font-size: 0.8rem;
    color: var(--text);
}

.session-badges {
    display: flex;
    gap: 0.3rem;
}

.session-card-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.session-task-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-style: italic;
}

.session-pr-link {
    font-size: 0.78rem;
    color: var(--primary);
    margin-top: 0.25rem;
}

/* Session detail */
.session-meta-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.pr-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.pr-link:hover { text-decoration: underline; }

.session-task-banner {
    padding: 0.5rem 0.85rem;
    background: var(--yellow-bg);
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.session-transcript {
    height: auto;
    max-height: calc(100vh - 280px);
}

.session-transcript .chat-messages {
    overflow-y: auto;
}

.chat-msg-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    opacity: 0.7;
}

/* Tool indicator (shown during AI tool use in chat) */
.tool-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    font-size: 0.82rem;
    color: var(--primary);
    background: #eff6ff;
    border-radius: var(--radius);
    margin: 0.25rem 0;
}

.tool-icon {
    font-size: 0.9rem;
}

/* Back link in page headers */
.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 1.1rem;
    margin-right: 0.3rem;
}

.back-link:hover { text-decoration: underline; }

/* ==============================
   Digest Feed — Redesigned
   ============================== */

/* -- Color palette overrides for digest -- */
.digest-card {
    --score-green: #059669;
    --score-green-bg: #d1fae5;
    --score-amber: #d97706;
    --score-amber-bg: #fef3c7;
    --score-rose: #e11d48;
    --score-rose-bg: #ffe4e6;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s, border-color 0.15s;
    position: relative;
}

.digest-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
    border-color: #cbd5e1;
}

/* Left color stripe by score tier */
.digest-stripe-high { border-left: 4px solid var(--score-green); }
.digest-stripe-medium { border-left: 4px solid var(--score-amber); }
.digest-stripe-low { border-left: 4px solid var(--score-rose); }

/* Analyzed cards get subtle background tint */
.digest-analyzed {
    background: linear-gradient(135deg, var(--surface) 0%, #f0fdf4 100%);
}

/* Crowded state */
.digest-card.digest-crowded {
    opacity: 0.6;
    border-color: var(--gray);
}

/* Warming state */
.digest-card.digest-warming {
    border-left: 4px solid var(--yellow);
}

/* Client-grouped cards */
.digest-client-grouped {
    opacity: 0.55;
    border-left: 4px solid var(--gray);
    margin-left: 1.5rem;
    margin-top: -0.4rem;
}

/* -- Zone A: Header -- */
.digest-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.digest-header .score-badge {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    letter-spacing: -0.02em;
}

.digest-header .score-high {
    background: var(--score-green-bg);
    color: var(--score-green);
    border-color: rgba(5, 150, 105, 0.2);
}

.digest-header .score-medium {
    background: var(--score-amber-bg);
    color: var(--score-amber);
    border-color: rgba(217, 119, 6, 0.2);
}

.digest-header .score-low {
    background: var(--score-rose-bg);
    color: var(--score-rose);
    border-color: rgba(225, 29, 72, 0.15);
}

.digest-title-group {
    flex: 1;
    min-width: 0;
}

.digest-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.digest-title-group .job-title {
    font-size: 0.98rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.digest-badges {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
}

/* Header meta row */
.digest-card .job-card-meta {
    margin-top: 0.3rem;
    margin-bottom: 0;
    font-size: 0.78rem;
    gap: 0;
    flex-wrap: wrap;
    align-items: center;
}

.meta-budget {
    font-weight: 600;
    color: var(--text);
}

.meta-sep::after {
    content: "·";
    margin: 0 0.4rem;
    color: var(--gray);
}

.meta-applicants {
    color: var(--text-muted);
}

.applicants-high {
    color: var(--red) !important;
    font-weight: 600;
}

.applicants-med {
    color: var(--yellow) !important;
    font-weight: 600;
}

.connects-pill {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--gray-bg);
    color: var(--text-muted);
    margin-left: 0.3rem;
}

.connects-high {
    background: var(--red-bg);
    color: var(--red);
}

.connects-med {
    background: var(--yellow-bg);
    color: var(--yellow);
}

/* -- Zone B: Key angle + dimension pills -- */
.digest-card .job-card-angle {
    font-style: normal;
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.45;
    padding-left: 0.6rem;
    border-left: 3px solid var(--primary);
    margin: 0.5rem 0;
}

.dim-pills {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.dim-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-family: "SF Mono", Monaco, "Cascadia Mono", monospace;
}

.dim-pill-high {
    background: var(--score-green-bg);
    color: var(--score-green);
}

.dim-pill-medium {
    background: var(--score-amber-bg);
    color: var(--score-amber);
}

.dim-pill-low {
    background: var(--score-rose-bg);
    color: var(--score-rose);
}

/* -- Zone C: Analysis panel -- */
.digest-analysis {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    font-size: 0.84rem;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1.5rem;
}

.analysis-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.analysis-bid {
    grid-column: 1 / -1;
}

.analysis-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.analysis-value {
    font-size: 0.84rem;
    color: var(--text);
    line-height: 1.4;
}

/* -- Zone D: Expandable details -- */
.digest-expandables {
    margin: 0.5rem 0;
}

.digest-detail {
    margin-bottom: 0.25rem;
}

.digest-detail > summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0;
    user-select: none;
}

.digest-detail > summary:hover {
    color: var(--primary-hover);
}

.digest-detail-text {
    margin-top: 0.4rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: 0.82rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}

.digest-detail-list {
    margin: 0.4rem 0 0 1.25rem;
    font-size: 0.82rem;
    line-height: 1.6;
}

.digest-detail-list li {
    margin-bottom: 0.35rem;
}

/* -- Zone E: Actions -- */
.digest-card .job-card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.actions-spacer {
    flex: 1;
}

.btn-action-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

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

.btn-text-skip {
    color: var(--text-muted);
    border-color: transparent;
    background: transparent;
}

.btn-text-skip:hover {
    color: var(--red);
    background: var(--red-bg);
}

/* Pipeline run button in header */
.btn-pipeline {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
    font-size: 0.82rem;
}

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

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

/* Relevance badges */
.relevance-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.relevance-crowded {
    background: var(--red-bg);
    color: var(--red);
}

.relevance-warming {
    background: var(--yellow-bg);
    color: var(--yellow);
}

/* Crowded toggle */
.crowded-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
}

.crowded-toggle input[type="checkbox"] {
    cursor: pointer;
}

.crowded-hidden {
    color: var(--red);
    font-size: 0.78rem;
}

/* Pipeline run status */
.pipeline-status {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.status-done {
    background: var(--green-bg);
    color: var(--green);
}

.status-running {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.status-error {
    background: var(--red-bg);
    color: var(--red);
}

/* Location restriction badge */
.location-restriction {
    color: var(--red);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Applicant competition delta */
.applicant-delta {
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.2rem;
}

.delta-up {
    color: var(--red);
}

.delta-down {
    color: var(--green);
}

/* Client group badge (in digest badges) */
.badge-client-group {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #dbeafe;
    color: var(--primary);
}

/* ACT NOW urgency badge */
.badge-act-now {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #e11d48;
    color: white;
    animation: pulse-urgency 1.5s infinite;
}

@keyframes pulse-urgency {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4); }
    50% { opacity: 0.85; box-shadow: 0 0 8px 2px rgba(225, 29, 72, 0.2); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 0;
    }

    .sidebar ul { display: flex; gap: 0; }
    .sidebar .logo { display: inline; padding: 0 1rem; }

    .sidebar a {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.5rem 1rem;
    }

    .sidebar a.active {
        border-bottom-color: var(--primary);
        border-left-color: transparent;
    }

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

    .job-card-meta { flex-direction: column; gap: 0.25rem; }
    .filters form { flex-direction: column; align-items: stretch; }
    .filter-count { margin-left: 0; }
    .chat-msg { max-width: 95%; }

    /* Digest responsive */
    .digest-client-grouped { margin-left: 0.5rem; }
    .analysis-grid { grid-template-columns: 1fr; }
    .digest-title-row { flex-direction: column; gap: 0.25rem; }
    .digest-card .job-card-actions { flex-wrap: wrap; }
    .dim-pills { gap: 0.25rem; }
}
