:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-alt: #f4f4f6;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-muted: #71717a;
  --text-faint: #a1a1aa;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --danger: #dc2626;
  --header-bg: #18181b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.09), 0 1px 2px rgba(0,0,0,0.04);
}

/* Guarantees the hidden attribute always wins, no matter what display value
   a more specific selector sets elsewhere in this file. */
[hidden] {
  display: none !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

header {
  background: var(--header-bg);
  color: white;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

#user-info button {
  padding: 7px 14px;
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#user-info button:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
}

#user-info a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s ease;
}

#user-info a:hover {
  color: white;
}

#create-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--surface);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.delete-user-button {
  color: var(--danger);
}

/* Lead comment thread — append-only history. */
.comments-section {
  margin-top: 18px;
}
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.comment-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.comment-item.comment-edit_request {
  background: #fff7ed;
  border-color: #fed7aa;
}
.comment-item.comment-edit_done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.comment-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.comment-body {
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-compose {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.comment-compose textarea,
.edit-request-panel textarea {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
}
.comment-compose button,
.edit-request-panel button,
.edit-request-notice button {
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

/* Opener edit requests (the team lead makes the change). */
.edit-request-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.edit-request-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.edit-request-panel button {
  align-self: flex-start;
}

/* Monday-style status picker right in the pipeline table (admins). */
select.stage-inline {
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}

/* Agents nobody is responsible for, flagged on Manage Team. */
.unassigned-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 0 0 12px;
}
tr.needs-leader td {
  background: #fffbeb;
}
.leader-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

#create-form input,
#create-form select {
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
}

#create-form button {
  padding: 9px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
}

#create-form button:hover {
  background: var(--primary-hover);
}

#create-form[hidden] {
  display: none;
}

.card-owner {
  font-style: normal;
  color: var(--text-muted);
}

.transfer-select {
  margin-top: 6px;
  width: 100%;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-family: inherit;
  background: var(--surface);
}

.auth-layout {
  display: flex;
  min-height: 100vh;
}

.auth-brand {
  position: relative;
  flex: 0 0 44%;
  min-width: 380px;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 60px;
  background: linear-gradient(160deg, #18181b 0%, #201c3f 55%, #312e81 100%);
  color: #fff;
}

.auth-brand-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  top: -160px;
  right: -180px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.45), transparent 70%);
  filter: blur(4px);
}

.auth-brand-glow-2 {
  width: 380px;
  height: 380px;
  top: auto;
  right: auto;
  bottom: -140px;
  left: -120px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.35), transparent 70%);
}

.auth-brand-content {
  position: relative;
  z-index: 1;
}

.auth-brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
}

.auth-brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.18);
}

.auth-brand-tag {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.72);
  max-width: 320px;
  margin: 0;
}

.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
}

.auth-box {
  background: var(--surface);
  padding: 40px 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  width: 340px;
}

.auth-box h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.auth-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.auth-box form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.auth-box input {
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.auth-box button[type="submit"] {
  margin-top: 4px;
  padding: 12px;
  background: linear-gradient(90deg, #4f46e5, #6d28d9);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.auth-box button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
}

.auth-error {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--danger);
  background: #fef2f2;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin: 2px 0 0;
}

@media (max-width: 760px) {
  .auth-brand {
    display: none;
  }
  .auth-layout {
    display: block;
  }
  .auth-page {
    min-height: 100vh;
  }
}

.pipeline-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: -6px;
}

.link-button {
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.link-button:hover {
  text-decoration: underline;
}

main {
  padding: 28px;
  max-width: 1400px;
  margin: 0 auto;
}

h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

th, td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th {
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

#contact-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--surface);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

#contact-form[hidden] {
  display: none;
}

#contact-form input,
#contact-form select {
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
}

#contact-form button {
  padding: 9px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
}

#contact-form button:hover {
  background: var(--primary-hover);
}

.board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.column {
  flex: 1;
  min-width: 230px;
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.column h3 {
  margin: 4px 8px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.card-list {
  min-height: 60px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card .card-name {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.card .card-detail {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.card.sortable-ghost {
  opacity: 0.4;
}

#open-add-modal {
  margin-bottom: 12px;
  padding: 10px 18px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: white;
  transition: background 0.15s ease;
}

#open-add-modal:hover {
  background: var(--primary-hover);
}

.quick-add-button {
  margin-top: 4px;
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.quick-add-button:hover {
  background: var(--surface);
  border-style: solid;
  border-color: var(--primary);
  color: var(--primary);
}

.board-tabs,
.date-tabs,
.view-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.board-tabs .tab,
.date-tabs .tab,
.view-toggle .tab {
  padding: 7px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.board-tabs .tab:hover,
.date-tabs .tab:hover,
.view-toggle .tab:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.board-tabs .tab.active,
.date-tabs .tab.active,
.view-toggle .tab.active {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

.date-tabs .tab.active {
  background: var(--primary);
  border-color: var(--primary);
}

.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
}

.filter-bar input {
  flex: 1;
  min-width: 200px;
}

.filter-bar button {
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  transition: background 0.15s ease;
}

.filter-bar button:hover {
  background: var(--surface-alt);
}

.pipeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pipeline-toolbar .board-tabs {
  margin-bottom: 0;
}

.dash-toolbar-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.dash-toolbar-right select {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
}

.dash-toolbar-right button {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}

.dash-toolbar-right button:hover {
  background: var(--surface-alt);
}

.export-menu {
  position: relative;
}

.export-menu > button {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}

.export-menu > button:hover {
  background: var(--surface-alt);
}

.export-menu-items {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 120px;
  padding: 4px;
  z-index: 20;
}

.export-menu-items a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.export-menu-items a:hover {
  background: var(--surface-alt);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,24,27,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 640px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px 28px;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 18px;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.delete-lead-button {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.delete-lead-button:hover {
  background: #fef2f2;
  border-color: var(--danger);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-faint);
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-grid label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  gap: 5px;
}

.detail-grid .detail-full {
  grid-column: 1 / -1;
}

.detail-grid input,
.detail-grid select,
.detail-grid textarea {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}

.detail-grid input:focus,
.detail-grid select:focus,
.detail-grid textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.modal-actions {
  margin-top: 18px;
  text-align: right;
}

.modal-actions button {
  padding: 10px 22px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.modal-actions button:hover {
  background: var(--primary-hover);
}

.attachments-section {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.attachments-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.attachment-upload-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.upload-button {
  padding: 7px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease;
}

.upload-button:hover {
  background: var(--border);
}

.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.attachment-item a {
  color: var(--primary);
  text-decoration: none;
}

.attachment-item a:hover {
  text-decoration: underline;
}

.attachment-meta {
  color: var(--text-faint);
  font-size: 11px;
}

.attachment-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
}

.activity-section {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

#activity-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.activity-list {
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.activity-item {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.activity-item .activity-meta {
  color: var(--text-faint);
  font-size: 11px;
  margin-top: 2px;
}

.activity-empty {
  color: var(--text-faint);
  font-size: 13px;
  padding: 8px 0;
}

/* Label colors, matching the QC Call / Appt Status swatches */
.label-No-Show, .label-Credit-Fail { background: #f5a742; color: #222; }
.label-Unconfirm { background: #e6398a; color: white; }
.label-Sit, .label-Done, .label-SOLD { background: #2ecc71; color: white; }
.label-DQ, .label-Cancel, .label-Canceled { background: #e05c5c; color: white; }
.label-No-Sit { background: #f28b82; color: #222; }
.label-Need-to-Rescheduled, .label-NO-OP { background: #8a8f98; color: white; }
.label-Rescheduled, .label-NA-1st { background: #f4d03f; color: #222; }
.label-Pending { background: #a78bfa; color: white; }
.label-Vonage-Fail { background: #9b59b6; color: white; }
.label-Need-to-RS { background: #48c9b0; color: #222; }
.label-NA-2nd { background: #f78fb3; color: #222; }
.label-NA-3rd { background: #5dade2; color: white; }
.label-NA-Left-Text { background: #45b39d; color: #222; }
.label-Straight-VM { background: #d4ac0d; color: #222; }
.label-Cx-HU { background: #935116; color: white; }
.label-Spanish { background: #aab7b8; color: #222; }

/* Workflow stage labels */
.label-New { background: #94a3b8; color: white; }
.label-Pending-QC { background: #f59e0b; color: #1f2937; }
.label-Sent-Back { background: #ef4444; color: white; }
.label-QC-Approved { background: #0ea5e9; color: white; }
.label-Assigned { background: #8b5cf6; color: white; }
.label-Sold { background: #16a34a; color: white; }
.label-Rehash { background: #f97316; color: white; }

/* Pipeline-stage labels (Status column) not already covered above */
.label-Submitted { background: #4a90d9; color: white; }
.label-Unconfirmed { background: #8c7ae6; color: white; }
.label-Ran { background: #c9a876; color: #222; }
.label-Rep-Follow-up { background: #2dd4bf; color: #222; }

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Table View --- */
.table-view-wrapper {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.lead-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.lead-table th,
.lead-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}

.lead-table th:last-child,
.lead-table td:last-child {
  border-right: none;
}

.lead-table th {
  background: var(--surface-alt);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 2;
}

.lead-table td:first-child,
.lead-table th:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  font-weight: 600;
}

.lead-table th:first-child {
  z-index: 3;
  background: var(--surface-alt);
}

.lead-table tbody tr {
  cursor: pointer;
  transition: background 0.1s ease;
}

.lead-table tbody tr:hover {
  background: var(--surface-alt);
}

.lead-table tbody tr:hover td:first-child {
  background: var(--surface-alt);
}

.lead-table .cell-notes {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-table .attachment-count {
  color: var(--text-muted);
  font-size: 12px;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.closer-section {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.closer-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.closer-section select {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
}

#feedback-submit-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

#feedback-submit-row[hidden],
#closer-assign-row[hidden],
#closer-readonly[hidden],
#feedback-view-row[hidden] {
  display: none;
}

#feedback-submit-row textarea {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
}

#feedback-submit-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

#feedback-submit-row button,
#feedback-review-button {
  align-self: flex-start;
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
}

#feedback-submit-row button:hover,
#feedback-review-button:hover {
  background: var(--primary-hover);
}

#feedback-view-row {
  margin-top: 8px;
}

#feedback-text {
  margin: 8px 0;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
}

.feedback-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.feedback-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.feedback-badge.reviewed {
  background: #d1fae5;
  color: #065f46;
}

.card-feedback-flag {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: #b45309;
  font-weight: 600;
}

/* --- Force password change overlay --- */
#force-password-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,24,27,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.force-password-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 380px;
  max-width: 92vw;
  padding: 28px;
}

.force-password-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.force-password-card p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.force-password-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.force-password-card input {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
}

.force-password-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.force-password-hint {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
}

.force-password-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
}

.force-password-card button[type="submit"] {
  padding: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.force-password-card button[type="submit"]:hover {
  background: var(--primary-hover);
}

/* --- Duplicate-lead warning --- */
.duplicate-warning {
  margin-bottom: 10px;
  padding: 12px 14px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: #92400e;
}

.duplicate-warning p {
  margin: 0 0 6px;
}

.duplicate-warning ul {
  margin: 0 0 10px;
  padding-left: 18px;
}

.duplicate-warning-actions {
  display: flex;
  gap: 8px;
}

.duplicate-warning-actions button {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.duplicate-warning-actions button.duplicate-proceed {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

/* --- Secondary nav links (Calendar / Leaderboard / Archive) shared across pages --- */
.secondary-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.secondary-nav a {
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.secondary-nav a:hover,
.secondary-nav a.active {
  border-color: var(--primary);
  color: var(--primary);
}

/* --- Export buttons --- */
.export-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.export-bar button,
.export-bar a {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.export-bar button:hover,
.export-bar a:hover {
  background: var(--surface-alt);
}

/* --- Pagination --- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.pagination-bar .pagination-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pagination-bar button {
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}

.pagination-bar button:hover:not(:disabled) {
  background: var(--surface-alt);
}

.pagination-bar button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* --- Archive page --- */
.archive-days-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
}

.archive-days-badge.urgent {
  background: #fee2e2;
  color: #991b1b;
}

.restore-button {
  padding: 6px 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
}

.restore-button:hover {
  background: var(--primary-hover);
}

/* --- Calendar view --- */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-header h2 {
  font-size: 18px;
  min-width: 160px;
  text-align: center;
}

.calendar-header button {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day-label {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding-bottom: 6px;
}

.calendar-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 92px;
  padding: 6px;
  font-size: 11px;
}

.calendar-cell.calendar-cell-empty {
  background: var(--surface-alt);
  border-style: dashed;
}

.calendar-cell.calendar-cell-today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.calendar-cell-date {
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.calendar-appt {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--primary-soft);
  color: var(--primary);
  border: none;
  border-radius: 4px;
  padding: 3px 6px;
  margin-bottom: 3px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-appt:hover {
  background: #dde3fc;
}

.calendar-popover {
  position: fixed;
  z-index: 150;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 16px;
  width: 260px;
  font-size: 13px;
}

.calendar-popover h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.calendar-popover p {
  margin: 0 0 6px;
  color: var(--text-muted);
}

.calendar-popover a,
.calendar-popover button {
  display: inline-block;
  margin-top: 8px;
  margin-right: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

/* --- Leaderboard --- */
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.leaderboard-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.leaderboard-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f4b400, #4f46e5, #48c9b0);
}

.leaderboard-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.leaderboard-card h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.leaderboard-card table {
  box-shadow: none;
  border: none;
  border-collapse: separate;
  border-spacing: 0 4px;
}

.leaderboard-card th {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-faint);
}

.leaderboard-card td {
  padding: 9px 8px;
  font-size: 13.5px;
}

.leaderboard-card tbody tr {
  transition: background 0.12s ease, transform 0.12s ease;
}

.leaderboard-card tbody tr:hover {
  background: var(--surface-alt);
}

.leaderboard-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
}

/* Top 3 get medal treatment automatically, since rows already render in rank order */
.leaderboard-card tbody tr:nth-child(1) .leaderboard-rank {
  background: linear-gradient(135deg, #ffd76a, #f4b400);
  color: #4d3800;
  box-shadow: 0 2px 6px rgba(244, 180, 0, 0.45);
}

.leaderboard-card tbody tr:nth-child(2) .leaderboard-rank {
  background: linear-gradient(135deg, #e3e8ef, #b7c0cc);
  color: #2f3742;
}

.leaderboard-card tbody tr:nth-child(3) .leaderboard-rank {
  background: linear-gradient(135deg, #e8b487, #c97b3d);
  color: #401f04;
}

.leaderboard-card tbody tr:nth-child(1) {
  background: linear-gradient(90deg, rgba(244, 180, 0, 0.10), transparent 70%);
}

.leaderboard-you {
  background: var(--primary-soft) !important;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}

/* --- Workflow panel (lead detail) --- */
.workflow-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.workflow-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workflow-stage-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.workflow-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.sent-back-notice {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #991b1b;
  line-height: 1.5;
}

.workflow-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.workflow-actions:not(:empty) {
  margin-top: 12px;
}

.workflow-primary {
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}

.workflow-primary:hover { background: var(--primary-hover); }

.workflow-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.workflow-hint-action {
  color: var(--primary);
  font-weight: 500;
}

.qc-review-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qc-review-panel textarea {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.qc-review-panel textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.qc-decision-buttons {
  display: flex;
  gap: 10px;
}

.qc-decision-buttons button {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
}

.qc-approve { background: #16a34a; color: white; }
.qc-approve:hover { background: #15803d; }
.qc-send-back { background: var(--surface); color: var(--danger); border: 1px solid var(--danger) !important; }
.qc-send-back:hover { background: #fef2f2; }

.supervisor-tools {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.supervisor-tools select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  min-width: 180px;
}

/* --- "Needs my attention" --- */
.attention-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.attention-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
}

.attention-toggle:hover { background: var(--surface-alt); }

.attention-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.attention-count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.attention-count.has-items {
  background: var(--danger);
  color: white;
}

.attention-toggle.active .attention-count {
  background: rgba(255,255,255,0.25);
  color: white;
}

.attention-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Role & access reference --- */
.roles-section {
  margin: 28px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.roles-table td:first-child,
.roles-table th:first-child {
  position: static;
  font-weight: 500;
}

.roles-table td { text-align: center; }
.roles-table td:first-child { text-align: left; }

.roles-yes { color: #15803d; font-weight: 700; }
.roles-no { color: var(--text-faint); }
.roles-partial { color: #b45309; font-size: 12px; }

.roles-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
}

.roles-link:hover { text-decoration: underline; }

.leaderboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.date-range-filter {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.date-range-filter label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  gap: 4px;
}

.date-range-filter input {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
}

.date-range-filter button {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.date-range-filter button:hover {
  background: var(--surface-alt);
}

#leaderboard-apply-range {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

#leaderboard-apply-range:hover {
  background: var(--primary-hover);
}

#export-leaderboard-csv {
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(90deg, #4f46e5, #6d28d9);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#export-leaderboard-csv:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.team-lead-row {
  border-bottom: 1px solid var(--border);
}

.team-lead-row:last-child {
  border-bottom: none;
}

.team-lead-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  color: var(--text);
  transition: background 0.12s ease;
}

.team-lead-toggle:hover {
  background: var(--surface-alt);
}

.team-lead-name {
  flex: 1;
  font-weight: 700;
}

.team-lead-close {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.team-lead-caret {
  color: var(--text-faint);
  transition: transform 0.15s ease;
}

.team-lead-toggle.expanded .team-lead-caret {
  transform: rotate(180deg);
}

.team-lead-agents {
  padding: 0 4px 12px 30px;
}

.team-lead-agents ul {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.team-lead-agents li {
  padding: 2px 0;
}

/* Standalone date range (pipeline / dashboard / archive), not inside the leaderboard toolbar */
main > .date-range-filter,
#dashboard-content > .date-range-filter {
  margin-bottom: 16px;
}

.date-range-filter button:hover {
  background: var(--surface-alt);
}

/* --- Leaderboard announcements --- */
.announcements-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}

.announcements-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #ef4444, #4f46e5);
}

.announcements-card h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#announcement-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

#announcement-form textarea {
  flex: 1;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

#announcement-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

#announcement-form button {
  align-self: flex-start;
  padding: 9px 18px;
  background: linear-gradient(90deg, #4f46e5, #6d28d9);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#announcement-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.announcement-item {
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  box-shadow: inset 3px 0 0 #f59e0b;
}

.announcement-item:last-child {
  margin-bottom: 0;
}

.announcement-body {
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
}

.announcement-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}

.announcement-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 4px;
}

/* --- Closer feedback: outcome + rehash --- */
.feedback-field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.feedback-field-label select {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
}

.feedback-rehash-hint {
  margin: 0;
  font-size: 12px;
  color: #b45309;
  font-weight: 600;
}

.rehash-outcome {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  white-space: nowrap;
}

/* --- Print-friendly Dashboard report --- */
/* --- Phones & small tablets ---
   Closers file outcomes from the doorstep and agents work from their phones, so every
   page has to be usable one-handed at phone width. */
@media (max-width: 720px) {
  header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }
  #user-info {
    flex-wrap: wrap;
    gap: 8px 14px;
    width: 100%;
  }
  main {
    padding: 16px 12px;
  }

  .filter-bar > * {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* Modals become full-screen sheets instead of a box floating off the edges. */
  .modal-overlay {
    align-items: stretch;
  }
  .modal-box {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .modal-actions button,
  .workflow-actions button {
    width: 100%;
  }

  /* 16px stops iOS from zooming the whole page in whenever a field is tapped. */
  input, select, textarea {
    font-size: 16px;
  }

  #users-table {
    display: block;
    overflow-x: auto;
  }
  #create-form > * {
    flex: 1 1 100%;
  }
}

@media print {
  header, .board-tabs, .secondary-nav, .export-bar, .date-range-filter {
    display: none !important;
  }
  main {
    padding: 0;
    max-width: 100%;
  }
}

/* ---------- Dock navigation (built by nav.js) ---------- */
/* An Apple-style dock floating at the bottom: icon buttons that lift as the pointer passes,
   the page name above the one being hovered, and a dot under the page you're on. */
body.has-dock {
  padding-bottom: 104px;
}
#dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 90;
  max-width: calc(100vw - 24px);
}
.dock-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 14px 14px;
  list-style: none;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid rgba(228, 228, 231, 0.9);
  border-radius: 24px;
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.06);
}
.dock-item {
  position: relative;
  display: flex;
  flex: 0 0 auto;
}
.dock-link {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--surface);
  color: #1f3b44;
  border: 1px solid #eceef2;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08), inset 0 1px 0 #fff;
  transform-origin: bottom center;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1.2), box-shadow 0.22s ease, color 0.15s ease;
}
.dock-link svg {
  width: 21px;
  height: 21px;
}
.dock-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.dock-link.active {
  color: var(--primary);
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.16), inset 0 1px 0 #fff;
}
/* The dot under the page you're on. */
.dock-link.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #1f3b44;
}
.dock-tip {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 4px 9px;
  border-radius: 7px;
  background: #2f4f57;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.dock-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: #2f4f57;
}
.dock-item:hover .dock-tip,
.dock-link:focus-visible + .dock-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}
.dock-divider {
  flex: 0 0 1px;
  align-self: stretch;
  margin: 6px 4px;
  background: var(--border-strong);
}
/* The lift (and a smaller one for the neighbours) — only with a mouse, and only for
   people who haven't asked for less motion. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .dock-item:hover .dock-link {
    transform: translateY(-8px) scale(1.18);
    box-shadow: 0 12px 22px -8px rgba(15, 23, 42, 0.3), inset 0 1px 0 #fff;
  }
  .dock-item:hover + .dock-item .dock-link,
  .dock-item:has(+ .dock-item:hover) .dock-link {
    transform: translateY(-3px) scale(1.07);
  }
}

.header-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.header-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.header-user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

/* Phones: a smaller dock that scrolls sideways when every button doesn't fit. */
@media (max-width: 720px) {
  #user-info {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }
  body.has-dock {
    padding-bottom: 88px;
  }
  #dock {
    bottom: 10px;
  }
  .dock-bar {
    gap: 6px;
    padding: 8px 10px 12px;
    border-radius: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .dock-bar::-webkit-scrollbar {
    display: none;
  }
  .dock-item {
    scroll-snap-align: center;
  }
  .dock-link {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .dock-tip {
    display: none;
  }
}

@media print {
  #dock {
    display: none !important;
  }
  body.has-dock {
    padding-bottom: 0;
  }
}

/* ---------- Logo ---------- */
header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  height: 26px;
  width: auto;
  display: block;
}
.auth-brand-logo {
  height: 34px;
  width: auto;
  display: block;
}
.auth-logo {
  display: block;
  width: 170px;
  height: auto;
  margin: 0 auto 24px;
}

/* Rehash rows open the lead. */
#rehash-table tr.rehash-row {
  cursor: pointer;
}
#rehash-table tr.rehash-row:hover td {
  background: var(--surface-alt);
}
.rehash-lead-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.rehash-lead-link:hover {
  text-decoration: underline;
}

/* Wide tables scroll sideways inside their own box instead of widening the page. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#rehash-table {
  min-width: 860px;
}

/* Calendar days share the width evenly, however long an appointment name is. */
.calendar-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
@media (max-width: 720px) {
  .calendar-grid {
    gap: 3px;
  }
  .calendar-cell {
    min-height: 64px;
    padding: 3px;
  }
  .calendar-appt {
    padding: 2px 3px;
    font-size: 10px;
  }
}
#archive-table {
  min-width: 620px;
}
#rehash-table td:nth-child(2),
#rehash-table td:nth-child(5) {
  white-space: nowrap;
}
.auth-note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Booth Appts / Raffle Leads ---------- */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.list-primary,
.list-secondary {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.list-primary {
  background: var(--primary);
  color: #fff;
  border: none;
}
.list-primary:hover {
  background: var(--primary-hover);
}
.list-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.list-secondary:hover {
  background: var(--surface-alt);
}
.list-import-help {
  flex: 1 1 260px;
  font-size: 12px;
  color: var(--text-muted);
}
.list-result {
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--primary-soft);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #3730a3;
}
.list-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.list-bulk-count {
  font-weight: 600;
}
.list-bulk-group {
  display: inline-flex;
  gap: 6px;
}
.list-bulk select {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  background: var(--surface);
}
.list-bulk button:not(.link-button) {
  padding: 7px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.list-check-col {
  width: 34px;
  text-align: center;
}
#list-table tr.list-row {
  cursor: pointer;
}
#list-table tr.list-row:hover td {
  background: var(--surface-alt);
}
.list-nowrap {
  white-space: nowrap;
}
.list-muted {
  color: var(--text-faint);
}
.list-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 12px;
}
.source-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 10.5px;
  font-weight: 600;
  vertical-align: 1px;
  white-space: nowrap;
}

/* =====================================================================
   Apple-style theme
   Layered last so it restyles the whole app without rewriting the rules
   above: Apple's light grey canvas and blue accent, a frosted top bar,
   pill buttons, a segmented control for the board tabs, softer inputs,
   rounded cards and tables, and blurred pop-ups.
   ===================================================================== */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-alt: #f5f5f7;
  --border: #e5e5ea;
  --border-strong: #d2d2d7;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-faint: #aeaeb2;
  --primary: #0071e3;
  --primary-hover: #0062c4;
  --primary-soft: #e8f1fd;
  --danger: #e0352b;
  --header-bg: rgba(255, 255, 255, 0.72);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --gray-fill: rgba(118, 118, 128, 0.12);
  --gray-fill-hover: rgba(118, 118, 128, 0.2);
  --focus-ring: 0 0 0 4px rgba(0, 113, 227, 0.18);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: -0.005em;
  background: var(--bg);
  color: var(--text);
}

/* --- Top bar: frosted white instead of black --- */
header {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 12px 28px;
}
header h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
@media (min-width: 721px) {
  header {
    position: sticky;
    top: 0;
    z-index: 80;
  }
}
#user-info {
  color: var(--text);
}
#user-info a {
  color: var(--text-muted);
}
#user-info a:hover {
  color: var(--text);
}
#user-info button {
  background: var(--gray-fill);
  color: var(--text);
  border: none;
  border-radius: 999px;
  padding: 7px 15px;
  font-weight: 500;
}
#user-info button:hover {
  background: var(--gray-fill-hover);
  border-color: transparent;
}
.header-user-name {
  color: var(--text);
}
.header-user-role {
  color: var(--text-muted);
}

/* --- Page titles --- */
main > h2,
main > .list-title,
#dashboard-content > h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 4px 0 6px;
}
h2 {
  letter-spacing: -0.02em;
}
.pipeline-hint {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* --- Buttons: blue pills for the main action, grey pills for the rest --- */
#open-add-modal,
#create-form button,
#contact-form button,
.modal-actions button,
.comment-compose button,
.edit-request-panel button,
.edit-request-notice button,
#feedback-submit-row button,
#feedback-review-button,
.force-password-card button[type="submit"],
.auth-box button[type="submit"],
.restore-button,
.workflow-primary,
#leaderboard-apply-range,
#export-leaderboard-csv,
#announcement-form button,
.list-primary,
.list-bulk button:not(.link-button),
.duplicate-warning-actions button.duplicate-proceed {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-weight: 500;
  box-shadow: none;
  transition: background 0.15s ease, transform 0.1s ease;
}
#open-add-modal:hover,
#create-form button:hover,
#contact-form button:hover,
.modal-actions button:hover,
.comment-compose button:hover,
.edit-request-panel button:hover,
.edit-request-notice button:hover,
#feedback-submit-row button:hover,
#feedback-review-button:hover,
.force-password-card button[type="submit"]:hover,
.auth-box button[type="submit"]:hover,
.restore-button:hover,
.workflow-primary:hover,
#leaderboard-apply-range:hover,
#export-leaderboard-csv:hover,
#announcement-form button:hover,
.list-primary:hover,
.list-bulk button:not(.link-button):hover,
.duplicate-warning-actions button.duplicate-proceed:hover {
  background: var(--primary-hover);
  box-shadow: none;
  transform: none;
}
#open-add-modal:active,
.modal-actions button:active,
.list-primary:active {
  transform: scale(0.98);
}
#open-add-modal {
  padding: 9px 18px;
}

.filter-bar button,
.export-menu > button,
.pagination-bar button,
.calendar-header button,
.dash-toolbar-right button,
.date-range-filter button,
.list-secondary,
.upload-button,
#activity-toggle,
.duplicate-warning-actions button,
.calendar-popover button,
.qc-decision-buttons button {
  background: var(--gray-fill);
  color: var(--text);
  border: none;
  border-radius: 999px;
  font-weight: 500;
  box-shadow: none;
  transition: background 0.15s ease;
}
.filter-bar button:hover,
.export-menu > button:hover,
.pagination-bar button:hover:not(:disabled),
.calendar-header button:hover,
.dash-toolbar-right button:hover,
.date-range-filter button:hover,
.list-secondary:hover,
.upload-button:hover,
#activity-toggle:hover,
.duplicate-warning-actions button:hover,
.calendar-popover button:hover,
.qc-decision-buttons button:hover {
  background: var(--gray-fill-hover);
  border-color: transparent;
  color: var(--text);
}
.pagination-bar button:disabled {
  background: rgba(118, 118, 128, 0.06);
  color: var(--text-faint);
}
.delete-lead-button,
.delete-user-button,
.attachment-delete,
.announcement-delete {
  border-radius: 999px;
}
.link-button {
  color: var(--primary);
}

/* --- Board tabs as an Apple segmented control --- */
.board-tabs,
.date-tabs,
.view-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--gray-fill);
  border-radius: 10px;
}
.board-tabs .tab,
.date-tabs .tab,
.view-toggle .tab {
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 6px 18px;
  color: var(--text);
  font-weight: 500;
}
.board-tabs .tab:hover,
.date-tabs .tab:hover,
.view-toggle .tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}
.board-tabs .tab.active,
.date-tabs .tab.active,
.view-toggle .tab.active {
  background: var(--surface);
  color: var(--text);
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
}

/* "Needs my attention" and similar toggles */
.attention-toggle {
  border-radius: 999px;
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.attention-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* --- Inputs --- */
main input[type="text"],
main input[type="email"],
main input[type="number"],
main input[type="date"],
main input[type="password"],
main input[type="search"],
main select:not(.stage-inline),
main textarea,
.modal-box input[type="text"],
.modal-box input[type="email"],
.modal-box input[type="number"],
.modal-box input[type="date"],
.modal-box select:not(.stage-inline),
.modal-box textarea,
.auth-box input,
.force-password-card input {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
main input:focus,
main select:not(.stage-inline):focus,
main textarea:focus,
.modal-box input:focus,
.modal-box select:not(.stage-inline):focus,
.modal-box textarea:focus,
.auth-box input:focus,
.force-password-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
main input:disabled,
.modal-box input:disabled,
.modal-box select:disabled,
.modal-box textarea:disabled {
  background-color: var(--surface-alt);
  color: var(--text-muted);
}
.filter-bar {
  gap: 10px;
}

/* --- Tables --- */
.table-view-wrapper {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.lead-table th,
th {
  background: #fafafc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.lead-table th {
  border-bottom: 1px solid var(--border);
}
.lead-table td,
td {
  border-color: #f0f0f3;
}
.lead-table tbody tr:hover td,
#rehash-table tr.rehash-row:hover td,
#list-table tr.list-row:hover td {
  background: #f9f9fb;
}
table {
  border-radius: var(--radius-md);
  border-color: var(--border);
}
.table-scroll > table,
.leaderboard-card table,
.roles-table {
  box-shadow: var(--shadow-sm);
}
.status-pill,
select.stage-inline {
  border-radius: 999px;
}

/* --- Cards --- */
.stat-tile,
.chart-card,
.leaderboard-card,
.announcements-card,
.workflow-panel,
.list-bulk,
#create-form,
.closer-section,
.attachments-section,
.card {
  border-radius: var(--radius-lg);
  border-color: var(--border);
}
.stat-tile,
.chart-card,
.leaderboard-card,
.announcements-card,
#create-form {
  box-shadow: var(--shadow-sm);
}
.leaderboard-card::before,
.announcements-card::before {
  display: none;
}
.leaderboard-card h3,
.announcements-card h3,
.chart-card h3 {
  text-transform: none;
  letter-spacing: -0.01em;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.workflow-panel {
  background: var(--surface-alt);
  border: none;
}
.list-result {
  background: var(--primary-soft);
  border-color: rgba(0, 113, 227, 0.2);
  color: #0a4ea3;
  border-radius: var(--radius-md);
}

/* Calendar */
.calendar-cell {
  border-radius: 12px;
  border-color: var(--border);
}
.calendar-cell.calendar-cell-today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.calendar-appt {
  border-radius: 6px;
}
.calendar-appt:hover {
  background: #d6e7fb;
}
.calendar-popover {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* --- Pop-ups: blurred backdrop, rounded sheet, gentle entrance --- */
.modal-overlay,
#force-password-overlay {
  background: rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.modal-box,
.force-password-card {
  border-radius: 22px;
  border: none;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.08);
}
.modal-close {
  border-radius: 999px;
  background: var(--gray-fill);
  color: var(--text-muted);
}
@media (prefers-reduced-motion: no-preference) {
  .modal-overlay:not([hidden]) .modal-box,
  #force-password-overlay .force-password-card {
    animation: apple-sheet-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}
@keyframes apple-sheet-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* --- Dock: blue accent to match --- */
.dock-link.active {
  border-color: rgba(0, 113, 227, 0.3);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.16), inset 0 1px 0 #fff;
}

/* --- Login: light, airy brand panel --- */
.auth-brand {
  background: linear-gradient(160deg, #fbfbfd 0%, #eef3fb 60%, #e3edfb 100%);
  color: var(--text);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}
.auth-brand-glow {
  background: radial-gradient(circle, rgba(0, 113, 227, 0.18), transparent 70%);
}
.auth-brand-glow-2 {
  background: radial-gradient(circle, rgba(0, 113, 227, 0.12), transparent 70%);
}
.auth-brand-mark {
  color: var(--text);
}
.auth-brand-tag {
  color: var(--text-muted);
}
.auth-page {
  background: var(--surface);
}
.auth-box {
  border-radius: 22px;
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}
.auth-box button[type="submit"] {
  padding: 12px;
  font-weight: 600;
}
.auth-field {
  color: var(--text);
  font-weight: 500;
}
.owner-cell .transfer-select {
  min-width: 120px;
  margin-top: 0;
}

/* Manage Team row controls */
#users-table button {
  padding: 5px 12px;
  margin: 2px 2px 2px 0;
  border: none;
  border-radius: 999px;
  background: var(--gray-fill);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}
#users-table button:hover {
  background: var(--gray-fill-hover);
}
#users-table .save-button {
  background: var(--primary);
  color: #fff;
}
#users-table .save-button:hover {
  background: var(--primary-hover);
}
#users-table .delete-user-button {
  background: rgba(224, 53, 43, 0.1);
  color: var(--danger);
}
#users-table .delete-user-button:hover {
  background: rgba(224, 53, 43, 0.18);
}
#users-table select {
  padding: 5px 8px;
  font-size: 12.5px;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
}

/* ---------- Compact, full-width tables ---------- */
/* Use the whole screen instead of a centred 1400px column, and pack the pipeline table
   tighter so more of it fits without scrolling sideways. */
main {
  max-width: none;
  padding: 24px 32px;
}
@media (max-width: 720px) {
  main {
    padding: 16px 12px;
  }
}
.lead-table th,
.lead-table td {
  padding: 7px 10px;
}
.lead-table td {
  line-height: 1.3;
}
.lead-table .cell-notes {
  max-width: 170px;
}
.lead-name {
  display: block;
  font-weight: 600;
}
.lead-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
}
.owner-cell .transfer-select {
  min-width: 0;
  width: 104px;
  padding: 4px 6px;
  font-size: 12px;
}
select.stage-inline {
  font-size: 11.5px;
  padding: 3px 6px;
}
.lead-table .status-pill {
  font-size: 11px;
  padding: 2px 8px;
}
/* Laptop screens: trim the long text columns (the full text is on hover and in the lead). */
@media (max-width: 1700px) {
  .lead-table th,
  .lead-table td {
    padding: 6px 8px;
  }
  .lead-table .cell-notes {
    max-width: 120px;
  }
}

/* Attach a link (e.g. Google Drive) instead of a file. */
.link-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  padding: 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
}
.link-form input[type="url"] {
  flex: 1 1 260px;
}
.link-form input[type="text"] {
  flex: 0 1 180px;
}
.link-form input,
.link-form select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
}
.link-form input:focus,
.link-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
#link-save {
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
#link-save:hover {
  background: var(--primary-hover);
}
button.upload-button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Closer view: appointment cards, phone-first ---------- */
body.closer-mode #open-add-modal,
body.closer-mode main > h2,
body.closer-mode .pipeline-toolbar,
body.closer-mode .attention-bar,
body.closer-mode .filter-bar,
body.closer-mode #custom-range-row,
body.closer-mode #table-view,
body.closer-mode .pagination-bar {
  display: none !important;
}
.closer-view {
  max-width: 720px;
  margin: 0 auto;
}
.closer-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 4px 0 14px;
}
.closer-tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  margin-bottom: 16px;
  background: var(--gray-fill);
  border-radius: 10px;
}
.closer-tab {
  flex: 1;
  padding: 9px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.closer-tab.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
}
.closer-count {
  margin-left: 4px;
  color: var(--text-muted);
  font-weight: 600;
}
.closer-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.closer-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius-lg);
}
.closer-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.closer-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.closer-card-done {
  opacity: 0.8;
}
.closer-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.closer-card-time {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.closer-card-date {
  font-size: 13px;
  color: var(--text-muted);
}
.closer-card-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.closer-card-name {
  font-size: 17px;
  font-weight: 600;
  margin-top: 4px;
}
.closer-card-line {
  display: block;
  color: var(--primary);
  text-decoration: none;
  font-size: 15px;
  padding: 2px 0;
}
.closer-card-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.closer-card-action {
  margin-top: 8px;
  padding: 12px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.closer-card-done .closer-card-action {
  background: var(--gray-fill);
  color: var(--text);
}

/* The sheet */
.closer-sheet {
  max-width: 560px;
}
.closer-sheet-when {
  margin: -6px 0 12px;
  color: var(--text-muted);
  font-size: 15px;
}
.closer-sheet-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.closer-sheet-actions:empty {
  display: none;
}
.closer-action-button {
  flex: 1;
  padding: 11px;
  border-radius: 999px;
  background: var(--gray-fill);
  color: var(--primary);
  text-align: center;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}
.closer-outcome-form h3,
.closer-files h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
}
.closer-outcomes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.closer-outcome {
  flex: 1 1 calc(50% - 8px);
  padding: 12px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.closer-outcome.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.closer-notes-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.closer-notes-label textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  resize: vertical;
}
.closer-notes-label textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.closer-submit {
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.closer-submit:disabled {
  opacity: 0.6;
}
.closer-outcome-locked {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--text-muted);
}
.closer-details {
  margin: 22px 0 0;
  border-top: 1px solid var(--border);
}
.closer-detail {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.closer-detail dt {
  flex: 0 0 110px;
  color: var(--text-muted);
  font-size: 14px;
}
.closer-detail dd {
  margin: 0;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
.closer-files {
  margin-top: 18px;
}
.closer-file {
  display: flex;
  align-items: center;
  padding: 10px 0;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.closer-full-details {
  display: block;
  margin: 18px auto 4px;
}
@media (max-width: 720px) {
  .closer-title {
    font-size: 24px;
  }
}

/* ---------- Sale celebration: card + confetti (nav.js) ---------- */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1300;
}
.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.celebration-card {
  width: 100%;
  max-width: 380px;
  padding: 30px 26px 24px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.08);
  text-align: center;
}
@media (prefers-reduced-motion: no-preference) {
  .celebration-card {
    animation: celebration-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
  }
}
@keyframes celebration-pop {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: none; }
}
.celebration-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd76a, #f4b400);
  color: #5c4200;
  box-shadow: 0 8px 20px rgba(244, 180, 0, 0.35);
}
.celebration-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.celebration-lead {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  color: var(--primary);
}
.celebration-body {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 15px;
}
.celebration-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.celebration-ok {
  padding: 12px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.celebration-open {
  color: var(--primary);
  font-size: 14px;
  text-decoration: none;
}

/* =====================================================================
   Night colour scheme (matches the Good Faith "Sales Command" app)
   Layered last: deep navy canvas, navy panels, solar-amber main accent
   with dark text on it, water-teal focus rings and links. Layout, the
   dock and the pill shapes stay as they are; only the colours change.
   Dark is the default. Choosing Light in the top bar sets
   data-theme="light" on <html>, which switches every rule here off and
   leaves the Apple light theme above. :where() adds no specificity, so
   each rule weighs the same as it would without the prefix.
   ===================================================================== */
:root:not([data-theme="light"]) {
  color-scheme: dark;
  --night: #0d1426;
  --night-2: #121b32;
  --panel: #16203a;
  --panel-2: #1b2742;
  --line: #26334f;
  --line-soft: #1f2b46;
  --solar: #f4a526;
  --solar-soft: #3a2e14;
  --water: #2bb7c4;
  --water-soft: #123339;
  --good: #46c98b;
  --warn: #f0b537;
  --bad: #ef5f6b;
  --star: #f4d35e;
  --on-primary: #2a1c05;

  --bg: var(--night);
  --surface: var(--panel);
  --surface-alt: var(--panel-2);
  --border: var(--line);
  --border-strong: #33415f;
  --text: #eef2fb;
  --text-muted: #8b97b4;
  --text-faint: #5f6c8a;
  --primary: var(--solar);
  --primary-hover: #f6b342;
  --primary-soft: var(--solar-soft);
  --danger: var(--bad);
  --header-bg: rgba(13, 20, 38, 0.82);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 22px 60px rgba(0, 0, 0, 0.45);
  --gray-fill: rgba(139, 151, 180, 0.14);
  --gray-fill-hover: rgba(139, 151, 180, 0.24);
  --focus-ring: 0 0 0 3px rgba(43, 183, 196, 0.35);
}

:where(:root:not([data-theme="light"])) body {
  background:
    radial-gradient(1100px 700px at 85% -10%, #1a2b4d 0, transparent 60%),
    radial-gradient(900px 600px at 0% 0%, #15213d 0, transparent 55%),
    var(--night);
  background-attachment: fixed;
  color: var(--text);
}

/* Top bar */
:where(:root:not([data-theme="light"])) header {
  background: var(--header-bg);
  border-bottom-color: var(--line);
}
:where(:root:not([data-theme="light"])) header h1,
:where(:root:not([data-theme="light"])) .header-user-name,
:where(:root:not([data-theme="light"])) #user-info {
  color: var(--text);
}

/* Main-action buttons: amber with dark text, like Good Faith */
:where(:root:not([data-theme="light"])) #open-add-modal,
:where(:root:not([data-theme="light"])) #create-form button,
:where(:root:not([data-theme="light"])) #contact-form button,
:where(:root:not([data-theme="light"])) .modal-actions button,
:where(:root:not([data-theme="light"])) .comment-compose button,
:where(:root:not([data-theme="light"])) .edit-request-panel button,
:where(:root:not([data-theme="light"])) .edit-request-notice button,
:where(:root:not([data-theme="light"])) #feedback-submit-row button,
:where(:root:not([data-theme="light"])) #feedback-review-button,
:where(:root:not([data-theme="light"])) .force-password-card button[type="submit"],
:where(:root:not([data-theme="light"])) .auth-box button[type="submit"],
:where(:root:not([data-theme="light"])) .restore-button,
:where(:root:not([data-theme="light"])) .workflow-primary,
:where(:root:not([data-theme="light"])) #leaderboard-apply-range,
:where(:root:not([data-theme="light"])) #export-leaderboard-csv,
:where(:root:not([data-theme="light"])) #announcement-form button,
:where(:root:not([data-theme="light"])) .list-primary,
:where(:root:not([data-theme="light"])) .list-bulk button:not(.link-button),
:where(:root:not([data-theme="light"])) .duplicate-warning-actions button.duplicate-proceed,
:where(:root:not([data-theme="light"])) #users-table .save-button,
:where(:root:not([data-theme="light"])) #link-save,
:where(:root:not([data-theme="light"])) .closer-card-action,
:where(:root:not([data-theme="light"])) .closer-submit,
:where(:root:not([data-theme="light"])) .celebration-ok,
:where(:root:not([data-theme="light"])) .attention-toggle.active {
  color: var(--on-primary);
  font-weight: 600;
}
:where(:root:not([data-theme="light"])) .attention-toggle.active .attention-count {
  background: rgba(42, 28, 5, 0.18);
  color: var(--on-primary);
}
:where(:root:not([data-theme="light"])) .closer-card-done .closer-card-action {
  color: var(--text);
}

/* Links and focus in water teal */
:where(:root:not([data-theme="light"])) .link-button,
:where(:root:not([data-theme="light"])) .rehash-lead-link,
:where(:root:not([data-theme="light"])) .closer-card-line,
:where(:root:not([data-theme="light"])) .closer-file,
:where(:root:not([data-theme="light"])) .closer-action-button,
:where(:root:not([data-theme="light"])) .celebration-open,
:where(:root:not([data-theme="light"])) .roles-link,
:where(:root:not([data-theme="light"])) .attachment-item a {
  color: var(--water);
}
:where(:root:not([data-theme="light"])) main input:focus,
:where(:root:not([data-theme="light"])) main select:not(.stage-inline):focus,
:where(:root:not([data-theme="light"])) main textarea:focus,
:where(:root:not([data-theme="light"])) .modal-box input:focus,
:where(:root:not([data-theme="light"])) .modal-box select:not(.stage-inline):focus,
:where(:root:not([data-theme="light"])) .modal-box textarea:focus,
:where(:root:not([data-theme="light"])) .auth-box input:focus,
:where(:root:not([data-theme="light"])) .force-password-card input:focus,
:where(:root:not([data-theme="light"])) .link-form input:focus,
:where(:root:not([data-theme="light"])) .link-form select:focus,
:where(:root:not([data-theme="light"])) .closer-notes-label textarea:focus {
  border-color: var(--water);
  box-shadow: var(--focus-ring);
}

/* Inputs: dark fields */
:where(:root:not([data-theme="light"])) main input[type="text"],
:where(:root:not([data-theme="light"])) main input[type="email"],
:where(:root:not([data-theme="light"])) main input[type="number"],
:where(:root:not([data-theme="light"])) main input[type="date"],
:where(:root:not([data-theme="light"])) main input[type="password"],
:where(:root:not([data-theme="light"])) main input[type="search"],
:where(:root:not([data-theme="light"])) main select:not(.stage-inline),
:where(:root:not([data-theme="light"])) main textarea,
:where(:root:not([data-theme="light"])) .modal-box input,
:where(:root:not([data-theme="light"])) .modal-box select:not(.stage-inline),
:where(:root:not([data-theme="light"])) .modal-box textarea,
:where(:root:not([data-theme="light"])) .auth-box input,
:where(:root:not([data-theme="light"])) .force-password-card input,
:where(:root:not([data-theme="light"])) .link-form input,
:where(:root:not([data-theme="light"])) .link-form select,
:where(:root:not([data-theme="light"])) .closer-notes-label textarea,
:where(:root:not([data-theme="light"])) .transfer-select,
:where(:root:not([data-theme="light"])) #users-table select {
  background-color: #0f1830;
  border-color: var(--line);
  color: var(--text);
}
:where(:root:not([data-theme="light"])) main input::placeholder,
:where(:root:not([data-theme="light"])) .modal-box input::placeholder,
:where(:root:not([data-theme="light"])) textarea::placeholder,
:where(:root:not([data-theme="light"])) .auth-box input::placeholder {
  color: var(--text-faint);
}
:where(:root:not([data-theme="light"])) main input:disabled,
:where(:root:not([data-theme="light"])) .modal-box input:disabled,
:where(:root:not([data-theme="light"])) .modal-box select:disabled,
:where(:root:not([data-theme="light"])) .modal-box textarea:disabled {
  background-color: var(--night-2);
  color: var(--text-muted);
}

/* Segmented controls */
:where(:root:not([data-theme="light"])) .board-tabs,
:where(:root:not([data-theme="light"])) .date-tabs,
:where(:root:not([data-theme="light"])) .view-toggle,
:where(:root:not([data-theme="light"])) .closer-tabs {
  background: var(--panel);
  border: 1px solid var(--line);
}
:where(:root:not([data-theme="light"])) .board-tabs .tab,
:where(:root:not([data-theme="light"])) .date-tabs .tab,
:where(:root:not([data-theme="light"])) .view-toggle .tab,
:where(:root:not([data-theme="light"])) .closer-tab {
  color: var(--text-muted);
}
:where(:root:not([data-theme="light"])) .board-tabs .tab:hover,
:where(:root:not([data-theme="light"])) .date-tabs .tab:hover,
:where(:root:not([data-theme="light"])) .view-toggle .tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
:where(:root:not([data-theme="light"])) .board-tabs .tab.active,
:where(:root:not([data-theme="light"])) .date-tabs .tab.active,
:where(:root:not([data-theme="light"])) .view-toggle .tab.active,
:where(:root:not([data-theme="light"])) .closer-tab.active {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
:where(:root:not([data-theme="light"])) .board-tabs .tab.active[data-board="Solar"] {
  background: var(--solar-soft);
  color: var(--solar);
}
:where(:root:not([data-theme="light"])) .board-tabs .tab.active[data-board="Water"] {
  background: var(--water-soft);
  color: var(--water);
}

/* Cards and tables: navy panels */
:where(:root:not([data-theme="light"])) .table-view-wrapper,
:where(:root:not([data-theme="light"])) .stat-tile,
:where(:root:not([data-theme="light"])) .chart-card,
:where(:root:not([data-theme="light"])) .leaderboard-card,
:where(:root:not([data-theme="light"])) .announcements-card,
:where(:root:not([data-theme="light"])) .list-bulk,
:where(:root:not([data-theme="light"])) #create-form,
:where(:root:not([data-theme="light"])) .closer-card,
:where(:root:not([data-theme="light"])) .closer-empty,
:where(:root:not([data-theme="light"])) .calendar-popover,
:where(:root:not([data-theme="light"])) .attention-toggle {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-color: var(--line);
}
:where(:root:not([data-theme="light"])) .lead-table th,
:where(:root:not([data-theme="light"])) th {
  background: #15203a;
  color: var(--text-muted);
  border-bottom-color: var(--line);
}
:where(:root:not([data-theme="light"])) .lead-table td,
:where(:root:not([data-theme="light"])) td {
  border-color: var(--line-soft);
}
:where(:root:not([data-theme="light"])) .lead-table td:first-child {
  background: var(--panel);
}
:where(:root:not([data-theme="light"])) .lead-table th:first-child {
  background: #15203a;
}
:where(:root:not([data-theme="light"])) .lead-table tbody tr:hover td,
:where(:root:not([data-theme="light"])) .lead-table tbody tr:hover td:first-child,
:where(:root:not([data-theme="light"])) #rehash-table tr.rehash-row:hover td,
:where(:root:not([data-theme="light"])) #list-table tr.list-row:hover td {
  background: #1a2540;
}
:where(:root:not([data-theme="light"])) table {
  background: var(--panel);
  border-color: var(--line);
}
:where(:root:not([data-theme="light"])) .workflow-panel,
:where(:root:not([data-theme="light"])) .link-form {
  background: var(--night-2);
}

/* Pop-ups */
:where(:root:not([data-theme="light"])) .modal-overlay,
:where(:root:not([data-theme="light"])) #force-password-overlay,
:where(:root:not([data-theme="light"])) .celebration-overlay {
  background: rgba(5, 9, 20, 0.6);
}
:where(:root:not([data-theme="light"])) .modal-box,
:where(:root:not([data-theme="light"])) .force-password-card,
:where(:root:not([data-theme="light"])) .celebration-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
:where(:root:not([data-theme="light"])) .modal-close {
  color: var(--text-muted);
}

/* Calendar */
:where(:root:not([data-theme="light"])) .calendar-cell {
  background: var(--panel);
  border-color: var(--line-soft);
}
:where(:root:not([data-theme="light"])) .calendar-cell.calendar-cell-empty {
  background: var(--night);
  opacity: 0.6;
}
:where(:root:not([data-theme="light"])) .calendar-cell.calendar-cell-today {
  background: rgba(244, 165, 38, 0.07);
  border-color: var(--solar);
  box-shadow: 0 0 0 1px var(--solar);
}
:where(:root:not([data-theme="light"])) .calendar-appt {
  background: rgba(91, 155, 240, 0.15);
  color: var(--text);
}
:where(:root:not([data-theme="light"])) .calendar-appt:hover {
  background: rgba(91, 155, 240, 0.28);
}

/* Dock */
:where(:root:not([data-theme="light"])) .dock-bar {
  background: rgba(18, 27, 50, 0.85);
  border-color: var(--line);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
}
:where(:root:not([data-theme="light"])) .dock-link {
  background: var(--panel-2);
  color: var(--text-muted);
  border-color: var(--line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
:where(:root:not([data-theme="light"])) .dock-item:hover .dock-link {
  color: var(--text);
}
:where(:root:not([data-theme="light"])) .dock-link.active {
  color: var(--solar);
  border-color: rgba(244, 165, 38, 0.45);
  box-shadow: inset 0 0 0 1px rgba(244, 165, 38, 0.25);
}
:where(:root:not([data-theme="light"])) .dock-link.active::after {
  background: var(--solar);
}
:where(:root:not([data-theme="light"])) .dock-tip {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}
:where(:root:not([data-theme="light"])) .dock-tip::after {
  border-top-color: var(--panel-2);
}
:where(:root:not([data-theme="light"])) .dock-divider {
  background: var(--line);
}

/* Notices, badges and tags that were light-on-light */
:where(:root:not([data-theme="light"])) .comment-item.comment-edit_request,
:where(:root:not([data-theme="light"])) .edit-request-notice,
:where(:root:not([data-theme="light"])) .unassigned-banner,
:where(:root:not([data-theme="light"])) .duplicate-warning {
  background: rgba(240, 181, 55, 0.1);
  border-color: rgba(240, 181, 55, 0.35);
  color: var(--warn);
}
:where(:root:not([data-theme="light"])) .comment-item.comment-edit_done {
  background: rgba(70, 201, 139, 0.1);
  border-color: rgba(70, 201, 139, 0.35);
}
:where(:root:not([data-theme="light"])) tr.needs-leader td {
  background: rgba(240, 181, 55, 0.06);
}
:where(:root:not([data-theme="light"])) .leader-badge,
:where(:root:not([data-theme="light"])) .source-tag,
:where(:root:not([data-theme="light"])) .rehash-outcome,
:where(:root:not([data-theme="light"])) .archive-days-badge,
:where(:root:not([data-theme="light"])) .feedback-badge.pending {
  background: rgba(240, 181, 55, 0.14);
  color: var(--warn);
}
:where(:root:not([data-theme="light"])) .feedback-badge.reviewed {
  background: rgba(70, 201, 139, 0.14);
  color: var(--good);
}
:where(:root:not([data-theme="light"])) .archive-days-badge.urgent,
:where(:root:not([data-theme="light"])) .sent-back-notice {
  background: rgba(239, 95, 107, 0.14);
  border-color: rgba(239, 95, 107, 0.4);
  color: #ff8b97;
}
:where(:root:not([data-theme="light"])) .auth-error {
  background: rgba(239, 95, 107, 0.12);
  color: #ff8b97;
}
:where(:root:not([data-theme="light"])) .delete-lead-button,
:where(:root:not([data-theme="light"])) .delete-user-button,
:where(:root:not([data-theme="light"])) #users-table .delete-user-button {
  background: transparent;
  border-color: #5a2730;
  color: #ff8b97;
}
:where(:root:not([data-theme="light"])) .list-result {
  background: var(--water-soft);
  border-color: rgba(43, 183, 196, 0.35);
  color: var(--water);
}
:where(:root:not([data-theme="light"])) .closer-card-badge {
  background: var(--solar-soft);
  color: var(--solar);
}
:where(:root:not([data-theme="light"])) .closer-outcome {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}
:where(:root:not([data-theme="light"])) .closer-outcome.selected {
  background: var(--solar-soft);
  border-color: var(--solar);
  color: var(--solar);
}
:where(:root:not([data-theme="light"])) .leaderboard-you {
  background: rgba(244, 165, 38, 0.1) !important;
}
:where(:root:not([data-theme="light"])) .status-deactivated {
  color: var(--text-faint);
}

/* Login */
:where(:root:not([data-theme="light"])) .auth-brand {
  background:
    radial-gradient(900px 600px at 20% 10%, #1a2b4d 0, transparent 60%),
    linear-gradient(160deg, #121b32 0%, #0d1426 100%);
  color: var(--text);
  border-right-color: var(--line);
}
:where(:root:not([data-theme="light"])) .auth-brand-glow {
  background: radial-gradient(circle, rgba(244, 165, 38, 0.18), transparent 70%);
}
:where(:root:not([data-theme="light"])) .auth-brand-glow-2 {
  background: radial-gradient(circle, rgba(43, 183, 196, 0.16), transparent 70%);
}
:where(:root:not([data-theme="light"])) .auth-brand-mark,
:where(:root:not([data-theme="light"])) .auth-field {
  color: var(--text);
}
:where(:root:not([data-theme="light"])) .auth-brand-tag,
:where(:root:not([data-theme="light"])) .auth-sub,
:where(:root:not([data-theme="light"])) .auth-note {
  color: var(--text-muted);
}
:where(:root:not([data-theme="light"])) .auth-page {
  background: transparent;
}
:where(:root:not([data-theme="light"])) .auth-box {
  background: var(--panel);
  border-color: var(--line);
}

/* =====================================================================
   Light / dark switch (top bar, before Log out)
   A round grey button showing a sun in dark mode and a moon in light
   mode. The login page shows the logo that suits the current colours.
   ===================================================================== */
#user-info .theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--text-muted);
}
#user-info .theme-toggle:hover {
  color: var(--text);
}
#user-info .theme-toggle svg {
  display: block;
}
:root[data-theme="light"] .logo-for-dark,
:root:not([data-theme="light"]) .logo-for-light {
  display: none;
}

/* =====================================================================
   Sidebar (computers). The dock becomes a frosted rail down the left:
   logo at the top, plain page icons, the page you're on as a filled
   accent tile, then who's signed in and Log out at the foot. Names
   appear to the right on hover. Phones keep the bottom dock.
   ===================================================================== */
.dock-side-only {
  display: none;
}
@media (min-width: 721px) {
  body.has-dock {
    padding-bottom: 0;
    padding-left: 100px;
  }
  body.has-dock #logout-button,
  body.has-dock .header-logo {
    display: none;
  }
  #dock {
    left: 14px;
    top: 14px;
    bottom: 14px;
    transform: none;
    width: 72px;
    max-width: none;
  }
  .dock-bar {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    box-sizing: border-box;
    padding: 18px 0 16px;
    border-radius: 26px;
  }
  .dock-side-only {
    display: flex;
  }
  .dock-brand {
    margin-bottom: 12px;
  }
  .dock-brand a {
    display: flex;
    border-radius: 10px;
  }
  .dock-brand img {
    width: 34px;
    height: auto;
    display: block;
  }
  .dock-spacer {
    flex: 1 1 auto;
    min-height: 8px;
  }
  .dock-divider {
    flex: 0 0 1px;
    align-self: center;
    width: 28px;
    margin: 4px 0;
  }

  /* Plain icons on the rail; a soft grey tile on hover. */
  .dock-link,
  :where(:root:not([data-theme="light"])) .dock-link {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--text-muted);
    transform-origin: center;
    transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
  }
  .dock-item:hover .dock-link {
    background: var(--gray-fill);
    color: var(--text);
  }
  /* The page you're on: a filled accent tile. */
  .dock-link.active,
  .dock-item:hover .dock-link.active {
    background: var(--primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px -8px var(--primary);
  }
  :where(:root:not([data-theme="light"])) .dock-link.active,
  :where(:root:not([data-theme="light"])) .dock-item:hover .dock-link.active {
    color: var(--on-primary);
    border-color: transparent;
  }
  .dock-link.active::after {
    display: none;
  }
  button.dock-link {
    padding: 0;
    font: inherit;
    cursor: pointer;
  }
  .dock-item:hover .dock-logout {
    color: var(--danger);
  }

  /* Who's signed in. */
  .dock-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
  }

  /* Names show to the right of the rail. */
  .dock-tip {
    left: calc(100% + 16px);
    top: 50%;
    bottom: auto;
    transform: translate(-4px, -50%);
  }
  .dock-item:hover .dock-tip,
  .dock-link:focus-visible + .dock-tip {
    transform: translate(0, -50%);
  }
  .dock-tip::after {
    top: 50%;
    left: auto;
    right: 100%;
    margin: -5px 0 0;
    border-color: transparent;
    border-right-color: #2f4f57;
  }
  :where(:root:not([data-theme="light"])) .dock-tip::after {
    border-top-color: transparent;
    border-right-color: var(--panel-2);
  }
}
/* A gentle grow instead of the dock's lift. */
@media (min-width: 721px) and (hover: hover) and (prefers-reduced-motion: no-preference) {
  .dock-item:hover .dock-link {
    transform: scale(1.08);
    box-shadow: none;
  }
  .dock-item:hover + .dock-item .dock-link,
  .dock-item:has(+ .dock-item:hover) .dock-link {
    transform: none;
  }
}
/* Shorter screens: tighter spacing so every button fits. */
@media (min-width: 721px) and (max-height: 760px) {
  .dock-bar {
    gap: 4px;
    padding: 12px 0 10px;
  }
  .dock-brand {
    margin-bottom: 6px;
  }
  .dock-link {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
  .dock-avatar {
    width: 32px;
    height: 32px;
  }
}
@media print {
  body.has-dock {
    padding-left: 0;
  }
}

/* =====================================================================
   Sidebar bubble (computers). The rail is dark in both colour schemes,
   and the page you're on pops out of its right edge as a round accent
   button in a ring of the page colour, with the rail curving smoothly
   into it above and below. The curves are 10px-wide strips painted in
   the page colour outside a 15px circle; the numbers line up with the
   30px ring (23px button + 7px ring) centred on the rail's outer edge.
   ===================================================================== */
@media (min-width: 721px) {
  .dock-bar,
  :where(:root:not([data-theme="light"])) .dock-bar {
    background: #1d1d1f;
    border-color: #1d1d1f;
    box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.35);
  }
  :where(:root:not([data-theme="light"])) .dock-bar {
    background: var(--panel-2);
    border-color: var(--line);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
  }
  .dock-link,
  :where(:root:not([data-theme="light"])) .dock-link {
    color: rgba(255, 255, 255, 0.6);
  }
  .dock-item:hover .dock-link,
  :where(:root:not([data-theme="light"])) .dock-item:hover .dock-link {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  .dock-divider,
  :where(:root:not([data-theme="light"])) .dock-divider {
    background: rgba(255, 255, 255, 0.14);
  }
  .dock-avatar {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  /* The bubble. */
  .dock-item.dock-current {
    align-self: stretch;
    justify-content: center;
  }
  .dock-item.dock-current .dock-link.active {
    z-index: 2;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    transform: translateX(36px);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 7px var(--bg), 0 10px 22px -6px rgba(0, 0, 0, 0.35);
  }
  :where(:root:not([data-theme="light"])) .dock-item.dock-current .dock-link.active {
    color: var(--on-primary);
  }
  .dock-item.dock-current::before,
  .dock-item.dock-current::after {
    content: "";
    position: absolute;
    right: -1px;
    width: 10px;
    height: 43px;
    z-index: 1;
    pointer-events: none;
  }
  .dock-item.dock-current::before {
    bottom: 50%;
    background: radial-gradient(circle at -5px 0, transparent 14.5px, var(--bg) 15px);
  }
  .dock-item.dock-current::after {
    top: 50%;
    background: radial-gradient(circle at -5px 100%, transparent 14.5px, var(--bg) 15px);
  }
  .dock-item.dock-current .dock-tip {
    left: calc(100% + 46px);
  }

  /* The ring has to match the page behind it, so in dark mode the soft glow
     behind the sidebar goes; the one at the top right stays. */
  :where(:root:not([data-theme="light"])) body.has-dock {
    background:
      radial-gradient(1100px 700px at 85% -10%, #1a2b4d 0, transparent 60%),
      var(--night);
    background-attachment: fixed;
  }
}
@media (min-width: 721px) and (max-height: 760px) {
  .dock-item.dock-current .dock-link.active {
    width: 42px;
    height: 42px;
    box-shadow: 0 0 0 8px var(--bg), 0 10px 22px -6px rgba(0, 0, 0, 0.35);
  }
}

/* =====================================================================
   Smoothness
   - Page switches cross-fade instead of flashing blank, the sidebar and
     top bar stay put, and the sidebar's bubble slides to the new page
     (browsers without view transitions just switch pages as before).
   - The dark background glow sits on its own fixed layer instead of
     background-attachment: fixed, which made the browser repaint the
     whole page on every scroll step.
   - The sidebar is solid, so it doesn't need the costly blur.
   ===================================================================== */
@view-transition {
  navigation: auto;
}
header {
  view-transition-name: topbar;
}
/* Only on computers: a named element can't blur what's behind it, and the
   phone dock is frosted glass. */
@media (min-width: 721px) {
  #dock {
    view-transition-name: dock;
  }
  .dock-item.dock-current .dock-link.active {
    view-transition-name: nav-bubble;
  }
  .dock-bar,
  :where(:root:not([data-theme="light"])) .dock-bar {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
::view-transition-group(nav-bubble) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.3, 0.9, 0.3, 1.15);
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.16s;
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

:where(:root:not([data-theme="light"])) body,
:where(:root:not([data-theme="light"])) body.has-dock {
  background: var(--night);
  background-attachment: scroll;
}
:where(:root:not([data-theme="light"])) body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 700px at 85% -10%, #1a2b4d 0, transparent 60%),
    radial-gradient(900px 600px at 0% 0%, #15213d 0, transparent 55%);
}
@media (min-width: 721px) {
  /* No glow behind the sidebar, so the bubble's ring matches the page. */
  :where(:root:not([data-theme="light"])) body.has-dock::before {
    background: radial-gradient(1100px 700px at 85% -10%, #1a2b4d 0, transparent 60%);
  }
}

/* =====================================================================
   "Done" confirmation (window.showSuccess in nav.js): a frosted card in
   the middle of the screen; the green circle pops in, the check draws
   itself, then the card fades away.
   ===================================================================== */
.success-hud {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1400;
  min-width: 190px;
  max-width: min(280px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 26px 24px 20px;
  border-radius: 22px;
  text-align: center;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.3);
  color: var(--text);
  cursor: pointer;
  transform: translate(-50%, -50%);
  animation: success-hud-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
:where(:root:not([data-theme="light"])) .success-hud {
  background: rgba(27, 39, 66, 0.9);
  border-color: var(--line);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
}
.success-hud-out {
  animation: success-hud-out 0.25s ease forwards;
}
.success-check {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
}
.success-check-circle {
  fill: var(--good, #34c759);
  transform-origin: center;
  animation: success-circle-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) 0.05s both;
}
.success-check-mark {
  fill: none;
  stroke: #fff;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: success-check-draw 0.32s cubic-bezier(0.65, 0, 0.35, 1) 0.32s forwards;
}
.success-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.success-detail {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@keyframes success-hud-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes success-hud-out {
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.94); }
}
@keyframes success-circle-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
@keyframes success-check-draw {
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .success-hud,
  .success-hud-out,
  .success-check-circle {
    animation: none;
  }
  .success-check-mark {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* Export menu items stay on one line ("Google Sheet (live)"). */
.export-menu-items a {
  white-space: nowrap;
}

/* =====================================================================
   Google Drive backup panel (Manage Team, owner only)
   ===================================================================== */
.backup-card {
  margin-top: 28px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 760px;
}
:where(:root:not([data-theme="light"])) .backup-card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-color: var(--line);
}
.backup-card h2 {
  margin-top: 0;
}
.backup-intro,
.backup-status {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}
.backup-status {
  color: var(--text);
}
.backup-message {
  font-size: 14px;
  color: var(--good, #34c759);
}
.backup-status-error,
.backup-message.backup-status-error {
  color: var(--danger);
}
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.backup-primary,
.backup-secondary {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.backup-primary {
  background: var(--primary);
  color: #fff;
}
.backup-primary:hover {
  background: var(--primary-hover);
}
:where(:root:not([data-theme="light"])) .backup-primary {
  color: var(--on-primary);
}
.backup-primary:disabled {
  opacity: 0.6;
  cursor: default;
}
.backup-secondary {
  background: var(--gray-fill);
  color: var(--text);
}
.backup-secondary:hover {
  background: var(--gray-fill-hover);
}
