/* ============================================================================
   Plotify — shared component classes. Tokens only (no hardcoded colors).
   Borders over shadows. One primary action per screen. Status via chips only.
   ============================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--content-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* --- Accessibility: skip link + focus rings ------------------------------ */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -48px;
  z-index: var(--z-tooltip);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--space-2) var(--space-4);
  transition: top var(--dur-micro) var(--ease);
}
.skip-link:focus {
  top: var(--space-2);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
/* Remove the default focus ring only where a custom one is provided. */
:where(button, summary):focus:not(:focus-visible) {
  outline: none;
}

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

/* --- Typography helpers -------------------------------------------------- */
h1,
.h1 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  margin: 0;
}
h2,
.h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  margin: 0;
}
.label {
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.dim {
  color: var(--dim);
}
.tabular {
  font-variant-numeric: tabular-nums;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.005em;
  padding: 0 var(--space-4);
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--dur-micro) var(--ease),
    border-color var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease),
    box-shadow var(--dur-micro) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
  min-height: 40px;
  line-height: 1;
  user-select: none;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}
.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--shadow-xs);
}
.btn--primary:hover:not(:disabled) {
  background: var(--primary-hover);
}
.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn--secondary:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--tint-info);
}
.btn--ghost {
  background: transparent;
  color: var(--muted);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}
.btn--danger {
  background: var(--danger);
  color: var(--on-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), var(--shadow-xs);
}
.notice {
  padding: 10px 14px; border-radius: var(--r-md); font-size: 13px;
  margin: 0 0 16px; border: 1px solid var(--border);
}
.notice--error { background: var(--tint-danger, color-mix(in srgb, var(--danger) 12%, var(--surface))); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.notice--ok { background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.btn--danger:hover:not(:disabled) {
  background: var(--danger-strong);
}
/* Quiet destructive: text/border red, fills on hover. For inline row actions. */
.btn--danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.btn--danger-ghost:hover:not(:disabled) {
  background: var(--tint-danger);
  color: var(--danger-strong);
}
.btn--sm {
  min-height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--fs-sm);
  gap: var(--space-1);
}
.btn--sm svg {
  width: 14px;
  height: 14px;
}
.btn--block {
  width: 100%;
}
.btn--icon {
  padding: 0;
  min-height: 40px;
  width: 40px;
}
.btn--icon.btn--sm {
  min-height: 32px;
  width: 32px;
}

/* --- Card ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
.card__header {
  padding: var(--card-pad);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.card__body {
  padding: var(--card-pad);
}
.card__footer {
  padding: var(--space-3) var(--card-pad);
  border-top: 1px solid var(--border);
}

/* --- Table --------------------------------------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-table);
  font-variant-numeric: tabular-nums;
}
.table th {
  text-align: left;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
  padding: var(--space-1) var(--space-3);
  height: 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.table td {
  padding: 0 var(--space-3);
  height: var(--row-h);
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table tbody tr:last-child td {
  border-bottom: none;
}

/* --- Badge --------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: 2px var(--space-2);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  line-height: 1.4;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }

/* --- Status chip (a11y: dot + label, never color alone) ------------------ */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: 3px var(--space-2);
  border-radius: var(--r-full);
  border: 1px solid var(--st, var(--border));
  color: var(--text);
  background: color-mix(in srgb, var(--st, var(--muted)) 10%, var(--surface));
  white-space: nowrap;
}
.status-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--st, var(--muted));
  flex-shrink: 0;
}
.status-chip--available { --st: var(--st-available); }
.status-chip--sold { --st: var(--st-sold); }
.status-chip--reserved { --st: var(--st-reserved); }
.status-chip--hold { --st: var(--st-hold); }
.status-chip--resale { --st: var(--st-resale); }
.status-chip--unknown { --st: var(--st-unknown); }
.status-chip--not_for_sale,
.status-chip--not-for-sale { --st: var(--st-not-for-sale); }

/* --- Form field ---------------------------------------------------------- */
.field {
  margin-bottom: var(--space-4);
}
.field__label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  margin-bottom: var(--space-2);
}
.field__req {
  color: var(--danger);
}
.field__control,
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font: inherit;
  font-size: var(--fs-table);
  color: var(--text);
  outline: none;
  min-height: 38px;
  transition: border-color var(--dur-micro) var(--ease),
    box-shadow var(--dur-micro) var(--ease);
}
.field textarea {
  min-height: 84px;
  resize: vertical;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.field__control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.field__help {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: var(--space-1);
}
.field__help--warn { color: var(--warning, #b45309); font-weight: 600; }
.field__error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: var(--space-1);
}
.field--invalid input,
.field--invalid select,
.field--invalid textarea {
  border-color: var(--danger);
}
.field--invalid input:focus,
.field--invalid select:focus,
.field--invalid textarea:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--tint-danger);
}
.field input::placeholder,
.field textarea::placeholder,
.field__control::placeholder {
  color: var(--dim);
}
/* Native select chevron. A mid-grey (slate-500) that meets contrast on both
   light and dark theme surfaces — background-image SVG cannot read CSS vars,
   so this single neutral is the pragmatic cross-theme choice. */
.field select,
.field__control:is(select),
.theme-switch__select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23748098' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

/* --- Scrim (shared by slide-over & modal) -------------------------------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  z-index: var(--z-scrim);
  animation: fade-in var(--dur-micro) var(--ease);
}

/* --- Slide-over ---------------------------------------------------------- */
.slide-over {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(480px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  animation: slide-in var(--dur-overlay) var(--ease-out);
}
.slide-over__header,
.modal__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.slide-over__body,
.modal__body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}
.slide-over__footer,
.modal__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  /* Pin the primary action to the bottom of the drawer so Save/Cancel never scroll out of
     reach on a tall form (the sale/edit panels were burying it below the fold). */
  position: sticky;
  bottom: 0;
  background: var(--surface);
  z-index: 1;
}

/* --- Modal --------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--space-4);
}
.modal__dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: pop-in var(--dur-overlay) var(--ease-out);
}

/* --- Confirm dialog (destructive actions) -------------------------------- */
.confirm {
  width: min(440px, 100%);
}
.confirm__body {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-5) var(--space-5);
}
.confirm__icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--tint-danger);
  color: var(--danger);
}
.confirm__icon svg { width: 20px; height: 20px; }
.confirm__message {
  margin: var(--space-2) 0 0;
  color: var(--muted);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

/* --- Toast --------------------------------------------------------------- */
.toast-region {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(380px, calc(100vw - var(--space-8)));
  pointer-events: none; /* let clicks pass through gaps; toasts re-enable */
}
/* On mobile, sit above the bottom-tabs and stretch full width. */
@media (max-width: 768px) {
  .toast-region {
    bottom: calc(var(--space-16) + var(--space-2));
    left: var(--space-3);
    right: var(--space-3);
    width: auto;
  }
}
.toast {
  --toast-accent: var(--info);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--toast-accent);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-table);
  line-height: 1.45;
  color: var(--text);
  animation: slide-up var(--dur-overlay) var(--ease-out);
  pointer-events: auto;
}
.toast--success { --toast-accent: var(--success); }
.toast--error { --toast-accent: var(--danger); }
.toast--warning { --toast-accent: var(--warning); }
.toast--info { --toast-accent: var(--info); }
.toast__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--toast-accent);
  margin-top: 1px;
}
.toast__icon svg { width: 18px; height: 18px; }
.toast__message {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}
.toast__close {
  margin-left: var(--space-2);
  margin-right: calc(var(--space-1) * -1);
  flex-shrink: 0;
  background: none;
  border: none;
  border-radius: var(--r-xs);
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  display: inline-flex;
}
.toast__close:hover { color: var(--text); background: var(--surface-2); }
.toast__close svg { width: 15px; height: 15px; }

/* --- Pagination ---------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;            /* never overflow the page width */
  max-width: 100%;
  gap: var(--space-1);
  font-size: var(--fs-table);
}
.pagination__item--gap {
  border: 0;
  background: none;
  cursor: default;
  pointer-events: none;
  color: var(--muted);
}
.pagination__item {
  min-width: 34px;
  height: 34px;
  padding: 0 var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.pagination__item:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}
.pagination__item[aria-current="page"] {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.pagination__item--disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* --- Empty state --------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.empty-state__icon-wrap {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-2);
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--dim);
}
.empty-state__icon {
  width: 26px;
  height: 26px;
}
.empty-state__title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin: 0;
}
.empty-state__text {
  font-size: var(--fs-body);
  max-width: 42ch;
  margin: 0;
}
.empty-state .btn {
  margin-top: var(--space-2);
}

/* --- Skeleton (loading = skeletons, not spinners) ------------------------ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--border-soft) 37%,
    var(--surface-2) 63%
  );
  background-size: 400% 100%;
  border-radius: var(--r-sm);
  animation: shimmer 1.4s ease infinite;
}
.skeleton--text {
  height: 12px;
  margin: var(--space-2) 0;
}
.skeleton--row {
  height: var(--row-h);
}

/* --- Keyframes ----------------------------------------------------------- */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes slide-up {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes pop-in {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .scrim,
  .slide-over,
  .modal__dialog,
  .toast,
  .skeleton {
    animation: none;
  }
}

/* Status-chip row (plot management counts) */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-3) 0; }
.chip-row .status-chip { display: inline-flex; align-items: center; gap: var(--space-1); }
.chip-row .status-chip strong { font-weight: 600; }

/* User menu (sidebar footer dropdown) — added in audit fix (H4). */
.user-menu { position: relative; }
.user-menu__trigger { list-style: none; cursor: pointer; display: inline-flex; }
.user-menu__trigger::-webkit-details-marker { display: none; }
.user-menu__panel {
  position: absolute; bottom: calc(100% + var(--space-2)); left: 0; min-width: 200px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); padding: var(--space-1); z-index: var(--z-tooltip);
}
.user-menu__name {
  padding: var(--space-2) var(--space-3); font-size: var(--fs-sm); color: var(--muted);
  border-bottom: 1px solid var(--border-soft); margin-bottom: var(--space-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.user-menu__item {
  display: block; width: 100%; text-align: left; box-sizing: border-box;
  padding: var(--space-2) var(--space-3); min-height: 40px; border: 0; background: transparent;
  color: inherit; font: inherit; line-height: 1.4; display: flex; align-items: center;
  border-radius: var(--r-sm); cursor: pointer; text-decoration: none;
}
.user-menu__item:hover { background: var(--surface-2); text-decoration: none; }
.user-menu__item--danger { color: var(--danger); }
.user-menu__item--danger:hover { background: var(--tint-danger); }
.user-menu__form { margin: 0; }

/* Analytics stat cards — markup existed, styles were missing (audit UI fix). */
.analytics__section-title {
  font-size: var(--fs-label); text-transform: uppercase; letter-spacing: var(--track-label);
  font-weight: var(--fw-semibold); color: var(--muted); margin: var(--space-5) 0 var(--space-3);
}
.analytics__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.analytics__empty { padding: var(--space-8); text-align: center; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--r-md); padding: var(--card-pad);
  box-shadow: var(--shadow-xs);
}
.stat-card__value {
  font-size: 26px; font-weight: var(--fw-bold); line-height: 1.1;
  color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.stat-card__label {
  margin-top: var(--space-1); font-size: var(--fs-sm); color: var(--muted);
}
.stat-card--available { border-left-color: var(--st-available); }
.stat-card--reserved  { border-left-color: var(--st-reserved); }
.stat-card--sold      { border-left-color: var(--st-sold); }
.stat-card--revenue   { border-left-color: var(--primary); }

/* Billing / subscription — markup existed, styles were missing (UI audit). */
.billing { display: flex; flex-direction: column; gap: var(--space-5); }
.billing__head h2 { margin: 0; }
.billing__summary { padding: var(--card-pad); }
.billing__facts {
  display: grid; grid-template-columns: max-content 1fr; gap: var(--space-3) var(--space-6);
  margin: 0; align-items: center;
}
.billing__facts dt { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.billing__facts dd { margin: 0; font-weight: var(--fw-semibold); color: var(--text); }
.billing__assign {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-4) var(--card-pad);
}
.billing__assign label { color: var(--muted); font-size: var(--fs-sm); }
.billing__empty { margin: 0; color: var(--muted); }

/* --- Feedback badges -------------------------------------------------------
   Tint background (--tint-*) + strong foreground (--*-strong) for AA contrast.
   Sacred plot-status colors stay on .status-chip; these are coarse
   sale / billing / lifecycle states (sold-register, dashboard, invoices). */
.badge--active, .badge--booked, .badge--published, .badge--paid, .badge--registered, .badge--success {
  background: var(--tint-success); color: var(--success-strong); border-color: transparent;
}
.badge--trial, .badge--new, .badge--draft, .badge--pending, .badge--info {
  background: var(--tint-info); color: var(--info); border-color: transparent;
}
.badge--past_due, .badge--contacted, .badge--reserved, .badge--hold, .badge--overdue, .badge--warning {
  background: var(--tint-warning); color: var(--warning-strong); border-color: transparent;
}
.badge--suspended, .badge--cancelled, .badge--lost, .badge--void, .badge--unpaid, .badge--archived, .badge--danger {
  background: var(--tint-danger); color: var(--danger-strong); border-color: transparent;
}

/* Onboarding/prompt banner — reusable (empty-layout upload prompt, layer-mapping
   prompt, etc). Tokens only. */
.onboard-banner { display: flex; align-items: center; gap: var(--space-3, 12px);
  padding: var(--space-3, 14px) var(--space-4, 18px); margin-bottom: var(--space-4, 18px);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: var(--r-md, 12px); }
.onboard-banner__icon { color: var(--primary); flex: none; }
.onboard-banner__text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.onboard-banner__text strong { font-size: .95rem; }
.onboard-banner__text span { color: var(--muted); font-size: .85rem; }

/* Django-messages toasts stack ABOVE the HTMX OOB #toast-region instead of
   overlapping it in the same fixed bottom-right slot. */
.toast-region--messages { bottom: 84px; }

/* topbar quick-search (sales-desk spec D) */
.qsearch { position: relative; width: min(320px, 34vw); margin-right: 10px; }
.qsearch input { width: 100%; background: var(--surface-2, #eef1f5); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13px; outline: none; }
.qsearch input:focus { border-color: var(--primary, #6366f1); }
.qsearch__list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-card, 0 10px 30px rgba(0,0,0,.15)); overflow: hidden; }
.qsearch__item { display: block; padding: 9px 14px; font-size: 13px; color: var(--text, inherit);
  text-decoration: none; border-top: 1px solid var(--border); }
.qsearch__item:first-child { border-top: 0; }
.qsearch__item:hover { background: var(--surface-2, #eef1f5); }
.qsearch__item--sale::before { content: "₹ "; color: var(--muted); }
.qsearch__item--plot::before { content: "▦ "; color: var(--muted); }
@media (max-width: 720px) { .qsearch { display: none; } }


/* trial pill in the topbar (replaces the full-width trial banner) */
.sub-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; margin-right: 10px;
  border-radius: 999px; font-size: 12.5px; white-space: nowrap; text-decoration: none;
  background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.sub-pill:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); text-decoration: none; }
.sub-pill i { width: 14px; height: 14px; }
.sub-pill--warn { background: var(--tint-warning); color: var(--warning-strong); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
@media (max-width: 900px) { .sub-pill strong { display: none; } }


/* --- Tooltip (8.1) --------------------------------------------------------
   One theming component: any element with a ``data-tip="…"`` attribute shows a
   themed bubble on hover / keyboard focus, and (via the base-template helper) on
   touch long-press. A ``data-tip-pos`` attribute (top|bottom|left|right, set by
   JS near a viewport edge) picks which side the bubble flips to. Replaces the wall
   of always-visible .field__help paragraphs + raw title= attributes. */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 260px; white-space: normal; text-align: left;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.18));
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-xs); font-weight: var(--fw-normal, 400); line-height: 1.42;
  text-transform: none; letter-spacing: normal;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-micro) var(--ease), transform var(--dur-micro) var(--ease);
  z-index: var(--z-tooltip);
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after,
[data-tip].is-tip-open::after { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-tip][data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translateX(-50%) translateY(-4px); }
[data-tip][data-tip-pos="bottom"]:hover::after,
[data-tip][data-tip-pos="bottom"]:focus-visible::after,
[data-tip][data-tip-pos="bottom"].is-tip-open::after { transform: translateX(-50%) translateY(0); }
[data-tip][data-tip-pos="right"]::after { left: calc(100% + 8px); right: auto; bottom: auto; top: 50%; transform: translateY(-50%) translateX(-4px); }
[data-tip][data-tip-pos="right"]:hover::after,
[data-tip][data-tip-pos="right"]:focus-visible::after,
[data-tip][data-tip-pos="right"].is-tip-open::after { transform: translateY(-50%) translateX(0); }
[data-tip][data-tip-pos="left"]::after { right: calc(100% + 8px); left: auto; bottom: auto; top: 50%; transform: translateY(-50%) translateX(4px); }
[data-tip][data-tip-pos="left"]:hover::after,
[data-tip][data-tip-pos="left"]:focus-visible::after,
[data-tip][data-tip-pos="left"].is-tip-open::after { transform: translateY(-50%) translateX(0); }

/* the ⓘ affordance rendered by components/field.html when help_text_tip is set */
.field__tip {
  display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 10px; font-weight: var(--fw-bold, 700); font-style: italic; line-height: 1;
  color: var(--muted); background: var(--surface-2); cursor: help; vertical-align: middle;
  text-transform: none; letter-spacing: normal;
}
.field__tip:hover, .field__tip:focus-visible { color: var(--primary); border-color: var(--primary); outline: none; }

/* --- Sector chip (6.6) ----------------------------------------------------
   Colored zone tag: on the plot record (next to status, links to the filtered
   list), and as the group-header label when the list is grouped by sector. The
   host sets ``--sector-color`` inline (falls back to the theme primary). */
.sector-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 11px 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: var(--fw-semibold, 600); text-decoration: none;
  color: var(--text);
  background: color-mix(in srgb, var(--sector-color, var(--primary)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--sector-color, var(--primary)) 34%, transparent);
}
a.sector-chip:hover { background: color-mix(in srgb, var(--sector-color, var(--primary)) 20%, transparent); text-decoration: none; }
.sector-chip__dot { width: 9px; height: 9px; border-radius: 999px; flex: none;
  background: var(--sector-color, var(--primary)); }

/* Sector management card list (loaded into layout settings) */
.sector-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sector-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sector-item__edit { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; margin: 0; }
.sector-item__name { flex: 1; min-width: 90px; }
.sector-item__count { font-size: 11px; white-space: nowrap; }
.sector-item__ops { display: flex; align-items: center; gap: 2px; }
.sector-item__ops .is-disabled { opacity: .45; cursor: not-allowed; }
.sector-item__del:hover { color: var(--danger); border-color: var(--danger); }
.sector-add { display: flex; align-items: center; gap: 8px; margin: 0; }
.sector-add .field__control { flex: 1; min-width: 0; }
.sector-color__input { width: 34px; min-width: 34px; height: 34px; padding: 2px; flex: none;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; }

/* Group-by-sector header row inside the plot table */
.table__grouphdr td { background: var(--surface-2); border-top: 1px solid var(--border);
  padding: 7px var(--space-3); }
.table__grouphdr-count { margin-left: 8px; font-size: 11px; font-variant-numeric: tabular-nums; }
/* Active state for the toolbar group-by-sector toggle (scoped to .toolbar so it
   never lights up the topbar's aria-pressed mode button). */
.toolbar .btn.is-on { outline: 2px solid var(--primary); outline-offset: -1px;
  color: var(--primary); }
@media (max-width: 720px) { .sub-pill { display: none; } }
