:root {
    --bg-color: #f4fcf1;
    --card-bg: #ffffff;
    --primary-color: #47664b;
    --primary-light: #86a789;
    --secondary-color: #d1e8d9;
    --text-main: #161d17;
    --text-muted: #4f6357;
    --border-color: #dde5da;
    --error-color: #ba1a1a;
    --warn-color: #d97706;

    --font-heading: 'Lexend', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-pill: 9999px;

    --shadow-ambient: 0 4px 20px rgba(134, 167, 137, 0.1);
    --shadow-hover:   0 8px 30px rgba(134, 167, 137, 0.15);
    --shadow-modal:   0 20px 60px rgba(0, 0, 0, 0.18);
}

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

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
}

h1, h2, h3, label { font-family: var(--font-heading); color: var(--primary-color); }
.muted { color: var(--text-muted); font-weight: 400; font-size: 0.85em; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
    text-align: center;
    margin-bottom: 48px;
}
header h1 { font-size: 32px; margin: 0 0 8px 0; }
header > p { color: var(--text-muted); margin: 0; font-size: 18px; }

/* ── User bar ──────────────────────────────────────────────────────────────── */
.user-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding: 12px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-ambient);
}
.user-info { display: flex; align-items: center; gap: 8px; }
.user-email { font-size: 14px; color: var(--text-muted); }

.role-badge {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-free  { background: var(--secondary-color); color: var(--primary-color); }
.badge-admin { background: #fef3c7; color: #92400e; }

/* Usage meter */
.usage-meter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.usage-bar-track {
    width: 80px;
    height: 6px;
    background: var(--secondary-color);
    border-radius: var(--radius-pill);
    overflow: hidden;
}
.usage-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}
.usage-bar-fill.bar-warn { background: var(--warn-color); }
.usage-bar-fill.bar-full { background: var(--error-color); }

/* Guest banner */
.guest-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding: 10px 20px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-pill);
    font-size: 14px;
    color: #92400e;
}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
}
.tab-btn {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -2px;
}
.tab-btn:hover { color: var(--primary-color); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }

/* ── Auth Modal ────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-modal);
    position: relative;
    animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-close {
    position: absolute;
    top: 14px; right: 18px;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}
.modal-close:hover { color: var(--text-main); background: var(--secondary-color); }

.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    border-bottom: 2px solid var(--border-color);
}
.auth-tab {
    flex: 1;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 0;
    cursor: pointer;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.auth-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }

.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-error {
    font-size: 13px;
    color: var(--error-color);
    margin: -8px 0 12px;
    padding: 8px 12px;
    background: #fff1f1;
    border-radius: var(--radius-sm);
    border: 1px solid #fecaca;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-ambient);
    transition: box-shadow 0.3s ease;
}
.card:hover { box-shadow: var(--shadow-hover); }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.cv-section textarea {
    width: 100%;
    height: 300px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-color);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-main);
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.cv-section textarea:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(134,167,137,0.2); }

.action-row { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.input-group { margin-bottom: 24px; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 500; }
.input-group input, .input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-color);
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--text-main);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(134,167,137,0.2);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    font-family: var(--font-heading);
    font-weight: 500;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 15px;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.primary-btn { background-color: var(--primary-color); color: white; }
.primary-btn:not(:disabled):hover { background-color: var(--primary-light); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(71,102,75,0.25); }
.secondary-btn { background-color: var(--secondary-color); color: var(--primary-color); }
.secondary-btn:not(:disabled):hover { background-color: #b6ccbe; }
.example-btn { background-color: #e5ede7; }
.sm-btn { font-size: 13px; padding: 7px 16px; }

/* ── Execute section ───────────────────────────────────────────────────────── */
.execute-section { text-align: center; margin-top: 48px; }
.large-btn { font-size: 20px; padding: 18px 56px; box-shadow: 0 4px 15px rgba(71,102,75,0.3); }
.large-btn:not(:disabled):hover { box-shadow: 0 6px 20px rgba(71,102,75,0.4); }
.status-msg { font-size: 14px; color: var(--text-muted); }
.execute-status { margin-top: 16px; font-size: 16px; font-weight: 500; }
.error-msg { color: var(--error-color) !important; }

/* ── Results / Matches ─────────────────────────────────────────────────────── */
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.results-header h2 { margin: 0; }
.results-controls { display: flex; gap: 10px; align-items: center; }

.results-container { display: flex; flex-direction: column; gap: 14px; }

.match-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 22px 24px;
    background-color: var(--bg-color);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.match-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-ambient); border-color: var(--primary-light); }
.match-card h3 { margin: 0 0 8px; font-size: 16px; }
.card-snippet { color: var(--text-muted); margin: 0; font-size: 14px; line-height: 1.5; }

/* ── Non-matches panel ─────────────────────────────────────────────────────── */
.non-matches-panel { margin-top: 32px; border-top: 1px solid var(--border-color); padding-top: 24px; }
.non-matches-header h3 { margin: 0 0 16px; font-size: 15px; }
.non-matches-container { display: flex; flex-direction: column; gap: 10px; }

.non-match-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    background: #fafafa;
    font-size: 14px;
}
.nm-title { font-family: var(--font-heading); font-weight: 500; color: var(--text-main); }
.nm-company { font-weight: 400; color: var(--text-muted); }
.nm-reason { color: var(--text-muted); margin-top: 4px; font-size: 13px; }
.nm-url { display: block; margin-top: 6px; font-size: 12px; color: var(--primary-light); word-break: break-all; text-decoration: none; }
.nm-url:hover { text-decoration: underline; }

/* ── Detail view ───────────────────────────────────────────────────────────── */
.detail-header { display: flex; align-items: center; margin-bottom: 24px; border-bottom: 1px solid var(--border-color); padding-bottom: 16px; }
.match-content {
    background: #fff;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 15px;
    color: var(--text-main);
    overflow-x: auto;
    max-height: 60vh;
    overflow-y: auto;
}
.match-content h1, .match-content h2, .match-content h3 { margin-top: 0; margin-bottom: 12px; }
.match-content p { margin-bottom: 12px; }

/* ── History view ──────────────────────────────────────────────────────────── */
.history-container { display: flex; flex-direction: column; gap: 14px; }
.history-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    background: var(--bg-color);
}
.history-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.history-role { font-family: var(--font-heading); font-weight: 600; font-size: 15px; }
.history-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.history-boards { display: flex; flex-wrap: wrap; gap: 6px; }
.board-chip {
    font-size: 11px;
    padding: 2px 10px;
    background: var(--secondary-color);
    color: var(--primary-color);
    border-radius: var(--radius-pill);
}
.run-status {
    font-size: 11px;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
}
.status-done    { background: #dcfce7; color: #166534; }
.status-running { background: #fef9c3; color: #854d0e; }
.status-error   { background: #fee2e2; color: #991b1b; }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.view { display: block; }
.view.active { display: block; }

/* ── Email verification UI ─────────────────────────────────────────────────── */

/* Shown inside the auth modal after a successful registration */
.verify-notice {
    text-align: center;
    padding: 24px 8px 8px;
    animation: slideUp 0.25s ease;
}
.verify-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.verify-notice h3 {
    margin: 0 0 10px;
    font-size: 20px;
    color: var(--primary-color);
}
.verify-notice p {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Full-width banners that appear at the very top of the page */
.verify-success-banner,
.verify-error-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 14px 24px;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.verify-success-banner {
    background: #dcfce7;
    color: #166534;
    border-bottom: 1px solid #86efac;
}
.verify-error-banner {
    background: #fee2e2;
    color: #991b1b;
    border-bottom: 1px solid #fca5a5;
}
