:root {
  /* Shared "Pool Slate" theme — soft off-white surfaces on a blue-gray canvas, blue accents.
     The former teal accent is retired to a lighter blue so the whole UI is white/gray/blue. */
  --teal:        #3080d1;
  --teal-dark:   #1f66b0;
  --teal-light:  #e5eefb;
  --blue:        #185fa5;
  --blue-light:  #e8f0fb;
  --sidebar-bg:  #1b2534;
  --sidebar-w:   230px;
  --topbar-h:    56px;
  --bg:          #e9edf3;
  --card:        #fbfcfe;
  --border:      #dde3ec;
  --text:        #1e2733;
  --text-2:      #5c6674;
  --text-3:      #95a0b0;
  --green:       #22c55e;
  --green-light: #dcfce7;
  --red:         #ef4444;
  --red-light:   #fee2e2;
  --amber:       #f59e0b;
  --amber-light: #fef3c7;
  --purple:      #8b5cf6;
  --purple-light:#f3f0ff;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.14);
  --pool-blue: #b5d4f4; --pool-blue-text: #1a4a7a;
  --pool-pink: #f4c0d1; --pool-pink-text: #7a1a3a;
  --pool-mint: #9fe1cb; --pool-mint-text: #1a5a3a;
  --pool-purple: #cecbf6; --pool-purple-text: #3a1a7a;
  --pool-orange: #f4d4a0; --pool-orange-text: #7a3a1a;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); display: flex; height: 100vh; overflow: hidden; font-size: 14px; }

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--sidebar-bg);
  display: flex; flex-direction: column; height: 100vh; overflow-y: auto;
  position: fixed; left: 0; top: 0; z-index: 100;
}
#sidebar-logo {
  padding: 18px 20px 14px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
#sidebar-logo svg { color: var(--teal); flex-shrink: 0; }
#sidebar-logo .logo-text { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
#sidebar-logo .logo-sub { font-size: 10px; color: rgba(255,255,255,.4); font-weight: 500; }
#sidebar nav { flex: 1; padding: 10px 0; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.3);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 12px 20px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer; border-radius: 0;
  color: rgba(255,255,255,.6); font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
  position: relative; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(48,128,209,.18); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--teal); border-radius: 0 2px 2px 0;
}
.nav-item svg { flex-shrink: 0; width: 16px; height: 16px; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
}
#sidebar nav { flex: 1; }
#sidebar-bottom { margin-top: auto; }
#sidebar-user {
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info .name { font-size: 12px; font-weight: 600; color: #fff; }
.sidebar-user-info .role { font-size: 11px; color: rgba(255,255,255,.4); }

/* ── MAIN LAYOUT ── */
#main-wrap {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

/* ── TOPBAR ── */
#topbar {
  height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0;
  box-shadow: var(--shadow);
}
#topbar-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
#topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 12px; width: 220px;
}
#topbar-search input {
  border: none; background: transparent; outline: none;
  font-size: 13px; color: var(--text); font-family: inherit; width: 100%;
}
#topbar-search input::placeholder { color: var(--text-3); }
.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-2); position: relative; transition: background .15s;
}
.topbar-icon-btn:hover { background: var(--bg); }
.topbar-notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; background: var(--red); border-radius: 50%;
  border: 1.5px solid var(--card);
}
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; cursor: pointer;
  transition: box-shadow .12s;
}
.topbar-avatar:hover { box-shadow: 0 0 0 3px rgba(48,128,209,.2); }
#profile-menu-wrap { position: relative; }
.profile-menu {
  position: absolute; top: 44px; right: 0; width: 220px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 200; display: none;
}
.profile-menu.open { display: block; }
.profile-menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.profile-menu-name { font-size: 13px; font-weight: 700; color: var(--text); }
.profile-menu-role { font-size: 11px; color: var(--text-3); }
.profile-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: background .12s;
}
.profile-menu-item:hover { background: var(--bg); color: var(--text); }
.profile-menu-item.logout { color: var(--red); }
.profile-menu-item.logout:hover { background: var(--red-light); }
.profile-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── CONTENT AREA ── */
#content { flex: 1; overflow-y: auto; padding: 24px; }
.section { display: none; }
.section.active { display: block; }

/* ── CARDS & LAYOUT HELPERS ── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.flex-row { display: flex; align-items: center; gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-20 { margin-top: 20px; }
.mt-16 { margin-top: 16px; }
.mt-12 { margin-top: 12px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 20px; }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.teal  { background: var(--teal-light); color: var(--teal); }
.stat-icon.blue  { background: var(--blue-light); color: var(--blue); }
.stat-icon.green { background: var(--green-light); color: #16a34a; }
.stat-icon.amber { background: var(--amber-light); color: #d97706; }
.stat-icon.red   { background: var(--red-light); color: var(--red); }
.stat-icon.purple{ background: var(--purple-light); color: var(--purple); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 4px; font-weight: 500; }
.stat-sub   { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.stat-sub .up   { color: var(--green); font-weight: 600; }
.stat-sub .down { color: var(--red);   font-weight: 600; }

/* ── PILLS / BADGES ── */
.pill {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill.green  { background: var(--green-light);  color: #16a34a; }
.pill.red    { background: var(--red-light);    color: #dc2626; }
.pill.amber  { background: var(--amber-light);  color: #d97706; }
.pill.blue   { background: var(--blue-light);   color: var(--blue); }
.pill.teal   { background: var(--teal-light);   color: var(--teal-dark); }
.pill.gray   { background: #f1f3f5;             color: var(--text-3); }
.pill.purple { background: var(--purple-light); color: var(--purple); }
.day-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: #e8f0fb; color: #0c447c; white-space: nowrap;
}
.day-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: background .15s, opacity .15s;
  font-family: inherit; white-space: nowrap;
}
.btn:active { opacity: .85; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-secondary { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e9ecef; }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.btn-ghost { background: transparent; color: var(--text-2); padding: 6px 10px; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border); background: #fafbfc;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; cursor: pointer; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8f9fa; }
tbody td { padding: 12px 16px; color: var(--text); vertical-align: middle; }
.td-name { font-weight: 600; }
.td-sub  { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── SEARCH & FILTER BAR ── */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input {
  display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 12px; flex: 1; max-width: 320px;
}
.search-input input { border: none; background: transparent; outline: none; font-size: 13px; font-family: inherit; width: 100%; }

/* ── INNER TABS ── */
.inner-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.inner-tab {
  padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s; white-space: nowrap;
}
.inner-tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.inner-tab-panel { display: none; }
.inner-tab-panel.active { display: block; }

/* ── AVATAR ── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
  flex-shrink: 0; color: #fff;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; color: var(--text); background: var(--card); outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--teal); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  transform: translateY(16px); transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-3); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}
.modal-lg { max-width: 740px; }

/* ── SLIDE PANEL ── */
.slide-panel-overlay {
  position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.3);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.slide-panel-overlay.open { opacity: 1; pointer-events: all; }
.slide-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100vw);
  background: var(--card); box-shadow: var(--shadow-lg); z-index: 901;
  transform: translateX(100%); transition: transform .25s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column; overflow: hidden;
}
.slide-panel-overlay.open .slide-panel { transform: translateX(0); }
.slide-panel-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.slide-panel-close { background: none; border: none; font-size: 22px; color: var(--text-3); cursor: pointer; margin-right: auto; }
.slide-panel-body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ── TOAST ── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #1a2332; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md);
  opacity: 0; transform: translateX(20px); transition: opacity .2s, transform .2s;
  max-width: 300px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }
.toast.info    { background: var(--blue); }

/* ── ACTIVITY FEED ── */
.activity-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px;
}
.activity-text { font-size: 13px; color: var(--text); flex: 1; }
.activity-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ── STOP CARD (schedule) ── */
.stop-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: box-shadow .15s;
}
.stop-card:hover { box-shadow: var(--shadow-md); }
.stop-card.completed { opacity: .55; }
.stop-card.active { border-color: var(--teal); }
.stop-card.en-route { border-color: var(--amber); }
.stop-name { font-size: 13px; font-weight: 600; color: var(--text); }
.stop-addr { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.stop-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot-complete { background: var(--green); }
.dot-active   { background: var(--teal); }
.dot-enroute  { background: var(--amber); }
.dot-pending  { background: #d1d5db; }

/* ── KANBAN ── */
.kanban-wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kanban-col { background: #f8f9fa; border-radius: 10px; padding: 14px; }
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.kanban-col-title { font-size: 13px; font-weight: 700; color: var(--text); }
.kanban-count {
  background: var(--border); color: var(--text-3); font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px;
}
.kanban-card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer;
  transition: box-shadow .15s; border: 1px solid transparent;
}
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: var(--teal-light); }
.kanban-client { font-size: 13px; font-weight: 600; color: var(--text); }
.kanban-service { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.kanban-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kanban-amount { font-size: 14px; font-weight: 700; color: var(--text); }
.kanban-date { font-size: 11px; color: var(--text-3); }

/* ── MESSAGES ── */
.msg-layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - var(--topbar-h) - 48px); gap: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.msg-sidebar { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.msg-sidebar-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.msg-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 6px; padding: 6px 10px; }
.msg-search input { border: none; background: transparent; outline: none; font-size: 12px; font-family: inherit; width: 100%; }
.thread-list { flex: 1; overflow-y: auto; }
.thread-item {
  padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-start; transition: background .12s;
}
.thread-item:hover { background: var(--bg); }
.thread-item.active { background: var(--teal-light); }
.thread-info { flex: 1; min-width: 0; }
.thread-name { font-size: 13px; font-weight: 600; color: var(--text); }
.thread-preview { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.thread-time { font-size: 11px; color: var(--text-3); }
.thread-unread { background: var(--teal); color: #fff; font-size: 10px; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: 2px; flex-shrink: 0; }
.msg-main { display: flex; flex-direction: column; overflow: hidden; }
.msg-main-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.msg-main-title { font-size: 15px; font-weight: 700; }
.msg-main-sub { font-size: 12px; color: var(--text-3); }
.msg-bubbles { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble-wrap { display: flex; gap: 8px; max-width: 75%; }
.bubble-wrap.out { align-self: flex-end; flex-direction: row-reverse; }
.bubble {
  padding: 9px 14px; border-radius: 14px; font-size: 13px; line-height: 1.4;
}
.bubble-wrap.in  .bubble { background: #f0f2f5; color: var(--text); border-bottom-left-radius: 4px; }
.bubble-wrap.out .bubble { background: var(--teal); color: #fff; border-bottom-right-radius: 4px; }
.bubble-time { font-size: 10px; color: var(--text-3); align-self: flex-end; white-space: nowrap; }
.bubble-wrap.out .bubble-time { color: rgba(255,255,255,.65); }
.msg-reply-bar { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.msg-templates { display: flex; gap: 6px; flex-wrap: wrap; }
.msg-template-btn { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--card); cursor: pointer; color: var(--text-2); white-space: nowrap; transition: background .15s; }
.msg-template-btn:hover { background: var(--teal-light); border-color: var(--teal); color: var(--teal); }
.reply-input-row { display: flex; gap: 8px; align-items: flex-end; }
.reply-textarea { flex: 1; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); resize: none; font-size: 13px; font-family: inherit; outline: none; height: 38px; max-height: 100px; }
.reply-textarea:focus { border-color: var(--teal); }

/* ── BROADCAST ── */
.broadcast-wrap { max-width: 640px; }
.broadcast-wrap .form-group { margin-bottom: 18px; }
.broadcast-preview { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-top: 8px; font-size: 13px; color: var(--text-2); min-height: 60px; }

/* ── REPORTS ── */
.reports-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.report-nav { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 0; }
.report-nav-item { padding: 9px 16px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-2); transition: background .12s, color .12s; border-radius: 0; }
.report-nav-item:hover { background: var(--bg); color: var(--text); }
.report-nav-item.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.report-content { }
.report-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.report-title { font-size: 17px; font-weight: 700; }

/* ── SETTINGS ── */
.settings-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.settings-section { padding: 24px; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: none; }
.settings-section-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.settings-section-desc { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }

/* ── CUSTOMER DETAIL ── */
.client-detail-header {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 24px; display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
}
.client-detail-info .name { font-size: 20px; font-weight: 700; }
.client-detail-info .sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.client-detail-info .meta { display: flex; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.client-meta-item { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.client-detail-actions { margin-left: auto; display: flex; gap: 8px; }
/* Owner inline-edit for the Pool Information & Access values */
.cd-editable { cursor: pointer; border-radius: 4px; padding: 1px 4px; margin: -1px -4px; border-bottom: 1px dashed transparent; transition: background .12s, border-color .12s; }
.cd-editable:hover { background: rgba(48,128,209,.12); border-bottom-color: var(--teal); }
.cd-editable.editing { background: transparent; border-bottom-color: transparent; cursor: default; padding: 0; margin: 0; }
.cd-input { font: inherit; font-size: 13px; padding: 3px 7px; border: 1px solid var(--teal); border-radius: 5px; background: var(--card); color: var(--text); }
.cd-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(48,128,209,.2); }

/* ── ROUTE VIEW in SCHEDULE ── */
.route-section { margin-bottom: 20px; }
/* ── CALENDAR ── */
#cal-grid { padding: 4px; }
.cal-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border); margin-bottom: 0;
}
.cal-day-name {
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 0;
}
.cal-days {
  display: grid; grid-template-columns: repeat(7, 1fr);
}
.cal-cell {
  min-height: 90px; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); padding: 6px 7px;
  cursor: pointer; transition: background .12s;
  position: relative;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--teal-light); }
.cal-cell.today { background: #eafbfa; box-shadow: inset 0 0 0 2px var(--teal); z-index: 1; }
.cal-cell.today .cal-cell-num {
  color: #fff; font-weight: 800; background: var(--teal);
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-cell.other-month .cal-cell-num { color: #ccc; }
.cal-cell.other-month { background: #fafafa; }
.cal-cell.weekend { background: #f7f8fa; cursor: default; }
.cal-cell.weekend:hover { background: #f7f8fa; }
.cal-cell.weekend .cal-cell-num { color: #b8c0cc; }
.cal-cell.weekend.today { background: #eafbfa; }
.cal-cell.weekend.today .cal-cell-num { color: #fff; }
.cal-cell-num {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  margin-bottom: 4px;
}
.cal-stop-pill {
  font-size: 10px; font-weight: 500; border-radius: 3px;
  padding: 1px 5px; margin-bottom: 2px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; display: block;
}
.cal-stop-pill.mike  { background: #dbeafe; color: #1e40af; }
.cal-stop-pill.diego { background: #d6ebf7; color: #0e5a86; }
.day-stop-clickable { cursor: pointer; transition: background .12s, box-shadow .12s; }
.day-stop-clickable:hover { box-shadow: 0 0 0 1.5px var(--teal); }
.cal-more { font-size: 10px; color: var(--text-3); margin-top: 2px; }
/* How much of that day actually got done — the payoff of dated visits for the owner,
   who previously could not see completion for any day but today. */
.cal-done { font-size:10px; font-weight:600; color:var(--green); margin-top:2px; white-space:nowrap; }

.route-tech-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.route-tech-name { font-size: 15px; font-weight: 700; }
.route-tech-meta { font-size: 12px; color: var(--text-3); }
.route-stop {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--radius); padding: 10px 14px;
  margin-bottom: 8px; box-shadow: var(--shadow); border-left: 3px solid transparent;
}
.route-stop.completed { border-left-color: var(--green); }
.route-stop.active    { border-left-color: var(--teal); }
.route-stop.en-route  { border-left-color: var(--amber); }
.route-stop.pending   { border-left-color: #d1d5db; }
.route-stop-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--bg);
  font-size: 11px; font-weight: 700; color: var(--text-3);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.route-stop-info { flex: 1; min-width: 0; }
.route-stop-name { font-size: 13px; font-weight: 600; }
.route-stop-addr { font-size: 11px; color: var(--text-3); }

/* ── DAY VIEW ── */
.day-view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.day-col-header { font-size: 13px; font-weight: 700; color: var(--text); padding: 0 0 10px 0; border-bottom: 2px solid var(--border); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.unscheduled-bin { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; border: 2px dashed var(--border); }

/* ── LOGIN SCREEN ── */
#login-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(135deg, #3080d1 0%, #1f66b0 100%);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
#login-screen.show { display: flex; }
#login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 30px 28px;
}
#login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
#login-brand { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.2; }
#login-sub { font-size: 12px; color: var(--text-3); }
.login-field { margin-bottom: 14px; }
.login-field .form-label { display: block; margin-bottom: 5px; }
#login-error {
  display: none; background: var(--red-light); color: var(--red);
  font-size: 12px; font-weight: 500; padding: 8px 12px;
  border-radius: 7px; margin-bottom: 10px;
}
#login-error.show { display: block; }
#login-hint {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-3); line-height: 1.7;
}

/* ── SCROLL TWEAKS ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* A message Twilio told us it could NOT deliver. Struck through rather than removed:
   the owner needs to see that it was attempted and did not land, which is the whole
   point of the delivery callback. */
.bubble.undelivered { opacity: .62; text-decoration: line-through; }
.undelivered-note { color: #9c2f2b; font-weight: 600; }

/* ── SMS opt-in badge (client profile) ───────────────────────────────────────
   Sits beside the phone number and reflects RPC_SMS_OPTIN.state(). Three states,
   because "we can't text this number" is a different thing from "we choose not
   to" and the owner needs to tell them apart at a glance. */
.sms-badge {
  display: inline-flex; align-items: center;
  margin-left: 8px; padding: 1px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: .01em; white-space: nowrap; vertical-align: middle;
}
.sms-badge.on   { background: var(--green-light); color: #15803d; cursor: pointer; }
.sms-badge.off  { background: var(--bg);          color: var(--text-3); cursor: pointer; border: 1px solid var(--border); }
/* Not clickable: there is nothing to toggle until the number is fixed. */
.sms-badge.none { background: var(--amber-light); color: #8a5a06; cursor: default; }
.sms-badge.on:hover  { background: #bbf7d0; }
.sms-badge.off:hover { background: var(--border); color: var(--text-2); }
.sms-badge:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ── Text requests ──────────────────────────────────────────────────────────
   Rows the owner acts on rather than reads, so each one carries its actions
   inline: the whole point is that sending is one tap from here. */
.request-row {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.request-row:last-child { border-bottom: 0; }
/* An inbound text the webhook could not match to a client. Marked rather than merely
   listed: these are the only rows here that came from OUTSIDE the business, and the
   action is usually "fix the phone number on that client" rather than "reply". */
.request-row.unmatched { border-left: 3px solid var(--amber); background: var(--amber-light); }
.request-row.unmatched .request-phone { color: #8a5a06; font-weight: 500; }
.request-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.request-who { font-size: 14px; color: var(--text-2); }
.request-who strong { color: var(--text); }
.request-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }
/* The message itself is the thing being approved, so it is quoted rather than
   restated in the interface voice. */
.request-text {
  font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--bg); border-radius: 8px; padding: 11px 13px;
}
.request-phone { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.request-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.request-actions .btn { text-decoration: none; }

.empty-state { padding: 44px 24px; text-align: center; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-sub { font-size: 13.5px; color: var(--text-3); max-width: 44ch; margin: 0 auto; line-height: 1.5; }

/* ── Admin / Maintenance-Repair toggle ──────────────────────────────────────
   Sits above the credentials because it changes WHERE you are signing in, not
   how — picking it after typing a password would be the wrong order. */
.surface-toggle {
  display: flex; gap: 4px; width: 100%; margin: 0 0 16px;
  background: var(--bg); border-radius: 10px; padding: 4px;
}
.surface-toggle button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-3);
  padding: 9px 8px; border-radius: 7px; transition: background .15s, color .15s;
}
.surface-toggle button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.surface-toggle button:focus-visible { outline: 2px solid var(--pool-blue); outline-offset: 2px; }

/* ── Crew notes ─────────────────────────────────────────────────────────────
   Each note carries who wrote it, when, and how long it lasts — a note whose
   lifespan is invisible is one nobody dares delete. */
.note-row { display:flex; gap:12px; align-items:flex-start; padding:10px 0; border-bottom:1px solid var(--border); }
.note-row:last-of-type { border-bottom:0; }
.note-body { flex:1; min-width:0; }
.note-text { font-size:13.5px; line-height:1.45; color:var(--text); }
.note-meta { font-size:11.5px; color:var(--text-3); margin-top:3px; }
.note-empty { font-size:13px; color:var(--text-3); padding:6px 0 10px; }
.note-add { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:12px;
            padding-top:12px; border-top:1px solid var(--border); }
.note-add .form-input { flex:1 1 260px; min-width:180px; }
.note-add .note-duration { flex:0 0 auto; width:auto; min-width:150px; }
