/* Customer selection filters views while retaining the organization workspace. */
.customer-scope-picker{display:block;min-width:0;margin:0 6px 20px;padding:12px;background:#f6f8fd;border:1px solid #e5ebf6;border-radius:8px}
.customer-scope-picker>span{display:flex;align-items:center;gap:7px;color:#8393ae;font-size:8px;font-weight:600;letter-spacing:.8px;margin-bottom:8px}
.customer-scope-picker .icon{width:15px;height:15px}
.customer-scope-picker select{display:block;width:100%;min-width:0;max-width:100%;border:0;background:#fff;border-radius:5px;padding:8px;color:#344868;font-size:11px;line-height:1.5;text-overflow:ellipsis}
.customer-scope-picker small{display:block;margin-top:7px;color:#91a0b8;font-size:8px;line-height:1.6}
.topbar.crm-workspace-header {
  height: auto;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0 36px;
}
.crm-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  min-height: 54px;
}
.crm-workspace-header .breadcrumbs {
  display: flex;
  flex: 1;
  min-width: 0;
  margin-right: 0;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}
.crm-workspace-header .breadcrumbs strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crm-header-main .topbar-actions {
  flex-shrink: 0;
  min-width: 0;
  gap: 14px;
}
.crm-header-customer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 18px;
  min-width: 0;
  padding: 9px 0 11px;
  border-top: 1px solid #edf1f8;
}
.crm-header-customer-summary {
  display: flex;
  flex: 0 1 340px;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}
.crm-header-customer-summary h2 {
  margin: 0;
  color: #405778;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.crm-header-customer-contact {
  display: block;
  margin: 0;
  color: #8a99ae;
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.crm-header-customer-facts {
  display: flex;
  flex: 1 1 300px;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
  min-width: 0;
  color: #8191a9;
  font-size: 10px;
  line-height: 1.65;
}
.crm-header-customer-facts > * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.crm-header-customer-facts a { color: #6d85b4; }
.crm-header-customer-actions {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.crm-header-customer-actions .btn {
  min-width: 0;
  min-height: 29px;
  padding: 6px 8px;
  gap: 5px;
  font-size: 10px;
  white-space: normal;
}
.crm-header-customer-actions .btn .icon { width: 13px; height: 13px; }
.crm-header-customer-actions [data-action="scope-clear"] { margin-left: auto; }
.customer-directory .is-selected-customer{background:#f0f4ff}
.customer-directory .is-selected-customer>td:first-child{box-shadow:inset 3px 0 #3d61df}
.customer-selected-label{display:block;margin-top:5px;color:#345bd7;font-size:10px;font-weight:600}
.customer-dashboard-links .panel-body{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.customer-dashboard-link{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px;border:1px solid #e5ebf6;border-radius:8px;color:#405778;text-decoration:none}
.customer-dashboard-link>span{display:grid;grid-template-columns:24px minmax(0,1fr);gap:4px 10px;min-width:0}
.customer-dashboard-link>span>.icon{grid-row:1/3}
.customer-dashboard-link small{grid-column:2;color:#8191a9;line-height:1.6}
.customer-invoice-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
.customer-invoice-downloads{margin-top:22px}
@media(max-width:600px){.customer-dashboard-links .panel-body,.customer-invoice-stats{grid-template-columns:minmax(0,1fr)}}

/* Keep the explicit edit control at the end of every task row. */
.task-row .task-edit-button {
  order: 10;
  flex: 0 0 32px;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  margin-left: auto;
  padding: 7px;
  color: #7b8faa;
}
.task-row .task-edit-button .icon { width: 16px; height: 16px; }

/* A project overview keeps source records readable inside the native modal. */
.project-detail-summary {
  min-width: 0;
  margin-bottom: 17px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8edf6;
}
.project-detail-summary h3 { margin: 0 0 6px; color: #405778; font-size: 15px; }
.project-detail-summary p { margin: 5px 0 0; font-size: 11px; overflow-wrap: anywhere; }
.project-detail-summary > .badge { margin: 0 8px 5px 0; }
.project-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  min-width: 0;
  margin: 0 0 20px;
}
.project-detail-stats > * {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid #e4ebf7;
  border-radius: 7px;
  background: #f8faff;
  color: #8b9bb2;
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.project-detail-stats strong {
  display: block;
  margin-top: 4px;
  color: #4c658d;
  font-size: 15px;
  line-height: 1.5;
}
.project-detail-section { min-width: 0; margin-top: 23px; }
.project-detail-section h3 {
  margin: 0 0 11px;
  color: #4b6284;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.project-detail-rows { display: grid; gap: 7px; min-width: 0; }
.project-detail-row {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid #e8edf6;
  border-radius: 7px;
  background: #fdfdff;
  color: #7d8fa9;
  font-size: 11px;
  line-height: 1.65;
}
.project-detail-row > div { flex: 1; min-width: 0; }
.project-detail-row strong { color: #50698e; font-size: 11px; overflow-wrap: anywhere; }
.project-detail-row small { display: block; color: #94a1b5; font-size: 10px; overflow-wrap: anywhere; }
.project-detail-row > span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.project-detail-row p { margin: 4px 0 0; font-size: 11px; white-space: pre-line; overflow-wrap: anywhere; }
.project-detail-row .btn { flex-shrink: 0; }
.project-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; min-width: 0; }
.project-detail-actions .btn { min-width: 0; white-space: normal; }
.project-detail-wiki { min-width: 0; max-width: 100%; }
.document-attachment-list{display:grid;gap:9px;min-width:0}
.document-attachment-row{display:flex;align-items:center;gap:12px;min-width:0;padding:12px 14px;border:1px solid #e5ebf6;border-radius:7px;background:#fbfcff}
.document-attachment-row>div{flex:1;min-width:0}
.document-attachment-row strong,.document-attachment-row small{display:block;overflow-wrap:anywhere;line-height:1.7}
.document-attachment-row strong{font-size:11px;color:#506789}
.document-attachment-row small{font-size:10px;color:#8e9eb7}
.document-attachment-row input{width:100%;min-width:0;margin-top:7px;font-size:12px;padding:8px;border:1px solid #dce5f3;border-radius:5px}
.document-uploads-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px;border-top:1px solid #e6edf7;padding-top:17px}
.document-uploads-heading h3{font-size:13px}
@media (max-width: 1200px) {
  .topbar.crm-workspace-header { padding-left: 24px; padding-right: 24px; }
  .crm-header-main .topbar-actions { gap: 10px; }
}
@media (max-width: 900px) {
  .topbar.crm-workspace-header { padding-left: 18px; padding-right: 18px; }
  .crm-header-main { gap: 10px; min-height: 60px; }
  .crm-workspace-header .mobile-nav-toggle { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; font-size: 0; }
  .crm-header-customer { gap: 7px 14px; padding-top: 8px; }
  .crm-header-customer-summary { flex-basis: 220px; }
  .crm-header-customer-actions .btn { min-height: 44px; padding: 8px 10px; }
  .task-row .task-edit-button { flex-basis: 44px; width: 44px; min-width: 44px; min-height: 44px; }
  .project-detail-actions .btn, .project-detail-row .btn { min-height: 44px; }
}
@media (max-width: 600px) {
  .topbar.crm-workspace-header { padding-left: 14px; padding-right: 14px; }
  .crm-header-main { gap: 8px; }
  .crm-workspace-header .breadcrumbs { flex-wrap: wrap; gap: 1px 4px; font-size: 9px; line-height: 1.4; white-space: normal; }
  .crm-workspace-header .breadcrumbs > .icon { width: 10px; height: 10px; }
  .crm-workspace-header .breadcrumbs strong { flex: 1 0 100%; font-size: 10px; white-space: nowrap; }
  .crm-header-main .topbar-actions { gap: 7px; }
  .crm-header-main .topbar-timer { min-height: 40px; padding: 7px; gap: 5px; }
  .crm-header-main .topbar-timer-project { max-width: 65px; }
  .crm-header-customer { gap: 7px; padding-top: 8px; padding-bottom: 10px; }
  .crm-header-customer-summary { flex: 1 1 100%; }
  .crm-header-customer-summary h2 { font-size: 13px; }
  .crm-header-customer-contact { font-size: 10px; }
  .crm-header-customer-facts { flex-basis: 100%; gap: 2px 10px; font-size: 10px; }
  .crm-header-customer-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .crm-header-customer-actions .btn { width: 100%; padding: 7px 5px; gap: 4px; font-size: 10px; }
  .crm-header-customer-actions [data-action="scope-clear"] { margin-left: 0; }
  .task-row:has(.task-edit-button) { display: grid; grid-template-columns: 23px minmax(0, 1fr) 44px; gap: 7px 10px; }
  .task-row:has(.task-edit-button) > .task-check { grid-column: 1; grid-row: 1; }
  .task-row:has(.task-edit-button) > div { grid-column: 2; grid-row: 1; min-width: 0; }
  .task-row .task-edit-button { grid-column: 3; grid-row: 1; align-self: start; margin: 0; }
  .task-row:has(.task-edit-button) > .task-due { grid-column: 2; margin-left: 0; }
  .task-row:has(.task-edit-button) > .badge { grid-column: 2; justify-self: start; margin-left: 0; }
  .project-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .project-detail-stats > * { padding: 10px; }
  .project-detail-stats strong { font-size: 14px; }
  .project-detail-row { flex-wrap: wrap; gap: 7px 10px; padding: 10px 11px; }
  .project-detail-row > div { flex-basis: 100%; }
  .project-detail-row > .btn { margin-left: auto; }
  .project-detail-actions .btn { flex: 1 1 130px; justify-content: center; }
  .customer-scope-picker{margin:0 8px 17px;padding:12px}
  .customer-scope-picker select{font-size:16px}
  .customer-scope-picker>span{font-size:9px}
  .customer-scope-picker small{font-size:10px}
  .document-attachment-row{align-items:flex-start;padding:11px;gap:8px;flex-wrap:wrap}
  .document-attachment-row>.btn{margin-left:auto}
  .document-attachment-row>div{flex:1 1 170px}
  .document-attachment-row input{font-size:16px}
}

/* Customer visibility is a directory preference; relationship records remain available. */
.customer-directory-filters{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;padding:0 22px 18px;min-width:0}
.customer-directory-filters .tabs{display:flex;flex-wrap:wrap;gap:3px;min-width:0}
.customer-directory-filters .btn.tab{min-height:34px;padding:8px 10px;white-space:normal;font-size:11px}
.customer-hidden-label{display:block;margin-top:5px;font-size:10px;color:#8191a9}
@media(max-width:600px){.customer-directory-filters{padding:0 14px 14px;gap:9px}.customer-directory-filters .tabs{width:100%}.customer-directory-filters .btn.tab{flex:1;min-height:44px;padding:8px;font-size:11px}.customer-directory .panel-header{flex-wrap:wrap;gap:12px}.customer-directory .search-field{width:100%;min-width:0}}
