/* ============ RESET & BASE ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1B4F72;
  --primary-light: #2471A3;
  --primary-dark: #154360;
  --bg-light: #EBF5FB;
  --bg-mid: #D6EAF8;
  --success: #27AE60;
  --warning: #E67E22;
  --danger: #E24B4A;
  --dark: #333333;
  --muted: #666666;
  --light-gray: #f0f2f5;
  --border: #ddd;
  --white: #fff;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 6px;
  --radius-lg: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--light-gray);
  color: var(--dark);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

/* ============ SIDEBAR ============ */
#sidebar {
  width: 220px;
  background: var(--primary);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-header .subtitle {
  font-size: 11px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.user-block {
  margin: 10px 20px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
}
.user-block .user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.user-block .logout-btn {
  background: transparent;
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}
.user-block .logout-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* Scrollable container holding all the nav groups. Header + user block
   stay fixed at the top; this fills the rest and scrolls when too tall. */
.nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
}
/* Custom scrollbar so it doesn't clash with the dark sidebar */
.nav-scroll::-webkit-scrollbar { width: 6px; }
.nav-scroll::-webkit-scrollbar-track { background: transparent; }
.nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}
.nav-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

.nav-group {
  margin-top: 6px;
}
.nav-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.5);
  padding: 14px 20px 4px;
}

.nav-links {
  list-style: none;
  padding: 0 0 6px;
}

.nav-links li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.15s;
}

.nav-links li a:hover {
  background: rgba(255,255,255,0.1);
  color: var(--white);
}

.nav-links li a.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  font-weight: 600;
  border-left: 3px solid var(--white);
}

/* ============ MAIN CONTENT ============ */
#main-content {
  margin-left: 220px;
  flex: 1;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-spacer { flex: 1; }

.last-sync {
  font-size: 12px;
  color: var(--muted);
}

.topbar-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topbar-sync-btn .sync-icon {
  font-size: 16px;
  display: inline-block;
}

.topbar-sync-btn.syncing .sync-icon {
  animation: spin 1s linear infinite;
}

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

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 10px;
  color: var(--dark);
}

#main-view {
  padding: 24px;
  flex: 1;
}

/* ============ BADGES ============ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-danger { background: var(--danger); color: var(--white); }
.badge-warning { background: var(--warning); color: var(--white); }
.badge-success { background: var(--success); color: var(--white); }
.badge-primary { background: var(--primary); color: var(--white); }
.badge-muted { background: #aaa; color: var(--white); }
.badge-auto { background: var(--bg-mid); color: var(--primary); font-size: 10px; padding: 1px 6px; margin-left: 4px; }

.badge-high { background: var(--danger); color: var(--white); }
.badge-medium { background: var(--warning); color: var(--white); }
.badge-low { background: #aaa; color: var(--white); }

.badge-stage-new { background: var(--primary); color: var(--white); }
.badge-stage-contacted { background: #2980B9; color: var(--white); }
.badge-stage-interested { background: var(--warning); color: var(--white); }
.badge-stage-viewing_booked { background: #8E44AD; color: var(--white); }
.badge-stage-negotiating { background: #D4AC0D; color: var(--white); }
.badge-stage-won { background: var(--success); color: var(--white); }
.badge-stage-lost { background: var(--danger); color: var(--white); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #219a52; }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #cf6d17; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c0392b; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--dark);
}
.btn-outline:hover { background: var(--light-gray); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
  font-size: 16px;
}
.btn-icon:hover { color: var(--dark); }

.btn-group { display: flex; gap: 6px; }

/* ============ CARDS ============ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

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

.card-header h3 { font-size: 16px; font-weight: 600; }

/* ============ PIPELINE / KANBAN ============ */
.pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.pipeline-header h1 { font-size: 22px; font-weight: 700; }

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: calc(100vh - 140px);
}

/* ============ NEW PROSPECTS NEEDING STORA CONVERSION ============ */
.needs-converting-banner {
  background: linear-gradient(180deg, #FFF4E6 0%, #FFE9CC 100%);
  border: 1.5px solid #E67E22;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 2px 6px rgba(230, 126, 34, 0.15);
}
.needs-converting-header {
  margin-bottom: 12px;
}
.needs-converting-header strong {
  color: #D35400;
  font-size: 14px;
}
.needs-converting-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.needs-converting-card {
  background: var(--white);
  border: 1px solid #E67E22;
  border-radius: var(--radius);
  padding: 10px 12px;
  min-width: 200px;
  max-width: 240px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.needs-converting-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(230, 126, 34, 0.25);
}
.ncc-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.ncc-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.ncc-days {
  font-weight: 500;
}
.ncc-contact {
  font-size: 13px;
}
.ncc-stora-link {
  display: inline-block;
  font-size: 12px;
  color: #D35400;
  font-weight: 600;
  text-decoration: none;
  background: #FFE9CC;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  margin-top: 2px;
}
.ncc-stora-link:hover {
  background: #E67E22;
  color: #fff;
}

.kanban-column {
  min-width: 240px;
  max-width: 260px;
  flex: 1;
  background: var(--light-gray);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kanban-column-header .count {
  background: rgba(0,0,0,0.15);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.kanban-column[data-stage="new"] .kanban-column-header { background: var(--primary); color: var(--white); }
.kanban-column[data-stage="contacted"] .kanban-column-header { background: #2980B9; color: var(--white); }
.kanban-column[data-stage="interested"] .kanban-column-header { background: var(--warning); color: var(--white); }
.kanban-column[data-stage="viewing_booked"] .kanban-column-header { background: #8E44AD; color: var(--white); }
.kanban-column[data-stage="negotiating"] .kanban-column-header { background: #D4AC0D; color: var(--white); }
.kanban-column[data-stage="won"] .kanban-column-header { background: var(--success); color: var(--white); }
.kanban-column[data-stage="lost"] .kanban-column-header { background: var(--danger); color: var(--white); }
.kanban-column[data-stage="no_response"] .kanban-column-header { background: #E67E22; color: var(--white); }
.kanban-column.col-no-response { background: #FFF4E6; }
.col-hint { font-size: 12px; opacity: 0.85; cursor: help; }

/* No-response styling on kanban cards */
.kanban-card.is-no-response { border-left: 4px solid #E67E22; }
.card-no-response-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #E67E22;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* No-response badge in call list */
.badge-no-response {
  background: #E67E22;
  color: var(--white);
}

.kanban-cards {
  padding: 8px;
  flex: 1;
  overflow-y: auto;
  min-height: 60px;
}

.kanban-cards.drag-over {
  background: var(--bg-mid);
}

.kanban-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: box-shadow 0.15s;
  border-left: 3px solid transparent;
}

.kanban-card:hover {
  box-shadow: var(--shadow);
}

.kanban-card.priority-High { border-left-color: var(--danger); }
.kanban-card.priority-Medium { border-left-color: var(--warning); }
.kanban-card.priority-Low { border-left-color: #aaa; }

.kanban-card.dragging { opacity: 0.5; }

.kanban-card .card-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.kanban-card .card-unit {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.kanban-card .card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}

.kanban-card .card-price {
  font-weight: 600;
  color: var(--success);
}

/* ============ TABLE ============ */
.table-container { overflow-x: auto; }

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

thead th {
  background: var(--bg-light);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

thead th:hover { background: var(--bg-mid); }

tbody tr {
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.1s;
}

tbody tr:hover { background: var(--bg-light); }

td {
  padding: 10px 12px;
  vertical-align: middle;
}

.td-name { font-weight: 600; }
.td-muted { color: var(--muted); font-size: 12px; }

/* ============ BULK ACTIONS BAR ============ */
.bulk-bar {
  position: sticky;
  bottom: 16px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  z-index: 20;
}
.bulk-count { font-weight: 600; font-size: 14px; }
.bulk-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}
.bulk-actions select {
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 4px;
  font-size: 13px;
}
.bulk-actions select option { color: #333; }

/* ============ FILTERS BAR ============ */
.filters-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters-bar input,
.filters-bar select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--white);
}

.filters-bar input { min-width: 220px; }

/* ============ CALL LIST ============ */
.calllist-row {
  display: grid;
  grid-template-columns: 40px 180px 1fr 200px 280px;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.1s;
  align-items: center;
}

.calllist-row:hover { background: var(--bg-light); }
.calllist-row:last-child { border-bottom: none; }
/* Leads whose wanted unit is full — visually de-emphasised */
.calllist-row-blocked { opacity: 0.72; }
.calllist-row-blocked:hover { opacity: 1; }
.calllist-blocked-section summary { list-style: none; }
.calllist-blocked-section summary::-webkit-details-marker { display: none; }

.calllist-rank {
  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.calllist-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.calllist-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calllist-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--dark);
}

.calllist-unit {
  font-size: 13px;
  color: var(--muted);
}

.calllist-contact { margin-top: 2px; }

.calllist-notes {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
  background: var(--light-gray);
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 3px solid var(--primary);
}

.calllist-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calllist-price {
  font-weight: 700;
  color: var(--success);
  font-size: 16px;
}

.calllist-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

/* Keep older .call-list-item styles for backward compat if used elsewhere */
.call-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.call-list-item:hover { background: var(--bg-light); }
.call-rank { font-size: 18px; font-weight: 700; color: var(--muted); min-width: 30px; text-align: center; }
.call-info { flex: 1; }
.call-info .name { font-weight: 600; font-size: 14px; }
.call-info .unit { font-size: 12px; color: var(--muted); }
.call-meta { text-align: right; font-size: 12px; color: var(--muted); }
.call-meta .price { font-weight: 600; color: var(--success); font-size: 14px; }

@media (max-width: 1400px) {
  .calllist-row {
    grid-template-columns: 40px 140px 1fr 260px;
    grid-template-areas: "rank badges main meta" "rank badges main actions";
    row-gap: 8px;
  }
  .calllist-rank { grid-area: rank; }
  .calllist-badges { grid-area: badges; flex-direction: column; align-items: flex-start; }
  .calllist-main { grid-area: main; }
  .calllist-meta { grid-area: meta; }
  .calllist-actions { grid-area: actions; }
}

/* ============ REMINDERS ============ */
.reminder-section { margin-bottom: 24px; }
.reminder-section h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.reminder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
}

.reminder-item.overdue { background: #fef2f2; }

.reminder-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--success);
}

.reminder-content { flex: 1; }
.reminder-content .reminder-text { font-size: 13px; }
.reminder-content .reminder-prospect {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

.reminder-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.reminder-date.overdue-text { color: var(--danger); font-weight: 600; }

/* Owner badge + filter row on each reminder */
.reminder-prospect-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.reminder-owner {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg-light);
  color: var(--muted);
  border: 1px solid var(--border);
}
.reminder-owner.is-me {
  background: #EBF5FB;
  color: var(--primary);
  border-color: #BDC3C7;
  font-weight: 600;
}
.reminder-owner.unassigned {
  background: #FDF2E9;
  color: #B65A0A;
  border-color: #F5CBA7;
  font-style: italic;
}

/* "How auto-reminders work" expandable help card */
.reminder-help-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.reminder-help-card summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  user-select: none;
  outline: none;
}
.reminder-help-card summary:hover { background: var(--bg-light); }
.reminder-help-card[open] summary { border-bottom: 1px solid var(--border); }
.reminder-help-body {
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.6;
}
.reminder-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 10px;
}
.reminder-help-stage {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.reminder-help-stage-name {
  font-size: 13px;
  margin-bottom: 6px;
}
.reminder-help-stage ul {
  margin: 0;
  padding-left: 20px;
  font-size: 12.5px;
}
.reminder-help-stage li { margin-bottom: 2px; }

/* ============ REPORTS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.stat-card .stat-hint {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.3;
  opacity: 0.75;
  font-style: italic;
}

/* ============ OCCUPANCY CARD ============ */
.occupancy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 10px;
}
.occupancy-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg-light);
}
.occupancy-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  margin-bottom: 8px;
}
.occupancy-bar {
  position: relative;
  height: 28px;
  background: #E8F8F5;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.occupancy-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(90deg, #4ECDC4 0%, #2ECC71 100%);
  transition: width 0.3s ease;
}
.occupancy-bar-text {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  line-height: 28px;
  padding: 0 10px;
}
.occupancy-meta {
  font-size: 11.5px;
  color: var(--muted);
}
.occupancy-details {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.occupancy-details summary {
  font-size: 11.5px;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
}
.occupancy-details summary:hover {
  text-decoration: underline;
}
.occupancy-units-list {
  margin-top: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.occupancy-unit-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #DCDCDC;
  color: #444;
  white-space: nowrap;
  font-family: monospace;
}
.occupancy-unit-chip.status-occupied { background: #4ECDC4; color: #fff; }
.occupancy-unit-chip.status-reserved { background: #A8E6CE; color: #2c5e54; }
.occupancy-unit-chip.status-unavailable {
  background: repeating-linear-gradient(45deg, #f5f5f5, #f5f5f5 3px, #ddd 3px, #ddd 6px);
  color: #999;
}

/* ============ BREAK-EVEN CALCULATOR ============ */
.be-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.be-snapshot-item {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.be-snapshot-item .be-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}
.be-snapshot-item .be-lbl {
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.3px;
  margin-top: 4px;
}
.be-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.be-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.be-input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.be-input input {
  padding: 8px 10px;
  border: 1.5px solid #FFE89A;
  background: #FFFCEB;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
}
.be-input input:disabled {
  background: var(--bg-light);
  border-color: var(--border);
  color: var(--muted);
  font-weight: normal;
}
.be-input-hint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}
.be-big-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.be-big-stat {
  text-align: center;
  padding: 10px;
  background: var(--bg-light);
  border-radius: var(--radius);
}
.be-big-stat .be-big-num {
  font-size: 22px;
  font-weight: 700;
}
.be-big-stat .be-big-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Break-even hero */
.be-hero { background: linear-gradient(135deg, #2C3E50 0%, #16A085 100%); color: #fff; }
.be-hero h3 { color: #fff; }
.be-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}
.be-hero-block {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.be-hero-block.be-hero-primary { background: rgba(255, 255, 255, 0.2); }
.be-hero-block.be-hero-realistic { background: rgba(0, 0, 0, 0.15); }
.be-hero-num {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}
.be-hero-unit {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
  opacity: 0.9;
}
.be-hero-sub {
  font-size: 11px;
  margin-top: 6px;
  opacity: 0.75;
}
.be-hero-progress {
  margin-top: 8px;
}
.be-progress-track {
  position: relative;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  overflow: visible;
}
.be-progress-current {
  height: 100%;
  background: linear-gradient(90deg, #2ECC71, #16A085);
  border-radius: 12px 0 0 12px;
}
.be-progress-target {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  background: #E74C3C;
  border-radius: 2px;
}
.be-progress-target::after {
  content: 'T';
  position: absolute;
  bottom: -16px;
  left: -4px;
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}
.be-progress-steady {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  background: #BB8FCE;
  border-radius: 2px;
}
.be-progress-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 12px;
}

/* Projection chart */
.be-chart {
  width: 100%;
  height: auto;
  margin-top: 10px;
  background: var(--bg-light);
  border-radius: var(--radius);
}
.be-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.be-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}

/* ============ ASK AI ============ */
.ai-question-input {
  width: 100%;
  font-size: 15px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}
.ai-question-input:focus {
  border-color: var(--primary);
  outline: none;
}
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ai-suggestion {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  color: var(--text);
}
.ai-suggestion:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.ai-chat-entry {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.ai-chat-q {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ai-chat-q strong { color: var(--text); }
.ai-chat-a {
  font-size: 14px;
  line-height: 1.6;
}
.ai-chat-a p { margin: 0 0 10px; }
.ai-chat-a p:last-child { margin-bottom: 0; }
.ai-chat-a ul, .ai-chat-a ol { margin: 8px 0; padding-left: 22px; }
.ai-chat-a li { margin-bottom: 4px; }
.ai-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}
.ai-table th, .ai-table td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.ai-table th {
  background: var(--bg-light);
  font-weight: 600;
}
.ai-table-wrap { margin: 10px 0; }
.ai-table-actions { margin-top: 6px; }
.ai-deeplink {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dotted var(--primary);
  font-weight: 500;
}
.ai-deeplink:hover {
  background: #EBF5FB;
  text-decoration: none;
  border-bottom-style: solid;
}
.ai-tool-debug {
  margin-top: 10px;
  font-size: 11px;
}
.ai-tool-debug summary {
  color: var(--muted);
  cursor: pointer;
}
.ai-tool-debug pre {
  background: var(--bg-light);
  padding: 8px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 10.5px;
  margin-top: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.ai-chat-entry.pending {
  border-color: var(--primary);
  background: linear-gradient(90deg, var(--white) 0%, #EBF5FB 50%, var(--white) 100%);
  background-size: 200% 100%;
  animation: ai-pulse 2s ease-in-out infinite;
}
@keyframes ai-pulse {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}
.ai-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}
.ai-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes ai-spin {
  to { transform: rotate(360deg); }
}
.ai-loading-title { font-size: 14px; font-weight: 600; }
.ai-loading-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

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

.bar-chart { margin-top: 10px; }

.bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}

.bar-label {
  min-width: 120px;
  font-size: 12px;
  text-align: right;
  color: var(--muted);
}

.bar-track {
  flex: 1;
  height: 22px;
  background: var(--light-gray);
  border-radius: var(--radius);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius);
  background: var(--primary);
  transition: width 0.5s;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 11px;
  color: var(--white);
  font-weight: 600;
  min-width: fit-content;
}

.bar-fill.type-self-storage { background: var(--primary); }
.bar-fill.type-office { background: var(--warning); }
.bar-fill.type-workshop { background: var(--success); }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  animation: modal-fade-in 0.12s ease-out;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 800px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  animation: modal-slide-in 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  /* GPU-accelerated transform makes this feel instant */
  will-change: transform;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-slide-in {
  from { transform: translateY(-8px); opacity: 0.5; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-sm { max-width: 520px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

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

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.btn-close:hover { color: var(--dark); }

.modal-body { padding: 24px; }

/* ============ DETAIL VIEW ============ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}

.detail-main { min-width: 0; }

.detail-sidebar .info-section {
  margin-bottom: 18px;
}

.detail-sidebar .info-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.info-row .label { color: var(--muted); }
.info-row .value { font-weight: 500; text-align: right; }
.inline-edit-group { display: inline-flex; align-items: center; gap: 4px; }
.inline-edit-group .btn-icon { font-size: 12px; padding: 2px; opacity: 0.4; transition: opacity 0.15s; }
.inline-edit-group:hover .btn-icon { opacity: 1; }

.stage-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* Friendly compact action bar shown under the stage row */
.action-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

/* "More" dropdown menu */
.more-menu-wrap {
  position: relative;
  display: inline-block;
}
.more-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  z-index: 1000;
  padding: 4px;
}
.more-menu.open { display: block; }
.more-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
}
.more-item:hover { background: var(--bg-light); }
.more-item.danger { color: var(--danger); }
.more-item.danger:hover { background: #FDECEC; }
.more-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 2px;
}

/* ============ SELLING POINTS ============ */
.sp-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-light);
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 12px;
}
.sp-toc-link {
  display: inline-block;
  padding: 4px 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.sp-toc-link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.sp-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.sp-section h3 { margin: 0 0 6px; font-size: 16px; }
.sp-hint {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 8px;
}
.sp-list {
  margin: 6px 0 0;
  padding-left: 22px;
  line-height: 1.7;
  font-size: 14px;
}
.sp-list li { margin-bottom: 4px; }
.sp-list-danger li { color: var(--text); }
.sp-list-danger li::marker { color: var(--danger); content: '✗ '; }
.sp-sub {
  margin-top: 12px;
  padding: 10px 14px;
  background: #FDEDEC;
  border-left: 3px solid var(--danger);
  border-radius: 4px;
}
.sp-sub-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}

/* ============ SITE MAP ============ */
.floorplan-scroll {
  overflow: auto;
  background: #FAF6EE; /* warm tan, similar to Stora's map */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.floorplan {
  position: relative;
}
.map-zone {
  position: absolute;
  display: flex;
  gap: 2px;
}
.map-zone-column { flex-direction: column; }
.map-zone-row { flex-direction: row; }
.map-zone-label {
  position: absolute;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  opacity: 0.5;
}
.map-zone-column > .map-zone-label { left: -24px; top: 0; }
.map-zone-row > .map-zone-label { left: -24px; top: 50%; transform: translateY(-50%); }
/* Long titles (e.g. "Office block — Ground floor") render above the zone
   so they don't horizontally overflow into the first cell */
.map-zone-label.header-label {
  position: absolute;
  left: 0;
  top: -22px;
  transform: none;
  font-size: 13px;
  opacity: 0.7;
  white-space: nowrap;
}
.map-cell {
  background: #E0E0E0;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
  overflow: hidden;
  text-align: center;
  padding: 2px;
  box-sizing: border-box;
}
.map-cell:hover {
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  filter: brightness(1.1);
}
.map-cell .map-ref {
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
  line-height: 1.2;
}
.map-cell .map-size {
  font-size: 10px;
  opacity: 0.9;
  white-space: nowrap;
  margin-top: 2px;
}
/* Status colours */
.map-cell.available { background: #DCDCDC; color: #444; }
.map-cell.occupied { background: #4ECDC4; color: #fff; }
.map-cell.reserved { background: #A8E6CE; color: #2c5e54; }
.map-cell.unavailable {
  background: repeating-linear-gradient(45deg, #f5f5f5, #f5f5f5 4px, #ddd 4px, #ddd 8px);
  color: #999;
  cursor: not-allowed;
}
.map-cell.unavailable:hover { transform: none; filter: none; box-shadow: none; }
.map-cell.missing {
  background: #fff;
  border-style: dashed;
  color: #bbb;
  cursor: default;
}

/* Legend chips at the top */
.map-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
}
.legend-swatch.available { background: #DCDCDC; }
.legend-swatch.occupied { background: #4ECDC4; }
.legend-swatch.unavailable { background: repeating-linear-gradient(45deg, #f5f5f5, #f5f5f5 3px, #ddd 3px, #ddd 6px); }

/* Priority pills (sidebar) */
.priority-pills {
  display: inline-flex;
  gap: 4px;
}
.priority-pill {
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.priority-pill:hover { background: var(--bg-light); }
.priority-pill.active { color: #fff; border-color: transparent; }
.priority-pill.high.active { background: var(--danger); }
.priority-pill.medium.active { background: var(--warning); }
.priority-pill.low.active { background: var(--muted); }

.stage-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 11px;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 500;
  transition: all 0.15s;
}

.stage-btn:hover { background: var(--bg-light); }
.stage-btn.active { color: var(--white); border-color: transparent; }
.stage-btn.active[data-stage="new"] { background: var(--primary); }
.stage-btn.active[data-stage="contacted"] { background: #2980B9; }
.stage-btn.active[data-stage="interested"] { background: var(--warning); }
.stage-btn.active[data-stage="viewing_booked"] { background: #8E44AD; }
.stage-btn.active[data-stage="negotiating"] { background: #D4AC0D; }
.stage-btn.active[data-stage="won"] { background: var(--success); }
.stage-btn.active[data-stage="lost"] { background: var(--danger); }

/* History entries */
.history-entry {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.history-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 5px;
  flex-shrink: 0;
}

.history-content { flex: 1; }
.history-method { font-weight: 600; font-size: 13px; }
.history-note { font-size: 13px; color: var(--dark); margin-top: 2px; }
.history-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Add history form */
.add-history-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.add-history-form select,
.add-history-form input,
.add-history-form textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
}

.add-history-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 60px;
}

/* Reminder in detail */
.detail-reminder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.detail-reminder.done { text-decoration: line-through; color: var(--muted); }

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
}

.form-group textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Email draft */
.email-draft {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
}

/* Units table */
.unit-status-Available { color: var(--success); font-weight: 600; }
.unit-status-Occupied { color: var(--danger); font-weight: 600; }
.unit-status-Reserved { color: var(--warning); font-weight: 600; }
.unit-status-Unavailable { color: var(--muted); font-weight: 600; }

/* ============ UTILITIES ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ============ MOBILE RESPONSIVE (≤768px) ============ */
@media (max-width: 768px) {
  /* Sidebar becomes a slide-in drawer */
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 260px;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #main-content {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: inline-block;
  }
  #topbar {
    padding: 8px 12px;
  }
  .last-sync {
    display: none; /* save space; user can check Integrations */
  }
  #main-view {
    padding: 12px;
  }

  /* Pipeline kanban: stack vertically, swipeable horizontal scroll preserved */
  .kanban-board {
    flex-direction: column;
    min-height: auto;
    gap: 16px;
  }
  .kanban-column {
    min-width: auto;
    max-width: none;
    max-height: 360px;
  }

  /* Tables become card-like rows */
  table thead {
    display: none; /* hide column headers, use labels in cells */
  }
  table, tbody, tr, td {
    display: block;
    width: 100%;
  }
  tbody tr {
    background: var(--white);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
  }
  tbody td {
    padding: 4px 0;
    border: none;
    font-size: 13px;
  }
  /* Show name in big bold */
  tbody td.td-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
  }

  /* Filters bar wraps */
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filters-bar input,
  .filters-bar select {
    width: 100%;
    min-width: 0;
  }

  /* Stats grid: single column */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stat-card .stat-value {
    font-size: 22px;
  }

  /* Modals: full screen on mobile */
  .modal-overlay {
    padding: 0;
  }
  .modal {
    max-height: 100vh;
    border-radius: 0;
    width: 100%;
    max-width: none;
  }

  /* Pipeline header / call list header stack */
  .pipeline-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* Call list rows stack */
  .calllist-row {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "badges"
      "main"
      "meta"
      "actions";
    gap: 8px;
  }
  .calllist-rank {
    display: none;
  }
  .calllist-meta {
    text-align: left;
  }

  /* Sidebar overlay backdrop */
  #sidebar.open::before {
    content: '';
    position: fixed;
    top: 0; left: 260px; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: -1;
  }

  /* Detail view: single column */
  .detail-grid {
    grid-template-columns: 1fr;
  }

  /* Chart grid: single column */
  .chart-grid {
    grid-template-columns: 1fr;
  }

  /* Bulk action bar: stack vertically */
  .bulk-bar {
    flex-direction: column;
    align-items: stretch;
    bottom: 8px;
  }
  .bulk-actions {
    margin-left: 0;
  }
}

/* Small phones (≤480px): tighter spacing */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .topbar-sync-btn .sync-label {
    display: none; /* show just the icon to save space */
  }
}

/* ============ PRICE CHEAT SHEET ============ */
.cheat-card { page-break-inside: avoid; }
/* Size & Space Helper result card — Workstore navy */
.sh-card {
  background: #2C4858;
  color: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  max-width: 460px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.cheat-table {
  font-size: 13px;
}
.cheat-table th {
  text-align: center;
  white-space: nowrap;
  background: var(--bg-light);
}
.cheat-table td {
  text-align: center;
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
}
.cheat-table td.td-name {
  text-align: left;
  font-weight: 600;
}
.cheat-table td.td-muted {
  text-align: left;
}
.cheat-discount {
  color: var(--success);
  font-weight: 500;
  background: rgba(39, 174, 96, 0.06);
}
.availability-chip {
  display: inline-block;
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.cheat-row-unavailable td {
  opacity: 0.55;
}
.cheat-row-unavailable td.td-name {
  opacity: 0.7;
  text-decoration: line-through;
  text-decoration-color: var(--danger);
}
.cheat-table tr:hover td { background: var(--bg-light); }
.cheat-table tr:hover td.cheat-discount { background: rgba(39, 174, 96, 0.12); }

@media print {
  #sidebar, #topbar, .pipeline-header > .flex { display: none !important; }
  #main-content { margin-left: 0; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .cheat-table { font-size: 11px; }
  .cheat-table td, .cheat-table th { padding: 4px 6px; }
}

/* ============ REVIEW STALE (Tinder-swipe style) ============ */
.review-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  max-width: 600px;
  margin: 20px auto;
  overflow: hidden;
}
.review-progress {
  height: 4px;
  background: var(--light-gray);
}
.review-progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}
.review-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px;
  background: linear-gradient(135deg, #EBF5FB 0%, #D6EAF8 100%);
}
.review-quiet {
  text-align: center;
  background: var(--white);
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.review-quiet-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--danger);
  line-height: 1;
}
.review-quiet-lbl {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.review-card-body {
  padding: 24px;
}
.review-info-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 12px;
}
.review-info-row.review-warn .review-info-value {
  color: var(--warning);
}
.review-info-label {
  min-width: 120px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.review-info-value {
  flex: 1;
  font-size: 14px;
}
.review-notes {
  margin-top: 16px;
  padding: 12px;
  background: #FFF9E5;
  border-left: 3px solid var(--warning);
  border-radius: 4px;
}
.review-notes .review-info-label {
  margin-bottom: 4px;
  min-width: 0;
}
.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 20px 24px;
  background: var(--light-gray);
}
.review-btn {
  background: var(--white);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 16px 8px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  text-align: center;
}
.review-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.review-btn-icon {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 6px;
}
.review-btn-label {
  font-size: 13px;
  font-weight: 600;
}
.review-btn-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.review-btn-key {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
}
.review-btn-dismiss { border-color: #FDEDEC; }
.review-btn-dismiss .review-btn-icon { color: var(--danger); }
.review-btn-dismiss:hover { border-color: var(--danger); background: #FDEDEC; }

.review-btn-snooze { border-color: #EBF5FB; }
.review-btn-snooze .review-btn-icon { color: var(--primary); }
.review-btn-snooze:hover { border-color: var(--primary); background: #EBF5FB; }

.review-btn-email { border-color: #FEF5E7; }
.review-btn-email .review-btn-icon { color: var(--warning); }
.review-btn-email:hover { border-color: var(--warning); background: #FEF5E7; }

.review-btn-keep { border-color: #E8F8F0; }
.review-btn-keep .review-btn-icon { color: var(--success); }
.review-btn-keep:hover { border-color: var(--success); background: #E8F8F0; }

.review-quick {
  padding: 12px 24px 20px;
  text-align: center;
  background: var(--light-gray);
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .review-actions { grid-template-columns: 1fr 1fr; }
  .review-btn-key { display: none; }
}

/* Clickable report bars */
.clickable-bar {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
  transition: background 0.1s;
}
.clickable-bar:hover {
  background: var(--bg-light);
}

/* Conversion rate rows */
.conversion-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.conversion-pct {
  display: inline-block;
  min-width: 50px;
  text-align: center;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}
.conversion-pct.low {
  background: #FDEDEC;
  color: var(--danger);
}
.conversion-pct.mid {
  background: #FEF5E7;
  color: var(--warning);
}
.conversion-pct.high {
  background: #E8F8F0;
  color: var(--success);
}

/* ============ NEW QOL FEATURE STYLES ============ */

/* Notification bell */
.notif-bell {
  background: none;
  border: none;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  font-size: 16px;
  position: relative;
  padding: 4px 6px;
  border-radius: 4px;
}
.notif-bell:hover { background: rgba(255,255,255,0.1); }
.notif-bell .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 9px;
  padding: 1px 5px;
}

/* Notification list items */
.notif-item {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.notif-item:hover { background: var(--bg-light); }
.notif-item.unread { background: #FFF9E5; }
.notif-item.unread .notif-title { font-weight: 600; }
.notif-title { font-size: 13px; margin-bottom: 2px; }
.notif-body { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.notif-meta { font-size: 11px; color: var(--muted); }

/* Sidebar quick-search button */
.sidebar-search-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 20px 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  width: calc(100% - 40px);
}
.sidebar-search-btn:hover { background: rgba(255,255,255,0.15); }
.kbd-hint {
  font-family: monospace;
  background: rgba(255,255,255,0.15);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 10px;
  margin-left: auto;
}

kbd {
  font-family: monospace;
  background: var(--light-gray);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  border: 1px solid var(--border);
}

/* Quick search dropdown rows */
.quicksearch-row {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  border-radius: 4px;
}
.quicksearch-row:hover, .quicksearch-row.selected {
  background: var(--bg-light);
}

/* Comment entries (internal team chat per prospect) */
.comment-entry {
  background: #FFF9E5;
  border-left: 3px solid var(--warning);
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 4px;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.comment-body { font-size: 13px; line-height: 1.5; color: #333; }
.mention {
  background: var(--primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

/* Tag chips */
.tag-chip {
  display: inline-block;
  background: var(--bg-mid);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-right: 2px;
}

/* Task rows */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #eee;
}
.task-row.overdue {
  background: #FDF2F2;
  border-left: 3px solid var(--danger);
}

/* Activity feed rows */
.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}
.activity-row:hover { background: var(--bg-light); }
.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
