/* The tools every layout shares (static/js/ui.js): the calendar, the colour picker and maps,
   in the journey look of the public home page. Plain CSS: the staff app, the console, the
   portals and the public sites all load it. Each layout's own colours are used when set. */

:root {
  --ui-ink: var(--j-ink, #101612);
  --ui-ink-2: var(--j-ink-2, #18201b);
  --ui-accent: var(--j-accent, var(--brand-accent, var(--accent, #c49a5a)));
  --ui-brand: var(--color-brand-600, var(--brand, var(--primary, #3d6535)));
  --ui-surface: var(--color-surface, var(--card, var(--surface, #fff)));
  --ui-text: var(--color-slate-900, var(--ink, var(--text, #1b2420)));
  --ui-muted: var(--color-slate-500, var(--ink-soft, var(--muted, #64748b)));
  --ui-line: rgb(15 23 42 / 0.1);
  --ui-radius: 1rem;
  --ui-pop: 0 30px 60px -24px rgb(0 0 0 / 0.45), 0 0 0 1px rgb(15 23 42 / 0.06);
}
html[data-theme="dark"] { --ui-line: rgb(255 255 255 / 0.1); }

/* ---- A popover (the calendar, the colour picker) ----------------------------------------- */
.ui-pop {
  position: absolute;
  z-index: 70;
  width: 19rem;
  max-width: calc(100vw - 1.5rem);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: var(--ui-pop);
  overflow: hidden;
  font-size: 0.875rem;
  animation: ui-pop-in 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ui-pop[hidden] { display: none; }
@keyframes ui-pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.ui-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  color: #eef1ee;
  background:
    radial-gradient(260px 120px at 0% 0%, color-mix(in srgb, var(--ui-brand) 40%, transparent), transparent 70%),
    radial-gradient(220px 140px at 100% 100%, color-mix(in srgb, var(--ui-accent) 28%, transparent), transparent 70%),
    linear-gradient(135deg, var(--ui-ink), var(--ui-ink-2));
}
.ui-pop-title { font-family: var(--font-display, Georgia, serif); font-size: 1.05rem; letter-spacing: 0.01em; }
.ui-pop-title small { display: block; font-family: inherit; font-size: 0.72rem; opacity: 0.7; letter-spacing: 0.12em; text-transform: uppercase; }
.ui-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
  color: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.ui-icon-btn:hover, .ui-icon-btn:focus-visible { background: rgb(255 255 255 / 0.18); outline: none; }
.ui-pop-foot { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.6rem 0.75rem 0.75rem; border-top: 1px solid var(--ui-line); }
.ui-chip {
  border: 0;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  background: color-mix(in srgb, var(--ui-brand) 9%, transparent);
  color: var(--ui-text);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.ui-chip:hover, .ui-chip:focus-visible { background: color-mix(in srgb, var(--ui-brand) 18%, transparent); outline: none; }
.ui-chip:active { transform: scale(0.96); }
.ui-chip.is-quiet { background: transparent; color: var(--ui-muted); margin-left: auto; }

/* ---- The calendar ------------------------------------------------------------------------- */
.ui-date { position: relative; display: block; }
.ui-date-input { padding-right: 2.4rem !important; cursor: pointer; }
.ui-date-btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--ui-muted);
  cursor: pointer;
}
.ui-date-btn:hover { background: color-mix(in srgb, var(--ui-brand) 10%, transparent); color: var(--ui-brand); }
.ui-cal { padding: 0.5rem 0.65rem 0.2rem; }
.ui-cal-week, .ui-cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ui-cal-week span { text-align: center; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-muted); padding: 0.35rem 0; }
.ui-cal-day {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ui-text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, transform 0.1s ease;
}
.ui-cal-day:hover { background: color-mix(in srgb, var(--ui-brand) 12%, transparent); }
.ui-cal-day:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 1px; }
.ui-cal-day.is-other { color: var(--ui-muted); opacity: 0.45; }
.ui-cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--ui-accent); font-weight: 600; }
.ui-cal-day.is-range { border-radius: 0.4rem; background: color-mix(in srgb, var(--ui-accent) 16%, transparent); }
.ui-cal-day.is-selected {
  background: linear-gradient(135deg, var(--ui-brand), color-mix(in srgb, var(--ui-brand) 60%, #000));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--ui-brand) 80%, transparent);
}
.ui-cal-day.is-edge { background: var(--ui-accent); color: var(--ui-ink); font-weight: 600; }
.ui-cal-day:disabled { opacity: 0.25; cursor: not-allowed; background: transparent; }
.ui-cal-day:active:not(:disabled) { transform: scale(0.92); }
.ui-cal-nights { padding: 0 0.85rem 0.5rem; font-size: 0.78rem; color: var(--ui-muted); min-height: 1.2rem; }

/* ---- The colour picker -------------------------------------------------------------------- */
.ui-colour { display: inline-flex; align-items: center; gap: 0.5rem; width: 100%; }
.ui-swatch {
  flex: none;
  width: 2.35rem;
  height: 2.35rem;
  border: 0;
  border-radius: 0.75rem;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12), 0 4px 10px -6px rgb(0 0 0 / 0.4);
  transition: transform 0.12s ease;
}
.ui-swatch:hover { transform: scale(1.06); }
.ui-swatch:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
.ui-cp { padding: 0.75rem; display: grid; gap: 0.7rem; }
.ui-cp-area {
  position: relative;
  height: 9.5rem;
  border-radius: 0.8rem;
  cursor: crosshair;
  touch-action: none;
  background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent);
}
.ui-cp-knob {
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  translate: -50% -50%;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35), 0 4px 10px rgb(0 0 0 / 0.35);
  pointer-events: none;
}
.ui-cp-hue {
  width: 100%;
  appearance: none;
  height: 0.75rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  cursor: pointer;
}
.ui-cp-hue::-webkit-slider-thumb { appearance: none; width: 1.1rem; height: 1.1rem; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.3), 0 3px 8px rgb(0 0 0 / 0.3); }
.ui-cp-hue::-moz-range-thumb { width: 1.1rem; height: 1.1rem; border-radius: 999px; background: #fff; border: 0; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.3); }
.ui-cp-row { display: flex; align-items: center; gap: 0.5rem; }
.ui-cp-hex {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--ui-line);
  border-radius: 0.6rem;
  padding: 0.45rem 0.6rem;
  font: 600 0.85rem ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  background: transparent;
  color: inherit;
}
.ui-cp-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.35rem; }
.ui-cp-swatches button { aspect-ratio: 1; border: 0; border-radius: 0.5rem; cursor: pointer; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); transition: transform 0.1s ease; }
.ui-cp-swatches button:hover, .ui-cp-swatches button:focus-visible { transform: scale(1.12); outline: none; }
.ui-cp-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ui-muted); }
.ui-cp-contrast { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.ui-cp-contrast span { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; border-radius: 0.6rem; padding: 0.45rem 0.6rem; font-size: 0.78rem; font-weight: 600; }
.ui-cp-contrast em { font-style: normal; font-size: 0.7rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: rgb(255 255 255 / 0.85); color: #111; }

/* ---- Maps --------------------------------------------------------------------------------- */
.ui-map-wrap { margin: 0 0 1.25rem; }
.ui-map {
  position: relative;
  width: 100%;
  min-height: 14rem;
  border-radius: var(--ui-radius);
  overflow: hidden;
  background:
    radial-gradient(500px 200px at 0% 0%, color-mix(in srgb, var(--ui-brand) 20%, transparent), transparent 70%),
    linear-gradient(135deg, var(--ui-ink), var(--ui-ink-2));
  box-shadow: var(--j-shadow, 0 10px 30px -16px rgb(0 0 0 / 0.3));
  outline: 1px solid var(--ui-line);
  isolation: isolate;
}
.ui-map.is-loading::after {
  content: "Loading the map";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgb(238 241 238 / 0.7);
  font-size: 0.85rem;
  background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 0.06) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: ui-flow 1.2s linear infinite;
}
@keyframes ui-flow { from { background-position: 200% 0; } to { background-position: -20% 0; } }
.ui-map-cap { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.5rem; font-size: 0.8rem; color: var(--ui-muted); }
.ui-map-list { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.85rem; }
.ui-map .leaflet-container { font: inherit; background: transparent; }
.ui-pin {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--ui-ink);
  color: var(--ui-accent);
  font: 700 12px/1 system-ui, sans-serif;
  box-shadow: inset 0 0 0 2px var(--ui-accent), 0 8px 18px -6px rgb(0 0 0 / 0.55);
}
.ui-pin.is-done { background: var(--ui-accent); color: var(--ui-ink); box-shadow: 0 8px 18px -6px rgb(0 0 0 / 0.55); }
.ui-pin.is-current { animation: ui-ring 2.4s ease-out infinite; }
.ui-pin.is-dot { width: 16px; height: 16px; }
@keyframes ui-ring {
  0% { box-shadow: inset 0 0 0 2px var(--ui-accent), 0 0 0 0 color-mix(in srgb, var(--ui-accent) 55%, transparent); }
  70%, 100% { box-shadow: inset 0 0 0 2px var(--ui-accent), 0 0 0 14px transparent; }
}
.ui-route { stroke: var(--ui-accent); stroke-dasharray: 8 10; animation: ui-dash 1.6s linear infinite; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--ui-accent) 70%, transparent)); }
@keyframes ui-dash { to { stroke-dashoffset: -36; } }
.ui-map .leaflet-popup-content-wrapper { border-radius: 0.9rem; box-shadow: var(--ui-pop); }
.ui-map .leaflet-popup-content { margin: 0.7rem 0.9rem; font-size: 0.85rem; }
.ui-map .leaflet-popup-content strong { display: block; }
.ui-map .leaflet-control-attribution { font-size: 10px; background: rgb(255 255 255 / 0.75); }
.ui-map-pick-hint { position: absolute; z-index: 500; left: 0.75rem; bottom: 0.75rem; border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.78rem; background: rgb(16 22 18 / 0.8); color: #eef1ee; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .ui-pop, .ui-route, .ui-pin.is-current, .ui-map.is-loading::after { animation: none; }
}

/* ---- Steps on a line, the journey's dots (any layout): <ol class="j-steps"> ------------- */
.j-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.25rem; counter-reset: j; }
.j-steps li { position: relative; display: grid; justify-items: center; gap: 0.45rem; text-align: center; font-size: 0.78rem; color: var(--ui-muted); counter-increment: j; }
.j-steps li::before {
  content: counter(j);
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: 1.9rem; height: 1.9rem; border-radius: 999px;
  font: 600 0.75rem/1 system-ui, sans-serif;
  background: var(--ui-surface); color: var(--ui-muted);
  box-shadow: inset 0 0 0 2px var(--ui-line);
}
.j-steps li::after { content: ""; position: absolute; top: 0.95rem; left: calc(50% + 1.1rem); right: calc(-50% + 1.1rem); height: 2px; background: var(--ui-line); }
.j-steps li:last-child::after { display: none; }
.j-steps li.is-done { color: var(--ui-text); }
.j-steps li.is-done::before { content: "✓"; background: var(--ui-accent); color: var(--ui-ink); box-shadow: none; }
.j-steps li.is-done::after { background: linear-gradient(90deg, var(--ui-accent), color-mix(in srgb, var(--ui-accent) 50%, transparent)); }
.j-steps li.is-current { color: var(--ui-text); font-weight: 600; }
.j-steps li.is-current::before { color: var(--ui-accent); box-shadow: inset 0 0 0 2px var(--ui-accent); animation: ui-ring-step 2.4s ease-out infinite; }
.j-steps a { color: inherit; }
@keyframes ui-ring-step { 0% { box-shadow: inset 0 0 0 2px var(--ui-accent), 0 0 0 0 color-mix(in srgb, var(--ui-accent) 50%, transparent); } 70%, 100% { box-shadow: inset 0 0 0 2px var(--ui-accent), 0 0 0 10px transparent; } }
@media (max-width: 640px) { .j-steps { grid-auto-flow: row; grid-auto-columns: auto; justify-items: start; } .j-steps li { grid-template-columns: 1.9rem 1fr; justify-items: start; text-align: left; align-items: center; } .j-steps li::after { display: none; } }
@media (prefers-reduced-motion: reduce) { .j-steps li.is-current::before { animation: none; } }

/* ---- The search check (templates/landing/_seo_panel.html) -------------------------------- */
.seo-panel { display: grid; gap: 1rem 1.5rem; grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.seo-score {
  --tone: var(--ui-accent);
  display: grid; place-items: center; align-content: center;
  width: 6.5rem; height: 6.5rem; border-radius: 999px;
  background: radial-gradient(closest-side, var(--ui-surface) 78%, transparent 80% 100%),
    conic-gradient(var(--tone) calc(var(--score) * 1%), color-mix(in srgb, var(--ui-muted) 20%, transparent) 0);
  font-family: var(--font-display, Georgia, serif);
}
.seo-score span { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.seo-score small { font-size: 0.72rem; color: var(--ui-muted); }
.seo-score.is-ok { --tone: #16a34a; }
.seo-score.is-warn { --tone: #d97706; }
.seo-score.is-bad { --tone: #dc2626; }
.seo-snippet { border-radius: 0.8rem; padding: 0.75rem 0.95rem; background: color-mix(in srgb, var(--ui-muted) 7%, transparent); font-family: Arial, sans-serif; }
.seo-snippet p { margin: 0; }
.seo-snippet-url { font-size: 0.78rem; color: #3c7a3c; }
.seo-snippet-title { font-size: 1.1rem; color: #1a0dab; margin: 0.15rem 0 !important; }
html[data-theme="dark"] .seo-snippet-title, :root[data-theme="dark"] .seo-snippet-title { color: #8ab4f8; }
.seo-snippet-text { font-size: 0.85rem; color: var(--ui-muted); }
.seo-checks { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.seo-checks li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.5rem; align-items: start; font-size: 0.85rem; }
.seo-checks li > span:first-child { display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 999px; font-weight: 700; font-size: 0.75rem; }
.seo-checks li.is-ok > span:first-child { background: color-mix(in srgb, #16a34a 16%, transparent); color: #16a34a; }
.seo-checks li.is-todo > span:first-child { background: color-mix(in srgb, #d97706 18%, transparent); color: #b45309; }
.seo-checks small { display: block; color: var(--ui-muted); font-weight: 400; }
.seo-pill { display: inline-block; min-width: 2.4rem; text-align: center; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-decoration: none; }
.seo-pill.is-ok { background: color-mix(in srgb, #16a34a 16%, transparent); color: #15803d; }
.seo-pill.is-warn { background: color-mix(in srgb, #d97706 18%, transparent); color: #b45309; }
.seo-pill.is-bad { background: color-mix(in srgb, #dc2626 16%, transparent); color: #b91c1c; }
@media (max-width: 640px) { .seo-panel { grid-template-columns: 1fr; } }

/* --- Links and contracts on the Supplier Network, both sides (templates/market/_link_body.html,
   _contract_terms.html, _contract_rates.html, _end_steps.html) ------------------------------ */
.link-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .link-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; } }
.link-main, .link-side { display: grid; gap: 1.25rem; min-width: 0; }
.link-card { padding: 1.1rem 1.25rem; border-radius: 16px; background: var(--surface, var(--color-surface, #fff)); box-shadow: 0 0 0 1px var(--line, rgb(15 23 42 / 0.1)), 0 16px 32px -28px rgb(15 23 42 / 0.4); }
.link-card h2 { margin: 0 0 .6rem; font-size: 1rem; font-weight: 700; }
.link-muted { color: var(--muted, #64748b); }
.link-warn { margin: .75rem 0 0; padding: .6rem .8rem; border-radius: 10px; background: #fff7e6; color: #92400e; font-size: .9rem; }
.link-facts { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.link-facts li { padding: .6rem .8rem; border-radius: 12px; background: color-mix(in srgb, var(--primary, #2f7d4a) 7%, transparent); }
.link-facts strong { display: block; font-size: 1.4rem; line-height: 1.1; }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.link-list > li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem; padding: .7rem .8rem; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line, rgb(15 23 42 / 0.1)); }
.link-list > li.is-closed { opacity: .7; }
.link-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start; }
.link-actions textarea { width: 100%; min-width: 14rem; margin: .4rem 0; }
.link-text { margin: .35rem 0 0; font-size: .9rem; }
.link-pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: color-mix(in srgb, var(--primary, #2f7d4a) 12%, transparent); color: var(--primary, #2f7d4a); }
.link-new { margin-top: .9rem; }
.link-new > summary { cursor: pointer; font-weight: 600; color: var(--primary, #2f7d4a); }
.link-form, .end-sign { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: .7rem; }
.link-form label, .end-sign label { display: grid; gap: .25rem; font-size: .85rem; }
.link-form label.is-wide { grid-column: 1 / -1; }
.link-form input, .link-form textarea, .end-sign input, .end-ask input { width: 100%; padding: .5rem .6rem; border-radius: 10px; border: 1px solid var(--line, #cbd5e1); background: transparent; color: inherit; font: inherit; }
.end-check { grid-column: 1 / -1; display: flex !important; align-items: center; gap: .5rem; }
.end-check input { width: auto; }
.end-ask { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.end-ask input { flex: 1 1 14rem; }
.link-log { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; max-height: 32rem; overflow: auto; }
.link-log li { display: grid; gap: .1rem; padding-left: .8rem; border-left: 2px solid color-mix(in srgb, var(--primary, #2f7d4a) 35%, transparent); font-size: .88rem; }
.link-log time, .link-log small { color: var(--muted, #64748b); font-size: .76rem; }
.contract-terms { display: grid; gap: .1rem .9rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 0; }
.contract-terms div { display: flex; justify-content: space-between; gap: .75rem; padding: .35rem 0; border-bottom: 1px dotted var(--line, #e2e8f0); }
.contract-terms dt { color: var(--muted, #64748b); }
.contract-terms dd { margin: 0; font-weight: 600; text-align: right; }
.contract-text { margin: .25rem 0 0; }
.contract-rates-wrap { overflow-x: auto; }
table.contract-rates { width: 100%; border-collapse: collapse; font-size: .88rem; }
.contract-rates th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; padding: .45rem .5rem; color: var(--muted, #64748b); border-bottom: 1px solid var(--line, #e2e8f0); }
.contract-rates td { padding: .45rem .5rem; border-bottom: 1px solid var(--line, #eef2f7); vertical-align: top; }
.contract-rates .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sp-hash { word-break: break-all; font-size: .78rem; }
.sp-cancel { display: grid; gap: .4rem; margin: .5rem 0; }
.sp-cancel-fieldset { min-width: 0; margin: .75rem 0 0; padding: 0; border: 0; }
.sp-cancel-fieldset > legend { padding: 0; font-weight: 600; }
.sp-cancel-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; align-items: end; }
.sp-cancel-row > .field { min-width: 0; }
.sp-cancel-deposit { display: flex; align-items: center; gap: .4rem; padding-bottom: .65rem; }
.sp-field-error { color: var(--bad); display: block; }
.sp-contract-create-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(20rem, .85fr); gap: 1rem; align-items: start; }
.sp-contract-create-grid > [data-contract-preview] { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.sp-contract-service { margin-top: 1rem; }
.sp-contract-service h3 { margin: 0 0 .4rem; font-size: 1rem; }
@media (max-width: 1100px) { .sp-cancel-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .sp-contract-create-grid { grid-template-columns: minmax(0, 1fr); } .sp-contract-create-grid > [data-contract-preview] { position: static; max-height: none; } }
@media (max-width: 600px) { .sp-cancel-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Loading (static/js/ui.js, end of file) ----------------------------------------------- */
/* Shown only when an answer takes a moment (150 ms), in every layout, light and dark. */
#page-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  height: 3px;
  width: 0;
  opacity: 0;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
  background: var(--color-brand-600, var(--ui-accent));
  box-shadow: 0 0 10px color-mix(in srgb, var(--color-brand-600, var(--ui-accent)) 55%, transparent);
  transition: width 0.35s ease, opacity 0.2s ease;
}
#page-progress.on { opacity: 1; }
#page-progress.is-done { opacity: 0; transition: width 0.2s ease, opacity 0.3s ease 0.15s; }

/* The button pressed: same size, its words hidden behind a spinner in its own colour. */
.ui-busy { position: relative; cursor: progress; pointer-events: none; }
.ui-busy-spin { color: transparent !important; }
.ui-busy-spin > * { visibility: hidden; }
.ui-busy-spin::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 1em;
  height: 1em;
  margin: auto;
  border: 2px solid var(--ui-busy-color, var(--ui-muted));
  border-right-color: transparent;
  border-radius: 999px;
  animation: ui-spin 0.7s linear infinite;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

/* A part being reloaded shimmers; a whole page being replaced dims and takes no clicks. */
.is-waiting { position: relative; }
.is-waiting > * { transition: opacity 0.2s ease; opacity: 0.55; }
.is-waiting::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 0.45) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: ui-flow 1.1s linear infinite;
}
html[data-theme="dark"] .is-waiting::after {
  background-image: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 0.08) 50%, transparent 80%);
}
.ui-dim { opacity: 0.55; pointer-events: none; transition: opacity 0.2s ease; cursor: progress; }
/* A preview frame reloading (ui.js "A form's live preview"). */
iframe.is-waiting { opacity: 0.55; transition: opacity 0.2s ease; }

/* A placeholder for a part that loads after the page (hx-trigger "load" or "intersect"). */
.skeleton, .ui-skeleton {
  border-radius: 0.375rem;
  background: linear-gradient(100deg, rgb(15 23 42 / 0.06) 20%, rgb(15 23 42 / 0.12) 50%, rgb(15 23 42 / 0.06) 80%);
  background-size: 220% 100%;
  animation: ui-flow 1.3s linear infinite;
}
html[data-theme="dark"] .skeleton, html[data-theme="dark"] .ui-skeleton {
  background-image: linear-gradient(100deg, rgb(255 255 255 / 0.05) 20%, rgb(255 255 255 / 0.1) 50%, rgb(255 255 255 / 0.05) 80%);
}

/* "Still working" after 8 seconds, and the notes when something went wrong. */
.ui-slow {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 1000;
  max-width: min(92vw, 30rem);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--ui-ink);
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 12px 30px -12px rgb(0 0 0 / 0.5);
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.ui-slow.on { opacity: 1; transform: translate(-50%, 0); }
.ui-toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1001;
  display: grid;
  gap: 0.5rem;
  width: min(92vw, 24rem);
}
.ui-toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.6rem;
  background: var(--ui-surface);
  color: inherit;
  font-size: 0.875rem;
  box-shadow: 0 0 0 1px var(--ui-line), 0 12px 28px -14px rgb(0 0 0 / 0.35);
  animation: ui-pop-in 0.2s ease;
}
.ui-toast.is-bad { background: #fef2f2; color: #991b1b; box-shadow: 0 0 0 1px #fecaca; }
html[data-theme="dark"] .ui-toast.is-bad { background: #3b0d0d; color: #fecaca; box-shadow: 0 0 0 1px #7f1d1d; }
.ui-toast-close { border: 0; background: none; color: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; opacity: 0.7; }
.ui-toast-close:hover, .ui-toast-close:focus-visible { opacity: 1; }
.ui-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  #page-progress, #page-progress.is-done, .ui-slow, .ui-dim, .is-waiting > * { transition: none; }
  .ui-busy-spin::after, .is-waiting::after, .skeleton, .ui-skeleton, .ui-toast { animation: none; }
}

/* ---- Form errors (static/js/ui.js "Forms") ------------------------------------------------ */
/* The message sits under its field; the field itself is marked; a box at the top of the form
   holds what belongs to no field. The same in every layout. */
.ui-field-error {
  display: block;
  margin-top: .3rem;
  font-size: .8rem;
  line-height: 1.35;
  color: #b91c1c;
  animation: ui-error-in .16s ease-out;
}
.ui-field-error::before { content: "! "; font-weight: 700; }
:is(input, select, textarea)[aria-invalid="true"] {
  box-shadow: inset 0 0 0 1.5px #dc2626 !important;
  border-color: #dc2626;
}
:is(input, select, textarea)[aria-invalid="true"]:focus {
  outline: 2px solid rgb(220 38 38 / .35);
  outline-offset: 1px;
}
input[type="checkbox"][aria-invalid="true"],
input[type="radio"][aria-invalid="true"] { outline: 2px solid #dc2626; outline-offset: 2px; box-shadow: none !important; }
.ui-form-summary {
  margin-bottom: 1rem;
  border-radius: .6rem;
  background: #fef2f2;
  padding: .75rem 1rem;
  font-size: .85rem;
  color: #991b1b;
  box-shadow: inset 0 0 0 1px #fecaca;
}
.ui-form-summary ul { margin: 0; padding-left: 1.1rem; list-style: disc; }
[data-ui-summary]:focus { outline: 2px solid rgb(220 38 38 / .4); outline-offset: 2px; }
html[data-theme="dark"] .ui-field-error { color: #fca5a5; }
html[data-theme="dark"] .ui-form-summary { background: rgb(127 29 29 / .25); color: #fecaca; box-shadow: inset 0 0 0 1px rgb(248 113 113 / .35); }
@keyframes ui-error-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ui-field-error { animation: none; } }

/* ---- Welcome tour (static/js/tour.js) ---------------------------------------------------------- */
.tour-shade { position: fixed; inset: 0; z-index: 90; background: transparent; }
.tour-spot { position: fixed; z-index: 91; border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 9999px rgb(15 23 42 / .55), 0 0 0 3px rgb(255 255 255 / .9); transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease; }
.tour-card { position: fixed; z-index: 92; width: min(22rem, calc(100vw - 24px)); border-radius: 16px; background: #fff; color: #0f172a; padding: 1.1rem 1.15rem 1rem; box-shadow: 0 24px 60px -20px rgb(15 23 42 / .45), 0 0 0 1px rgb(15 23 42 / .06); transition: top .25s ease, left .25s ease; }
.tour-card.is-center { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); }
.tour-card.is-center ~ .tour-spot, .tour-spot[hidden] { display: none; }
.tour-shade:has(~ .tour-card.is-center) { background: rgb(15 23 42 / .55); }
.tour-count { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.tour-title { margin-top: .2rem; font-size: 1.05rem; font-weight: 650; }
.tour-text { margin-top: .35rem; font-size: .88rem; line-height: 1.5; color: #334155; }
.tour-dots { margin-top: .8rem; display: flex; gap: .3rem; }
.tour-dots span { width: .4rem; height: .4rem; border-radius: 999px; background: #cbd5e1; }
.tour-dots span.is-on { width: 1.1rem; background: var(--tour-accent, #2f7d4f); }
.tour-actions { margin-top: .9rem; display: flex; align-items: center; gap: .4rem; }
.tour-gap { flex: 1; }
.tour-actions button { border-radius: 10px; padding: .45rem .8rem; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.tour-skip { background: none; border: 0; color: #64748b; padding-left: 0 !important; }
.tour-skip:hover { color: #0f172a; }
.tour-back { background: #fff; border: 1px solid #cbd5e1; color: #334155; }
.tour-next { background: var(--tour-accent, #2f7d4f); border: 1px solid transparent; color: #fff; }
.tour-actions button:focus-visible { outline: 2px solid var(--tour-accent, #2f7d4f); outline-offset: 2px; }
html[data-theme="dark"] .tour-card { background: #111827; color: #e5e7eb; box-shadow: 0 24px 60px -20px #000, 0 0 0 1px rgb(255 255 255 / .1); }
html[data-theme="dark"] .tour-text { color: #cbd5e1; }
html[data-theme="dark"] .tour-back { background: transparent; border-color: rgb(255 255 255 / .2); color: #e5e7eb; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }

/* Analytics consent on the platform's public pages (templates/includes/platform_analytics.html). */
.consent-bar { position: fixed; z-index: 70; left: 16px; right: 16px; bottom: 16px; margin-inline: auto; max-width: 720px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 18px; border-radius: 14px; background: #1f1a17; color: #f7f2ea; box-shadow: 0 18px 40px -18px rgb(0 0 0 / 0.6); font: 400 0.9rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.consent-bar[hidden] { display: none; }
.consent-bar p { margin: 0; flex: 1 1 320px; }
.consent-bar a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.consent-actions { display: flex; gap: 8px; margin-left: auto; }
.consent-bar button { border: 1px solid rgb(255 255 255 / 0.35); background: transparent; color: inherit; border-radius: 999px; padding: 8px 16px; min-height: 40px; font: 600 0.85rem system-ui, sans-serif; cursor: pointer; }
.consent-bar button.is-primary { background: #f7f2ea; color: #1f1a17; border-color: #f7f2ea; }
.consent-bar button:focus-visible { outline: 2px solid #f7f2ea; outline-offset: 2px; }

/* Maps: Ctrl or Cmd + scroll to zoom, two fingers to move on a phone (static/js/ui.js). */
.ui-map { position: relative; }
.ui-map-hint {
  position: absolute; inset: 0; z-index: 1000; display: grid; place-items: center;
  padding: 1rem; text-align: center; font-size: 0.95rem; font-weight: 600; color: #fff;
  background: rgb(15 23 42 / 0.45); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease; border-radius: inherit;
}
.ui-map.is-hinting .ui-map-hint { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ui-map-hint { transition: none; } }

/* The calendar following the task (ui.js Dates): the title choosing the month or year, days
   other rows already take, the day suggested to start a new row. */
.ui-pop-title.is-button { border: 0; background: transparent; cursor: pointer; border-radius: 0.5rem; padding: 0.15rem 0.5rem; font: inherit; color: inherit; }
.ui-pop-title.is-button:hover, .ui-pop-title.is-button:focus-visible { background: rgb(15 23 42 / 0.06); }
.ui-cal-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; padding: 0.25rem 0; }
.ui-cal-month { border: 0; border-radius: 0.6rem; padding: 0.6rem 0; background: transparent; font: inherit; cursor: pointer; color: inherit; }
.ui-cal-month:hover, .ui-cal-month:focus-visible { background: rgb(15 23 42 / 0.06); }
.ui-cal-month.is-selected { background: var(--ui-accent, #3d6535); color: #fff; }
.ui-cal-day.is-taken:not(.is-selected) { background-image: repeating-linear-gradient(135deg, rgb(148 163 184 / 0.18) 0 3px, transparent 3px 7px); color: rgb(100 116 139); }
.ui-cal-day.is-suggested:not(.is-selected) { box-shadow: inset 0 0 0 2px var(--ui-accent, #3d6535); }
html[data-theme="dark"] .ui-pop-title.is-button:hover, html[data-theme="dark"] .ui-cal-month:hover { background: rgb(255 255 255 / 0.08); }
