:root {
  --color-primary: #2F842F;
  --color-primary-press: #246c24;
  --color-secondary: #fca905;
  --color-success: #68CF29;
  --color-bg: #FFFFFF;
  --color-surface: #F7F9F7;
  --color-text: #1A1A1A;
  --color-muted: #6B7280;
  --color-danger: #C0392B;
  --color-border: #E5E9E5;
  --radius: 8px;
  --tap: 44px;
  --app-bar-h: 56px;
  --tab-bar-h: 64px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06);
}

@font-face {
  font-family: 'Outfit';
  src: url('/assets/fonts/Outfit-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Outfit';
  src: url('/assets/fonts/Outfit-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Outfit';
  src: url('/assets/fonts/Outfit-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/assets/fonts/Tajawal-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/assets/fonts/Tajawal-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.is-arabic {
  font-family: 'Tajawal', 'Outfit', sans-serif;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a { color: var(--color-primary); text-decoration: none; }
a:active { color: var(--color-primary-press); }

img, svg { display: block; max-width: 100%; }

.hidden { display: none !important; }

/* App shell */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: var(--app-bar-h);
}
.app-bar-title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}
.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* User pill (top right) + dropdown menu.
   On mobile the .tab-bar is at the bottom, so we pin the pill to the top-right
   of the viewport so it stays in the header. On desktop the .tab-bar IS the
   header, so the pill sits inline within it. */
.user-pill-wrap {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 31;
}
@media (min-width: 1024px) {
  .user-pill-wrap {
    position: relative;
    top: auto;
    right: auto;
    margin-left: 12px;
    z-index: auto;
  }
}
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.user-pill:active { background: var(--color-surface); }
.user-pill[aria-expanded='true'] {
  background: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.user-pill-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 4px;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.user-menu[hidden] { display: none; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 40px;
  color: var(--color-text);
  border-radius: var(--radius);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.user-menu-item:hover,
.user-menu-item:active {
  background: var(--color-surface);
}
.user-menu-item svg { color: var(--color-muted); }

.app-main {
  padding: 12px 12px calc(var(--tab-bar-h) + env(safe-area-inset-bottom, 0px) + 88px);
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  flex: 1;
  min-height: var(--tab-bar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 4px;
  user-select: none;
}
.tab svg { color: inherit; }
.tab.active { color: var(--color-primary); }
.tab:active { background: var(--color-surface); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:active { background: var(--color-primary-press); border-color: var(--color-primary-press); }
.btn-secondary {
  background: var(--color-bg);
  border-color: var(--color-border);
}
.btn-danger {
  background: var(--color-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}
.btn-danger:active { background: var(--color-danger); color: #fff; }
.btn-link {
  background: transparent;
  border: 0;
  color: var(--color-primary);
  min-height: var(--tap);
  padding: 10px 8px;
  cursor: pointer;
}
.btn-link:active { color: var(--color-primary-press); }
.btn-block { width: 100%; }

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  color: var(--color-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { background: var(--color-surface); }
.icon-btn.danger { color: var(--color-danger); }

/* Forms */
.field {
  display: block;
  margin: 0 0 16px;
}
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-muted);
}
.field input[type='text'],
.field input[type='email'],
.field input[type='tel'],
.field input[type='password'],
.field input[type='search'],
.field textarea,
.field select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}
.field textarea {
  min-height: 96px;
  resize: vertical;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(47, 132, 47, 0.25);
  border-color: var(--color-primary);
}
.field-error {
  color: var(--color-danger);
  font-size: 13px;
  margin-top: 6px;
}
.form-error {
  color: var(--color-danger);
  font-size: 14px;
  text-align: center;
  margin: 12px 0 0;
  min-height: 20px;
}

/* Segmented control */
.segmented {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
}
.segmented button {
  flex: 1;
  min-height: var(--tap);
  border: 0;
  background: transparent;
  color: var(--color-text);
  font-weight: 500;
  cursor: pointer;
}
.segmented button[aria-pressed='true'] {
  background: var(--color-primary);
  color: #fff;
}
.segmented button:not(:last-child) {
  border-right: 1px solid var(--color-border);
}
.segmented button:active { background: var(--color-surface); }
.segmented button[aria-pressed='true']:active { background: var(--color-primary-press); }

/* Filter chips */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 4px;
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.filter-chip[aria-pressed='true'] {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.filter-chip:active { background: var(--color-surface); }
.filter-chip[aria-pressed='true']:active { background: var(--color-primary-press); }

/* Chips (generic) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}
.chip-type[data-type='company'] { color: var(--color-text); }
.chip-type[data-type='freelancer'] { color: var(--color-primary); }
.chip-type[data-type='TBD'] {
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}
.chip-type[data-type='TBD']::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color-secondary);
}

/* Status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
  border: 1px solid var(--color-border);
}
.status-pill[data-status='new'] {
  background: #EFEFEF;
  color: #555;
}
.status-pill[data-status='contacted'] {
  background: #FFF4DC;
  color: #8A5A00;
  border-color: #F2D58A;
}
.status-pill[data-status='registered'] {
  background: #E6F8D7;
  color: #2B5C0F;
  border-color: #B8E59A;
}

/* Provider list */
.search-row {
  margin: 8px 0;
  position: relative;
}
.search-row input[type='search'] {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}
.search-row svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  pointer-events: none;
}
.providers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.provider-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.provider-card:active { background: #eef1ee; }
.provider-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.provider-card-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  overflow-wrap: anywhere;
}
.provider-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.provider-services {
  font-size: 13px;
  color: var(--color-muted);
  flex: 1 1 100%;
}

/* Empty state */
.empty {
  text-align: center;
  color: var(--color-muted);
  padding: 32px 16px;
  font-size: 15px;
}

/* Sticky bottom action bar */
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tab-bar-h);
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 8px;
  z-index: 20;
}
.action-bar .btn-primary { flex: 1; }

/* FAB */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tab-bar-h) + 16px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
}
.fab:active { background: var(--color-primary-press); }

/* Catalog list */
.catalog-tabs {
  margin: 8px 0 12px;
}
.catalog-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.catalog-row {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
}
.catalog-row .name {
  flex: 1;
  font-weight: 500;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.catalog-row .badge {
  font-size: 12px;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 2px 8px;
  border-radius: 999px;
}
.group-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  padding: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: var(--app-bar-h);
  background: var(--color-bg);
}

/* Settings */
.settings-section {
  margin: 16px 0 24px;
}
.settings-section h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--color-text);
}

/* Service multi-picker */
.svc-picker-trigger {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  text-align: left;
  cursor: pointer;
  color: var(--color-text);
}
.svc-picker-trigger.empty { color: var(--color-muted); }
.svc-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.svc-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
}
.svc-selected-chip button {
  background: transparent;
  border: 0;
  cursor: pointer;
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}
.svc-selected-chip button:active { color: var(--color-danger); }

/* Modal / sheet */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
}
.modal-sheet {
  background: var(--color-bg);
  width: 100%;
  max-width: 520px;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
}
@media (min-width: 768px) {
  .modal-sheet { border-radius: 16px; max-height: 85vh; }
}
.modal-sheet.full-screen {
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
}
.modal-head h3 {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.modal-foot {
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
}
.modal-foot .btn-primary { flex: 1; }

/* Service picker groups */
.svc-group {
  border-top: 1px solid var(--color-border);
  padding: 8px 0;
}
.svc-group:first-child { border-top: 0; }
.svc-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  min-height: var(--tap);
}
.svc-group-head .count {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 400;
}
.svc-group-head svg { color: var(--color-muted); transition: transform 150ms ease; }
.svc-group[data-open='false'] svg { transform: rotate(-90deg); }
.svc-group[data-open='false'] .svc-group-list { display: none; }
.svc-group-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.svc-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  min-height: var(--tap);
  cursor: pointer;
}
.svc-option input { width: 20px; height: 20px; accent-color: var(--color-primary); }

/* Toast */
.toast-root {
  position: fixed;
  left: 0;
  right: 0;
  top: 12px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--color-text);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  max-width: 92%;
}
.toast.success { background: var(--color-success); color: #0E2606; }
.toast.error { background: var(--color-danger); }
.toast.warn { background: var(--color-secondary); color: #3a2700; }

/* Login */
.login-body {
  background: var(--color-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-card);
}
.brand-wordmark {
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.brand-logo {
  display: block;
  height: 48px;
  width: auto;
}
.brand-mark { color: var(--color-primary); }
.brand-tag {
  font-size: 13px;
  color: var(--color-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Brand logo inside the top nav (desktop only) */
.brand-link {
  display: none;
}
.brand-logo-nav {
  display: block;
  height: 32px;
  width: auto;
}

/* Desktop top nav */
@media (min-width: 1024px) {
  :root { --tab-bar-h: 56px; }
  body {
    padding-top: 56px;
  }
  .tab-bar {
    flex-direction: row;
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    height: 56px;
    width: auto;
    border-top: 0;
    border-bottom: 1px solid var(--color-border);
    padding: 0 16px;
    padding-bottom: 0;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
  }
  .brand-link {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding: 0 8px;
    margin-right: auto; /* pushes nav tabs to the right */
  }
  .tab {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 14px;
    min-height: 44px;
    border-radius: var(--radius);
  }
  /* Strip the app-bar banner — let the page title sit inline above the toolbar. */
  .app-bar {
    position: static;
    background: transparent;
    border-bottom: 0;
    padding: 12px 24px 0;
    min-height: 0;
  }
  .app-bar-title {
    font-size: 22px;
  }
  .action-bar { bottom: 0; }
  .fab { bottom: 24px; }
  /* Use the full viewport width on desktop so the table doesn't need to scroll horizontally. */
  .app-main {
    max-width: none;
    padding: 0 24px 32px;
  }
  /* Let long category/service lists wrap to multiple lines on desktop instead of ellipsis. */
  .providers-table td.ellipsis {
    max-width: none;
    white-space: normal;
  }
}

/* Providers table (≥ 768 px) */
.providers-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}
.providers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.providers-table th,
.providers-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.providers-table tr:last-child td { border-bottom: 0; }
.providers-table thead th {
  font-weight: 600;
  background: var(--color-surface);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.providers-table thead th .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  color: var(--color-muted);
  font-size: 11px;
}
.providers-table thead th[aria-sort='ascending'] .sort-indicator,
.providers-table thead th[aria-sort='descending'] .sort-indicator {
  color: var(--color-primary);
}
.providers-table tbody tr {
  cursor: pointer;
}
.providers-table tbody tr:hover td {
  background: var(--color-surface);
}
.providers-table td.ellipsis {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.providers-table td.col-name { font-weight: 600; }
.providers-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.providers-toolbar .spacer { flex: 1; }

/* Inline rename input */
.inline-input {
  width: 100%;
  min-height: var(--tap);
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* User row (Settings → Users) */
.user-row {
  align-items: center;
  gap: 12px;
}
.user-row-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.user-row-name { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.user-row-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.user-row-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.user-row-notify {
  margin-top: 4px;
}
.user-row-notify-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-row-notify-inputs .inline-input {
  flex: 1 1 180px;
  min-width: 140px;
}
.notify-ok {
  color: var(--color-success);
  display: inline-flex;
  align-items: center;
}
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--color-border);
}
.role-badge.role-admin {
  background: #E6F8D7;
  color: #1F4707;
  border-color: #B8E59A;
}
.role-badge.role-operator {
  background: #E8F0FE;
  color: #1A4FB3;
  border-color: #BBD0F6;
}
.role-badge.role-viewer {
  background: var(--color-surface);
  color: var(--color-muted);
}
.badge-active {
  background: var(--color-bg);
  color: var(--color-muted);
}
.badge-paused {
  background: #FFF4DC;
  color: #8A5A00;
  border-color: #F2D58A;
}

/* Added-by cell on Catalog rows (Categories + Services sub-tabs) */
.catalog-row-added-by {
  flex: 0 0 auto;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--color-muted);
  font-style: italic;
}
@media (min-width: 768px) {
  .catalog-row-added-by { max-width: 160px; font-size: 13px; }
}

/* Activity timeline (provider edit form + catalog edit dialogs) */
.activity-disclosure {
  display: block;
  margin: 16px 0 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--color-bg);
}
.activity-disclosure > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  user-select: none;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.activity-disclosure > summary::-webkit-details-marker { display: none; }
.activity-disclosure > summary::before {
  content: '▸';
  display: inline-block;
  width: 16px;
  color: var(--color-muted);
  transition: transform 150ms ease;
}
.activity-disclosure[open] > summary::before { transform: rotate(90deg); }
.activity-log {
  list-style: none;
  padding: 4px 12px 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.activity-log-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.activity-log-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 4px;
}
.activity-log-by {
  font-weight: 600;
  color: var(--color-primary);
}
.activity-log-at { white-space: nowrap; }
.activity-log-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.4;
}

/* Remarks log */
.remarks-log {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}
.remarks-log-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.remarks-log-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 4px;
}
.remarks-log-by {
  font-weight: 600;
  color: var(--color-primary);
}
.remarks-log-at {
  white-space: nowrap;
}
.remarks-log-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-size: 14px;
}

/* Helper layout */
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.muted { color: var(--color-muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }

/* Product chips on provider list */
.product-chip {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
}
.product-chip.product-waslawork {
  background: #E6F4E6;
  color: #1F4707;
  border-color: #B8E59A;
}
.product-chip.product-waslacare {
  background: #FFF4DC;
  color: #8A5A00;
  border-color: #F2D58A;
}

/* Product line checkboxes on the provider form */
.products-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.product-toggle {
  flex: 1 1 120px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  cursor: pointer;
}
.product-toggle input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
}
.product-toggle:has(input:checked) {
  border-color: var(--color-primary);
  background: rgba(47, 132, 47, 0.06);
}

/* Inline-add row inside the service picker */
.svc-add-row-host { padding: 4px 0 12px; }
.svc-add-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px dashed var(--color-secondary);
  border-radius: var(--radius);
  background: #FFFBF1;
  color: #8A5A00;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.svc-add-row:active { background: #FFF4DC; }
.svc-add-row svg { color: var(--color-secondary); }

/* user-added catalog badge */
.badge-user-added {
  background: #FFF4DC;
  color: #8A5A00;
  border: 1px solid #F2D58A;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  margin-left: 8px;
  border-radius: 999px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.catalog-row .name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

/* Dashboard — alert message when some services have no providers linked */
.dash-zero-alert {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-danger);
  margin: -4px 0 12px;
  animation: dash-zero-alert-pulse 1.4s ease-in-out infinite;
}
@keyframes dash-zero-alert-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .dash-zero-alert { animation: none; }
}
@media (min-width: 768px) {
  .dash-zero-alert { font-size: 18px; }
}

/* Dashboard — compact summary matrix (4 columns × 8 rows: name/value pairs per group) */
.dash-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
/* Column widths: group label gets a bit more, three metric columns share the rest */
.dash-summary-table th:first-child,
.dash-summary-table td:first-child { width: 26%; }
.dash-summary-table th:not(:first-child),
.dash-summary-table td:not(:first-child) { width: 24.66%; }

.dash-summary-table th,
.dash-summary-table td {
  border: 1px solid var(--color-border);
  /* Horizontal row dividers in brand primary green */
  border-top-color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  padding: 6px 6px;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  line-height: 1.25;
}
.dash-summary-group-label {
  background: var(--color-surface);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text);
}
.dash-summary-name {
  font-weight: 500;
  color: var(--color-muted);
  font-size: 12px;
}
.dash-summary-value {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-text);
}
@media (min-width: 768px) {
  .dash-summary-table { font-size: 14px; }
  .dash-summary-table th,
  .dash-summary-table td { padding: 8px 10px; }
  .dash-summary-name { font-size: 13px; }
  .dash-summary-value { font-size: 16px; }
}

/* Dashboard — pie chart + legend (Providers by Category) */
.dash-pie-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}
.dash-pie-col {
  display: flex;
  justify-content: center;
}
.dash-pie {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  /* Subtle ring to anchor light slice colors against white background */
  box-shadow: 0 0 0 1px var(--color-border) inset;
}
.dash-pie-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.dash-pie-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
}
.dash-pie-swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.dash-pie-legend-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-pie-legend-count {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 24px;
  text-align: right;
}
.dash-pie-legend-pct {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 40px;
  text-align: right;
}

@media (min-width: 768px) {
  .dash-pie-wrap {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }
  .dash-pie-col {
    flex: 0 0 240px;
  }
  .dash-pie {
    max-width: 240px;
  }
  .dash-pie-legend {
    flex: 1 1 auto;
  }
}

/* Dashboard — services breakdown table */
.dash-svc-table-wrap {
  width: 100%;
  overflow-x: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.dash-svc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}
.dash-svc-table thead th {
  text-align: left;
  font-weight: 600;
  background: var(--color-surface);
  padding: 8px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
}
.dash-svc-table tbody td {
  padding: 8px 10px;
  border-top: 1px solid var(--color-border);
  vertical-align: top;
}
.dash-svc-table tbody tr:first-child td { border-top: 0; }
.dash-svc-table .dash-svc-name,
.dash-svc-table .dash-svc-cat {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-svc-table .dash-svc-name-text {
  font-weight: 500;
}
.dash-svc-table .dash-svc-count {
  text-align: right;
  white-space: nowrap;
  width: 64px;
  font-weight: 600;
}
.dash-svc-table thead th.dash-svc-count { text-align: right; }
/* Mobile column widths — Service / Category / Added-by / Count.
   Keep counts visible; let long names truncate before category. */
.dash-svc-table colgroup { display: none; }
.dash-svc-table th:nth-child(1),
.dash-svc-table td:nth-child(1) { width: 40%; }
.dash-svc-table th:nth-child(2),
.dash-svc-table td:nth-child(2) { width: 25%; }
.dash-svc-table th:nth-child(3),
.dash-svc-table td:nth-child(3) { width: 20%; }
.dash-svc-table th:nth-child(4),
.dash-svc-table td:nth-child(4) { width: 15%; }
.dash-svc-table .dash-svc-by {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-muted);
}
@media (min-width: 768px) {
  .dash-svc-table { font-size: 14px; }
  .dash-svc-table th:nth-child(1),
  .dash-svc-table td:nth-child(1) { width: 40%; }
  .dash-svc-table th:nth-child(2),
  .dash-svc-table td:nth-child(2) { width: 30%; }
  .dash-svc-table th:nth-child(3),
  .dash-svc-table td:nth-child(3) { width: 18%; }
  .dash-svc-table th:nth-child(4),
  .dash-svc-table td:nth-child(4) { width: 12%; }
}
