/* ReFresh component library.
   Tokens first, then base, layout and components. Every page uses these classes;
   components.html shows each one. Mobile rules are at the end (576px and below). */

/* ─── Tokens ─────────────────────────────────────────────────────────── */

:root {
  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --fs-11: 9px;
  --fs-12: 9.5px;
  --fs-13: 10.5px;
  --fs-14: 11px;
  --fs-15: 12px;
  --fs-16: 13px;
  --fs-17: 13.5px;
  --fs-18: 14.5px;
  --fs-20: 16px;
  --fs-24: 19px;
  --fs-30: 24px;
  --fs-body: var(--fs-15);
  --fs-meta: var(--fs-14);
  --fs-small: var(--fs-13);
  --lh-tight: 1.2;
  --lh-body: 1.45;
  --lh-loose: 1.6;
  --tracking-display: -0.03em;
  --tracking-heading: -0.02em;
  --tracking-body: -0.006em;

  /* Colour */
  --bg: #f0f0ee;
  --shell: #e9e7f1;          /* the app frame behind the sidebar and panels, lavender */
  --shell-hover: #dcdae5;    /* a sidebar row under the pointer */
  --panel: #f9f9f8;
  --surface: #ffffff;
  --subtle: #f3f3f1;
  --hover: #ededeb;
  --pressed: #e5e5e2;
  --border: #e5e5e2;
  --border-strong: #d5d5d1;
  --divider: #ececea;
  --track: #e3e3df;
  --surface-2: #fafaf8;      /* raised hover on white controls, file chips */
  --row-hover: #f2f2f0;      /* table and list rows */
  --border-dashed: #d3d3ce;  /* drop zones, empty avatars */
  --focus-border: #a9a2f6;   /* every focused input */
  --ink: #2b2b29;            /* selected cards, toasts, chart hub */
  --on-accent: #ffffff;
  --text: #1d1d1b;
  --text-2: #63635f;
  --text-3: #9b9b96;
  --text-4: #b8b8b3;
  --muted: var(--text-2);
  --faint: var(--text-3);
  --accent: #5b4ef0;
  --accent-hover: #4c3fe0;
  --accent-soft: #eeedfd;
  --accent-ring: rgba(91, 78, 240, 0.14);
  --activity-icon: #8a84e8;
  --green: #3f7d57;
  --green-bright: #4caf6a;
  --green-soft: #e4f0e8;
  --amber: #c98f2e;
  --amber-soft: #fbf0d9;
  --amber-text: #a06c17;
  --yellow: #f2c230;
  --red: #c4513b;
  --red-bright: #e5484d;
  --red-soft: #fdf1ee;
  --red-ink: #8e2f20;

  /* Shape */
  --r-xs: 3px;
  --r-sm: 5px;
  --r-md: 6.5px;
  --r-lg: 8px;
  --r-xl: 9.5px;
  --r-2xl: 13px;
  --r-full: 799px;

  /* Space (3px grid) */
  --sp-1: 3px;
  --sp-2: 6.5px;
  --sp-3: 9.5px;
  --sp-4: 13px;
  --sp-5: 16px;
  --sp-6: 19px;
  --sp-8: 25.5px;
  --sp-10: 32px;
  --sp-12: 38.5px;
  --sp-14: 45px;
  --sp-16: 51px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(20, 20, 18, 0.04);
  --shadow-toggle: 0 1px 2px rgba(20, 20, 18, 0.08);
  --shadow-card: 0 1px 2px rgba(20, 20, 18, 0.04), 0 1px 1px rgba(20, 20, 18, 0.02);
  --shadow-pop: 0 9.5px 25.5px rgba(20, 20, 18, 0.12), 0 2px 5px rgba(20, 20, 18, 0.06);
  --shadow-modal: 0 19px 51px rgba(20, 20, 18, 0.2);

  /* Sizes */
  --control-h: 32px;
  --control-h-sm: 25.5px;
  --row-h: 45px;
  --sidebar-w: 211px;
  --header-h: 45px;
}

/* ─── Base ───────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer; }
input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible { outline: none; }

[hidden] { display: none !important; }

.icon {
  width: 13px;
  height: 13px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-xs { width: 9.5px; height: 9.5px; }
.icon-sm { width: 11px; height: 11px; }
.icon-md { width: 14.5px; height: 14.5px; }
.icon-lg { width: 16px; height: 16px; }

/* Text helpers */
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.serif { font-family: var(--font-serif); font-optical-sizing: auto; }
.nowrap { white-space: nowrap; }
.dash { color: var(--text-3); }

/* ─── Layout ─────────────────────────────────────────────────────────── */

body:has(> .app) { background: var(--shell); }
.app {
  background: var(--shell);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  height: 100dvh;
  padding: 14.5px 14.5px 9.5px 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 11px;
}

.workspace {
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  height: 29px;
  padding: 0 6.5px;
  margin-bottom: 11px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  font-size: var(--fs-15);
  font-weight: 600;
}
.workspace:hover { background: var(--shell-hover); }
.workspace .icon { margin-left: 3px; color: var(--text-2); }
.workspace-avatar {
  width: 19px;
  height: 19px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
}

.nav { display: flex; flex-direction: column; gap: 11px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label { padding: 0 8px 3px; font-size: var(--fs-13); color: var(--text-3); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9.5px;
  height: 30px;
  padding: 0 9.5px;
  border-radius: var(--r-lg);
  color: var(--text-2);
  font-size: var(--fs-15);
  text-decoration: none;
  white-space: nowrap;
}
.nav-item .icon { width: 14.5px; height: 14.5px; color: var(--text-2); }
/* No box until the pointer is over a row; the page you're on just reads a little darker */
.nav-item:hover { background: var(--shell-hover); color: var(--text); }
.nav-item:hover .icon { color: var(--text); }
.nav-item.is-active { color: var(--text); }
.nav-item.is-soon { color: var(--text-3); cursor: default; }
.nav-item.is-soon .icon { color: var(--text-4); }
.nav-item.is-soon:hover { background: none; }
.nav-soon { margin-left: auto; font-size: var(--fs-11); color: var(--text-3); opacity: 0; transition: opacity 0.1s; }
.nav-item.is-soon:hover .nav-soon { opacity: 1; }

.account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: auto;
  padding: 0 8px 9.5px;
  font-size: var(--fs-13);
  color: var(--text-2);
}
.account:empty { display: none; }
.account + .brand { margin-top: 0; }
.account:empty + .brand { margin-top: auto; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-signout {
  flex: none;
  padding: 2px 5px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  font-size: var(--fs-13);
}
.account-signout:hover { background: var(--hover); color: var(--text); }

.brand {
  display: flex;
  align-items: center;
  margin-top: auto;
  padding: 0 8px 5px;
}
.brand-logo { display: block; width: auto; height: 15px; }

/* Mobile top bar and drawer scrim; hidden on desktop. */
.mobile-bar, .nav-scrim { display: none; }

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--panel);
  overflow: hidden;
}

.panel-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  height: var(--header-h);
  padding: 0 14.5px 0 16px;
  border-bottom: 1px solid var(--border);
}

.page-title-wrap { display: flex; align-items: center; gap: 5px; min-width: 0; }
.title-more { margin-left: 2px; }
.page-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: var(--fs-15);
  font-weight: 400;
  white-space: nowrap;
}
.page-title .icon { color: var(--text); }
.header-actions { display: flex; flex: none; align-items: center; gap: var(--sp-2); }

.panel-body { flex: 1; min-height: 0; overflow: auto; }

.toolbar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 14.5px 21px 11px;
}
.toolbar-meta { margin-left: auto; font-size: var(--fs-14); color: var(--text-3); white-space: nowrap; }

/* ─── Buttons ────────────────────────────────────────────────────────── */

/* Primary pill: "New task", "New assessment" */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5.5px;
  height: 29px;
  padding: 0 13.5px 0 12px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-15);
  font-weight: 500;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

/* Outline pill: "Filter", "Display" */
.btn-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6.5px;
  height: var(--control-h);
  padding: 0 13px 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  font-size: var(--fs-15);
  white-space: nowrap;
}
.btn-pill .icon { width: 13.5px; height: 13.5px; }
.btn-pill:hover, .btn-pill.is-open { border-color: var(--border-strong); background: var(--surface-2); }
.btn-pill.has-filter::after {
  content: "";
  position: absolute;
  top: 6.5px;
  left: 19px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Small bordered button: "Upload", "Cancel" */
.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: var(--control-h-sm);
  padding: 0 9.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-14);
  font-weight: 500;
  white-space: nowrap;
}
.btn-small:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn-small.is-primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn-small.is-primary:hover { background: var(--accent-hover); }
.btn-small.is-quiet { margin-right: auto; border-color: transparent; background: none; color: var(--text-2); }

/* Text button: "Subscribe", "Add task" */
.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25.5px;
  padding: 0 6.5px;
  margin-right: -8px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  font-size: var(--fs-15);
  font-weight: 500;
}
.text-btn:hover { background: var(--hover); color: var(--text); }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: var(--fs-14);
}
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
}
.icon-btn:hover, .icon-btn.is-open { background: var(--hover); color: var(--text); }
.icon-btn .icon { width: 13.5px; height: 13.5px; }

/* Round grey send button in comment composers */
.send-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--hover);
  color: var(--text-2);
}
.send-btn:hover { background: var(--pressed); color: var(--text); }
.send-btn.is-ready { background: var(--accent); color: var(--on-accent); }
.send-btn .icon { width: 12px; height: 12px; stroke-width: 1.6; }

.btn-calc {
  height: var(--control-h-sm);
  padding: 0 13px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--hover);
  color: var(--text-3);
  font-size: var(--fs-14);
  white-space: nowrap;
}
.btn-calc:disabled { cursor: not-allowed; }
.btn-calc.is-ready { background: var(--accent); color: var(--on-accent); font-weight: 500; }
.btn-calc.is-ready:hover { background: var(--accent-hover); }

.invite-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 3px;
  margin: -2px -4px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--accent);
  font-size: var(--fs-14);
  white-space: nowrap;
}
.invite-link:hover, .invite-link.is-open { background: var(--accent-soft); }

.row-remove {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-3);
  opacity: 0;
}
.row-remove:hover { background: var(--hover); color: var(--text); }
.row-remove:focus-visible { opacity: 1; }
.row-remove-spacer { flex: none; width: 19px; }

/* ─── Form controls ──────────────────────────────────────────────────── */

/* Search pill */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 296px;
  height: var(--control-h);
  padding: 0 14.5px 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-2);
  cursor: text;
}
.search .icon { width: 13.5px; height: 13.5px; }
.search:focus-within { border-color: var(--border-strong); }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: var(--fs-15);
  color: var(--text);
}
.search input::placeholder { color: var(--text-2); }
.search input::-webkit-search-cancel-button { display: none; }

/* Text input and select */
.input {
  width: 100%;
  height: 33.5px;
  padding: 0 10.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-15);
  color: var(--text);
  outline: none;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--focus-border); box-shadow: 0 0 0 2.5px var(--accent-ring); }
.input.is-invalid { border-color: var(--red); }
textarea.input { height: auto; min-height: 77px; padding: 9px 10.5px; resize: vertical; line-height: var(--lh-body); }

.select, select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 27px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2363635f' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 6.5 8 10l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 13px;
  text-overflow: ellipsis;
  cursor: pointer;
}
/* Compact select, as in the Display menu */
.select {
  height: 27px;
  padding: 0 27px 0 9.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-15);
  color: var(--text);
  outline: none;
}
.select:hover { border-color: var(--border-strong); }
.select:focus { border-color: var(--focus-border); box-shadow: 0 0 0 2.5px var(--accent-ring); }

/* Checkbox */
.checkbox {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 14.5px;
  height: 14.5px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}
.checkbox::after {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--on-accent);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%);
  transform: scale(0);
  transition: transform 0.08s;
}
.checkbox:checked { border-color: var(--accent); background: var(--accent); }
.checkbox:checked::after { transform: scale(1); }

/* Fields */
.field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.field-label { font-size: var(--fs-14); font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }
.field-hint { display: flex; align-items: center; gap: 5.5px; font-size: var(--fs-13); color: var(--text-2); }
.field-error { margin: 0; font-size: var(--fs-13); color: var(--red); }

/* Email chips input */
.chips-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 35px;
  padding: 5px 6.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: text;
}
.chips-input:focus-within { border-color: var(--focus-border); box-shadow: 0 0 0 2.5px var(--accent-ring); }
.chips-input input {
  flex: 1;
  min-width: 112px;
  height: 22.5px;
  padding: 0 3px;
  border: 0;
  outline: 0;
  background: none;
  font-size: var(--fs-14);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22.5px;
  padding: 0 5px 0 7px;
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: var(--fs-14);
}
.chip.is-invalid { border-color: #efc2b8; background: var(--red-soft); color: var(--red); }
.chip button {
  display: inline-flex;
  padding: 2px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: inherit;
}
.chip button:hover { background: rgba(0, 0, 0, 0.06); }

/* Segmented control: Yes / Partly / No */
.segmented {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border-radius: var(--r-md);
  background: var(--hover);
}
.segmented button {
  min-width: 41.5px;
  height: 22.5px;
  padding: 0 9.5px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  font-size: var(--fs-13);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-on {
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-toggle);
}

/* ─── Tags, chips and pills ──────────────────────────────────────────── */

/* Bordered tag with an add button, as in the task side panel */
.tag-list { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10.5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--surface);
  font-size: var(--fs-15);
  white-space: nowrap;
}
button.tag { color: var(--text); font: inherit; font-size: var(--fs-15); cursor: pointer; }
button.tag:hover { border-color: var(--text-3); background: var(--surface-2); }
.tag-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-2);
}
.tag-add:hover { background: var(--hover); color: var(--text); }
.tag-add .icon { width: 13.5px; height: 13.5px; }

/* Grey toggle chips, as in Display properties */
.toggle-chips { display: flex; flex-wrap: wrap; gap: 5.5px; }
.toggle-chip {
  display: inline-flex;
  align-items: center;
  height: 25.5px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--hover);
  color: var(--text);
  font-size: var(--fs-15);
  font-weight: 500;
  white-space: nowrap;
}
.toggle-chip:hover { background: var(--pressed); }
.toggle-chip:not(.is-on) { background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--text-3); font-weight: 400; }

.pill {
  flex: none;
  padding: 2.5px 7px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-12);
  font-weight: 500;
}
.pill.is-working { background: var(--accent-soft); color: var(--accent); }
.pill.is-error { background: var(--red-soft); color: var(--red); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 9px 0 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
}
.status-pill-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.is-purple { background: var(--accent-soft); color: var(--accent); }
.status-pill.is-amber { background: var(--amber-soft); color: var(--amber-text); }
.status-pill.is-amber .status-pill-dot { background: var(--amber); }
.status-pill.is-grey { background: var(--hover); color: var(--text-2); }
.status-pill.is-grey .status-pill-dot { background: var(--text-3); }
.status-pill.is-green { background: var(--green-soft); color: var(--green); }

.question-tag {
  margin-left: 5px;
  padding: 1px 5.5px;
  border-radius: var(--r-full);
  background: var(--hover);
  color: var(--text-2);
  font-size: var(--fs-12);
  white-space: nowrap;
}

/* ─── Avatars ────────────────────────────────────────────────────────── */

.avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 17.5px;
  height: 17.5px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}
.avatar-task { width: 17.5px; height: 17.5px; font-size: 7px; }
.avatar-lg { width: 24px; height: 24px; font-size: 9.5px; }
.avatar-empty { border: 1px dashed var(--border-dashed); background: var(--surface) !important; color: var(--text-2); }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--panel); }
.avatar-stack .avatar + .avatar { margin-left: -5px; }
.avatar-more { background: var(--pressed) !important; color: var(--text) !important; }

/* Person + name, or "Unassigned" with an outline person */
.person { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; }
.person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person.is-unassigned { color: var(--text-2); }
.person.is-unassigned .icon { width: 15px; height: 15px; color: var(--text-2); }

/* ─── Status circles and priority icons ──────────────────────────────── */

.status-icon { flex: none; width: 14.5px; height: 14.5px; }
.status-icon-sm { width: 13px; height: 13px; }
.data-row > .status-circle, .task-check .status-circle, .task-new > .status-circle { flex: none; }
.status-circle { flex: none; width: 15px; height: 15px; }
.status-circle.is-sm { width: 13px; height: 13px; }

.priority-icon { flex: none; width: 13px; height: 13px; }

.score {
  display: flex;
  align-items: center;
  gap: 6.5px;
}
.score-dot { width: 5.5px; height: 5.5px; flex: none; border-radius: 50%; }
.score-value { font-weight: 500; }
.score-label { margin-left: -1px; font-size: var(--fs-13); color: var(--text-2); }
.score-none { padding-left: 2px; color: var(--text-3); }
.score-moderate .score-dot, .score-dot.score-moderate { background: var(--amber); }
.score-high .score-dot, .score-dot.score-high { background: var(--red); }
.score-low .score-dot, .score-dot.score-low { background: var(--green); }

.priority {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-14);
  white-space: nowrap;
}
.priority-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.priority.is-critical { color: var(--red); }
.priority.is-important { color: var(--amber-text); }
.priority.is-good { color: var(--text-2); }
.priority.is-good .priority-dot { background: var(--text-4); }

/* ─── Tables ─────────────────────────────────────────────────────────── */

.table-wrap { display: flex; flex: 1; flex-direction: column; padding: 0 21px 19px; overflow: auto; }
.table-wrap > .table { flex: none; }
/* Results count and paging sit at the bottom of the page, however few rows there are. */
.table-wrap > .list-footer { margin-top: auto; position: sticky; bottom: 0; padding-bottom: 0; background: var(--panel); }

.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  white-space: nowrap;
}
.table th {
  height: 37px;
  padding: 0 9.5px 0 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-15);
  font-weight: 400;
  text-align: left;
}
.table td {
  height: var(--row-h);
  padding: 0 9.5px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--fs-15);
}
.table td.is-muted, .table .td-muted { color: var(--text-2); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--row-hover); }
.table tbody tr:hover td:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.table tbody tr:hover td:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.row-link { color: inherit; text-decoration: none; }

/* Column widths: first assessments design */
.col-assessment { width: 23.5%; }
.col-status { width: 13.7%; }
.col-progress { width: 13.7%; }
.col-due { width: 10.3%; }
.col-team { width: 10.3%; }
.col-people { width: 8.6%; }
.col-score { width: 10.4%; }
.col-created { width: 9.5%; }

/* Column widths: assessments by company */
.table.is-assessments td { height: 51px; }
.col-name { width: 30%; }
.col-astatus { width: 14%; }
.col-aprogress { width: 15.5%; }
.col-adue { width: 9.5%; }
.col-apeople { width: 16%; }
.col-index { width: 15%; }

.assessment-cell { display: flex; align-items: center; gap: 9.5px; }
.assessment-cell span { overflow: hidden; text-overflow: ellipsis; }

.company-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.company-name { overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 450; }
.company-sub { overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-13); color: var(--text-3); }

.people-cell { display: flex; align-items: center; gap: 8px; }
.index-none { font-size: var(--fs-14); color: var(--text-3); }

.progress { display: flex; align-items: center; gap: 6.5px; }
.progress-track { width: 64px; height: 3px; flex: none; overflow: hidden; border-radius: 2px; background: var(--track); }
.progress-fill { height: 100%; border-radius: 2px; background: var(--accent); }
.progress-fill.is-complete { background: var(--green); }
.progress-label { font-size: var(--fs-13); color: var(--text-3); }
.progress-label.is-none { color: var(--text-3); }

/* Empty states */
.empty { margin: 22.5px 0 0; font-size: var(--fs-14); color: var(--text-2); }
.empty-title { display: block; margin-bottom: 3px; color: var(--text); font-weight: 500; }
.empty .btn-small { display: flex; margin-top: 11px; }
.list-empty {
  padding: 61px 13px;
  color: var(--text-2);
  font-size: var(--fs-16);
  text-align: center;
}
.list-empty-sub { display: block; margin-top: 5px; color: var(--text-3); font-size: var(--fs-14); }

/* Pagination */
.list-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14.5px;
  padding: 14.5px 0 3px;
  color: var(--text-2);
  font-size: var(--fs-15);
}
.pager { display: flex; align-items: center; gap: 8px; }
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22.5px;
  height: 22.5px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
}
.pager-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.pager-btn:disabled { color: var(--text-4); cursor: default; }
.pager-label { color: var(--text-3); }

/* ─── Detail page ────────────────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9.5px;
  min-width: 0;
  font-size: var(--fs-15);
}
.crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.crumb .icon { color: var(--text); }
.crumb:hover { color: var(--accent); }
.crumb-sep { color: var(--text-2); }
.crumb-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 57.5px;
  max-width: 1152px;
  padding: 45px 51px 77px;
}

/* Title and description edit in place, like plain text: click anywhere and type. */
.editable {
  outline: none;
  white-space: pre-wrap;
  cursor: text;
  caret-color: var(--text);
}
.editable:empty::before { content: attr(data-placeholder); color: var(--text-3); cursor: text; }

/* Page heading: bold serif with tight tracking */
.detail-title {
  margin: 0 0 17.5px;
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: var(--fs-30);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
}

.detail-desc {
  margin: 0;
  font-size: var(--fs-17);
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.rule { margin: 27px 0; border: 0; border-top: 1px solid var(--border); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: 14.5px;
}
.section-head-actions { display: flex; align-items: center; gap: var(--sp-4); }

/* Section heading: same serif, smaller */
.section-title {
  margin: 0;
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: var(--fs-18);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: var(--tracking-heading);
}

.section-intro {
  margin: -8px 0 13px;
  color: var(--text-2);
  font-size: var(--fs-15);
  line-height: 1.55;
}

.footnote { margin: 9.5px 0 0; color: var(--text-3); font-size: var(--fs-13); }

/* Card */
.card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

/* Data needed rows */
.data-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 53px;
  padding: 9.5px 13px;
  border: 0;
  border-bottom: 1px solid var(--divider);
  background: none;
  text-align: left;
}
.data-text { flex: 1; min-width: 0; }
.data-title { font-size: var(--fs-15); }
.data-note { margin-top: 2px; color: var(--text-2); font-size: var(--fs-13); }
.data-note.is-error { color: var(--red); }
.data-busy { color: var(--text-2); font-size: var(--fs-13); }
.data-actions { display: flex; flex: none; align-items: center; gap: 11px; }
.data-owner {
  margin-left: 5px;
  color: var(--text-3);
  font-size: var(--fs-13);
  white-space: nowrap;
}
.data-note.is-working {
  color: var(--accent);
  animation: working-pulse 1.6s ease-in-out infinite;
}
.data-note.is-muted { color: var(--text-3); }

/* Drag a file onto an upload row */
.data-row { position: relative; }
.data-drop-hint { color: var(--text-3); font-size: var(--fs-13); white-space: nowrap; }
.data-drop-label {
  position: absolute;
  inset: 3px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6.5px;
  border: 1.5px dashed var(--accent);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--accent);
  font-size: var(--fs-14);
  font-weight: 500;
  pointer-events: none;
}
#data-card.is-dragging .data-row { outline: 1px dashed var(--border-dashed); outline-offset: -3px; }
#data-card.is-dragging .data-row.is-drop { outline: 0; }
.data-row.is-drop .data-drop-label { display: flex; }
@media (hover: none) { .data-drop-hint { display: none; } }
.data-note.is-error .link-btn { margin-left: 3px; font-size: inherit; }
.data-note .is-error { color: var(--red); }
@keyframes working-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .data-note.is-working { animation: none; }
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 208px;
  height: 24px;
  padding: 0 3px 0 7px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-13);
}
.file-chip .icon { color: var(--text-2); }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .file-name { padding: 0; border: 0; background: none; font-size: var(--fs-13); text-align: left; }
.file-chip .file-name:hover { text-decoration: underline; }
.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: var(--text-3);
  visibility: hidden;
}
.file-chip:hover .chip-remove, .chip-remove:focus-visible { visibility: visible; }
.chip-remove:hover { background: var(--hover); color: var(--text); }

.questions-head:hover { background: var(--surface-2); }
.questions-toggle { flex: none; color: var(--text-2); font-size: var(--fs-13); }

.question-row {
  display: flex;
  align-items: center;
  gap: 9.5px;
  min-height: 43px;
  padding: 7px 9.5px 7px 38.5px;
  border-bottom: 1px solid var(--divider);
  background: var(--subtle);
}
.question-row:hover .row-remove { opacity: 1; }
.question-text { flex: 1; min-width: 0; font-size: var(--fs-15); }
.question-add input {
  flex: 1;
  min-width: 0;
  height: 27px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-14);
  outline: none;
}
.question-add input:focus { border-color: var(--focus-border); box-shadow: 0 0 0 2.5px var(--accent-ring); }

.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46.5px;
  padding: 8px 9.5px 8px 13px;
  color: var(--text-2);
  font-size: var(--fs-14);
}
.footer-text { flex: 1; }

/* Files for analysis */
.dropzone {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14.5px;
  border: 1.5px dashed var(--border-dashed);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  color: var(--text-2);
}
.dropzone.is-over { border-color: var(--accent); background: rgba(91, 78, 240, 0.05); }
.dropzone-title { color: var(--text); font-size: var(--fs-15); }
.dropzone-title .link-btn { font-size: inherit; }
.dropzone-hint { margin-top: 2px; font-size: var(--fs-13); }

.files { margin: 5px 0 0; padding: 0; list-style: none; }
.file-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9.5px 2px;
  border-bottom: 1px solid var(--divider);
}
.file-row:hover .row-remove { opacity: 1; }
.file-icon { display: flex; color: var(--text-2); }
.file-link {
  display: block;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: none;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-link:hover { text-decoration: underline; }

/* Task list on the detail page, and "What to do" */
.tasks { margin: 0; padding: 0; list-style: none; }
.task {
  display: flex;
  align-items: center;
  gap: 9.5px;
  min-height: 33.5px;
  font-size: var(--fs-15);
}
.task:hover .row-remove, .task:hover .is-empty { opacity: 1; }
.task-check { display: flex; padding: 0; border: 0; background: none; }
.task-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.is-done .task-text { color: var(--text-3); text-decoration: line-through; }
.task-due {
  display: inline-flex;
  align-items: center;
  padding: 2.5px 5px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  font-size: var(--fs-14);
}
.task-owner { display: flex; padding: 0; border: 0; border-radius: 50%; background: none; }
.task-due:hover, .task-due.is-open { background: var(--hover); }
.task-owner:hover .avatar, .task-owner.is-open .avatar { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--border-strong); }
.task-due.is-empty, .task-owner.is-empty { opacity: 0; }
.task-due.is-open, .task-owner.is-open { opacity: 1; }
.is-empty-list { color: var(--text-3); font-size: var(--fs-14); }
.task-new input { flex: 1; border: 0; outline: 0; background: none; }
.task.is-action { min-height: 48px; border-bottom: 1px solid var(--divider); }
.task-body { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.task-body .task-text { flex: none; }
.task-sub { color: var(--text-3); font-size: var(--fs-13); }
.task.is-done .task-sub { text-decoration: none; }
.task-points {
  flex: none;
  width: 43px;
  color: var(--green);
  font-size: var(--fs-14);
  text-align: right;
  white-space: nowrap;
}

/* ─── Property list (detail side panel) ──────────────────────────────── */
/* Sizes follow the assessment detail design (status, team, tags, Details, People). */

.detail-side { padding-top: 3px; }
.props { display: flex; flex-direction: column; gap: 1px; }
.prop {
  display: flex;
  align-items: center;
  gap: 9px;
  width: calc(100% + 13px);
  min-height: 27px;
  margin-left: -8px;
  padding: 4px 6.5px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  font-size: var(--fs-15);
  text-align: left;
}
button.prop:hover, .prop.is-open { background: var(--hover); }
.prop.is-static { cursor: default; }
.prop.is-accent, .prop.is-accent .prop-icon { color: var(--accent); }
.prop-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 14.5px;
  color: var(--text-2);
}
.prop-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-sep { color: var(--text-3); }
.prop.is-split { gap: 0; }
.prop.is-split .prop-icon { margin-right: 5.5px; }
.prop-part {
  padding: 2px 3px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  font-size: var(--fs-15);
}
.prop-part:first-of-type { margin-left: -4px; }
.prop-part:hover, .prop-part.is-open { background: var(--hover); }
.is-placeholder { color: var(--text-3); }
.side-label { margin: 17.5px 0 5px; color: var(--text-2); font-size: 11px; }

/* ─── Activity feed ──────────────────────────────────────────────────── */

.activity { margin: 0; padding: 0; list-style: none; }
.activity-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9.5px;
  padding: 4px 0;
  color: var(--text-2);
  font-size: var(--fs-15);
  line-height: 17.5px;
}
/* Dotted connector between consecutive event icons */
.activity-item:not(.activity-comment) + .activity-item:not(.activity-comment)::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 7px;
  height: 11px;
  border-left: 1.5px dotted var(--border-strong);
}
.activity-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 17.5px;
  color: var(--activity-icon);
}
.activity-icon .icon { width: 13.5px; height: 13.5px; }
.activity-icon.is-neutral { color: var(--text-2); }
.activity-text { min-width: 0; }
.activity-text strong { color: var(--text); font-weight: 500; }
.activity-text a { color: var(--text); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.activity-date { color: var(--text-2); white-space: nowrap; }
.activity-date::before { content: " · "; }
.activity-toggle {
  display: flex;
  align-items: flex-start;
  gap: 9.5px;
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--text-2);
  font-size: var(--fs-15);
  line-height: 17.5px;
  text-align: left;
}
.activity-toggle .activity-icon { color: var(--text-2); }
.activity-toggle:hover { color: var(--text); }
.activity-toggle .activity-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-comment { padding: 8px 0; }

/* ─── Comments ───────────────────────────────────────────────────────── */

.comment {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.comment-head { display: flex; align-items: center; gap: 8px; padding: 13px 14.5px 5px; }
.comment-name { color: var(--text); font-size: var(--fs-15); font-weight: 500; }
.comment-date { color: var(--text-2); font-size: var(--fs-15); }
.comment-body { padding: 0 14.5px 13px; color: var(--text); font-size: var(--fs-16); line-height: var(--lh-loose); white-space: pre-wrap; }
.comment-reply {
  display: flex;
  align-items: center;
  gap: 9.5px;
  padding: 9.5px 11px 9.5px 14.5px;
  border-top: 1px solid var(--divider);
}
.comment-reply input, .composer textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-size: var(--fs-16);
}
.comment-reply input::placeholder, .composer textarea::placeholder { color: var(--text-3); }

.composer {
  position: relative;
  display: flex;
  width: 100%;
  flex-direction: column;
  min-height: 70.5px;
  padding: 13px 41.5px 11px 14.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.composer:focus-within { border-color: var(--border-strong); }
.composer textarea { min-height: 35px; padding: 0; resize: none; line-height: var(--lh-body); }
.composer .send-btn { position: absolute; right: 11px; bottom: 11px; }

/* ─── Popovers and menus ─────────────────────────────────────────────── */

.popover {
  position: fixed;
  z-index: 50;
  min-width: 192px;
  max-width: 272px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-15);
  outline: none;
}
.popover.is-inline { position: relative; z-index: auto; }
.popover-scrim { display: none; }

.pop-search { border-bottom: 1px solid var(--divider); }
.pop-search input {
  width: 100%;
  height: 37px;
  padding: 0 13px;
  border: 0;
  outline: 0;
  background: none;
  font-size: var(--fs-15);
}
.pop-search input::placeholder { color: var(--text-2); }
.pop-list { max-height: 240px; padding: 5px; overflow: auto; }
.pop-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 30.5px;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  font-size: var(--fs-15);
  text-align: left;
}
.pop-item.is-active, .pop-item:hover { background: var(--subtle); }
.pop-item.is-danger { color: var(--red); }
.pop-icon { display: flex; flex: none; color: var(--text-2); }
.pop-icon .icon { width: 14.5px; height: 14.5px; }
.pop-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-check { display: flex; color: var(--accent); }
.pop-chevron { display: flex; color: var(--text-4); }
.pop-empty { padding: 9.5px 11px; color: var(--text-3); }
.pop-divider { height: 1px; margin: 3px 0; background: var(--divider); }

.pop-person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 11px 9.5px;
  border-bottom: 1px solid var(--divider);
}
.pop-person .avatar { width: 24px; height: 24px; font-size: 9px; }
.pop-person-name { font-weight: 500; }
.pop-person-org { color: var(--text-2); font-size: var(--fs-13); }

.popover-form form { display: flex; flex-direction: column; gap: 9.5px; padding: 11px; }
.pop-field { display: flex; flex-direction: column; gap: 5px; }
.pop-field span { color: var(--text-2); font-size: var(--fs-13); }
.pop-field input {
  height: 29px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  outline: none;
}
.pop-field input:focus { border-color: var(--focus-border); box-shadow: 0 0 0 2.5px var(--accent-ring); }
.pop-hint { margin: 0; color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; }
.pop-actions { display: flex; justify-content: flex-end; gap: 6.5px; margin-top: 2px; }

/* Filter menu: "Add filter…", field rows, side submenu of checkboxes */
.filter-menu { width: 232px; }
.filter-menu .pop-item { min-height: 33.5px; }
.filter-field.is-open { background: var(--subtle); }
.filter-sub {
  position: absolute;
  z-index: 1;
  width: 192px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.filter-sub .pop-item { gap: 9.5px; min-height: 33.5px; }
.filter-option .checkbox { pointer-events: none; }
.filter-count { margin-left: auto; color: var(--text-3); font-size: var(--fs-13); }
.filter-inline { padding: 0 5px 5px 32px; }

/* Display menu: ordering, per page, property chips, reset */
.display-menu { width: 248px; padding: 5px 0; }
.dm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5.5px 13px;
}
.dm-label { flex: 1; color: var(--text-2); font-size: var(--fs-15); font-weight: 500; }
.dm-row .icon { color: var(--text-2); }
.dm-row .select { max-width: 136px; }
.dm-section { padding: 8px 13px 9.5px; }
.dm-heading { margin-bottom: 8px; color: var(--text-2); font-size: var(--fs-15); font-weight: 500; }
.dm-divider { height: 1px; margin: 5px 13px; background: var(--divider); }
.dm-reset {
  margin: 2px 6.5px 0;
  padding: 6.5px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--text-3);
  font-size: var(--fs-15);
  font-weight: 500;
}
.dm-reset:hover:not(:disabled) { background: var(--subtle); color: var(--text); }
.dm-reset:disabled { cursor: default; }

/* ─── Modals ─────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 13px 19px;
  overflow-y: auto;
  background: rgba(40, 40, 36, 0.32);
}
.modal {
  width: 100%;
  max-width: 461px;
  padding: 21px 22.5px 17.5px;
  border-radius: var(--r-2xl);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}
body.has-modal { overflow: hidden; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; }
.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: var(--fs-24);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: var(--tracking-display);
}
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: -3px -6px 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
}
.modal-close:hover { background: var(--hover); color: var(--text); }
.modal-sub { margin: 8px 0 0; color: var(--text-2); font-size: var(--fs-15); line-height: 1.5; }
.modal-body { display: flex; flex-direction: column; gap: 14.5px; margin-top: 17.5px; }
.modal-footer { display: flex; align-items: center; gap: 8px; margin-top: 19px; }
.modal-footnote { margin-right: auto; color: var(--text-3); font-size: var(--fs-13); }
.modal-footer .btn-small { height: 30.5px; padding: 0 13px; font-size: var(--fs-15); }
.modal-footer .btn-primary { height: 30.5px; padding: 0 14.5px; }

/* New assessment: "What they will be asked for" */
/* "What they'll be asked for": a short list, each row expands */
.ask-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.ask-item + .ask-item { border-top: 1px solid var(--divider); }
.ask-row {
  display: grid;
  grid-template-columns: 25.5px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9.5px;
  width: 100%;
  padding: 9.5px 11px;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
}
.ask-row:hover { background: var(--surface-2); }
.ask-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent-ring); }
.ask-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25.5px;
  height: 25.5px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
}
.ask-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ask-title { font-size: var(--fs-15); font-weight: 500; line-height: 1.3; }
.ask-desc {
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-13);
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ask-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-2);
  font-size: var(--fs-13);
}
.ask-toggle .icon { transition: transform 0.15s; }
.ask-row[aria-expanded="true"] .ask-toggle .icon { transform: rotate(180deg); }
.ask-row:hover .ask-toggle { color: var(--text); }

.ask-panel { margin: 0; padding: 2px 11px 9.5px 46.5px; }
.ask-file {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 -8px;
  padding: 6.5px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.ask-file:hover { background: var(--surface-2); }
.ask-file input { margin-top: 2px; flex: none; }
.ask-file-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.ask-file-name { display: flex; align-items: baseline; gap: 6.5px; font-size: var(--fs-14); color: var(--text); }
.ask-file-note { margin-left: auto; color: var(--text-3); font-size: var(--fs-12); white-space: nowrap; }
.ask-file-points { color: var(--text-3); font-size: var(--fs-12); line-height: 1.45; }
.ask-panel-hint { margin: 5px 0 0; color: var(--text-3); font-size: var(--fs-12); }
.ask-questions { padding-left: 61px; color: var(--text-2); font-size: var(--fs-14); line-height: 1.5; }
.ask-questions li { padding: 2.5px 0; }

/* ─── Feedback ───────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 19px;
  left: 50%;
  z-index: 100;
  max-width: min(448px, calc(100vw - 25.5px));
  padding: 9px 13px;
  border-radius: var(--r-lg);
  background: var(--ink);
  color: var(--on-accent);
  font-size: var(--fs-14);
  box-shadow: 0 6.5px 19px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6.5px);
  transition: opacity 0.15s, transform 0.15s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--red-ink); }

.action-toast {
  position: fixed;
  right: 19px;
  bottom: 19px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 13px;
  max-width: min(400px, calc(100vw - 25.5px));
  padding: 7px 7px 7px 13px;
  border-radius: var(--r-lg);
  background: var(--ink);
  color: var(--on-accent);
  font-size: var(--fs-14);
  box-shadow: 0 6.5px 19px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6.5px);
  transition: opacity 0.15s, transform 0.15s;
}
.action-toast.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.action-toast-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-toast-btn {
  flex: none;
  padding: 4px 9.5px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: var(--fs-14);
  font-weight: 500;
}
.action-toast-btn:hover { background: rgba(255, 255, 255, 0.16); }
@media (max-width: 640px) { .action-toast { right: 12.75px; left: 12.75px; max-width: none; } }

.page-loading {
  padding: 51px 32px;
  color: var(--text-2);
  font-size: var(--fs-15);
  text-align: center;
}
.page-loading a { color: var(--accent); }

/* ─── Sign-in ────────────────────────────────────────────────────────── */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 19px 13px;
}
.auth-card {
  width: 100%;
  max-width: 320px;
  padding: 25.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--panel);
}
.auth-brand { margin: 0 0 19px; padding: 0; }
.auth-brand .brand-logo { height: 19px; }
.auth-title {
  margin: 0 0 5px;
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: var(--fs-30);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
}
.auth-sub { margin: 0 0 19px; color: var(--text-2); font-size: var(--fs-15); }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-form .pop-field span { font-size: var(--fs-14); }
.auth-form .pop-field input { height: 33.5px; background: var(--surface); font-size: var(--fs-15); }
.auth-submit { justify-content: center; height: 33.5px; }
.auth-submit:disabled { opacity: 0.6; cursor: default; }
.auth-message { margin: 0; font-size: var(--fs-14); }
.auth-message.is-error { color: var(--red); }
.auth-message.is-info { color: var(--green); }
.auth-switch { margin: 14.5px 0 0; color: var(--text-2); font-size: var(--fs-14); }
.auth-switch .link-btn { font-size: inherit; }

/* ─── Print (Report PDF) ─────────────────────────────────────────────── */

@media print {
  body { background: #fff; }
  .app { display: block; height: auto; padding: 0; }
  .sidebar, .mobile-bar, .header-actions, .icon-btn, #add-task, .row-remove, .text-btn { display: none !important; }
  .panel { overflow: visible; border: 0; }
  .panel-body { overflow: visible; }
  .detail { grid-template-columns: minmax(0, 1fr) 192px; gap: 25.5px; padding: 13px 0; }
}

/* ─── Narrower screens ───────────────────────────────────────────────── */

@media (max-width: 1120px) {
  .detail { grid-template-columns: minmax(0, 1fr); gap: 6.5px; padding: 29px 25.5px 64px; }
  .detail-side { order: -1; padding-bottom: 6.5px; }
}

@media (max-width: 900px) {
  .search { width: auto; flex: 1; min-width: 144px; }
}

/* ─── Mobile web (576px and below) ───────────────────────────────────── */

@media (max-width: 720px) {
  :root {
    --fs-30: 21px;
    --fs-24: 17.5px;
    --row-h: auto;
  }

  body { font-size: var(--fs-15); }

  .app {
    display: block;
    height: auto;
    min-height: 100dvh;
    padding: 0;
  }

  /* Top bar with the workspace name and a menu button */
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 41.5px;
    padding: 0 9.5px 0 5px;
    border-bottom: 1px solid var(--border);
    background: var(--shell);
  }
  .mobile-bar .icon-btn { width: 32px; height: 32px; color: var(--text); }
  .mobile-bar .workspace-avatar { width: 17.5px; height: 17.5px; }
  .mobile-bar-name { font-size: var(--fs-16); font-weight: 600; }

  /* The sidebar becomes a drawer */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(240px, 84vw);
    padding: 11px 9.5px 9.5px;
    background: var(--shell);
    box-shadow: var(--shadow-modal);
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }
  body.nav-open .sidebar { transform: none; }
  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(40, 40, 36, 0.32);
  }
  body.nav-open .nav-scrim { display: block; }
  body.nav-open { overflow: hidden; }
  .nav-item { height: 35px; font-size: var(--fs-16); }
  .workspace { height: 35px; }

  /* Edge-to-edge panel; the page scrolls rather than the panel */
  .panel { min-height: calc(100dvh - 41.5px); border: 0; border-radius: 0; overflow: visible; }
  .panel-body, .table-wrap { overflow: visible; }
  .panel-header { height: 45px; padding: 0 8px 0 13px; background: var(--panel); }
  .panel > .panel-header { position: sticky; top: 41.5px; z-index: 20; }
  .panel-header { flex-wrap: wrap; row-gap: 5px; height: auto; min-height: 45px; padding-top: 6.5px; padding-bottom: 6.5px; }
  .panel-header .breadcrumb { flex: 1 1 160px; }
  .panel-header .header-actions { margin-left: auto; }
  .breadcrumb { gap: 6.5px; }
  .breadcrumb .crumb { display: none; }
  .breadcrumb .crumb-sep { display: none; }
  .header-actions .btn-small, .header-actions .delete-pill { height: 32px; }
  .btn-primary { height: 32px; padding: 0 13px 0 11px; }

  .toolbar { flex-wrap: wrap; gap: 6.5px; padding: 11px 13px 8px; }
  .search { order: -1; flex: 1 1 100%; width: 100%; }
  .btn-pill { height: 32px; }
  .toolbar-meta { flex: 1 1 100%; margin-left: 0; font-size: var(--fs-13); }

  /* Touch targets */
  .icon-btn, .modal-close, .pager-btn, .tag-add { width: 32px; height: 32px; }
  .send-btn { width: 29px; height: 29px; }
  .text-btn { height: 32px; }
  .btn-small { height: 32px; }
  .segmented button { height: 27px; }
  .pop-item, .filter-menu .pop-item, .filter-sub .pop-item { min-height: 37px; }
  .prop { min-height: 32px; }
  .row-remove { width: 29px; height: 29px; opacity: 1; }
  .task-due.is-empty, .task-owner.is-empty { opacity: 1; }
  .chip-remove { visibility: visible; }

  /* Tables become stacked cards. The first cell is the title; cells with
     data-label show their label on the left. */
  .table-wrap { padding: 0 13px 19px; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table { table-layout: auto; white-space: normal; }
  .table thead { display: none; }
  .table tbody tr {
    padding: 9.5px 0;
    border-bottom: 1px solid var(--divider);
  }
  .table tbody tr:hover td { background: none; }
  .table td {
    display: flex;
    align-items: center;
    gap: 9.5px;
    height: auto;
    min-height: 24px;
    padding: 2.5px 0;
    overflow: visible;
    font-size: var(--fs-15);
  }
  .table td:first-child { padding-bottom: 5px; font-size: var(--fs-16); }
  .table td[data-label]::before {
    content: attr(data-label);
    flex: none;
    width: 89.5px;
    color: var(--text-3);
    font-size: var(--fs-14);
  }
  .table td:first-child[data-label]::before { display: none; }
  .table td:empty, .table td[data-empty] { display: none; }
  .table.is-assessments td { height: auto; }
  .company-name, .company-sub { white-space: normal; }
  .progress-track { width: 77px; }

  .list-footer { justify-content: space-between; }
  .list-empty { padding: 45px 13px; }

  /* Detail page stacks with the side panel first */
  .detail { gap: 3px; padding: 17.5px 13px 51px; }
  .detail-title { margin-bottom: 11px; }
  .detail-desc { font-size: var(--fs-16); }
  .rule { margin: 21px 0; }
  .section-head { flex-wrap: wrap; row-gap: 5px; }
  .section-head > :not(.section-title) { flex: none; white-space: nowrap; }
  .side-label { margin-top: 14.5px; }

  .data-row { flex-wrap: wrap; row-gap: 6.5px; min-height: 0; padding: 11px; }
  .data-actions { flex: 1 1 100%; justify-content: flex-end; flex-wrap: wrap; padding-left: 25.5px; }
  .file-chip { max-width: 100%; }
  .question-row { flex-wrap: wrap; padding: 9.5px 11px; }
  .question-text { flex: 1 1 calc(100% - 38.5px); }
  .question-add input { flex: 1 1 100%; height: 32px; }
  .card-footer { flex-wrap: wrap; }
  .card-footer .btn-calc { height: 32px; margin-left: auto; }
  .dropzone { align-items: flex-start; }

  .task { flex-wrap: wrap; row-gap: 3px; padding: 6.5px 0; }
  .task.is-action { padding: 8px 0; }
  .task-body { flex: 1 1 calc(100% - 32px); }
  .task.is-action .priority { margin-left: 24px; }

  .comment-head { padding: 11px 11px 5px; }
  .comment-body { padding: 0 11px 11px; }
  .comment-reply { padding: 8px 8px 8px 11px; }
  .activity-toggle .activity-text { white-space: normal; }

  /* Popovers become bottom sheets */
  .popover:not(.is-inline) {
    top: auto !important;
    right: 0;
    bottom: 0;
    left: 0 !important;
    z-index: 70;
    width: 100% !important;
    min-width: 0;
    max-width: none;
    max-height: 82dvh;
    overflow: auto;
    border-width: 1px 0 0;
    border-radius: 14.5px 14.5px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-in 0.18s ease;
  }
  .popover:not(.is-inline)::before {
    content: "";
    display: block;
    width: 29px;
    height: 3px;
    margin: 6.5px auto 2px;
    border-radius: 2px;
    background: var(--border-strong);
  }
  .popover-scrim {
    position: fixed;
    inset: 0;
    z-index: 65;
    display: block;
    background: rgba(40, 40, 36, 0.28);
  }
  .pop-list { max-height: none; }
  .filter-sub { position: static; width: auto; margin: 0 0 3px 29px; padding: 0; border: 0; box-shadow: none; }
  .display-menu .dm-row .select { max-width: none; flex: 1; height: 32px; }
  .toggle-chip { height: 29px; }

  /* Modals fill most of the screen and rise from the bottom */
  .modal-backdrop { align-items: flex-end; padding: 13px 0 0; }
  .modal {
    max-width: none;
    min-height: 60dvh;
    max-height: calc(100dvh - 13px);
    padding: 17.5px 13px calc(13px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 14.5px 14.5px 0 0;
    animation: sheet-in 0.2s ease;
  }
  .field-row { grid-template-columns: 1fr !important; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footnote { flex: 1 1 100%; }
  .modal-footer .btn-small, .modal-footer .btn-primary { flex: 1; height: 35px; }
  .input { height: 35px; font-size: var(--fs-16); }
  .chips-input input { font-size: var(--fs-16); }

  .ask-row { flex-wrap: wrap; row-gap: 2px; }
  .ask-toggle { order: 2; margin-left: auto; }
  .ask-desc { flex: 1 1 calc(100% - 32px); order: 3; margin-left: 32px; }

  .auth-card { padding: 21px 16px; }
  .toast { bottom: calc(13px + env(safe-area-inset-bottom)); }
}

@keyframes sheet-in {
  from { transform: translateY(13px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Activity on the assessment page */

.activity-section .composer { margin-top: 9.5px; }
.comment-head .comment-delete { margin-left: auto; opacity: 0; }
.comment:hover .comment-delete, .comment-delete:focus-visible { opacity: 1; }
.comment-thread-reply { border-top: 1px solid var(--divider); }
.comment-thread-reply .comment-head { padding-top: 9.5px; }
.comment-body.is-deleted { color: var(--text-3); font-style: italic; }
.activity-empty .activity-text { padding-left: 0; color: var(--text-3); }
.icon-btn.has-filter { color: var(--accent); }

/* Narrow screens: title and description first, then the details panel, then everything else. */
@media (max-width: 1120px) {
  .detail { display: flex; flex-direction: column; }
  .detail-main { display: contents; }
  .detail-main > * { order: 4; }
  .detail-main > .detail-title { order: 1; }
  .detail-main > .detail-desc { order: 2; }
  .detail-side { order: 3; padding: 14.5px 0 3px; margin-top: 14.5px; border-top: 1px solid var(--divider); }
}

.table.is-assessments.hide-status [data-col="status"],
.table.is-assessments.hide-progress [data-col="progress"],
.table.is-assessments.hide-due [data-col="due"],
.table.is-assessments.hide-people [data-col="people"],
.table.is-assessments.hide-index [data-col="index"] { display: none; }


/* ─── App additions on the library ───────────────────────────────────── */

/* Tags as chips in a property row: the icon lines up with the first row of chips */
.prop.is-tags { align-items: flex-start; padding-top: 2.5px; padding-bottom: 2.5px; }
.prop.is-tags .prop-icon { height: 22.5px; }
.prop.is-tags .tag-list { gap: 4px; padding-top: 0; }
.prop.is-tags .tag { height: 22.5px; padding: 0 9px; font-size: var(--fs-14); }
.prop.is-tags .tag-add { width: 22.5px; height: 22.5px; }

/* Property rows that link somewhere (task page: its assessment) */
a.prop { color: inherit; text-decoration: none; }
a.prop:hover { background: var(--hover); }
a.prop:hover .prop-text { color: var(--accent); }

/* Task rows open the task page */
a.task-body { color: inherit; text-decoration: none; border-radius: var(--r-sm); }
a.task-body:hover .task-text { color: var(--accent); }
a.task-body:focus-visible { outline: none; box-shadow: 0 0 0 2.5px var(--accent-ring); }
.priority .priority-icon { width: 12px; height: 12px; }
.task-points { color: var(--green); font-variant-numeric: tabular-nums; }
.task-due { font-variant-numeric: tabular-nums; }

/* "Fixes: …" line under a task title */
.task-fixes { margin: 8px 0 0; color: var(--text-2); font-size: var(--fs-15); }
.task-fixes strong { color: var(--text); font-weight: 500; }

/* Sign-in uses the library field labels; "Forgot your password?" sits under the password */
.auth-form .pop-field span { color: var(--text); font-size: var(--fs-14); font-weight: 500; }
.auth-form .pop-field { gap: var(--sp-2); }
.auth-forgot { margin-top: 0; font-size: var(--fs-14); }
.auth-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); margin-top: -2px; }
.auth-remember { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-size: var(--fs-14); cursor: pointer; }

/* ─── Questions: progress card and questionnaire ─────────────────────── */

.status-pill.is-red { background: var(--red-soft); color: var(--red); }
.status-pill.is-red .status-pill-dot { background: var(--red); }

.progress-track.is-wide { width: 100%; height: 5px; border-radius: 2.5px; }
.progress-track.is-wide .progress-fill { border-radius: 2.5px; }

.q-progress { margin-bottom: 9.5px; }
.q-progress-head {
  display: flex;
  align-items: center;
  gap: 9.5px;
  padding: 14.5px 16px;
  border-bottom: 1px solid var(--divider);
}
.q-progress-title { margin: 0; font-size: var(--fs-18); font-weight: 500; color: var(--text); }
.q-progress-head .status-pill { font-size: var(--fs-13); }
.q-progress-action { margin-left: auto; }
.q-progress-action .icon { width: 12px; height: 12px; }

.q-progress-body {
  display: grid;
  grid-template-columns: minmax(128px, 0.9fr) 1.3fr;
  grid-auto-rows: minmax(54.5px, auto);
  column-gap: 22.5px;
  padding: 14.5px 16px 11px;
}
.q-steps { display: contents; margin: 0; padding: 0; list-style: none; }
.q-step {
  position: relative;
  grid-column: 1;
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.q-step-mark {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  flex: none;
  border-radius: 50%;
  background: var(--hover);
  color: var(--accent);
}
.q-step-mark .icon { width: 11px; height: 11px; stroke-width: 2; }
.q-step.is-done .q-step-mark, .q-step.is-current .q-step-mark { background: var(--accent-soft); }
.q-step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
/* Line down to the next step: accent once this step is done. */
.q-step:not(:nth-child(4))::after {
  content: "";
  position: absolute;
  top: 24px;
  bottom: -4px;
  left: 10px;
  width: 1.5px;
  background: var(--divider);
}
.q-step.is-done:not(:nth-child(4))::after { background: var(--accent); }
.q-step-text { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.q-step-label { color: var(--text); font-size: var(--fs-15); }
.q-step-date { color: var(--accent); font-size: var(--fs-14); }
.q-step-date.is-empty { color: var(--text-3); }

.q-owner {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 0 -8px;
  padding: 3px 6.5px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--text);
  font-size: var(--fs-15);
}
.q-owner:hover, .q-owner.is-open { background: var(--hover); }
.q-meter { grid-column: 2; grid-row: 3; align-self: start; display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.q-meter-line { display: flex; justify-content: space-between; gap: 9.5px; font-size: var(--fs-15); color: var(--text); }
.q-meter-count { color: var(--accent); }

.questions-card { margin-bottom: 9.5px; }
.questions-card .questions-head { border-bottom: 0; }
.questions-card .questions-head[aria-expanded="true"] { border-bottom: 1px solid var(--divider); }
.questions-toggle { display: inline-flex; align-items: center; gap: 3px; }
.calc-card .card-footer { border-top: 0; }

/* The questionnaire: one question at a time */
.modal.is-questionnaire { max-width: 496px; }
.qz-progress { margin-top: 13px; }
.qz-question {
  margin: 21px 0 14.5px;
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
}
.qz-options { display: flex; flex-direction: column; gap: 6.5px; }
.qz-option {
  display: flex;
  align-items: center;
  gap: 9.5px;
  min-height: 38.5px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-16);
  text-align: left;
}
.qz-option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.qz-option:focus-visible { outline: none; border-color: var(--focus-border, var(--accent)); box-shadow: 0 0 0 2.5px var(--accent-ring); }
.qz-option.is-on { border-color: var(--accent); background: var(--accent-soft); }
.qz-radio {
  width: 14.5px;
  height: 14.5px;
  flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
}
.qz-option.is-on .qz-radio { border: 4px solid var(--accent); }
.btn-small:disabled { opacity: 0.45; cursor: default; }

@media (max-width: 720px) {
  .q-progress-head { flex-wrap: wrap; padding: 13px; }
  .q-progress-action { width: 100%; margin-left: 0; }
  .q-progress-body { grid-template-columns: 1fr; grid-auto-rows: auto; row-gap: 14.5px; padding: 13px; }
  .q-step { grid-row: auto !important; }
  .q-step:not(:nth-child(4))::after { bottom: -22px; }
  .q-owner, .q-meter { grid-column: 1; grid-row: auto; }
  .q-owner { margin-top: 3px; }
  .qz-question { font-size: var(--fs-20); }
}

@media (max-width: 720px) {
  .calc-card .card-footer { flex-wrap: wrap; }
  .calc-card .footer-text { flex-basis: calc(100% - 25.5px); }
  .calc-card .btn-calc { width: 100%; }
}

/* Account menu opens from the ReFresh logo */
.mobile-workspace {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6.5px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--text);
}
.mobile-workspace:hover, .mobile-workspace.is-open, .workspace.is-open { background: var(--hover); }
.mobile-workspace .icon { color: var(--text-2); }
.account-menu { min-width: 208px; }

/* ─── Calculating: bouncing ball loader ──────────────────────────────── */

.calc-loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(249, 249, 248, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s;
}
.calc-loading.is-visible { opacity: 1; }
.calc-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 260px;
  padding: 26px 32px 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
  text-align: center;
}
.calc-loading-title { margin: 14px 0 4px; color: var(--text); font-size: var(--fs-16); font-weight: 500; }
.calc-loading-step { margin: 0; min-height: 1.4em; color: var(--text-2); font-size: var(--fs-14); }
.calc-loading-step.is-in { animation: calc-step-in 0.3s ease-out; }
.calc-loading-note { max-width: 260px; margin: 8px auto 0; color: var(--text-3); font-size: var(--fs-13); line-height: 1.45; }

.bounce { position: relative; width: 56px; height: 64px; }
.bounce-ball {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8a80f6, var(--accent) 60%, #3f33c9);
  transform-origin: 50% 100%;
  animation: bounce-ball 0.9s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.bounce-shadow {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 24px;
  height: 5px;
  margin-left: -12px;
  border-radius: 50%;
  background: rgba(91, 78, 240, 0.25);
  animation: bounce-shadow 0.9s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes bounce-ball {
  0%   { transform: translateY(0) scale(1.18, 0.82); }
  12%  { transform: translateY(-6px) scale(0.94, 1.06); }
  50%  { transform: translateY(-38px) scale(1, 1); }
  88%  { transform: translateY(-6px) scale(0.96, 1.04); }
  100% { transform: translateY(0) scale(1.18, 0.82); }
}
@keyframes bounce-shadow {
  0%, 100% { transform: scale(1.1); opacity: 0.9; }
  50%      { transform: scale(0.45); opacity: 0.35; }
}
@keyframes calc-step-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bounce-ball { animation: bounce-pulse 1.4s ease-in-out infinite; }
  .bounce-shadow { animation: none; }
  .calc-loading-step.is-in { animation: none; }
  @keyframes bounce-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
}

/* ─── Add task pop-up ────────────────────────────────────────────────── */

.modal.is-composer { max-width: 640px; padding: 18px 19px 16px; }
.task-composer { display: flex; flex-direction: column; }
.tc-head { display: flex; align-items: flex-start; gap: 10px; }
.tc-title {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.tc-title::placeholder { color: var(--text-3); }
.tc-desc {
  min-height: 64px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-16);
  line-height: 1.5;
}
.tc-desc::placeholder { color: var(--text-3); }
.tc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-14);
  white-space: nowrap;
}
.tc-chip:hover, .tc-chip.is-open { border-color: var(--border-strong); background: var(--surface-2); }
.tc-chip.is-empty { color: var(--text-2); }
.tc-chip .icon { width: 14px; height: 14px; color: var(--text-2); }
.tc-chip .avatar { width: 17px; height: 17px; font-size: 7px; }
.tc-chip .priority-icon, .tc-chip .status-circle { width: 14px; height: 14px; }
.tc-chip.is-icon { width: 30px; padding: 0; justify-content: center; }
.tc-chip > span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.tc-footer { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 22px; }

/* New assessment uses the composer too, with a few chips of its own */
.tc-chip.is-invalid { border-color: #efc2b8; background: var(--red-soft); color: var(--red); }
.tc-chip.is-invalid .icon { color: var(--red); }
.tc-footnote { margin-right: auto; color: var(--text-3); font-size: var(--fs-13); }
.task-composer .field-error { margin-top: 12px; }
/* The pop-up's pickers. They're popover menus like the rest of the library, a bit wider. */
.popover.na-companies, .popover.na-invite { width: 300px; max-width: calc(100vw - 24px); }
.popover.na-panel { width: 400px; max-width: calc(100vw - 24px); }
.na-company { position: relative; }
.na-company-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: -3px -4px -3px 0;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--text-3);
  opacity: 0;
}
.na-company:hover .na-company-delete, .na-company-delete:focus-visible { opacity: 1; }
.na-company-delete:hover { background: var(--red-soft); color: var(--red); }
.na-company-delete .icon { width: 13px; height: 13px; }
@media (hover: none) { .na-company-delete { opacity: 1; } }

.na-person { cursor: default; }
.na-person .avatar { width: 20px; height: 20px; font-size: 8px; }
.na-person .pop-label { display: flex; flex-direction: column; }
.na-person.is-invalid .pop-label { color: var(--red); }
.na-person-note { color: var(--red); font-size: var(--fs-12); }
.na-person-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--text-3);
}
.na-person-remove:hover { background: var(--hover); color: var(--text); }
.na-pop-foot {
  display: flex;
  gap: 6.5px;
  padding: 9px 13px 10px;
  border-top: 1px solid var(--divider);
  color: var(--text-3);
  font-size: var(--fs-12);
  line-height: 1.45;
}
.na-pop-foot .icon { flex: none; width: 12px; height: 12px; margin-top: 1.5px; }

.na-panel-head { padding: 11px 13px 4px; color: var(--text-2); font-size: var(--fs-13); font-weight: 500; }
.na-panel-list { max-height: min(400px, 60vh); padding: 3px 5px 5px; overflow-y: auto; }
.na-toggle {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 8px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.na-toggle:hover { background: var(--subtle); }
.na-toggle-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.na-toggle-title { display: flex; align-items: baseline; gap: 6.5px; color: var(--text); font-size: var(--fs-14); }
.na-toggle-note { margin-left: auto; color: var(--text-3); font-size: var(--fs-12); white-space: nowrap; }
.na-toggle-detail { color: var(--text-3); font-size: var(--fs-12); line-height: 1.45; }
.na-toggle .switch { margin-top: 1px; }
.na-section + .na-section { margin-top: 2px; border-top: 1px solid var(--divider); padding-top: 2px; }
.na-section-questions { margin: 0 0 6px; padding: 0 52px 0 26px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.5; }
.na-section-questions li { padding: 1.5px 0; }
.na-section.is-off .na-section-questions { opacity: 0.45; text-decoration: line-through; text-decoration-color: var(--text-4); }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-14); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative;
  width: 32px;
  height: 18px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--border-strong);
  transition: background 0.15s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-toggle);
  transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--accent-ring); }

@media (max-width: 720px) {
  .tc-footer { justify-content: space-between; }
}

/* Chart tooltips (tipAttr in ui.js) */
.chart-tip {
  position: fixed;
  z-index: 120;
  max-width: 260px;
  padding: 7px 9.5px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: #fff;
  font-size: var(--fs-13);
  line-height: 1.45;
  box-shadow: 0 6.5px 19px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
}
.chart-tip.is-visible { opacity: 1; }
.chart-tip-title { font-weight: 500; }
.chart-tip-line { color: rgba(255, 255, 255, 0.72); }
[data-tip] { cursor: default; }
.is-tipped { filter: brightness(0.92); }
@media print { .chart-tip { display: none; } }

/* Delete confirm, anchored to the bin */
.popover.confirm-pop { display: flex; flex-direction: column; gap: 11px; width: 264px; padding: 13px; }
.confirm-pop-title { color: var(--text); font-size: var(--fs-15); font-weight: 500; }
.confirm-pop-text { margin: 4px 0 0; color: var(--text-2); font-size: var(--fs-13); line-height: 1.45; }
.btn-small.is-danger { border-color: var(--red); background: var(--red); color: #fff; }
.btn-small.is-danger:hover { background: var(--red-ink); }
.btn-small.is-danger .icon { color: #fff; }
/* Delete assessment: a light red pill, top right of the assessment page */
.delete-pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 25.5px;
  padding: 0 11px;
  border: 1px solid #f4d3cb;
  border-radius: var(--r-full);
  background: var(--red-soft);
  color: var(--red);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
}
.delete-pill:hover, .delete-pill.is-open { border-color: #efc2b8; background: #fbe3dd; }
.delete-pill:focus-visible { outline: none; box-shadow: 0 0 0 2.5px rgba(196, 81, 59, 0.2); }
