/* ===========================================================================
   Fundnation Ops Portal

   Swiss-minimal admin UI: white surfaces, hairline borders instead of shadows,
   generous whitespace, one accent colour. Inter throughout with weight doing
   the hierarchy work. Pink is reserved for primary actions, links and the
   active-nav marker - everything else is neutral, so the accent stays loud.
   =========================================================================== */

:root {
  /* ---- Accent (the only brand colour) ---- */
  --p:        #e2014d;
  --p-hover:  #c50144;
  --p-active: #a8013a;
  --p-ring:   rgba(226, 1, 77, 0.16);

  /* ---- Neutrals: true greys, no warm or blue cast ---- */
  --n0:   #ffffff;
  --n25:  #fcfcfd;
  --n50:  #f7f7f8;   /* app background */
  --n100: #f1f1f3;
  --n150: #e9e9ec;
  --n200: #e3e3e7;   /* hairlines */
  --n300: #d4d4d8;   /* a border that needs to be seen, not just felt */
  --n400: #71717a;   /* faint labels - was #9a9aa4 at 2.8:1, unreadable */
  --n500: #52525b;   /* muted text */
  --n700: #27272a;   /* body */
  --n900: #111113;   /* headings */

  /* ---- Campaign type colours: purple / green / orange ---- */
  --t-purple-bg: #f3efff;  --t-purple-fg: #5b21b6;  --t-purple: #7c3aed;
  --t-green-bg:  #eafaf1;  --t-green-fg:  #0a7d43;  --t-green:  #12a05c;
  --t-orange-bg: #fff3e6;  --t-orange-fg: #9a4f00;  --t-orange: #f97316;
  --t-grey-bg:   #f1f1f3;  --t-grey-fg:   #52525b;  --t-grey:   #9a9aa4;

  /* ---- Depth: a whisper of shadow, not a drop-shadow ---- */
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.05);
  --shadow-md: 0 2px 4px rgba(24, 24, 27, 0.05), 0 6px 16px rgba(24, 24, 27, 0.06);
  --shadow-lg: 0 12px 32px rgba(24, 24, 27, 0.10);

  /* ---- Soft status tints (pills, not solid slabs) ---- */
  --ok-bg:   #eefbf3;  --ok-fg:   #0a7d43;
  --warn-bg: #fff6e9;  --warn-fg: #9a5b00;
  --bad-bg:  #fdf0ef;  --bad-fg:  #b02a1e;

  --radius:    10px;
  --radius-lg: 14px;
  --sidebar:   240px;

  /* ---- Bootstrap bridge ---- */
  --bs-primary: #e2014d;
  --bs-primary-rgb: 226, 1, 77;
  --bs-body-bg: #ffffff;
  --bs-body-color: #3f3f46;
  --bs-emphasis-color: #18181b;
  --bs-secondary-color: #6b6b74;
  --bs-border-color: #e3e3e7;
  --bs-border-radius: 10px;
  --bs-link-color: #e2014d;
  --bs-link-color-rgb: 226, 1, 77;
  --bs-link-hover-color: #a8013a;
  --bs-body-font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-font-size: 1rem;
}

/* ------------------------------------------------------------------- Base */

/* All-white app: sidebar and canvas share one surface, separated by a single
   hairline. Greys are reserved for hover, hairlines and muted text. */
body {
  font-family: var(--bs-body-font-family);
  font-size: 1rem;             /* 16px */
  line-height: 1.6;
  background: var(--n0);
  color: var(--n700);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11';  /* disambiguated l / 1 / I */
}

h1, h2, h3, h4, h5, h6 {
  color: var(--n900);
  font-weight: 600;
  letter-spacing: -0.021em;
}

h1, .h1 { font-size: 1.625rem; }
h2, .h2 { font-size: 1.375rem; }
h3, .h3 { font-size: 1.1875rem; }

a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* Buttons are buttons even when they're anchors - never underline them. */
.btn, .btn:hover, .btn:focus,
.view-switch-item, .view-switch-item:hover,
.kcard-link, .kcard-link:hover,
.dropdown-item, .dropdown-item:hover { text-decoration: none; }

.text-secondary, .text-muted { color: var(--n500) !important; }

/* Numbers in data columns shouldn't jitter between rows. */
.tnum, table td, .stat-value { font-variant-numeric: tabular-nums; }

::selection { background: var(--p); color: #fff; }

:focus-visible {
  outline: 2px solid var(--p);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- Buttons */

.btn {
  --bs-btn-padding-y: 0.45rem;
  --bs-btn-padding-x: 0.85rem;
  --bs-btn-font-size: 0.9375rem;
  --bs-btn-font-weight: 500;
  --bs-btn-border-radius: 8px;
  --bs-btn-focus-shadow-rgb: 226, 1, 77;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-sm {
  --bs-btn-padding-y: 0.3rem;
  --bs-btn-padding-x: 0.6rem;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-border-radius: 7px;
}

.btn-primary {
  --bs-btn-bg: var(--p);
  --bs-btn-border-color: var(--p);
  --bs-btn-hover-bg: var(--p-hover);
  --bs-btn-hover-border-color: var(--p-hover);
  --bs-btn-active-bg: var(--p-active);
  --bs-btn-active-border-color: var(--p-active);
  --bs-btn-disabled-bg: var(--p);
  --bs-btn-disabled-border-color: var(--p);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
  --bs-btn-disabled-color: #fff;
}

/* The default secondary action: a quiet outlined button. */
.btn-outline-secondary,
.btn-light {
  --bs-btn-color: var(--n700);
  --bs-btn-bg: var(--n0);
  --bs-btn-border-color: var(--n200);
  --bs-btn-hover-bg: var(--n50);
  --bs-btn-hover-border-color: var(--n200);   /* unchanged on hover */
  --bs-btn-hover-color: var(--n900);
  --bs-btn-active-bg: var(--n100);
  --bs-btn-active-border-color: var(--n200);
  --bs-btn-active-color: var(--n900);
  --bs-btn-focus-shadow-rgb: 155, 155, 165;
}

.btn-outline-primary {
  --bs-btn-color: var(--p);
  --bs-btn-border-color: var(--n200);
  --bs-btn-bg: var(--n0);
  --bs-btn-hover-bg: var(--p);
  --bs-btn-hover-border-color: var(--p);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--p-active);
  --bs-btn-active-border-color: var(--p-active);
}

.btn-success {
  --bs-btn-bg: #0a7d43; --bs-btn-border-color: #0a7d43;
  --bs-btn-hover-bg: #086a39; --bs-btn-hover-border-color: #086a39;
  --bs-btn-active-bg: #075830; --bs-btn-active-border-color: #075830;
  --bs-btn-focus-shadow-rgb: 10, 125, 67;
}

.btn-warning {
  --bs-btn-bg: #fff6e9; --bs-btn-border-color: #f5dfbe;
  --bs-btn-color: #9a5b00; --bs-btn-hover-color: #7d4a00;
  --bs-btn-hover-bg: #fdefdb; --bs-btn-hover-border-color: #efd3a8;
  --bs-btn-active-bg: #fbe7c9; --bs-btn-active-border-color: #efd3a8;
  --bs-btn-focus-shadow-rgb: 154, 91, 0;
}

.btn-danger {
  --bs-btn-bg: #b02a1e; --bs-btn-border-color: #b02a1e;
  --bs-btn-hover-bg: #96241a; --bs-btn-hover-border-color: #96241a;
  --bs-btn-focus-shadow-rgb: 176, 42, 30;
}

.btn-outline-danger {
  --bs-btn-color: #b02a1e;
  --bs-btn-bg: var(--n0);
  --bs-btn-border-color: var(--n200);
  --bs-btn-hover-bg: #b02a1e;
  --bs-btn-hover-border-color: #b02a1e;
  --bs-btn-hover-color: #fff;
  --bs-btn-focus-shadow-rgb: 176, 42, 30;
}

.btn-link { --bs-btn-color: var(--p); --bs-btn-hover-color: var(--p-active); }

/* ------------------------------------------------------------------ Pills */

.badge {
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  letter-spacing: 0;
}

.pill-ok      { background: var(--ok-bg);   color: var(--ok-fg); }
.pill-warn    { background: var(--warn-bg); color: var(--warn-fg); }
.pill-bad     { background: var(--bad-bg);  color: var(--bad-fg); }
.pill-neutral { background: var(--n100);    color: #52525b; }
.pill-accent  { background: var(--p);       color: #fff; }

/* Legacy Bootstrap badge classes, softened to match */
.text-bg-primary   { background: var(--p) !important;      color: #fff !important; }
.text-bg-success   { background: var(--ok-bg) !important;  color: var(--ok-fg) !important; }
.text-bg-warning   { background: var(--warn-bg) !important; color: var(--warn-fg) !important; }
.text-bg-danger    { background: var(--bad-bg) !important; color: var(--bad-fg) !important; }
.text-bg-secondary { background: var(--n100) !important;   color: #52525b !important; }
.text-bg-light     { background: var(--n100) !important;   color: #52525b !important; }
.text-bg-dark      { background: var(--n900) !important;   color: #fff !important; }

.text-primary { color: var(--p) !important; }
.text-success { color: var(--ok-fg) !important; }
.text-warning { color: var(--warn-fg) !important; }
.text-danger  { color: var(--bad-fg) !important; }

/* ----------------------------------------------------------------- Alerts */

.alert {
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.9375rem;
  background: var(--n0);
  color: var(--n700);
}

.alert-success { background: var(--ok-bg);   border-color: #cdefdc; color: var(--ok-fg); }
.alert-warning { background: var(--warn-bg); border-color: #f5dfbe; color: var(--warn-fg); }
.alert-danger  { background: var(--bad-bg);  border-color: #f6d5d1; color: var(--bad-fg); }
.alert-info    { background: var(--n50);     border-color: var(--n200); color: var(--n700); }
.alert-light,
.alert-dark    { background: var(--n50);     border-color: var(--n200); color: var(--n700); }

/* ------------------------------------------------------------------ Cards */

.card {
  border: 1px solid var(--n200);
  border-radius: var(--radius-lg);
  background: var(--n0);
}

/* Shadows are the main source of "heaviness" - drop them entirely. */
.card.shadow-sm, .shadow-sm, .shadow { box-shadow: none !important; }

.card-body { padding: 1.25rem; }
.card-footer, .card-header { background: transparent; border-color: var(--n200); }

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--n400);
}

/* ------------------------------------------------------------- Stat tiles */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--n200);
  border: 1px solid var(--n200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stat {
  background: var(--n0);
  padding: 1.15rem 1.25rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--n900);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--n500);
  margin-top: 0.2rem;
}

.stat.is-flagged .stat-value { color: var(--p); }

/* ----------------------------------------------------------------- Tables */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--n700);
  margin-bottom: 0;
  font-size: 0.9375rem;
}

.table > thead th {
  background: transparent;
  border-bottom: 1px solid var(--n200);
  color: var(--n500);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  padding: 0.6rem 1rem;
  white-space: nowrap;
}

.table > tbody > tr > td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--n150);
  vertical-align: middle;
}

.table > tbody > tr:last-child > td { border-bottom: 0; }

.table-hover > tbody > tr:hover > * {
  background: var(--n25);
  --bs-table-accent-bg: transparent;
}

/* ------------------------------------------------------------------ Forms */

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--n700);
  margin-bottom: 0.35rem;
}

.form-control, .form-select {
  border: 1px solid var(--n200);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--n900);
  background-color: var(--n0);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--p);
  box-shadow: 0 0 0 3px var(--p-ring);
}

.form-control::placeholder { color: var(--n400); }
.form-control:disabled, .form-select:disabled { background: var(--n50); color: var(--n500); }

.form-text { font-size: 0.875rem; color: var(--n500); }

.form-check-input { border-color: var(--n400); }
.form-check-input:checked { background-color: var(--p); border-color: var(--p); }
.form-check-input:focus { border-color: var(--p); box-shadow: 0 0 0 3px var(--p-ring); }
.form-check-label { font-size: 0.9375rem; }

/* ==================================================================== Shell */

.fn-shell { min-height: 100vh; }

.fn-sidebar {
  width: var(--sidebar);
  background: var(--n0);
  border-right: 1px solid var(--n200);
}

@media (min-width: 992px) {
  .fn-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;

    /* position:fixed creates a stacking context on its own, whatever the
       z-index. That traps the System flyout's z-index inside the sidebar, so
       it can never climb over page content no matter how high it is set - the
       sidebar itself has to outrank the content. Without this, any positioned
       element in the main column (Bootstrap's .card is position:relative)
       paints over the flyout simply by coming later in the document.

       1035 sits above the sticky topbar (1030) and below Bootstrap's modal
       layer (1050+), so a dialog still covers the nav as it should. */
    z-index: 1035;
  }
  .fn-main { margin-left: var(--sidebar); }
}

.fn-brand {
  padding: 1.35rem 1.25rem 1.1rem;
}

.fn-brand img { height: 22px; width: auto; display: block; }

.fn-brand-sub {
  font-size: 0.8125rem;
  color: var(--n400);
  margin-top: 0.4rem;
}

.fn-nav {
  padding: 0.25rem 0.75rem 1rem;
  flex: 1 1 auto;
  /* visible, not auto: the System flyout opens outside the sidebar and would
     otherwise be clipped by the scroll container. */
  overflow: visible;
}

.fn-nav-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--n400);
  padding: 1.1rem 0.6rem 0.4rem;
  margin: 0;
}

.fn-nav .nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  color: var(--n700);
  font-size: 0.9375rem;
  font-weight: 450;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.fn-nav .nav-link:hover { background: var(--n50); color: var(--n900); text-decoration: none; }

/* Active state is colour and weight only - no chip, no marker bar. On an
   all-white surface those read as clutter. */
.fn-nav .nav-link.active {
  background: transparent;
  color: var(--p);
  font-weight: 600;
}

.fn-nav .nav-link.active:hover { background: var(--n50); color: var(--p); }

.fn-nav .nav-link svg { width: 17px; height: 17px; flex: none; stroke-width: 1.75; }

.fn-user {
  border-top: 1px solid var(--n200);
  padding: 0.6rem;
}

.fn-user .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  color: var(--n900);
  transition: background-color 0.15s ease;
}

.fn-user .dropdown-toggle:hover { background: var(--n50); text-decoration: none; }
.fn-user .dropdown-toggle::after { display: none; }

.fn-topbar {
  background: var(--n0);
  border-bottom: 1px solid var(--n200);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.fn-topbar img { height: 20px; width: auto; }

/* Page header block */
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin-bottom: 0.15rem; }
.page-head p { color: var(--n500); margin-bottom: 0; font-size: 0.9375rem; }

/* ---------------------------------------------------------------- Avatars */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--n100);
  color: var(--n700);
  font-weight: 600;
  font-size: 0.8125rem;
  flex: none;
  object-fit: cover;
}

.avatar-lg { width: 46px; height: 46px; font-size: 1.0625rem; }

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

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--n0);
}

.auth-card { width: 100%; max-width: 380px; }
.auth-logo { height: 26px; width: auto; }

.btn-google {
  background: var(--n0);
  border: 1px solid var(--n200);
  color: var(--n700);
  font-weight: 500;
}

.btn-google:hover { background: var(--n50); color: var(--n900); }
.btn-google svg { width: 17px; height: 17px; }

/* The primary way in. Google's mark has to stay on white, so presence comes
   from size and a lift rather than from filling it with the brand pink. */
.btn-google-lg {
  padding: 0.7rem;
  font-size: 1rem;
  border-color: var(--n300);
  box-shadow: var(--shadow-sm);
}

.btn-google-lg:hover { box-shadow: var(--shadow-md); }
.btn-google-lg svg { width: 19px; height: 19px; }

/* Password sign-in, tucked under the main button until asked for. */
.auth-alt { margin-top: 1.15rem; }

/* Flex-centred with a floor on the height: the label is small, but the thing
   you tap still has to be a comfortable target on a phone. */
.auth-alt > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: 0.875rem;
  color: var(--n500);
  border-radius: 8px;
}

.auth-alt > summary::-webkit-details-marker { display: none; }
.auth-alt > summary:hover { color: var(--p); }
.auth-alt > summary:focus-visible { outline: 2px solid var(--p-ring); outline-offset: 2px; }
.auth-alt[open] > summary { color: var(--n900); font-weight: 500; margin-bottom: 1.1rem; }
.auth-alt[open] > summary + form { border-top: 1px solid var(--n200); padding-top: 1.25rem; }

/* .auth-divider (the "or" rule between the two sign-in methods) was dropped
   when Google became the single primary button - there is nothing to divide. */

/* ------------------------------------------------------------------- Bits */

.perm-group {
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  height: 100%;
}

/* Group titles match the small-caps section labels used elsewhere. */
.perm-group h6 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--n400);
  margin-bottom: 0.75rem;
}

code, .slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
  color: var(--n500);
  background: transparent;
  padding: 0;
}

code.slug { color: var(--n500); }

.dropdown-menu {
  --bs-dropdown-border-color: var(--n200);
  --bs-dropdown-border-radius: 10px;
  --bs-dropdown-link-color: var(--n700);
  --bs-dropdown-link-hover-bg: var(--n50);
  --bs-dropdown-link-hover-color: var(--n900);
  --bs-dropdown-font-size: 0.9375rem;
  box-shadow: 0 8px 24px rgba(24, 24, 27, 0.08);
  padding: 0.3rem;
}

.dropdown-item { border-radius: 6px; padding: 0.45rem 0.6rem; }

.modal-content { border: 1px solid var(--n200); border-radius: var(--radius-lg); }
.modal-header, .modal-footer { border-color: var(--n200); padding: 1rem 1.25rem; }
.modal-body { padding: 1.25rem; }
.modal-title { font-size: 1.0625rem; }

.breadcrumb { font-size: 0.875rem; --bs-breadcrumb-divider-color: var(--n400); }
.breadcrumb-item.active { color: var(--n500); }

hr { border-color: var(--n200); opacity: 1; }

.list-group-item { border-color: var(--n150); padding-left: 0; padding-right: 0; }

/* -------------------------------------------------------- Loading states */

[aria-busy="true"] { pointer-events: none; }
a.btn[aria-busy="true"] { opacity: 0.7; }

.btn .spinner-border-sm {
  width: 0.85rem; height: 0.85rem;
  border-width: 0.14em;
  vertical-align: -0.08em;
}

.fn-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(3px);
}

.fn-overlay .spinner-border {
  color: var(--p);
  width: 2rem; height: 2rem;
  border-width: 0.18em;
}

.fn-overlay-text {
  margin-top: 0.8rem;
  font-size: 0.9375rem;
  color: var(--n500);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .spinner-border { animation-duration: 1.5s; }
}

/* ================================================================= Kanban */

.fn-wide { width: 100%; padding-left: 1.5rem; padding-right: 1.5rem; }

.kanban {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  /* Bleed to the viewport edge so the last column isn't clipped mid-scroll. */
  margin-right: -1.5rem;
  padding-right: 1.5rem;
  scrollbar-width: thin;
}

.kcol {
  flex: 0 0 272px;
  width: 272px;
  background: var(--n50);
  border: 1px solid var(--n200);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 230px);
}

.kcol-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem 0.55rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--n900);
}

.kcol-handle { cursor: grab; }
.kcol-handle:active { cursor: grabbing; }

.kcol-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kcol-count {
  flex: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--n500);
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 999px;
  padding: 0 0.45rem;
  min-width: 1.4rem;
  text-align: center;
}

.kcol-body {
  padding: 0 0.5rem 0.25rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 12px;
}

.kcol-add {
  border: 0;
  background: transparent;
  color: var(--n500);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  cursor: pointer;
}

.kcol-add:hover { background: var(--n100); color: var(--n900); }

.kcol-new { background: transparent; border-style: dashed; }

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

.kcard {
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}


.kcard-link {
  display: block;
  padding: 0.7rem 0.75rem;
  color: inherit;
  text-decoration: none;
}

.kcard-link:hover { text-decoration: none; color: inherit; }

.kcard-type { font-size: 0.75rem; margin-bottom: 0.35rem; display: inline-block; }

.kcard-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--n900);
  margin: 0 0 0.3rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.kcard-dates { font-size: 0.8125rem; color: var(--n500); }

.kcard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.8125rem;
}

.kcard-cost { font-weight: 600; color: var(--n900); font-variant-numeric: tabular-nums; }
.kcard-country { color: var(--n500); }

.kcard-pills { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.45rem; }
.kcard-pills .badge { font-size: 0.75rem; }

.kcard-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--n150);
}

.kcard-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--n500);
  font-variant-numeric: tabular-nums;
}

.kcard-badge.is-done { color: var(--ok-fg); }

.kcard-avatars { margin-left: auto; display: flex; }
.kcard-avatars .avatar-xs { width: 22px; height: 22px; font-size: 0.6875rem; margin-left: -6px; border: 2px solid var(--n0); }
.kcard-avatars .avatar-xs:first-child { margin-left: 0; }

/* Drag states */
.kcard-ghost { opacity: 0.35; }
.kcard-drag  { transform: rotate(1.5deg); }
.kcol-ghost  { opacity: 0.5; }

/* Quick add */
.kquick { padding: 0.25rem 0 0.5rem; }
.kquick-actions { display: flex; gap: 0.25rem; align-items: center; margin-top: 0.4rem; }

.kanban.is-readonly .kcard { cursor: default; }

/* ----------------------------------------------------------------- Toast */

.fn-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: var(--n900);
  color: #fff;
  font-size: 0.875rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  z-index: 2100;
  box-shadow: 0 8px 24px rgba(24, 24, 27, 0.18);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(90vw, 460px);
}

.fn-toast.is-error { background: var(--bad-fg); }
.fn-toast.is-out { opacity: 0; transform: translateX(-50%) translateY(6px); }

/* ----------------------------------------------------------- Card detail */

.feed-item { display: flex; gap: 0.65rem; padding: 0.6rem 0; border-bottom: 1px solid var(--n150); }
.feed-item:last-child { border-bottom: 0; }
.feed-body { flex: 1 1 auto; min-width: 0; font-size: 0.9375rem; }
.feed-time { font-size: 0.8125rem; color: var(--n400); white-space: nowrap; }
.feed-comment {
  background: var(--n50);
  border: 1px solid var(--n200);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin-top: 0.25rem;
  white-space: pre-wrap;
  font-size: 0.9375rem;
}
.feed-mention { color: var(--p); font-weight: 500; }

.check-row { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.9375rem; }
.check-row.is-done label { color: var(--n400); text-decoration: line-through; }

.progress-line { height: 4px; background: var(--n150); border-radius: 999px; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--ok-fg); border-radius: 999px; }

/* ------------------------------------------------------------ Card detail */

.cd-head { margin-bottom: 1.1rem; }
.cd-org { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--n500); }
.cd-title { font-size: 1.375rem; margin: 0.1rem 0 0.3rem; }
.cd-sub { font-size: 0.875rem; color: var(--n500); }

.cd-panel { border-top: 1px solid var(--n200); padding-top: 1rem; }

/* Settings read as a quiet table by default - they're set once, not edited daily. */
.cd-grid {
  display: grid;
  grid-template-columns: minmax(7.5rem, auto) 1fr;
  gap: 0;
  margin: 0;
  font-size: 0.9375rem;
}

.cd-grid dt {
  font-weight: 400;
  color: var(--n500);
  padding: 0.45rem 1rem 0.45rem 0;
  border-bottom: 1px solid var(--n150);
}

.cd-grid dd {
  margin: 0;
  padding: 0.45rem 0;
  color: var(--n900);
  font-weight: 500;
  border-bottom: 1px solid var(--n150);
}

.cd-grid dd.is-empty { color: var(--n400); font-weight: 400; }
.cd-grid dt:last-of-type, .cd-grid dd:last-of-type { border-bottom: 0; }

.cd-desc { margin-top: 1rem; }
.cd-desc-label { font-size: 0.8125rem; color: var(--n500); margin-bottom: 0.25rem; }
.cd-desc-body {
  font-size: 0.9375rem;
  background: var(--n50);
  border: 1px solid var(--n200);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  max-height: 16rem;
  overflow-y: auto;
}

.cd-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; }

.cd-activity { border-top: 1px solid var(--n200); margin-top: 1.25rem; padding-top: 1rem; }

.fn-toast.is-ok { background: var(--ok-fg); }

/* ===================================================== Type colours + depth */

.pill-purple { background: var(--t-purple-bg); color: var(--t-purple-fg); }
.pill-green  { background: var(--t-green-bg);  color: var(--t-green-fg); }
.pill-orange { background: var(--t-orange-bg); color: var(--t-orange-fg); }

.type-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: 0.05em;
  flex: none;
}
.type-purple { background: var(--t-purple); }
.type-green  { background: var(--t-green); }
.type-orange { background: var(--t-orange); }
.type-grey   { background: var(--t-grey); }

/* Cards and panels lift slightly off the page now. */
.card { box-shadow: var(--shadow-sm); }
.kcard { box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .15s ease; }
/* Lift only - a border colour change on hover read as a flicker. */
.kcard:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kcard-drag { box-shadow: var(--shadow-lg); }
.dropdown-menu { box-shadow: var(--shadow-md); }
.modal-content { box-shadow: var(--shadow-lg); }

/* A type stripe down the left edge of every card. */
.kcard { position: relative; overflow: hidden; }
.kcard::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--t-grey);
}
.kcard.t-purple::before { background: var(--t-purple); }
.kcard.t-green::before  { background: var(--t-green); }
.kcard.t-orange::before { background: var(--t-orange); }

.kcard-charity {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--n500);
  margin-bottom: 0.15rem;
}

.kcol { background: linear-gradient(180deg, var(--n50), #fbfbfc); }

/* ------------------------------------------------------------ View switch */

.view-switch {
  display: inline-flex;
  background: var(--n100);
  border-radius: 9px;
  padding: 2px;
}

.view-switch-item {
  padding: 0.3rem 0.75rem;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--n500);
  text-decoration: none;
}

.view-switch-item:hover { color: var(--n900); text-decoration: none; }

.view-switch-item.active {
  background: var(--n0);
  color: var(--n900);
  box-shadow: var(--shadow-sm);
}

.filter-panel { width: 17rem; }

/* ------------------------------------------------------------- List view */

.list-group-block { margin-bottom: 1.75rem; }

.list-group-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.list-group-head h2 { font-size: 1rem; margin: 0; }

.list-link { color: var(--n900); font-weight: 500; display: inline-flex; align-items: center; }
.list-link:hover { color: var(--p); text-decoration: none; }

/* --------------------------------------------------------------- Calendar */

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--n700);
  margin-bottom: 1rem;
}

.cal-legend-item { display: inline-flex; align-items: center; }

.cal-month { margin-bottom: 2rem; }

.cal-month-title {
  font-size: 1.0625rem;
  margin: 0 0 0.5rem;
  position: sticky;
  top: 0;
  background: var(--n0);
  padding: 0.4rem 0;
  z-index: 2;
}

.cal-month-title span { color: var(--n400); font-weight: 400; }
.cal-month-title.is-now { color: var(--p); }

.cal-dow, .cal-days, .cal-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-dow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--n400);
  padding-bottom: 0.3rem;
}

.cal-dow span { padding: 0 0.4rem; }

.cal-grid { border: 1px solid var(--n200); border-radius: var(--radius-lg); overflow: hidden; background: var(--n0); box-shadow: var(--shadow-sm); }

.cal-week { position: relative; border-bottom: 1px solid var(--n150); }
.cal-week:last-child { border-bottom: 0; }

/* A week is as tall as it needs to be: a floor for the date numbers, plus one
   row per overlapping campaign. Previously every week reserved space for the
   busiest possible one, so a quiet month was mostly empty grid. */
/* 50px is the floor - enough for the date and a comfortable click target on a
   quiet week - and each overlapping campaign adds a bar's worth on top. */
.cal-days { min-height: calc(50px + var(--lanes, 0) * 22px); }

.cal-day { border-right: 1px solid var(--n150); padding: 0.2rem 0.35rem; }
.cal-day:last-child { border-right: 0; }
.cal-day.is-out { background: var(--n25); }
.cal-day.is-out .cal-daynum { color: var(--n400); }

.cal-daynum { font-size: 0.8125rem; color: var(--n500); font-variant-numeric: tabular-nums; }

.cal-day.is-today .cal-daynum {
  background: var(--p);
  color: #fff;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  font-weight: 600;
}

/* Bars overlay the day cells, below the day numbers. */
.cal-bars {
  position: absolute;
  left: 0; right: 0; top: 1.4rem;
  gap: 2px 0;
  padding: 0 2px;
  pointer-events: none;
}

.cal-bar {
  pointer-events: auto;
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  padding: 0.1rem 0.4rem;
  margin: 0 1px 2px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.cal-bar:hover { text-decoration: none; filter: brightness(0.96); }

.cal-bar.cal-purple { background: var(--t-purple-bg); color: var(--t-purple-fg); border-left-color: var(--t-purple); }
.cal-bar.cal-green  { background: var(--t-green-bg);  color: var(--t-green-fg);  border-left-color: var(--t-green); }
.cal-bar.cal-orange { background: var(--t-orange-bg); color: var(--t-orange-fg); border-left-color: var(--t-orange); }
.cal-bar.cal-grey   { background: var(--t-grey-bg);   color: var(--t-grey-fg);   border-left-color: var(--t-grey); }

/* Runs continuing past a week edge lose the rounded cap on that side. */
.cal-bar.is-cont-start { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-color: transparent; }
.cal-bar.is-cont-end   { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.cal-sentinel { text-align: center; color: var(--n400); font-size: 0.875rem; padding: 1.5rem 0 3rem; }

/* ------------------------------------------------------- Card detail rail */

.cd-layout { display: flex; gap: 1.25rem; align-items: flex-start; border-top: 1px solid var(--n200); padding-top: 1rem; }
.cd-main { flex: 1 1 auto; min-width: 0; }

.cd-side {
  flex: 0 0 8.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: sticky;
  top: 1rem;
}

.cd-side .btn { width: 100%; justify-content: center; }
.cd-side .cd-danger { color: var(--bad-fg); border-color: #f0cfcb; }
.cd-side .cd-danger:hover { background: var(--bad-fg); border-color: var(--bad-fg); color: #fff; }

@media (max-width: 640px) {
  .cd-layout { flex-direction: column; }
  .cd-side { flex-direction: row; flex-wrap: wrap; position: static; width: 100%; }
  .cd-side .btn { width: auto; }
}

/* Third-party controls, matched to the app's inputs. */
/* TomSelect copies the original select's classes onto its own wrapper, so
   .ts-wrapper inherits .form-select and paints a second border plus Bootstrap's
   chevron around the real control - two borders, one nested in the other.
   Strip the wrapper back to a plain box; .ts-control is the field. */
.ts-wrapper.form-select {
  border: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  height: auto;
  min-height: 0;
  line-height: inherit;
}

.ts-wrapper .ts-control {
  border: 1px solid var(--n200);
  border-radius: 8px;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  min-height: calc(1.5em + 1rem + 2px);   /* matches .form-control */
  font-size: 0.9375rem;
  color: var(--n900);
  background-color: var(--n0);
  /* the chevron the wrapper used to draw */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b6b74' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 15px 11px;
}

.ts-wrapper.focus .ts-control { border-color: var(--p); box-shadow: 0 0 0 3px var(--p-ring); }
.ts-control > input { font-size: 0.9375rem; color: var(--n900); }
.ts-control > input::placeholder { color: var(--n400); }
.ts-dropdown { border-color: var(--n200); border-radius: 8px; box-shadow: var(--shadow-md); font-size: 0.9375rem; }
.ts-dropdown .active { background: var(--n50); color: var(--n900); }

.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
  background: var(--p); border-color: var(--p);
}
.flatpickr-day.today { border-color: var(--p); }

/* ------------------------------------------------------- System flyout nav */

.fn-flyout-host { position: relative; }

.fn-flyout-toggle::after {
  content: '';
  margin-left: auto;
  width: 5px; height: 5px;
  border-top: 1.5px solid var(--n400);
  border-right: 1.5px solid var(--n400);
  transform: rotate(45deg);
}

.fn-flyout {
  position: absolute;
  left: calc(100% - 0.25rem);
  top: -0.35rem;
  min-width: 12.5rem;
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 1040;

  /* Hidden but focusable-in via keyboard; opacity keeps the fade. */
  opacity: 0;
  visibility: hidden;
  transform: translateX(-4px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
}

/* Hover, keyboard focus, or tap (JS adds is-open on touch). */
.fn-flyout-host:hover > .fn-flyout,
.fn-flyout-host:focus-within > .fn-flyout,
.fn-flyout-host.is-open > .fn-flyout {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* A bridge across the gap so the pointer can travel to the panel. */
.fn-flyout::before {
  content: '';
  position: absolute;
  left: -0.5rem; top: 0; bottom: 0;
  width: 0.5rem;
}

.fn-flyout-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--n700);
  text-decoration: none;
}

.fn-flyout-link:hover { background: var(--n50); color: var(--n900); text-decoration: none; }
.fn-flyout-link.active { color: var(--p); font-weight: 600; }

/* On mobile the sidebar is a drawer - drop the flyout inline instead. */
@media (max-width: 991.98px) {
  .fn-flyout {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    border-left: 1px solid var(--n200);
    border-radius: 0;
    margin: 0.1rem 0 0.3rem 1.55rem;
    min-width: 0;
  }
  .fn-flyout-toggle::after { display: none; }
}

/* ============================================== Stacked campaign form ===== */

.form-stack { display: flex; flex-direction: column; gap: 1.25rem; }

.form-block {
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 1rem;
  background: var(--n0);
}

.form-block-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--n500);
  margin: 0 0 0.75rem;
}

.form-row + .form-row { margin-top: 0.85rem; }
.form-row .form-label { display: block; }
.form-row .form-text { margin-top: 0.3rem; }

/* ================================================= Date + time field ===== */

.date-field { position: relative; }

.date-field .date-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--n400);
  pointer-events: none;
  z-index: 2;
}

.date-field .date-icon svg { width: 100%; height: 100%; display: block; }

/* flatpickr swaps in an altInput; both need the icon gutter. */
.date-field .form-control,
.date-field .date-input {
  padding-left: 2.35rem;
  padding-right: 2.1rem;
  cursor: pointer;
  background: var(--n0);
}

.date-field .date-input::placeholder { color: var(--n400); }
.date-field:focus-within .date-icon { color: var(--p); }

.date-field .date-clear {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--n400);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  cursor: pointer;
  display: none;
  z-index: 3;
}

.date-field.has-value .date-clear { display: block; }
.date-field .date-clear:hover { background: var(--n100); color: var(--n900); }

/* The calendar panel, restyled to match the app. */
.flatpickr-calendar.fn-cal {
  font-family: var(--bs-body-font-family);
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 19rem;
  padding-bottom: 0;
}

.fn-cal .flatpickr-months { padding: 0.5rem 0 0.25rem; }
.fn-cal .flatpickr-current-month { font-size: 0.9375rem; font-weight: 600; color: var(--n900); }
.fn-cal .flatpickr-monthDropdown-months { font-weight: 600; }
.fn-cal .flatpickr-prev-month, .fn-cal .flatpickr-next-month { fill: var(--n500); padding: 0.55rem; }
.fn-cal .flatpickr-prev-month:hover svg, .fn-cal .flatpickr-next-month:hover svg { fill: var(--p); }

.fn-cal span.flatpickr-weekday {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--n400);
}

.fn-cal .flatpickr-day {
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--n700);
  height: 2.25rem;
  line-height: 2.25rem;
  max-width: 2.4rem;
}

.fn-cal .flatpickr-day:hover { background: var(--n100); border-color: transparent; }
.fn-cal .flatpickr-day.today { border-color: var(--p); color: var(--p); font-weight: 600; }

.fn-cal .flatpickr-day.selected,
.fn-cal .flatpickr-day.selected:hover {
  background: var(--p);
  border-color: var(--p);
  color: #fff;
  font-weight: 600;
}

.fn-cal .flatpickr-day.prevMonthDay,
.fn-cal .flatpickr-day.nextMonthDay { color: var(--n400); }
.fn-cal .flatpickr-day.flatpickr-disabled { color: var(--n200); }

/* Time row gets real presence rather than a cramped strip. */
.fn-cal .flatpickr-time {
  border-top: 1px solid var(--n200);
  height: auto;
  padding: 0.5rem 0;
  background: var(--n25);
}

.fn-cal .flatpickr-time input {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--n900);
  font-variant-numeric: tabular-nums;
}

.fn-cal .flatpickr-time input:hover,
.fn-cal .flatpickr-time input:focus { background: var(--n100); }
.fn-cal .flatpickr-time .flatpickr-time-separator { font-weight: 600; color: var(--n500); }

.fn-cal-actions {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem;
  border-top: 1px solid var(--n200);
}

.fn-cal-actions button {
  flex: 1 1 0;
  border: 1px solid var(--n200);
  background: var(--n0);
  border-radius: 7px;
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--n700);
  cursor: pointer;
}

.fn-cal-actions button:hover { background: var(--n50); color: var(--n900); }

/* The panel is a <body> child, so it needs to clear the modal itself. */
.flatpickr-calendar.fn-cal { z-index: 1060; }

/* flatpickr's static mode wraps the input in an inline-block; without this the
   date field collapses to its intrinsic width instead of filling the row. */
.date-field .flatpickr-wrapper { display: block; width: 100%; }
.date-field .flatpickr-wrapper > .form-control { width: 100%; }

/* ------------------------------------------------------------------ Files */

.cd-files { border-top: 1px solid var(--n200); margin-top: 1.25rem; padding-top: 1rem; }

.file-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--n150);
}

.file-row:last-child { border-bottom: 0; }

.file-ext {
  flex: none;
  width: 2.6rem;
  text-align: center;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--n500);
  background: var(--n100);
  border-radius: 6px;
  padding: 0.3rem 0;
}

.file-meta { flex: 1 1 auto; min-width: 0; }

.file-name {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--n900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name:hover { color: var(--p); text-decoration: none; }
.file-sub { display: block; font-size: 0.8125rem; color: var(--n500); }

.file-remove {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--n400);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
}

.file-remove:hover { background: var(--bad-bg); color: var(--bad-fg); }

label.is-busy { opacity: 0.6; pointer-events: none; }

/* ==================================================== Charity contacts ===== */

.row-link { font-weight: 500; color: var(--n900); }
.row-link:hover { color: var(--p); text-decoration: none; }

.empty-note { color: var(--n500); font-size: 0.9375rem; margin: 0; }

.contact-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--n200);
}

.contact-row:first-of-type { padding-top: 0; }
.contact-row:last-of-type { border-bottom: 0; padding-bottom: 0; }

.contact-main { min-width: 0; }
.contact-name { font-weight: 500; color: var(--n900); }

.contact-sub {
  font-size: 0.875rem;
  color: var(--n500);
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-sub a { color: var(--n500); }
.contact-sub a:hover { color: var(--p); text-decoration: none; }

.contact-actions {
  flex: none;
  display: flex;
  gap: 0.35rem;
}

/* Dial code sits against the number: one control, two inputs. */
.phone-field { display: flex; }
.phone-field .form-select { width: 8.5rem; flex: none; border-radius: var(--radius) 0 0 var(--radius); }
.phone-field .form-control { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }
.phone-field .form-select:focus, .phone-field .form-control:focus { position: relative; z-index: 1; }

.danger-zone {
  border-top: 1px solid var(--n200);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ================================================== Campaign checklist ===== */

.task-section {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--n500);
  margin: 1.1rem 0 0.35rem;
}

.task-section:first-of-type { margin-top: 0.25rem; }

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--n150);
}

.task-row:last-child { border-bottom: 0; }

/* Done fades but stays legible - it is still a record of what happened. */
.task-row.is-done .task-title { color: var(--n400); text-decoration: line-through; }

.task-row .task-status { flex: none; width: 9.5rem; }

.task-main { min-width: 0; flex: 1; }
.task-title { font-weight: 500; color: var(--n900); font-size: 0.9375rem; }

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--n500);
  margin-top: 0.15rem;
}

.task-detail { font-size: 0.8125rem; color: var(--n500); margin-top: 0.2rem; }

.task-due { font-variant-numeric: tabular-nums; color: var(--n700); }
.task-due.is-none { color: var(--n400); font-style: italic; }
.task-due.is-soon { color: var(--warn-fg); font-weight: 500; }

/* Overdue is the one thing on this panel that should catch the eye. */
.task-due.is-overdue {
  color: var(--bad-fg);
  font-weight: 600;
  background: var(--bad-bg);
  padding: 0.05rem 0.4rem;
  border-radius: 6px;
}

.task-actions { flex: none; }

@media (max-width: 575.98px) {
  .task-row { flex-wrap: wrap; }
  .task-row .task-status { width: 100%; order: 2; }
  .task-main { flex: 1 1 100%; order: 1; }
  .task-actions { order: 3; }
}

.task-editor {
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 1rem;
  margin-top: 1rem;
  background: var(--n25);
}

/* ==================================================== Public form pages ===== */
/* Standalone: the person filling this in is not a portal user, so none of the
   app chrome applies. Wider line length and larger controls than the admin UI
   because this is a long form filled once, often on a phone. */

.ff-body { background: var(--n50); }

.ff-wrap { max-width: 46rem; margin: 0 auto; padding: 2.5rem 1rem 4rem; }

.ff-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.ff-logo { height: 24px; width: auto; display: block; }
.ff-context { font-size: 0.875rem; color: var(--n500); text-align: right; }
.ff-context-sub { display: block; color: var(--n400); }

.ff-card {
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 575.98px) { .ff-card { padding: 1.25rem; } }

.ff-title { font-size: 1.5rem; margin: 0 0 0.5rem; }
.ff-lede { color: var(--n500); margin: 0; }
.ff-meta { font-size: 0.8125rem; color: var(--n400); }
.ff-foot { text-align: center; font-size: 0.8125rem; color: var(--n400); margin-top: 1.5rem; }

.ff-intro {
  border-left: 3px solid var(--p);
  padding: 0.1rem 0 0.1rem 0.9rem;
  margin-bottom: 1.75rem;
  color: var(--n700);
}

.ff-progress { margin-bottom: 1.75rem; }
.ff-progress-label { font-size: 0.8125rem; color: var(--n500); margin-bottom: 0.4rem; }

.ff-row + .ff-row { margin-top: 1.4rem; }
.ff-row .form-label { font-weight: 500; color: var(--n900); margin-bottom: 0.35rem; }
.ff-row .form-control, .ff-row .form-select { padding: 0.6rem 0.75rem; }

.ff-section {
  font-size: 1.125rem;
  margin: 2.25rem 0 0.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--n200);
}
.ff-row:first-child .ff-section { margin-top: 0; padding-top: 0; border-top: 0; }

.ff-note { color: var(--n500); font-size: 0.9375rem; }
.ff-note p:last-child { margin-bottom: 0; }

.ff-choices { display: flex; flex-direction: column; gap: 0.3rem; }
.ff-choices .form-check-input { margin-top: 0.3rem; }
.ff-choices .form-check-label { color: var(--n700); }
.ff-choices .form-check-input:checked { background-color: var(--p); border-color: var(--p); }

.ff-files { font-size: 0.875rem; color: var(--n500); margin: 0 0 0.4rem; padding-left: 1.1rem; }

.ff-row.is-bad .form-control, .ff-row.is-bad .form-select { border-color: var(--bad-fg); }
.ff-error, .ff-error-live { color: var(--bad-fg); font-size: 0.875rem; margin-top: 0.35rem; }

.ff-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--n200);
}

.ff-actions .btn { padding: 0.6rem 1.4rem; }

/* ------------------------------------------------- Form preview chrome ---- */
/* A bar across the top rather than a notice inside the page, so the form
   below is laid out exactly as a client would see it. */

.pv-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--n900);
  color: #fff;
  padding: 0.6rem 1rem;
}

.pv-bar-inner {
  max-width: 74rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.pv-id { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.pv-name { font-weight: 500; font-size: 0.9375rem; }
.pv-note { color: #a1a1aa; font-size: 0.8125rem; }

.pv-tools { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* Page numbers and the width toggle share one pill-group treatment. */
.pv-pages, .pv-widths {
  display: flex;
  gap: 0.15rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.15rem;
}

.pv-page, .pv-width {
  border: 0;
  background: transparent;
  color: #d4d4d8;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.4;
}

.pv-page { min-width: 1.9rem; text-align: center; }
.pv-page:hover, .pv-width:hover { color: #fff; text-decoration: none; }
.pv-page.is-on, .pv-width.is-on { background: #fff; color: var(--n900); }

@media (max-width: 575.98px) {
  .pv-note { display: none; }
  .pv-bar-inner { gap: 0.5rem; }
}

/* Phone width, for checking a form most people fill on a handset. */
.ff-wrap.is-narrow { max-width: 26rem; }
.ff-wrap.is-narrow .ff-card { padding: 1.25rem; }

/* The checklist's progress bar means "done"; a form's means "how far through",
   so it takes the brand accent rather than the green. */
/* A form's or portal's progress means "how far through", not "done", so it
   takes the brand accent rather than the checklist's green. */
.ff-progress .progress-line span,
.pt-hero .progress-line span { background: var(--p); }

/* Narrow: let the logo have its own line instead of squeezing it against the
   form name. Applies on real phones and in the preview's phone width. */
@media (max-width: 34rem) {
  .ff-head { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .ff-context { text-align: left; }
}

.ff-wrap.is-narrow .ff-head { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.ff-wrap.is-narrow .ff-context { text-align: left; }

/* ------------------------------------------------------ Client portal ----- */
/* A control centre, not a status page: the facts stay at the top, the work
   sits in the wide column, and reference material goes beside it. */

.pt-wrap { max-width: 64rem; }

.pt-notice, .pt-locked {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}

.pt-notice { background: var(--n100); color: var(--n700); border-left: 3px solid var(--p); }
.pt-locked { background: var(--warn-bg); color: var(--warn-fg); }

/* ---- the always-visible facts ---- */

.pt-hero { padding-bottom: 0; }

.pt-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.pt-hero-title { font-size: 1.5rem; margin: 0 0 0.25rem; }
.pt-hero-sub { color: var(--n500); margin: 0; font-size: 0.9375rem; }
.pt-hero-sub strong { color: var(--n900); }

.pt-ring { flex: none; text-align: right; }
.pt-ring-num { display: block; font-size: 1.75rem; font-weight: 700; color: var(--n900); line-height: 1.1; letter-spacing: -0.02em; }
.pt-ring-label { display: block; font-size: 0.75rem; color: var(--n500); text-transform: uppercase; letter-spacing: 0.06em; }

.pt-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.25rem 1.5rem;
  margin: 1.5rem -2rem 0;
  padding: 1.1rem 2rem;
  border-top: 1px solid var(--n200);
  background: var(--n25);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.pt-fact-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--n500); }
.pt-fact-value { font-size: 1rem; font-weight: 600; color: var(--n900); margin-top: 0.15rem; font-variant-numeric: tabular-nums; }
.pt-fact-sub { font-size: 0.8125rem; color: var(--n500); font-variant-numeric: tabular-nums; }
.pt-fact-value.is-overdue, .pt-fact-sub.is-overdue { color: var(--bad-fg); }
.pt-fact-value.is-soon, .pt-fact-sub.is-soon { color: var(--warn-fg); }

/* ---- headings and rows shared by both columns ---- */

.pt-heading {
  font-size: 1.0625rem;
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--n200);
}

.pt-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--n150);
}

.pt-row:last-child { border-bottom: 0; padding-bottom: 0; }
.pt-row .badge, .pt-row .btn { flex: none; margin-top: 0.1rem; }

.pt-row-main { min-width: 0; }
.pt-row-title { font-weight: 500; color: var(--n900); }
.pt-row-sub { font-size: 0.875rem; color: var(--n500); margin-top: 0.1rem; }
.pt-row-detail { font-size: 0.875rem; color: var(--n500); margin-top: 0.4rem; }
.pt-dot { margin: 0 0.3rem; color: var(--n300); }

.pt-row.is-done .pt-row-title { color: var(--n500); }

/* ---- a to-do, with its own action ---- */

.pt-task { padding: 0.95rem 0; border-bottom: 1px solid var(--n150); }
.pt-task:last-child { border-bottom: 0; padding-bottom: 0; }
.pt-task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.pt-task-main { min-width: 0; }
.pt-task .badge { flex: none; margin-top: 0.1rem; }
.pt-task-action { margin-top: 0.7rem; }
.pt-task.is-done .pt-row-title { color: var(--n500); }

.pt-due { font-variant-numeric: tabular-nums; }
.pt-due.is-overdue { color: var(--bad-fg); font-weight: 600; }
.pt-due.is-soon { color: var(--warn-fg); font-weight: 500; }

.pt-soon-note {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  color: var(--n500);
  background: var(--n50);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}


@media (max-width: 575.98px) {
  .pt-facts { margin-left: -1.25rem; margin-right: -1.25rem; padding-left: 1.25rem; padding-right: 1.25rem; }
  .pt-hero-top { flex-direction: column; gap: 0.75rem; }
  .pt-ring { text-align: left; }
  .pt-row { flex-wrap: wrap; }
  .pt-row .btn { width: 100%; }
}

/* Portal control on the card */
.portal-link { display: flex; gap: 0.35rem; }
.portal-link .form-control { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; }

.portal-states { display: inline-flex; gap: 0.15rem; background: var(--n100); border-radius: 8px; padding: 0.15rem; }

.portal-state {
  border: 0;
  background: transparent;
  color: var(--n500);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.portal-state:hover { color: var(--n900); }
.portal-state.is-on { background: var(--n0); color: var(--n900); box-shadow: var(--shadow-sm); }

.portal-more > summary { cursor: pointer; font-size: 0.875rem; color: var(--n500); list-style: none; }
.portal-more > summary::-webkit-details-marker { display: none; }
.portal-more > summary:hover { color: var(--p); }

/* Nothing left to do - say so plainly rather than showing an empty card. */
.pt-clear-msg { font-size: 1.0625rem; font-weight: 500; color: var(--ok-fg); margin: 0 0 0.35rem; }

/* A task that takes a file answers it in place, rather than by form. */
.pt-upload { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.pt-upload .form-control { flex: 1 1 14rem; min-width: 0; }
.pt-upload .btn { flex: none; }
.pt-upload-hint { font-size: 0.8125rem; color: var(--n400); margin-top: 0.35rem; }

.pt-sent-files { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 0.8125rem; color: var(--n500); }

.task-files { margin-top: 0.35rem; font-size: 0.8125rem; display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; }
.task-files a { color: var(--p); }

@media (max-width: 575.98px) {
  .pt-upload { flex-direction: column; align-items: stretch; }
  .pt-upload .btn { width: 100%; }
}

.pt-answer textarea { resize: vertical; }
.pt-sent-answer {
  margin-top: 0.4rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--n200);
  font-size: 0.8125rem;
  color: var(--n500);
}

.task-answer {
  margin-top: 0.4rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--ok-fg);
  font-size: 0.875rem;
  color: var(--n700);
}

/* -------------------------------------------------------- What's due ------ */

.due-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.due-filter-group { display: flex; gap: 0.15rem; background: var(--n100); border-radius: 8px; padding: 0.15rem; }

.due-chip {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--n500);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
}

.due-chip:hover { color: var(--n900); text-decoration: none; }
.due-chip.is-on { background: var(--n0); color: var(--n900); box-shadow: var(--shadow-sm); }
/* The standalone chip has no group behind it, so it carries its own edge. */
.due-filters > .due-chip { border: 1px solid var(--n200); }
.due-filters > .due-chip.is-on { border-color: var(--bad-fg); color: var(--bad-fg); background: var(--bad-bg); box-shadow: none; }

.due-group { margin-bottom: 1.75rem; }

.due-group-head {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--n900);
  margin: 0 0 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.due-task { font-weight: 500; color: var(--n900); }
.due-sub { font-size: 0.8125rem; color: var(--n500); margin-top: 0.1rem; }
.due-date { font-weight: 500; font-variant-numeric: tabular-nums; }
.due-date.is-overdue, .due-sub.is-overdue { color: var(--bad-fg); }
.due-date.is-soon { color: var(--warn-fg); }

/* ---------------------------------------------------------- Dashboard ----- */
/* Three columns of equal weight: what is running, what is coming, what is owed. */

.dash-cols .card-body { display: flex; flex-direction: column; }

.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.dash-title { font-size: 1.0625rem; margin: 0; }
.dash-sub { font-size: 0.8125rem; color: var(--n500); margin: 0.15rem 0 0.9rem; }

.dash-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--n150);
}

.dash-row:first-of-type { border-top: 0; padding-top: 0; }
.dash-row .badge { flex: none; margin-top: 0.1rem; }

.dash-row-main { min-width: 0; }
.dash-row-sub { font-size: 0.8125rem; color: var(--n500); margin-top: 0.1rem; }
.dash-task { font-weight: 500; color: var(--n900); font-size: 0.9375rem; }
.dash-quiet { color: var(--n500); }
.dash-quiet:hover { color: var(--p); text-decoration: none; }

.dash-due {
  flex: none;
  font-size: 0.8125rem;
  color: var(--n500);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-top: 0.15rem;
}

.dash-due.is-overdue { color: var(--bad-fg); font-weight: 600; }

/* ------------------------------------------------- Campaign full page ----- */
/* A dashboard, not a long scroll: facts in a strip, work split into tabs.
   The board's modal keeps the compact .card-detail layout. */

.cp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.cp-head-main { min-width: 0; }
.cp-title { font-size: 1.625rem; margin: 0.1rem 0 0.35rem; letter-spacing: -0.021em; }
.cp-head-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.cp-head-actions .cd-danger { color: var(--bad-fg); border-color: #f0cfcb; }
.cp-head-actions .cd-danger:hover { background: var(--bad-fg); border-color: var(--bad-fg); color: #fff; }

.cp-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--n200);
  border-radius: var(--radius-lg);
  background: var(--n0);
  margin-bottom: 1.5rem;
}
.cp-kpi { padding: 0.9rem 1.1rem; border-left: 1px solid var(--n200); min-width: 0; }
.cp-kpi:first-child { border-left: 0; }
.cp-kpi-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--n500); }
.cp-kpi-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--n900);
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-kpi-sub { display: block; font-size: 0.8125rem; color: var(--n500); font-variant-numeric: tabular-nums; }
.cp-kpi-sub.is-soon { color: var(--warn-fg); font-weight: 500; }
.cp-kpi-sub.is-past { color: var(--n400); }

@media (max-width: 991.98px) {
  .cp-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cp-kpi:nth-child(4) { border-left: 0; }
  .cp-kpi:nth-child(n+4) { border-top: 1px solid var(--n200); }
}
@media (max-width: 575.98px) {
  .cp-head { flex-direction: column; }
  .cp-head-actions { justify-content: flex-start; }
  .cp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-kpi { border-left: 0; border-top: 1px solid var(--n200); }
  .cp-kpi:nth-child(-n+2) { border-top: 0; }
  .cp-kpi:nth-child(even) { border-left: 1px solid var(--n200); }
}

/* Underline tabs: the active one carries weight and the accent, nothing else. */
.cp-tabs {
  gap: 0.25rem;
  border-bottom: 1px solid var(--n200);
  margin-bottom: 1.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.cp-tabs .nav-link {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--n500);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.6rem 0.9rem;
  margin-bottom: -1px;
  white-space: nowrap;
}
.cp-tabs .nav-link:hover { color: var(--n900); }
.cp-tabs .nav-link.active { color: var(--n900); font-weight: 600; border-bottom-color: var(--p); }

.cp-card {
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
}
.cp-card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.cp-card-title { font-size: 1rem; font-weight: 600; margin: 0; }

/* Blocks shared with the modal bring their own top rule; inside a card it is noise. */
.cp .cd-files { border-top: 0; margin-top: 0; padding-top: 0; }

/* ------------------------------------------------------ Info doc link ----- */

.doc-link { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.doc-icon {
  flex: none;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1a56c4;
  background: #eaf1fd;
  border-radius: 6px;
  padding: 0.45rem 0.4rem;
}
.doc-url {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-form { display: flex; gap: 0.35rem; }
.doc-form .form-control { flex: 1 1 auto; min-width: 0; }

/* --------------------------------------------- Portal: sending us files --- */


/* A file input stretched over the whole zone, so dropping files works with
   no script at all; portal.js only names what was picked. */
.pt-drop {
  position: relative;
  display: block;
  border: 1.5px dashed var(--n300);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.pt-drop input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.pt-drop:hover, .pt-drop.is-over { border-color: var(--p); background: var(--n25); }
.pt-drop:focus-within { border-color: var(--p); box-shadow: 0 0 0 3px var(--p-ring); }
.pt-drop.has-files { border-style: solid; border-color: var(--ok-fg); background: var(--ok-bg); }
.pt-drop-main { display: block; font-weight: 600; color: var(--n900); overflow-wrap: anywhere; }
.pt-drop-sub { display: block; font-size: 0.8125rem; color: var(--n500); margin-top: 0.15rem; }



/* ------------------------------------------- Detail: pinned header ------ */
/* Title and dates never scroll away. Once stuck (card.js sets .is-stuck) the
   header drops the charity line and shrinks, so it costs little room. */

.cp-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--n0);
  padding: 0.25rem 0 0.75rem;
  border-bottom: 1px solid transparent;
  align-items: center;
}
.cp-title { transition: font-size .15s ease; }
.cp-when { margin-left: 0.35rem; font-variant-numeric: tabular-nums; }
.cd-sub .badge + .badge { margin-left: 0.35rem; }

.cp-head.is-stuck { padding: 0.55rem 0; border-bottom-color: var(--n200); }
.cp-head.is-stuck .cd-org { display: none; }
.cp-head.is-stuck .cp-title { font-size: 1.0625rem; margin: 0 0 0.1rem; }
.cp-head.is-stuck .cd-sub { font-size: 0.8125rem; }

/* Below lg the mobile top bar is itself sticky; sit underneath it. */
@media (max-width: 991.98px) {
  .cp-page .cp-head { top: 50px; }
}

/* In the modal the body scrolls and has 1.25rem of padding: pin to its very
   top edge, and let the header's own padding cover the gap at rest. */
.cp-modal .cp-head { top: -1.25rem; margin-top: -1.25rem; padding-top: 1.25rem; }
.cp-modal .cp-head.is-stuck { padding-top: 1.25rem; }
.cp-modal .cp-title { font-size: 1.375rem; }
.cp-modal .cp-kpi { padding: 0.75rem 0.9rem; }
.cp-modal .cp-head.is-stuck .cp-title { font-size: 1rem; }

/* Each tab opens with its heading and its one primary action. */
.cp-card-title .badge { font-size: 0.75rem; vertical-align: 0.1em; }
.cp-card-meta { font-size: 0.875rem; font-weight: 400; color: var(--n500); }
.cp-panes .cp-card-head { min-height: 2rem; }

/* Let a long status ("Confirmed Campaigns") wrap rather than lose its end. */
.cp-kpi-value { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }

/* ------------------------------------------------ Notification builder ---- */
/* Three numbered steps that read as one sentence: When / Only if / Then. */

.nb-step-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.25rem 0.6rem; margin-bottom: 1rem; }
.nb-num {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--n100);
  color: var(--n700);
  font-size: 0.8125rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}
.nb-title { font-size: 1.0625rem; margin: 0; }
.nb-hint { font-size: 0.8125rem; color: var(--n500); }

/* Triggers as selectable tiles: the choice that shapes the rest of the rule. */
.nb-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.6rem; }
.nb-event {
  position: relative;
  display: block;
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem 0.8rem 2.3rem;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.nb-event:hover { border-color: var(--n300); }
.nb-event input { position: absolute; left: 0.9rem; top: 0.95rem; accent-color: var(--p); }
.nb-event:has(input:checked) { border-color: var(--p); background: #fff7fa; }
.nb-event:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--p-ring); }
.nb-event-label { display: block; font-weight: 600; color: var(--n900); }
.nb-event-desc { display: block; font-size: 0.8125rem; color: var(--n500); margin-top: 0.15rem; line-height: 1.4; }

.nb-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.nb-action { display: flex; gap: 0.5rem; align-items: center; }
.nb-action-type { flex: 0 0 13rem; }
.nb-action-target { flex: 1 1 auto; min-width: 0; }
.nb-action-remove { flex: none; font-size: 1.1rem; line-height: 1; padding: 0.35rem 0.65rem; }

@media (max-width: 575.98px) {
  .nb-action { flex-wrap: wrap; }
  .nb-action-type { flex: 1 1 100%; }
}

/* ------------------------------------------------ Portal: actions & files - */


/* Each action is one large, quiet button - room for more to join it. */
.pt-actions .pt-action + .pt-action { margin-top: 0.5rem; }
.pt-action {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.pt-action:hover { border-color: var(--p); background: #fff7fa; text-decoration: none; }
.pt-action-text { flex: 1 1 auto; min-width: 0; }
.pt-action-ext { flex: none; color: var(--n400); font-size: 1rem; }
.pt-action:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--p-ring); border-color: var(--p); }
.pt-action-icon {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: #fff0f5;
  color: var(--p);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pt-action-icon svg { width: 18px; height: 18px; }
.pt-action-label { display: block; font-weight: 600; color: var(--n900); }
.pt-action-sub { display: block; font-size: 0.8125rem; color: var(--n500); }

/* The send-files window. */
.pt-dialog {
  width: min(34rem, calc(100vw - 2rem));
  border: 1px solid var(--n200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}
.pt-dialog::backdrop { background: rgba(17, 17, 19, 0.45); }
.pt-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }

.pt-picked { list-style: none; margin: 0.6rem 0 0; padding: 0; max-height: 14rem; overflow-y: auto; }
.pt-picked li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--n150);
  font-size: 0.875rem;
}
.pt-picked li:last-child { border-bottom: 0; }
.pt-picked-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--n700); }
.pt-picked-size { flex: none; color: var(--n500); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.pt-picked-remove {
  flex: none;
  border: 0;
  background: none;
  color: var(--n400);
  font-size: 1.1rem;
  line-height: 1;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
}
.pt-picked-remove:hover { background: var(--bad-bg); color: var(--bad-fg); }
/* In the window the rule belongs under the whole header, not just the title. */
.pt-dialog-head { border-bottom: 1px solid var(--n150); padding-bottom: 0.75rem; margin-bottom: 0.9rem; }
.pt-dialog-head .pt-heading { border-bottom: 0; padding-bottom: 0; }

/* The person to talk to: a face, a first name, an address. */
.pt-manager { display: flex; align-items: center; gap: 0.85rem; }
.pt-manager-pic {
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--n100);
  color: var(--n700);
  font-weight: 600;
  font-size: 1.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pt-manager-text { min-width: 0; }
.pt-manager-name { font-weight: 600; color: var(--n900); font-size: 1rem; }
.pt-manager-email { font-size: 0.875rem; overflow-wrap: anywhere; }

/* ------------------------------------------------------ Knowledge base ---- */

.kb-wrap { max-width: 60rem; }
.kb-gate { max-width: 30rem; margin: 0 auto; }

.kb-hero .ff-lede { margin-bottom: 1rem; }
.kb-search { display: flex; gap: 0.5rem; }
.kb-search .form-control { flex: 1 1 auto; min-width: 0; }
.kb-results-note { font-size: 0.875rem; color: var(--n500); margin: 1rem 0 0; }

.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.25rem; margin-top: 1.25rem; }
.kb-list { list-style: none; margin: 0; padding: 0; }
.kb-list li + li { border-top: 1px solid var(--n150); }
.kb-list a { display: block; padding: 0.5rem 0; color: var(--n700); font-weight: 500; }
.kb-list a:hover { color: var(--p); text-decoration: none; }

.kb-crumbs { font-size: 0.875rem; color: var(--n500); margin-bottom: 0.75rem; display: flex; gap: 0.4rem; }
.kb-title { font-size: 1.75rem; letter-spacing: -0.021em; margin: 0 0 0.25rem; }
.kb-meta { font-size: 0.8125rem; color: var(--n500); margin-bottom: 1.5rem; }

/* Article text: comfortable to read, and the editor's own classes honoured. */
.kb-body { font-size: 1rem; line-height: 1.7; color: var(--n700); overflow-wrap: anywhere; }
.kb-body > :first-child { margin-top: 0; }
.kb-body h2 { font-size: 1.3125rem; margin: 1.75rem 0 0.6rem; }
.kb-body h3 { font-size: 1.0625rem; margin: 1.4rem 0 0.5rem; }
.kb-body p, .kb-body ul, .kb-body ol, .kb-body pre, .kb-body blockquote { margin: 0 0 1rem; }
.kb-body blockquote { border-left: 3px solid var(--p); padding: 0.1rem 0 0.1rem 1rem; color: var(--n500); }
.kb-body pre { background: var(--n50); border: 1px solid var(--n200); border-radius: 8px; padding: 0.8rem 1rem; white-space: pre-wrap; font-size: 0.875rem; }
.kb-body .ql-align-center { text-align: center; }
.kb-body .ql-align-right { text-align: right; }
.kb-body .ql-align-justify { text-align: justify; }
.kb-body .ql-indent-1 { padding-left: 2em; }  .kb-body .ql-indent-2 { padding-left: 4em; }
.kb-body .ql-indent-3 { padding-left: 6em; }  .kb-body .ql-indent-4 { padding-left: 8em; }

/* Admin */
.kb-cat-row { display: flex; gap: 0.35rem; align-items: center; margin-bottom: 0.4rem; }
.kb-cat-row .form-control { flex: 1 1 auto; min-width: 0; }
.kb-cat-row .kb-cat-pos { flex: 0 0 4.25rem; }

.kb-title-input { font-size: 1.375rem; font-weight: 600; border: 0; padding-left: 0; box-shadow: none !important; }
.kb-editor-wrap .ql-toolbar.ql-snow { border-color: var(--n200); border-radius: 8px 8px 0 0; font-family: inherit; }
.kb-editor-wrap .ql-container.ql-snow { border-color: var(--n200); border-radius: 0 0 8px 8px; font-family: inherit; font-size: 1rem; }
.kb-editor-wrap .ql-editor { min-height: 22rem; line-height: 1.7; }

@media (max-width: 575.98px) {
  .kb-search { flex-direction: column; }
}

/* Article images: never wider than the column, softly framed. */
.kb-body img, .kb-editor-wrap .ql-editor img { max-width: 100%; height: auto; border-radius: 8px; }
.kb-body img { display: block; margin: 0.5rem 0 1rem; border: 1px solid var(--n150); }
.kb-body .ql-align-center img { margin-left: auto; margin-right: auto; }
.kb-body .ql-align-right img { margin-left: auto; }
