@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;
  --bulk-bar-h:      0px;
  --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;
  align-items: center;
  overflow: hidden;
}

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


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

.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;
}

/* ── Topbar mobile nav (hamburger + search overlay) ──────── */

.topbar-overflow-menu { position: relative; display: block; }

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

#topbar-overflow-dropdown { left: 0; right: auto; }

.topbar-search-btn { display: none !important; }
.topbar-search-close { display: none !important; }
.topbar-add-client-overflow { display: none !important; }
.topbar-search-btn-mobile { display: none !important; }

@media (max-width: 900px) {
  .topbar-add-client-btn { display: none !important; }
  .topbar-add-client-overflow { display: flex !important; }
  .topbar-user-btn .ti-chevron-down { display: none; }
  .topbar-search-btn-mobile { display: inline-flex !important; }
  .topbar-search:not(.search-open) { width: 0; overflow: hidden; padding: 0; }
  .topbar-search { position: static; justify-content: flex-end; }
  .search-wrap-topbar { display: none; }

  .topbar-search.search-open {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--pn-green);
    z-index: 110;
    padding: 0 12px;
    justify-content: stretch;
  }
  .topbar-search.search-open .topbar-search-btn { display: none; }
  .topbar-search.search-open ~ .topbar-right .topbar-search-btn-mobile { display: none !important; }
  .topbar-search.search-open ~ .topbar-right { visibility: hidden; }
  .topbar-search.search-open .search-wrap-topbar {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    background: transparent;
  }
  .topbar-search.search-open .search-wrap-topbar i { color: rgba(255,255,255,0.8); }
  /* Make the inactive-clients toggle a reliable tap target in the overlay */
  .topbar-search.search-open .search-inactive-label {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    padding: 8px 10px;
    color: rgba(255,255,255,0.9);
  }
  .topbar-search.search-open .search-inactive-label input[type="checkbox"] {
    width: 20px; height: 20px;
  }
  .topbar-search.search-open .search-inactive-label i { color: rgba(255,255,255,0.9); }
  .topbar-search.search-open .search-input {
    background: transparent !important;
    color: #fff !important;
    border: none;
    box-shadow: none !important;
    outline: none;
    flex: 1;
    height: 100%;
    font-size: 15px;
  }
  .topbar-search.search-open .search-input::placeholder { color: rgba(255,255,255,0.6); }
  .topbar-search.search-open .topbar-search-close { display: inline-flex !important; flex-shrink: 0; color: rgba(255,255,255,0.9); background: transparent; border: none; }

  .sync-label { display: none; }
  #user-display-name { display: none; }
  .main-content { padding: 16px 12px 40px !important; padding-top: calc(var(--filters-h, 48px) + var(--bulk-bar-h, 0px)) !important; }
  .filters-sticky { padding: 6px 12px 4px; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 12px; }
  .topbar-right { gap: 8px; }
  .main-content { padding: 12px 6px 32px !important; padding-top: calc(var(--filters-h, 48px) + var(--bulk-bar-h, 0px)) !important; }
  .filters-sticky { padding: 6px 6px 4px; }
}

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

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

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

.main-content {
  flex: 1;
  padding: 24px 24px 48px;
  padding-top: calc(var(--filters-h, 48px) + var(--bulk-bar-h, 0px));
  min-width: 0;
}

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

.filters-sticky {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--pn-cream);
  padding: 6px 24px 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Filter panel collapse toggle */
.filters-toggle-row {
  display: flex;
  align-items: center;
  padding: 2px 0 6px;
  cursor: pointer;
  user-select: none;
}
.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pn-muted);
  padding: 2px 0;
}
.filters-toggle:hover { color: var(--pn-text); }
.filters-toggle-chevron { font-size: 14px; transition: transform 0.18s ease; }
.filter-count {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  background: var(--pn-blue-light);
  color: var(--pn-blue);
  border-radius: 20px;
  padding: 1px 7px;
}
.filter-count.filtered { background: var(--pn-green); color: #fff; }
.filter-count.hidden { display: none; }
.filters-sticky.filters-collapsed .filters-toggle-chevron { transform: rotate(-90deg); }

#filters-collapsible {
  overflow: visible;
  transition: max-height 0.22s ease, opacity 0.18s ease;
  max-height: 1000px;
  opacity: 1;
}
.filters-sticky.filters-collapsed #filters-collapsible {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

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

.search-wrap-topbar {
  display: flex;
  align-items: center;
  width: 360px;
  border-radius: 0;
  background: #fff;
  border: none;
}

.search-wrap-inner {
  flex: 1;
  min-width: 0;
  max-width: none;
  position: relative;
}

.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;
}

.search-inactive-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 400;
  color: var(--pn-muted);
  white-space: nowrap;
  cursor: pointer;
  padding: 2px 8px;
  flex-shrink: 0;
}
.search-inactive-label:hover { color: var(--pn-text); }
.search-inactive-label input[type="checkbox"] { margin: 0; cursor: pointer; }


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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  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; }


/* ── 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: max-content;
  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: max-content;
  justify-content: center;
}

/* Clear-filter button in practitioner / month bars — styled as a chip, not a toolbar icon */
.prac-clear-btn {
  flex-shrink: 0;
  width: auto;
  height: auto;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--pn-border-mid);
  background: var(--pn-white);
  color: var(--pn-muted);
  font-size: 13px;
  opacity: 0.35;
  pointer-events: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s, opacity 0.12s;
}
.prac-clear-btn.prac-clear-active {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}
.prac-clear-btn.prac-clear-active:hover {
  background: var(--pn-cream);
  border-color: var(--pn-green-dark);
  color: var(--pn-green-dark);
}

.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;
  overflow: visible;
}

.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 {
  height: 36px;
  width: 100%;
  padding: 0 12px 0 32px;
  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;
}

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

.toolbar-pill-select {
  width: auto !important;
  min-width: 0;
  flex: 0 0 auto;
}
.toolbar-pill-select .pill-select-trigger {
  min-height: 36px;
  padding: 4px 10px;
  white-space: nowrap;
  width: auto;
}
.toolbar-pill-select .pill-select-display { flex: 0 0 auto; white-space: nowrap; }
.toolbar-pill-select .pill-select-placeholder { font-size: 12px; white-space: nowrap; }
.toolbar-pill-select .pill-select-opts { width: max-content; min-width: 100%; }
.toolbar-pill-select .pill-select-opt { white-space: nowrap; }

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

@media (max-width: 600px) {
  /* Practitioner + Month/Consult chip rows stack full-width instead of
     squeezing side by side (each bar's own overflow-x:auto then has the
     full viewport width to scroll within, instead of ~160px). */
  .filter-chip-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
  }
  .filter-chip-rows #practitioner-bar,
  .filter-chip-rows #planned-consult-bar {
    width: 100%;
    min-width: 0;
    margin-bottom: 0;
  }

  /* Smaller chip text on phone so more chips fit per row */
  .prac-label { font-size: 9px; padding: 4px 10px; }

  /* Month chips wrap onto two rows of six instead of scrolling off-screen */
  #planned-consult-bar {
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: flex-end;
  }
  #planned-consult-bar .prac-label-month {
    flex: 0 0 calc((100% - 36px - 6 * 6px) / 6);
    min-width: 0;
  }

  /* Toolbar wraps; Tags + Months share the last row, aligned with dropdowns above */
  .toolbar { flex-wrap: wrap; }
  #fs-status { order: 10; margin-left: 44px; }
  #fs-month  { order: 10; }

}

.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;
}

.data-table th.cb-col                      { width: 80px; }
.data-table th:nth-child(2)                { width: 15%; }  /* client name */

.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; }

/* ── 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; }

@media (max-width: 600px) {
  .view-edit-toggle .prac-label { padding: 7px 10px; }
  .view-edit-toggle .view-label-text { display: none; }
}

/* ── Compact View ────────────────────────────────────────── */

.compact-table {
  table-layout: auto;
  width: 100%;
}

.compact-table td {
  padding: 4px 10px;
  white-space: nowrap;
}

.compact-table th {
  white-space: nowrap;
}

.compact-row td { line-height: 1.3; }

.compact-name     { font-weight: 500; color: var(--pn-text); white-space: nowrap; }
.compact-pill     { white-space: nowrap; }
.compact-services { white-space: normal; }
.compact-status   { white-space: normal; width: 100%; }

@media (max-width: 900px) {
  #table-card-wrap { overflow-x: auto; }
}

/* Phone: compact table rows become stacked cards, mirroring the Today-view
   card row layout — name row (name + practitioner + month), then a status
   tags row, then a services + consult-date row. */
@media (max-width: 600px) {
  #table-card-wrap { overflow-x: visible; }

  .compact-table thead { display: none; }
  .compact-table, .compact-table tbody { display: block; width: 100%; }

  .compact-table tr.compact-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--pn-border);
  }
  .compact-table tr.compact-row td {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    white-space: normal;
    border-bottom: none;
  }
  .compact-table tr.compact-row td.cb-col {
    display: none;
  }

  /* Row 1 (mirrors .today-card-row1): name (flex, ellipsis) + practitioner + month */
  .compact-table tr.compact-row td.compact-name {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .compact-table tr.compact-row td.compact-pill {
    order: 2;
    flex: 0 0 auto;
    min-width: 0;
  }

  /* Row 2 (mirrors .today-card-row2): status tags left, services + consult right */
  .compact-table tr.compact-row td.compact-status {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
  }
  .compact-table tr.compact-row td.compact-services {
    order: 4;
    flex: 1 1 auto;
    min-width: 0;
  }
  .compact-table tr.compact-row td.compact-consult {
    order: 5;
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 13px;
    color: var(--pn-muted);
    white-space: nowrap;
  }

  .compact-table tr.group-header-row { display: block; }
  .compact-table tr.group-header-row td { display: block; padding: 4px 12px; }

  .compact-contact { font-size: 13px; }

  /* Quick-action shortcut icons (email/notes/files/todos) are too small to be
     usable on phone — hide them in both the Active list and Today cards. */
  .quick-note-btn { display: none !important; }
}


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

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  margin: 0;
  background: var(--pn-green);
  border-bottom: 1px solid var(--pn-green-dark);
  position: fixed;
  top: calc(var(--topbar-h) + var(--filters-h, 48px));
  left: 0;
  right: 0;
  z-index: 51;
  min-height: 52px;
}

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

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

.bulk-actions-full { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.bulk-overflow-menu { position: relative; display: none; }
#bulk-overflow-dropdown { left: auto; right: 0; }

@media (max-width: 600px) {
  .bulk-bar { flex-wrap: wrap; }
  .bulk-actions-full { display: none; }
  .bulk-overflow-menu { display: block; }
}

/* ── 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) ───────────────────────────── */

.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;
  padding: 7px 14px;
  font-size: 11px;
}
.btn-action:hover {
  background: var(--pn-green-dark);
  color: var(--pn-text);
  border-color: var(--pn-green-dark);
}


.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);
}


.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);
}

/* ── 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 {
  padding: 5px 0;
  border-bottom: 0.5px solid var(--pn-border);
}
.note-entry:last-child { border-bottom: none; }

.note-entry-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.note-body {
  font-size: 13px;
  color: var(--pn-text);
  font-weight: 400;
  margin-top: 2px;
  white-space: pre-wrap;
}

.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-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); } }

.pebble-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
}
.pebble-loader-svg {
  width: 160px;
  height: 104px;
  animation: pebble-heartbeat 1.4s ease-in-out infinite;
  transform-origin: center center;
  filter: drop-shadow(0 6px 16px rgba(128,169,189,0.45));
}

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

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

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

.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);
  min-width: 420px;
}

.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;
}

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

@media (max-width: 1280px) {
  body                             { font-size: 12px; }
  .data-table                      { font-size: 11px; }
  .search-input                    { 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,
  .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-body,
  .note-freetext,
  .cal-list-time,
  .cal-list-call,
  .cal-list-name,
  .cal-list-meta,
  .cal-list-contact,
  .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: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ── 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-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);
}

@media (max-width: 600px) {
  .email-compose-field { flex-wrap: wrap; }
  .email-compose-field-label { margin-left: 0 !important; width: auto; flex-basis: 100%; }
  .email-compose-field .search-input,
  .email-compose-field select { flex: 1 1 100%; min-width: 0; }
}


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

#em-compose-pane {
  overflow-y: auto;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
}

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

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

#ec-template-dropdown {
  right: auto;
  left: 0;
}

.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);
  right: 0;              /* anchor to right edge so it expands inward, not past the frame */
  left: auto;
  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);
  width: 300px;
  max-width: min(360px, 90vw);
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
}

.ec-doc-search-wrap {
  padding: 6px 8px 8px;
  border-bottom: 1px solid var(--pn-border);
  margin-bottom: 4px;
}
.ec-doc-search {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  box-sizing: border-box;
}

.ec-doc-upload-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pn-blue);
  background: none;
  border: none;
  border-bottom: 1px solid var(--pn-border);
  cursor: pointer;
  text-align: left;
}
.ec-doc-upload-btn:hover { background: var(--pn-hover, #f0f4f8); }
.ec-doc-upload-btn i { font-size: 15px; }

.ec-doc-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  background: none;
  border: none;
  text-align: left;
}

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

.ec-doc-item-icon {
  margin-top: 1px;
  flex-shrink: 0;
  font-size: 15px;
  color: var(--pn-muted);
}
.ec-doc-item-selected .ec-doc-item-icon { color: var(--pn-green-dark); }
.ec-doc-item-selected { background: var(--pn-green-light, #eef6ee); }

.ec-doc-item-text { display: flex; flex-direction: column; min-width: 0; }

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

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

/* Selected-attachment chips below the subject row */
.ec-attach-chips-row { align-items: flex-start; }
.ec-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.ec-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 4px 3px 8px;
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  background: var(--pn-white);
  font-size: 12px;
}
.ec-attach-chip i { font-size: 12px; color: var(--pn-muted); flex-shrink: 0; }
.ec-attach-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-attach-chip-x {
  display: inline-flex;
  align-items: center;
  border: none;
  background: none;
  padding: 1px;
  cursor: pointer;
  border-radius: 3px;
  color: var(--pn-muted);
}
.ec-attach-chip-x:hover { background: var(--pn-hover, #f0f4f8); color: var(--pn-text); }

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

.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;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* ── 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: 20px 24px;
  min-height: 0;
  position: relative;
  overflow-y: auto;
}

.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-detail-iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
}

.eh-item {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid var(--pn-border);
  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:has(.eh-item-checkbox:checked) { background: var(--pn-blue-light); }

.eh-item-cb-wrap {
  display: flex;
  align-items: center;
  padding: 12px 4px 12px 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.eh-item-checkbox { cursor: pointer; }

.eh-item-body {
  flex: 1;
  min-width: 0;
  padding: 10px 14px 10px 6px;
  cursor: pointer;
}

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

.eh-item-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.eh-mailbox {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pn-muted);
  background: var(--pn-hover, #f0f4f8);
  border: 1px solid var(--pn-border, #e0e0e0);
  border-radius: 3px;
  padding: 1px 5px;
}

.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;
}

.eh-attach-indicator {
  color: var(--pn-muted);
  display: inline-flex;
  align-items: center;
  font-size: 13px;
}

.eh-flag-indicator {
  color: var(--pn-red);
  display: inline-flex;
  align-items: center;
  font-size: 13px;
}

.eh-shared-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--pn-amber-light);
  color: var(--pn-amber);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.eh-shared-indicator i { font-size: 12px; }

/* Ambiguous (shared address, not yet assigned) emails — needs attention. */
.eh-item-ambiguous {
  background: var(--pn-amber-light);
  border-left: 3px solid var(--pn-amber);
}
.eh-item-ambiguous:hover { background: #ffe6d1; }
.eh-item-ambiguous .eh-subject { font-weight: 700; }

.eh-assign-row {
  align-items: flex-start;
  margin-top: 8px;
}

.eh-assign-picker {
  position: relative;
  flex: 1;
  min-width: 0;
}

.eh-assign-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 10px;
  border: 0.5px solid var(--pn-border-mid);
  border-radius: var(--radius-sm);
  background: var(--pn-white);
  cursor: pointer;
  font-size: 13px;
  min-height: 32px;
  user-select: none;
}
.eh-assign-trigger:hover { border-color: var(--pn-green); }
.eh-assign-picker.open .eh-assign-trigger { border-color: var(--pn-green); box-shadow: 0 0 0 2px rgba(197,217,243,0.5); }

.eh-assign-trigger-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.eh-assign-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--pn-white);
  border: 1px solid var(--pn-border-mid);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 500;
  max-height: 320px;
  overflow-y: auto;
}
.eh-assign-picker.open .eh-assign-dropdown { display: block; }

.eh-assign-opt {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 0.5px solid var(--pn-border);
}
.eh-assign-opt:last-child { border-bottom: none; }
.eh-assign-opt:hover { background: var(--pn-cream); }
.eh-assign-opt-selected { background: #f0f7f0; }

.eh-assign-opt-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.eh-assign-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.eh-assign-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
}


.eh-item-flagged {
  border-left: 3px solid var(--pn-red);
}

.eh-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.eh-attach-loading { color: var(--pn-muted); font-size: 12px; }
.eh-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  background: var(--pn-white);
  color: var(--pn-text);
  font-size: 12px;
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s;
}
.eh-attach-chip:hover { background: var(--pn-blue-light); border-color: var(--pn-blue); }
.eh-attach-chip i { font-size: 13px; color: var(--pn-muted); flex-shrink: 0; }
.eh-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eh-attach-size { color: var(--pn-muted); flex-shrink: 0; }

.eh-attach-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
}
.eh-attach-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  background: var(--pn-white);
  color: var(--pn-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.eh-attach-upload-btn:hover { background: var(--pn-green-light); border-color: var(--pn-green); color: var(--pn-green-dark); }
.eh-attach-upload-btn:disabled { cursor: default; opacity: 0.6; }
.eh-attach-upload-btn i { font-size: 13px; }

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

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

.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;
}
.modal-actions-wrapper { display: contents; }

.cdp-qs-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
}
.cdp-qs-pill:hover { background: rgba(0,0,0,0.04); outline: 1px solid var(--pn-border-mid); }
.cdp-qs-placeholder { color: var(--pn-muted); font-size: 12px; font-style: italic; }

.cdp-qs-pill-area {
  cursor: pointer;
  border: 0.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 3px 4px;
  margin: -3px -4px;
}
.cdp-qs-pill-area:hover { border-color: var(--pn-green); background: var(--pn-cream); }

.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;
}

/* Column tab strip — hidden on desktop, shown when columns stack (see media query below) */
.cdp-col-tabs {
  display: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--pn-border);
  background: var(--pn-white);
}
.cdp-col-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--pn-muted);
  background: var(--pn-cream);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.cdp-col-tab:hover { color: var(--pn-text); }
.cdp-col-tab-active {
  color: var(--pn-blue);
  border-bottom-color: var(--pn-blue);
  background: var(--pn-white);
}

.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; }

@media (max-width: 900px) {
  .cdp-col-tabs { display: flex; }
  .cdp-body { flex-direction: column; }
  .cdp-body .cdp-col {
    flex: 1 1 auto;
    width: 100%;
    border-right: none;
    display: none;
  }
  .cdp-body .cdp-col.cdp-col-active { display: flex; }
  /* col 1 isn't display:flex by default (it's a plain block of form fields) */
  .cdp-body #cdp-col-1.cdp-col-active { display: block; }
}

#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-notes-view-section {
  flex: 1 1 auto;
  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; }

.cdp-todo-section {
  flex: 0 0 auto;
  max-height: 45%;
  overflow: hidden;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--pn-border);
}

.cdp-todo-section #client-todos-list { flex: 1; min-height: 0; overflow-y: auto; }
.cdp-todo-section #client-todos-list .woo-empty { padding: 6px 0; }

/* 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: 9px;
  font-weight: 500;
  color: var(--pn-muted);
  background: var(--pn-cream);
  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, background 0.12s;
}
.cdp-rtab-label {
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.cdp-rtab-count { display: none; }
.cdp-rtab:hover { color: var(--pn-text); }
.cdp-rtab:focus { outline: none; }
.cdp-rtab-active {
  color: var(--pn-blue);
  border-bottom-color: var(--pn-blue);
  background: var(--pn-white);
}
.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 and QuickBooks services (invoice summary) panels —
   the summary table scrolls internally (capped height) so the timeline below
   it stays visible instead of being pushed off-screen by a long summary. */
#cdp-panel-orders,
#cdp-panel-invoices {
  overflow: hidden;
}
#woo-summary-container,
#qbo-summary-container {
  flex: 0 1 auto;
  overflow-y: auto;
  max-height: 45%;
}
.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-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-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 {
  padding: 8px 4px;
}

/* ── Activity Log (History tab) ─────────────────────────────────────────── */

#activity-log-list {
  flex: 1;
  overflow-y: auto;
}

.al-list {
  display: flex;
  flex-direction: column;
}
.al-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--pn-border);
}
.al-row-icon {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 14px;
  color: var(--pn-muted);
}
.al-row-body {
  flex: 1;
  min-width: 0;
}
.al-row-desc {
  font-size: 13px;
  color: var(--pn-text);
  line-height: 1.4;
  margin-top: 3px;
}
.al-col-title { font-weight: 600; }
.al-val-from { color: var(--pn-red); }
.al-val-to   { color: var(--pn-green-dark); }
.al-row-meta {
  font-size: 11px;
  color: var(--pn-muted);
}
.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: 10px 16px;
  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: 10px 16px;
  border-bottom: 1px solid var(--pn-border);
  vertical-align: middle;
  color: var(--pn-text);
  font-size: 13px;
}
.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-product { display: flex; align-items: center; gap: 10px; min-width: 0; }
.woo-st-product-name { overflow: hidden; text-overflow: ellipsis; }
.woo-st-product-link { text-decoration: none; color: inherit; }
.woo-st-product-link:hover .woo-st-product-name { color: var(--pn-blue); text-decoration: underline; }
.woo-st-ext { font-size: 11px; opacity: 0.4; vertical-align: 1px; }
.woo-st-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--pn-border);
  background: #fff;
}
.woo-st-thumb-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--pn-muted);
  font-size: 24px;
}
.woo-st-qty    { text-align: center; width: 48px; }
.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: 12px; }

/* 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; }

/* Combined timeline list containers — scroll when content overflows */
#woo-timeline-list,
#qbo-timeline-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0;
}

/* ── Graphical timeline ───────────────────────────────────────────────────── */
/* A continuous vertical axis runs down the left; each row places a dot on the
   axis with its card to the right. Events are grouped under month headers. */
.tl-track {
  position: relative;
  padding: 4px 0 12px;
}
/* The axis line — a thin rule down the gutter, behind the dots. */
.tl-track::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 19px;                 /* centre of the 40px axis gutter */
  width: 2px;
  background: var(--pn-border);
}

/* Year divider — a prominent band spanning the full track width. */
.tl-year {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 4px;
}
.tl-year::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--pn-border);
}
.tl-year-label {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--pn-green-dark);
  padding: 3px 12px;
  border-radius: 0;
}
.tl-year:first-child { margin-top: 4px; }

/* Month sub-header within a year, label offset past the axis. */
.tl-month {
  position: relative;
  margin: 12px 0 8px;
  padding-left: 52px;
}
.tl-month-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pn-muted);
  background: var(--pn-cream, #fff);
  padding: 2px 6px;
  position: relative;
  z-index: 1;
}

/* Event row: fixed-width axis gutter + flexible card. */
.tl-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 8px 0;
}
.tl-axis {
  position: relative;
  width: 40px;
  flex-shrink: 0;
  align-self: stretch;
}
.tl-dot {
  position: absolute;
  top: 12px;
  left: 13px;                 /* centres a 12px dot over the 2px line at 19px */
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--pn-cream, #fff);
  box-shadow: 0 0 0 1px var(--pn-border);
}
.tl-dot-order   { background: #6b8cce; }
.tl-dot-invoice { background: #1a7f5a; }

.tl-card {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--pn-border);
  border-radius: 0;
  padding: 8px 12px;
  background: var(--pn-white, #fff);
}
.tl-card.woo-order-clickable { cursor: pointer; transition: border-color 0.1s, box-shadow 0.1s; }
.tl-card.woo-order-clickable:hover { border-color: var(--pn-green-dark); box-shadow: 0 1px 4px rgba(0,0,0,0.10); }

/* Source-type badges */
.tl-ref { display: inline-flex; align-items: center; gap: 6px; }
.tl-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 0;
}
.tl-badge i { font-size: 11px; }
.tl-badge-order   { background: #eaf0fb; color: #3b5a9e; }
.tl-badge-invoice { background: #e6f4ea; color: #1a7f5a; }

/* 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;
}
.qbo-no-match {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  color: var(--pn-muted);
}
.qbo-no-match > i { font-size: 28px; opacity: 0.4; margin-bottom: 10px; }
.qbo-no-match-title { font-size: 14px; font-weight: 600; color: var(--pn-text); margin-bottom: 6px; }
.qbo-no-match-detail { font-size: 13px; margin-bottom: 8px; }
.qbo-no-match-detail strong { color: var(--pn-text); font-weight: 600; }
.qbo-no-match-hint { font-size: 12px; line-height: 1.5; max-width: 280px; }

.inv-form-row { margin-bottom: 16px; }

.inv-lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.inv-lines-table th {
  background: var(--pn-green-light);
  color: var(--pn-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--pn-green-mid);
  white-space: nowrap;
}
.inv-lines-table td {
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--pn-border);
  vertical-align: middle;
}
.inv-lines-table .form-input {
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
}
.inv-lines-table .inv-line-amount {
  font-weight: 600;
  white-space: nowrap;
}
.qbo-disconnect-row {
  text-align: center;
  padding: 14px 0 4px;
}
.qbo-disconnect-link {
  background: none;
  border: none;
  color: var(--pn-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}
.qbo-disconnect-link:hover { color: var(--pn-text); }

/* Client files list */
#client-files-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
/* File category groups */
.cf-group { margin-bottom: 10px; }
.cf-group-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--pn-cream, #f7f5f0);
  border-top: 1px solid var(--pn-border);
  border-bottom: 1px solid var(--pn-border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pn-text);
  position: sticky;
  top: 0;
  z-index: 1;
}
.cf-group-header > i { font-size: 14px; color: var(--pn-green-dark); }
.cf-group-label { flex: 1; }
.cf-group-count {
  font-weight: 600;
  color: var(--pn-muted);
  background: #fff;
  border: 1px solid var(--pn-border);
  border-radius: 0;
  padding: 0 6px;
  font-size: 10px;
}

.cf-select-all-wrap {
  display: flex;
  align-items: center;
  padding: 0 6px 0 2px;
  cursor: pointer;
}

.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:has(.cf-checkbox:checked) { background: var(--pn-blue-light); }

.cf-checkbox-wrap {
  display: flex;
  align-items: center;
  padding: 0 4px 0 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.cf-checkbox { cursor: pointer; }
.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; }

.cf-analyse {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 6px 9px 0;
  font-size: 16px;
  color: var(--pn-green-dark);
  opacity: 1;
  transition: color 0.15s;
  line-height: 1;
}
.cf-analyse:hover { color: var(--pn-accent, #2d7aee); }

/* Client To Do tab */
.ct-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--pn-border);
  flex-wrap: wrap;
}
.ct-add-row #tm-new-title { flex: 1; min-width: 140px; }
.ct-add-due { width: 150px; }

.ct-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--pn-border);
  transition: background 0.12s;
  background: #fff;
}
.ct-row:hover { background: var(--pn-hover, #f0f4f8); }
.ct-row-overdue { border-left: 3px solid var(--pn-red); }
.ct-row-done { opacity: 0.55; }
.ct-row-done .ct-title { text-decoration: line-through; }

.ct-checkbox { flex-shrink: 0; cursor: pointer; }
.ct-info { flex: 1; min-width: 0; }
.ct-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.ct-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--pn-muted);
}
.ct-due-overdue { color: var(--pn-red); font-weight: 600; }
.ct-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  color: var(--pn-muted);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
}
.ct-row:hover .ct-delete { opacity: 1; }
.ct-delete:hover { color: #e74c3c; }

/* HTMA Analysis Modal */
:root {
  --htma-ok:   #27ae60;
  --htma-low:  #2980b9;
  --htma-high: #e74c3c;
}
.htma-modal-box { max-width: 660px; width: 95vw; }
.htma-modal-body { padding: 0 20px 8px; max-height: 70vh; overflow-y: auto; }

.htma-loading, .htma-error {
  padding: 32px 24px;
  text-align: center;
  color: var(--pn-muted);
  font-size: 13px;
}
.htma-error { color: #e74c3c; }

@keyframes pebble-heartbeat {
  0%   { transform: scale(1);    }
  14%  { transform: scale(1.18); }
  28%  { transform: scale(1);    }
  42%  { transform: scale(1.12); }
  56%  { transform: scale(1);    }
  100% { transform: scale(1);    }
}

.htma-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--pn-border);
  margin-bottom: 10px;
}
.htma-meta-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--pn-text);
  margin-right: 4px;
}
.htma-meta-chip {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pn-muted);
  background: var(--pn-bg2, #f3f4f6);
  border-radius: 4px;
  padding: 2px 7px;
}

.htma-section { margin-bottom: 16px; }
.htma-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pn-muted);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--pn-border);
  margin-bottom: 4px;
}

.htma-row {
  display: grid;
  grid-template-columns: 28px 110px 1fr 56px 80px 44px;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
}

.htma-sym { font-weight: 700; color: var(--pn-text); }
.htma-name { color: var(--pn-muted); }
.htma-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--pn-text); }
.htma-ref { text-align: right; font-size: 11px; color: var(--pn-muted); font-variant-numeric: tabular-nums; }

@media (max-width: 600px) {
  .htma-row {
    grid-template-columns: 22px 1fr auto auto;
    grid-template-areas:
      "sym name val badge"
      "bar bar bar bar"
      "ref ref ref ref";
    row-gap: 2px;
    padding: 7px 0;
    border-bottom: 1px solid var(--pn-border);
  }
  .htma-sym      { grid-area: sym; }
  .htma-name     { grid-area: name; }
  .htma-val      { grid-area: val; text-align: right; }
  .htma-badge    { grid-area: badge; }
  .htma-bar-wrap { grid-area: bar; margin-top: 3px; }
  .htma-ref      { grid-area: ref; text-align: left; }
}

.htma-bar-wrap { position: relative; }
.htma-bar {
  position: relative;
  height: 6px;
  background: var(--pn-bg2, #f0f2f5);
  border-radius: 3px;
  overflow: visible;
}
.htma-bar-ref {
  position: absolute;
  left: 25%;
  width: 50%;
  top: 0;
  bottom: 0;
  background: rgba(39,174,96,0.18);
  border-radius: 3px;
}
.htma-bar-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: -1px;
  transform: translateX(-50%);
}

.htma-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 4px;
  padding: 2px 6px;
}
.htma-badge-low  { background: rgba(41,128,185,0.12); color: var(--htma-low); }
.htma-badge-high { background: rgba(231,76,60,0.12);  color: var(--htma-high); }

.htma-low  .htma-val { color: var(--htma-low); }
.htma-high .htma-val { color: var(--htma-high); }

.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;
}
.evm-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.evm-subject {
  font-size: 12px;
  color: var(--pn-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.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;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid var(--pn-border-mid);
  flex-shrink: 0;
  background: var(--pn-cream);
}

.cdp-footer .btn-danger,
.cdp-footer .btn-secondary {
  padding: 7px 14px;
  font-size: 11px;
}

@media (max-width: 600px) {
  .cdp-footer {
    flex-wrap: wrap;
    padding: 8px 12px;
  }
  .cdp-footer .btn { padding: 6px 9px; font-size: 11px; }
  .cdp-rtab { font-size: 18px; padding: 8px 4px; flex-direction: column; gap: 2px; }
  .cdp-rtab-label { display: none; }
  .cdp-rtab-count { display: inline; font-size: 10px; font-weight: 600; letter-spacing: 0; line-height: 1; }

  /* Column-switcher tabs: uppercase, normal weight */
  .cdp-col-tab { text-transform: uppercase; font-weight: 400; letter-spacing: 0.06em; }

  /* Client name + contact name stack on separate lines instead of truncating on one */
  .cdp-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
  }
  #modal-title-contact {
    display: block;
    font-size: 13px;
  }
}


/* ── Compact layout for laptop screens (≤ 740 px tall) ─────────────────── */

@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-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);
}

/* Inline Status Tags editor (dropdown with checkboxes) */
/* Inline Status Tags editor — floating two-column dual-list popup */
.tag-editor-dl {
  background: #fff;
  border: 1px solid var(--pn-border);
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.18);
  padding: 10px;
  user-select: none;
}
.tag-editor-dl .services-dual-list {
  grid-template-columns: 200px auto 200px;
}
.tag-editor-dl .sdl-panel { min-height: 150px; }
.tag-editor-dl .sdl-list  { max-height: 240px; }

/* ── Today Page ──────────────────────────────────────────── */

.today-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* Left panel — upcoming consultations */
.today-consult-panel {
  flex: 0 0 28%;
  min-width: 200px;
  max-width: 320px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  background: var(--pn-white);
  border: 1px solid var(--pn-border);
  border-radius: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: flex-basis 0.15s ease, min-width 0.15s ease;
}
.today-consult-panel-toggle {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 100%;
  height: 22px;
  padding: 0;
  border: none;
  border-bottom: 1px solid var(--pn-border);
  border-radius: 0;
  background: var(--pn-cream);
  color: var(--pn-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.today-consult-panel-toggle:hover { color: var(--pn-text); background: var(--pn-border); }
.today-consult-panel-toggle i { transition: transform 0.15s ease; }
.today-layout:has(.today-consult-panel-collapsed) { gap: 0; }
.today-consult-panel-collapsed {
  flex: 0 0 auto;
  min-width: 0;
  width: 22px;
  border-top: none;
  border-bottom: none;
  border-left: none;
}
.today-consult-panel-collapsed .today-consult-panel-toggle i { transform: rotate(180deg); }
.today-consult-panel-collapsed .today-consult-panel-body { display: none; }
.today-consult-panel-heading {
  padding: 10px 14px;
  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);
}
.today-todo-panel-heading {
  border-top: 1px solid var(--pn-border);
}
.today-todo-panel-row { align-items: center; }
.today-todo-due {
  font-size: 12px;
  color: var(--pn-muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.today-todo-due-overdue { color: var(--pn-red); font-weight: 600; }
.today-consult-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--pn-muted);
  font-style: italic;
  margin: 0;
}
.today-cl-group { padding: 0; }
.today-cl-date {
  padding: 6px 14px 3px;
  font-size: 13px;
  font-weight: 700;
  color: var(--pn-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--pn-border);
}
.today-cl-group:first-child .today-cl-date { border-top: none; }
.today-cl-date-today { color: var(--pn-green-dark); }
.today-cl-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--pn-border);
}
.today-cl-row:last-child { border-bottom: none; }
.today-cl-row:hover { background: var(--pn-cream); }
.today-cl-time {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--pn-blue);
  min-width: 34px;
  flex-shrink: 0;
}
.today-cl-time-none { color: var(--pn-muted); font-weight: 400; }
.today-cl-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.today-cl-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.today-cl-sub {
  font-size: 13px;
  color: var(--pn-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.today-cl-call {
  font-style: italic;
}
.today-cl-prac {
  flex-shrink: 0;
}

/* Right panel — client cards */
.today-cards-panel {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

.today-groups {
  width: 100%;
  overflow-x: hidden;
}

.today-group-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.today-card-last-updated {
  font-size: 12px;
  font-weight: 400;
  color: var(--pn-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: 2px;
}
.today-card-last-updated.tlu-recent {
  font-weight: 700;
  color: var(--pn-text);
}
.today-card-last-updated.tlu-hot {
  font-weight: 700;
  color: var(--pn-red);
}
.today-group-heading {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
}
.today-group-heading-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.today-client-card {
  background: var(--pn-cream);
  border: 1px solid var(--pn-border);
  border-radius: 0;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 33vh;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  transition: box-shadow 0.1s, border-color 0.1s;
}
.today-client-card:hover {
  border-color: var(--pn-green-dark);
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}
.today-cards-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 8px;
}

.today-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.today-card-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
/* Practitioner + Month, shown in the group row (right side) at all breakpoints. */
.today-card-row1b {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.today-card-collapse-btn {
  background: var(--pn-green);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  padding: 0;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  line-height: 1;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.today-card-collapse-btn:hover { background: var(--pn-green-dark); }
.today-client-card-collapsed .today-card-collapse-btn { transform: rotate(-90deg); }
.today-client-card-collapsed .today-card-row2,
.today-client-card-collapsed .today-card-body { display: none; }
.today-client-card-collapsed { max-height: none; overflow-y: visible; }
.today-card-name {
  font-weight: 600;
  font-size: 17px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-card-prac {
  flex-shrink: 0;
}
.today-card-planned {
  flex-shrink: 0;
}
.today-card-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.today-card-row2-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
/* Inline-editable fields on a today card (practitioner / month / status tags) */
.today-edit-pill {
  cursor: pointer;
  border-radius: 4px;
  transition: box-shadow 0.12s, background 0.12s;
}
.today-edit-pill:hover {
  box-shadow: 0 0 0 2px var(--pn-blue-light);
}
.today-card-row2-left.today-edit-pill { padding: 1px 2px; margin: -1px -2px; min-height: 18px; }
.today-card-row2-right {
  flex-shrink: 0;
}
.today-card-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.today-card-emails {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  min-width: 0;
  gap: 4px;
  margin-top: 6px;
}
.today-card-notes {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  min-width: 0;
}
.today-note-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  min-width: 0;
}
.today-note-icon {
  font-size: 12px;
  color: var(--pn-muted);
  flex-shrink: 0;
}
.today-note-text {
  flex: 1;
  min-width: 0;
  color: var(--pn-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.today-note-time {
  font-size: 11px;
  color: var(--pn-muted);
  flex-shrink: 0;
}
.today-card-todos {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  min-width: 0;
}
.today-todo-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 2px 0;
  min-width: 0;
}
.today-todo-checkbox { flex-shrink: 0; cursor: pointer; }
.today-todo-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--pn-text);
}
.today-todo-due {
  font-size: 11px;
  color: var(--pn-muted);
  flex-shrink: 0;
}
.today-todo-overdue .today-todo-due { color: var(--pn-red); font-weight: 600; }
.today-detail-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--pn-text);
}
.today-detail-icon {
  font-size: 14px;
  flex-shrink: 0;
  color: var(--pn-green-dark);
}

/* Email rows inside a today card reuse .eh-item styles but don't have the
   checkbox wrapper, so reset to block and restore the body padding. */
.today-card-emails .eh-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--pn-border);
  border-radius: 0;
}
.today-card-emails .eh-item:last-child { border-bottom: none; }

/* Emails within the last hour — make them stand out.
   Received = amber, Sent = blue, so direction stays clear at a glance. */
.eh-item-new {
  background: #fff4e5;
  border-left: 3px solid #f5a623;
}
.eh-item-new:hover { background: #ffedd0; }
.eh-item-new .eh-subject { font-weight: 700; }
.eh-item-new-sent {
  background: #eaf0fb;
  border-left-color: #3b76d9;
}
.eh-item-new-sent:hover { background: #dde8f8; }

.eh-new-badge {
  background: #f5a623;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 0;
}
.eh-new-badge-sent { background: #3b76d9; }

.today-empty {
  padding: 20px 14px;
  font-size: 13px;
  color: var(--pn-muted);
  text-align: center;
}
.today-loading-spinner {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}
.today-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.today-error {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--pn-red);
}


@media (max-width: 900px) {
  .today-layout { flex-direction: column; }
  .today-consult-panel { flex: none; max-width: 100%; width: 100%; position: static; max-height: none; overflow-y: visible; }
  #today-consult-list { max-height: none; overflow-y: visible; }
  .today-client-card { max-height: none; overflow-y: visible; }
}
@media (max-width: 500px) {

  /* Unbreakable nowrap text (email subjects/previews, note/file/todo text) can force
     a multicol container wider than its flex parent even with min-width:0 on every
     ancestor — break the text instead of relying on a width constraint that the
     multicol box doesn't reliably enforce at this breakpoint. */
  .today-note-text,
  .today-todo-text,
  .eh-subject,
  .eh-preview {
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }

  /* The only intentional differences from tablet/desktop at this breakpoint:
     (i) quick-action shortcut icons hidden (.quick-note-btn, ruled globally
         above); (ii) smaller font sizes; (iii) group name truncated
         (.today-group-heading-truncate, ruled globally below). Row structure
         (row1 / group row / row2) is otherwise identical to desktop. */
  .today-card-row2 { flex-wrap: wrap; }
  .today-card-row1 { flex-wrap: wrap; }
  .today-card-name { white-space: nowrap; font-size: 14px; }
  .today-group-heading { font-size: 9px; padding: 2px 6px; }
  .today-group-heading-truncate { max-width: 24ch; }
}

/* ── Templates Editor ─────────────────────────────────────── */

.templates-page {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  background: var(--pn-cream);
}

/* Sidebar */
.tmpl-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--pn-white);
  border-right: 1px solid var(--pn-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tmpl-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--pn-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tmpl-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--pn-muted);
  flex: 1;
}

.tmpl-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.tmpl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 13px;
  color: var(--pn-text);
  transition: background 0.12s;
}

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

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

.tmpl-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tmpl-item-del {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--pn-red);
  padding: 2px 4px;
  font-size: 13px;
  line-height: 1;
  transition: opacity 0.12s;
}

.tmpl-item:hover .tmpl-item-del { opacity: 0.5; }
.tmpl-item-del:hover { opacity: 1 !important; }

.tmpl-list-empty {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--pn-muted);
  text-align: center;
}

/* Editor panel */
.tmpl-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tmpl-editor-toolbar {
  padding: 10px 16px;
  background: var(--pn-white);
  border-bottom: 1px solid var(--pn-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.tmpl-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--pn-muted);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px 4px 0;
  border-right: 1px solid var(--pn-border);
  margin-right: 4px;
  white-space: nowrap;
  transition: color 0.12s;
  font-family: inherit;
}
.tmpl-back-btn:hover { color: var(--pn-text); }

.tmpl-name-input {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--pn-text);
  flex: 1;
  outline: none;
  min-width: 0;
}
.tmpl-name-input::placeholder { color: var(--pn-muted); font-weight: 400; }
.tmpl-name-input:focus { border-bottom: 2px solid var(--pn-green-dark); }

.tmpl-subject-row {
  padding: 0 16px;
  background: var(--pn-white);
  border-bottom: 1px solid var(--pn-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tmpl-subject-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pn-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.tmpl-subject-input {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--pn-text);
  outline: none;
  padding: 10px 0;
}
.tmpl-subject-input::placeholder { color: var(--pn-muted); }
.tmpl-subject-input:focus { border-bottom: 1px solid var(--pn-green-dark); }

.tmpl-view-tabs {
  display: flex;
  gap: 2px;
  background: var(--pn-cream);
  padding: 3px;
  border-radius: 4px;
  flex-shrink: 0;
}

.tmpl-view-tab {
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--pn-muted);
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.tmpl-view-tab.active {
  background: var(--pn-white);
  color: var(--pn-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tmpl-editor-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: var(--pn-cream);
}

#tmpl-quill-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--pn-white);
  border: 1px solid var(--pn-border);
  overflow: hidden;
}

#tmpl-quill-container .ql-toolbar {
  border: none;
  border-bottom: 1px solid var(--pn-border);
  background: var(--pn-cream);
}

#tmpl-quill-container .ql-container {
  flex: 1;
  border: none;
  font-family: inherit;
  font-size: 14px;
  overflow-y: auto;
}

#tmpl-quill-container .ql-editor { min-height: 100%; }

#tmpl-html-source {
  flex: 1;
  width: 100%;
  resize: none;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--pn-border);
  padding: 16px;
  background: #1e1e1e;
  color: #d4d4d4;
  outline: none;
  display: none;
}

#tmpl-preview-frame {
  flex: 1;
  border: 1px solid var(--pn-border);
  background: var(--pn-white);
  display: none;
}

.tmpl-editor-footer {
  padding: 10px 16px;
  background: var(--pn-white);
  border-top: 1px solid var(--pn-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tmpl-editor-status {
  flex: 1;
  font-size: 12px;
  color: var(--pn-muted);
}

.tmpl-char-counter {
  font-size: 12px;
  color: var(--pn-muted);
  white-space: nowrap;
}

.tmpl-char-counter.over-limit {
  color: var(--pn-red);
  font-weight: 600;
}

.tmpl-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--pn-muted);
  background: var(--pn-cream);
}

.tmpl-placeholder i { font-size: 48px; opacity: 0.25; }
.tmpl-placeholder p { font-size: 14px; }

/* Substitution tags panel */
.tmpl-tags-panel {
  border-top: 1px solid var(--pn-border);
  flex-shrink: 0;
}

.tmpl-tags-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--pn-cream);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pn-muted);
  text-align: left;
  transition: background 0.12s;
}
.tmpl-tags-toggle:hover { background: #f0ece7; }
.tmpl-tags-toggle span { flex: 1; }

.tmpl-tags-chevron {
  font-size: 14px;
  transition: transform 0.2s;
  transform: rotate(180deg);
}

.tmpl-tags-panel.open .tmpl-tags-chevron { transform: rotate(0deg); }

.tmpl-tags-body {
  display: none;
  padding: 10px 14px 14px;
  overflow-y: auto;
  max-height: 340px;
}

.tmpl-tags-panel.open .tmpl-tags-body { display: block; }

.tmpl-tags-hint {
  font-size: 11px;
  color: var(--pn-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.tmpl-tags-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pn-muted);
  margin: 10px 0 5px;
}
.tmpl-tags-group-label:first-of-type { margin-top: 0; }

.tmpl-tags-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tmpl-tag {
  display: block;
  font-size: 12px;
  font-family: 'Courier New', Courier, monospace;
  background: var(--pn-blue-light);
  color: var(--pn-green-deeper);
  padding: 3px 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tmpl-tag:hover {
  background: var(--pn-green-deeper);
  color: #fff;
  border-color: var(--pn-green-deeper);
}
.tmpl-tag.copied {
  background: #e4f4f4;
  color: var(--pn-green-deeper);
  border-color: var(--pn-teal);
}

/* ── Actions Editor ─────────────────────────────────────────────────────────── */

/* Actions page — tabular layout */
.actions-page {
  display: flex;
  flex-direction: column;
  background: var(--pn-cream);
  overflow: hidden;
}

.act-page-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--pn-border);
  background: var(--pn-white);
  flex-shrink: 0;
}

.act-page-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--pn-text);
  flex: 1;
}

.act-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--pn-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  flex-shrink: 0;
  transition: color 0.15s;
}
.act-back-btn:hover { color: var(--pn-text); }

/* Table */
.act-table-wrap {
  flex: 1;
  overflow-y: auto;
}

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

.act-table thead tr {
  border-bottom: 2px solid var(--pn-border);
  background: var(--pn-white);
  position: sticky;
  top: 0;
  z-index: 2;
}

.act-table th {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pn-muted);
  text-align: left;
  white-space: nowrap;
}

.act-th-drag  { width: 28px; padding-right: 0; }
.act-th-name  { min-width: 160px; }
.act-th-bulk  { width: 56px; text-align: center; }
.act-th-tmpl  { min-width: 180px; }
.act-th-fu    { min-width: 200px; }

.act-row {
  border-bottom: 1px solid var(--pn-border);
  cursor: pointer;
  transition: background 0.1s;
}
.act-row:hover { background: var(--pn-cream); }
.act-row.act-row-selected { background: var(--pn-blue-light); cursor: default; }
.act-row.act-row-selected:hover { background: var(--pn-blue-light); }
.act-row.act-row-dragging { opacity: 0.4; }
.act-row.act-row-drop-over { outline: 2px solid var(--pn-green-dark); outline-offset: -2px; }

.act-table td {
  padding: 9px 12px;
  vertical-align: middle;
  color: var(--pn-text);
}

.act-drag-cell { width: 28px; padding-right: 0; }

.act-drag-handle {
  color: var(--pn-muted);
  cursor: grab;
  font-size: 14px;
  opacity: 0.35;
  transition: opacity 0.1s;
}
.act-row:hover .act-drag-handle { opacity: 0.65; }

.act-bulk-cell { text-align: center; }

.act-bulk-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.act-name-cell { font-weight: 500; }

.act-name-input {
  font-size: 13px;
  font-weight: 500;
  color: var(--pn-text);
  background: var(--pn-white);
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  padding: 4px 8px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.act-name-input::placeholder { color: var(--pn-muted); font-weight: 400; }
.act-name-input:focus { border-color: var(--pn-green-dark); }

.act-tmpl-cell, .act-fu-cell {
  font-size: 12px;
  color: var(--pn-muted);
}

.act-tmpl-cell-edit,
.act-fu-cell-edit {
  cursor: pointer;
  position: relative;
}
.act-tmpl-cell-edit:hover,
.act-fu-cell-edit:hover { background: rgba(0,0,0,0.04); }

.act-cell-edit-icon {
  font-size: 11px;
  color: var(--pn-muted);
  margin-left: 5px;
  opacity: 0.5;
}

.act-chip {
  display: inline-block;
  padding: 1px 7px;
  background: var(--pn-cream);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--pn-text);
  margin: 1px 2px;
  white-space: nowrap;
}

.act-empty-cell { color: var(--pn-muted); font-size: 13px; }

.act-table-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--pn-muted);
  font-size: 13px;
}

/* Bottom save bar */
.act-bottom-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid var(--pn-border);
  background: var(--pn-white);
  flex-shrink: 0;
}

/* Templates picker popup */
.act-tmpl-picker-popup {
  background: var(--pn-white);
  border: 1px solid var(--pn-border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  padding: 10px;
  min-width: 360px;
}

/* Bulk badge (shown in unselected name cell) */
.act-bulk-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--pn-green-dark);
  color: #fff;
  margin-left: 6px;
  vertical-align: middle;
}

/* Field updates */
.act-fu-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--pn-border);
}
.act-fu-row:last-child { border-bottom: none; }

.act-fu-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--pn-text);
  padding-top: 6px;
}

.act-fu-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.act-fu-op-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.act-fu-op-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pn-muted);
  min-width: 46px;
}

.act-fu-select {
  font-size: 13px;
  color: var(--pn-text);
  background: var(--pn-white);
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
}
.act-fu-select:focus { border-color: var(--pn-green-dark); }

.act-fu-input {
  font-size: 13px;
  color: var(--pn-text);
  background: var(--pn-white);
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  padding: 4px 8px;
  outline: none;
}
.act-fu-input:focus { border-color: var(--pn-green-dark); }

.act-fu-pill-preview {
  display: inline-flex;
  align-items: center;
}

.act-fu-pill-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 28px;
}

/* Tag pills for status tags */
.act-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
  background: var(--pn-cream);
  color: var(--pn-text);
}

.act-tag-pill-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
}
.act-tag-pill-remove:hover { opacity: 1; }

/* Tag add dropdown */
.act-tag-add-wrap {
  position: relative;
  display: inline-flex;
}

.act-tag-add-btn {
  background: var(--pn-white);
  border: 1px dashed var(--pn-border);
  border-radius: 3px;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--pn-muted);
  display: flex;
  align-items: center;
  transition: border-color 0.12s, color 0.12s;
}
.act-tag-add-btn:hover { border-color: var(--pn-green-dark); color: var(--pn-green-dark); }

.act-tag-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--pn-white);
  border: 1px solid var(--pn-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 140px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px 0;
}
.act-tag-dropdown.hidden { display: none; }

.act-tag-dropdown-item {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.1s;
}
.act-tag-dropdown-item:hover { filter: brightness(0.9); }

.act-tag-dropdown-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--pn-muted);
}

