/* Helping Hub Ltd. Business Development CRM */
:root {
    --hh-ink: #14212e;
    --hh-navy: #102235;
    --hh-navy-2: #18324a;
    --hh-accent: #1f7a68;
    --hh-accent-dark: #17604f;
    --hh-amber: #d98e1c;
    --hh-bg: #f4f5f2;
    --hh-surface: #ffffff;
    --hh-line: #e3e5e0;
    --hh-muted: #66717c;
    --bs-primary: var(--hh-accent);
    --bs-primary-rgb: 31, 122, 104;
    --bs-link-color: var(--hh-accent);
    --bs-link-color-rgb: 31, 122, 104;
    --bs-link-hover-color: var(--hh-accent-dark);
    --bs-body-color: var(--hh-ink);
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bs-border-color: var(--hh-line);
    --sidebar-w: 260px;
}

.btn-primary {
    --bs-btn-bg: var(--hh-accent); --bs-btn-border-color: var(--hh-accent);
    --bs-btn-hover-bg: var(--hh-accent-dark); --bs-btn-hover-border-color: var(--hh-accent-dark);
    --bs-btn-active-bg: var(--hh-accent-dark); --bs-btn-active-border-color: var(--hh-accent-dark);
    --bs-btn-disabled-bg: var(--hh-accent); --bs-btn-disabled-border-color: var(--hh-accent);
}
.pagination { --bs-pagination-active-bg: var(--hh-accent); --bs-pagination-active-border-color: var(--hh-accent); --bs-pagination-color: var(--hh-accent); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #7fb9ad; box-shadow: 0 0 0 .2rem rgba(31,122,104,.18); }
.form-check-input:checked { background-color: var(--hh-accent); border-color: var(--hh-accent); }

body.app-body { background: var(--hh-bg); }

/* ---- shell ------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: var(--hh-navy) !important; color: #c9d4de;
    display: flex; flex-direction: column;
}
@media (min-width: 992px) {
    .app-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
@media (max-width: 991.98px) {
    .app-sidebar { --bs-offcanvas-width: var(--sidebar-w); --bs-offcanvas-bg: var(--hh-navy); }
}
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
    background: var(--hh-amber); color: var(--hh-navy); font-weight: 800; letter-spacing: .02em; font-size: .9rem; flex: none;
}
.brand-text { color: #fff; font-weight: 600; line-height: 1.15; }
.brand-text small { display: block; color: #8fa3b5; font-weight: 400; font-size: .72rem; margin-top: 2px; }
.sidebar-nav { padding: .6rem .55rem; flex: 1; }
.sidebar-link {
    display: flex; align-items: center; gap: .7rem; padding: .48rem .7rem; margin-bottom: 1px;
    border-radius: 6px; color: #c9d4de; text-decoration: none; font-size: .9rem;
}
.sidebar-link .bi { font-size: 1rem; width: 1.1rem; text-align: center; color: #8fa3b5; }
.sidebar-link:hover { background: var(--hh-navy-2); color: #fff; }
.sidebar-link.active { background: rgba(31,122,104,.28); color: #fff; box-shadow: inset 3px 0 0 var(--hh-amber); }
.sidebar-link.active .bi { color: #fff; }
.phase-tag { margin-left: auto; font-size: .64rem; color: #8fa3b5; border: 1px solid rgba(143,163,181,.35); border-radius: 4px; padding: 0 .3rem; }
.sidebar-foot { padding: .9rem 1.1rem; font-size: .7rem; color: #6f8496; border-top: 1px solid rgba(255,255,255,.07); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    display: flex; align-items: center; gap: .75rem; padding: .8rem 1.5rem;
    background: var(--hh-surface); border-bottom: 1px solid var(--hh-line); position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.app-content { padding: 1.5rem; max-width: 1400px; width: 100%; }
@media (max-width: 575.98px) { .app-content, .app-topbar { padding-left: 1rem; padding-right: 1rem; } }

.user-menu { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--hh-line); }
.avatar {
    display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    background: var(--hh-navy); color: #fff; font-size: .75rem; font-weight: 600; flex: none;
}
.avatar-lg { width: 46px; height: 46px; font-size: 1.1rem; }

/* ---- components -------------------------------------------------------- */
.card { border-color: var(--hh-line); border-radius: 10px; }
.card-header { background: transparent; border-bottom-color: var(--hh-line); padding: .8rem 1rem; }
.card-footer { background: #fafaf8; border-top-color: var(--hh-line); }
.table > :not(caption) > * > * { padding: .6rem .85rem; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--hh-muted); font-weight: 600; background: #fafaf8; }

.stat-card {
    position: relative; background: var(--hh-surface); border: 1px solid var(--hh-line); border-radius: 10px;
    padding: 1rem 1.1rem; height: 100%;
}
.stat-icon { position: absolute; right: 1rem; top: .9rem; font-size: 1.15rem; color: #a8b3bc; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .82rem; color: var(--hh-muted); margin-top: .2rem; }
.stat-alert { border-color: #f0c2bd; background: #fff8f7; }
.stat-alert .stat-value { color: #b42318; }

.pipeline-row { display: grid; grid-template-columns: 170px 1fr 36px; align-items: center; gap: .75rem; padding: .22rem 0; font-size: .85rem; }
.pipeline-label { color: var(--hh-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipeline-track { height: 8px; background: #edefeb; border-radius: 4px; overflow: hidden; }
.pipeline-bar { display: block; height: 100%; width: 0; background: var(--hh-accent); border-radius: 4px; transition: width .4s ease; }
.pipeline-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 575.98px) { .pipeline-row { grid-template-columns: 120px 1fr 30px; } }

.empty-state { color: var(--hh-muted); font-size: .9rem; }
.activity-list .list-group-item { padding: .6rem 1rem; }

.perm-group { border: 1px solid var(--hh-line); border-radius: 8px; padding: .7rem .85rem; height: 100%; }
.perm-group-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--hh-muted); font-weight: 600; margin-bottom: .35rem; }
.perm-group .form-check { font-size: .88rem; margin-bottom: .2rem; }

.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; }
.country-chip { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--hh-line); border-radius: 8px; padding: .35rem .6rem; font-size: .88rem; }
.country-chip > span:first-child { flex: 1; }
.country-chip.is-off { background: #f5f5f3; color: var(--hh-muted); }
.country-chip .bi { font-size: 1.25rem; }

/* ---- guest pages ------------------------------------------------------- */
body.guest-body { background: var(--hh-navy); min-height: 100vh; }
.guest-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.guest-card { width: 100%; max-width: 400px; background: var(--hh-surface); border-radius: 12px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.guest-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.guest-foot { color: #8fa3b5; font-size: .78rem; margin-top: 1.25rem; text-align: center; }

/* ---- Phase 2: candidates ---------------------------------------------- */
.chip { display: inline-block; font-size: .78rem; padding: .12rem .5rem; margin: 0 .25rem .25rem 0; border-radius: 999px; background: #eef3f1; color: #20463d; border: 1px solid #d6e5df; }
.form-section { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--hh-muted); font-weight: 600; margin: 1.25rem 0 .75rem; padding-bottom: .35rem; border-bottom: 1px solid var(--hh-line); }
.form-section:first-of-type { margin-top: .25rem; }
.field-flag { font-size: .8rem; color: #8a5a00; background: #fff6e0; border-left: 3px solid var(--hh-amber); padding: .3rem .55rem; margin-top: .35rem; border-radius: 0 4px 4px 0; }
.form-control.is-flagged:not(.is-invalid) { border-color: #e6b34d; }
.small-mono { font-size: .82rem; }
.cv-text { white-space: pre-wrap; word-break: break-word; font-size: .78rem; line-height: 1.45; background: #fafaf8; border: 1px solid var(--hh-line); border-radius: 6px; padding: .75rem; max-height: 60vh; overflow: auto; margin: 0; }
.cv-text-full { max-height: none; font-size: .85rem; }
@media (min-width: 1200px) { .review-aside { position: sticky; top: 76px; } }
.pre-line { white-space: pre-line; }
.consent-box { border: 1px solid var(--hh-line); border-radius: 8px; padding: .9rem 1rem; background: #fbfbf9; }
.consent-box legend { float: none; width: auto; padding: 0 .35rem; margin-bottom: .25rem; }
.danger-zone summary { cursor: pointer; }
.profile-dl dt { color: var(--hh-muted); font-weight: 500; }
.filter-bar { padding: .85rem 1rem; }
button[data-busy].is-busy { pointer-events: none; opacity: .75; }

/* ---- Phase 3: research & companies ------------------------------------- */
.score-pill { min-width: 64px; text-align: center; font-weight: 700; font-size: 1.25rem; line-height: 1; padding: .45rem .6rem; border-radius: 8px; background: #eef3f1; color: #20463d; border: 1px solid #d6e5df; }
.score-pill small { font-size: .65rem; font-weight: 500; color: var(--hh-muted); margin-left: 1px; }
.score-chip { display: inline-block; min-width: 2.2rem; text-align: center; font-weight: 600; font-size: .82rem; padding: .1rem .4rem; border-radius: 6px; font-variant-numeric: tabular-nums; }
.score-big { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; font-size: 1.5rem; font-weight: 700; flex: none; }
.score-high { background: #e3f3ec; color: #17604f; border: 1px solid #bfe2d3; }
.score-mid { background: #fff3dc; color: #8a5a00; border: 1px solid #f0d9a8; }
.score-low { background: #f3f3f1; color: #5f6b75; border: 1px solid #e1e3de; }
.result-card.is-decided { opacity: .7; }
.next-action { background: #f4f8f6; border-left: 3px solid var(--hh-accent); padding: .45rem .6rem; border-radius: 0 4px 4px 0; }

/* ---- Phase 4: pipeline, matching, submissions, tasks -------------------- */
.kanban { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .75rem; align-items: flex-start; }
.kanban-col { flex: 0 0 250px; background: #ecefe9; border-radius: 10px; display: flex; flex-direction: column; max-height: 78vh; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: .6rem .75rem; font-size: .8rem; font-weight: 600; color: var(--hh-ink); }
.kanban-body { padding: 0 .5rem .5rem; overflow-y: auto; }
.kanban-card { background: var(--hh-surface); border: 1px solid var(--hh-line); border-radius: 8px; padding: .6rem .65rem; margin-bottom: .5rem; font-size: .88rem; }
.kanban-empty { color: var(--hh-muted); font-size: .8rem; text-align: center; margin: .25rem 0 .5rem; }
.ai-box { background: #f3f6fb; border-left: 3px solid #6c8ebf; padding: .5rem .65rem; border-radius: 0 4px 4px 0; }
.steps { display: flex; list-style: none; padding: 0; margin: 0; gap: .25rem; counter-reset: s; flex-wrap: wrap; }
.steps li { flex: 1 1 120px; font-size: .8rem; color: var(--hh-muted); padding: .4rem .5rem; border-top: 3px solid var(--hh-line); counter-increment: s; }
.steps li::before { content: counter(s) ". "; }
.steps li.done { border-top-color: var(--hh-accent); color: var(--hh-ink); }
.steps li.current { border-top-color: var(--hh-amber); color: var(--hh-ink); font-weight: 600; }
.task-done .fw-medium { text-decoration: line-through; color: var(--hh-muted); }
.stat-link { display: block; color: inherit; text-decoration: none; } .stat-link:hover { border-color: #b9cfc8; }

/* ---- Phase 5: email ---------------------------------------------------- */
.email-body { font-family: var(--bs-body-font-family); font-size: .92rem; line-height: 1.5; }
.email-preview { white-space: pre-wrap; word-break: break-word; font-family: var(--bs-body-font-family); font-size: .92rem; line-height: 1.55; background: #fbfbf9; border: 1px solid var(--hh-line); border-radius: 8px; padding: 1rem; margin: 0; }
.inbox-unread { background: #f4f8f6; box-shadow: inset 3px 0 0 var(--hh-accent); }

/* ---- Reports ---- */
.stat-hint { font-size: .72rem; color: var(--hh-muted); margin-top: .15rem; line-height: 1.25; }
.report-table th, .report-table td { white-space: nowrap; }
.report-table th[scope="row"] { white-space: normal; min-width: 10rem; }
.report-bar-cell { min-width: 9rem; }
.report-track { display: inline-block; vertical-align: middle; width: 5.5rem; height: .5rem; background: #edf1f3; border-radius: 4px; margin-right: .5rem; overflow: hidden; }
.report-bar { display: block; height: 100%; width: 0; background: var(--hh-accent); border-radius: 4px; transition: width .4s ease; }
.report-num { display: inline-block; min-width: 2.5rem; font-variant-numeric: tabular-nums; }
@media print {
    @page { margin: 12mm; }
    body, .app-body { background: #fff !important; }
    .app-sidebar, .app-topbar .dropdown, .app-topbar button, .no-print, .alert-dismissible .btn-close { display: none !important; }
    .app-shell, .app-main, .app-content { display: block !important; margin: 0 !important; padding: 0 !important; width: auto !important; }
    .app-topbar { position: static !important; border: 0 !important; padding: 0 0 6mm !important; }
    .card, .stat-card { box-shadow: none !important; border-color: #ccc !important; }
    .stat-card, tr, .card-header { break-inside: avoid; }
    .card-header { break-after: avoid; }
    .report-section { width: 100% !important; flex: 0 0 100% !important; max-width: 100% !important; }
    .report-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; transition: none; }
    .report-track { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    a { color: inherit !important; text-decoration: none !important; }
}

.error-detail { max-width: 46rem; }
.health-status { width: 1.4rem; text-align: center; flex-shrink: 0; }
.sidebar-foot a { color: inherit; }
.help-toc { position: sticky; top: 1rem; }
.help-body ul, .help-body ol { padding-left: 1.2rem; margin-bottom: .5rem; }
.help-body li { margin-bottom: .35rem; }
.help-body p:last-child, .help-body ul:last-child, .help-body ol:last-child { margin-bottom: 0; }
