:root {
  --teal: #1a5276;
  --teal-light: #217dbb;
  --gold: #b8860b;
  --gold-light: #d4a017;
  --cream: #fdf6e3;
  --cream-border: #f0e4c4;
  --grey-bg: #f0f2f4;
  --grey-card: #eef1f5;
  --text-dark: #2c3e50;
  --text-body: #334155;
  --text-muted: #7f8c8d;
  --border: #dce1e8;
  --white: #ffffff;
  --red-bar: #8b0000;
  --black: #111111;
}
body {
  background-color: #f5f6fa;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--text-dark);
}

/* === PAGE HEADER === */
.page-header {
  background: var(--white);
  padding: 7px 28px;
  border-bottom: 3px solid var(--teal);
  display: flex;
  justify-content: space-between;
  /* Baseline-align so the date sits on the title/nav text line, not centered. */
  align-items: baseline;
  margin-bottom: 20px;
}
.page-header-left {
  display: flex;
  /* Baseline-align so the title and smaller nav links read as one line. */
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.page-nav {
  display: flex;
  gap: 14px;
  margin-left: 8px;
}
.page-nav a {
  font-size: 1rem;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
}
.page-nav a.active {
  color: var(--teal);
  font-weight: 600;
}
.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--teal);
  font-family: "Georgia", serif;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.page-header .header-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}
.header-user {
  position: relative;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e2433;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.user-avatar:hover {
  background: #2d3448;
}
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}
.user-menu-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  color: var(--text-body);
  text-decoration: none;
  transition: background 0.12s;
}
.user-menu-item:hover {
  background: #f5f7fa;
  color: var(--red-bar);
}
.page-content {
  padding: 0 28px 28px;
  max-width: 1400px;
  margin: 0 auto;
}

/* === ACTION BAR === */
.action-bar {
  background: var(--white);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}
.action-bar-left,
.action-bar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.daily-email-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.7);
  padding: 5px 12px 5px 9px;
  /* Match the Bulma is-small toolbar buttons (border, radius, grey fill). */
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f5f5f5;
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
  font-family: -apple-system, sans-serif;
}
.daily-email-toggle-label:hover {
  border-color: #3298dc;
  color: #1d72aa;
}
.daily-email-toggle-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 32px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  background: var(--white);
  transition:
    background 0.15s,
    border-color 0.15s;
}
.daily-email-toggle-label input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transform: translateY(-50%);
  transition:
    left 0.15s,
    background 0.15s;
}
.daily-email-toggle-label input[type="checkbox"]:checked {
  background: #3298dc;
  border-color: #3298dc;
}
.daily-email-toggle-label input[type="checkbox"]:checked::after {
  left: 16px;
  background: var(--white);
}
.daily-email-toggle-label:has(input:checked) {
  border-color: #3298dc;
  background: rgba(50, 152, 220, 0.12);
  color: #1d72aa;
}
.daily-email-toggle-label:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}
.daily-email-toggle-label:has(input:disabled):hover {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--white);
}
.daily-email-toggle-label input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

/* === SECTION TITLE (gold uppercase) === */
.section-title {
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 12px 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* === DASHBOARD GRID === 2fr/1fr columns, cards fill row by row so paired cards share a top edge; collapses to 1 column below 1024px. */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
/* Top row: make AI Market Summary and Pricing Desk Notations the same height. */
.dashboard-grid > .ai-summary-card,
.dashboard-grid > .notations-card {
  align-self: stretch;
}
/* Day over Day spans rows 2-3 to match the right column's stacked cards. */
.dashboard-grid > #dayOverDayContainer {
  grid-column: 1;
  grid-row: 2 / span 2;
  align-self: stretch;
}
/* When a right-column card is expanded for editing, don't stretch Day over Day to match. */
.dashboard-grid.templates-expanded > #dayOverDayContainer,
.dashboard-grid.spotlight-expanded > #dayOverDayContainer {
  align-self: start;
}
.dashboard-grid > #spotlightCard {
  grid-column: 2;
  grid-row: 2;
}
.dashboard-grid > #displayTemplatesBox {
  grid-column: 2;
  grid-row: 3;
}
/* Lock/Float drops to the next left-column row, below Day over Day. */
.dashboard-grid > #lockFloatBox {
  grid-column: 1;
  grid-row: 4;
}
/* Keep the Recipient List in the right column (no left-column partner). */
.dashboard-grid > #emailConfigSection {
  grid-column: 2;
}
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  /* Single column: let everything flow naturally in DOM order. */
  .dashboard-grid > #dayOverDayContainer,
  .dashboard-grid > #spotlightCard,
  .dashboard-grid > #displayTemplatesBox,
  .dashboard-grid > #lockFloatBox,
  .dashboard-grid > #emailConfigSection {
    grid-column: auto;
    grid-row: auto;
  }
}

/* --- AI Market Summary Card --- */
.ai-summary-card {
  background: var(--grey-card);
  border-top: 4px solid var(--teal);
  border-radius: 0 0 8px 8px;
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.ai-summary-card .card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ai-summary-card .card-actions {
  display: flex;
  gap: 6px;
}
.ai-summary-card .card-actions .button {
  font-size: 0.68rem;
  height: 26px;
  padding: 0 10px;
  border-radius: 4px;
  font-family: -apple-system, sans-serif;
}
.ai-summary-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-body);
}
.ai-summary-body .loading-skeleton {
  background: linear-gradient(90deg, #dde2e8 25%, #eef1f5 50%, #dde2e8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 16px;
  margin-bottom: 10px;
}
.ai-summary-body .loading-skeleton:last-child {
  width: 60%;
}
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.ai-timestamp {
  margin-top: 18px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  font-family: -apple-system, sans-serif;
}

.market-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.market-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.75rem;
  color: #475569;
  font-family: -apple-system, sans-serif;
}
.market-indicator .ind-label {
  font-weight: 500;
  color: #64748b;
}
.market-indicator .ind-value {
  font-weight: 700;
  color: #1e293b;
}

.ai-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  font-family: -apple-system, sans-serif;
}
.ai-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}
.ai-stat-pill.is-up {
  background: #ecfdf5;
  color: #059669;
}
.ai-stat-pill.is-down {
  background: #fef2f2;
  color: #dc2626;
}
.ai-stat-pill.is-flat {
  background: #f1f5f9;
  color: #64748b;
}

/* --- Pricing Desk Notations Card --- */
.notations-card {
  background: var(--cream);
  border: 1px solid var(--cream-border);
  border-radius: 8px;
  padding: 20px 22px;
}
.notations-display {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-body);
  min-height: 60px;
  /* Static height: scroll inside when the text grows, no scrollbar otherwise. */
  max-height: 140px;
  overflow-y: auto;
}
.notations-display.is-empty {
  color: var(--text-muted);
  font-style: italic;
}
.notations-card textarea {
  border: 1px solid var(--cream-border);
  border-radius: 6px;
  padding: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  width: 100%;
  min-height: 100px;
  background: var(--white);
  font-family: inherit;
}
.notations-card textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.15);
}

/* --- Product Spotlight Card --- */
.spotlight-card {
  background: var(--teal);
  border-radius: 8px;
  padding: 22px 24px;
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.spotlight-card .spotlight-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 8px;
  font-family: -apple-system, sans-serif;
}
.spotlight-card .spotlight-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.2;
}
.spotlight-card .spotlight-emoji {
  float: right;
  /* Fixed box so any emoji fits the same footprint and never overflows. */
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  line-height: 1;
  overflow: hidden;
  margin-left: 8px;
  margin-top: 20px;
}
.spotlight-card .spotlight-desc {
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 16px;
  /* Static height: scroll inside when the text grows, no scrollbar otherwise. */
  max-height: 140px;
  overflow-y: auto;
}
.spotlight-card .spotlight-btn {
  display: inline-block;
  background: rgba(0, 0, 0, 0.25);
  color: var(--white);
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: -apple-system, sans-serif;
}
.spotlight-card .spotlight-btn:hover {
  background: rgba(0, 0, 0, 0.35);
}
.spotlight-card .spotlight-edit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.spotlight-card .spotlight-edit-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Spotlight edit mode */
.spotlight-edit input,
.spotlight-edit textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 0.85rem;
  margin-bottom: 8px;
  font-family: inherit;
}
.spotlight-edit input::placeholder,
.spotlight-edit textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
.spotlight-edit input:focus,
.spotlight-edit textarea:focus {
  outline: none;
  border-color: var(--gold-light);
}
.spotlight-edit .edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.spotlight-edit .edit-actions button {
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-family: -apple-system, sans-serif;
}
.spot-edit-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin: 8px 0 3px;
}
.spot-edit-label:first-child {
  margin-top: 0;
}
.spotlight-edit .btn-save,
.edit-actions .btn-save {
  background: var(--gold-light);
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
}
.spotlight-edit .btn-cancel,
.edit-actions .btn-cancel {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
}

/* === DAY OVER DAY + LOCK/FLOAT === */
.white-box {
  background: var(--white);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: visible;
}

/* Flex column so the data area fills the stretched card and scrolls; title stays fixed. */
#dayOverDayContainer {
  display: flex;
  flex-direction: column;
  /* min-height:0 lets the data area's overflow absorb tall tables, not the row. */
  min-height: 0;
}
#dayOverDayContent {
  flex: 1 1 auto;
  min-height: 0;
  /* Cap height so the data scrolls instead of stretching the card further. */
  max-height: 420px;
  overflow-y: auto;
}
.table.is-pricing {
  font-size: 0.8rem;
  font-family: -apple-system, sans-serif;
  table-layout: fixed;
  width: 100%;
}
.table.is-pricing th {
  background: #fafafa;
  font-weight: 600;
  font-size: 1.2rem;
  white-space: nowrap;
  /* Freeze the Product / Rate / Price / Lock header when the data scrolls. */
  position: sticky;
  top: 0;
  z-index: 2;
}
.table.is-pricing th:first-child {
  width: auto;
}
.table.is-pricing th:not(:first-child) {
  text-align: left;
}
.table.is-pricing td {
  vertical-align: middle;
  font-size: 0.9rem;
}
.table.is-pricing td:first-child {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}
.table.is-pricing td:not(:first-child) {
  white-space: nowrap;
  text-align: left;
  padding-left: 6px;
  padding-right: 6px;
}
.rate-display {
  font-size: 0.8rem;
  font-family: -apple-system, sans-serif;
}
.inline-edit {
  padding: 4px 8px;
  border: 1px solid #e0dede;
  border-radius: 4px;
  font-size: 0.8rem;
  text-align: left;
  background: transparent;
  width: 90px;
  height: 28px;
  box-sizing: border-box;
  font-family: -apple-system, sans-serif;
}
.inline-edit:hover {
  border-color: var(--border);
}
.inline-edit:focus {
  border-color: var(--teal-light);
  outline: none;
  background: #fff;
}
.price-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.price-edit-indicator {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(184, 134, 11, 0.12);
  color: var(--gold);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: help;
  white-space: nowrap;
}
.price-edit-indicator[hidden] {
  display: none;
}
.rate-dropdown {
  position: relative;
  display: inline-block;
  min-width: 90px;
}
.rate-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  height: 28px;
  border: 1px solid #e0dede;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: -apple-system, sans-serif;
  user-select: none;
  box-sizing: border-box;
}
.rate-dropdown-trigger:hover {
  border-color: var(--border);
}
.rate-dropdown-caret {
  font-size: 0.55rem;
  color: var(--text-muted);
  line-height: 1;
}
.rate-dropdown-menu {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 2px);
  min-width: 90px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.rate-dropdown-menu::-webkit-scrollbar {
  display: none;
}
.rate-dropdown-menu.is-open {
  display: block;
}
.rate-dropdown-item {
  padding: 5px 10px;
  font-size: 0.78rem;
  font-family: -apple-system, sans-serif;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  color: var(--text-dark);
}
.rate-dropdown-item:hover {
  background: var(--grey-bg);
}
.rate-dropdown-item.is-selected {
  background: var(--teal);
  color: #fff;
}
.bps-up {
  color: #27ae60;
  font-weight: 600;
}
.bps-down {
  color: #c0392b;
  font-weight: 600;
}
.bps-flat {
  color: #7a7a7a;
  font-weight: 600;
}
.template-section {
  margin-bottom: 24px;
}
.template-section:last-child {
  margin-bottom: 0;
}
.template-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--teal);
}
.template-group-row td {
  background: var(--grey-card);
  padding-top: 12px !important;
  padding-bottom: 6px !important;
  border-bottom: 2px solid var(--teal);
  z-index: 1;
}
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #dbdbdb;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-bar {
  border-radius: 6px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  display: none;
  font-family: -apple-system, sans-serif;
}
.status-bar.is-success {
  background: #effaf3;
  border: 1px solid #b5dfca;
  color: #257942;
}
.status-bar.is-error {
  background: #feecf0;
  border: 1px solid #f9c0cc;
  color: #cc0f35;
}
.status-bar.is-info {
  background: #f0f7ff;
  border: 1px solid #d0e3f7;
  color: #296fa8;
}

/* ===== Toast Notifications ===== */
#toastContainer {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: -apple-system, sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  pointer-events: all;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.toast-show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success {
  background: #effaf3;
  border: 1px solid #b5dfca;
  color: #257942;
}
.toast-error {
  background: #feecf0;
  border: 1px solid #f9c0cc;
  color: #cc0f35;
}
.toast-info {
  background: #f0f7ff;
  border: 1px solid #d0e3f7;
  color: #296fa8;
}
.toast-message {
  flex: 1;
  line-height: 1.4;
}
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.5;
  padding: 0;
  color: inherit;
  flex-shrink: 0;
}
.toast-close:hover {
  opacity: 1;
}
.date-input {
  max-width: 180px;
}
.empty-state {
  text-align: center;
  padding: 40px;
  color: #7a7a7a;
  font-family: -apple-system, sans-serif;
}
.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
  color: #dbdbdb;
}
textarea.textarea {
  font-size: 0.9rem;
}
.history-badge {
  display: inline-block;
  background: #f5f5f5;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  margin: 2px;
  font-family: -apple-system, sans-serif;
}

/* Edit toggle button */
.edit-toggle {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: -apple-system, sans-serif;
}
.edit-toggle:hover {
  background: #f5f5f5;
  color: var(--teal);
}
.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  &:hover {
    background: none;
    color: var(--text-muted);
  }
}
.edit-toggle i {
  font-size: 0.6rem;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-header .section-title {
  margin-bottom: 0;
}
.section-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.picker-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  text-align: right;
}
.picker-done-btn {
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}
.picker-done-btn:hover {
  background: var(--teal-light);
}

/* === Interest Rate Index === */
.rate-index-section {
  margin-top: 20px;
}
.rate-index-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.rate-index-card .section-header {
  padding: 16px 20px 0;
}
.rate-index-config {
  padding: 16px 20px;
  background: #fafbfc;
  border-top: 1px solid var(--border);
  font-family: -apple-system, sans-serif;
  font-size: 0.8rem;
}
.rate-index-config label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}
.rate-index-config select,
.rate-index-config input[type="text"] {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  width: 100%;
}
.rate-index-config .config-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
/* Rate Chart Toggle Buttons */
.rate-chart-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.rate-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition:
    opacity 0.15s,
    border-color 0.15s;
  user-select: none;
}
.rate-toggle .color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.rate-toggle.is-active {
  border-color: currentColor;
  opacity: 1;
}
.rate-toggle.is-inactive {
  opacity: 0.4;
  border-color: var(--border);
}
.rate-toggle:hover {
  opacity: 0.8;
}

/* === Template Picker === */
.template-picker {
  font-family: -apple-system, sans-serif;
}
#templatePickerList {
  max-height: calc(6 * 37px);
  overflow-y: auto;
}
.template-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.82rem;
}
.template-picker-item:last-child {
  border-bottom: none;
}
.template-picker-item input[type="checkbox"] {
  cursor: pointer;
}
.template-picker-item .tmpl-name {
  flex: 1;
}
.template-picker-actions {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  position: relative;
}
.recipient-input-error {
  display: none;
  color: #c0392b;
  font-size: 0.72rem;
  padding: 4px 12px;
}
.recipient-picker-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  text-align: right;
}
.recipient-picker .btn-save {
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}
.template-picker-actions input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.78rem;
}
.template-picker-actions button {
  padding: 5px 12px;
  border: none;
  background: var(--teal);
  color: white;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}
.template-search-dropdown {
  display: none;
  position: absolute;
  left: 12px;
  right: 60px;
  top: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 180px;
  overflow-y: auto;
  z-index: 10;
}
.template-search-dropdown.active {
  display: block;
}
.template-search-item {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border);
}
.template-search-item:last-child {
  border-bottom: none;
}
.template-search-item:not(.is-added):hover {
  background: var(--bg-light);
}
.template-search-item.is-added {
  cursor: default;
  opacity: 0.55;
}
.template-search-item .ts-info {
  flex: 1;
  min-width: 0;
}
.ts-already-added {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-style: italic;
}
.template-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.template-search-item .ts-name {
  font-weight: 600;
}
.template-search-item .ts-id {
  color: var(--text-muted);
  font-size: 0.68rem;
}

/* === Recipient List === */
.hidden {
  display: none;
}
.recipient-picker {
  font-family: -apple-system, sans-serif;
}
#templatesContent,
#recipientsContent {
  max-height: calc(6 * 22px);
  overflow-y: auto;
}
#recipientPickerList {
  max-height: calc(5 * 37px);
  overflow-y: auto;
}
.employee-search-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 60px;
  bottom: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  max-height: 180px;
  overflow-y: auto;
  z-index: 10;
}
.employee-search-dropdown.active {
  display: block;
}
.employee-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.78rem;
  cursor: pointer;
}
.employee-search-item.is-added {
  cursor: default;
  opacity: 0.55;
}
.employee-search-item:not(.is-added):hover {
  background: #f0fbf9;
}
.employee-search-item:last-child {
  border-bottom: none;
}
.employee-search-item .emp-info {
  flex: 1;
  min-width: 0;
}
.employee-search-item .emp-name {
  font-weight: 600;
  color: var(--text-dark);
}
.employee-search-item .emp-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.emp-already-added {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-style: italic;
}
.employee-search-empty {
  padding: 10px 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}
.recipient-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.82rem;
  font-family: -apple-system, sans-serif;
}
.recipient-picker-item:last-child {
  border-bottom: none;
}
.recipient-picker-item input[type="checkbox"] {
  cursor: pointer;
  flex-shrink: 0;
}
.recipient-picker-item .rcpt-name {
  font-weight: 600;
  flex: 1;
}
.recipient-picker-item .rcpt-email {
  color: var(--text-muted);
  font-size: 0.7rem;
}
.rcpt-remove {
  flex-shrink: 0;
  background: none;
  border: 1px solid #e0e0e0;
  color: #999;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rcpt-remove:hover {
  border-color: #c0392b;
  color: #c0392b;
  background: #feecf0;
}
