/*
 * Fernwell component library — the app's only design system now that
 * every page has been migrated. Everything here is still scoped under
 * `.fernwell` (wrap markup in a `.fernwell` container and pull in
 * fernwell-tokens.css + this file) rather than applied globally.
 */

.fernwell {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cloud);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
  margin: 0 auto;
}

.fernwell * {
  box-sizing: border-box;
}

/* The `hidden` attribute is a UA-stylesheet rule, so any author rule that
   sets `display` (e.g. `.field`, `.row` being flex) silently wins over it
   regardless of selector specificity. Restore it explicitly wherever a
   component might be toggled with the `hidden` attribute. */
.fernwell [hidden] {
  display: none !important;
}

.fernwell h1,
.fernwell h2,
.fernwell h3,
.fernwell h4 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--ink);
}

.fernwell p {
  margin: 0;
}

.fernwell code {
  font-family: var(--font-mono);
}

.fernwell a {
  color: var(--plum);
  font-weight: 600;
  text-decoration: none;
}

.fernwell a:hover {
  text-decoration: underline;
}

.fernwell .subtitle {
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---- auth page shell ---- */
.fernwell .auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}

.fernwell .auth-shell .card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.fernwell .auth-shell .field {
  max-width: none;
}

/* ---- layout helpers ---- */
.fernwell .row {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  align-items: center;
}

/* ---- app page shell ---- */
.fernwell .page {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-8);
}

.fernwell .page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.fernwell .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}

@media (max-width: 640px) {
  .fernwell .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ---- card ---- */
.fernwell .card {
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1.5px solid var(--cloud-dim);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
}

.fernwell .card + .card {
  margin-top: var(--sp-3);
}

/* ---- list row (clickable resource cards: checklists, invoices, etc.) ---- */
.fernwell .list-row {
  display: block;
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1.5px solid var(--cloud-dim);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4) var(--sp-5);
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.fernwell .list-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.fernwell .list-row + .list-row {
  margin-top: var(--sp-3);
}

.fernwell .list-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
}

.fernwell .list-row-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.fernwell .list-row-meta {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---- file list (reference documents, uploaded files) ---- */
.fernwell .file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- disclosure (native <details> used as an inline expand/collapse) ---- */
.fernwell .disclosure > summary {
  cursor: pointer;
  color: var(--plum);
  font-weight: 600;
  font-size: 13px;
  list-style: none;
}

.fernwell .disclosure > summary::-webkit-details-marker {
  display: none;
}

.fernwell .disclosure > summary:hover {
  text-decoration: underline;
}

.fernwell .list-row-progress {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---- buttons ---- */
.fernwell .btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--r-md);
  padding: 12px 22px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.fernwell .btn:hover {
  transform: translateY(-1px);
}

.fernwell .btn:active {
  transform: translateY(0);
}

.fernwell .btn-primary {
  background: var(--marigold);
  color: var(--ink-fixed);
  box-shadow: var(--shadow-marigold);
}

.fernwell .btn-primary:hover {
  background: var(--marigold-dk);
}

.fernwell .btn-secondary {
  background: var(--plum);
  color: var(--white);
}

.fernwell .btn-secondary:hover {
  background: var(--plum-dk);
}

.fernwell .btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--cloud-dim);
}

.fernwell .btn-ghost:hover {
  border-color: var(--ink-soft);
}

.fernwell .btn-danger {
  background: var(--coral-bg);
  color: var(--coral);
}

.fernwell .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.fernwell .btn-loading {
  cursor: progress;
}

.fernwell .btn .spinner {
  margin-right: 2px;
}

/* ---- form fields ---- */
.fernwell .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 320px;
  margin: 8px;
}

.fernwell .field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.fernwell .field .hint {
  font-size: 12px;
  color: var(--ink-soft);
}

.fernwell .field input,
.fernwell .field select,
.fernwell .field textarea {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--cloud-dim);
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.2s ease, color 0.2s ease;
}

.fernwell .field textarea {
  min-height: 90px;
  resize: vertical;
}

.fernwell .field input::placeholder,
.fernwell .field textarea::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.fernwell .field input:focus,
.fernwell .field select:focus,
.fernwell .field textarea:focus {
  border-color: var(--marigold-dk);
  box-shadow: 0 0 0 4px rgba(255, 193, 69, 0.25);
}

.fernwell .field input.error,
.fernwell .field textarea.error {
  border-color: var(--coral);
}

.fernwell .field .error-msg {
  font-size: 12px;
  color: var(--coral);
  font-weight: 600;
}

.fernwell .required-mark {
  color: var(--coral);
  font-weight: 700;
  margin-left: 3px;
}

.fernwell .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fernwell .field input:disabled {
  background: var(--cloud-dim);
  color: var(--ink-soft);
  border-color: var(--cloud-dim);
  cursor: not-allowed;
}

.fernwell .field.is-disabled label {
  color: var(--ink-soft);
}

/* ---- selection controls (checkbox, radio, toggle) ---- */
.fernwell .checkbox,
.fernwell .radio,
.fernwell .toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.fernwell .checkbox input,
.fernwell .radio input,
.fernwell .toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.fernwell .checkbox .box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--cloud-dim);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.fernwell .checkbox .box svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.fernwell .checkbox input:checked + .box {
  background: var(--marigold);
  border-color: var(--marigold);
}

.fernwell .checkbox input:checked + .box svg {
  opacity: 1;
}

.fernwell .checkbox input:focus-visible + .box {
  box-shadow: 0 0 0 4px rgba(255, 193, 69, 0.25);
}

.fernwell .checkbox input:disabled + .box {
  background: var(--cloud-dim);
  border-color: var(--cloud-dim);
}

.fernwell .checkbox input:disabled ~ span {
  color: var(--ink-soft);
}

.fernwell .checkbox input:disabled {
  cursor: not-allowed;
}

.fernwell .checkbox:has(input:disabled) {
  cursor: not-allowed;
}

.fernwell .radio .box {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--cloud-dim);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.12s ease;
}

.fernwell .radio .box::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.12s ease;
}

.fernwell .radio input:checked + .box {
  border-color: var(--marigold);
}

.fernwell .radio input:checked + .box::after {
  background: var(--marigold);
}

.fernwell .radio input:focus-visible + .box {
  box-shadow: 0 0 0 4px rgba(255, 193, 69, 0.25);
}

.fernwell .toggle .track {
  width: 42px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--cloud-dim);
  position: relative;
  flex-shrink: 0;
  transition: background 0.16s ease;
}

.fernwell .toggle .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease;
}

.fernwell .toggle input:checked + .track {
  background: var(--marigold);
}

.fernwell .toggle input:checked + .track .thumb {
  transform: translateX(18px);
}

.fernwell .toggle input:focus-visible + .track {
  box-shadow: 0 0 0 4px rgba(255, 193, 69, 0.25);
}

.fernwell .toggle input:disabled + .track {
  opacity: 0.5;
}

.fernwell .toggle input:disabled ~ span {
  color: var(--ink-soft);
}

.fernwell .option-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- autocomplete / combobox ---- */
.fernwell .combobox-wrap {
  position: relative;
}

.fernwell .combobox-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--white);
  border: 1.5px solid var(--cloud-dim);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.fernwell .combobox-list.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.fernwell .combobox-option {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
}

.fernwell .combobox-option:hover,
.fernwell .combobox-option.active {
  background: var(--cloud);
}

.fernwell .combobox-option b {
  color: var(--marigold-dk);
  font-weight: 700;
}

.fernwell .combobox-empty {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
}

/* ---- status tags (signature tilted stickers) ---- */
.fernwell .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--r-md);
  transform: rotate(-2deg);
}

.fernwell .tag:nth-of-type(2n) {
  transform: rotate(1.5deg);
}

.fernwell .tag:nth-of-type(3n) {
  transform: rotate(-1deg);
}

.fernwell .tag-live {
  background: var(--meadow-bg);
  color: var(--meadow);
}

.fernwell .tag-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--meadow);
}

.fernwell .tag-pending {
  background: var(--pending-bg);
  color: var(--marigold-dk);
}

.fernwell .tag-error {
  background: var(--coral-bg);
  color: var(--coral);
}

.fernwell .tag-info {
  background: var(--sky-bg);
  color: var(--sky);
}

/* ---- alerts ---- */
.fernwell .alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  margin-left: 8px;
  margin-right: 8px;
  border-radius: var(--r-md);
  align-items: flex-start;
}

.fernwell .alert .dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

.fernwell .alert-title {
  font-weight: 700;
  font-size: 14px;
}

.fernwell .alert-body {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.fernwell .alert-success {
  background: var(--meadow-bg);
}

.fernwell .alert-success .dot {
  background: var(--meadow);
}

.fernwell .alert-error {
  background: var(--coral-bg);
}

.fernwell .alert-error .dot {
  background: var(--coral);
}

.fernwell .alert-pending {
  background: var(--pending-bg);
}

.fernwell .alert-pending .dot {
  background: var(--marigold-dk);
}

.fernwell .alert-info {
  background: var(--sky-bg);
}

.fernwell .alert-info .dot {
  background: var(--sky);
}

.fernwell .alert-with-action {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.fernwell .alert-with-action .alert-main {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ---- nav ---- */
.fernwell .nav-header {
  position: sticky;
  top: 8px;
  z-index: 50;
  background: var(--plum);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.fernwell .nav-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.fernwell .nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.fernwell .nav-brand {
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fernwell .nav-brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--marigold);
}

/* ---- org switcher (a <details> dropdown living in the nav) ---- */
.fernwell .org-switcher {
  position: relative;
}

.fernwell .org-switcher > summary {
  list-style: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.fernwell .org-switcher > summary::-webkit-details-marker {
  display: none;
}

.fernwell .org-switcher > summary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.fernwell .org-switcher-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  min-width: 240px;
  background: var(--white);
  border: 1.5px solid var(--cloud-dim);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fernwell .org-switcher-menu form {
  margin: 0;
}

.fernwell .org-switcher-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  border: none;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  cursor: pointer;
}

.fernwell .org-switcher-item:hover {
  background: var(--cloud);
}

.fernwell .org-switcher-item--current {
  color: var(--ink-soft);
  cursor: default;
}

.fernwell .org-switcher-item--current:hover {
  background: none;
}

.fernwell .org-switcher-new {
  display: flex;
  gap: var(--sp-2);
  border-top: 1.5px solid var(--cloud-dim);
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
}

.fernwell .org-switcher-new input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--cloud-dim);
  background: var(--white);
  color: var(--ink);
  outline: none;
}

.fernwell .org-switcher-new button {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: none;
  background: var(--plum);
  color: var(--white);
  cursor: pointer;
}

.fernwell .nav-links {
  display: flex;
  gap: var(--sp-5);
}

.fernwell .nav-links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.fernwell .nav-links a.active {
  color: var(--white);
}

.fernwell .nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--marigold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--ink-fixed);
  font-family: var(--font-display);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: filter 0.12s ease;
}

.fernwell button.nav-avatar:hover {
  filter: brightness(1.05);
}

.fernwell .nav-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

/* hamburger toggle — hidden until the nav is tight */
.fernwell .nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.fernwell .nav-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}

.fernwell .nav-toggle span {
  width: 16px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.fernwell .nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.fernwell .nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.fernwell .nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* mobile dropdown panel */
.fernwell .nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1.5px solid var(--cloud-dim);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.fernwell .nav-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* compact, right-aligned popover anchored under a single trigger (e.g. the
   account avatar), as opposed to the full-width mobile nav-links panel */
.fernwell .nav-dropdown--menu {
  left: auto;
  right: 0;
  min-width: 180px;
}

.fernwell .nav-dropdown a,
.fernwell .nav-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: none;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}

.fernwell .nav-dropdown a:hover,
.fernwell .nav-dropdown button:hover {
  background: var(--cloud);
}

.fernwell .nav-dropdown a.active {
  background: var(--marigold);
  color: var(--ink-fixed);
}

.fernwell .nav-dropdown form {
  margin: 0;
}

/* below 600px: collapse inline links into the toggle + dropdown */
@media (max-width: 600px) {
  .fernwell .nav-links {
    display: none;
  }

  .fernwell .nav-toggle {
    display: flex;
  }
}

/* ---- stat card ---- */
.fernwell .stat-label {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

.fernwell .stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  margin-top: 4px;
}

.fernwell .stat-delta {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--meadow);
  margin-top: 4px;
}

/* ---- progress & loading (labeled/indeterminate track, spinners) ---- */
.fernwell .progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 13px;
}

.fernwell .progress-label-row .name {
  font-weight: 600;
  color: var(--ink);
}

.fernwell .progress-label-row .pct {
  font-family: var(--font-mono);
  color: var(--ink-soft);
}

.fernwell .progress-track {
  position: relative;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--cloud-dim);
  overflow: hidden;
}

.fernwell .progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--marigold);
  width: 0;
  transition: width 0.4s ease;
}

.fernwell .progress-fill.success {
  background: var(--meadow);
}

.fernwell .progress-track.indeterminate .progress-fill {
  position: absolute;
  width: 40%;
  left: -40%;
  animation: indeterminate-slide 1.4s ease-in-out infinite;
}

@keyframes indeterminate-slide {
  0% {
    left: -40%;
    width: 40%;
  }
  50% {
    width: 60%;
  }
  100% {
    left: 100%;
    width: 40%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-opacity {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.fernwell .spinner {
  display: inline-block;
  border-radius: 50%;
  flex-shrink: 0;
  border: 3px solid var(--cloud-dim);
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
}

.fernwell .spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.fernwell .spinner-md {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

.fernwell .spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.fernwell .spinner-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .fernwell .spinner {
    animation: pulse-opacity 1.2s ease-in-out infinite;
    border-top-color: var(--cloud-dim);
  }

  .fernwell .progress-track.indeterminate .progress-fill {
    position: static;
    width: 100%;
    animation: pulse-opacity 1.2s ease-in-out infinite;
  }
}

.fernwell .results-panel {
  position: relative;
}

.fernwell .results-panel-overlay {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  z-index: 10;
}

.fernwell .results-panel.is-loading .results-panel-overlay {
  display: flex;
}

.fernwell .results-panel.is-loading > *:not(.results-panel-overlay) {
  opacity: 0.5;
}

/* ---- empty state ---- */
.fernwell .empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
}

.fernwell .empty .blob {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--sp-4);
  border-radius: 38% 62% 60% 40% / 48% 42% 58% 52%;
  background: linear-gradient(135deg, var(--marigold), #ffd988);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.fernwell .empty h4 {
  font-size: 17px;
  margin-bottom: 6px;
}

.fernwell .empty p {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 36ch;
  margin: 0 auto var(--sp-4);
}

/* ---- client link row ---- */
.fernwell .link-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--white);
  border: 1.5px solid var(--cloud-dim);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}

.fernwell .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--meadow);
}

.fernwell .status-dot.muted {
  background: var(--ink-soft);
}

.fernwell .link-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fernwell .link-main .status-text {
  font-size: 12px;
  color: var(--ink-soft);
}

.fernwell .link-main .url {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fernwell .btn-copy {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  border: 1.5px solid var(--cloud-dim);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 74px;
  justify-content: center;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.fernwell .btn-copy:hover {
  border-color: var(--ink-soft);
}

.fernwell .btn-copy.copied {
  background: var(--marigold);
  border-color: var(--marigold);
  color: var(--ink-fixed);
}

.fernwell .btn-copy svg {
  width: 13px;
  height: 13px;
}

/* ---- icon button (small square action button used on task rows) ---- */
.fernwell .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--cloud-dim);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  flex-shrink: 0;
  text-decoration: none;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.fernwell .icon-btn:hover {
  border-color: var(--plum);
  color: var(--plum);
}

.fernwell .icon-btn svg {
  width: 15px;
  height: 15px;
}

/* ---- task row (checklist item, expandable detail) ---- */
.fernwell .task {
  background: var(--white);
  border: 1.5px solid var(--cloud-dim);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.fernwell .task-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  transition: box-shadow 0.12s ease;
}

.fernwell .task:has(summary.task-toggle:hover),
.fernwell .task:has(> .task-toggle:hover),
.fernwell .task:has(> .task-meta:hover) {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--plum) 35%, transparent);
}

.fernwell .task-toggle-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.fernwell .task summary.task-toggle {
  cursor: pointer;
  list-style: none;
}

.fernwell .task summary.task-toggle::-webkit-details-marker {
  display: none;
}

.fernwell .task-toggle, .fernwell .task-meta {
  min-height: 60px;
}
.fernwell .task-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px 0 14px var(--sp-4);
}

.fernwell .task-header > .task-toggle {
  flex: 1 1 auto;
  min-width: 0;
}

.fernwell .chevron-slot {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fernwell .chevron-slot svg {
  width: 16px;
  height: 16px;
  color: var(--ink-soft);
  transition: transform 0.15s ease;
}

.fernwell .task details[open] .chevron-slot svg {
  transform: rotate(90deg);
}

.fernwell .task .title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fernwell .type-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--cloud);
  padding: 4px 10px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  white-space: nowrap;
}

.fernwell .task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
  padding: 14px var(--sp-4) 14px var(--sp-3);
}

.fernwell .task .actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* below 600px: split the task header into two rows so the title isn't
   crowded by the type/status chips and action buttons */
@media (max-width: 600px) {
  .fernwell .task-toggle-wrap,
  .fernwell .task-header > .task-toggle {
    flex-basis: 100%;
  }

  .fernwell .task-meta {
    flex-basis: 100%;
    padding-left: var(--sp-4);
  }
}

.fernwell .task .detail {
  padding: var(--sp-4) var(--sp-4) var(--sp-4) 46px;
}

.fernwell .task .detail p {
  margin: 0 0 var(--sp-3);
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 56ch;
}

.fernwell .task .detail p span {
  font-weight: 600;
}

.fernwell .task .detail p:last-child {
  margin-bottom: 0;
}

.fernwell .task .detail .extra {
  font-size: 13px;
  background: var(--cloud);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: var(--sp-3);
}

.fernwell .task .detail .extra .k {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.fernwell .task .detail .extra-value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.fernwell .task .detail .extra-value .type-chip {
  background: var(--white);
  border: 1px solid var(--cloud-dim);
}

.fernwell .task .detail .extra:last-child {
  margin-bottom: 0;
}

.fernwell .task .revert-form {
  padding: 0 var(--sp-4) var(--sp-4) 46px;
}

/* ---- modal form layout (extra-block, field-row, optional-label hint) ---- */
.fernwell .extra-block {
  background: var(--cloud);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.fernwell .extra-block .extra-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: var(--sp-3);
}

.fernwell .extra-block .field {
  margin-bottom: 0;
}

.fernwell .extra-label-field {
  margin-top: var(--sp-3);
  display: none;
}

.fernwell .extra-label-field.show {
  display: flex;
}

.fernwell .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

@media (max-width: 480px) {
  .fernwell .field-row {
    grid-template-columns: 1fr;
  }
}

.fernwell .field label .opt {
  font-weight: 500;
  color: var(--ink-soft);
}

/* ---- modal ---- */
.fernwell .modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 36, 48, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.fernwell .modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.fernwell .modal {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--sp-6);
  transform: translateY(14px) scale(0.97);
  transition: transform 0.18s ease;
}

.fernwell .modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.fernwell .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-5);
}

.fernwell .modal-head h2 {
  font-size: 19px;
  font-weight: 800;
}

.fernwell .modal-head .sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.fernwell .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  align-items: center;
  margin-top: var(--sp-2);
  padding-top: var(--sp-5);
  border-top: 1.5px solid var(--cloud-dim);
}

/* ---- toast ---- */
.fernwell .toast {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--meadow-bg);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.fernwell .toast.show {
  transform: translateY(0);
  opacity: 1;
}

.fernwell .toast .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--meadow);
  flex-shrink: 0;
}

/* ---- reference documents ---- */
.fernwell .docs-card {
  background: var(--white);
  border: 1.5px solid var(--cloud-dim);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.fernwell .docs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
}

.fernwell .docs-head .title {
  font-size: 14px;
  font-weight: 700;
}

.fernwell .btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  color: var(--plum);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
}

.fernwell .btn-upload:hover {
  text-decoration: underline;
}

.fernwell .btn-upload svg {
  width: 14px;
  height: 14px;
}

.fernwell .doc-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1.5px solid var(--cloud-dim);
  transition: background 0.12s ease;
}

.fernwell .doc-row:hover {
  background: var(--cloud);
}

.fernwell .doc-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--plum-bg);
  color: var(--plum);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fernwell .doc-icon svg {
  width: 17px;
  height: 17px;
}

.fernwell .doc-main {
  flex: 1;
  min-width: 0;
}

.fernwell .doc-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fernwell .doc-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 1px;
}

.fernwell .doc-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.fernwell .doc-actions .icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
}

.fernwell .doc-actions .icon-btn:hover {
  background: var(--white);
  color: var(--plum);
}

.fernwell .doc-actions .icon-btn.danger:hover {
  color: var(--coral);
}

.fernwell .docs-empty {
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
}

.fernwell .docs-empty p {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 var(--sp-3);
}

/* ---- file-upload dropzone (client checklist page) ---- */
.fernwell .dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  border: 1.5px dashed var(--cloud-dim);
  border-radius: var(--r-md);
  background: var(--cloud);
  padding: var(--sp-5) var(--sp-4);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.fernwell .dropzone:hover,
.fernwell .dropzone.dragover {
  border-color: var(--marigold-dk);
  background: #fffbf0;
}

.fernwell .dropzone .icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--white);
  border: 1.5px solid var(--cloud-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.fernwell .dropzone .icon svg {
  width: 17px;
  height: 17px;
}

.fernwell .dropzone .main-txt {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.fernwell .dropzone .main-txt span {
  color: var(--plum);
  text-decoration: underline;
}

.fernwell .dropzone .sub-txt {
  font-size: 12px;
  color: var(--ink-soft);
}

.fernwell .selected-file {
  display: none;
  align-items: center;
  gap: var(--sp-3);
  border: 1.5px solid var(--cloud-dim);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}

.fernwell .selected-file.show {
  display: flex;
}

.fernwell .remove-file {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fernwell .remove-file:hover {
  background: var(--cloud);
  color: var(--ink);
}

.fernwell .remove-file svg {
  width: 15px;
  height: 15px;
}

.fernwell .completed-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.fernwell .completed-row .doc-icon {
  background: var(--meadow-bg);
  color: var(--meadow);
}

/* ---- dashboard toolbar (search + status filter pills) ---- */
.fernwell .toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  flex-wrap: nowrap;
}

@media (max-width: 600px) {
  .fernwell .toolbar {
    flex-wrap: wrap;
  }
}

.fernwell .search {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.fernwell .search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.45;
  pointer-events: none;
}

.fernwell .search input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 11px 14px 11px 40px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--cloud-dim);
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.fernwell .search input::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.fernwell .search input:focus {
  border-color: var(--marigold-dk);
  box-shadow: 0 0 0 4px rgba(255, 193, 69, 0.25);
}

.fernwell .status-filters {
  display: flex;
  gap: 2px;
  background: var(--white);
  padding: 4px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--cloud-dim);
  min-width: 0;
  /* Prevent wrapping and allow horizontal scrolling */
  flex-wrap: nowrap;
  overflow-x: auto;
  /* Hide scrollbar on Firefox and IE/Edge */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
@media (max-width: 600px) {
  .fernwell .status-filters {
    width: 100%;
  }
}

/* Hide scrollbar on Chrome/Safari/Webkit */
.fernwell .status-filters::-webkit-scrollbar {
  display: none;
}

.fernwell .filter-pill {
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  border-radius: var(--r-full);
  cursor: pointer;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.fernwell .filter-pill:hover {
  color: var(--ink);
  text-decoration: none;
}

.fernwell .filter-pill.active {
  background: var(--marigold);
  color: var(--ink-fixed);
}

.fernwell .filter-pill .count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
}

/* ---- checklist list (dashboard results) ---- */
.fernwell .list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-5);
}

.fernwell .list-row-main .spacer {
  flex: 1;
}

/* ---- pagination ---- */
.fernwell .pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.fernwell .pag-info,
.fernwell .pag-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.fernwell .pag-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.fernwell .btn-page {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--cloud-dim);
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.fernwell .btn-page:hover {
  border-color: var(--ink-soft);
  text-decoration: none;
}

.fernwell .btn-page.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
