:root {
  --primary: #1a56db;
  --primary-hover: #1444b0;
  --dark: #1e293b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --white: #ffffff;
  --error: #dc2626;
  --success: #16a34a;
  --sidebar-width: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  line-height: 1.5;
}

/* Auth pages (login, forgot, reset) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
}

.auth-card {
  background: var(--white);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-logo {
  width: 280px;
  max-width: 100%;
  margin-bottom: 1.5rem;
}

/* Text stand-in on the sign-in pages. The upstream logo image was not
   carried into the DWS fork. */
.auth-logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: var(--gray-800, #1f2937);
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--gray-600);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s;
  background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.form-group label {
  color: var(--gray-600);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  max-height: 120px;
  overflow-y: auto;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-picker-row input[type="color"] {
  width: 40px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.color-hex-input {
  flex: 1;
  font-family: monospace;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-group-narrow {
  flex: 0 0 90px;
}

.form-row-2 {
  display: flex;
  gap: 1rem;
}

.form-row-2 .form-group {
  flex: 1;
}

.form-row-3 {
  display: flex;
  gap: 1rem;
}

.form-row-3 .form-group {
  flex: 1;
}

.form-row-4 {
  display: flex;
  gap: 1rem;
}

.form-row-4 .form-group {
  flex: 1;
}

.form-row-5 {
  display: flex;
  gap: 1rem;
}

.form-row-5 .form-group {
  flex: 1;
}

.form-group.flex-shrink {
  flex: 0 0 120px;
}

.form-group.flex-grow {
  flex: 3;
}

.status-select {
  appearance: auto;
  font-weight: 600;
}

.status-select option[value="Do Not Contact"] {
  color: #ffffff;
  background: #1f2937;
}

.status-select option[value="Unverified"] {
  color: #991b1b;
  background: #fef2f2;
}

.status-select option[value="Verified"] {
  color: #854d0e;
  background: #fefce8;
}

.status-select option[value="Promoted"] {
  color: #166534;
  background: #f0fdf4;
}

/* Email status badge shown next to problem email addresses in list views. */
.email-status-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 4px;
}
.email-status-badge.does_not_exist { background: #fee2e2; color: #991b1b; }
.email-status-badge.bounced        { background: #ffedd5; color: #9a3412; }
.email-status-badge.unsubscribed   { background: #e5e7eb; color: #374151; }
.email-status-badge.valid          { background: #dcfce7; color: #166534; }

/* Email preview body (Activities + Project Emails modals). Email HTML is
   authored to render with browser defaults — list indents, nested bullets,
   paragraph spacing. The global `* { margin:0; padding:0 }` reset strips all
   of that, so bullets collapse flush-left with no sub-indent. Restore the
   defaults here so the preview matches what the recipient actually sees. */
/* Reply / Reply All / Forward row inside the email view modal. Rendered from
   views/partials/email-modal-actions.ejs, between the header block and the
   message body. */
.email-modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.email-modal-body ul,
.email-modal-body ol { padding-left: 1.6em; margin: 0.5em 0; }
.email-modal-body ul { list-style: disc outside; }
.email-modal-body ol { list-style: decimal outside; }
.email-modal-body ul ul { list-style: circle outside; }
.email-modal-body ul ul ul { list-style: square outside; }
.email-modal-body li { margin: 0.2em 0; }
.email-modal-body p { margin: 0; }
.email-modal-body h1,
.email-modal-body h2,
.email-modal-body h3,
.email-modal-body h4,
.email-modal-body h5,
.email-modal-body h6 { margin: 0.7em 0 0.35em; line-height: 1.3; }
.email-modal-body blockquote {
  margin: 0.6em 0;
  padding-left: 1em;
  border-left: 3px solid var(--gray-200);
  color: var(--gray-600);
}

.form-card {
  background: var(--white);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  margin-top: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-200);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-outline {
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-outline:hover {
  background: var(--gray-100);
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-error {
  background: #fef2f2;
  color: var(--error);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Auth links */
.auth-links {
  margin-top: 1.25rem;
}

.auth-links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* ===================== */
/* Sidebar               */
/* ===================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  height: 56px;
  display: flex;
  align-items: center;
}

.sidebar-logo a {
  display: block;
  line-height: 0;
}

.sidebar-logo-img {
  height: 32px;
  width: auto;
}

/* Text stand-in for the logo. The upstream logo image was not carried into
   the DWS fork; an uploaded logo still renders as an <img> through the
   companyLogo setting. */
.sidebar-logo-text {
  display: block;
  line-height: 32px;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--gray-800, #1f2937);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
  overflow-y: auto;
}

.sidebar-divider {
  margin: 0.35rem 0.625rem;
  border: none;
  border-top: 1px solid var(--gray-200);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.12rem 0.625rem;
  padding: 0.3rem 0.75rem;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 6px;
  transition: background-color 0.1s, color 0.1s;
}

.sidebar-link:hover {
  background: var(--gray-100);
}

/* Category colors */
.sidebar-link.cat-dashboard { color: #6366f1; }
.sidebar-link.cat-dashboard .sidebar-icon { stroke: #6366f1; }
.sidebar-link.cat-crm { color: #0891b2; }
.sidebar-link.cat-crm .sidebar-icon { stroke: #0891b2; }
.sidebar-link.cat-projects { color: #d97706; }
.sidebar-link.cat-projects .sidebar-icon { stroke: #d97706; }
.sidebar-link.cat-comms { color: #059669; }
.sidebar-link.cat-comms .sidebar-icon { stroke: #059669; }
.sidebar-link.cat-admin { color: #9333ea; }
.sidebar-link.cat-admin .sidebar-icon { stroke: #9333ea; }

.sidebar-link:hover.cat-dashboard { color: #4f46e5; }
.sidebar-link:hover.cat-crm { color: #0e7490; }
.sidebar-link:hover.cat-projects { color: #b45309; }
.sidebar-link:hover.cat-comms { color: #047857; }
.sidebar-link:hover.cat-admin { color: #7e22ce; }

.sidebar-link.active {
  background: var(--primary);
  color: var(--white) !important;
  font-weight: 600;
}

.sidebar-link.active .sidebar-icon {
  stroke: var(--white) !important;
}

/* Per-route icon colors. Override the .cat-* stroke so each item is distinct.
   Active state still wins via !important above (icon goes white on the
   primary background). Link text color stays whatever the .cat-* rule sets. */
.sidebar-link[href="/dashboard"]         .sidebar-icon { stroke: #475569; }
.sidebar-link[href="/companies"]         .sidebar-icon { stroke: #1a56db; }
.sidebar-link[href="/contacts"]          .sidebar-icon { stroke: #0891b2; }
.sidebar-link[href="/calendar"]          .sidebar-icon { stroke: #dc2626; }
.sidebar-link[href="/active-projects"]   .sidebar-icon { stroke: #059669; }
.sidebar-link[href="/active-workflows"]  .sidebar-icon { stroke: #d97706; }
.sidebar-link[href="/form-submissions"]  .sidebar-icon { stroke: #16a34a; }
.sidebar-link[href="/chats"]             .sidebar-icon { stroke: #7c3aed; }
.sidebar-link[href="/phone-calls"]       .sidebar-icon { stroke: #0284c7; }
.sidebar-link[href="/instantly-responses"] .sidebar-icon { stroke: #be185d; }
.sidebar-link[href="/voice-agents"]      .sidebar-icon { stroke: #db2777; }
.sidebar-link[href="/chat-widgets"]      .sidebar-icon { stroke: #7c3aed; }
.sidebar-link[href="/documents-library"] .sidebar-icon { stroke: #92400e; }
.sidebar-link[href="/emails"]            .sidebar-icon { stroke: #4f46e5; }
.sidebar-link[href="/forms"]             .sidebar-icon { stroke: #ea580c; }
.sidebar-link[href="/invoice-templates"] .sidebar-icon { stroke: #0d9488; }
.sidebar-link[href="/projects"]          .sidebar-icon { stroke: #059669; }
.sidebar-link[href="/sms"]               .sidebar-icon { stroke: #7c3aed; }
.sidebar-link[href="/workflows"]         .sidebar-icon { stroke: #d97706; }
.sidebar-link[href="/admin"]             .sidebar-icon { stroke: #9333ea; }

.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ===================== */
/* Top bar               */
/* ===================== */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 99;
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dev-badge {
  font-size: 1.75rem;
  font-weight: 900;
  color: #dc2626;
  letter-spacing: 0.15em;
  text-shadow: 0 0 1px rgba(220, 38, 38, 0.4);
  user-select: none;
}

.topbar-user-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  color: var(--gray-600);
  font-size: 0.8125rem;
  font-weight: 500;
}

.topbar-logout {
  display: inline;
}

.btn-active {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

/* ===================== */
/* App layout            */
/* ===================== */
.app-page {
  min-height: 100vh;
  background: var(--gray-100);
}

.app-content {
  margin-left: var(--sidebar-width);
  margin-top: 56px;
  padding: 1.5rem 2rem;
  min-height: calc(100vh - 56px);
}

.app-content h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--dark);
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.content-header h1 {
  margin-bottom: 0;
}

.content-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.8125rem;
}

.back-link:hover {
  color: var(--primary);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

/* ===================== */
/* Detail view           */
/* ===================== */
.detail-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-top: 1rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.detail-grid-3 {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
}

.detail-section {
  padding: 1rem 1.25rem;
}

.detail-section:not(:last-child) {
  border-right: 1px solid var(--gray-200);
}

.detail-section-middle {
  min-width: 220px;
}

.address-display {
  font-size: 0.875rem;
  color: var(--gray-800);
  line-height: 1.5;
}

.address-country {
  color: var(--gray-400);
}

.address-coords {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.375rem;
}

.text-muted {
  font-size: 0.875rem;
  color: var(--gray-400);
}

.detail-subsection-title {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-100);
}

.phone-display {
  font-size: 0.875rem;
  color: var(--gray-800);
}

.phone-type {
  color: var(--gray-400);
  font-size: 0.8125rem;
}

.detail-section h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 0.75rem;
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-section-header h2 {
  margin-bottom: 0;
}

.detail-section-header + p,
.detail-section-header + .text-muted {
  margin-top: 0.75rem;
}

.detail-section-header .btn-icon-sm {
  text-decoration: none;
}

.detail-row {
  display: flex;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  width: 100px;
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.detail-value {
  font-size: 0.875rem;
  color: var(--gray-800);
}

.detail-value a {
  color: var(--primary);
  text-decoration: none;
}

.detail-value a:hover {
  text-decoration: underline;
}

.detail-extra-row {
  display: flex;
  border-top: 1px solid var(--gray-200);
}

.detail-extra-block {
  flex: 1;
  padding: 0.75rem 1.25rem;
}

.detail-extra-block:not(:last-child) {
  border-right: 1px solid var(--gray-200);
}

.detail-extra-block h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}

.detail-extra-desc {
  flex: 2;
}

.description-text {
  font-size: 0.875rem;
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  line-height: 1.5;
  white-space: pre-line;
}

.services-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.service-tag {
  font-size: 0.75rem;
}

.bh-display {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.bh-display-row {
  display: flex;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.bh-display-day {
  width: 36px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--gray-600);
}

.bh-display-time {
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.bh-closed .bh-display-day,
.bh-closed .bh-display-time {
  color: var(--gray-300);
}

.detail-meta {
  display: flex;
  gap: 2rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--gray-100);
  border-radius: 4px;
  font-size: 0.8125rem;
  margin-right: 0.25rem;
}

.app-footer {
  margin-left: var(--sidebar-width);
  text-align: center;
  padding: 1rem;
  color: var(--gray-400);
  font-size: 0.8rem;
}

/* ===================== */
/* Data table            */
/* ===================== */
.table-wrapper {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--gray-50);
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}

/* Virtual lists pin column widths after first render and switch to
   table-layout:fixed; long content has to truncate so columns don't jitter
   as new rows scroll into view. */
.data-table[data-virtual="true"] td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Virtual lists (e.g. Companies) scroll inside this viewport-height panel so a
   wide column set gets a horizontal scrollbar at the bottom of the screen
   instead of running off the right edge of the page. The height is set inline
   by the scroller JS; this just enables both-axis scrolling and overrides the
   plain .table-wrapper's overflow:hidden. */
.table-scroll-viewport {
  overflow: auto;
}
/* Keep the column-label row visible while scrolling down or panning across a
   wide table. Only the first header row sticks; the filter row scrolls under
   it (same as before). Needs an opaque background so rows don't show through. */
.table-scroll-viewport .data-table[data-virtual="true"] thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--gray-50);
}

/* Collapsible integration card on the Admin > Integrations tab. Each
   integration is a <details> element with a custom chevron in the summary
   that rotates when open. */
.integration-card {
  background: var(--white, #fff);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  overflow: hidden;
}
.integration-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  user-select: none;
}
.integration-card > summary::-webkit-details-marker { display: none; }
.integration-card > summary h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--gray-600);
  font-weight: 600;
}
.integration-card > summary .chev {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-right: 2px solid var(--gray-500);
  border-bottom: 2px solid var(--gray-500);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  margin-top: -4px;
}
.integration-card[open] > summary .chev {
  transform: rotate(-135deg);
  margin-top: 4px;
}
.integration-card[open] > summary {
  border-bottom: 1px solid var(--gray-200);
}
.integration-card > .integration-body {
  padding: 1rem;
}
.integration-card > .integration-body > .form-actions {
  margin-top: 1rem;
  text-align: right;
}

/* Drag-to-resize handles on the right edge of each column header.
   The <th> needs position:relative so the handle can pin to its right edge. */
.data-table[data-virtual="true"] thead tr:first-child th {
  position: relative;
}
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
}
.col-resizer:hover,
.col-resizer.col-resizer-active {
  background: var(--primary, #2563eb);
  opacity: 0.4;
}
body.col-resizing,
body.col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-row-link {
  cursor: pointer;
  transition: background-color 0.1s;
}

.table-row-link:hover {
  background: var(--gray-50);
}

.td-primary {
  font-weight: 600;
  color: var(--primary);
}

.table-empty {
  text-align: center;
  color: var(--gray-400);
  padding: 2rem 1rem !important;
}

.th-actions {
  width: 1%;
  white-space: nowrap;
}

.td-actions {
  white-space: nowrap;
  text-align: right;
}

.btn-icon-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-400);
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
}

.btn-icon-sm:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.btn-icon-danger {
  color: #ff0000;
  border-color: #fecaca;
}
.btn-icon-danger:hover {
  background: #fff0f0;
  color: #cc0000;
  border-color: #ff0000;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-do-not-contact,
.badge-do.contact {
  background: #1f2937;
  color: #ffffff;
  /* Multi-word status reads as shouting in all-caps; render title-case
     instead of inheriting the .badge text-transform. */
  text-transform: none;
  letter-spacing: 0;
}

/* "via <Brand>" label on SMS rows — which of our own Twilio lines a text
   arrived on. A brand name is a proper noun, so it opts out of the .badge
   all-caps (same reasoning as .badge-do-not-contact) and never wraps. */
.badge-line {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.6875rem;
  white-space: nowrap;
}

.badge-unverified {
  background: #fef2f2;
  color: #991b1b;
}

.badge-verified {
  background: #fefce8;
  color: #854d0e;
}

.badge-promoted {
  background: #f0fdf4;
  color: #166534;
}

/* ===================== */
/* Tabs                  */
/* ===================== */
.tabs {
  display: flex;
  gap: 0;
  margin-top: 0.75rem;
}

.tab {
  padding: 0.5rem 1.25rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
  margin-right: -1px;
}

.tab:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}


/* Admin-only tabs - purple accent */
.tab.tab-admin {
  color: #9333ea;
  background: #faf5ff;
  border-color: #e9d5ff;
}
.tab.tab-admin:hover {
  background: #f3e8ff;
  color: #7e22ce;
}

/* Admin-only icon button (purple) */
.btn-icon-sm.btn-icon-admin {
  color: #9333ea;
}
.btn-icon-sm.btn-icon-admin:hover {
  color: #7e22ce;
}
/* Admin-only outline button (purple) */
.btn.btn-admin {
  color: #9333ea !important;
  border-color: #d8b4fe !important;
}
.btn.btn-admin:hover {
  background: #faf5ff;
  color: #7e22ce !important;
}

.tab.tab-admin.active {
  background: var(--white);
  color: #7e22ce;
  border-color: #d8b4fe;
  border-top: 2px solid #9333ea;
}

.tab.active {
  background: var(--white);
  color: var(--gray-800);
  font-weight: 600;
  border-color: var(--gray-200);
  position: relative;
}

.tab-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0 8px 8px 8px;
  padding: 1rem 1.25rem;
}

.tab-panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

/* ===================== */
/* Inline form           */
/* ===================== */
.inline-form {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.form-help {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

.form-help a {
  color: var(--primary);
}

.form-section-title {
  font-size: 0.9375rem;
  color: var(--gray-800);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.places-search-input {
  border: 1px solid var(--primary) !important;
  background: #f0f5ff !important;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-600);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
}

/* ===================== */
/* Multi-select dropdown */
/* ===================== */
.multiselect {
  position: relative;
}

.multiselect-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.9375rem;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s;
  min-height: 40px;
}

.multiselect-display:hover {
  border-color: var(--gray-300);
}

.multiselect.open .multiselect-display {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.multiselect-text {
  color: var(--gray-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiselect-text.has-value {
  color: var(--gray-800);
}

.multiselect-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}

.multiselect.open .multiselect-dropdown {
  display: block;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-800);
  cursor: pointer;
  transition: background-color 0.1s;
}

.multiselect-option:hover {
  background: var(--gray-50);
}

.multiselect-option input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* ===================== */
/* Address cards         */
/* ===================== */
.address-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.address-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.address-card-body {
  flex: 1;
}

.address-line {
  font-size: 0.875rem;
  color: var(--gray-800);
  line-height: 1.4;
}

.address-country {
  color: var(--gray-400);
}

.address-coords {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

.address-card .badge {
  margin-bottom: 0.375rem;
}

.address-card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
}

.btn-danger {
  color: var(--error);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
}

.empty-state {
  text-align: center;
  color: var(--gray-400);
  padding: 2rem 1rem;
  font-size: 0.875rem;
}

/* ===================== */
/* Table sort & filter   */
/* ===================== */
.sortable-th {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.sortable-th:hover {
  background: var(--gray-100);
}

.sort-arrow {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.sort-active {
  color: var(--primary);
}

.sort-active .sort-arrow {
  color: var(--primary);
}

.table-filter-row {
  background: var(--white);
}

.table-filter-cell {
  padding: 0.375rem 0.5rem !important;
  border-bottom: 1px solid var(--gray-200) !important;
}

.table-filter-input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color 0.15s;
}

.table-filter-input::placeholder {
  color: var(--gray-300);
}

.table-filter-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.1);
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  padding: 1rem 0;
}
.media-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s;
}
.media-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.media-thumb {
  position: relative;
  width: 100%;
  padding-top: 75%;
  background: var(--gray-100);
  overflow: hidden;
  cursor: pointer;
}
.media-thumb-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-badge-video {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  z-index: 1;
}
.media-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.media-card:hover .media-overlay {
  opacity: 1;
}
.media-overlay-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  cursor: pointer;
  color: var(--gray-700);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  text-decoration: none;
  transition: background 0.1s;
}
.media-overlay-btn:hover {
  background: #fff;
}
.media-overlay-danger:hover {
  background: var(--error);
  color: #fff;
}
.media-info {
  padding: 0.5rem 0.75rem 0.75rem;
}
.media-info-title {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}
.media-info-meta {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}
.media-info-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-bottom: 0.35rem;
}
.media-info-url {
  margin-top: 0.25rem;
}
.media-url-input {
  width: 100%;
  font-size: 0.6875rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: pointer;
  outline: none;
}
.media-url-input:focus {
  border-color: var(--primary);
  background: #fff;
}

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.lightbox-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-content img,
.lightbox-content video {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.lightbox-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10000;
}
.lightbox-btn:hover {
  background: rgba(255,255,255,0.3);
}
.lightbox-prev {
  left: 1rem;
}
.lightbox-next {
  right: 1rem;
}
.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10000;
}
.lightbox-close:hover {
  background: rgba(255,255,255,0.3);
}
.lightbox-caption {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.875rem;
  text-align: center;
  max-width: 80vw;
  z-index: 10000;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Responsive */
@media (max-width: 480px) {
  .auth-card {
    margin: 1rem;
    padding: 1.5rem;
  }
  .auth-logo {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .form-row, .form-row-2, .form-row-3, .form-row-4 {
    flex-direction: column;
    gap: 0;
  }
  .form-group.flex-shrink {
    flex: 1;
  }
  .detail-extra-row {
    flex-direction: column;
  }
  .detail-extra-block:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }
  .sidebar {
    width: 60px;
  }
  .sidebar-logo-img {
    width: 36px;
  }
  .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
    font-size: 0;
  }
  .sidebar-icon {
    width: 22px;
    height: 22px;
  }
  .app-content,
  .app-footer {
    margin-left: 60px;
  }
  .topbar {
    left: 60px;
  }
}

/* Document drop zone */
.doc-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  background: var(--gray-50);
  margin-bottom: 1rem;
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
}
.doc-dropzone-active {
  border-color: var(--primary);
  background: #eff6ff;
}

/* Activity type badges — matches calendar color map */
.badge-activity-phone   { background: #3b82f6; color: #fff; }
.badge-activity-text    { background: #14b8a6; color: #fff; }
.badge-activity-email   { background: #6366f1; color: #fff; }
.badge-activity-note    { background: #f59e0b; color: #fff; }
.badge-activity-meeting { background: #ef4444; color: #fff; }
.badge-activity-task    { background: #22c55e; color: #fff; }
.badge-activity-other   { background: #64748b; color: #fff; }

/* View icon colors — applied via attribute selector to all View buttons */
.btn-icon-sm[title*="View"] { color: #00ff00; border-color: #bbffbb; }
.btn-icon-sm[title*="View"]:hover { color: #00cc00; background: #f0fff0; border-color: #00ff00; }

/* ============================================================
   QuickBooks-style Invoice Form (views/invoice-form.ejs)
   ============================================================ */

.qb-invoice {
  background: #f5f6f8;
  border: 1px solid #d8dde5;
  padding: 0;
  font-size: 0.8125rem;
  color: #1f2937;
}

/* Top bar — Customer:Job + Template */
.qb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #f5f6f8;
  border-bottom: 1px solid #d8dde5;
  font-size: 0.75rem;
}
.qb-topbar-customer { display: flex; align-items: center; gap: 0.5rem; }
.qb-topbar-label { color: #475569; }
.qb-topbar-value {
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  min-width: 240px;
  font-weight: 500;
}
.qb-topbar-template { display: flex; align-items: center; gap: 0.5rem; }
.qb-topbar-template label { color: #475569; }
.qb-topbar-template select {
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  font-size: 0.75rem;
  min-width: 200px;
}
.qb-topbar-input {
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  min-width: 320px;
  font-weight: 500;
  font-size: 0.75rem;
  font-family: inherit;
}

/* Header section — Invoice title + Bill To (left) | Date/Inv#/Type/Due (right) */
.qb-header-section {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
}
.qb-invoice-title {
  font-size: 2rem;
  font-weight: 700;
  color: #4a8a9a;
  margin: 0 0 0.5rem 0;
  letter-spacing: 0.5px;
}

/* Section header bar (gray strip with white-ish label) — used for Bill To, Date, Invoice #, etc. */
.qb-section-header {
  background: #6b7280;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 3px 8px;
  letter-spacing: 0.3px;
}

/* Bill To box */
.qb-bill-to-box {
  border: 1px solid #d8dde5;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.qb-bill-to-content { padding: 0.5rem; display: flex; flex-direction: column; gap: 6px; }
.qb-bill-to-content input,
.qb-bill-to-content select {
  border: 1px solid #d8dde5;
  padding: 4px 6px;
  font-size: 0.8125rem;
  width: 100%;
  background: #fff;
}
.qb-bill-to-content input:focus { outline: none; border-color: #4a8a9a; }
.qb-bill-to-row { display: flex; gap: 6px; }
.qb-bill-to-row > * { flex: 1; }
.qb-bill-to-row .qb-cell-state { flex: 0 0 70px; }
.qb-bill-to-row .qb-cell-zip { flex: 0 0 90px; }

.qb-bill-to-content .qb-inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #475569;
  margin-top: 4px;
}
.qb-bill-to-content .qb-inline-checkbox input { width: auto; }

/* Right-side meta cells (Date, Invoice #, Type, Due Date) */
.qb-header-right { display: flex; flex-direction: column; gap: 0.5rem; }
.qb-meta-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid #d8dde5; }
.qb-meta-pair .qb-meta-cell + .qb-meta-cell { border-left: 1px solid #d8dde5; }
.qb-meta-cell { background: #fff; display: flex; flex-direction: column; }
.qb-meta-cell input,
.qb-meta-cell select {
  border: none;
  padding: 5px 8px;
  font-size: 0.8125rem;
  width: 100%;
  background: #fff;
}
.qb-meta-cell input[readonly] { background: #f8fafc; color: #475569; }
.qb-meta-cell input:focus,
.qb-meta-cell select:focus { outline: none; background: #fefcc6; }
.qb-meta-cell-full { grid-column: 1 / -1; }

/* QB customer search — sits inside Bill To */
.qb-search-wrap { position: relative; }
.qb-search-wrap input { width: 100%; }
#qb-customer-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid #cbd5e1;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Generic section (Send Invoice To) */
.qb-section { background: #fff; border-top: 1px solid #d8dde5; }
.qb-section-body { padding: 0.5rem 1rem; }
.qb-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}
.qb-row-3 label {
  display: block;
  font-size: 0.6875rem;
  color: #475569;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.qb-row-3 .qb-input-with-picker { display: flex; gap: 4px; }
.qb-row-3 input,
.qb-row-3 select {
  border: 1px solid #d8dde5;
  padding: 4px 6px;
  font-size: 0.8125rem;
  background: #fff;
  width: 100%;
}
.qb-row-3 .qb-input-with-picker select { flex: 0 0 32px; padding: 4px 2px; }

/* Items table — striped QB-style */
.qb-items-wrap { background: #fff; padding: 0; }
.qb-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  table-layout: fixed;
}
.qb-items-table thead th {
  background: #6b7280;
  color: #fff;
  font-weight: 500;
  text-align: left;
  padding: 5px 8px;
  border-right: 1px solid #4b5563;
  font-size: 0.6875rem;
  letter-spacing: 0.3px;
}
.qb-items-table thead th:last-child { border-right: none; }
.qb-items-table tbody tr:nth-child(even) td { background: #eef3f8; }
.qb-items-table tbody tr:nth-child(odd)  td { background: #fff; }
.qb-items-table tbody td {
  padding: 4px 6px;
  border-right: 1px solid #d8dde5;
  border-bottom: 1px solid #e8ecf2;
  vertical-align: middle;
}
.qb-items-table tbody td:last-child { border-right: none; }
.qb-items-table tbody td input,
.qb-items-table tbody td select,
.qb-items-table tbody td textarea {
  width: 100%;
  border: 1px solid transparent;
  padding: 3px 4px;
  background: transparent;
  font-size: 0.8125rem;
  font-family: inherit;
}
.qb-items-table tbody td textarea {
  resize: vertical;
  min-height: 28px;
  line-height: 1.35;
}
.qb-items-table tbody td input:hover,
.qb-items-table tbody td select:hover,
.qb-items-table tbody td textarea:hover { border-color: #cbd5e1; }
.qb-items-table tbody td input:focus,
.qb-items-table tbody td select:focus,
.qb-items-table tbody td textarea:focus {
  outline: none;
  border-color: #4a8a9a;
  background: #fefcc6;
}
.qb-items-table .qb-col-amount,
.qb-items-table .qb-col-qty,
.qb-items-table .qb-col-price { text-align: right; }
.qb-items-table .qb-col-amount input,
.qb-items-table .qb-col-qty input,
.qb-items-table .qb-col-price input { text-align: right; }

.qb-add-item {
  background: #fff;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #d8dde5;
}
.qb-add-item .qb-link-btn {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 4px;
}
.qb-add-item .qb-link-btn:hover { text-decoration: underline; }

/* Bottom — Customer Message + Totals */
.qb-bottom-section {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
  border-top: 1px solid #d8dde5;
}
.qb-customer-message-area .qb-bottom-label {
  font-size: 0.6875rem;
  color: #475569;
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.qb-customer-message-area textarea {
  width: 100%;
  border: 1px solid #d8dde5;
  padding: 6px;
  font-size: 0.8125rem;
  font-family: inherit;
  resize: vertical;
}
.qb-customer-message-area textarea:focus { outline: none; border-color: #4a8a9a; }

.qb-totals-area { display: flex; flex-direction: column; gap: 2px; }
.qb-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  font-size: 0.8125rem;
}
.qb-total-row span:first-child { color: #475569; }
.qb-total-row input[type=number] {
  width: 90px;
  text-align: right;
  border: 1px solid #d8dde5;
  padding: 2px 4px;
  font-size: 0.8125rem;
}
.qb-total-final {
  background: #f1f5f9;
  border-top: 2px solid #4a8a9a;
  font-size: 1rem;
  font-weight: 700;
  padding: 8px;
  margin-top: 4px;
}
.qb-total-final span:first-child { color: #1f2937; }
.qb-total-final span:last-child { color: #4a8a9a; }

/* Action footer */
.qb-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.75rem 1rem;
  background: #f5f6f8;
  border-top: 1px solid #d8dde5;
}

/* Schedule day group hide/show is handled inline; ensure spacing */
#schedule-day-group { display: none; }
#schedule-day-group.qb-show { display: grid; }
