/* ============================================================
   CRM Webforms — Dark Theme Stylesheet
   Single source of truth for all visual styling.
   All values reference CSS custom properties defined in :root.
   ============================================================ */

/* --- Design Tokens --- */
:root {
  /* surfaces — darker, shifted towards black */
  --bg-page:        #0c0d10;
  --bg-surface:     #131519;
  --bg-surface-2:   #1a1d22;
  --bg-input:       #1e2128;
  --bg-hover:       #252930;

  /* borders */
  --border-subtle:  #1f2229;
  --border-default: #2e333c;
  --border-strong:  #444b57;
  --border-focus:   #5c8fcf;

  /* text */
  --text-primary:   #e8e9eb;
  --text-secondary: #a4a8b0;
  --text-muted:     #6f747e;
  --text-disabled:  #4a4e57;

  /* accents */
  --accent:         #5c8fcf;
  --accent-hover:   #6ea0dc;
  --accent-bg:      #1a2d48;
  --accent-text:    #b8d0f0;
  --accent-glow:    rgba(92, 143, 207, 0.15);

  /* secondary accent */
  --accent2:        #8b6fcf;
  --accent2-bg:     #2a1f48;
  --accent2-text:   #c8b8f0;

  /* semantic */
  --danger:         #c95757;
  --danger-bg:      #3a1f1f;
  --success:        #6ab04c;
  --success-bg:     #1f2f1a;
  --warning:        #d9a44a;
  --warning-bg:     #3a2e15;
  --danger-dark:       #8b2020;
  --danger-dark-hover: #a02828;

  /* spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* typography — larger base */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 19px;
  --fs-xl: 24px;
  --fs-2xl: 28px;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;

  /* shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* transitions */
  --t-fast: 100ms ease;
  --t-base: 150ms ease;
}


/* --- Reset / Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* --- Utility Classes --- */
.hidden {
  display: none !important;
}

.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;
}

.text-xs {
  font-size: var(--fs-xs);
}


/* --- Layout --- */
.page-container {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: var(--space-5) var(--space-7);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-default);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Centered content container for forms/drafts */
.content-container {
  max-width: 60%;
  margin-left: auto;
  margin-right: auto;
}


/* --- Typography --- */
h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

h2 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  margin-top: var(--space-6);
  margin-bottom: var(--space-4);
}

h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}


/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background-color var(--t-base), border-color var(--t-base), color var(--t-base), box-shadow var(--t-base);
  text-decoration: none;
  line-height: 1.5;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--bg-page);
  border-color: var(--accent);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-primary);
  border-color: var(--danger);
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-ghost:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--fs-xs);
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn--loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-action {
  font-size: var(--fs-base);
  padding: var(--space-1) var(--space-3);
}

.btn-danger-dark {
  background-color: var(--danger-dark);
  color: var(--text-primary);
  border-color: var(--danger-dark);
}

.btn-danger-dark:hover {
  background-color: var(--danger-dark-hover);
  border-color: var(--danger-dark-hover);
}


/* --- Form Inputs --- */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.form-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-bg), var(--shadow-glow);
}

.form-input:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
}

.form-error {
  color: var(--danger);
  font-size: var(--fs-xs);
  margin-top: var(--space-1);
}

.form-input--error {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger-bg);
}

.form-input--error:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-bg);
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.form-label-row .form-error {
  margin-top: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: stretch;
}

.form-row .form-group {
  display: flex;
  flex-direction: column;
}

/* Wrapper for input with reset button */
.input-with-reset {
  position: relative;
}

.input-with-reset .form-input {
  padding-right: 36px;
}

/* Reset button (circular, inside input wrapper) */
.btn-reset {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--accent);
  font-size: var(--fs-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--t-base), border-color var(--t-base);
  padding: 0;
}

.btn-reset:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}


/* --- Input Group (prefix/suffix) --- */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-prefix {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  background-color: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
}

.input-group .form-input {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  flex: 1;
  min-width: 0;
}

/* --- Toggle Switch --- */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: var(--border-strong);
  border-radius: 11px;
  cursor: pointer;
  transition: background-color var(--t-base);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 18px;
  height: 18px;
  background-color: var(--text-primary);
  border-radius: 50%;
  transition: transform var(--t-base);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}


/* --- Cards --- */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.admin-tab-content .card + .card {
  margin-top: var(--space-5);
}


/* --- Tables --- */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border-default);
}

.table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-base);
}

.table tr:hover {
  background-color: var(--bg-hover);
}


/* --- Collapsible Sections --- */
.collapsible-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: var(--space-3);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height var(--t-base);
}

.collapsible-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
  padding: 0;
}

.collapsible-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.collapsible-icon--open {
  transform: rotate(90deg);
}

.collapsible-header .form-section-title {
  margin-bottom: 0;
  margin-top: 0;
}


/* --- Section Summary (per-section totals) --- */
.section-summary {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-5);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
  background: var(--bg-surface-2);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.section-summary strong {
  color: var(--accent);
}


/* --- Dropdown (Searchable Product Select) --- */
.dropdown-wrapper {
  position: relative;
}

.dropdown-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  padding-right: var(--space-6);
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  transition: border-color var(--t-base);
}

.dropdown-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.dropdown-clear {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: none;
  font-size: var(--fs-base);
  line-height: 1;
  padding: var(--space-1);
}

.dropdown-clear:hover {
  color: var(--text-primary);
}

.dropdown-panel {
  position: fixed;
  background-color: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: var(--shadow-md);
}

.dropdown-item {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: background-color var(--t-fast);
}

.dropdown-item:hover,
.dropdown-item--active {
  background-color: var(--bg-hover);
}

.dropdown-item--add {
  color: var(--accent-text);
  font-style: italic;
}

.dropdown-item--disabled {
  pointer-events: none;
  color: var(--text-muted);
}

.dropdown-wrapper--disabled .dropdown-input { opacity: 0.5; cursor: not-allowed; }


/* --- Toast Notifications --- */
.toast {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  background-color: var(--bg-surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  z-index: 1000;
  transform: translateX(120%);
  transition: transform var(--t-base);
  font-size: var(--fs-sm);
  max-width: 360px;
  border-left: 3px solid var(--border-default);
  box-shadow: var(--shadow-lg);
}

.toast--visible {
  transform: translateX(0);
}

.toast--success {
  border-left-color: var(--success);
}

.toast--error {
  border-left-color: var(--danger);
}


/* --- Login Page --- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-5);
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-1);
}

.login-subtitle {
  margin-bottom: var(--space-5);
  font-size: var(--fs-sm);
}


/* --- Home Page — Drafts Table --- */
.drafts-table {
  width: 100%;
  border-collapse: collapse;
}

.draft-row {
  transition: background-color var(--t-fast);
}

.draft-row:hover {
  background-color: var(--bg-hover);
}

.draft-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}


/* --- Form Page --- */
.form-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-size: calc(var(--fs-lg) + 4px);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-4);
  margin-top: 0;
}

.line-item-row td {
  vertical-align: middle;
}

.line-items-table th:nth-child(1) { width: 35%; }
.line-items-table th:nth-child(2) { width: 12%; }
.line-items-table th:nth-child(3) { width: 18%; }
.line-items-table th:nth-child(4) { width: 15%; }
.line-items-table th:nth-child(5) { width: 15%; }
.line-items-table th:nth-child(6) { width: 5%; }

.line-items-table .form-input {
  width: 100%;
  box-sizing: border-box;
}

.line-items-table .input-group {
  width: 100%;
}

.line-item-row--pending td:not(:first-child) { opacity: 0.5; }
.line-item-row--pending td:not(:first-child) .form-input { cursor: not-allowed; }

.line-item-row--pinned td:first-child .form-input {
  color: var(--text-primary);
  font-weight: 500;
}

.line-items-table td .dropdown-wrapper {
  min-width: 0;
  position: relative;
}

.line-items-table td .dropdown-panel {
  min-width: 250px;
  max-width: 400px;
}

/* Monthly costs table */
.monthly-costs-table th:nth-child(1) { width: 30%; }
.monthly-costs-table th:nth-child(2) { width: 10%; text-align: center; }
.monthly-costs-table th:nth-child(3) { width: 25%; }
.monthly-costs-table th:nth-child(4) { width: 17%; }
.monthly-costs-table th:nth-child(5) { width: 18%; }
.monthly-toggle-cell { text-align: center; }
.monthly-service-name { font-weight: 500; }

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.grid-3-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.grid-4-col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.form-group--full { grid-column: 1 / -1; }

.client-type-group {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-default);
}

.checkbox-card .checkbox-group {
  font-size: calc(var(--fs-base) + 4px);
}


/* --- Prevention / Monitoring Costs --- */
.prevention-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
  background: var(--bg-surface-2);
  border-radius: var(--radius-md);
}

.prevention-total-value {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--accent);
}

/* --- Read-only Form Values --- */
.form-value {
  display: block;
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-base);
}


/* --- Admin Page --- */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border-default);
  margin-bottom: var(--space-5);
  gap: var(--space-1);
}

.admin-tab {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color var(--t-base), border-color var(--t-base);
  margin-bottom: -2px;
}

.admin-tab:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.admin-tab--active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

.admin-tab-content {
  padding-top: var(--space-4);
}

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.tab-header h2 {
  margin: 0;
  font-size: var(--fs-xl);
}

.tab-header .btn {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  padding: var(--space-2) var(--space-5);
}

/* Pagination */
.pagination {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  justify-content: center;
}

.pagination--active {
  background-color: var(--accent-bg);
  color: var(--accent-text);
  border-color: var(--accent);
}


/* --- Error / Success States --- */
.field-error {
  color: var(--danger);
  font-size: var(--fs-xs);
  margin-top: var(--space-1);
}

.error-summary {
  background-color: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  color: var(--danger);
  font-size: var(--fs-sm);
}

.success-message {
  background-color: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--success);
  font-size: var(--fs-sm);
}


/* --- Loading / Spinner --- */
.spinner {
  display: inline-block;
  width: var(--space-4);
  height: var(--space-4);
  border: 2px solid var(--border-default);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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


/* --- Badge --- */
.badge {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
}

.badge--admin {
  background-color: var(--accent-bg);
  color: var(--accent-text);
  border: 1px solid var(--accent);
}

.badge--operator {
  background-color: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.badge--once-off {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.badge--monthly {
  background-color: var(--accent-bg);
  color: var(--accent-text);
  border: 1px solid var(--accent);
}

.badge--yearly {
  background-color: var(--accent2-bg);
  color: var(--accent2-text);
  border: 1px solid var(--accent2);
}

.badge--pinned { background-color: var(--warning); color: var(--bg-page); }


/* --- Modal / Overlay --- */
.overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 480px;
  width: 100%;
  margin: var(--space-5);
  box-shadow: var(--shadow-lg);
}

.modal--wide {
  max-width: 640px;
}

.modal h3 {
  margin-bottom: var(--space-5);
  font-size: var(--fs-xl);
}

.pw-modal-subtitle {
  margin-bottom: var(--space-4);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}


/* --- Confirm Modal --- */
.confirm-warning {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.confirm-warning-icon {
  font-size: 2rem;
  color: var(--warning);
}

/* --- Form Page — Centered Container --- */
.form-page .page-container {
  max-width: 60%;
  min-width: 700px;
}

/* --- Home Page — Centered Container --- */
.home-page .page-container {
  max-width: 70%;
  min-width: 700px;
}


/* --- Area / Suburb Management --- */
.area-suburb-container { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: var(--space-4); }
.area-suburb-col { min-width: 0; }
tr.area-selected { background-color: var(--bg-hover); }
.area-suburb-top { margin-top: var(--space-6); }
.text-center { text-align: center; }

/* --- Drag-and-Drop --- */
.drag-handle { cursor: grab; width: 2rem; text-align: center; user-select: none; color: var(--text-secondary); }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: 0.4; }
tr.drag-over { border-top: 2px solid var(--accent); }

/* --------------------------------------------------------
   Multi-select dropdown chips
   -------------------------------------------------------- */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--accent-bg);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-primary);
}

.chip__text {
  white-space: nowrap;
}

.chip__remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: 0 2px;
  border: none;
  background: none;
  line-height: 1;
}

.chip__remove:hover {
  color: var(--danger);
}

.dropdown-item--selected {
  display: flex;
  align-items: center;
  background: var(--accent-bg);
}

.dropdown-item--selected::after {
  content: "\2713";
  margin-left: auto;
  color: var(--accent);
}

/* --------------------------------------------------------
   Coordinates input
   -------------------------------------------------------- */
.coordinates-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* --- Office Form --- */
.office-client-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.office-info-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.office-info-row:last-child {
  border-bottom: none;
}

.office-info-label {
  flex: 0 0 100px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}

.office-info-value {
  font-size: var(--fs-base);
  color: var(--text-primary);
}

.office-status-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.office-status-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.office-status-label {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
  min-width: 100px;
}

.office-status-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.office-status-badge--done {
  background-color: var(--success-bg);
  color: var(--success);
}

.office-status-badge--pending {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* --- Home Page — Sub-section Headers & Lead Button --- */
.home-page section > h3 {
  margin-top: var(--space-4);
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
}

.lead-btn-section {
  margin-top: var(--space-6);
}

.lead-btn-full {
  width: 100%;
}
