:root {
  --gold: #bfa468; /* primary gold */
  --ink: #2e2e3a; /* dark text */
  --ink-2: #5b5b6b; /* muted text */
  --line: #d9d9e0; /* input underline */
  --bg: #ffffff; /* page bg */
  --bg-soft: #f7f7fa; /* soft panels */
  --panel: #ffffff;
  --corner-brand: #f4f2ef;
  --text: #2d2d2f;
  --muted: #7a7a85;
  --border: #ececf2;
  --sidebar: #06172a;
  --accent: #c6a76b;
  --hover: #f6f6fb;
  --gold-20: rgba(198, 167, 107, 0.2);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  --radius: 16px;
  --focus: 0 0 0 4px rgba(191, 164, 104, 0.18);
  --header-user-name: #f5f5f5;       /* name text in header */
  --header-user-initials: #f5f5f5;   /* initials text in header avatar */
  --header-user-avatar-bg: #8398b3;  /* avatar circle bg when initials show */
  /* page shell alt bg */
  --bg-2: #f3f2f9;
}

/* ======================================================================
   Base reset-ish
   ====================================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ======================================================================
   base grid
   ====================================================================== */

.abs-fill {
  position: absolute;
  inset: 0;
}
.z-100 {
  z-index: 100;
}
.scroll-y {
  overflow: auto;
}
.maxh-90vh {
  max-height: 90vh;
}

.grid {
  display: grid;
}
.grid-gap-12 {
  gap: 12px;
}
.grid-1 {
  grid-template-columns: repeat(1, minmax(220px, 1fr));
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}
.grid-5 {
  grid-template-columns: repeat(5, minmax(200px, 1fr));
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* ======================================================================
   Base modal card + utils
   ====================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
}

.modal[hidden] {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 18, 27, 0.45);
  backdrop-filter: blur(2px);
}

.modal__card {
  position: relative;
  width: min(1100px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #ececf2);
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.06));
}

.modal__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px;
  border-bottom: 1px solid var(--border, #e9ecef);
  --modal-close-top: 12px;
  --modal-close-right: 12px;
  --modal-close-size: 36px;
  --modal-close-font: 20px;
}

.modal__title {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink, #2e2e3a);
}

.modal__header > [data-close] {
  all: unset;
  position: absolute;
  top: var(--modal-close-top);
  right: var(--modal-close-right);
  width: var(--modal-close-size);
  height: var(--modal-close-size);
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border, #e9ecef);
  color: var(--ink, #2e2e3a);
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.06));
  cursor: pointer;
  z-index: 2;
}

.modal__header > [data-close]::before {
  content: "×";
  font: 600 var(--modal-close-font) / 1 Inter, system-ui, -apple-system,
    Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.modal__header > [data-close]:hover {
  background: var(--hover, #f6f6fb);
}

.modal__body {
  padding: 16px 18px 18px;
}

.modal__footer {
  padding: 10px 18px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border, #e9ecef);
}

/* Optional size modifiers you can reuse everywhere */
.modal--sm .modal__card {
  width: min(640px, 96vw);
}
.modal--lg .modal__card {
  width: min(1400px, 96vw);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
  font: 600 20px/1 Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, sans-serif;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.modal-close::before {
  content: "×";
}
.modal-close:hover {
  background: var(--hover);
}

/* Launcher row */
.launcher-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* ======================================================================
   Auth pages (split hero + card) [legacy structure]
   ====================================================================== */

.wrap {
  display: grid;
  min-height: 100vh;
}

.hero {
  position: relative;
  height: 36vh;
  min-height: 220px;
  overflow: hidden;
  border-bottom: 1px solid #eee;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(95%) brightness(105%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.85),
    rgba(255, 255, 255, 0.35)
  );
}

.panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px 40px;
}

/* Base card for auth screens only (width-capped, animated in) */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel .card {
  width: min(560px, 100%);
  padding: 28px 24px 22px;
  animation: cardIn 0.6s ease both;
}

.card h4 {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.card .value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

.title {
  font-size: clamp(22px, 3.6vw, 34px);
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 700;
}

.subtitle {
  margin-top: 6px;
  color: var(--ink-2);
}

form {
  margin-top: 26px;
}

/* Floating input group */
.field {
  position: relative;
  margin: 22px 0;
}

.input {
  width: 100%;
  font-size: 16px;
  padding: 14px 12px 12px;
  border: none;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--ink);
  outline: none;
  transition: border-color 0.25s ease;
}

.input:focus {
  border-color: var(--gold);
  box-shadow: var(--focus);
}

.label {
  position: absolute;
  left: 12px;
  top: 12px;
  color: var(--ink-2);
  pointer-events: none;
  transition: transform 0.2s ease, color 0.2s ease, top 0.2s ease,
    font-size 0.2s ease, background-color 0.2s ease;
}

/* Floating labels: text inputs */
.input:focus + .label,
.input:not(:placeholder-shown) + .label {
  top: -12px;
  font-size: 12px;
  color: var(--gold);
  background: var(--panel);
  padding: 0 6px;
  transform: translateY(-2px);
  z-index: 1;
}

/* Floating labels: selects (no :placeholder-shown) */
select.input[data-empty="false"] + .label,
select.input:focus + .label {
  top: -12px;
  font-size: 12px;
  color: var(--gold);
  background: var(--panel);
  padding: 0 6px;
  transform: translateY(-2px);
  z-index: 1;
}

/* If the input is wrapped for autocomplete, keep label positioning intact */
.field .suggest-wrap {
  position: static;
} /* wrapper can be static */
.field .suggest-wrap .label {
  position: absolute;
} /* label still absolute per your base rules */

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 20px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}

.row a {
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
}

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

.password-field {
  position: relative;
}

.password-field .toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #666;
  padding: 0;
}

.password-field .toggle-password:hover {
  color: var(--gold);
}
.password-field svg {
  pointer-events: none;
}

/* Buttons */
.actions {
  display: flex;
  gap: 14px;
}

.btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.2s ease,
    background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--gold);
  color: #fff;
  box-shadow: 0 6px 14px rgba(191, 164, 104, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 10px 20px rgba(191, 164, 104, 0.32);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: #b8b8c7;
}

.btn-ghost:hover {
  background: #f0f0f6;
}

.legal {
  margin-top: 24px;
  text-align: center;
  color: #9a9aa8;
  font-size: 12px;
}

.legal a {
  color: inherit;
  text-decoration: none;
}
.legal a:hover {
  text-decoration: underline;
}

/* Desktop split layout for auth */
@media (min-width: 980px) {
  .wrap {
    grid-template-columns: 1fr 1fr;
  }
  .hero {
    height: auto;
    min-height: 100vh;
    border-bottom: none;
  }
  .panel {
    padding: 48px;
  }
  .panel .card {
    box-shadow: none;
    width: 82%;
    max-width: 520px;
    padding: 8vh 8%;
  }
  .subtitle {
    margin-top: 8px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   Auth background / centered card layout
   (login, signup, forgot, reset, force-change)
   ============================================================ */

/* page-level wrapper: full viewport flex */
.auth-bg {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px; /* breathing room on mobile */
  isolation: isolate; /* ensure z-layers behave */
  /*background: #000;        /* fallback while image loads */
  overflow: auto; /* scroll if content taller than viewport */
}

/* background image layer */
.auth-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../assets/img/login_bg_img.jpg"); /* adjust path if needed */
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  filter: contrast(95%) brightness(105%);
  z-index: 0;
}

/* subtle wash over bg so the card reads */
.auth-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.12) 40%,
    rgba(0, 0, 0, 0.55) 100%
  );
  z-index: 0;
}

/* override the old .wrap grid rules for auth screens:
   just be a block container at max-width so centering works */
.wrap {
  position: relative;
  z-index: 1; /* above background layers */
  width: 100%;
  max-width: 480px;
  display: block;
  min-height: auto; /* kill the min-height:100vh from legacy split layout effect */
  grid-template-columns: none;
}

/* hero section is no longer a visible half-page panel,
   but we keep the node so markup changes are tiny */
.hero {
  display: none;
}

/* panel just wraps the .card now */
.panel {
  padding: 0;
  display: block;
  align-items: initial;
  justify-content: initial;
}

/* auth card visual tweaks so it feels like a modal on top of bg */
.panel .card {
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22), 0 2px 4px rgba(0, 0, 0, 0.08);
  padding: 28px 24px 24px;
  animation: cardIn 0.6s ease both;
}

/* brand row at top of card */
.brand-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 12px;
}

/* the PNG logo */
.brand-head .logo-img {
  width: auto;
  max-width: 180px;
  max-height: 64px;
  height: auto;
  object-fit: contain;
  display: block;
}

/* fallback / title text */
.brand-head .app-title {
  font-size: clamp(22px, 3.6vw, 34px);
  letter-spacing: 0.08em;
  /*color: var(--gold);*/
  color: var(--sidebar);
  font-weight: 700;
  margin: 12px 0 0;
  text-align: center;
}

/* hide the fallback title if we mark it [hidden] in HTML */
.brand-head .app-title[hidden] {
  display: none;
}

/* subtitle under logo */
.brand-head .subtitle {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
  max-width: 280px;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* Google SSO needs to wrap nicely under card actions */
.actions {
  flex-wrap: wrap;
}

/* Google SSO button */
.btn-google {
  width: 100%;
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid #b8b8c7;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
  transition: transform 0.06s ease, box-shadow 0.2s ease,
    background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-google:active {
  transform: translateY(1px);
}

.btn-google:hover {
  background: #f0f0f6;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* tiny google "G" icon (SVG inline) */
.btn-google .gmark {
  width: 18px;
  height: 18px;
  line-height: 0;
  display: inline-block;
}

/* Put this in your external CSS file (no inline styles needed) */
.btn-apple{
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.18);
  background: #111;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.btn-apple .amark{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.btn-apple:hover{ filter: brightness(1.05); }
.btn-apple:active{ transform: translateY(1px); }

/* shared icon bubble (works for both buttons) */
.sso-ico{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px;
  height:28px;
  border-radius:999px;
  background: rgba(255,255,255,.08); /* looks good on dark Apple btn */
}

.btn-google .sso-ico{
  background: rgba(0,0,0,.06); /* looks better on light Google btn */
}

.icon-google:before { content: '\f1a0'; }
.icon-apple:before { content: '\f179'; }

.sso-ico i{
  font-size: 16px;
  line-height: 1;
}


/* When body has auth-bg class, allow scrolling even though app shell locks overflow */
body.auth-bg {
  overflow: auto;
}

/* Chrome autofill fix for floating labels so text doesn't sit on top of label */
.input:-webkit-autofill + .label {
  top: -12px;
  font-size: 12px;
  color: var(--gold);
  background: var(--panel);
  padding: 0 6px;
  transform: translateY(-2px);
  z-index: 1;
}

/* nav brand logo (header/sidebar app chrome, not auth, but keeping here for completeness) */
.brand-logo {
  display: block;
  width: 70px;
  height: auto;
  max-height: 24px;
}

/* Diagnostics card at top of editor */
.diag-card {
  background: var(--bg-soft, #f7f7fa);
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.06));
  border: 1px solid var(--border, #ececf2);
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1rem;
  position: relative;
  color: var(--ink-2, #5b5b6b);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* gold accent bar */
.diag-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 4px;
  width: 100%;
  background: var(--gold, #bfa468);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 0 10px rgba(191, 164, 104, 0.55),
    0 0 30px rgba(191, 164, 104, 0.3);
}

.diag-head {
  margin-bottom: 0.75rem;
}

.diag-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gold, #bfa468);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  display: block;
}

.diag-desc {
  font-size: 0.75rem;
  color: var(--ink-2, #5b5b6b);
}

.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 0.75rem 1rem;
}

.diag-field {
  min-width: 0;
}

.diag-label {
  font-size: 0.7rem;
  color: var(--ink-2, #5b5b6b);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.diag-value {
  font-size: 0.8rem;
  color: var(--ink, #2e2e3a);
  word-break: break-word;
}

/* inline row for coordinates in Diagnostics */
.diag-coords {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  line-height: 1.4;
}

/* map pin icon color */
.diag-pin {
  color: #c47f3e; /* warm copper/amber */
  font-size: 0.8rem;
  line-height: 1;
}

/* dupe flag alert color */
.icon-flag.fg-alert {
  color: #b25b4e; /* burnt red */
}

.conflict-icon--attention {
  color: #c47f3e;
}

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

/* wrapper that we toggle visible/hidden */
.toast-shell {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1rem;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 30000;

  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast-shell.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-card {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;

  min-width: min(320px, 90vw);
  max-width: 90vw;

  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);

  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ink);

  padding: 0.75rem 1rem;
  pointer-events: auto;
}

/* icon bubble (left side of toast) */
.toast-icon {
  flex-shrink: 0;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-top: 0.3rem;
  background-color: var(--ink-2);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

/* message text */
.toast-msg {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-weight: 500;
  word-break: break-word;
}

/* success / error / info / warn accent colors  */
.toast-card.is-success .toast-msg {
  color: var(--ink);
}
.toast-card.is-error .toast-msg {
  color: var(--ink);
}
.toast-card.is-warn .toast-msg {
  color: var(--ink);
}
.toast-card.is-info .toast-msg {
  color: var(--ink);
}

.toast-icon.is-success {
  background-color: var(--gold); /* warm gold pulse for success */
  box-shadow: 0 0 10px rgba(191, 164, 104, 0.6);
}

.toast-icon.is-error {
  background-color: #b25b4e; /* same burnt red vibe as dupes */
  box-shadow: 0 0 10px rgba(178, 91, 78, 0.6);
}

.toast-icon.is-warn {
  background-color: #c47f3e; /* your pin color = warm amber/orange */
  box-shadow: 0 0 10px rgba(196, 127, 62, 0.5);
}

.toast-icon.is-info {
  background-color: var(--ink-2);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* ======================================================================
   App shell (sidebar + header + main)
   ====================================================================== */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100dvh;
}

.loader-viewport {
  display: grid;
  place-items: center;
  min-height: 320px;
}

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 0px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Sidebar + header (dark) overrides */
.sidebar .nav a {
  color: #f5f5f5; /* smoke white */
}

.sidebar .nav a i[class^="icon-"],
.sidebar .nav a i[class*=" icon-"] {
  width: 16px;
  text-align: center;
  font-size: 16px;
  line-height: 1;
  color: #8398b3;
}

/* keep any remaining SVG icons consistent */
.sidebar .nav svg {
  stroke: #8398b3;
}

.sidebar .nav a:hover {
  background: rgba(255, 255, 255, 0.10);
}

.sidebar .nav a.active,
.sidebar .nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.20);
  border-color: rgba(255, 255, 255, 0.12);
}

/* don't shift icon color on active */
.sidebar .nav a.active svg,
.sidebar .nav a[aria-current="page"] svg {
  stroke: #8398b3;
}

.header .name {
  color: var(--ink);
}


.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  height: 64px;
  background: var(--corner-brand);
  
  color: #f5f5f5;
  font-weight: 600;

  /* make it bleed past the 12px padding on both sides */
  margin-left: -12px;
  margin-right: -12px;

  /* still give internal padding */
  padding: 16px 12px;

  /* make sure it sizes relative to full row, not shrink */
  width: calc(100% + 24px);
  box-sizing: border-box;
}

.brand small {
  color: var(--muted);
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav svg,
.header svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #3a3a42;
  transition: background-color 0.22s;
}

.nav a:hover {
  background: var(--hover);
}

.nav a::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--gold);
  transform: translateX(-100%);
  opacity: 0;
  transition: transform 0.22s, opacity 0.22s;
}

.nav a.active,
.nav a[aria-current="page"] {
  background: var(--gold-20);
  border: 1px solid var(--border);
}

.nav a.active::before,
.nav a[aria-current="page"]::before {
  transform: translateX(0);
  opacity: 1;
}

.nav a.active svg,
.nav a[aria-current="page"] svg {
  stroke: var(--gold);
}

.subnav {
  margin: 2px 0 8px 6px;
  padding-left: 10px;
  border-left: 2px solid var(--gold);
  display: grid;
  gap: 4px;
}

.subnav .sublink {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: #4a4a55;
  text-decoration: none;
}

.subnav .sublink:hover {
  background: var(--hover);
}

.subnav .sublink.active {
  background: var(--gold-20);
  border: 1px solid var(--border);
}

.group-label {
  margin: 12px 10px 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.spacer {
  flex: 1;
}
.settings {
  margin-top: auto;
}

.link.logout {
  color: var(--text);
}
.link.logout:hover {
  color: var(--text-strong, #222);
}

/* Header */
.header {
  grid-area: header;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
}

.search {
  flex: 1;
  position: relative;
}

.search input {
  width: 100%;
  height: 40px;
  border-radius: 25px;
  border: 1px solid var(--border);
  padding: 0 44px 0 42px;
  background: #fafafe;
}

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}

.trail {
  display: flex;
  align-items: center;
  gap: 16px;
}

.iconbtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: var(--shadow);
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ddd, #bbb);
}
.name {
  font-weight: 600;
  font-size: 13px;
}

/* Header user menu (z-order fixes) */
.header,
.header .trail {
  position: relative;
  overflow: visible;
  z-index: 300;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.avatar-img {
  display: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #ddd, #bbb);
}

.avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  color: #2d2d2f;
  background: linear-gradient(135deg, #ddd, #bbb);
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: none;
  z-index: 1000;
}

.menu.show {
  display: block;
}

.menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 8px;
}

.menu-head .who-name {
  font-weight: 600;
}
.menu-head .who-email {
  color: var(--muted);
  font-size: 12px;
}

.menu-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  color: var(--text);
}

.menu-item:hover {
  background: var(--hover);
}

/* Main */
main {
  grid-area: main;
  padding: 22px 28px 40px;
}
.page-title {
  font-size: 18px;
  font-weight: 600;
  margin: 4px 0 16px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

/* ======================================================================
   folders drag highlight
   ====================================================================== */
#folders-root.is-dragover {
  outline: 2px dashed var(--accent);
  outline-offset: 6px;
  background: rgba(0, 0, 0, 0.02);
}

/* ======================================================================
   Cards: base + utilities (shared across the app)
   ====================================================================== */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: relative;
}

.card h4 {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.card .value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

/* Size/behavior modifiers (stackable) */
.card--compact {
  padding: 10px 12px;
}
.card--spacious {
  padding: 20px 22px;
}
.card--tall {
  min-height: 520px;
}
.card--short {
  min-height: 240px;
}
.card--maxh-400 {
  max-height: 400px;
  overflow: auto;
}
.card--maxh-520 {
  max-height: 520px;
  overflow: auto;
}

/* Content-type helpers */
.card--table .table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--border);
}

.card--table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.card--table thead th {
  text-align: left;
  font-weight: 600;
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.card--table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.card--table tbody tr:last-child td {
  border-bottom: none;
}
.card--table th[data-sorted="true"] {
  color: var(--gold);
}
.card--table th[role="button"] {
  cursor: pointer;
}

.card--map {
  display: flex;
  flex-direction: column;
}

.card--map .map-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden; /* testing to see if the hidden setting is messing it up */
}

/* keep icon columns narrow & centered */
.col-icon {
  width: 2.25rem;
  text-align: center;
}

.col-icon .icon-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* HBTable sort arrows (Fontello) */
.card--table thead th[role="button"] {
  position: relative;
  padding-right: 1.5rem; /* room for the arrow */
}

/* Always show a neutral arrow (down) so users see it's sortable */
.card--table thead th[role="button"]::after {
  content: "\f0dd"; /* neutral: down */
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: "fontello"; /* <-- match your fontello.css @font-face */
  font-style: normal;
  font-weight: normal;
  display: inline-block;
  width: 1em;
  line-height: 1;
  opacity: 0.45;
}

/* HBTable toggles aria-sort for you */
.card--table thead th[aria-sort="ascending"]::after {
  content: "\f0de";
  opacity: 0.95;
} /* up */
.card--table thead th[aria-sort="descending"]::after {
  content: "\f0dd";
  opacity: 0.95;
} /* down */

/* optional hover affordance */
.icon-btn--ghost:hover {
  opacity: 0.9;
}

/* make loader viewport consistent (you already switched to a class in pages.js) */
.loader-viewport {
  display: grid;
  place-items: center;
  height: 320px;
}

/* Per-card overrides are encouraged via IDs when a tool needs polish */

/* ======================================================================
   HB toolbar & card view modes
   ====================================================================== */

[data-hb-view-key] {
  position: relative;
}

/* Toolbar */
.hb-toolbar[data-hb-toggle] {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  z-index: 10;
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.hb-toggle-btn {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font: inherit;
  line-height: 1;
}

.hb-toggle-btn[aria-pressed="true"] {
  background: var(--panel);
  outline: 1px solid var(--border);
}

/* GRID (default) use data-colspan on cards to widen */
[data-hb-viewport].hb-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  margin-top: 2.25rem;
}

/* Per-card column span in grid view */
[data-hb-viewport].hb-grid .card[data-colspan="2"] {
  grid-column: span 2;
}
[data-hb-viewport].hb-grid .card[data-colspan="3"] {
  grid-column: span 3;
}
[data-hb-viewport].hb-grid .card[data-colspan="4"] {
  grid-column: span 4;
}

/* Collapse spans on narrow screens */
@media (max-width: 900px) {
  [data-hb-viewport].hb-grid .card[data-colspan] {
    grid-column: span 1;
  }
}

/* Diagnostics block at top of the editor modal */
.prop-meta-info {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
}

/* slim gold bar on the left */
.prop-meta-info::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 4px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(191, 164, 104, 0.5); /* soft gold glow */
}

/* section head inside diagnostics */
.prop-meta-info .section-head {
  display: flex;
  flex-direction: column;
  padding-left: 0; /* we already have outer padding */
  margin-bottom: 0.75rem;
}

.section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-compact {
  padding-inline: 8px;
  padding-block: 4px;
  font-size: 0.8rem;
}

.people-link-list-shell {
  max-height: 320px;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid var(--border-subtle, #e5e7eb);
  padding: 4px 0;
  margin-top: 8px;
}

.people-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.people-link-item {
  padding: 6px 10px;
}

.people-link-item label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.people-link-item input[type="checkbox"] {
  margin-right: 6px;
}

.people-link-main {
  font-size: 0.9rem;
}

.people-link-sub {
  font-size: 0.8rem;
}

.prop-meta-info .section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* tiny status pill next to title (optional future hook) */
.prop-meta-info .section-title .diag-pill {
  background: var(--gold-20);
  color: var(--ink);
  font-size: 0.7rem;
  line-height: 1.2;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--gold);
}

.prop-meta-info .section-hint {
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--ink-2);
}

/* grid layout of the diagnostic rows */
.prop-meta-info .grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 0.75rem 1rem;
}

/* label/value pair */
.prop-meta-info .field {
  background: transparent;
  border: 0;
  padding: 0;
}

/* the label */
.prop-meta-info .field-label {
  font-size: 0.7rem;
  line-height: 1.2;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  margin-bottom: 0.25rem;
  display: block;
}

/* the value container */
.prop-meta-info .field-static {
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  padding: 0.5rem 0.5rem;
  min-height: 2rem;
  display: flex;
  align-items: center;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono",
    monospace;
}

/* empty / missing info */
.prop-meta-info .field-static:empty::after,
.prop-meta-info .field-static:has(:not(*))::after {
  content: "—";
  color: var(--ink-2);
}

/* Carousel */
[data-hb-viewport].hb-carousel {
  display: grid;
  grid-template-rows: 1fr auto;
  align-content: stretch;
  position: relative;
  margin-top: 2.25rem;
  height: min(72vh, 520px);
  overflow: hidden;
  transform-style: preserve-3d;
  perspective: 900px;
  --count: 1;
  --position: 1;
  --step: 360px;
  --tilt: -12deg;
  --depth: 80px;
  --side-dim: 0.85;
  --side-opacity: 0.92;
  --scale-active: 1.02;
  --dot-size: 8px;
  --dot-gap: 10px;
  --dot-color: #fff;
  --dot-active: var(--gold);
  --dot-ring: rgba(0, 0, 0, 0.16);
  padding: 56px 0 0;
}

.hb-carousel .hb-item {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  --r: calc(var(--position) - var(--offset));
  --abs: max(calc(var(--r) * -1), var(--r));
  transform: translate(-50%, -50%) rotateY(calc(var(--tilt) * var(--r)))
    translateX(calc(var(--step) * var(--r) * -1))
    translateZ(calc(var(--abs) * var(--depth) * -1));
  backface-visibility: hidden;
  will-change: transform, filter, opacity;
  z-index: calc(var(--count) - var(--abs));
  filter: saturate(calc(1 - (1 - var(--side-dim)) * min(var(--abs), 1)))
    brightness(calc(1 - (1 - var(--side-dim)) * min(var(--abs), 1)));
  opacity: calc(1 - (1 - var(--side-opacity)) * min(var(--abs) * 0.8, 1));
  transition: transform 0.35s ease, opacity 0.25s ease, filter 0.25s ease,
    z-index 0.1s;
}

.hb-carousel .hb-item > .card {
  width: var(--w, auto);
  max-width: none;
  height: auto;
  max-height: min(64vh, 480px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
  background: var(--panel);
  transition: width 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease,
    border-color 0.25s ease;
  position: relative;
  z-index: 1;
}

.hb-carousel .hb-item[aria-current="true"] > .card {
  transform: scale(var(--scale-active));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16),
    0 0 0 1px rgba(0, 0, 0, 0.04) inset;
  border-color: color-mix(in oklab, var(--gold) 24%, var(--border));
}

.hb-carousel .hb-item {
  pointer-events: none;
}
.hb-carousel .hb-item[aria-current="true"] {
  pointer-events: auto;
}

.hb-dots {
  grid-row: 2 / 3;
  justify-self: center;
  align-self: start;
  display: inline-flex;
  gap: var(--dot-gap);
  margin-top: 12px;
  z-index: 1;
}

.hb-dot {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  border: 0;
  background: var(--dot-color);
  box-shadow: 0 0 0 1px var(--dot-ring);
  opacity: 0.6;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease,
    background-color 0.15s ease;
}

.hb-dot:hover {
  opacity: 0.85;
  transform: scale(1.15);
}

.hb-dot[aria-current="true"] {
  opacity: 1;
  background: var(--dot-active);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--dot-active) 60%, transparent),
    0 0 0 6px color-mix(in oklab, var(--dot-active) 18%, transparent);
}

/* Keyboard focus for carousel */
[data-hb-viewport].hb-carousel {
  outline: none;
}
[data-hb-viewport].hb-carousel:focus {
  box-shadow: none;
}

[data-hb-viewport].hb-carousel:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--gold) 22%, transparent);
  border-radius: 18px;
}

/* Optional edge fade */
.hb-carousel.hb-edges {
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 8%,
    #000 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 8%,
    #000 92%,
    transparent 100%
  );
}

.hb-carousel.hb-edges {
  pointer-events: none;
}
.hb-carousel.hb-edges * {
  pointer-events: auto;
}

/* Carousel active widening only for non-table cards */
.hb-carousel .hb-item.is-table > .card {
  width: var(--w) !important;
  max-width: none !important;
}

.hb-carousel .hb-item.is-table[aria-current="true"] > .card {
  transform: none;
}

.hb-carousel .hb-item:not(.is-table)[aria-current="true"] > .card {
  width: clamp(calc(var(--w, 360px) * 1), 62vw, 720px);
  transform: scale(var(--scale-active, 1.02));
}

/* Dots below stage */
.hb-viewport.hb-carousel {
  padding-bottom: 56px;
}

.hb-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 10;
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .hb-carousel .hb-item {
    transition: none !important;
  }
  .hb-carousel .hb-item > .card {
    transition: none !important;
  }
  .hb-dot {
    transition: none !important;
  }
}

/* Breakpoints for carousel */
@media (max-width: 639.98px) {
  [data-hb-viewport].hb-carousel {
    height: 64vh;
  }
}

@media (min-width: 1560px) {
  [data-hb-viewport].hb-carousel {
    perspective: 1100px;
  }
}

/* New Property form: let the outer form span full grid width */
.hb-viewport.hb-grid > #pc_form.form {
  max-width: none;   /* remove the global form clamp */
  width: 100%;       /* fill the grid column */
  margin: 0;         /* let the card edges align with the grid edges */
  padding: 0;        /* cards will handle their own padding */
}


/* 2-col grid inside the People modal */
#people-create-modal .form .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Ensure fields stretch correctly in the grid */
#people-create-modal .form .row .field {
  width: 100%;
}

/* ===========================
   FLOAT LABELS: SELECTS
   (same behavior as properties form)
   =========================== */

#people-create-modal .select-wrap {
  position: relative;          /* context for floating label */
}

#people-create-modal .select-wrap .input {
  padding-top: 22px;           /* room for label when resting */
}

/* Base label position (resting) */
#people-create-modal .select-wrap > .label {
  position: absolute;
  left: 12px;
  top: 10px;
  line-height: 1;
  pointer-events: none;
  opacity: .8;
  transition:
    top .15s ease,
    font-size .15s ease,
    opacity .15s ease,
    background-color .15s ease,
    padding .15s ease;
  z-index: 1;                   /* keep it above the control */
}

/* Float when select has a value OR is focused */
#people-create-modal .select-wrap[data-empty="false"] > .label,
#people-create-modal .select-wrap:focus-within > .label {
  top: -12px;                   /* lift above underline */
  font-size: 12px;
  opacity: .95;
  background: var(--panel);     /* mask scrollable options edge */
  padding: 0 6px;               /* pill effect */
}

/* ===========================
   FLOAT LABELS: CHECKBOX GROUP
   (Dispute / Difficult contact)
   =========================== */

/* Wrapper aligns checkbox + text and reserves space for label */
#people-create-modal .check-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 28px;            /* space for floated label */
}

/* Resting label */
#people-create-modal .check-wrap > .label {
  position: absolute;
  left: 0;
  top: 12px;                    /* resting position */
  line-height: 1;
  pointer-events: none;
  opacity: .85;
  transition:
    top .15s ease,
    font-size .15s ease,
    opacity .15s ease,
    background-color .15s ease,
    padding .15s ease;
  z-index: 1;
}

/* Float UP when checked (data-empty="false") or focused */
#people-create-modal .check-wrap[data-empty="false"] > .label,
#people-create-modal .check-wrap:focus-within > .label {
  top: -12px;                   /* match select/input float */
  font-size: 12px;
  opacity: .95;
  background: var(--panel);
  padding: 0 6px;
}

/* Checkbox control sizing + slight nudge to avoid collision */
#people-create-modal .check-wrap .check-input {
  inline-size: 16px;
  block-size: 16px;
  margin-top: 2px;
}

/* Optional helper text next to the checkbox (non-label text) */
#people-create-modal .check-wrap .check-text {
  user-select: none;
}

/* --- People modal footer to match property editor --- */
#people-create-modal .modal__footer.modal__footer--stack {
  display: block;
  padding: 12px 16px 16px;      /* same insets as property editor */
}

/* Relationships list */
.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-item { border-bottom: 1px solid var(--ink-200); padding: 8px 0; }
.rel-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rel-type { font-weight: 600; }
.rel-meta { display: flex; gap: 10px; margin-top: 2px; }
.rel-notes { margin-top: 6px; }

/* Typeahead */
.typeahead { position: relative; }
.typeahead-list {
  position: absolute; inset-inline: 0; top: 100%;
  z-index: 10; background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: 8px; margin: 4px 0 0; padding: 6px 0;
  max-height: 240px; overflow: auto; list-style: none;
}
.typeahead-list li { padding: 6px 10px; cursor: pointer; }
.typeahead-list li.is-active,
.typeahead-list li:hover { background: var(--ink-50); }
.ta-name { font-weight: 600; }
.ta-email { margin-left: 6px; }


/* Block-level, full-width pill button */
.btn-wide {
  display: block;
  width: 100%;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  text-align: center;
}

/* Ensure ghost variant looks like the property editor's Close bar */
.btn.btn-ghost.btn-wide {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 8px 24px rgba(0,0,0,.04) inset;
}

/* Keep hover/active subtle, like the property editor */
.btn.btn-ghost.btn-wide:hover {
  background: var(--hover);
}

.btn.btn-ghost.btn-wide:active {
  transform: translateY(0); /* prevent "pressed" dip for a flat bar feel */
}

/* Match property editor: wide gold Save bar */
#people-create-modal .people-save-row {
  display: block;
  padding: 0 0 8px;
}

/* Shared full-width pill button */
.btn-wide {
  display: block;
  width: 100%;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  text-align: center;
}

/* Primary (gold) wide button: mirror property editor */
.btn.btn-primary.btn-wide {
  /* your global .btn-primary handles colors; we only ensure the shape/size */
  border: 1px solid transparent;        /* avoid layout shift on focus */
}

/* Optional: subtle hover/active consistency */
.btn.btn-primary.btn-wide:hover { filter: brightness(0.98); }
.btn.btn-primary.btn-wide:active { transform: translateY(0); }

/* Keep spacing above the tools grid consistent */
#people-create-modal #people-tools { margin-top: 12px; }


/* People modal: custom max width (scoped to #people-create-modal only) */
#people-create-modal {
  /* Tweak this one number to whatever you want */
  --people-modal-max: 1040px;  /* e.g., 920px, 1040px, 1200px */
}

/* Apply width using the variable above */
#people-create-modal .modal__card {
  max-width: var(--people-modal-max);
  width: min(96vw, var(--people-modal-max)); /* keep margins on small screens */
}

/* Optional: a slightly wider breakpoint feel, if you want true edge gutters */
@media (max-width: 640px) {
  #people-create-modal .modal__card {
    width: 96vw;              /* maintain comfy side gutters on phones */
    border-radius: 16px;      /* match your large modal rounding */
  }
}




/* ======================================================================
   Activity card (scoped tweaks)
   ====================================================================== */

#activity-card .card-head .filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

#activity-card .btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}

#activity-card .btn-sm.is-active {
  background: var(--bg-3, #f4f4f6);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

#activity-card .table.compact th,
#activity-card .table.compact td {
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
}

#activity-card .table.compact td:nth-child(3) {
  white-space: normal;
}
#activity-card .muted {
  color: var(--muted, #7a7a7a);
}

/* Activity card: menu placement & table containment */
#activity-card .menu[hidden] {
  display: none;
}

#activity-card .menu {
  right: 10px;
  top: calc(100% + 6px);
  min-width: 180px;
}

/* piggybacks .menu base styles */
#activity-card .menu {
  display: block;
  right: 10px;
  top: calc(100% + 6px);
  min-width: 180px;
}

#activity-card .menu[hidden] {
  display: none;
}

#activity-card .table {
  table-layout: fixed;
  width: 100%;
}

#activity-card .table th,
#activity-card .table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*===================================================================
Tasks Appointments and Deadlines 
===================================================================*/
.kpi-value {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px; /* tweak to taste */
  font-size: 2.4rem;
  font-weight: 500;
}

.kpi-num {
  display: inline-block;
  padding: 0 0.1em;
}

.kpi-num-divider {
  display: inline-block;
  padding: 0.25em;
  font-size: 1.4rem;
  color: var(--border);
}

/* Colors for ok/warn/danger numbers */
.kpi-num-ok {
  color: #4f8b4a; /* greenish */
}

.kpi-num-warn {
  color: #bfa468; /* gold-ish */
}

.kpi-num-danger {
  color: #b25454; /* red-ish */
}

/* Lock in tool button sizing */
.icon-grid {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

@media (max-width: 1024px) {
  .icon-grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
  }
}

@media (max-width: 768px) {
  .icon-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 480px) {
  .icon-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

.icon-grid .icon-btn {
  min-width: 100px;
} /* prevents micro-shrinking */

/* Properties page top icon menu – force it to behave */
#icons-props.icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)); /* 4 tiles in a row */
  gap: 12px;
  justify-items: center;
  align-items: stretch;
}

/* ===== UNIFY TOOL TILES (property tools, people tools, generic) ===== */
:root {
  --tile-w: 140px;
  --tile-h: 90px;
  --tile-radius: 12px;
}

/* Make all tool tiles share one visual language */
.tool-tile,
.icon-grid .icon-btn,
.card-tools .tool-tile,
#icons-props.icon-grid .icon-btn {
  width: var(--tile-w);
  height: var(--tile-h);
  border-radius: var(--tile-radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;

  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  text-align: center;

  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

/* Icon + label sizing matches the property form tiles */
.tool-tile .glyph,
.icon-grid .icon-btn .glyph {
  font-size: 1.4rem;
  line-height: 1;
}

.tool-tile .title,
.icon-grid .icon-btn .title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: normal; /* allow wrapping like property form */
}

/* Unified hover/active behavior */
.tool-tile:hover,
.icon-grid .icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--gold);
}

.tool-tile:active,
.icon-grid .icon-btn:active {
  transform: translateY(0);
  box-shadow: none;
}


/* ======================================================================
   Paperwork dashboard (tables, layout)
   ====================================================================== */

#paperwork-dashboard #properties-page-root {
  display: grid;
}

#paperwork-dashboard .board-two {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
  margin-top: 10px;
}

#paperwork-dashboard .side-stack {
  display: grid;
  gap: 16px;
}
#paperwork-dashboard .upload-zone {
  display: grid;
  gap: 10px;
}

#paperwork-dashboard .row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#paperwork-dashboard .checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#paperwork-dashboard .table-wrap {
  margin-top: 10px;
  overflow: auto;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--border);
  background: var(--panel);
}

#paperwork-dashboard table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#paperwork-dashboard thead th {
  text-align: left;
  font-weight: 600;
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#paperwork-dashboard tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

#paperwork-dashboard tbody tr:last-child td {
  border-bottom: none;
}
#paperwork-dashboard .btn.primary {
  box-shadow: var(--shadow);
}

#paperwork-dashboard #my-properties-card {
  display: flex;
  flex-direction: column;
  width: 95%;
  max-width: 1620px;
  max-height: 450px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-top: 10px;
  overflow: hidden;
}

#paperwork-dashboard #my-properties-card .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: 12px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--border);
  border-radius: 12px;
}

/* =========================================================
   My Properties header + Active/Deleted toggle
   ========================================================= */

/* My Properties card layout */
#my-properties-card {
  display: flex;
  flex-direction: column;
}

/* Header row: title left, filters right */
#my-properties-card > .section-head {
  display: flex !important;        /* override any global styles */
  flex-direction: row !important;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

/* Title: no extra spacing */
#my-properties-card > .section-head h4 {
  margin: 0;
  padding: 0;
}

/* Filter toggle container (Active / Deleted) */
#my-properties-card #prop-filters {
  margin-left: auto;               /* pushes filters to the right edge */
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Toggle button base look */
#my-properties-card #prop-filters .btn {
  flex: 0 0 auto;
  min-width: auto;
  padding: 0.2rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
  box-shadow: none;
}

/* Ghost default */
#my-properties-card #prop-filters .btn.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

/* Hover */
#my-properties-card #prop-filters .btn.btn-ghost:hover {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--ink);
}

/* Active state */
#my-properties-card #prop-filters .btn.is-active {
  background: var(--gold-20);
  color: var(--ink);
  border-color: var(--accent);
}

/* Table sits below header */
#my-properties-card .table-wrap {
  order: 1;
}

/* Tight title so it doesn’t push things down */
#my-properties-card h4 {
  margin: 0;
  padding: 0;
}

/* Property & Deal notes panel spacing under tools tiles */
.prop-notes-panel,
.deal-notes-panel {
  margin-top: 16px;           /* space between tiles row and Notes section */
}

/* Header row: date on left, actions on right */
.prop-notes-panel .note-row-head,
.deal-notes-panel .note-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* Date + pinned badge */
.prop-notes-panel .note-row-meta,
.deal-notes-panel .note-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Pin/Delete buttons aligned to the right */
.prop-notes-panel .note-row-actions,
.deal-notes-panel .note-row-actions {
  margin-left: auto;          /* push all the way right */
  display: flex;
  gap: 4px;
}

/* Each note separated by a subtle line */
.prop-notes-panel .notes-list .note-row,
.deal-notes-panel .notes-list .note-row {
  padding: 12px 0;
  border-top: 1px solid var(--border, #ececf2);
}

/* Don't show a line before the very first note */
.prop-notes-panel .notes-list .note-row:first-child,
.deal-notes-panel .notes-list .note-row:first-child {
  border-top: none;
}

/* Little spacing from header to first note */
.prop-notes-panel .section-head,
.deal-notes-panel .section-head {
  margin-bottom: 8px;
}

/* Tighten text a bit */
.prop-notes-panel .note-row-body,
.deal-notes-panel .note-row-body {
  margin-top: 4px;
  line-height: 1.4;
}

/* Properties tools icon row: force all tool tiles to same size */
#icons-props.icon-grid .icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  /* fixed footprint so all four match */
  width: 140px; /* tweak up/down to taste */
  height: 90px; /* tweak up/down to taste */

  padding: 0.6rem 0.5rem;
  box-sizing: border-box;

  /* keep their pill look */
  border-radius: 12px;
}

/* icon glyph size stays consistent */
#icons-props.icon-grid .icon-btn .glyph {
  margin-bottom: 0.35rem;
  font-size: 1.4rem; /* icon size */
}

/* label always centered, can wrap to 2 lines */
#icons-props.icon-grid .icon-btn .title {
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: normal; /* allow wrapping */
}

/* Folder table wrapper: give it a reasonable height & scroll body only */
.folder-table-wrap {
  max-height: 420px; /* tweak for taste */
  overflow-y: auto;
  position: relative;
}

/* Sticky header for ALL tables inside a .table-wrap */
.table-wrap .table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel, #fff);
}

/* Optional: little sort arrows on sorted columns */
.table thead th.sorted-asc::after,
.table thead th.sorted-desc::after {
  content: "";
  display: inline-block;
  margin-left: 0.35rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.table thead th.sorted-asc::after {
  border-bottom: 6px solid rgba(0, 0, 0, 0.45);
}
.table thead th.sorted-desc::after {
  border-top: 6px solid rgba(0, 0, 0, 0.45);
}

/* Folder rows: subtle hover + selected state */
.folder-table tbody tr.folder-row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.folder-table tbody tr.folder-row.selected {
  background: rgba(0, 0, 0, 0.05);
}

/* keep the icon column tight */
.folder-table .col-icon {
  width: 32px;
  text-align: center;
}

/* Folder table hover + selection */
.folder-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.folder-table tbody tr.selected {
  background: rgba(0, 0, 0, 0.05);
}

/* Shared column icon (handshake) */
.folder-table .col-shared {
  width: 2.25rem;
  text-align: center;
}

.folder-table .col-shared i.icon-handshake {
  font-size: 1rem;
  line-height: 1;
}

/* keep tight icon columns in tables generally */
.col-icon {
  width: 2.25rem;
  text-align: center;
}

/* ======================================================================
   Profile page
   ====================================================================== */

#profile-page-root .profile-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
}

#profile-page-root .pf-top {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 8px;
}

#profile-page-root .pf-avatar-wrap {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #ddd, #bbb);
  display: grid;
  place-items: center;
}

#profile-page-root .pf-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

#profile-page-root .pf-avatar-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 700;
  color: #2d2d2f;
}

/* Pencil overlay */
#profile-page-root .pf-avatar-edit {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 32px;
  height: 32px;
  border-radius: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

#profile-page-root .pf-avatar-edit:hover {
  background: var(--hover);
}

/* Profile forms (reuse floating underline styles) */
#profile-page-root .pf-form .field {
  position: relative;
  margin: 10px 0;
}

#profile-page-root .pf-form .input {
  width: 100%;
  font: inherit;
  background: transparent;
  color: var(--ink);
  outline: none;
  border: none;
  border-bottom: 2px solid var(--line);
  padding: 14px 12px 12px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#profile-page-root .pf-form .input:focus {
  border-color: var(--gold);
  box-shadow: var(--focus);
}

#profile-page-root .pf-form .label {
  position: absolute;
  left: 12px;
  top: 12px;
  color: var(--ink-2);
  pointer-events: none;
  transition: transform 0.2s ease, color 0.2s ease, top 0.2s ease,
    font-size 0.2s ease, background-color 0.2s ease;
}

#profile-page-root .pf-form .input:focus + .label,
#profile-page-root .pf-form .input:not(:placeholder-shown) + .label {
  top: -12px;
  font-size: 12px;
  color: var(--gold);
  background: var(--panel);
  padding: 0 6px;
  transform: translateY(-2px);
  z-index: 1;
}

#profile-page-root .pf-form .grid-2 {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  #profile-page-root .pf-form .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

#profile-page-root .pf-form .select-wrap {
  position: relative;
}

#profile-page-root .pf-form select.input {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  font: inherit;
  border: none;
  border-bottom: 2px solid var(--line);
  color: var(--ink);
  padding: 14px 32px 12px 12px;
  width: 100%;
}

#profile-page-root .pf-form select.input:focus {
  border-color: var(--gold);
  box-shadow: var(--focus);
}

#profile-page-root .pf-form .select-wrap::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
  font-size: 12px;
}

#profile-page-root .pf-form select.input:not([data-empty="true"]) + .label {
  top: -12px;
  font-size: 12px;
  color: var(--gold);
  background: var(--panel);
  padding: 0 6px;
  transform: translateY(-2px);
  z-index: 1;
}

@media (max-width: 980px) {
  #profile-page-root .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* ======================================================================
   Dupes Overview Tool
   ====================================================================== */

/* ---------- Overlay ---------- */
.dupe-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
}

.dupe-modal[hidden] {
  display: none !important;
}

.dupe-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 18, 27, 0.45);
  backdrop-filter: blur(2px);
}

/* ---------- Card ---------- */
.dupe-modal__card {
  position: relative;
  width: min(1100px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #ececf2);
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.06));
}

/* ---------- Header + Title + Close ---------- */
.dupe-modal__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px;
  border-bottom: 1px solid var(--border, #e9ecef);
  /* tweakable without editing CSS again */
  --dupe-close-top: 12px;
  --dupe-close-right: 12px;
  --dupe-close-size: 36px;
  --dupe-close-font: 20px;
}

.dupe-modal__title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ink, #2e2e3a);
}

/* the only close button you need; works with <button data-close> */
.dupe-modal__header > [data-close] {
  all: unset;
  position: absolute;
  top: var(--dupe-close-top);
  right: var(--dupe-close-right);
  width: var(--dupe-close-size);
  height: var(--dupe-close-size);
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border, #e9ecef);
  color: var(--ink, #2e2e3a);
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.06));
  cursor: pointer;
  z-index: 2;
}

.dupe-modal__header > [data-close]::before {
  content: "×";
  font: 600 var(--dupe-close-font) / 1 Inter, system-ui, -apple-system, Segoe UI,
    Roboto, Helvetica, Arial, sans-serif;
}

.dupe-modal__header > [data-close]:hover {
  background: var(--hover, #f6f6fb);
}

/* ---------- Step wrappers + Footer ---------- */
.dupe-step {
  padding: 16px 18px 18px;
}
[data-step-panel="review"] {
  font-size: 0.9rem;
}

.dupe-modal__footer {
  padding: 10px 18px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border, #e9ecef);
}

/* duplicate/conflict flag button in properties table */
.dupe-flag-btn {
  color: #b25b4e; /* text/icon color when idle */
}

.dupe-flag-btn .icon-flag::before {
  color: #b25b4e; /* ensure the glyph itself is that red */
}

/* hover: make it pop a little without glowing "danger alarm" */
.dupe-flag-btn:hover {
  color: #d06d5d;
}

.dupe-flag-btn:hover .icon-flag::before {
  color: #d06d5d;
}

/* ---------- Review grid + cards ---------- */
/* Review grid + cards */
.review-grid {
  display: grid;
  gap: 12px;
}

@media (max-width: 640px) {
  .review-grid {
    grid-template-columns: repeat(1, minmax(220px, 1fr));
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .review-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .review-grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }
}

@media (min-width: 1201px) {
  .review-grid {
    grid-template-columns: repeat(5, minmax(200px, 1fr));
  }
}

.card-dupe {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 10px;
}

.card-dupe .media {
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  background: #eee;
  display: grid;
  place-items: center;
}

.card-dupe .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-dupe .body {
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.card-dupe .title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin: 2px 0;
}

.card-dupe .meta {
  font-size: 12px;
  color: var(--ink-2);
}

.card-dupe .actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
}

.btn-xs {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.dupe-list {
  display: grid;
  gap: 12px;
}

@media (min-width: 641px) {
  .dupe-list {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (min-width: 1025px) {
  .dupe-list {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }
}

.dupe-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  border: 1px solid var(--border, #e9ecef);
  border-radius: 12px;
  background: var(--bg-soft, #f7f7fa);
  overflow: hidden;
}

.dupe-card .media {
  aspect-ratio: 16/9;
  background: white;
  overflow: hidden;
}

.dupe-card .media img {
  width: 100%;
  height: 100%;
  /*object-fit: cover;*/
  object-fit: contain;
  object-position: center center;
  display: block;
}

/* make it responsive on small screens */
@media (max-width: 520px) {
  .dupe-card .media {
    width: 80px;
    height: 60px;
  }
  .dupe-card {
    grid-template-columns: 80px 1fr auto;
  }
}

.dupe-card .body {
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.dupe-card .title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink, #2e2e3a);
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.dupe-card .meta {
  font-size: 0.85rem;
  color: var(--ink-2, #5b5b6b);
  line-height: 1.25;
}

.dupe-card .actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
}
.dupe-card .btn {
  padding: 8px 10px;
  font-size: 0.85rem;
  border-radius: 10px;
}


/*=====================================================================
   Activity Card Carousel (scoped to card--activity)
   ====================================================================*/

.card--activity .value {
  margin-top: 4px; /* override global .card .value */
  padding-top: 0.5rem;
  font-size: 0.85rem; /* keep the card short */
  font-weight: 400;
}

/* Viewport + track */
.card--activity .activity-viewport {
  overflow: hidden;
}

.card--activity .activity-track {
  display: flex;
  transition: transform 0.25s ease;
}

/* Each “message” */
.card--activity .activity-item {
  min-width: 100%;
  padding: 0.15rem 0.1rem;
}

.card--activity .activity-sentence {
  font-size: 0.8rem;
  line-height: 1.4;
}

.card--activity .activity-sentence-when {
  font-weight: 500;
}

.card--activity .activity-sentence-you {
  font-weight: 500;
}

.card--activity .activity-meta {
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: var(--muted, #6b7280);
}

.card--activity .activity-empty {
  font-size: 0.8rem;
  padding: 0.25rem 0;
}

/* Footer: arrows + counter on one line */
.card--activity .activity-footer {
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Arrows */
.card--activity .activity-nav {
  border: 0;
  background: #f3f4f6;
  color: #4b5563;
  border-radius: 999px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}
.card--activity .activity-nav:hover:not(:disabled) {
  background: #e5e7eb;
}
.card--activity .activity-nav:active:not(:disabled) {
  transform: translateY(1px);
}
.card--activity .activity-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Counter: smaller & subtle */
.card--activity .activity-counter {
  font-size: 0.7rem;
  text-align: center;
  min-width: 72px;
}

/* ---------- Merge view ---------- */
.merge-wrap {
  display: grid;
  gap: 12px;
}

.merge-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.merge-toolbar .grow {
  flex: 1;
}

.merge-grid {
  overflow: auto;
  border: 1px solid var(--border, #e9ecef);
  border-radius: 12px;
  background: var(--panel, #fff);
}

.merge-grid table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.merge-grid thead th,
.merge-grid tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e9ecef);
  vertical-align: top;
  text-align: left;
  white-space: nowrap;
}

.merge-grid thead th:first-child,
.merge-grid tbody td:first-child {
  position: sticky;
  left: 0;
  background: var(--panel, #fff);
  z-index: 1;
}

.merge-grid thead th {
  font-size: 0.9rem;
}
.merge-field {
  font-weight: 600;
}

.merge-option {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.merge-option .muted {
  font-size: 0.85rem;
  color: var(--ink-2, #5b5b6b);
}

/* ======================================================================
   Map card (specific tool)
   ====================================================================== */

#properties-map-card {
  width: 100%;
  height: clamp(420px, 80svh, 500px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#properties-map-card .section-head,
#properties-map-card footer {
  flex: 0 0 auto;
}

#properties-map-card .map-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

/* 1) Make the map card span full width of the cards grid */
.cards-grid #properties-map-card {
  grid-column: 1 / -1; /* span all columns in the grid */
}

/* 2) Tighter padding between header, map, and footer */
#properties-map-card {
  padding-top: 0;
  padding-bottom: 0.5rem;
}

#properties-map-card .section-head {
  margin-bottom: 0.05rem;
}

#properties-map-card .map-wrap {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

/* 3) Align title + search horizontally, make search a bit longer */
#properties-map-card > .section-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.05rem;
}

#properties-map-card .section-head h4 {
  margin: 0;
}

#properties-map-card .section-head .actions {
  margin-left: auto;
  display: flex;
  align-items: center;
}

#properties-map-card label[for="propMapSearch"] {
  font-size: 0.8rem;
  font-weight: 500;
}

#propMapSearch {
  min-width: 220px;
  width: min(340px, 70vw); /* longer, but still responsive */
}

/* 4) Footer text smaller + softer */
#properties-map-card footer.muted.small {
  font-size: 0.7rem;
  line-height: 1.3;
  opacity: 0.75;
  margin-top: 0.25rem;
}

@media (max-width: 768px) {
  #properties-map-card {
    width: 100%;
  }
}

/* ======================================================================
   Custom Inputs (scoped)
   ====================================================================== */

#custom-inputs .field {
  position: relative;
  margin: 14px 0;
}

#custom-inputs .label {
  position: absolute;
  left: 12px;
  top: 12px;
  color: var(--ink-2);
  pointer-events: none;
  transition: transform 0.2s ease, color 0.2s ease, top 0.2s ease,
    font-size 0.2s ease, background-color 0.2s ease;
}

#custom-inputs .input:focus + .label,
#custom-inputs .input:not(:placeholder-shown) + .label {
  top: -12px;
  font-size: 12px;
  color: var(--gold);
  background: var(--panel);
  padding: 0 6px;
  transform: translateY(-2px);
  z-index: 1;
}

#custom-inputs [data-action="promote"],
#custom-inputs [data-action="dismiss"] {
  background: transparent;
  border: none;
  padding: 0 4px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 12px;
}

#custom-inputs [data-action="promote"] {
  color: var(--gold);
  font-weight: 600;
}

#custom-inputs [data-action="promote"]:hover,
#custom-inputs [data-action="dismiss"]:hover {
  text-decoration: underline;
}

#custom-inputs .select-wrap {
  position: relative;
}

#custom-inputs .saved-remove {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: none;
  place-items: center;
  background: #d94a4a;
  color: #fff6e5;
  font-size: 14px;
  line-height: 1;
  border: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

#custom-inputs .saved-remove.show {
  display: grid;
}
#custom-inputs .saved-remove:focus {
  outline: none;
  box-shadow: var(--focus);
}

/* ===== Autocomplete (property form) ===== */
.suggest-wrap {
  position: relative;
}

/* Legacy suggest panel: uses .is-open for visibility */
.suggest-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  display: none; /* only this one is controlled by .is-open */
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 999;
}

.suggest-panel.is-open {
  display: block;
}

/* New helper container: same look, BUT we do NOT force display:none here.
   Your JS can control visibility via [hidden] or inline style. */
#pc_address_suggestions {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 999;
}

/* Make every option look like the old vertical list */
.suggest-item,
#pc_address_suggestions button,
#pc_address_suggestions .paa-item,
#pc_address_suggestions [data-role="option"] {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.suggest-item:hover,
#pc_address_suggestions button:hover,
#pc_address_suggestions .paa-item:hover,
#pc_address_suggestions [data-role="option"]:hover {
  background: var(--hover);
}

/* Empty state */
.suggest-empty,
#pc_address_suggestions .empty {
  padding: 10px 12px;
  color: var(--ink-2);
}



/* Inline “link-style” buttons used in promote hint */
.btn-inline {
  background: transparent;
  border: none;
  padding: 0 0.25rem;
  cursor: pointer;
  font: inherit;
}

.btn-inline:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-inline--gold {
  color: var(--gold);
  font-weight: 600;
}
.btn-inline--muted {
  color: var(--ink-2);
}

/* ======================================================================
   folder rules
   =======================================================================*/

.folder-grid-root,
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 14px;
}

.folder-card {
  cursor: pointer;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  user-select: none;
  background: #fff;
}

.folder-card.selected {
  outline: 2px solid #4f46e5;
}
.folder-card-icon {
  width: 48px;
  height: 48px;
  margin: 8px auto 10px;
  background: #f2f2f2;
  border-radius: 8px;
}
.folder-card-icon.folder-shared {
  background: #eaf3ff;
}
.folder-card-icon.file {
  background: #f9f0ff;
}
.folder-card-title {
  font-size: 13px;
  line-height: 1.2;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-card-sub {
  color: #6b7280;
  font-size: 12px;
  margin-top: 2px;
}
.crumb {
  margin-bottom: 10px;
}
.crumb-link {
  color: #2563eb;
  cursor: pointer;
}
.crumb-active {
  font-weight: 600;
}
.folder-section {
  margin-bottom: 22px;
}
.folder-section h3 {
  font-size: 14px;
  color: #374151;
  margin: 8px 0 10px;
}

.folder-grid-root,
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 14px;
}

.folder-card {
  cursor: pointer;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  user-select: none;
  background: #fff;
}

/* Folders tool layout: use a single wide card, not a tile grid */
#folders-root #folder-grid {
  display: block; /* override .folder-grid-root grid layout */
}

/* Make the folders card match the width of other tools (like My Properties) */
#folders-root .folders-card {
  width: 95%;
  max-width: 1620px;
  margin-top: 10px;
  margin-left: auto;
  margin-right: auto;
}

/* ======================================================================
   Responsive shell & scrolling behavior
   ====================================================================== */

@media (max-width: 1024px) {
  #paperwork-dashboard .board-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 72px 1fr;
  }
  .brand span,
  .brand small {
    display: none;
  }
  .nav a span {
    display: none;
  }
  .nav a {
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .kpis {
    grid-template-columns: 1fr;
  }
}

/* Viewport clamp (app shell) */
html,
body {
  height: 100dvh;
  overflow: hidden;
}

.app {
  height: 100dvh;
  overflow: hidden;
}

.header {
  position: sticky;
  top: 0;
  min-width: 0;
}

.header .search,
.header .trail {
  min-width: 0;
}

.header .search input {
  width: 100%;
  max-width: 100%;
}

.sidebar {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

main {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

main,
.sidebar,
.header {
  overscroll-behavior: contain;
}
main * {
  max-width: 100%;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

pre,
code,
.codeblock {
  max-width: 100%;
  overflow: auto;
}

.tool-spa {
  display: grid;
  gap: 1rem;
}

.tool-spa .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tool-spa .breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--ink-2);
}

.tool-spa .breadcrumbs a {
  color: var(--ink-2);
  text-decoration: none;
}

.tool-spa .breadcrumbs .sep {
  opacity: 0.5;
}

/* Top row: search + filters */
.tool-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.tool-search {
  position: relative;
}

.tool-search input[type="search"] {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--bg);
  color: var(--ink);
}

.tool-search .icon {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  opacity: 0.65;
}

.tool-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tool-filters .select-wrap {
  min-width: 10rem;
}

/* Metrics row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.metrics-row .metric {
  grid-column: span 4;
}

@media (max-width: 1200px) {
  .metrics-row .metric {
    grid-column: span 6;
  }
}

@media (max-width: 640px) {
  .metrics-row .metric {
    grid-column: span 12;
  }
}

.metric .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
}

.metric .label {
  font-size: 0.9rem;
  color: var(--ink-2);
}
.metric .delta {
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Lower icon grid */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 0.75rem;
  justify-items: center;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .icon-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .icon-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .icon-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.icon-btn {
  width: 70%;
  height: 65%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    border-color 0.12s ease;
}

.icon-btn .glyph {
  font-size: 0.6rem;
  line-height: 1;
}

.icon-btn .title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.icon-btn .hint {
  font-size: 0.6rem;
  color: var(--ink-2);
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--gold);
}

.icon-btn:active {
  transform: translateY(0);
  box-shadow: none;
}
.icon-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Lightweight badge strip inside cards */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--ink-2);
}

/* Minimal list styles */
.list {
  display: grid;
  gap: 0.5rem;
}

.list .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px dashed var(--line);
}

.list .item:last-child {
  border-bottom: 0;
}
.muted {
  color: var(--ink-2);
}

/* Icon grid/button already exist — this just styles the font icons */
.icon-btn .glyph {
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
}

.icon-btn .glyph .icon {
  font-size: 1.5rem; /* base size */
  opacity: 0.92;
}
.icon-btn:hover .glyph .icon {
  opacity: 1;
}
.icon-btn:active .glyph .icon {
  transform: translateY(0);
}

.icon-btn .title {
  letter-spacing: 0.02em;
}

/* ======================================================================
   Utilities
   ====================================================================== */

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

/* job progress bar pinned to bottom of viewport */
.job-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--ink); /* dark bar */
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  z-index: 9999;
  padding: 4px 8px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.job-bar__inner {
  position: relative;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius, 8px);
  overflow: hidden;
  height: 6px;
}

/* the fill element we'll animate inline using width % */
.job-bar__inner::before {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--pct, 0%);
  background: var(--accent, var(--gold));
  transition: width 0.25s ease;
  border-radius: inherit;
}

#job-progress-text {
  position: absolute;
  left: 8px;
  top: -1.4em;
  color: #fff;
  font-weight: 500;
}

/* ---------- small helpers for flex sizing ---------- */
.row-gap {
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row-tight {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.flex-1 {
  flex: 1 1 0;
}
.flex-2 {
  flex: 2 1 0;
}
.flex-1-50 {
  flex: 1 1 50%;
  min-width: 200px;
}
.max-360 {
  max-width: 360px;
  flex: 1 1 320px;
}
.top-pad {
  margin-top: 12px;
}

.owners-block {
  display: grid;
  gap: 12px;
}
.owners-list {
  display: grid;
  gap: 8px;
}
.static-label {
  position: static;
  font-weight: 600;
  color: var(--ink);
}

/* probate group toggled by JS */
.probate-field.hidden,
.debt-other-block.hidden,
.hidden {
  display: none !important;
}

/* Required star color reuse */
.req {
  color: #b91c1c;
}

/* ---------- collapsible cards ---------- */

/* Card header row */
.card-collapsible .collapse-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 12px;
}

.collapse-title h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.collapse-title small {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-2);
  display: block;
  margin-top: 2px;
}

/* toggle button (Hide / Show) */
.collapse-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.collapse-toggle:hover {
  background: var(--hover);
}

.collapse-toggle .toggle-icon {
  font-size: 10px;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s ease;
}

/* collapsed state (JS will add .is-collapsed to card) */
.card-collapsible.is-collapsed .collapse-body {
  display: none;
}
.card-collapsible.is-collapsed .collapse-toggle .toggle-label {
  /* when collapsed, label becomes "Show" via JS, but safe fallback */
}
.card-collapsible.is-collapsed .collapse-toggle .toggle-icon {
  transform: rotate(-90deg);
}

/* ---------- tools card layout ---------- */
.card-tools .tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.tool-tile {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: box-shadow 0.12s ease, transform 0.12s ease,
    border-color 0.12s ease;
}

.tool-tile:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--gold);
}

.tool-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink);
}

.tool-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

/* Top bar: title + icon menu on one line */
.tool-hero {
  display: flex;
  align-items: center; /* vertical alignment */
  justify-content: space-between;
  gap: 0.35rem; /* space between text and tiles */
  margin-bottom: 1rem; /* tighter gap before KPIs */
}

/* Make sure title doesn’t push things down */
.tool-hero .tool-title {
  margin: 0;
  font-size: 0.9rem; /* slightly smaller than default <p> */
  font-weight: 500;
}

/* Kill any top margin the grid might be adding in this context */
.tool-hero .icon-grid {
  display: flex; /* override any grid definition */
  justify-content: flex-end; /* hug the right edge (align with cards) */
  gap: 0.4rem; /* smaller gap between tool tiles */
  margin: 0;
}

/* Optional: tighten spacing inside the icon grid if it feels too airy */
.tool-hero .icon-grid .icon-btn {
  margin-top: 0;
}

/* placeholder fontello icon classes.
   Map them to your real fontello glyphs */
.icon-note::before {
  content: "\e800";
} /* update with real codepoint */
.icon-docs::before {
  content: "\e801";
}
.icon-photo::before {
  content: "\e802";
}
.icon-refresh::before {
  content: "\e803";
}

.icon-note,
.icon-docs,
.icon-photo,
.icon-refresh {
  font-family: "fontello";
  font-style: normal;
  font-weight: normal;
  speak: none;
  display: inline-block;
  line-height: 1;
  font-size: 1rem;
}

/* Layout: grid + detail panel */
.people-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1.4fr);
  gap: 18px;
  align-items: flex-start;
}

@media (max-width: 960px) {
  .people-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .people-detail-shell {
    order: -1;
  }
}

.people-grid-shell,
.people-detail-shell {
  min-height: 260px;
}

/* Rolodex grid */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.person-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: #fff;
  padding: 10px 10px 9px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 4px;
  cursor: pointer;
  transition: box-shadow 0.14s ease, border-color 0.14s ease,
    transform 0.06s ease, background-color 0.14s ease;
}

.person-card:hover {
  box-shadow: var(--shadow, 0 10px 24px rgba(0, 0, 0, 0.06));
  border-color: var(--gold, #bfa468);
  transform: translateY(-1px);
  background: #fffbf4;
}

.person-card.is-active {
  border-color: var(--gold, #bfa468);
  box-shadow: 0 0 0 1px rgba(191, 164, 104, 0.45),
    0 12px 30px rgba(0, 0, 0, 0.08);
  background: #fffbf4;
}

.person-card.is-deleted {
  opacity: 0.6;
}

.person-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.person-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #111827;
  background: #f3f4f6;
}

.person-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink, #2d2d2f);
  line-height: 1.2;
}

.person-meta {
  font-size: 0.72rem;
  color: var(--muted, #6b7280);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.person-meta span {
  white-space: nowrap;
}

.person-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 1px;
}

.pill {
  border-radius: 999px;
  font-size: 0.68rem;
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #f4f4f6;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pill-role {
  border-color: rgba(191, 164, 104, 0.4);
  background: rgba(191, 164, 104, 0.08);
  color: #4b3a1b;
}

.pill-grade-good {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #166534;
}

.pill-grade-maybe {
  border-color: rgba(234, 179, 8, 0.4);
  background: rgba(234, 179, 8, 0.08);
  color: #854d0e;
}

.pill-grade-bad {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
}

.pill-dispute {
  background-color: #fee2e2;
  color: #b91c1c;
}

.people-detail-roles {
  display: inline-flex;
  /*flex-wrap: wrap;*/
  gap: 6px;
  align-items: center;
}

/* If your .pill base uses odd line-height, normalize it */
.pill {
  line-height: 1; /* keep height consistent */
  display: inline-flex; /* align text nicely */
  align-items: center;
}

/* Detail panel */
.people-detail {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
}

.people-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

/* People detail: linked properties footer actions */
.people-detail-actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.5rem;
}

/* optional: keep list clear of the right dots gutter */
.contacts-list {
  padding-right: 22px;
}

.divider--soft {
  margin: 0.5rem 0 0.75rem;
  opacity: 0.5; /* keep it subtle like the footer’s rule */
}

.people-avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
  background: linear-gradient(135deg, #f5f5f7, #e0e7ff);
}

.people-detail-nameblock h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink, #111827);
}

.people-detail-roles {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.people-detail-section {
  margin-top: 10px;
}

.people-detail-section h4 {
  margin: 0 0 4px;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
}

.people-detail-list {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px 10px;
  font-size: 0.78rem;
}

.people-detail-list div {
  min-width: 0;
}

.people-detail-list dt {
  margin: 0;
  font-weight: 500;
  color: var(--muted, #6b7280);
  font-size: 0.7rem;
}

.people-detail-list dd {
  margin: 0;
  color: var(--ink, #111827);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.people-detail-links {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.78rem;
}

.people-detail-links li + li {
  margin-top: 2px;
}

.people-detail-empty {
  font-size: 0.8rem;
  padding: 6px 0;
}

.people-detail-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.people-detail-actions {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle, #e5e7eb);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#filter-grade {
  font-family: "fontello", Inter, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, sans-serif;
}

/* ======================================================================
   CONTACTS PAGE: LIST + DOT RAIL
   Matches HTML with:
   - .card.contacts-frame
   - .contacts-shell[data-contact-scroll]
   - .contacts-list
   - .card.contact-card
   - .track-dots / .track-dot
   ====================================================================== */

/* Big wrapper card for the entire contacts block */
.contacts-frame {
  padding: 0;
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--panel);
  overflow: hidden; /* keep scroll & dots inside */
  max-width: 1100px;
  margin-top: 12px;
}

/* Shell that defines the scroll viewport inside the big card */
.contacts-shell {
  position: relative;
  height: min(640px, 70vh); /* tall but not full page */
}

/* Scrollable list of contacts INSIDE the card */
.contacts-list {
  height: 100%;
  overflow-y: auto;
  padding: 0.5rem 2.4rem 0.5rem 0.75rem; /* room on right for dot rail */
  scroll-behavior: smooth;
}

/* Each contact row: wide, short, pill-like */
.contact-card {
  border-radius: 999px;
  padding: 10px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fdfdfd;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Hover state */
.contact-card:hover {
  background: #fffbf4;
  border-color: var(--gold);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

/* Left side: avatar + text stack */
.contact-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.contact-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #111827;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.contact-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.contact-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink, #2d2d2f);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-meta {
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Right side: pills / quick actions */
.contact-right {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  flex-shrink: 0;
  white-space: nowrap;
}

.contact-pill {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft, #f7f7fa);
  color: var(--ink-2);
  white-space: nowrap;
}

.contact-pill--gold {
  border-color: rgba(191, 164, 104, 0.5);
  background: rgba(191, 164, 104, 0.08);
  color: #4b3a1b;
}

.contact-pill--muted {
  color: var(--muted, #6b7280);
}

/* tiny text icon inside pill */
.contact-icon {
  font-size: 0.7rem;
  opacity: 0.65;
}

.people-notes-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-item {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-subtle, #f9fafb);
}

.note-body {
  margin-bottom: 4px;
}

.note-meta span + span {
  margin-left: 8px;
}

/* ======================================================================
   DOT RAIL (track-dots / track-dot)
   ====================================================================== */

/* Vertical rail anchored to the right side of the contacts card */
.track-dots {
  position: absolute;
  top: 0.25rem; /* a little inset from card edge */
  right: 0.4rem;
  bottom: 0.25rem;
  width: 18px;

  display: flex;
  flex-direction: column;
  align-items: center;

  /* THIS is the key: spread dots from top to bottom */
  justify-content: space-between;
  gap: 0;

  pointer-events: none; /* buttons re-enable events */
}

.track-dots[hidden] {
  display: none !important;
}

/* Base dot */
.track-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: rgba(0, 0, 0, 0.18);
  opacity: 0.7;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.15s ease, background-color 0.15s ease,
    transform 0.15s ease;
}

/* Active state: gold + morph animation */
.track-dot.is-active {
  background: var(--gold, #bfa468);
  opacity: 1;
  animation: trackDotMorph 0.26s ease-out;
}

/* Larger invisible hitbox – keep this */
.track-dot::before {
  content: "";
  position: absolute;
  inset: -6px;
}

/* Morph: circle → tall pill → circle (same position) */
@keyframes trackDotMorph {
  0% {
    transform: scaleX(1) scaleY(1);
  }
  35% {
    transform: scaleX(1.1) scaleY(2.4); /* vertical pill */
  }
  100% {
    transform: scaleX(1) scaleY(1); /* back to circle */
  }
}

/* Larger invisible hitbox – easier to hit on touch */
.track-dot::before {
  content: "";
  position: absolute;
  inset: -6px;
}

/* Hide native scrollbar on the contacts list, but keep it scrollable */
.contacts-list {
  overflow-y: auto; /* keep scrolling */
  -ms-overflow-style: none; /* IE/Edge legacy */
  scrollbar-width: none; /* Firefox */
}

.contacts-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* -------------------------------------------------
 * Profit / Final Net Proceeds page
 * ------------------------------------------------- */

#profit-page-root .page-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

#profit-page-root .hb-viewport.hb-grid {
  margin-top: 1.75rem;
}

/* Cards on Profit page respect grid width */
#profit-page-root .card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Context card */
#profit-context-card .profit-context-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#profit-context-card .profit-context-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

#profit-context-card .profit-meta-line {
  font-size: 0.85rem;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

#profit-context-card .profit-context-meta {
  margin-top: 8px;
}

/* Summary card */
#profit-summary-card .profit-summary-body {
  padding-top: 4px;
}

#profit-summary-card .profit-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 20px;
}

#profit-summary-card .profit-summary-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-soft);
}

#profit-summary-card .profit-summary-item.profit-summary-net {
  border: 1px solid var(--gold-20);
  box-shadow: var(--shadow-soft, 0 6px 14px rgba(0, 0, 0, 0.04));
}

#profit-summary-card .profit-summary-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

#profit-summary-card .profit-summary-value {
  font-size: 1rem;
  font-weight: 600;
}

#profit-summary-card .profit-summary-sub {
  margin-top: 4px;
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: baseline;
  color: var(--muted);
}

#profit-summary-empty {
  margin-top: 12px;
}

/* Notes card */
#profit-notes-card .profit-notes-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#profit-notes-card .profit-notes-list {
  max-height: 260px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  background: #fff;
}

#profit-notes-card .profit-note {
  padding: 6px 4px 8px;
  border-bottom: 1px solid var(--border);
}

#profit-notes-card .profit-note:last-child {
  border-bottom: none;
}

#profit-notes-card .profit-note-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 2px;
}

#profit-notes-card .profit-note-body {
  font-size: 0.85rem;
  white-space: pre-wrap;
}

#profit-notes-card .profit-note-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#profit-notes-card .profit-note-input {
  resize: vertical;
}

#profit-notes-card .profit-note-actions {
  display: flex;
  justify-content: flex-end;
}

/* Attachments stub */
#profit-attachments-card .card-body p {
  margin-bottom: 6px;
}

/* Revenue & Expense Breakdown card:
   keep it in-column and let tools wrap */
#profit-breakdown-card {
  overflow: hidden; /* prevent tiny overflow from shifting the border */
}

#profit-breakdown-card .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  white-space: normal; /* override any global nowrap */
}

#profit-breakdown-card .card-title {
  flex: 1 1 auto;
  min-width: 0;
}

#profit-breakdown-card .card-tools {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap; /* buttons wrap instead of stretching card */
  gap: 8px;
  white-space: normal;
}

/* Deal editor modal width + layout */
#deal-editor-modal .modal__card {
  max-width: 960px; /* wider like the property editor */
  width: 100%;
}

/* Grid layout inside the deal editor body */
.deal-editor-body {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Each section can use the existing grid-2 helper to form columns */
.deal-editor-section .grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
}

@media (max-width: 768px) {
  #deal-editor-modal .modal__card {
    max-width: 100%;
    margin: 0 1rem;
  }

  .deal-editor-section .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Dashboard: Recent Transactions */
.deal-transactions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.deal-transactions-table th,
.deal-transactions-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-soft, rgba(15, 23, 42, 0.08));
}

.deal-transactions-table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-muted, #64748b);
  white-space: nowrap;
}

.deal-transactions-table td.text-right {
  text-align: right;
}

.deal-transactions-table td.text-center {
  text-align: center;
}

.deal-transactions-table th.text-right {
  text-align: right;
}

.deal-transactions-table th.text-center {
  text-align: center;
}


/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.status-pill--default {
  background: rgba(148, 163, 184, 0.12);
  color: #475569;
}

.status-pill--draft {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
}

.status-pill--active {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
}

.status-pill--closed {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.status-pill--abandoned {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}



/* ======================================================================
   Calendar SPA controls
   ====================================================================== */
.cal-slot {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.cal-pill:hover {
  background: var(--hover);
}

/* ======================================================================
tasks kanban + modal
======================================================================*/
/* /css/tasks.css */
/* Scoped Kanban + modal layout. No brand color overrides; uses your vars. */

.tasks-toolbar {
  align-items: center;
  gap: 12px;
}

.tasks-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Board shell */
.tasks-layout {
  margin-top: 12px;
}

.tasks-kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}

/* Column card */
.tasks-column {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
  padding: 0;
  overflow: hidden;
}

.tasks-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.tasks-column-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.tasks-column-count {
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--border);
}

.tasks-column-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}

.tasks-column-empty {
  padding: 10px 8px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
}

/* Task cards */
.tasks-card {
  position: relative;
  padding: 12px 12px 10px 12px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: grab;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.tasks-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 4px;
  background: var(--gold);
  opacity: 0.35;
}

.tasks-card:hover {
  transform: translateY(-2px);
}

.tasks-card.is-dragging {
  opacity: 0.7;
  transform: rotate(1deg);
  cursor: grabbing;
}

.tasks-column-body.is-drop-target {
  background: var(--bg-soft);
  border-radius: 12px;
}

/* Card head */
.tasks-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.tasks-card-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

/* Priority pill */
.tasks-card-priority {
  height: 22px;
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.tasks-card-priority--low {
  background: var(--bg-soft);
  color: var(--ink-2);
}

.tasks-card-priority--med {
  background: var(--gold-20);
  color: var(--ink);
}

.tasks-card-priority--high {
  background: var(--gold);
  color: #fff;
}

/* Card meta */
.tasks-card-body {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.tasks-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.tasks-card-footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.tasks-card-due {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink-2);
  background: var(--bg-soft);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Modal fine-tune */
.tasks-form {
  display: grid;
  gap: 12px;
}

.tasks-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tasks-due-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tasks-sub-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: -4px;
}

.tasks-attachments {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
}

/* Responsive */
@media (max-width: 980px) {
  .tasks-kanban {
    grid-template-columns: 1fr;
  }
  .tasks-grid {
    grid-template-columns: 1fr;
  }
}

/* Hide property diagnostics / enrichment panel everywhere */
.diagnostics-card,
#prop-meta-info {
  display: none !important;
}


/* ======================================================================
   END OF styles.css
   ====================================================================== */
