/* GrantSherpa dashboard. Builds on /site.css tokens; the second half keeps the match, workspace,
   budget, evidence and funding-search rules this dashboard has always used. */

:root { --bg-soft: var(--panel); }
.dash-body { background: #fff; }
/* ---------------------------------------------------------------- Header */
.dash-header { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 30; }
.dash-header-inner {
  max-width: 1480px; margin: 0 auto; padding: 0 20px;
  min-height: 58px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.dash-account { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.status-pill {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.status-pill.ok { background: var(--good-bg); border-color: #b9dcc4; color: var(--good); }
.status-pill.warn { background: var(--warn-bg); border-color: #f1d98a; color: var(--warn); }
.status-pill.bad { background: var(--bad-bg); border-color: #f3b8b4; color: var(--bad); }
.status-pill.trial-pill { font-weight: 600; }
.trial-upgrade {
  background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 4px;
  font-size: 11px; font-weight: 700; padding: 2px 8px; white-space: nowrap; line-height: 1.6;
}
.trial-upgrade:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.dash-header-notes { flex: 1; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); min-width: 0; }
.dash-header-notes .note-item { white-space: nowrap; }
.dash-header-notes .note-item strong { color: var(--ink); font-weight: 600; }
.dash-header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

.dash-notice { max-width: 1440px; margin: 14px auto 0; width: calc(100% - 40px); }

/* ---------------------------------------------------------------- Sign in */
.signin-panel { padding: 48px 20px; }
.signin-card { max-width: 440px; margin: 0 auto; border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: var(--shadow); }
.signin-card h1 { font-size: 22px; }
.signin-card .signin-reason { color: var(--muted); font-size: 14.5px; margin-bottom: 18px; }
.signin-card .or-divider { margin: 16px 0; }
.signin-form { display: flex; flex-direction: column; gap: 14px; }
.signin-form .btn { margin-top: 4px; padding: 11px 18px; font-size: 15px; }
.signin-links { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; font-size: 13.5px; }
.signin-links .sep { color: var(--line-strong); }
.signin-card .notice { margin-top: 14px; }
.signin-foot { margin: 16px 0 0; font-size: 13.5px; color: var(--muted); }

/* ---------------------------------------------------------------- Email confirmation banner */
.verify-banner { background: var(--warn-bg); border-bottom: 1px solid #f1d98a; color: var(--warn); }
.verify-banner-inner { max-width: 1480px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.verify-banner .verify-text { flex: 1 1 320px; min-width: 0; overflow-wrap: anywhere; }
.verify-banner .verify-text strong { color: #6b4600; }
.verify-banner .btn.secondary { border-color: #e2c468; color: var(--warn); background: #fffaf0; }
.verify-banner .btn.secondary:hover { background: #fff; }
.verify-banner .verify-msg { flex-basis: 100%; font-size: 13px; }
.verify-banner .verify-msg.err { color: var(--bad); }
.verify-banner .dev-link { margin-top: 6px; }

/* ---------------------------------------------------------------- Layout */
.dash-layout { max-width: 1480px; margin: 0 auto; padding: 20px 20px 80px; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.dash-nav { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: 0; border-radius: 6px;
  padding: 9px 12px; text-align: left; font-size: 14px; font-weight: 500; color: var(--muted);
}
.nav-item:hover { background: var(--panel); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item .count { font-size: 11.5px; font-weight: 700; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item .count.warn { background: var(--warn-bg); border-color: #f1d98a; color: var(--warn); }
.dash-main { min-width: 0; }

.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.view-head h1 { font-size: 24px; margin-bottom: 2px; }
.view-sub { color: var(--muted); font-size: 14px; margin: 0; }
.view-tools { display: flex; gap: 8px; align-items: center; }


.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 36px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* ---------------------------------------------------------------- Settings */
.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.settings-nav a { font-size: 13px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; background: #fff; }
.settings-nav a:hover { color: var(--ink); border-color: var(--line-strong); }
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px; margin-bottom: 20px; background: #fff; }
.panel h2 { font-size: 18px; margin-bottom: 6px; scroll-margin-top: 80px; }
.panel > .hint { margin-bottom: 14px; display: block; }
.panel textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 14px; resize: vertical; }
.panel input[type="text"] { padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 14px; }
.panel .subpanel { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.panel .subpanel h3 { font-size: 15px; margin-bottom: 4px; }
.panel .subpanel > .hint { display: block; margin-bottom: 12px; }
.panel .subpanel .form-actions { margin-top: 14px; }
.panel .subpanel .form-actions .btn { text-decoration: none; }
.panel .form-section:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.panel .form-section:first-of-type { padding-top: 0; margin-top: 4px; border-top: 0; }

/* ---------------------------------------------------------------- Left nav: the existing toggle buttons, styled as nav items */
.dash-nav .nav-item[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.dash-nav .nav-sep { border-top: 1px solid var(--line); margin: 8px 4px; }
.dash-nav a.nav-item { text-decoration: none; }
.plan-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--grey-bg); color: var(--muted); white-space: nowrap; }
.plan-pill.paid { background: var(--ink); color: #fff; }
.plan-line { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }

/* ---------------------------------------------------------------- Tabs (match lists, workspace, evidence, funding search) */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 9px 13px; font-size: 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-family: inherit; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.panel h3 { margin-top: 0; font-size: 18px; }
.panel h4 { font-size: 14px; margin: 18px 0 6px; }
.link-btn { font-size: 13.5px; color: var(--accent); cursor: pointer; text-decoration: underline; background: none; border: none; padding: 0; font-family: inherit; }
.link-btn:hover { color: var(--accent-hover); }
.dev-only { margin-top: 12px; border: 1px dashed var(--warn); background: #fffaf0; color: var(--warn); border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.dev-only a { color: var(--accent-ink); word-break: break-all; }
footer.site-footer { margin-top: 30px; font-size: 11.5px; color: var(--faint); border: 0; padding: 0; }

/* ---------------------------------------------------------------- Match cards */
.match-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.match-tools input[type=search] { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13.5px; min-width: 240px; }
.match-tools select { padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 13.5px; background: #fff; }
.match { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; background: #fff; }
.match:hover { border-color: var(--line-strong); box-shadow: 0 1px 3px rgba(20, 23, 26, 0.06); }
.match.is-closed { background: #fafbfc; }
.match.is-locked { background: var(--panel); border-style: dashed; }
.match.is-locked .title { color: var(--muted); }
.match .lock-line { font-size: 13px; margin-top: 6px; }
.match .lock-line a, .match .lock-line button { font-weight: 600; }
.match .title { font-weight: 700; font-size: 15.5px; margin-bottom: 4px; }
.match .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.match .fit { font-size: 14px; margin-bottom: 8px; }
.match ul { margin: 0 0 8px; padding-left: 18px; font-size: 13px; }
.match .fits { font-size: 13px; color: var(--good); margin: 8px 0 4px; }
.match .conflicts { font-size: 13px; color: var(--bad); margin: 8px 0 4px; }
.match .unknowns { font-size: 12px; color: var(--warn); margin-bottom: 8px; }
.match .disq { font-size: 12px; color: var(--bad); margin-bottom: 8px; }
.match .reqs { font-size: 12px; color: #444; margin-bottom: 8px; }
.match .changed { font-size: 12.5px; color: #856404; background: #fffaf0; border-left: 3px solid #f1d98a; padding: 6px 10px; margin-bottom: 8px; }
.match .flag { font-size: 12.5px; padding: 6px 10px; margin-bottom: 8px; border-left: 3px solid var(--line); background: var(--panel); color: var(--muted); }
.match .note { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-style: italic; }
.match .next { font-size: 13.5px; color: #333; margin-bottom: 8px; }
.match .checked { font-size: 11px; color: #aaa; margin-bottom: 8px; }
.match .notice-link { margin-top: 10px; font-size: 13px; }
.match a { color: var(--accent); }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.actions button { font-size: 12.5px; padding: 6px 10px; border-radius: 5px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-family: inherit; }
.actions button:hover { background: var(--panel); }
.actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.actions button[disabled] { opacity: 0.6; cursor: default; }
.actions .action-error { font-size: 12px; color: var(--bad); }
.badge { margin-right: 6px; vertical-align: 1px; }

/* ---------------------------------------------------------------- Profile / settings form */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.profile-field { margin-bottom: 14px; }
.profile-field.full { grid-column: 1 / -1; }
.profile-field > label, .profile-field legend { font-size: 13.5px; font-weight: 600; display: block; margin-bottom: 4px; padding: 0; }
.profile-field fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.profile-field input[type=text], .profile-field input[type=password], .profile-field textarea, .profile-field select { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 6px; font-family: inherit; font-size: 14px; }
.profile-field textarea { resize: vertical; }
.profile-field .hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tri { display: flex; gap: 14px; flex-wrap: wrap; }
.tri label { font-weight: 400; display: inline-flex; align-items: center; gap: 6px; margin-right: 0; font-size: 13.5px; }
.field-error { font-size: 12.5px; color: var(--bad); margin-top: 4px; }
.field-error:empty { display: none; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.save-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
#profile-save-status { font-size: 13px; }
#profile-save-status.ok { color: var(--good); }
#profile-save-status.err { color: var(--bad); }
.signin-section { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.signin-section h4 { margin-top: 0; font-size: 15px; }
.signin-section .form-grid { max-width: 640px; }
.kv-line { font-size: 13.5px; margin: 0 0 8px; color: var(--muted); }
.kv-line strong { color: var(--ink); }

/* ---------------------------------------------------------------- Funder contact strip (workspace) */
.contact-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; background: var(--panel); font-size: 13.5px; }
.contact-box h5 { margin: 0 0 6px; font-size: 13.5px; }
.contact-box .cs-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-bottom: 6px; }
.contact-box .cs-row a { color: var(--accent-ink); overflow-wrap: anywhere; }
.cs-social { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 4px; text-decoration: none; background: #fff; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.cs-social:hover { color: var(--ink); border-color: var(--line-strong); }
.contact-box .cs-note { font-size: 12px; color: var(--muted); }

@media (max-width: 860px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .dash-nav .nav-sep { display: none; }
  .nav-item { padding: 7px 10px; font-size: 13px; }
}
@media (max-width: 640px) {
  .profile-grid { grid-template-columns: 1fr; }
}

/* ================================================================ Kept from the first dashboard (workspace, budget, evidence, funding search) */

.sf { font-size: 13px; margin-bottom: 8px; padding-left: 2px; }
.sf .sf-cite { color: var(--muted); font-size: 12px; display: block; margin-top: 1px; }
.sf .sf-inferred { color: var(--warn); font-size: 11px; font-weight: 600; margin-left: 4px; }
.ws-section { margin: 16px 0; }
.ws-section h4 { margin: 0 0 6px; font-size: 14px; }
.ws-empty { color: var(--muted); font-size: 13px; }
.ws-banner { border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; border: 1px solid var(--line); background: var(--bg-soft); }
.ws-banner.warn { background: #fffaf0; border-color: #f1d98a; color: #856404; }
.ws-banner.bad { background: #fdf3f2; border-color: #f3b8b4; color: var(--bad); }
.ws-banner.good { background: #eef7f1; border-color: #b9dcc4; color: var(--good); }
.conflict-row { border-left: 3px solid var(--bad); background: #fdf3f2; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.criterion-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.outline-section { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
.outline-section h5 { margin: 0 0 4px; font-size: 13.5px; }
.outline-section .placeholder { color: var(--warn); font-style: italic; font-size: 13px; }
.outline-section .draft { font-size: 13px; white-space: pre-wrap; }
.checklist-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.checklist-table th, .checklist-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.checklist-table select, .checklist-table input { font-size: 12.5px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; font-family: inherit; }
.checklist-table input[type=text] { width: 110px; }
.checklist-table input[type=date] { width: 130px; }
.fact-row { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.fact-row .fact-meta { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.doc-row { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.budget-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.budget-table th, .budget-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.budget-table select, .budget-table input { font-size: 12px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 4px; font-family: inherit; width: 100%; box-sizing: border-box; }
.budget-table input[type=text], .budget-table input[type=number] { width: 90px; }
.budget-table .desc-cell input { width: 160px; }
.budget-total-row td { font-weight: 700; border-top: 2px solid var(--ink); }
.finding-row { border-left: 3px solid var(--line); padding: 6px 10px; margin-bottom: 6px; font-size: 13px; background: var(--bg-soft); }
.finding-row.calculation_error { border-left-color: var(--bad); background: #fdf3f2; }
.finding-row.requirement_conflict { border-left-color: var(--bad); background: #fdf3f2; }
.finding-row.question_for_applicant { border-left-color: var(--warn); background: #fffaf0; }
.settings-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; font-size: 13px; }
.settings-row label { display: inline-flex; align-items: center; gap: 5px; font-weight: 400; }
.settings-row input[type=text], .settings-row input[type=date] { padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; font-size: 12.5px; }
}
/* Funding search (discovery) */
.dsc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 16px; }
.dsc-grid label { font-size: 12.5px; font-weight: 600; display: block; margin-bottom: 3px; }
.dsc-grid input, .dsc-grid select, .dsc-grid textarea, #dsc-project-form textarea { width: 100%; box-sizing: border-box; padding: 7px 8px; border: 1px solid var(--line); border-radius: 5px; font: inherit; font-size: 13px; }
.dsc-hint { font-size: 12px; color: var(--muted); }
.dsc-project { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.dsc-project.active { border-color: var(--accent); background: var(--bg-soft); }
.dsc-progress { font-size: 13px; padding: 8px 12px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--line); margin: 10px 0; }
.dsc-result { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.dsc-result h4 { margin: 0 0 4px; font-size: 15px; }
.dsc-result .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.dsc-dim { font-size: 12.5px; margin: 2px 0; }
.dsc-dim.pass::before { content: "\2713  "; color: var(--good); font-weight: 700; }
.dsc-dim.fail::before { content: "\2717  "; color: var(--bad); font-weight: 700; }
.dsc-dim.unknown::before { content: "?  "; color: var(--warn); font-weight: 700; }
.dsc-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--line); background: #fff; margin-right: 6px; }
.dsc-badge.open { border-color: #b9dcc4; color: var(--good); background: #eef7f1; }
.dsc-badge.warn { border-color: #ecd3a0; color: var(--warn); background: #fffaf0; }
.dsc-badge.bad { border-color: #f3b8b4; color: var(--bad); background: #fdf3f2; }
.dsc-ledger details { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin-bottom: 6px; font-size: 13px; }
.dsc-ledger summary { cursor: pointer; font-weight: 600; }
.dsc-ledger li { margin: 3px 0; font-size: 12.5px; }
.dsc-evidence { font-size: 12px; border-left: 3px solid var(--line); padding: 4px 8px; margin: 4px 0; background: var(--bg-soft); }
.dsc-evidence.verified { border-left-color: var(--good); }
.dsc-evidence.conflict { border-left-color: var(--bad); }
