/* ================================================================
   RecruitServer — Modern SaaS Design System
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Reset & Base --- */

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

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1e293b;
    background: #f8fafc;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: #1d4ed8;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: #0f172a;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 0.5rem; }

small { color: #64748b; font-size: 0.8125rem; }

hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1rem 0;
}

/* --- Form Controls --- */

button,
input,
textarea,
select {
    font: inherit;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5625rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

button:hover {
    background: #1d4ed8;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border-radius: 0.5rem;
    padding: 0.5625rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    background: #2563eb;
    color: #fff;
    transition: background 0.15s, box-shadow 0.15s;
}

.button-link:hover {
    background: #1d4ed8;
    color: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.button-danger {
    background: #dc2626;
}

.button-danger:hover {
    background: #b91c1c;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.2);
}

.button-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.button-secondary:hover {
    background: #e2e8f0;
    color: #334155;
    box-shadow: none;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5625rem 0.75rem;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[readonly] {
    background: #f8fafc;
    color: #64748b;
}

/* --- Site Header --- */

.site-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 3.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.app-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.app-title:hover {
    color: #0f172a;
}

.app-subtitle {
    display: none;
}

.site-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.site-actions a {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    transition: background 0.15s, color 0.15s;
}

.site-actions a:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.site-actions .button-link {
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
}

/* --- Page Shell --- */

.page-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* --- Messages --- */

.message-stack {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem 0;
}

.message-banner {
    margin-bottom: 0.5rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.message-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.message-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

/* --- App Layout (sidebar + content) --- */

.app-layout {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 240px minmax(0, 1fr);
}

.app-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.app-content {
    display: grid;
    gap: 1rem;
    align-content: start;
}

/* --- Sidebar Navigation --- */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* --- Panel / Card --- */

.panel-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.panel-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(320px, 460px) 1fr;
}

/* --- Auth Layout --- */

.auth-layout {
    display: flex;
    justify-content: center;
    padding-top: 2rem;
}

.auth-card {
    width: min(440px, 100%);
}

.auth-card h1 {
    margin-bottom: 1.25rem;
}

.narrow-layout {
    display: flex;
    justify-content: center;
}

.narrow-layout .panel-card {
    width: min(560px, 100%);
}

.social-login-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* --- Hero (Landing) --- */

.hero-section {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    align-items: start;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hero-copy h1 {
    font-size: 1.75rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
}

/* --- Stats --- */

.stats-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-value {
    margin: 0.5rem 0 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
}

/* --- Sticky Form --- */

.panel-card-form {
    position: sticky;
    top: 5rem;
}

/* --- Section / Detail Headers --- */

.panel-card-header,
.section-header,
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.detail-actions,
.control-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

/* --- Stack --- */

.stack {
    display: grid;
    gap: 0.75rem;
}

/* --- Run List / Cards --- */

.run-list {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.run-card {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    color: inherit;
}

.run-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.run-card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.run-card p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
}

.run-card small {
    display: block;
    margin-top: 0.25rem;
}

/* --- Evidence / Transcript / Profile / Candidate --- */

.evidence-item,
.transcript-item,
.profile-block {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    background: #fff;
}

.candidate-item {
    width: 100%;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.15s, background 0.15s;
}

.candidate-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.candidate-item-active {
    border-color: #2563eb;
    background: #eff6ff;
}

.candidate-item strong {
    color: #0f172a;
}

.candidate-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.evidence-item p,
.profile-block p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
}

/* --- Detail Layout --- */

.detail-layout {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
}

.detail-main {
    min-height: 60vh;
}

.detail-summary {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin: 1rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.detail-summary strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.375rem;
}

/* --- Workflow Grid --- */

.workflow-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 1rem;
}

.workflow-item {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    background: #fff;
}

.workflow-item h2 {
    margin-top: 0;
    margin-bottom: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.workflow-chip {
    margin: 0;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.workflow-chip-muted {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
}

.workflow-list {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.workflow-note {
    margin-top: 0.5rem;
    color: #d97706;
    font-size: 0.8125rem;
}

/* --- Transcript --- */

.transcript-list {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.transcript-item pre {
    white-space: pre-wrap;
    margin: 0.5rem 0 0;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #334155;
}

.transcript-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8125rem;
    color: #64748b;
}

.transcript-meta strong {
    color: #1e293b;
}

.direction-agent_to_openclaw {
    border-left: 3px solid #2563eb;
}

.direction-openclaw_to_agent {
    border-left: 3px solid #16a34a;
}

.direction-system {
    border-left: 3px solid #94a3b8;
}

/* --- Form Fields --- */

.field {
    display: grid;
    gap: 0.25rem;
}

.field > span {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.field-error {
    color: #dc2626;
    font-size: 0.8125rem;
}

.feedback-error {
    color: #dc2626;
}

/* --- Utility --- */

.muted {
    color: #64748b;
}

.empty-state {
    color: #94a3b8;
    font-size: 0.875rem;
}

.back-link {
    color: #64748b;
    font-size: 0.875rem;
    transition: color 0.15s;
}

.back-link:hover {
    color: #2563eb;
}

/* --- Status & Pills --- */

.status,
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.status-queued {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.status-active,
.status-waiting_client {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.status-completed {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.status-paused {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.status-stopped,
.status-failed {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* --- Task Status --- */

.task-status {
    margin: 0.75rem 0 0;
    padding: 0.75rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #f8fafc;
    font-size: 0.875rem;
}

.task-status p {
    margin: 0;
}

.task-status p + p {
    margin-top: 0.375rem;
}

.task-status-queued,
.task-status-running {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.task-status-failed {
    border-color: #fecaca;
    background: #fef2f2;
}

/* --- Onboarding --- */

.onboarding-grid {
    align-items: start;
}

/* --- Copy Field / Inline Actions / Meta Grid --- */

.copy-field {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.copy-field input {
    flex: 1 1 280px;
    min-width: 0;
}

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

.meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

.meta-grid .workflow-item {
    flex: 1 1 200px;
}

.copy-feedback {
    min-height: 1.2rem;
    margin: 0;
    font-size: 0.8125rem;
    color: #2563eb;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .app-sidebar .panel-card {
        min-width: 200px;
        flex-shrink: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 0.25rem;
    }

    .hero-section,
    .panel-grid,
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .panel-card-form {
        position: static;
    }

    .site-header-inner {
        flex-direction: row;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 1rem;
    }

    .site-header-inner {
        padding: 0 1rem;
    }

    h1 { font-size: 1.25rem; }
    .hero-copy h1 { font-size: 1.375rem; }
}
