/* =============================================================================
   AI Hiring Assistant — Design System & Styles
   ============================================================================= */

:root {
    /* Color Palette — Dark Mode (new design system) */
    --bg-primary: #0C0E14;
    --bg-secondary: #13161F;
    --bg-tertiary: #1B1F2E;
    --bg-card: #13161F;
    --bg-hover: #222638;
    --bg-input: #1B1F2E;

    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-default: rgba(255, 255, 255, 0.13);
    --border-focus: rgba(124, 111, 224, 0.5);

    --text-primary: #EDF0FA;
    --text-secondary: #8892A8;
    --text-muted: #555E72;

    --accent: #7C6FE0;
    --accent-hover: #6B5FCC;
    --accent-subtle: rgba(124, 111, 224, 0.12);
    --accent-glow: rgba(124, 111, 224, 0.18);
    --secondary: #60A5FA;
    --btn-text: #FFFFFF;

    --green: #34D399;
    --green-subtle: rgba(52, 211, 153, 0.12);
    --amber: #FBBF24;
    --amber-subtle: rgba(251, 191, 36, 0.12);
    --red: #F87171;
    --red-subtle: rgba(248, 113, 113, 0.12);
    --blue: #60A5FA;
    --blue-subtle: rgba(96, 165, 250, 0.12);

    /* Typography */
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'DM Mono', 'SF Mono', 'Fira Code', monospace;

    /* Spacing */
    --sidebar-width: 232px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
[data-theme="light"] {
    --bg-primary: #F4F5FA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F0F1F8;
    --bg-card: #FFFFFF;
    --bg-hover: #E8EAF4;
    --bg-input: #F0F1F8;

    --border-subtle: rgba(0, 0, 0, 0.07);
    --border-default: rgba(0, 0, 0, 0.13);
    --border-focus: rgba(124, 111, 224, 0.4);

    --text-primary: #111827;
    --text-secondary: #5A6478;
    --text-muted: #9AA1B4;

    --accent: #7C6FE0;
    --accent-hover: #6B5FCC;
    --accent-subtle: rgba(124, 111, 224, 0.08);
    --accent-glow: rgba(124, 111, 224, 0.1);
    --secondary: #60A5FA;
    --btn-text: #FFFFFF;

    --green-subtle: rgba(16, 185, 129, 0.1);
    --amber-subtle: rgba(245, 158, 11, 0.1);
    --red-subtle: rgba(239, 68, 68, 0.1);
    --blue-subtle: rgba(59, 130, 246, 0.1);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   Reset & Base
   ============================================================================= */

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

html {
    font-size: 15px;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

/* =============================================================================
   Sidebar
   ============================================================================= */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    backdrop-filter: blur(10px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--secondary, #00c4cc));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent), var(--secondary, #00c4cc));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: var(--font);
    font-weight: 500;
    transition: all 0.15s var(--ease);
}

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

.nav-item.active {
    background: var(--accent-subtle);
    color: var(--accent-hover);
}

.sidebar-footer {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    width: 100%;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* Sun icon visible in dark mode, moon in light */
.icon-moon {
    display: none;
}

.icon-sun {
    display: block;
    flex-shrink: 0;
}

[data-theme="light"] .icon-sun {
    display: none;
}

[data-theme="light"] .icon-moon {
    display: block;
    flex-shrink: 0;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.status-dot.online {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.status-dot.offline {
    background: var(--red);
}

/* =============================================================================
   Main Content
   ============================================================================= */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.view {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.view.active {
    display: flex;
}

.is-hidden {
    display: none !important;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.view-header h1 {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, var(--accent), var(--secondary, #00c4cc));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.btn-primary {
    background: var(--accent);
    color: var(--btn-text, white);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

.btn-danger {
    background: var(--red-subtle);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.22);
}

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

.dashboard-content {
    margin: 24px;
    height: 100%;
    overflow-y: auto;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    transition: background 0.25s, box-shadow 0.25s;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 400;
}

.stat-value {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.stat-delta {
    font-size: 11px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
}

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

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

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
}

.section-count {
    font-size: 11px;
    font-family: var(--mono);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 2px 7px;
    border-radius: 5px;
}

.section-link {
    margin-left: auto;
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
}

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

.pipeline-cols {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.pipeline-col {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 12px;
    min-height: 180px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-sm);
}

.pipeline-col:hover {
    box-shadow: var(--shadow-md);
}

.col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.col-title {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.col-count {
    font-size: 10px;
    font-family: var(--mono);
    padding: 1px 6px;
    border-radius: 4px;
}

.cand-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    margin-bottom: 7px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}

.cand-card:hover {
    border-color: var(--border-focus);
    background: var(--bg-hover);
}

.cand-name {
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 2px;
}

.cand-role {
    font-size: 11px;
    color: var(--text-secondary);
}

.cand-days {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 5px;
}

.avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    margin-right: 6px;
    flex-shrink: 0;
}

.cand-top {
    display: flex;
    align-items: center;
}

/* Status pills */
.pill {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.pill-applied {
    background: var(--blue-subtle);
    color: var(--blue, #3B82F6);
}

.pill-screen {
    background: var(--accent-subtle);
    color: var(--accent);
}

.pill-interview {
    background: var(--amber-subtle);
    color: var(--amber, #F59E0B);
}

.pill-offer {
    background: var(--green-subtle);
    color: var(--green);
}

.pill-hired {
    background: var(--green-subtle);
    color: var(--green);
}

.pill-rejected {
    background: var(--red-subtle);
    color: var(--red);
}

.pill-draft {
    background: var(--accent-subtle);
    color: var(--text-secondary);
}

.pill-closed {
    background: var(--red-subtle);
    color: var(--text-muted);
}

/* Bottom row */
.bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 30px;
}

/* Jobs table */
.dashboard-jobs-card {
    display: flex;
    flex-direction: column;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: background 0.25s;
    box-shadow: var(--shadow-sm);
}

.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title {
    font-size: 13.5px;
    font-weight: 600;
}

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

.dashboard-jobs-table th {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: left;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-tertiary);
}

.dashboard-jobs-table td {
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

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

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

.td-mono {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--text-secondary);
}

.td-role {
    font-weight: 500;
}

/* Activity feed */
.feed-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.feed-icon svg {
    width: 13px;
    height: 13px;
}

.feed-body {
    flex: 1;
}

.feed-text {
    font-size: 13px;
    line-height: 1.45;
}

.feed-text strong {
    font-weight: 600;
}

.feed-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}


/* =============================================================================
   Chat
   ============================================================================= */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 3px;
}

/* Welcome */
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    animation: fadeIn 0.5s var(--ease);
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-subtle), rgba(0, 196, 204, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 20px;
}

.welcome-message h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-message p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 600px;
}

.suggestion {
    padding: 8px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.suggestion:hover {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: slideUp 0.3s var(--ease);
    max-width: 800px;
}

.message.user {
    justify-content: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--accent), var(--secondary, #00c4cc));
    color: var(--btn-text, white);
}

.message.user .message-avatar {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    order: 2;
}

.message-content {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    max-width: 600px;
    line-height: 1.6;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.assistant .message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.message.user .message-content {
    background: var(--accent);
    color: var(--btn-text, white);
}

/* Markdown parsing overrides in assistant messages */
.markdown-body {
    white-space: normal;
    /* Override the `pre-wrap` so HTML paragraphs wrap naturally */
}

.markdown-body p {
    margin-bottom: 0.8em;
}

.markdown-body p:last-child {
    margin-bottom: 0;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 0.8em;
    padding-left: 1.5em;
}

.markdown-body li {
    margin-bottom: 0.3em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.markdown-body code {
    background: var(--bg-tertiary);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 0.85em;
}

/* Slightly more visible highlight for inline code in chat messages */
/* .message.assistant .markdown-body code {
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 0.82em;
} */

.markdown-body pre {
    background: var(--bg-tertiary);
    padding: 1em;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 0.8em;
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.markdown-body strong {
    font-weight: 600;
    color: var(--text-primary);
}

/* Base styling for markdown tables */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
    margin-bottom: 1em;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.markdown-body th {
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.markdown-body td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.88rem;
    color: var(--text-primary);
}

.markdown-body tr:last-child td {
    border-bottom: none;
}

.markdown-body tbody tr {
    transition: background 0.15s;
}

.markdown-body tbody tr:hover {
    background: var(--bg-hover);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.32s;
}

/* Input */
.chat-input-area {
    padding: 16px 32px 20px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#chat-input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 4px 0;
}

#chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--btn-text, white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease);
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.05);
}

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

.input-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-left: 4px;
}

.input-hint code {
    font-family: var(--mono);
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.7rem;
}

/* =============================================================================
   Jobs Grid
   ============================================================================= */

.card-grid {
    padding: 24px 32px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    overflow-y: auto;
    flex: 1;
}

.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s var(--ease);
    animation: fadeIn 0.3s var(--ease);
}

.job-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.job-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.job-status {
    padding: 3px 10px;
    border-radius: var(--radius-xl);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.job-status.open {
    background: var(--green-subtle);
    color: var(--green);
}

.job-status.closed {
    background: var(--red-subtle);
    color: var(--red);
}

.job-status.draft {
    background: var(--amber-subtle);
    color: var(--amber);
}

.job-status.paused {
    background: var(--blue-subtle);
    color: var(--blue);
}

.job-id {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.job-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.job-card-actions .btn {
    font-size: 0.78rem;
    padding: 6px 12px;
}

/* Jobs view: applicants panel (full-width card, not nested in job card) */
.jobs-view-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.jobs-list-state {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.jobs-applicants-state {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    padding: 0 32px 24px;
}

.job-applicants-toolbar {
    flex-shrink: 0;
}

.job-applicants-toolbar .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.job-applicants-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.job-applicants-title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.job-applicants-subtitle {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 18px;
    word-break: break-all;
}

.job-applicants-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.job-applicants-content>.loading-state,
.job-applicants-content>.empty-state {
    margin: auto 0;
}

.job-applicants-table-scroll {
    flex: 1;
    min-height: 0;
    max-height: min(62vh, 680px);
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}

.job-applicants-table {
    margin: 0;
}

.job-applicants-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-card);
    box-shadow: 0 1px 0 var(--border-subtle);
}

.job-applicants-rank-col,
.job-applicants-rank-cell {
    text-align: center;
    width: 4.25rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text-secondary);
}

.job-applicants-row {
    cursor: pointer;
}

.job-applicants-row .pipeline-delete-btn {
    cursor: pointer;
}

/* Job JD dialog */
.job-jd-dialog {
    padding: 0;
    border: none;
    border-radius: var(--radius-lg);
    position: fixed;
    inset: 0;
    width: min(640px, calc(100vw - 32px));
    max-width: min(640px, 100vw - 32px);
    max-height: min(85vh, 900px);
    height: fit-content;
    margin: auto;
    box-sizing: border-box;
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}

.job-jd-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.job-jd-dialog-inner {
    display: flex;
    flex-direction: column;
    max-height: min(85vh, 900px);
}

.job-jd-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 0;
    flex-shrink: 0;
}

.job-jd-dialog-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}

.job-jd-dialog-status {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    background: var(--accent-subtle);
    color: var(--accent);
}

.job-jd-dialog-id {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 8px 20px 0;
    margin: 0;
}

.job-jd-dialog-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.job-jd-dialog-body h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 16px 0 8px;
}

.job-jd-dialog-body h3:first-child {
    margin-top: 0;
}

.job-jd-dialog-md {
    font-size: 0.88rem;
    line-height: 1.55;
}

.job-jd-dialog-reqs {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

.job-jd-dialog-footer {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-subtle);
    margin: 0;
    flex-shrink: 0;
}

.candidate-detail-dialog {
    max-width: min(520px, 100vw - 32px);
    width: min(520px, calc(100vw - 32px));
}

.candidate-detail-body .form-group {
    margin-bottom: 14px;
}

.candidate-detail-body .form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.candidate-detail-body input,
.candidate-detail-body select,
.candidate-detail-body textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-input, var(--bg-elevated));
    color: var(--text-primary);
    font-size: 0.88rem;
}

.candidate-detail-body textarea {
    resize: vertical;
    min-height: 88px;
    font-family: inherit;
}

.candidate-detail-feedback {
    font-size: 0.82rem;
    margin: 0 0 12px;
    min-height: 1.2em;
}

.candidate-detail-feedback.error {
    color: var(--danger, #e74c3c);
}

.candidate-detail-feedback.success {
    color: var(--success, #27ae60);
}

.candidate-resume-upload .resume-upload-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.candidate-resume-upload .resume-upload-row input[type="file"] {
    flex: 1;
    min-width: 140px;
    font-size: 0.8125rem;
}

#candidate-detail-resume-status {
    margin-top: 0.25rem;
    min-height: 1.25em;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

#candidate-detail-resume-status.error {
    color: var(--red);
}

.candidate-detail-screening {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.candidate-detail-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--text-primary);
}

.candidate-detail-screening-empty {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.candidate-detail-screening-body.is-hidden,
.candidate-detail-screening-empty.is-hidden {
    display: none !important;
}

.screening-score-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
}

.screening-score-big {
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1;
}

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

.screening-breakdown-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.screening-breakdown-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    align-items: center;
}

.screening-breakdown-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.screening-breakdown-pct {
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    text-align: right;
}

.screening-breakdown-track {
    grid-column: 1 / -1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-default);
    overflow: hidden;
}

.screening-breakdown-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    min-width: 0;
    transition: width 0.2s var(--ease);
}

.screening-weights-note {
    margin: 0 0 12px;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.screening-reasoning-block {
    margin-bottom: 12px;
}

.screening-reasoning-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.screening-reasoning-text {
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.screening-chip-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.screening-chip-group.is-hidden {
    display: none;
}

.screening-chip-group-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.screening-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.screening-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    font-size: 0.72rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.screening-chip.risk {
    background: var(--red-subtle);
    border-color: var(--border-default);
    color: var(--red);
}

.candidate-detail-readonly {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-subtle);
}

.candidate-detail-readonly p {
    margin: 6px 0;
}

.candidate-detail-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.pipeline-candidate-row {
    cursor: pointer;
}

.pipeline-candidate-row td {
    user-select: none;
}

.pipeline-candidate-row .candidate-id-cell,
.pipeline-candidate-row .pipeline-actions-cell {
    cursor: default;
    user-select: text;
}

.pipeline-actions-cell .pipeline-delete-btn {
    user-select: none;
}

/* =============================================================================
   Pipeline
   ============================================================================= */

.pipeline-content {
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

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

.pipeline-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.pipeline-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.88rem;
}

.pipeline-table tr {
    transition: background 0.15s;
}

.pipeline-table tbody tr:hover {
    background: var(--bg-hover);
}

.pipeline-score-col {
    white-space: nowrap;
}

.pipeline-duration-col {
    white-space: nowrap;
    width: 6.75rem;
}

.pipeline-duration-cell {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 0.85rem;
    vertical-align: middle;
}

.pipeline-score-cell {
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

.pipeline-score-value {
    font-weight: 600;
    color: var(--text-primary);
}

.pipeline-score-empty {
    color: var(--text-muted);
}

.pipeline-decision-hint {
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.pipeline-score-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.pipeline-score-line {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}

.pipeline-explain-wrap {
    line-height: 1.2;
}

.pipeline-explain-wrap .btn-text-link {
    font-size: 0.72rem;
}

.pipeline-actions-cell {
    white-space: nowrap;
    vertical-align: middle;
}

.pipeline-delete-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
}

/* Base (dark mode default) — filled */
.status-pill {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1.5px solid transparent;
    display: inline-block;
}

.status-pill.applied {
    background: rgba(79, 126, 247, 0.18);
    color: #6b9bff;
}

.status-pill.interview {
    background: rgba(124, 106, 245, 0.18);
    color: #a594f9;
}

.status-pill.screening {
    background: rgba(212, 134, 10, 0.18);
    color: #f0a832;
}

.status-pill.offer {
    background: rgba(26, 158, 92, 0.18);
    color: #34c47c;
}

.status-pill.hired {
    background: rgba(26, 158, 92, 0.18);
    color: #34c47c;
}

.status-pill.rejected {
    background: rgba(217, 79, 79, 0.18);
    color: #f07070;
}

/* Light mode — outlined, no fill */
[data-theme="light"] .status-pill {
    background: transparent;
}

[data-theme="light"] .status-pill.applied {
    color: #3b6de8;
    border-color: #3b6de8;
}

[data-theme="light"] .status-pill.interview {
    color: #6355d4;
    border-color: #6355d4;
}

[data-theme="light"] .status-pill.screening {
    color: #b36b00;
    border-color: #b36b00;
}

[data-theme="light"] .status-pill.offer {
    color: #157a46;
    border-color: #157a46;
}

[data-theme="light"] .status-pill.hired {
    color: #157a46;
    border-color: #157a46;
}

[data-theme="light"] .status-pill.rejected {
    color: #c0392b;
    border-color: #c0392b;
}

.candidate-id-cell {
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.candidate-id-cell:hover {
    color: var(--accent);
    text-decoration: underline dotted;
}

/* =============================================================================
   Loading & Empty States
   ============================================================================= */

.loading-state,
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
    font-size: 0.9rem;
    grid-column: 1 / -1;
}

/* =============================================================================
   Animations
   ============================================================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* =============================================================================
   Workspace (main + quick panel)
   ============================================================================= */

.workspace {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-width: 0;
    min-height: 0;
}

.quick-panel {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    padding: 20px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: width 0.2s var(--ease), padding 0.2s var(--ease);
}

.quick-panel-header-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    flex-shrink: 0;
}

.quick-panel-toggle-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.2s var(--ease);
}

.quick-panel-toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.quick-panel-toggle-icon {
    display: block;
    transition: transform 0.2s var(--ease);
}

/* Collapsed: chevron points left (expand) */
.workspace.quick-panel-collapsed .quick-panel-toggle-btn.is-collapsed .quick-panel-toggle-icon {
    transform: rotate(180deg);
}

.quick-panel-heading {
    flex: 1;
    min-width: 0;
}

.quick-panel-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workspace.quick-panel-collapsed .quick-panel {
    width: 48px;
    padding: 16px 8px;
}

.workspace.quick-panel-collapsed .quick-panel-header-row {
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.workspace.quick-panel-collapsed .quick-panel-heading,
.workspace.quick-panel-collapsed .quick-panel-body {
    display: none;
}

.workspace.quick-panel-collapsed .quick-panel {
    overflow-y: hidden;
}

.quick-panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.quick-panel-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.quick-actions-root {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.quick-actions-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-actions-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--border-subtle);
}

.quick-actions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-action-btn {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.quick-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Add-candidate form */
.form-page {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px 40px;
}

.card-form {
    max-width: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px 28px 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group .req {
    color: var(--accent);
}

.form-group .optional {
    font-weight: 400;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

.form-actions {
    margin-top: 24px;
}

.form-feedback {
    margin-top: 16px;
    font-size: 0.85rem;
    min-height: 1.25em;
}

.form-feedback.success {
    color: var(--green);
}

.form-feedback.error {
    color: var(--red);
}

.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* JD Builder */
.jd-builder-page {
    padding-bottom: 48px;
}

.jd-builder-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr);
    gap: 24px;
    align-items: start;
    max-width: 1200px;
}

.jd-builder-card,
.jd-preview-card {
    max-width: none;
}

.jd-builder-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.jd-builder-card .jd-builder-section-title:not(:first-child) {
    margin-top: 28px;
}

.jd-filter-wrap {
    margin-bottom: 12px;
}

.jd-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 48px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.jd-chip {
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

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

.jd-chip[data-state="must"] {
    background: var(--green-subtle);
    border-color: rgba(34, 197, 94, 0.35);
    color: var(--green);
    font-weight: 500;
}

.jd-chip[data-state="nice"] {
    background: var(--blue-subtle);
    border-color: rgba(59, 130, 246, 0.35);
    color: var(--blue);
    font-weight: 500;
}

.jd-chip.jd-chip-hidden {
    display: none;
}

.jd-custom-row {
    display: flex;
    gap: 10px;
}

.jd-custom-row input {
    flex: 1;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
}

.jd-large-textarea {
    font-size: 0.85rem;
    line-height: 1.5;
    font-family: var(--font);
}

.jd-builder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.jd-bias-banner {
    margin-top: 14px;
    border-radius: var(--radius-md);
    border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--border-default));
    background: color-mix(in srgb, var(--amber) 12%, var(--bg-card));
    color: var(--text-primary);
}

.jd-bias-banner.is-hidden {
    display: none !important;
}

.jd-bias-banner-inner {
    padding: 14px 16px;
}

.jd-bias-banner-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.jd-bias-banner-summary {
    margin: 0 0 6px;
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.jd-bias-banner-note {
    margin: 0 0 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.jd-bias-flag-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.jd-bias-flag-item {
    margin-bottom: 12px;
}

.jd-bias-flag-item:last-child {
    margin-bottom: 0;
}

.jd-bias-flag-phrase {
    display: inline-block;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 8px;
}

.jd-bias-flag-meta {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--amber);
}

.jd-bias-flag-reason {
    margin: 4px 0 2px;
}

.jd-bias-flag-suggestion {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 960px) {

    /* Stack quick panel under main on narrow screens */
    .workspace {
        flex-direction: column;
    }

    .quick-panel {
        width: 100%;
        height: auto;
        max-height: 220px;
        border-left: none;
        border-top: 1px solid var(--border-subtle);
        order: 2;
    }

    .workspace.quick-panel-collapsed .quick-panel {
        width: 100%;
        max-height: 56px;
        min-height: 56px;
        padding: 10px 12px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }

    .workspace.quick-panel-collapsed .quick-panel-header-row {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }

    .main-content {
        order: 1;
        flex: 1;
        min-height: 0;
    }

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

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .view-header {
        padding: 16px 20px;
    }

    .chat-messages {
        padding: 16px 20px;
    }

    .chat-input-area {
        padding: 12px 20px 16px;
    }

    .card-grid {
        padding: 16px 20px;
        grid-template-columns: 1fr;
    }

    .pipeline-content {
        padding: 16px 20px;
    }

    .form-page {
        padding: 16px 20px 32px;
    }

    .analytics-page {
        padding: 16px 20px 32px;
    }

    .analytics-middle {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   Analytics dashboard
   ============================================================================= */

.analytics-page {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.analytics-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
}

.analytics-job-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.analytics-job-select {
    min-width: 220px;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.88rem;
}

.analytics-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.analytics-metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s var(--ease);
}

.analytics-metric-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.analytics-metric-value {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.analytics-metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 6px;
}

.analytics-metric-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 10px;
    line-height: 1.45;
}

.analytics-middle {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 20px;
    align-items: start;
}

.analytics-chart-card,
.analytics-table-card {
    padding: 18px 20px;
}

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

.analytics-card-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 14px;
    line-height: 1.4;
}

.analytics-donut-wrap {
    position: relative;
    height: 260px;
    max-width: 100%;
}

.analytics-table-scroll {
    max-height: min(520px, 55vh);
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}

.analytics-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    font-size: 0.82rem;
    table-layout: fixed;
}

/* Prioritize readable “Why” — other columns stay compact */
.analytics-table th:nth-child(1),
.analytics-table td:nth-child(1) {
    width: 14%;
}

.analytics-table th:nth-child(2),
.analytics-table td:nth-child(2) {
    width: 10%;
}

.analytics-table th:nth-child(3),
.analytics-table td:nth-child(3) {
    width: 11%;
}

.analytics-table th:nth-child(4),
.analytics-table td:nth-child(4) {
    width: 6%;
}

.analytics-table th:nth-child(5),
.analytics-table td:nth-child(5) {
    width: 13%;
}

.analytics-table th:nth-child(6),
.analytics-table td:nth-child(6) {
    width: 46%;
    min-width: 280px;
}

.analytics-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 1;
}

.analytics-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

.analytics-table tr.analytics-cand-row {
    cursor: pointer;
}

.analytics-table tr.analytics-cand-row:hover {
    background: var(--bg-hover);
}

.analytics-score-main {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.analytics-subbars {
    display: flex;
    gap: 3px;
    margin-top: 6px;
    max-width: 140px;
}

.analytics-subbar {
    flex: 1;
    height: 5px;
    border-radius: 2px;
    background: var(--border-default);
    overflow: hidden;
}

.analytics-subbar>span {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
}

.analytics-decision-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-xl);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.analytics-decision-pill.shortlist {
    background: var(--green-subtle);
    color: var(--green);
}

.analytics-decision-pill.maybe {
    background: var(--amber-subtle);
    color: var(--amber);
}

.analytics-decision-pill.reject {
    background: var(--red-subtle);
    color: var(--red);
}

.analytics-decision-pill.none {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.dashboard-reasoning {
    max-width: none;
    width: 100%;
    line-height: 1.55;
    font-size: 0.84rem;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.dashboard-reasoning.is-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-text-link {
    background: none;
    border: none;
    padding: 0;
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    font-family: var(--font);
}

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

.analytics-insights {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.analytics-insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.analytics-insight-card h4 {
    margin: 0 0 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.analytics-insight-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.analytics-insight-metric {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   Confirm Dialog
   ============================================================================= */

.confirm-dialog-box {
    margin: auto;
    padding: 0;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    outline: none;
}

.confirm-dialog-box::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.confirm-card {
    overflow: hidden;
    position: relative;
    background-color: var(--bg-card);
    text-align: left;
    border-radius: 0.5rem;
    max-width: 290px;
    width: 290px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.confirm-header {
    padding: 1.25rem 1rem 1rem 1rem;
    background-color: var(--bg-card);
}

.confirm-image {
    display: flex;
    margin-left: auto;
    margin-right: auto;
    background-color: #fee2e2;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
}

.confirm-image svg {
    color: #dc2626;
    width: 1.5rem;
    height: 1.5rem;
}

.confirm-content {
    margin-top: 0.75rem;
    text-align: center;
}

.confirm-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5rem;
    display: block;
}

.confirm-message {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.confirm-actions {
    margin: 0.75rem 1rem;
    background-color: transparent;
}

.confirm-desactivate {
    display: inline-flex;
    padding: 0.5rem 1rem;
    background-color: #dc2626;
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 500;
    justify-content: center;
    width: 100%;
    border-radius: 0.375rem;
    border-width: 1px;
    border-color: transparent;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.confirm-cancel {
    display: inline-flex;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 500;
    justify-content: center;
    width: 100%;
    border-radius: 0.375rem;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

/* --- Toast Notifications --- */
/* --- Advanced Toast Notifications --- */
.notifications {
    position: fixed;
    top: 2rem;
    right: 1.25rem;
    z-index: 10000;
    list-style: none;
    pointer-events: none;
}

.notifications .toast {
    position: relative;
    width: 380px;
    margin-bottom: 0.75rem;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-subtle);
    pointer-events: auto;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: toast-slide-in-bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes toast-slide-in-bounce {
    0% {
        transform: translateX(100%);
    }

    40% {
        transform: translateX(-5%);
    }

    80% {
        transform: translateX(0%);
    }

    100% {
        transform: translateX(-10px);
    }
}

.notifications .toast.hide {
    animation: toast-slide-out 0.4s ease forwards;
}

@keyframes toast-slide-out {
    0% {
        transform: translateX(-10px);
    }

    40% {
        transform: translateX(0%);
    }

    80% {
        transform: translateX(-5%);
    }

    100% {
        transform: translateX(calc(100% + 20px));
        opacity: 0;
    }
}

.toast::before {
    position: absolute;
    content: "";
    height: 3px;
    width: 100%;
    bottom: 0px;
    left: 0px;
    animation: toast-progress 5s linear forwards;
}

@keyframes toast-progress {
    100% {
        width: 0%;
    }
}

.toast .column {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast .column i {
    font-size: 1.5rem;
}

.toast .column span {
    font-size: 0.95rem;
    font-weight: 500;
}

.toast i:last-child {
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.toast i:last-child:hover {
    color: var(--text-primary);
}

/* Category Colors */
.toast.success .column i {
    color: #10b981;
}

.toast.success::before {
    background: #10b981;
}

.toast.error .column i {
    color: #ef4444;
}

.toast.error::before {
    background: #ef4444;
}

.toast.warning .column i {
    color: #f59e0b;
}

.toast.warning::before {
    background: #f59e0b;
}

.toast.info .column i {
    color: var(--accent-primary);
}

.toast.info::before {
    background: var(--accent-primary);
}

[data-theme="dark"] .toast {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .toast {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.05);
}
