/* CECOE Sub-Grantee Portal — forms, tables, panels and status pills. */
:where(:root) {
  --navy: #025529; --navy-dark: #0b2615; --green: #006837; --green-light: #e6f3ec;
  --amber: #f2a900; --ink: #1f2421; --muted: #55625b; --line: #e1e7e3; --bg: #f8f8f8; --card: #ffffff; --radius: 18px;
}
/* Fallback buttons for themes other than CECOE's (zero specificity: any theme rule wins). */
:where(.btn) { display: inline-block; padding: 12px 26px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; border: 2px solid transparent; cursor: pointer; line-height: 1.2; }
:where(.btn-primary) { background: var(--navy); color: #fff; }
:where(.btn-ghost-dark) { border-color: var(--navy); color: var(--navy); background: transparent; }
/* ==========================================================================
   Sub-grantee portal
   ========================================================================== */
.cecoe-portal { padding-bottom: 60px; }
.cecoe-portal h2 { color: var(--navy); font-size: 25px; margin-bottom: 8px; }
.cecoe-portal h3 { color: var(--navy); font-size: 19px; margin-bottom: 10px; }
.cecoe-portal .cecoe-sub { color: var(--muted); margin-bottom: 22px; max-width: 760px; }
.cecoe-portal-intro { color: var(--muted); margin-bottom: 24px; max-width: 820px; }
.cecoe-breadcrumb { margin-bottom: 10px; font-size: 14px; }
.cecoe-breadcrumb a { text-decoration: none; font-weight: 600; }

/* Portal navigation */
.cecoe-portal-nav { border-bottom: 2px solid var(--line); margin-bottom: 28px; }
.cecoe-portal-nav ul { list-style: none; display: flex; gap: 4px; flex-wrap: wrap; }
.cecoe-portal-nav li.is-right { margin-left: auto; }
.cecoe-portal-nav a {
  display: block; padding: 10px 16px; text-decoration: none; font-weight: 600;
  font-size: 14.5px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.cecoe-portal-nav a:hover { color: var(--green); }
.cecoe-portal-nav a.is-active { color: var(--navy); border-bottom-color: var(--amber); }

/* Status pills */
.cecoe-pill {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.cecoe-pill.tone-good { background: var(--green-light); color: #0a5c32; border: 1px solid #bfdccb; }
.cecoe-pill.tone-info { background: #e7f1fb; color: #14487f; border: 1px solid #c2d9f0; }
.cecoe-pill.tone-warn { background: #fff6e0; color: #7a5c00; border: 1px solid #f0dfae; }
.cecoe-pill.tone-bad { background: #fdeceb; color: #8a1c13; border: 1px solid #f3c9c5; }
.cecoe-pill.tone-neutral { background: #eef0f3; color: #5c6670; border: 1px solid #d7dce2; }

/* Alerts */
.cecoe-alert { border-radius: var(--radius); padding: 16px 20px; margin: 0 0 22px; font-size: 14.5px; }
.cecoe-alert strong { display: block; margin-bottom: 4px; }
.cecoe-alert p { margin: 0 0 6px; }
.cecoe-alert p:last-child, .cecoe-alert ul:last-child { margin-bottom: 0; }
.cecoe-alert ul { margin: 6px 0 0 18px; }
.cecoe-alert.is-ok { background: var(--green-light); border: 1px solid #bfdccb; color: #0a5c32; }
.cecoe-alert.is-info { background: #e7f1fb; border: 1px solid #c2d9f0; color: #14487f; }
.cecoe-alert.is-warn { background: #fff6e0; border: 1px solid #f0dfae; color: #6b5618; }
.cecoe-alert.is-error { background: #fdeceb; border: 1px solid #f3c9c5; color: #8a1c13; }

/* Panels */
.cecoe-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 26px;
}
.cecoe-panel.is-urgent { border-left: 5px solid var(--amber); }
.cecoe-panel.state-non_compliant { border-left: 5px solid #b3261e; }
.cecoe-panel.state-at_risk { border-left: 5px solid var(--amber); }
.cecoe-panel.state-compliant { border-left: 5px solid var(--green); }

/* Tables */
.cecoe-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 580px; }
.cecoe-table th {
  background: var(--navy); color: #fff; text-align: left; padding: 11px 14px;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px;
}
.cecoe-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cecoe-table tr:last-child td { border-bottom: 0; }
.cecoe-table tr.is-overdue { background: #fdf6f5; }
.cecoe-table tr.is-revision { background: #fffbf0; }
.cecoe-table small { color: var(--muted); }
.cecoe-table small.is-late { color: #b3261e; font-weight: 700; }
.cecoe-row-action { text-align: right; white-space: nowrap; }
.btn-sm {
  display: inline-block; background: var(--navy); color: #fff; text-decoration: none;
  font-weight: 700; font-size: 13px; padding: 7px 15px; border-radius: 999px;
  border: 0; cursor: pointer;
}
.btn-sm:hover { background: var(--green); color: #fff; }
.btn-ghost-dark { border-color: var(--navy); color: var(--navy); background: #fff; }
.btn-ghost-dark:hover { background: var(--green-light); }

/* Grant cards and the compliance meter */
.cecoe-grant-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.cecoe-grant-card { border: 1px solid var(--line); border-top: 4px solid var(--navy); border-radius: var(--radius); padding: 18px; }
.cecoe-grant-card.state-non_compliant { border-top-color: #b3261e; }
.cecoe-grant-card.state-at_risk { border-top-color: var(--amber); }
.cecoe-grant-card h4 { font-size: 16px; margin-bottom: 4px; }
.cecoe-grant-card h4 a { color: var(--navy); text-decoration: none; }
.cecoe-grant-card h4 a:hover { color: var(--green); }
.cecoe-grant-meta { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.cecoe-grant-status { font-size: 13.5px; margin-top: 10px; }
.cecoe-grant-status small { color: var(--muted); }
.cecoe-meter { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.cecoe-meter span { display: block; height: 100%; background: var(--green); }
.state-at_risk .cecoe-meter span { background: var(--amber); }
.state-non_compliant .cecoe-meter span { background: #b3261e; }

/* Key/value facts */
.cecoe-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.cecoe-facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.cecoe-facts dd { margin: 2px 0 0; font-weight: 600; color: var(--ink); }

/* Calls */
.cecoe-call-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 20px; }
.cecoe-call { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--amber); border-radius: var(--radius); padding: 22px; }
.cecoe-call h3 { font-size: 18px; margin-bottom: 12px; }
.cecoe-call-meta { display: grid; gap: 8px; margin-bottom: 14px; }
.cecoe-call-meta dt { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.cecoe-call-meta dd { margin: 0; font-weight: 600; font-size: 14px; }
.cecoe-call-body { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.cecoe-call-body p { margin-bottom: 10px; }

/* Sign-in */
.cecoe-signin-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: start; }
@media (max-width: 820px) { .cecoe-signin-grid { grid-template-columns: 1fr; } }
.cecoe-signin-aside { background: var(--green-light); border: 1px solid #bfdccb; border-radius: var(--radius); padding: 24px; }
.cecoe-signin-aside h3 { margin-bottom: 8px; }
.cecoe-signin-aside p { font-size: 14.5px; color: var(--muted); margin-bottom: 14px; }
.cecoe-portal form.wp-core-ui .button-primary,
.cecoe-portal #loginform input[type="submit"] {
  background: var(--amber); color: #1d1503; border: 0; border-radius: 8px;
  padding: 12px 26px; font-weight: 700; font-size: 15px; cursor: pointer;
}
.cecoe-portal #loginform p { margin-bottom: 14px; }
.cecoe-portal #loginform label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14.5px; }
.cecoe-portal #loginform input[type="text"],
.cecoe-portal #loginform input[type="password"] {
  width: 100%; max-width: 420px; padding: 11px 15px; font-size: 15px;
  border: 2px solid var(--line); border-radius: 8px;
}

/* Forms */
.cecoe-form { max-width: 980px; }
.cecoe-form.is-narrow { max-width: 560px; }
.cecoe-fs { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 22px 24px; margin-bottom: 22px; }
.cecoe-fs legend { font-weight: 700; color: var(--navy); font-size: 17px; padding: 0 8px; }
.cecoe-fs-intro { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.cecoe-field-row { margin-bottom: 20px; }
.cecoe-field-row > label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 14.5px; }
.cecoe-field-row.is-half { display: inline-block; width: calc(50% - 10px); vertical-align: top; }
.cecoe-field-row.is-half:nth-of-type(odd) { margin-right: 16px; }
@media (max-width: 680px) { .cecoe-field-row.is-half { display: block; width: 100%; margin-right: 0; } }
.cecoe-field-row input[type="text"], .cecoe-field-row input[type="email"],
.cecoe-field-row input[type="tel"], .cecoe-field-row input[type="url"],
.cecoe-field-row input[type="date"], .cecoe-field-row input[type="number"],
.cecoe-field-row input[type="password"], .cecoe-field-row select, .cecoe-field-row textarea {
  width: 100%; padding: 11px 14px; font-size: 15px; font-family: inherit; color: var(--ink);
  border: 2px solid var(--line); border-radius: 8px; background: #fff;
}
.cecoe-field-row textarea { line-height: 1.55; resize: vertical; }
.cecoe-field-row input:focus, .cecoe-field-row select:focus, .cecoe-field-row textarea:focus { border-color: var(--navy); outline: none; }
.cecoe-field-row.has-error input, .cecoe-field-row.has-error select,
.cecoe-field-row.has-error textarea, .cecoe-field-row.has-error .cecoe-repeater { border-color: #b3261e; }
.cecoe-field-row.has-error .cecoe-repeater { border: 2px solid #b3261e; border-radius: 8px; padding: 10px; }
abbr.req, .req { color: #b3261e; text-decoration: none; font-weight: 700; }
.cecoe-help { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.cecoe-error { font-size: 13.5px; color: #b3261e; font-weight: 600; margin-top: 6px; }
.cecoe-note { background: var(--green-light); border-radius: 8px; padding: 12px 16px; font-size: 14px; margin-bottom: 18px; }
.cecoe-choices { display: grid; gap: 6px; }
.cecoe-choice { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; cursor: pointer; font-weight: 400; }
.cecoe-choice input { margin-top: 4px; flex: none; }
.cecoe-wordcount { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.cecoe-wordcount.is-over { color: #b3261e; font-weight: 700; }
.cecoe-form-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 26px 0 10px; }
.cecoe-form-actions .cecoe-help { width: 100%; margin: 0; }

/* Repeater tables */
.cecoe-repeater { margin-bottom: 8px; }
.cecoe-rep-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 680px; background: #fff; }
.cecoe-rep-table th {
  background: var(--green-light); color: var(--navy); text-align: left;
  padding: 9px 10px; font-size: 12.5px; border: 1px solid var(--line);
}
.cecoe-rep-table td { border: 1px solid var(--line); padding: 6px; vertical-align: top; }
.cecoe-rep-table input, .cecoe-rep-table select, .cecoe-rep-table textarea {
  width: 100%; border: 1px solid transparent; background: transparent; padding: 6px;
  font-size: 13.5px; font-family: inherit; color: var(--ink); border-radius: 4px; resize: vertical;
}
.cecoe-rep-table input:focus, .cecoe-rep-table select:focus, .cecoe-rep-table textarea:focus {
  border-color: var(--navy); background: #fff; outline: none;
}
.cecoe-rep-table input[readonly] { background: #f5f7fa; color: var(--muted); font-weight: 600; }
.cecoe-rep-table tfoot td { background: var(--green-light); font-weight: 700; color: var(--navy); }
.cecoe-rep-actions { width: 38px; text-align: center; }
.cecoe-rep-remove {
  background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1;
  cursor: pointer; padding: 4px 6px; border-radius: 4px;
}
.cecoe-rep-remove:hover { background: #fdeceb; color: #b3261e; }
.cecoe-rep-add { margin-top: 10px; }
.cecoe-rep-table.is-readonly input, .cecoe-rep-table.is-readonly textarea { display: none; }

/* Uploads */
.cecoe-file-list { list-style: none; margin: 0 0 10px; }
.cecoe-file-list li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.cecoe-file-list li:last-child { border-bottom: 0; }
.cecoe-file-meta { color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.cecoe-file-remove { font-size: 12.5px; color: var(--muted); margin-left: 10px; cursor: pointer; }
.cecoe-files input[type="file"] { font-size: 14px; }

/* Read-only rendering */
.cecoe-ro-heading { color: var(--navy); font-size: 16px; margin: 24px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.cecoe-ro { display: grid; grid-template-columns: 260px 1fr; gap: 10px 20px; margin: 0 0 18px; font-size: 14.5px; }
@media (max-width: 680px) { .cecoe-ro { grid-template-columns: 1fr; gap: 2px 0; } .cecoe-ro dd { margin-bottom: 12px; } }
.cecoe-ro dt { font-weight: 600; color: var(--muted); }
.cecoe-ro dd { margin: 0; }

/* Callouts and summaries */
.cecoe-callout { background: var(--green-light); border: 1px solid #bfdccb; border-radius: var(--radius); padding: 20px 22px; margin: 22px 0; }
.cecoe-callout h4 { color: var(--navy); font-size: 16px; margin-bottom: 4px; }
.cecoe-summary-list { list-style: none; margin-top: 10px; }
.cecoe-summary-list li { display: flex; justify-content: space-between; gap: 20px; padding: 7px 0; border-bottom: 1px dashed #b0d4bf; font-size: 14.5px; }
.cecoe-summary-list li:last-child { border-bottom: 0; }
.cecoe-summary-list li.is-total { font-size: 17px; font-weight: 700; color: var(--navy); border-top: 2px solid #b0d4bf; margin-top: 4px; padding-top: 10px; }
.cecoe-preview { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.cecoe-preview ul { margin: 10px 0 0 20px; font-size: 14px; color: var(--muted); }
.cecoe-preview li { padding: 3px 0; }

/* ---- Budget-driven workflow (3.3) ---- */
.cecoe-steps { list-style: none; margin: 0; padding: 0; }
.cecoe-steps li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #e3e7ea; }
.cecoe-steps li:last-child { border-bottom: 0; }
.cecoe-steps li.is-done strong::before { content: "✓ "; color: #0a5c32; }
.cecoe-steps small { color: #5c6670; }
.cecoe-task-list { list-style: none; margin: 0; padding: 0; }
.cecoe-task-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0e2b6; }
.cecoe-period { margin: 18px 0 8px; }
.cecoe-period h4 { margin: 0 0 8px; font-size: 1rem; color: #006837; }
.cecoe-objective { border: 1px solid #dfe5e1; border-radius: 10px; padding: 14px; margin: 0 0 14px; background: #fbfcfb; }
.cecoe-objective .cecoe-field-row input { width: 100%; }
.cecoe-budget input[type="text"], .cecoe-budget input[type="number"], .cecoe-budget select,
.cecoe-plan input[type="number"] { width: 100%; box-sizing: border-box; }
.cecoe-budget-add { margin: 6px 0 18px; }
.cecoe-add-chooser { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; padding: 12px; border: 1px dashed #b9c4bd; border-radius: 10px; }
.cecoe-add-chooser[hidden] { display: none; }
.cecoe-act-code { font-weight: 700; color: #006837; white-space: nowrap; }
.cecoe-plan-table td, .cecoe-plan-table th { white-space: nowrap; }
.cecoe-plan-table td:first-child { white-space: normal; }
.is-over { color: #b32d2e; font-weight: 700; }
.cecoe-signsteps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 12px 0 18px; }
.cecoe-signstep { border: 1px solid #dfe5e1; border-radius: 10px; padding: 12px 14px; background: #fff; }
.cecoe-signstep form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.cecoe-staff-box { border: 2px solid #f2a900; border-radius: 10px; padding: 14px 16px; margin-top: 20px; background: #fffaf0; }
.cecoe-num-table td:not(:first-child), .cecoe-num-table th:not(:first-child) { text-align: right; white-space: nowrap; }
.cecoe-table tr.is-section td { background: #eef4fb; }
.cecoe-table tr.is-total td { background: #fff2cc; font-weight: 700; }
.cecoe-generated { margin: 8px 0 14px; }
details > summary { cursor: pointer; font-weight: 600; margin: 8px 0; }

/* ==========================================================================
   4.1 — application built on the templates, agreement, CECOE Members look
   ========================================================================== */
.cecoe-portal { --cm-bg: #f3f7f4; --cm-bd: #dfe5e1; }
.cecoe-panel, .cecoe-fs { border-radius: 22px; border-color: var(--cm-bd); }
.cecoe-alert { border-radius: 16px; border: 0; }

/* Step bar (like the membership application steps). */
.cecoe-app-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 22px; padding: 0; counter-reset: appstep; }
.cecoe-app-steps li { counter-increment: appstep; background: var(--cm-bg); border-radius: 14px; font-size: 14px; font-weight: 500; }
.cecoe-app-steps li a { display: flex; gap: 10px; align-items: center; padding: 11px 12px; color: var(--muted); text-decoration: none; border-radius: 14px; }
.cecoe-app-steps li a::before { content: counter(appstep); flex: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--navy); }
.cecoe-app-steps li.is-done a { color: var(--navy); }
.cecoe-app-steps li.is-done a::before { content: "✓"; background: var(--green); color: #fff; }
.cecoe-app-steps li.is-current { background: #c4eed0; }
.cecoe-app-steps li.is-current a { color: var(--navy); font-weight: 600; }
.cecoe-app-steps li.is-current a::before { background: var(--navy); color: #fff; }
.cecoe-app-steps li.has-problem { background: #f9dedc; }
.cecoe-app-steps li.has-problem a { color: #8c1d18; }
.cecoe-app-steps li a:hover { box-shadow: inset 0 0 0 1px var(--green); }
@media (max-width: 900px) { .cecoe-app-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.cecoe-app-step-head { margin: 0 0 14px; }
.cecoe-app-step-head h3 { color: var(--navy); font-size: 22px; margin: 0 0 2px; }
.cecoe-app-form .cecoe-form-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.96); padding: 14px 0; border-top: 1px solid var(--cm-bd); z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Objectives & activities builder. */
.cecoe-app-objective { background: var(--cm-bg); border: 0; }
.cecoe-app-objective.has-error, .cecoe-app-activity.has-error, tr.has-error td { box-shadow: inset 0 0 0 2px #e1958e; }
.cecoe-app-objective legend { font-weight: 700; color: var(--navy); }
.cecoe-app-activity { background: #fff; border-radius: 14px; padding: 12px 14px; margin: 0 0 10px; }
.cecoe-app-activity-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.cecoe-app-activity-head input { flex: 1; }
.cecoe-app-activity textarea { width: 100%; }
.cecoe-act-code { flex: none; min-width: 38px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--green); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }

/* Activity plan grid. */
.cecoe-activity-plan th.cecoe-q { text-align: center; background: var(--navy); color: #fff; }
.cecoe-activity-plan th.cecoe-m, .cecoe-activity-plan td.cecoe-m { text-align: center; padding: 4px 2px; min-width: 30px; }
.cecoe-activity-plan td.cecoe-m.is-on { background: #c4eed0; font-weight: 700; color: var(--navy); }
.cecoe-tick { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; cursor: pointer; }
.cecoe-tick input { width: 18px; height: 18px; accent-color: var(--green); }
.cecoe-activity-plan input[type="text"], .cecoe-activity-plan textarea { min-width: 120px; }

/* Budget dashboard and summary. */
.cecoe-app-dashboard h4, .cecoe-callout h4 { margin: 0 0 8px; color: var(--navy); }
.cecoe-summary-list b.is-over, [data-row="variance"].is-over, [data-plan="variance"].is-over { color: #b3261e; }
.cecoe-signature { background: #c4eed0; color: var(--navy); border-radius: 14px; padding: 12px 16px; font-weight: 600; }

/* Agreement. */
.cecoe-agreement { font-size: 15px; line-height: 1.65; max-height: 70vh; overflow: auto; }
.cecoe-agreement h4 { color: var(--navy); margin: 22px 0 6px; font-size: 15px; letter-spacing: .3px; }
.cecoe-agreement-title { text-align: center; color: var(--navy); }
.cecoe-sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
@media (max-width: 700px) { .cecoe-sign-grid { grid-template-columns: 1fr; } }
.cecoe-app-activity input[type="text"], .cecoe-app-activity textarea, .cecoe-app-objective > .cecoe-field-row textarea,
.cecoe-activity-plan input[type="text"], .cecoe-activity-plan textarea, .cecoe-forecast input, .cecoe-form .cecoe-field-row input[type="text"] {
  width: 100%; border: 1.5px solid var(--cm-bd); border-radius: 12px; padding: 9px 12px; font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
.cecoe-app-activity input[type="text"]:focus, .cecoe-app-activity textarea:focus, .cecoe-activity-plan input:focus, .cecoe-activity-plan textarea:focus, .cecoe-forecast input:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
.cecoe-app-activity-head .cecoe-row-remove { flex: none; border: 0; background: #f9dedc; color: #8c1d18; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; }
.cecoe-forecast input { min-width: 110px; }
.cecoe-repeater[data-repeater^="bud_"] .cecoe-rep-table input { padding: 7px 8px; min-width: 64px; font-size: 13.5px; }
.cecoe-repeater[data-repeater^="bud_"] .cecoe-rep-table input[data-col="total"] { text-align: right; min-width: 96px; }

/* 4.2 — Reports & documents (one file per organization) */
.cecoe-matrix th, .cecoe-matrix td { vertical-align: top; }
.cecoe-matrix tbody th small { display: block; color: var(--muted); font-weight: 400; }
.cecoe-cell small { display: block; color: var(--muted); margin-top: 4px; font-size: 12.5px; }
.cecoe-cell small.is-paid { color: var(--navy); font-weight: 600; }
.cecoe-cell.is-empty { color: #a7aaad; }
.cecoe-cell .cecoe-cell-open { display: inline-block; margin-top: 6px; font-weight: 600; }
.cecoe-cell.status-overdue { background: #fdf0ef; } .cecoe-cell.status-submitted { background: #fff8e5; } .cecoe-cell.status-accepted { background: #f0f7f2; } .cecoe-cell.status-revision { background: #fff4e5; }
.cecoe-docs { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.cecoe-doc { font-size: 12.5px; text-decoration: none; display: flex; gap: 6px; align-items: center; }
.cecoe-doc-ext { font-size: 10px; font-weight: 700; color: #fff; background: #646970; border-radius: 4px; padding: 1px 4px; min-width: 32px; text-align: center; }
.cecoe-doc-ext.ext-xlsx { background: #217346; } .cecoe-doc-ext.ext-docx { background: #2b579a; } .cecoe-doc-ext.ext-pdf { background: #b30b00; }
.cecoe-doc-more { font-size: 12px; color: var(--muted); }
.cecoe-org-facts span, .cecoe-org-setup > span { display: inline-block; margin: 0 18px 6px 0; font-size: 14px; }
.cecoe-org-setup .cecoe-docs { flex-direction: row; flex-wrap: wrap; gap: 8px 14px; }
.cecoe-org-grant h3 a { text-decoration: none; color: var(--navy); }
.cecoe-matrix tbody th { background: var(--cm-bg) !important; color: var(--navy) !important; text-transform: none; letter-spacing: 0; font-size: 14px; }
.cecoe-matrix tbody th small { color: var(--muted) !important; }

/* ==========================================================================
   4.3 — tracking, review before submit, confirmation, autosave, mobile
   ========================================================================== */
.cecoe-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 26px; }
.cecoe-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* Progress: fill in → review → sent, and the application's step bar */
.cecoe-progress-steps { list-style: none; display: flex; gap: 0; margin: 0 0 20px; padding: 0; counter-reset: pstep; }
.cecoe-progress-steps li { counter-increment: pstep; flex: 1; position: relative; padding: 8px 6px 0; font-size: 13.5px; font-weight: 600; color: var(--muted); text-align: center; border-top: 4px solid var(--line); }
.cecoe-progress-steps li::before { content: counter(pstep); display: block; width: 26px; height: 26px; line-height: 26px; margin: -21px auto 4px; border-radius: 50%; background: #fff; border: 2px solid var(--line); font-size: 12.5px; }
.cecoe-progress-steps li.is-done { border-top-color: var(--green); color: var(--navy); }
.cecoe-progress-steps li.is-done::before { content: "✓"; background: var(--green); border-color: var(--green); color: #fff; }
.cecoe-progress-steps li.is-current { color: var(--navy); }
.cecoe-progress-steps li.is-current:not(.is-done)::before { background: var(--navy); border-color: var(--navy); color: #fff; }
.cecoe-progress { margin: 0 0 14px; }
.cecoe-progress-bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.cecoe-progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--navy)); border-radius: 999px; transition: width .3s; }
.cecoe-progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }

/* Review before submit: the generated document */
.cecoe-review h3 { margin-top: 0; }
.cecoe-doc-preview { border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; padding: 18px; margin: 16px 0; max-height: 70vh; overflow: auto; }
.cecoe-doc-preview.is-document .cecoe-doc-page { background: #fff; max-width: 800px; margin: 0 auto; padding: 32px 36px; box-shadow: 0 1px 4px rgba(0,0,0,.08); font-size: 14px; line-height: 1.55; }
.cecoe-doc-page h3 { text-align: center; color: #1f4e79; }
.cecoe-doc-page h4, .cecoe-doc-page h5 { color: #1f4e79; margin: 18px 0 6px; }
.cecoe-doc-sheet { margin-bottom: 22px; }
.cecoe-doc-tab { display: inline-block; background: var(--navy); color: #fff !important; font-size: 12.5px !important; padding: 5px 14px; border-radius: 10px 10px 0 0; margin: 0 !important; }
.cecoe-doc-table { border-collapse: collapse; font-size: 12.5px; background: #fff; min-width: 100%; }
.cecoe-doc-table td, .cecoe-doc-table th { border: 1px solid #d6e0ea; padding: 5px 8px; vertical-align: top; min-width: 60px; }
.cecoe-doc-table th, .cecoe-doc-table .s-header { background: #1f4e79; color: #fff; font-weight: 700; text-align: left; }
.cecoe-doc-table .is-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cecoe-doc-table .s-title { font-size: 16px; font-weight: 700; color: #1f4e79; border: 0; }
.cecoe-doc-table .s-note { font-style: italic; color: var(--muted); border: 0; }
.cecoe-doc-table .s-total, .cecoe-doc-table .s-total_money { background: #fff2cc; font-weight: 700; }
.cecoe-doc-table .s-section { background: #ddebf7; font-weight: 700; }
.cecoe-doc-table .s-label { background: #e2efda; font-weight: 600; }
.cecoe-doc-table .s-bold { font-weight: 700; border: 0; }
.cecoe-doc-table tr.is-gap td { border: 0; height: 8px; padding: 0; }

/* Confirmation */
.cecoe-confirmation { border-top: 5px solid var(--green); text-align: left; }
.cecoe-confirm-icon { width: 54px; height: 54px; border-radius: 50%; background: var(--green); color: #fff; font-size: 28px; line-height: 54px; text-align: center; margin-bottom: 10px; }
.cecoe-next-steps { margin: 6px 0 0 20px; }
.cecoe-next-steps li { margin-bottom: 6px; }

/* Timeline */
.cecoe-timeline-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 26px 0; }
.cecoe-timeline-title { margin: 0 0 12px; color: var(--navy); font-size: 16px; }
.cecoe-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.cecoe-timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.cecoe-timeline li { position: relative; display: flex; gap: 14px; padding: 0 0 14px; font-size: 14px; }
.cecoe-tl-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: #c9d1cc; margin-top: 3px; position: relative; z-index: 1; box-shadow: 0 0 0 3px #fff; }
.cecoe-timeline .tone-good .cecoe-tl-dot { background: var(--green); }
.cecoe-timeline .tone-info .cecoe-tl-dot { background: #2f6db5; }
.cecoe-timeline .tone-warn .cecoe-tl-dot { background: var(--amber); }
.cecoe-timeline .tone-bad .cecoe-tl-dot { background: #b3261e; }
.cecoe-tl-meta { display: block; color: var(--muted); font-size: 12.5px; }
.cecoe-timeline li p { margin: 4px 0 0; background: #f6f8f7; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.cecoe-tl-ver { display: inline-block; font-size: 11.5px; font-weight: 700; background: var(--green-light); color: var(--navy); border-radius: 999px; padding: 1px 8px; }
.cecoe-versions { list-style: none; margin: 8px 0 16px; padding: 0; }
.cecoe-versions li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cecoe-versions li.is-current a { font-weight: 700; }

/* Revision: highlighted questions */
.cecoe-field-row.is-flagged { background: #fff6e0; border: 2px solid var(--amber); border-radius: 14px; padding: 12px 14px; }
.cecoe-field-row.is-flagged > label::after { content: "Please revise"; display: inline-block; margin-left: 8px; font-size: 11.5px; font-weight: 700; background: var(--amber); color: #3d2e00; border-radius: 999px; padding: 1px 9px; vertical-align: middle; }
.cecoe-flag-note { font-weight: 600; }

/* Inline validation and the error summary */
.cecoe-error-summary a { color: #8a1c13; font-weight: 600; }
.cecoe-error-summary:focus { outline: 3px solid #f3c9c5; }
.cecoe-field-row.is-target { animation: cecoe-flash 1.4s ease-out 1; }
@keyframes cecoe-flash { 0% { box-shadow: 0 0 0 4px rgba(242,169,0,.6); } 100% { box-shadow: 0 0 0 0 rgba(242,169,0,0); } }

/* Autosave indicator */
.cecoe-autosave { font-size: 13px; color: var(--muted); margin-left: auto; }
.cecoe-autosave.is-saving { color: var(--navy); }
.cecoe-autosave.is-saved::before { content: "✓ "; color: var(--green); font-weight: 700; }
.cecoe-autosave.is-error { color: #b3261e; }
.cecoe-form .cecoe-form-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.96); padding: 14px 0; border-top: 1px solid var(--line); z-index: 5; }

/* Phones (375px) */
@media (max-width: 600px) {
  .cecoe-portal h2 { font-size: 21px; }
  .cecoe-card, .cecoe-panel, .cecoe-timeline-wrap { padding: 16px; border-radius: 14px; }
  .cecoe-form-actions .btn, .cecoe-form-actions button { flex: 1 1 100%; text-align: center; }
  .cecoe-autosave { width: 100%; margin: 0; text-align: center; }
  .cecoe-doc-preview { padding: 8px; max-height: none; }
  .cecoe-doc-preview.is-document .cecoe-doc-page { padding: 16px; }
  .cecoe-app-steps { grid-template-columns: 1fr 1fr; font-size: 13px; }
  .cecoe-progress-steps li { font-size: 12px; }
  .cecoe-repeater, .cecoe-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cecoe-portal table:not(.cecoe-doc-table) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cecoe-portal-nav a { padding: 8px 10px; font-size: 13.5px; }
}

.cecoe-doc-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: -4px 0 12px; position: sticky; top: -18px; background: #fbfcfb; padding: 6px 0; z-index: 2; }
.cecoe-doc-tabs button { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.cecoe-doc-tabs button.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (max-width: 600px) {
  .cecoe-doc-preview .cecoe-table-scroll { overflow-x: auto; }
  .cecoe-doc-table { min-width: 520px; }
  .cecoe-doc-table td:first-child { min-width: 150px; }
}
