@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

/* ============================================================
   Pebble Nutrition Client Dashboard — Stylesheet
   ============================================================ */

:root {
  --pn-green:        #c5d9f3;                      /* blue — primary accent */
  --pn-green-dark:   #8cb5e8;                      /* blue dark — hover bg */
  --pn-green-deeper: #4a7ab8;                      /* blue deepest — text on blue bg */
  --pn-green-light:  #f3c5d9;                      /* pink — light bg accent */
  --pn-green-mid:    #e5b8cf;                      /* pink mid — borders */
  --pn-cream:        #fbf6ee;                      /* warm cream — page bg */
  --pn-white:        #ffffff;
  --pn-text:         #333333;
  --pn-muted:        #8c7085;                      /* dark purple — muted text */
  --pn-border:       rgba(140, 112, 133, 0.18);
  --pn-border-mid:   rgba(140, 112, 133, 0.30);
  --pn-amber:        #b57840;                      /* peach dark — text on peach bg */
  --pn-amber-light:  #fff0e6;                      /* peach light bg */
  --pn-red:          #c0392b;
  --pn-red-light:    #fdecea;
  --pn-blue:         #4a73a0;
  --pn-blue-light:   #c5d9f3;                      /* new blue */
  --pn-teal:         #79b8b9;                      /* new teal */
  --pn-purple:       #c8c5f3;                      /* new purple */
  --pn-purple-dark:  #5955a8;
  --pn-shadow:       0 1px 4px rgba(51, 51, 51, 0.08);
  --topbar-h:        56px;
  --sidebar-w:       210px;
  --radius:          0px;
  --radius-sm:       0px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
input, select, textarea, button { font-family: inherit; }

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--pn-cream);
  color: var(--pn-text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────── */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--pn-green);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,0.15);
  cursor: pointer;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-search {
  display: flex;
  justify-content: center;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.app-version {
  font-size: 10px;
  font-family: monospace;
  color: var(--pn-text-muted, #999);
  opacity: 0.7;
  white-space: nowrap;
}

.topbar-logo-img {
  height: 44px;
  width: auto;
  padding: 4px 0;
}

.topbar-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
}

.topbar-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(255,255,255,0.85);
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.topbar-nav-link:hover { background: rgba(255,255,255,0.12); }
.topbar-nav-link.active { border-bottom-color: #fff; color: #fff; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
}

.topbar-sync {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
}

.sync-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--pn-green);
  flex-shrink: 0;
}

.sync-label {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}

.topbar-user-menu { position: relative; }

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(0,0,0,0.07);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px 6px 6px;
  cursor: pointer;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  transition: background 0.15s;
  user-select: none;
}

.topbar-user-btn:hover { background: rgba(255,255,255,0.12); }

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--pn-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 190px;
  z-index: 500;
  padding: 4px 0;
}

.user-dropdown.hidden { display: none; }

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--pn-text, #333);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.user-dropdown-item:hover { background: var(--pn-cream); }
.user-dropdown-item i { font-size: 15px; opacity: 0.7; }

.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--pn-muted);
  border: 1.5px solid rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 500;
}

/* ── Layout ──────────────────────────────────────────────── */

.app-layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--pn-white);
  border-right: 0.5px solid var(--pn-border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
}

.sidebar-section { padding: 0 12px; margin-bottom: 4px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--pn-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--pn-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  margin-bottom: 1px;
}

.nav-item i { font-size: 16px; flex-shrink: 0; }

.nav-item:hover { background: var(--pn-cream); color: var(--pn-text); }

.nav-item.active {
  background: var(--pn-green-light);
  color: var(--pn-muted);
  font-weight: 500;
}

.sidebar-spacer { flex: 1; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 0.5px solid var(--pn-border);
  font-size: 11px;
  color: var(--pn-muted);
}

/* ── Main Content ────────────────────────────────────────── */

.main-content {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

/* ── Sticky Filter Section ───────────────────────────────── */

.filters-sticky {
  position: sticky;
  top: var(--topbar-h);
  z-index: 50;
  background: var(--pn-cream);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

/* ── Page Header ─────────────────────────────────────────── */

.search-wrap-header {
  width: 240px;
}

.search-wrap-header .search-input {
  height: 40px;
  font-size: 14px;
  border-width: 1px;
  background: var(--pn-white);
  box-shadow: var(--pn-shadow);
}

.search-wrap-topbar {
  width: 360px;
  border-radius: 0;
  background: #fff;
  border: none;
}

.search-wrap-topbar i {
  color: var(--pn-muted);
  font-size: 16px;
}

.search-wrap-topbar .search-input {
  height: 38px;
  font-size: 14px;
  background: #fff;
  border: none;
  border-radius: 0;
  color: var(--pn-text);
  box-shadow: none;
}

.search-wrap-topbar .search-input::placeholder {
  color: var(--pn-muted);
}

.search-wrap-topbar .search-input:focus {
  outline: none;
  background: #fff;
}

.page-title { font-size: 18px; font-weight: 700; color: var(--pn-text); text-transform: uppercase; letter-spacing: 2px; }
.page-subtitle { font-size: 12px; color: var(--pn-muted); margin-top: 3px; }

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  background: var(--pn-green);
  color: var(--pn-text);
}
.btn:hover { background: var(--pn-green-dark); }

.btn-primary {
  background: var(--pn-green);
  color: var(--pn-text);
}
.btn-primary:hover { background: var(--pn-teal); color: var(--pn-white); }

.btn-secondary {
  background: var(--pn-white);
  color: var(--pn-text);
  border: 0.5px solid var(--pn-border-mid);
}
.btn-secondary:hover { background: var(--pn-teal); color: var(--pn-white); border-color: var(--pn-teal); }

.btn-danger {
  background: var(--pn-red-light);
  color: var(--pn-red);
  border: 0.5px solid rgba(192,57,43,0.2);
}
.btn-danger:hover { background: #f8d9d6; }

.btn-sm { padding: 6px 12px; font-size: 11px; }

.btn-add-client {
  background: #fff;
  color: var(--pn-green-deeper);
  border: none;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  gap: 8px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.btn-add-client:hover { background: var(--pn-cream); }

/* ── Stat Cards ──────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--pn-white);
  border: 0.5px solid var(--pn-border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--pn-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 500;
  color: var(--pn-text);
  line-height: 1;
}

.stat-note {
  font-size: 12px;
  color: var(--pn-muted);
  margin-top: 4px;
}

.stat-note.green { color: var(--pn-green); }
.stat-note.amber { color: var(--pn-amber); }

/* ── Toolbar ─────────────────────────────────────────────── */

.practitioner-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.prac-radio { display: none; }

.prac-label {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--pn-border-mid);
  color: var(--pn-muted);
  background: var(--pn-white);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  user-select: none;
}

.prac-label:hover { background: var(--pn-cream); border-color: var(--pn-green-dark); }

.prac-radio:checked + .prac-label {
  background: var(--pn-green);
  border-color: var(--pn-green-dark);
  color: var(--pn-text);
}

/* Practitioner filter chips — coloured per practitioner */
.prac-label-prac {
  background: #fff;
  color: var(--prac-text);
  border-color: var(--prac-text);
  padding: 8px 18px;
  font-size: 12px;
}
.prac-label-prac:hover {
  background: var(--prac-bg);
  color: var(--prac-text);
  border-color: var(--prac-text);
}
.prac-radio:checked + .prac-label-prac {
  background: var(--prac-bg);
  color: var(--prac-text);
  border-color: var(--prac-text);
}

/* Month buttons with embedded bar chart */
.prac-label-month {
  flex-direction: column;
  align-items: stretch;
  padding: 7px 12px 6px;
  gap: 4px;
  min-width: 0;
}

/* Practitioner filter bar: one row, buttons share the full width equally */
#practitioner-bar {
  flex-wrap: nowrap;
  overflow-x: auto;
  align-items: stretch;
}
#practitioner-bar .prac-label {
  flex: 1;
  min-width: 0;
  justify-content: center;
}

/* Planned-consult bar: one row, buttons share the full width equally */
#planned-consult-bar {
  flex-wrap: nowrap;
  overflow-x: auto;
  align-items: stretch;
}
#planned-consult-bar .prac-label {
  flex: 1;
  min-width: 0;
  justify-content: center;
}

/* "All" button — fixed icon-btn-width, lines up with refresh button */
#practitioner-bar .prac-label-all,
#planned-consult-bar .prac-label-all {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 10px;
}

/* Group-by row — shown only in Columns view */
#group-by-bar {
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.month-label-name {
  white-space: nowrap;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.month-name-abbr { display: none; }

@media (max-width: 900px) {
  .month-name-full { display: none; }
  .month-name-abbr { display: inline; }
}

.month-bar-wrap {
  height: 4px;
  background: rgba(140, 112, 133, 0.15);
  width: 100%;
}

.month-bar {
  display: block;
  height: 100%;
  background: var(--pn-muted);
  transition: width 0.2s ease;
  min-width: 0;
}

.month-label-count {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
  color: var(--pn-text);
}

.prac-radio:checked + .prac-label-month {
  background: var(--month-bg, var(--pn-green-deeper));
  color: var(--month-text, #fff);
}
.prac-radio:checked + .prac-label-month .month-label-count { color: var(--month-text, #fff); }
.prac-radio:checked + .prac-label-month .month-bar { background: var(--month-text, #fff); opacity: 0.5; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: nowrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}

.search-wrap i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pn-muted);
  font-size: 15px;
  pointer-events: none;
}

.search-input,
.filter-select {
  height: 36px;
  padding: 0 12px;
  border: 0.5px solid var(--pn-border-mid);
  border-radius: var(--radius-sm);
  background: var(--pn-white);
  font-size: 13px;
  color: var(--pn-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-select { max-width: 130px; }

.search-input {
  width: 100%;
  padding-left: 32px;
}

.search-input:focus,
.filter-select:focus {
  border-color: var(--pn-green);
  box-shadow: 0 0 0 3px rgba(197,217,243,0.5);
}

.toolbar-spacer { margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--pn-border-mid);
  background: var(--pn-white);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--pn-muted);
  font-size: 16px;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--pn-green-light); color: var(--pn-green-dark); }

.topbar-refresh-btn {
  background: rgba(0,0,0,0.07);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  width: 32px; height: 32px;
}
.topbar-refresh-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Table ───────────────────────────────────────────────── */

.table-card {
  background: var(--pn-white);
  border: 0.5px solid var(--pn-border);
  border-radius: var(--radius);
}

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

/* All column widths sum to 100% — no auto columns, no blank space */
.data-table th.cb-col                      { width: 80px; }
.data-table th:nth-child(2)                { width: 15%; }  /* client name */
.data-table th[data-col="services"]        { width: 9%; }
.data-table th[data-col="practitioner"]    { width: 10%; }
.data-table th[data-col="plannedConsult"]  { width: 9%; }
.data-table th[data-col="consultDate"]     { width: 11%; }
.data-table th[data-col="status"]          { width: 8%; }
.data-table th[data-col="invite"]          { width: 7%; }
.data-table th[data-col="updatedAt"]       { width: 9%; }
.data-table th[data-col="contact"]         { width: 18%; }
/* total: 4+15+9+10+9+11+8+7+9+18 = 100% */

.data-table th {
  background: var(--pn-green-light);
  color: var(--pn-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--pn-green-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover { background: #edd5e4; }
.data-table th[draggable] { cursor: grab; }
.data-table th.col-dragging { opacity: 0.4; }
.data-table th.col-drag-over { background: #d4b8e0; box-shadow: inset 3px 0 0 var(--pn-purple); }

.data-table th .sort-icon {
  margin-left: 4px;
  opacity: 0.5;
  font-size: 12px;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--pn-border);
  vertical-align: middle;
  overflow: hidden;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(0,0,0,0.04); }

.client-name {
  font-weight: 500;
  color: var(--pn-muted);
  cursor: pointer;
}
.client-name:hover { text-decoration: underline; }
.client-email { font-size: 12px; color: var(--pn-muted); margin-top: 1px; }

/* ── Status Pills ────────────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-active   { background: var(--pn-green-light); color: var(--pn-muted); }
.status-pending  { background: var(--pn-amber-light);  color: var(--pn-amber); }
.status-trial    { background: var(--pn-purple);       color: var(--pn-purple-dark); }
.status-inactive { background: #f0efec;                color: #888; }

/* ── Bulk Action Bar ─────────────────────────────────────── */

.group-header-row:hover td { filter: brightness(0.97); }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { filter: brightness(0.96); }

.view-edit-toggle { display: flex; align-items: center; gap: 2px; }

/* ── Inline editable cells ───────────────────────────────── */

.inline-select {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  max-width: 140px;
  outline: none;
}

.inline-select:hover { background: rgba(0,0,0,0.05); }
.inline-select:focus { background: var(--pn-white); outline: 1px solid var(--pn-green-dark); }
.inline-select:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Bulk Action Bar ─────────────────────────────────────── */

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 10px;
  background: var(--pn-green);
  border: 1px solid var(--pn-green-dark);
}

.bulk-bar.hidden { display: none; }

.bulk-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--pn-text);
  white-space: nowrap;
}

/* ── Checkbox Column ─────────────────────────────────────── */

.cb-col {
  width: 80px;
  padding: 0 8px !important;
}


.cb-col > div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.quick-note-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--pn-muted);
  padding: 0;
  line-height: 1;
  font-size: 16px;
  opacity: 0.4;
  transition: opacity 0.12s, color 0.12s;
  display: flex;
  align-items: center;
}
.quick-note-btn:hover { opacity: 1; color: var(--pn-text); }

.row-cb, #select-all-cb {
  cursor: pointer;
  width: 14px;
  height: 14px;
  accent-color: var(--pn-green-deeper);
}

/* ── Action Buttons (in table) ───────────────────────────── */

.action-group { display: flex; flex-direction: column; gap: 3px; }

.act-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  border: 0.5px solid var(--pn-green-deeper);
  background: var(--pn-green-deeper);
  color: var(--pn-white);
  transition: all 0.12s;
  white-space: nowrap;
}

.btn-action {
  background: #c5d9f3;
  color: var(--pn-text);
  border-color: #c5d9f3;
}
.btn-action:hover {
  background: var(--pn-green-dark);
  color: var(--pn-text);
  border-color: var(--pn-green-dark);
}

.act-btn-lg {
  padding: 10px 22px;
  font-size: 12px;
  letter-spacing: 0.07em;
}

.act-btn:hover {
  background: var(--pn-teal);
  color: var(--pn-white);
  border-color: var(--pn-teal);
}


.act-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


/* ── Pagination ──────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 0.5px solid var(--pn-border);
  font-size: 12px;
  color: var(--pn-muted);
}

.page-btns { display: flex; gap: 4px; }

.page-btn {
  min-width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--pn-border-mid);
  background: var(--pn-white);
  font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--pn-muted);
  padding: 0 6px;
  transition: all 0.12s;
}

.page-btn:hover { background: var(--pn-green-light); color: var(--pn-green-dark); }
.page-btn.active { background: var(--pn-green); color: var(--pn-text); border-color: var(--pn-green); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Modal ───────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(51,51,51,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 16px;
}

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

.modal {
  background: var(--pn-white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 0.5px solid var(--pn-border);
}

.modal-title { font-size: 16px; font-weight: 500; }

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--pn-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background 0.12s;
}
.modal-close:hover { background: var(--pn-cream); }

.modal-body { padding: 20px; flex: 1; overflow-y: auto; }

.modal-body-cols {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
  align-items: start;
  padding: 0;
}
.modal-col-left {
  padding: 20px;
  min-width: 0;
  overflow: hidden;
}
.modal-col-left .form-grid {
  grid-template-columns: auto auto;
}
.modal-col-left .form-input,
.modal-col-left .form-select {
  width: 100%;
  min-width: 140px;
}
.modal-col-right {
  padding: 20px;
  border-left: 1px solid var(--pn-border);
  display: flex;
  flex-direction: column;
  min-height: 400px;
}
.modal-col-right .notes-display,
.modal-col-right .notes-textarea {
  flex: 1;
  min-height: 300px;
}

.modal-section-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--pn-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 0.5px solid var(--pn-border);
}

.modal-section-label:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.services-dual-list {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch;
}

.sdl-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--pn-border);
  background: var(--pn-white);
  border-radius: 4px;
  overflow: hidden;
  min-height: 180px;
}

.sdl-header {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pn-muted);
  background: var(--pn-cream);
  border-bottom: 1px solid var(--pn-border);
  user-select: none;
  flex-shrink: 0;
}

.sdl-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 3px 0;
  max-height: 200px;
}

.sdl-item {
  padding: 5px 10px 5px 9px;
  font-size: 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  user-select: none;
  color: var(--pn-text);
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sdl-item:hover { background: var(--pn-cream); }

.sdl-item.sdl-active {
  background: var(--pn-blue-light);
  border-left-color: var(--pn-green-deeper) !important;
  color: var(--pn-green-dark);
  font-weight: 600;
}

.sdl-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.sdl-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pn-border);
  background: var(--pn-white);
  color: var(--pn-text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  border-radius: 3px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.sdl-btn:hover {
  background: var(--pn-green-deeper);
  color: #fff;
  border-color: var(--pn-green-deeper);
}

.sdl-hint {
  padding: 10px;
  font-size: 11px;
  color: var(--pn-muted);
  font-style: italic;
  text-align: center;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 0.5px solid var(--pn-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--pn-white);
}

/* ── Client Modal Theming ────────────────────────────────── */

#client-modal .modal-header {
  background: var(--pn-cream);
  border-bottom: 1px solid var(--pn-border-mid);
}

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

#client-modal .modal-header-group-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--pn-green-deeper);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#client-modal .modal-header-right .pill-select {
  width: auto;
  min-width: 0;
}

#client-modal .modal-header-right .pill-select-display {
  flex: none;
  white-space: nowrap;
}

#client-modal .modal-header-right .pill-select-opts {
  right: auto;
  width: max-content;
  min-width: 160px;
}

#client-modal .modal-title {
  font-weight: 700;
  color: var(--pn-green-deeper);
  letter-spacing: 0.01em;
}

#client-modal .modal-footer {
  background: var(--pn-cream);
  border-top: 1px solid var(--pn-border-mid);
}

#client-modal .modal-col-right {
  background: #fdfaf5;
  border-left-color: var(--pn-border-mid);
}

#client-modal .modal-section-label {
  border-top: none;
  padding-top: 0;
  color: var(--pn-green-deeper);
  font-weight: 700;
  font-size: 10.5px;
}

#client-modal .modal-section-label:first-child { margin-top: 0; }

#client-modal .form-label {
  color: var(--pn-text);
  font-weight: 600;
}

#client-modal .notes-display {
  background: #fdf9f2;
}

/* ── Form ────────────────────────────────────────────────── */

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

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--pn-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Pill-select (coloured-pill custom dropdown) ─────────── */
.pill-select {
  position: relative;
  width: 100%;
  min-width: 140px;
  box-sizing: border-box;
}
.pill-select-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border: 0.5px solid var(--pn-border-mid);
  border-radius: var(--radius-sm);
  background: var(--pn-white);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.pill-select-trigger:hover { border-color: var(--pn-green); }
.pill-select.open .pill-select-trigger {
  border-color: var(--pn-green);
  box-shadow: 0 0 0 3px rgba(197,217,243,0.5);
}
.pill-select-display { flex: 1; min-width: 0; }
.pill-select-placeholder { font-size: 13px; color: var(--pn-muted); }
.pill-select-chevron {
  font-size: 13px;
  color: var(--pn-muted);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.pill-select.open .pill-select-chevron { transform: rotate(180deg); }
.pill-select-opts {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--pn-white);
  border: 0.5px solid var(--pn-border-mid);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  max-height: 240px;
  overflow-y: auto;
}
.pill-select.open .pill-select-opts { display: block; }
.pill-select-opt {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.pill-select-opt:hover { background: var(--pn-cream); }
.pill-select-opt.ps-selected { background: var(--pn-blue-light); }

.form-input,
.form-select,
.form-textarea {
  padding: 8px 12px;
  border: 0.5px solid var(--pn-border-mid);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--pn-text);
  background: var(--pn-white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--pn-green);
  box-shadow: 0 0 0 3px rgba(197,217,243,0.5);
}

.form-textarea { resize: vertical; min-height: 80px; }
.notes-textarea { font-size: 13px; line-height: 1.7; min-height: 160px; }

/* ── Notes display panel ─────────────────────────────────── */
.notes-display {
  padding: 10px 14px;
  border: 0.5px solid var(--pn-border-mid);
  border-radius: var(--radius-sm);
  background: var(--pn-white);
  min-height: 60px;
  line-height: 1.6;
}

.notes-empty {
  color: var(--pn-muted);
  font-style: italic;
  font-size: 13px;
}

.note-entry {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 0.5px solid var(--pn-border);
}
.note-entry:last-child { border-bottom: none; }

.note-timestamp {
  font-size: 11px;
  color: var(--pn-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.note-action {
  font-size: 13px;
  font-weight: 500;
  color: var(--pn-text);
}

.note-freetext {
  font-size: 13px;
  color: var(--pn-text);
  padding: 6px 0 2px;
  white-space: pre-wrap;
}

/* ── Toast Notifications ─────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  animation: slideIn 0.2s ease;
  pointer-events: auto;
}

.toast.success { background: #e4f4f4;               color: var(--pn-green-deeper); border: 0.5px solid rgba(121,184,185,0.4); }
.toast.error   { background: var(--pn-red-light);   color: var(--pn-red);          border: 0.5px solid rgba(192,57,43,0.2); }
.toast.info    { background: var(--pn-blue-light);  color: var(--pn-blue);         border: 0.5px solid rgba(74,115,160,0.3); }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Login Page ──────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pn-cream);
  padding: 16px;
}

.login-card {
  background: var(--pn-white);
  border: 0.5px solid var(--pn-border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--pn-shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-mark {
  width: 52px; height: 52px;
  background: var(--pn-green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}

.login-logo-mark svg { width: 30px; height: 30px; }

.login-brand { font-size: 17px; font-weight: 500; color: var(--pn-text); }
.login-tagline { font-size: 12px; color: var(--pn-muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-form .form-group { gap: 6px; }
.login-form .form-label { font-size: 12px; font-weight: 500; color: var(--pn-muted); }
.login-form .form-input { width: 100%; }

.login-submit {
  width: 100%;
  height: 40px;
  background: var(--pn-green);
  color: var(--pn-text);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
.login-submit:hover { background: var(--pn-green-dark); }
.login-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  background: var(--pn-red-light);
  color: var(--pn-red);
  border: 0.5px solid rgba(192,57,43,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  display: none;
}

/* ── Empty State ─────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--pn-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── Loading Spinner ─────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--pn-green-mid);
  border-top-color: var(--pn-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-row td {
  text-align: center;
  padding: 32px;
  color: var(--pn-muted);
}

/* ── Calendar View ───────────────────────────────────────── */

.calendar-wrap {
  background: #fff;
  border: 1px solid var(--pn-border);
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--pn-border);
  background: var(--pn-cream);
}

.calendar-month-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--pn-text);
  letter-spacing: 0.01em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--pn-border);
}

.calendar-day-header {
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pn-muted);
  text-align: center;
  background: var(--pn-cream);
  border-right: 1px solid var(--pn-border);
  border-bottom: 1px solid var(--pn-border);
}

.calendar-day-header:last-child { border-right: none; }

.calendar-cell {
  min-height: 110px;
  padding: 5px 5px 6px;
  border-right: 1px solid var(--pn-border);
  border-bottom: 1px solid var(--pn-border);
  vertical-align: top;
  background: #fff;
}

.calendar-cell:nth-child(7n) { border-right: none; }

.calendar-cell.other-month { background: var(--pn-cream); }

.calendar-cell.cal-today { background: #f0f6fd; }

.calendar-date-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--pn-muted);
  text-align: right;
  margin-bottom: 3px;
  line-height: 1;
}

.calendar-date-num.cal-today-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--pn-blue);
  color: #fff;
  border-radius: 50%;
  float: right;
  font-size: 11px;
}

.cal-event {
  display: block;
  font-size: 11px;
  padding: 2px 5px;
  margin-bottom: 2px;
  cursor: pointer;
  background: var(--prac-bg, var(--pn-blue-light));
  color: var(--prac-fg, var(--pn-blue));
  border-left: 2px solid var(--prac-fg, var(--pn-green-deeper));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.cal-event:hover {
  filter: brightness(0.88);
}

.cal-event-services {
  display: block;
  font-size: 10px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.cal-event-prac {
  display: block;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.8;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Calendar List View ──────────────────────────────────── */

.cal-list-wrap {
  border-top: 1px solid var(--pn-border);
}

.cal-list-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--pn-cream);
  border-bottom: 1px solid var(--pn-border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.cal-list-group.cal-list-today {
  background: #e8f1fb;
}

.cal-list-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--pn-text);
  letter-spacing: 0.02em;
}

.cal-list-today-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--pn-blue);
  color: #fff;
  padding: 1px 7px;
  border-radius: 20px;
}

.cal-list-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--pn-border);
  border-left: 3px solid var(--prac-fg, transparent);
  cursor: pointer;
  background: var(--prac-bg, #fff);
  transition: filter 0.1s;
}

.cal-list-row:hover {
  filter: brightness(0.95);
}

.cal-list-prac {
  flex: 0 0 130px;
  overflow: hidden;
}

.cal-list-time {
  flex: 0 0 48px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pn-blue);
  white-space: nowrap;
}

.cal-list-call {
  flex: 0 0 120px;
  font-size: 12px;
  color: var(--pn-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-list-name {
  flex: 1 1 160px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pn-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-list-statuses {
  flex: 0 0 130px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cal-list-meta {
  flex: 1 1 140px;
  font-size: 12px;
  color: var(--pn-muted);
  line-height: 1.5;
  overflow: hidden;
}

.cal-list-status {
  flex: 0 0 auto;
  flex-shrink: 0;
}

.cal-list-contact {
  flex: 0 0 180px;
  font-size: 11px;
  color: var(--pn-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-list-contact-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-list-contact-phone {
  color: var(--pn-text);
  font-weight: 500;
}

/* ── Kanban View ─────────────────────────────────────────── */

.kanban-wrap {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 16px;
  align-items: flex-start;
}

.kanban-col {
  flex: 0 0 220px;
  background: var(--pn-cream);
  border: 1px solid var(--pn-border);
  border-top-width: 3px;
}

.kanban-col-header {
  padding: 7px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--pn-border);
}

.kanban-col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.kanban-col-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  color: #fff;
}

.kanban-cards {
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 60px;
}

.kanban-card {
  background: #fff;
  border: 1px solid var(--pn-border);
  padding: 9px 11px;
  cursor: pointer;
}

.kanban-card:hover {
  border-color: var(--pn-green-dark);
  background: #f7fafd;
}

.kanban-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--pn-text);
  margin-bottom: 3px;
  line-height: 1.3;
}

.kanban-card-services {
  font-size: 11px;
  color: var(--pn-muted);
  margin-bottom: 6px;
  line-height: 1.3;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1960px) {
  .view-label-text { display: none; }
}

@media (max-width: 1280px) {
  body                             { font-size: 12px; }
  .data-table                      { font-size: 11px; }
  .search-input, .filter-select    { font-size: 11px; }
  .form-input, .form-select,
  .form-textarea                   { font-size: 11px; }
  .topbar-user-btn                 { font-size: 11px; }
  .btn                             { font-size: 10px; }

  /* 14px elements → 12px */
  .search-wrap-topbar .search-input,
  .btn-add-client,
  .month-label-count               { font-size: 12px; }

  /* field labels in client view */
  .form-label                        { font-size: 10px; }

  /* 13px elements → 11px */
  .user-dropdown-item,
  .topbar-nav-link,
  .pill-select-placeholder,
  .pill-select-chevron,
  .notes-textarea,
  .notes-empty,
  .note-action,
  .note-freetext,
  .cal-list-time,
  .cal-list-call,
  .cal-list-name,
  .cal-list-meta,
  .cal-list-contact,
  .kanban-card-name,
  .kanban-card-services,
  .email-compose-title,
  .email-compose-field-value,
  .ec-to-email-addr,
  .ec-toggle-label,
  .eh-subject,
  .eh-loading,
  .eh-empty,
  .cdp-email-title,
  .em-list-panel,
  .sdl-item                        { font-size: 11px; }
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .action-group { flex-wrap: wrap; }
}

/* ── DateTime Picker ─────────────────────────────────────── */

.dt-picker-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.dt-picker-wrap .form-input {
  flex: 1;
  min-width: 0;
}

.dt-time-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  background: var(--pn-white);
  border: 1px solid var(--pn-border-mid);
  color: var(--pn-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s;
  min-width: 100px;
}

.dt-time-btn:hover {
  border-color: var(--pn-green-dark);
  color: var(--pn-text);
}

.dt-time-btn .ti { font-size: 14px; }

/* ── Clock Face Picker ───────────────────────────────────── */

.clock-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clock-picker-overlay.hidden { display: none; }

.clock-picker-panel {
  background: #fff;
  width: 300px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.clock-picker-header {
  background: #1d4ed8;
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.cp-seg {
  font-size: 48px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  line-height: 1;
  transition: color 0.1s;
  user-select: none;
}

.cp-seg.cp-active { color: #fff; }

.cp-colon {
  font-size: 48px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  line-height: 1;
  padding: 0 2px;
}

.cp-ampm {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
}

.cp-ampm-btn {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.3);
  user-select: none;
  transition: all 0.1s;
}

.cp-ampm-btn.cp-ampm-active {
  color: #fff;
  border-color: #fff;
  background: rgba(255,255,255,0.15);
}

.clock-face-svg {
  width: 100%;
  height: 260px;
  display: block;
  padding: 8px;
  box-sizing: border-box;
}

.clock-picker-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--pn-border);
}

/* ── Email Compose Overlay ───────────────────────────────────────────── */

.email-compose-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.email-compose-window {
  background: var(--pn-white);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 780px;
  min-width: 480px;
  height: 90vh;
  min-height: 400px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  resize: both;
}

.email-compose-topbar {
  height: 52px;
  background: var(--pn-cream);
  border-bottom: 1px solid var(--pn-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}

.email-compose-title {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pn-text);
}

.email-compose-fields {
  padding: 14px 20px;
  border-bottom: 1px solid var(--pn-border);
  background: var(--pn-cream);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.email-compose-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.email-compose-field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pn-muted);
  width: 60px;
  flex-shrink: 0;
}

.email-compose-field-value {
  font-size: 13px;
  color: var(--pn-text);
}

.email-compose-no-email {
  font-size: 11px;
  color: var(--pn-danger, #c0392b);
  margin-left: 8px;
}

.ec-compose-iframe {
  flex-shrink: 0;
  border: none;
  width: 100%;
  min-height: 300px;
}

#em-compose-pane {
  overflow-y: auto;
}

.ec-to-email-addr {
  color: var(--pn-muted);
  font-size: 13px;
  margin-left: 4px;
}

.ec-template-select {
  max-width: 300px;
}

.ec-doc-picker {
  position: relative;
}

.ec-doc-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 0 10px;
  height: 28px;
  white-space: nowrap;
}

.ec-doc-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--pn-white, #fff);
  border: 1px solid var(--pn-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 260px;
  max-width: 360px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 0;
}

.ec-doc-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
}

.ec-doc-item:hover {
  background: var(--pn-hover, #f0f4f8);
}

.ec-doc-item input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.ec-doc-item-name {
  font-weight: 600;
  color: var(--pn-text);
}

.ec-doc-item-desc {
  font-size: 11px;
  color: var(--pn-muted);
}

.ec-doc-loading {
  display: block;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--pn-muted);
}

.ec-toggle-label {
  font-size: 13px;
  color: var(--pn-text);
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}

.email-compose-footer {
  padding: 12px 20px;
  background: var(--pn-cream);
  border-top: 1px solid var(--pn-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Reports overlay ──────────────────────────────────────────────────────── */

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

.reports-modal {
  background: var(--pn-white, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  width: 92vw;
  max-width: 1200px;
  height: 78vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reports-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--pn-border);
  flex-shrink: 0;
}

.reports-modal-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reports-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--pn-muted);
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
}

.reports-modal-close:hover {
  background: var(--pn-hover, #f0f4f8);
  color: var(--pn-text);
}

.reports-modal-body {
  flex: 1;
  padding: 24px 28px;
  min-height: 0;
  position: relative;
}

.reports-modal-body {
  overflow-y: auto;
  padding: 20px 24px;
}

.reports-chart-wrap {
  height: 320px;
  position: relative;
  margin-bottom: 24px;
}

.reports-table-wrap {
  overflow-x: auto;
}

.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.reports-table th,
.reports-table td {
  padding: 6px 10px;
  text-align: center;
  border: 1px solid var(--pn-border);
  white-space: nowrap;
}

.reports-table th {
  background: var(--pn-cream);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pn-muted);
}

.reports-table-prac {
  text-align: left !important;
  display: flex;
  align-items: center;
  gap: 7px;
}

.reports-prac-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.reports-table-total {
  font-weight: 700;
  background: var(--pn-cream);
}

.reports-table-totals-row td {
  font-weight: 700;
  background: var(--pn-cream);
  border-top: 2px solid var(--pn-border-mid);
}

.reports-tabs {
  display: flex;
  gap: 4px;
  margin-left: 20px;
}

.reports-tab {
  background: none;
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pn-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.reports-tab:hover {
  background: var(--pn-hover, #f0f4f8);
  color: var(--pn-text);
}

.reports-tab-active {
  background: var(--pn-green);
  border-color: var(--pn-green-dark);
  color: var(--pn-green-deeper);
}

/* ── Email History overlay ───────────────────────────────────────────────── */

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

.eh-modal {
  background: var(--pn-white, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  width: 92vw;
  max-width: 1200px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.eh-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--pn-border);
  flex-shrink: 0;
}

.eh-modal-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eh-modal-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.eh-list-panel {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--pn-border);
  overflow-y: auto;
  padding: 8px 0;
}

.eh-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.eh-detail-iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
}

.eh-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--pn-border);
  cursor: pointer;
  transition: background 0.12s;
  background: #fff;
}

.eh-item:hover { background: var(--pn-hover, #f0f4f8); }
.eh-item-active { background: var(--pn-green-pale, #e8f5e9); }

.eh-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.eh-direction {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.eh-sent     { color: #1a7f5a; }
.eh-received { color: #1565c0; }

.eh-date {
  font-size: 11px;
  color: var(--pn-muted);
}

.eh-subject {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.eh-preview {
  font-size: 12px;
  color: var(--pn-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eh-loading,
.eh-empty {
  padding: 24px 16px;
  color: var(--pn-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eh-email-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--pn-border);
  padding: 14px 20px;
  background: var(--pn-bg, #f8f9fa);
  font-size: 12px;
  line-height: 1.7;
}

.eh-hdr-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.eh-hdr-label {
  font-weight: 600;
  color: var(--pn-muted);
  flex-shrink: 0;
  width: 54px;
  text-align: right;
}

/* ── Combined Email Modal (em-*) ─────────────────────────────────────────── */

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

.em-modal {
  background: var(--pn-white, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  width: 96vw;
  max-width: 1300px;
  height: 84vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.em-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--pn-border);
  flex-shrink: 0;
}

.em-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.em-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--pn-muted);
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

.em-close-btn:hover { background: var(--pn-hover, #f0f4f8); color: var(--pn-text); }

.em-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.em-list-panel {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--pn-border);
  overflow-y: auto;
  padding: 8px 0;
}

.em-right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.em-pane {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Client Detail Page ─────────────────────────────────────────────────── */
.cdp-page {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0; bottom: 0;
  z-index: 99;
  background: var(--pn-white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cdp-page.hidden { display: none; }

.cdp-name-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: var(--pn-cream);
  border-bottom: 1px solid var(--pn-border);
  flex-shrink: 0;
}

.cdp-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--pn-text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.cdp-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cdp-nav-counter {
  font-size: 12px;
  color: var(--pn-muted);
  min-width: 46px;
  text-align: center;
}
.cdp-nav .btn { user-select: none; }

.cdp-group-field {
  margin-bottom: 14px;
}
.cdp-group-field .pill-select-trigger {
  min-width: 180px;
}
.modal-actions-wrapper { display: contents; }

.services-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
  padding: 2px 0;
}

.cdp-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.cdp-col {
  flex: 0 0 33.333%;
  width: 33.333%;
  overflow-y: auto;
  padding: 20px;
  border-right: 1px solid var(--pn-border);
  box-sizing: border-box;
  background: var(--pn-cream);
}
.cdp-col:last-child { border-right: none; }

#cdp-col-1 { padding-top: 12px; }

.cdp-col .form-grid { grid-template-columns: auto auto; }
.cdp-col .form-input,
.cdp-col .form-select { width: 100%; min-width: 110px; }

.cdp-inner-divider { border-top: 0.5px solid var(--pn-border); margin: 14px 0 12px; }


/* Notes column — fills vertical space */
.cdp-notes-col {
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.cdp-contact-section {
  flex-shrink: 0;
  padding: 12px 12px 12px;
  border-bottom: 0.5px solid var(--pn-border);
}

.cdp-notes-view-section {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
}

.cdp-notes-view-section .notes-display { flex: 1; min-height: 0; overflow-y: auto; }
.cdp-notes-view-section .notes-textarea { flex: 1; resize: none; }

/* Email column — list only */
.cdp-email-col {
  overflow: hidden;
  padding: 0 12px 0 0;
  display: flex;
  flex-direction: column;
  border-right: none;
  background: var(--pn-cream);
}
.cdp-email-col.hidden { display: none; }

/* Right-column tabs (Email / Orders) */
.cdp-right-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--pn-border);
  background: var(--pn-white);
}
.cdp-rtab {
  flex: 1;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--pn-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: color 0.12s, border-color 0.12s;
}
.cdp-rtab-label {
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.cdp-rtab:hover { color: var(--pn-text); }
.cdp-rtab-active {
  color: var(--pn-blue);
  border-bottom-color: var(--pn-blue);
}
.cdp-rpanel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cdp-email-col .em-list-panel {
  flex: 1;
  width: 100%;
  border-right: none;
  overflow-y: auto;
}

/* WooCommerce order list */
#woo-orders-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.woo-order {
  padding: 10px 14px;
  border-bottom: 1px solid var(--pn-border);
  background: #fff;
}
.woo-order-clickable { cursor: pointer; }
.woo-order-clickable:hover { background: var(--pn-hover, #f0f4f8); }
.woo-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.woo-order-num {
  font-size: 13px;
  font-weight: 600;
}
.woo-order-link {
  color: inherit;
  text-decoration: none;
}
.woo-order-link:hover { text-decoration: underline; }
.woo-order-link .ti-external-link { font-size: 11px; vertical-align: 1px; opacity: 0.5; }
.woo-order-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.woo-date {
  font-size: 11px;
  color: var(--pn-muted);
}
.woo-total {
  font-size: 12px;
  font-weight: 600;
  color: var(--pn-text);
}
.woo-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.woo-status-completed  { background: #e6f4ea; color: #1a7f5a; }
.woo-status-processing { background: #e3f2fd; color: #1565c0; }
.woo-status-cancelled  { background: #fdecea; color: #c62828; }
.woo-status-other      { background: #f5f5f5; color: #666; }
.woo-customer {
  font-size: 12px;
  font-weight: 600;
  color: var(--pn-text);
  margin-bottom: 3px;
}
.woo-items { padding-top: 2px; }
.woo-line-item {
  font-size: 12px;
  color: var(--pn-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.woo-qty {
  font-size: 11px;
  color: var(--pn-blue);
}
.woo-empty {
  padding: 24px 16px;
  color: var(--pn-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.woo-error { color: #c62828; }

#woo-summary-container {
  flex-shrink: 0;
}
.woo-summary {
  border-bottom: 1px solid var(--pn-border);
}
.woo-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}
.woo-summary-table th {
  padding: 6px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--pn-muted);
  border-bottom: 1px solid var(--pn-border);
  white-space: nowrap;
}
.woo-summary-table td {
  padding: 5px 14px;
  border-bottom: 1px solid var(--pn-border);
  vertical-align: middle;
  color: var(--pn-text);
  font-size: 12px;
}
.woo-summary-table tbody tr:last-child td { border-bottom: none; }
.woo-summary-table tbody tr:hover { background: var(--pn-hover, #f0f4f8); }
.woo-st-name   { font-weight: 600; }
.woo-st-qty    { text-align: center; width: 40px; }
.woo-st-total  { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.woo-st-period { white-space: nowrap; }
.woo-st-last   { white-space: nowrap; }
.woo-summary-table tfoot td { border-top: 1px solid var(--pn-border); padding-top: 8px; }

/* QuickBooks invoice status badges (reuses woo-status base) */
.qbo-status-paid    { background: #e6f4ea; color: #1a7f5a; }
.qbo-status-overdue { background: #fdecea; color: #c62828; }
.qbo-status-open    { background: #fff8e1; color: #b45309; }

/* QuickBooks not-connected state */
.qbo-not-connected {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--pn-muted);
  font-size: 13px;
  text-align: center;
  flex: 1;
}

/* Invoice list container */
#qbo-invoices-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

/* Client files list */
#client-files-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.cf-item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--pn-border);
  transition: background 0.12s;
  background: #fff;
}
.cf-item:hover { background: var(--pn-hover, #f0f4f8); }
.cf-item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--pn-text);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
}
.cf-icon {
  font-size: 22px;
  color: var(--pn-blue);
  flex-shrink: 0;
}
.cf-info { flex: 1; min-width: 0; }
.cf-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.cf-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--pn-muted);
}
.cf-open {
  font-size: 13px;
  color: var(--pn-muted);
  flex-shrink: 0;
}
.cf-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 14px 9px 0;
  font-size: 16px;
  color: var(--pn-muted);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
}
.cf-item:hover .cf-delete { opacity: 1; }
.cf-delete:hover { color: #e74c3c; }

.cdp-email-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--pn-border);
  flex-shrink: 0;
  background: var(--pn-cream);
}

.cdp-email-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--pn-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Email popup nav (prev/next in modal header) */
.evm-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  margin-right: 12px;
}
.evm-nav.hidden { display: none; }
.evm-counter {
  font-size: 12px;
  color: var(--pn-muted);
  min-width: 40px;
  text-align: center;
}

/* Email popup modal */
.email-view-modal-box {
  width: 820px;
  max-width: 95vw;
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.email-view-modal-box .modal-header {
  padding: 10px 20px;
}

.email-view-modal-box .email-compose-fields {
  padding: 10px 20px;
  gap: 6px;
}

.email-view-modal-box .email-compose-field {
  min-height: 28px;
}

.evm-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.evm-body .em-pane {
  flex: 1;
  min-height: 0;
}

.cdp-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid var(--pn-border-mid);
  flex-shrink: 0;
  background: var(--pn-cream);
}

/* ── Collapsible section headers (<details>/<summary>) ─────────────────── */
.cdp-collapsible { display: block; }

.cdp-collapsible > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.cdp-collapsible > summary::-webkit-details-marker { display: none; }
.cdp-collapsible > summary::marker { content: ''; }
.cdp-collapsible > summary:hover { color: var(--pn-text); }

.cdp-collapse-icon {
  font-size: 12px;
  color: var(--pn-muted);
  flex-shrink: 0;
  transition: transform 0.18s;
}
.cdp-collapsible[open] > summary .cdp-collapse-icon { transform: rotate(90deg); }

/* ── Compact layout for laptop screens (≤ 740 px tall) ─────────────────── */
@media (max-height: 720px) {
  .filters-sticky { position: static; }
}

@media (max-height: 740px) {
  .cdp-name-bar { padding: 5px 16px; }
  .cdp-title  { font-size: 16px; }
  .cdp-footer { padding: 4px 16px; }
  .cdp-footer .btn { padding: 6px 12px; font-size: 11px; }

  .cdp-col { padding: 12px; }
  #cdp-col-1 { padding-top: 10px; }
  .cdp-notes-view-section { padding: 6px 8px 8px; }
  .cdp-contact-section    { padding: 10px 8px 8px; }

  .cdp-inner-divider { margin: 8px 0 8px; }

  .modal-section-label { margin-top: 10px; padding-top: 6px; }
  .cdp-group-field { margin-bottom: 8px; }

  #cdp-col-1 .form-grid   { margin-bottom: 8px  !important; }
  .services-display        { margin-bottom: 6px  !important; }
}

/* ── Client History Tab ──────────────────────────────────────────────────── */
#client-history-list {
  overflow-y: auto;
  flex: 1;
}
.ch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ch-table thead th {
  padding: 7px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pn-muted);
  background: var(--pn-cream, #f8f9fa);
  border-bottom: 1px solid var(--pn-border, #e2e8f0);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.ch-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--pn-border, #e2e8f0);
  vertical-align: middle;
}

/* ── Quick status change ─────────────────────────────────────────────── */
.qs-pill-wrap {
  cursor: pointer;
  display: inline-block;
  border-radius: 3px;
  transition: opacity 0.1s;
}
.qs-pill-wrap:hover {
  opacity: 0.8;
  outline: 2px solid rgba(59,130,246,0.35);
  outline-offset: 1px;
}
.qs-dropdown {
  user-select: none;
}
.qs-option {
  padding: 5px 10px;
  cursor: pointer;
}
.qs-option:hover {
  background: var(--pn-cream, #f8f9fa);
}
