* { box-sizing: border-box; }
:root { color-scheme: light; --ink: #182b37; --muted: #536b78; --line: #dbe5e9; --teal: #006454; --wash: #f3f7f7; --white: #fff; }
body { margin: 0; background: var(--wash); color: var(--ink); font: 15px/1.5 "Inter", system-ui, sans-serif; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 8px 24px; gap: 16px; background: #102f35; color: var(--white); }
.topbar a { color: var(--white); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; background: #8be0c6; color: #112f2e; }
.account, .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.account button { background: transparent; color: var(--white); border-color: #56757a; min-height: 32px; }
.shell { display: grid; grid-template-columns: 186px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.shell.no-nav { grid-template-columns: minmax(0, 1fr); }
.sidebar { background: var(--white); border-right: 1px solid var(--line); padding: 22px 12px; }
.sidebar a { display: block; padding: 10px 12px; border-radius: 7px; color: var(--ink); margin-bottom: 3px; }
.sidebar a[aria-current], .tabs a[aria-current] { background: #dff1eb; color: #004a3f; font-weight: 650; }
main { width: 100%; min-width: 0; padding: 28px; }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.15; letter-spacing: -.04em; }
h2 { font-size: 18px; } h3 { font-size: 16px; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel { border: 1px solid var(--line); background: var(--white); border-radius: 11px; padding: 16px; margin-bottom: 16px; }
.narrow { max-width: 720px; }
.login-card { max-width: 440px; margin: clamp(36px, 13vh, 120px) auto; padding: 30px; }
.muted { color: var(--muted); } .empty { color: var(--muted); padding: 25px; }
.toolbar, .table-tools, .tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
input, select, textarea, button, .button { font: inherit; }
input:not([type=checkbox]), select, textarea { border: 1px solid #aabfc6; color: var(--ink); background: var(--white); border-radius: 6px; padding: 7px 9px; max-width: 100%; }
input[type=checkbox] { accent-color: var(--teal); }
textarea { width: 100%; }
.narrow form p > label, .login-card label { display: block; margin-bottom: 5px; }
.narrow input:not([type=checkbox]), .login-card input { width: 100%; }
button, .button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #aabfc6; color: var(--ink); background: var(--white); border-radius: 7px; padding: 5px 10px; min-height: 36px; cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
.primary { color: var(--white); border-color: var(--teal); background: var(--teal); font-weight: 600; }
:focus-visible { outline: 2px solid #1761b0; outline-offset: 2px; }
.scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
thead th { background: #edf4f3; color: #243f47; font-size: 13px; }
tbody tr:hover { background: #f6faf9; }
.cell-value { display: inline-block; max-width: 270px; vertical-align: middle; text-overflow: ellipsis; overflow: hidden; }
.cell-copy { min-height: 26px; padding: 0 4px; margin-left: 5px; color: var(--teal); border-color: transparent; background: transparent; }
.row-actions { white-space: nowrap; }
.row-actions a, .row-actions button { margin-right: 6px; }
.row-actions button { min-height: 28px; padding: 2px 7px; }
.table-heading { margin-bottom: 18px; }
.customer-filters { align-items: end; }
.customer-filters input[type=search] { flex: 1 1 245px; }
.table-tools { margin-bottom: 12px; }
.selection-count { padding: 2px 9px; border-radius: 20px; color: #005344; background: #dff1eb; font-size: 13px; }
.customer-scroll { max-height: min(68vh, 760px); border: 1px solid var(--line); border-radius: 8px; }
#customer-table thead th { position: sticky; z-index: 1; top: 0; box-shadow: 0 1px var(--line); }
#customer-table th[aria-sort=ascending], #customer-table th[aria-sort=descending] { background: #dcece8; }
#customer-table tbody tr:nth-child(even) { background: #f8fbfa; }
#customer-table tbody tr:hover { background: #edf6f3; }
#customer-table tbody tr:has(.pick:checked) { background: #e0f2ec; }
#customer-table td:first-child, #customer-table th:first-child { width: 1%; }
#customer-table .row-actions a { font-weight: 600; }
.view-options { margin-left: auto; position: relative; }
.view-options > summary { cursor: pointer; padding: 6px; }
.view-options form { position: absolute; z-index: 2; right: 0; top: 100%; width: min(360px, 78vw); box-shadow: 0 7px 28px #112c3630; }
.view-options label { flex: 1; }
#column-settings { overflow: auto; max-height: 48vh; padding-left: 0; }
#column-settings li { list-style: none; padding: 3px; display: flex; align-items: center; gap: 5px; }
#column-settings button { padding: 0 6px; min-height: 26px; }
.grip { cursor: grab; color: var(--muted); }
.pagination { display: flex; gap: 18px; align-items: center; padding: 9px 5px; }
.tabs { margin: 8px 0 16px; }
.tabs a { padding: 6px 11px; border-radius: 8px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 12px; }
.fields dt { color: var(--muted); font-size: 13px; }
.fields dd { margin: 0; display: flex; gap: 5px; justify-content: space-between; align-items: start; overflow-wrap: anywhere; }
.long { white-space: pre-wrap; overflow-wrap: anywhere; }
.stack article { padding-block: 12px; border-bottom: 1px solid var(--line); }
.stack article:last-child { border-bottom: 0; }
.notice { border-radius: 7px; background: #e9f2fa; padding: 10px 14px; }
.error, .errorlist { color: #9b281f; } .notice.error { background: #fcebe9; } .notice.success { background: #dff4e8; }
.helptext { color: var(--muted); font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 780px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: flex; gap: 5px; overflow: auto; padding: 7px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar a { white-space: nowrap; margin-bottom: 0; }
  main { padding: 14px; }
  .topbar { padding-inline: 12px; }
  .panel { padding: 12px; }
}

.page-size-control { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.column-bulk { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0 0; }
.employee-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.metric-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 14px; }
.metric-groups .panel { min-width: 0; }
.metric-table { white-space: normal; }
.metric-table input[type=number] { width: 85px; }
.metric-number { text-align: right; white-space: nowrap; }
.metric-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#customer-table .row-primary { position: sticky; left: 0; background: var(--white); z-index: 1; box-shadow: 1px 0 var(--line); }
#customer-table thead .row-primary { z-index: 2; background: #edf4f3; }
#customer-table tr:nth-child(even) .row-primary { background: #f8fbfa; }
#customer-table tr:has(.pick:checked) .row-primary { background: #e0f2ec; }
.row-primary-actions, .date-controls { display: flex; gap: 8px; align-items: center; }
.date-controls { flex-wrap: wrap; }
.date-controls button[aria-pressed=true] { color: #004a3f; background: #dff1eb; }
.narrow .date-controls input[type=date] { width: auto; }
.followup-field { margin-bottom: 14px; }
.followup-field > label { display: block; margin-bottom: 5px; }
.followup-attachments { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.followup-attachments li { max-width: 190px; overflow-wrap: anywhere; }
.followup-attachments img { width: 100%; height: 100px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; display: block; }

.detail-back { margin-bottom: 14px; }
.customer-scroll[data-scrollbar=custom] { overflow-x: hidden; }
.grid-scrollbar:not([hidden]) { display: flex; gap: 10px; align-items: center; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.grid-scrollbar input[type=range] { --scroll-thumb-width: 30%; appearance: none; flex: 1; min-width: 0; height: 16px; padding: 0; border: 1px solid #a5bdba; border-radius: 9px; background: #e3edeb; cursor: ew-resize; }
.grid-scrollbar input[type=range]::-webkit-slider-thumb { appearance: none; width: var(--scroll-thumb-width); height: 14px; border-radius: 8px; background: #32776c; border: 1px solid #2c685e; }
.grid-scrollbar input[type=range]::-moz-range-thumb { width: var(--scroll-thumb-width); height: 14px; border-radius: 8px; background: #32776c; border: 1px solid #2c685e; }
.task-notification:not([hidden]) { display: inline-flex; align-items: center; gap: 6px; }
.task-badge { min-width: 20px; padding: 0 5px; text-align: center; background: #ce4436; color: white; border-radius: 12px; font-weight: 650; }

.quick-select { max-width: 8em; font-size: 12px; min-height: 28px; padding: 3px 5px; margin-left: 3px; }
.quick-summary:not([hidden]) { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 6px 0 10px; color: var(--muted); }
.quick-summary strong { color: var(--ink); }
.row-actions a.button { min-height: 28px; padding: 2px 7px; font-size: 13px; }

.account-editor { max-width: 1440px; }
.account-editor-grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(400px, 1.4fr); gap: 18px; }
.account-fields, .account-permissions, .role-checks > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(205px, 100%), 1fr)); gap: 14px; }
.account-fields > div > label, .account-permissions label { display: block; margin-bottom: 6px; }
.account-fields input:not([type=checkbox]), .account-fields select, .account-permissions select { width: 100%; }
.role-checks label { display: flex; align-items: center; gap: 6px; }
@media (max-width: 950px) { .account-editor-grid { grid-template-columns: minmax(0, 1fr); } }

.date-select { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; vertical-align: middle; }
.date-select select { width: auto; min-width: 3.6rem; }

.record-editor { max-width: 1200px; }
.record-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 18px; }
.record-fields > div > label { display: block; }
.record-fields input:not([type=checkbox]), .record-fields select, .record-fields textarea { width: 100%; }
.custom-record-row { display: grid; grid-template-columns: 1fr 2fr auto; align-items: start; gap: 12px; margin-bottom: 10px; }
.custom-record-row input:not([type=checkbox]) { display: block; width: 100%; }
.custom-remove { align-self: center; }
.record-editor textarea { width: 100%; }
@media (max-width: 620px) { .custom-record-row { grid-template-columns: 1fr; gap: 4px; } }
.report-column-options summary { cursor: pointer; }
.report-column-options fieldset { margin: 10px 0; border: 1px solid var(--line); }
.report-column-options label { display: inline-flex; align-items: center; gap: 5px; margin: 4px 12px 4px 0; }

.score-rule-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); max-width: 1600px; gap: 14px; align-items: start; }
.score-rule-group { min-width: 0; }
.score-group-title, .score-group-columns, .score-item-overview { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.score-group-title h2 { margin: 0; }
.score-group-title button { flex-shrink: 0; }
.score-group-columns { margin-top: 10px; padding: 5px 7px; background: var(--wash); color: var(--muted); font-size: .875rem; }
.score-group-columns > :last-child { min-width: 68px; text-align: right; }
.score-item { padding: 6px 7px; border-bottom: 1px solid var(--line); }
.score-item:last-child { border-bottom: 0; }
.score-item-name { font-weight: 600; overflow-wrap: anywhere; }
.score-item-points input { width: 68px; text-align: right; }
.score-item-details { margin: -2px 0 2px; }
.score-item-details summary { width: fit-content; cursor: pointer; color: var(--teal); font-size: .875rem; }
.score-edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 9px; margin: 8px 0; }
.score-edit-fields label:not([hidden]) { display: grid; gap: 3px; }
.score-edit-fields input, .score-edit-fields select { width: 100%; min-width: 0; }
.score-display-name { grid-column: 1 / -1; }
.score-remove { display: inline-flex; gap: 5px; align-items: center; }
.score-deleted { background: var(--wash); }
.score-deleted .score-item-name { text-decoration: line-through; color: var(--muted); }
.score-remove-status { color: var(--muted); }

.advanced-filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; flex: 1 0 100%; }
.advanced-filter-fields label { display: grid; align-content: start; gap: 4px; }
.advanced-filter-fields input, .advanced-filter-fields select { width: 100%; min-width: 0; }
.customer-filter-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; flex-basis: 100%; }

#company-picker { margin-top: 7px; }
.company-search-results { display: grid; max-height: 16rem; overflow: auto; gap: 3px; }
.company-search-results button { text-align: left; }

.notice.warning { background: #fff5d6; border-left: 4px solid #a7660b; color: #593707; }
.staff-notice-recipients { max-height: 15rem; overflow: auto; }

.staff-notice-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 68rem;
  margin: 0 auto 16px;
  border: 1px solid #9bbeb3;
  border-left: 4px solid #24705f;
  background: #e8f5ee;
  overflow-wrap: anywhere;
}
.staff-notice-banner h2 { margin: 3px 0; }
.staff-notice-banner p { margin: 4px 0 0; }
.notice.warning p { margin: 8px 0 0; }
