:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --grid: #d9dee3;
  --text: #20262d;
  --muted: #64717d;
  --blue: #1f75bb;
  --blue-dark: #115b94;
  --mint: #bfe9cc;
  --aqua: #bfe6f2;
  --rose: #f8c2cd;
  --yellow: #fff59a;
  --peach: #f4c6a7;
  --lavender: #d993d5;
  --sky: #83c9e3;
  --green: #c8efcf;
  --gray: #e7eaee;
  --orange: #ffd8ad;
  --surface-soft: #f9fbfc;
  --border: #cbd4dc;
  --control-bg: #ffffff;
  --control-border: #bac5cf;
  --button-bg: #ffffff;
  --button-text: #1f2c38;
  --ghost-text: #34414d;
  --shadow: 0 12px 34px rgba(31, 46, 61, 0.12);
  --table-header: #c0e7f1;
  --section-header: #bdecc9;
  --history-bg: #f8fafb;
  --chart-track: #e8edf2;
  --bar: #1f75bb;
  --dashboard-bg: #f6f8fb;
  --dashboard-card: #ffffff;
  --dashboard-purple: #9253d8;
  --dashboard-purple-light: #c28bf1;
  font-family: "Segoe UI", Arial, sans-serif;
}

body[data-theme="dark"] {
  --bg: #101214;
  --panel: #181b1f;
  --grid: #343a42;
  --text: #ecf1f5;
  --muted: #aeb8c2;
  --blue: #5aa3e8;
  --blue-dark: #8bc2f2;
  --surface-soft: #20242a;
  --border: #39414b;
  --control-bg: #111418;
  --control-border: #4b5562;
  --button-bg: #242a31;
  --button-text: #f4f7fa;
  --ghost-text: #d4dbe3;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  --table-header: #24465a;
  --section-header: #26533a;
  --history-bg: #15181c;
  --chart-track: #2d333a;
  --bar: #5aa3e8;
  --dashboard-bg: #111418;
  --dashboard-card: #181b1f;
  --dashboard-purple: #b184f0;
  --dashboard-purple-light: #7c55c7;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.topbar > div:first-child {
  min-width: min(240px, 100%);
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2 {
  line-height: 1.1;
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

.topbar-actions,
.form-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-actions {
  justify-content: flex-end;
}

.role-control {
  min-width: 150px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
}

.primary-button {
  background: var(--blue);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  background: var(--button-bg);
  border-color: var(--border);
  color: var(--button-text);
}

.ghost-button {
  background: transparent;
  border-color: var(--border);
  color: var(--ghost-text);
}

.icon-button {
  background: var(--button-bg);
  border-color: var(--border);
  color: var(--button-text);
  height: 34px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.tracker-surface,
.dashboard-surface {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dashboard-surface[hidden],
.tracker-surface[hidden] {
  display: none;
}

.filters {
  align-items: end;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--grid);
  display: grid;
  gap: 10px;
  grid-template-columns: 210px 190px 190px 150px minmax(220px, 1fr) auto;
  padding: 12px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
}

select,
input,
textarea {
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 5px;
  color: var(--text);
  min-height: 34px;
  padding: 7px 9px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.status-strip {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--grid);
  display: flex;
  gap: 18px;
  padding: 10px 12px;
}

.status-strip > div {
  align-items: baseline;
  display: flex;
  gap: 6px;
}

.metric-value {
  color: var(--blue-dark);
  font-size: 18px;
  font-weight: 800;
}

.metric-value.critical {
  color: #a01834;
}

.metric-label,
.sync-message {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sync-message {
  margin-left: auto;
}

.workbook {
  background: var(--panel);
}

.table-wrap {
  max-height: calc(100vh - 232px);
  min-height: 480px;
  overflow: auto;
}

.tracker-table {
  border-collapse: collapse;
  min-width: 2050px;
  table-layout: fixed;
  width: 100%;
}

.tracker-table th,
.tracker-table td {
  border: 1px solid var(--grid);
  font-size: 12px;
  line-height: 1.32;
  padding: 7px 8px;
  vertical-align: top;
}

.tracker-table thead th {
  background: var(--table-header);
  font-weight: 800;
  position: sticky;
  text-align: center;
  top: 27px;
  z-index: 3;
}

.tracker-table thead .section-row th {
  background: var(--section-header);
  border-bottom: 2px solid #000000;
  color: var(--text);
  font-size: 12px;
  top: 0;
  z-index: 4;
}

.tracker-table tbody tr:hover td {
  box-shadow: inset 0 0 0 9999px rgba(31, 117, 187, 0.06);
}

.expand-col {
  width: 70px;
}

.date-col {
  width: 112px;
}

.person-col {
  width: 112px;
}

.priority-col {
  width: 88px;
}

.category-col {
  width: 118px;
}

.issue-col {
  width: 330px;
}

.notes-col {
  width: 365px;
}

.team-col {
  width: 170px;
}

.status-col {
  width: 160px;
}

.ticket-col {
  width: 146px;
}

.closing-col {
  width: 315px;
}

.cell-muted {
  color: var(--muted);
}

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

.editable-note-cell {
  cursor: pointer;
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

.editable-note-cell:hover {
  box-shadow: inset 0 0 0 9999px rgba(31, 117, 187, 0.08);
}

.note-thread-cell,
.note-thread-history {
  display: grid;
  gap: 8px;
}

.note-thread-cell {
  align-content: start;
  max-height: 88px;
  overflow: hidden;
  position: relative;
}

.note-thread-cell.has-history-prompt {
  padding-bottom: 26px;
}

.note-history-prompt {
  background: var(--panel);
  border-top: 1px solid var(--border);
  bottom: 0;
  box-shadow: 0 -10px 14px 8px var(--panel);
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
  left: 0;
  line-height: 1.2;
  padding: 6px 4px 4px;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.note-thread-entry {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  padding: 9px 10px;
}

.note-thread-entry.compact {
  background: transparent;
  border: 0;
  border-left: 3px solid var(--border);
  border-radius: 0;
  padding: 0 0 0 7px;
}

.note-thread-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.note-author {
  border-radius: 999px;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 7px;
}

.note-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.note-actions {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  margin-left: auto;
  position: relative;
}

.note-action-button {
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--button-text);
  font-size: 11px;
  font-weight: 800;
  min-height: 24px;
  padding: 3px 8px;
}

.note-action-button:hover {
  border-color: var(--blue);
}

.note-action-button.icon-only {
  min-width: 30px;
  padding-left: 6px;
  padding-right: 6px;
}

.note-action-button.danger {
  color: #b42318;
}

body[data-theme="dark"] .note-action-button.danger {
  color: #ff9b91;
}

.note-action-menu {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.note-action-dropdown {
  display: inline-flex;
  order: -1;
}

.note-action-dropdown[hidden] {
  display: none;
}

.note-action-dropdown button {
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--button-text);
  font-size: 11px;
  font-weight: 800;
  min-height: 24px;
  padding: 3px 8px;
  white-space: nowrap;
}

.note-action-dropdown button:hover {
  border-color: var(--blue);
}

.note-body {
  margin: 0;
  overflow-wrap: anywhere;
}

.select-cell {
  border: 0;
  border-radius: 0;
  font-size: 12px;
  font-weight: 700;
  min-height: 28px;
  padding: 4px 6px;
  width: 100%;
}

.ticket-cell {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.ticket-refresh {
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--button-text);
  font-size: 11px;
  font-weight: 800;
  height: 26px;
  min-width: 44px;
  padding: 0 6px;
}

.expand-button {
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--button-text);
  font-size: 11px;
  font-weight: 800;
  min-height: 26px;
  min-width: 46px;
  padding: 0 6px;
}

.history-row td {
  background: var(--history-bg);
  padding: 0;
}

.history-panel {
  border-left: 4px solid var(--blue);
  display: grid;
  gap: 10px;
  padding: 12px 14px;
}

.history-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.history-heading span,
.history-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.history-item p,
.empty-history {
  margin: 0;
}

.dashboard-surface {
  background: var(--dashboard-bg);
  border-color: transparent;
  box-shadow: none;
  overflow: visible;
  padding: 18px;
}

.dashboard-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dashboard-header h2 {
  font-size: 22px;
  margin-bottom: 3px;
}

.dashboard-subtitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 0;
}

.dashboard-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  position: relative;
}

.dashboard-practice-filter {
  max-width: 100%;
  position: relative;
}

.dashboard-practice-filter summary {
  align-items: center;
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--button-text);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: space-between;
  list-style: none;
  min-height: 38px;
  max-width: min(280px, calc(100vw - 36px));
  min-width: min(210px, 100%);
  padding: 8px 12px;
}

.dashboard-practice-filter summary::-webkit-details-marker {
  display: none;
}

.dashboard-practice-filter summary::after {
  content: "v";
  color: var(--muted);
  font-size: 11px;
  margin-left: 12px;
}

.dashboard-practice-filter[open] summary::after {
  content: "^";
}

#dashboardPracticeFilterLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.practice-filter-menu {
  background: var(--dashboard-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
  max-width: min(320px, calc(100vw - 36px));
  min-width: 260px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 12;
}

.practice-filter-option {
  align-items: center;
  border-radius: 5px;
  color: var(--text);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  min-height: 32px;
  padding: 6px 8px;
}

.practice-filter-option:hover {
  background: var(--surface-soft);
}

.practice-filter-option input {
  min-height: 0;
  padding: 0;
}

.dashboard-metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  margin-bottom: 14px;
}

.summary-tile {
  background: var(--dashboard-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(31, 46, 61, 0.06);
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 8px;
  min-width: 0;
  min-height: 116px;
  padding: 16px;
  text-align: left;
  transition: border-color 150ms ease, transform 150ms ease;
}

.summary-tile:hover,
.summary-tile:focus-visible {
  border-color: var(--dashboard-purple);
  transform: translateY(-1px);
}

.summary-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.summary-value {
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.summary-value.critical {
  color: #d64a5f;
}

.summary-hint {
  color: #169b50;
  font-size: 12px;
  font-weight: 800;
}

.summary-hint.warning {
  color: #d96b2b;
}

.dashboard-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

.chart-panel {
  background: var(--dashboard-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(31, 46, 61, 0.06);
  min-height: 210px;
  min-width: 0;
  padding: 16px;
}

.chart-panel:nth-child(1) {
  grid-column: auto;
}

.chart-panel:nth-child(2) {
  grid-column: auto;
}

.chart-panel:nth-child(3) {
  grid-column: auto;
}

.chart-panel:nth-child(4) {
  grid-column: 1 / -1;
}

.chart-panel h3 {
  font-size: 13px;
  margin: 0 0 16px;
}

.bar-list {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.bar-row {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: inherit;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(96px, 34%) minmax(0, 1fr) max-content;
  min-width: 0;
  padding: 0;
  text-align: left;
}

.chart-drilldown {
  cursor: pointer;
}

.chart-drilldown:hover,
.chart-drilldown:focus-visible {
  background: var(--surface-soft);
  outline: 1px solid var(--border);
  outline-offset: 4px;
}

.bar-label,
.bar-value,
.vertical-label,
.vertical-value {
  font-size: 12px;
  font-weight: 800;
}

.bar-label,
.vertical-label {
  color: var(--text);
}

.bar-label,
.bar-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bar-value,
.vertical-value {
  color: var(--muted);
  justify-self: end;
  text-align: right;
}

.bar-track {
  background: var(--chart-track);
  border-radius: 999px;
  height: 12px;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.bar-fill {
  background: linear-gradient(90deg, var(--dashboard-purple), var(--dashboard-purple-light));
  border-radius: 999px;
  height: 100%;
}

.vertical-chart {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(var(--vertical-chart-columns, 3), minmax(0, 190px));
  justify-content: center;
  min-height: 158px;
  width: 100%;
}

.vertical-bar-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: inherit;
  display: grid;
  font: inherit;
  gap: 7px;
  grid-template-rows: auto 118px auto;
  min-width: 0;
  padding: 0;
  text-align: center;
}

.vertical-value {
  justify-self: center;
  text-align: center;
}

.vertical-bar-track {
  align-items: end;
  background: transparent;
  display: flex;
  height: 118px;
  justify-content: center;
  width: 100%;
}

.vertical-bar-fill {
  background: linear-gradient(180deg, var(--dashboard-purple-light), var(--dashboard-purple));
  border-radius: 6px 6px 0 0;
  max-width: 58px;
  min-height: 3px;
  width: 54%;
}

.vertical-label {
  min-height: 28px;
  overflow-wrap: anywhere;
  text-align: center;
}

.priority-critical {
  background: #e6566d;
  color: #ffffff;
  font-weight: 800;
}

.priority-high {
  background: var(--rose);
  color: #8a1027;
  font-weight: 800;
}

.priority-medium {
  background: #ffffff;
  color: #20262d;
}

.priority-low {
  background: #d7f0d2;
  color: #255b30;
}

.team-ops {
  background: var(--lavender);
  color: #20262d;
}

.team-it {
  background: var(--yellow);
  color: #20262d;
}

.team-growth-and-client-experience {
  background: var(--peach);
  color: #20262d;
}

.team-product {
  background: #b7e3b5;
  color: #20262d;
}

.team-pims-support {
  background: var(--sky);
  color: #20262d;
}

.team-implementation {
  background: var(--gray);
  color: #20262d;
}

.status-not-started-pending {
  background: var(--gray);
  color: #20262d;
}

.status-in-progress {
  background: var(--aqua);
  color: #08749a;
}

.status-follow-up-needed {
  background: var(--rose);
  color: #d30024;
  font-weight: 800;
}

.status-to-communicate {
  background: #ffeaa3;
  color: #b56800;
}

.status-waiting-on-clinic,
.status-waiting-on-vendor {
  background: var(--orange);
  color: #20262d;
}

.status-closed,
.status-resolved {
  background: var(--green);
  color: #14742c;
}

.modal-backdrop {
  align-items: center;
  background: rgba(20, 31, 42, 0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 30;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  max-height: calc(100vh - 48px);
  max-width: 860px;
  overflow: auto;
  padding: 18px;
  width: 100%;
}

.detail-modal {
  max-width: 1120px;
}

.export-modal {
  max-width: 680px;
}

.note-edit-modal {
  max-width: 720px;
}

.note-thread-history {
  background: var(--history-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 300px;
  overflow: auto;
  padding: 10px;
}

.note-thread-history[hidden] {
  display: none;
}

.detail-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: -6px 0 12px;
}

.detail-table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

.dashboard-detail-table {
  border-collapse: collapse;
  min-width: 980px;
  width: 100%;
}

.dashboard-detail-table th,
.dashboard-detail-table td {
  border-bottom: 1px solid var(--grid);
  font-size: 12px;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.dashboard-detail-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

.dashboard-detail-table tr:last-child td {
  border-bottom: 0;
}

.detail-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 8px;
}

.empty-detail {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

body[data-theme="dark"] .priority-medium {
  background: #242a31;
  color: var(--text);
}

body[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.modal-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.issue-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.note-edit-form {
  display: grid;
  gap: 12px;
}

.export-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.export-count {
  align-self: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 0;
}

.note-edit-form textarea {
  min-height: 220px;
}

.wide-field {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin-top: 4px;
}

@media (min-width: 1440px) {
  .dashboard-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .chart-panel:nth-child(1) {
    grid-column: span 5;
  }

  .chart-panel:nth-child(2) {
    grid-column: span 4;
  }

  .chart-panel:nth-child(3) {
    grid-column: span 3;
  }

  .chart-panel:nth-child(4) {
    grid-column: span 12;
  }
}

@media (max-width: 1180px) {
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-control {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .search-control {
    grid-column: auto;
  }

  .status-strip {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .sync-message {
    flex-basis: 100%;
    margin-left: 0;
  }

  .table-wrap {
    max-height: none;
  }

  .issue-form {
    grid-template-columns: 1fr;
  }

  .export-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .dashboard-surface {
    padding: 12px;
  }

  .dashboard-controls,
  .dashboard-practice-filter,
  .dashboard-practice-filter summary,
  .dashboard-controls .secondary-button {
    width: 100%;
  }

  .practice-filter-menu {
    left: 0;
    right: auto;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bar-value {
    justify-self: start;
    text-align: left;
  }
}

/* --- v2: role badge, practice status bar, practice column, attachments, unread --- */

.role-badge {
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
}

.practice-col {
  width: 150px;
}

.practice-status-bar {
  align-items: center;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--grid);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.practice-status-info {
  align-items: center;
  display: flex;
  gap: 10px;
}

.practice-status-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
}

.practice-status-pill.status-not-started {
  background: var(--gray);
  color: #20262d;
}

.practice-status-pill.status-open {
  background: var(--green);
  color: #14742c;
}

.practice-status-pill.status-closed {
  background: var(--rose);
  color: #8a1027;
}

.practice-status-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.practice-lifecycle-tile {
  cursor: default;
  gap: 4px;
}

.practice-lifecycle-row {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.practice-lifecycle-row span {
  color: var(--text);
  font-weight: 800;
}

.practice-filter-search {
  margin-bottom: 4px;
  min-height: 32px;
}

.practice-filter-options-list {
  display: grid;
  gap: 2px;
  max-height: 260px;
  overflow: auto;
}

.unread-badge {
  background: var(--blue);
  border-radius: 999px;
  color: #ffffff;
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  margin-left: 6px;
  padding: 2px 7px;
}

.attachment-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.attachment-item {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  font-size: 12px;
  gap: 8px;
  padding: 6px 8px;
}

.attachment-item a {
  color: var(--blue-dark);
  overflow-wrap: anywhere;
}

.detail-pagination-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 8px 0 0;
}

[data-locked="true"] .select-cell,
[data-locked="true"] .editable-note-cell {
  cursor: not-allowed;
  opacity: 0.75;
}

/* --- Admin Portal (requirements.md §3.6, v2.5) ------------------------------ */
.admin-surface { padding: 24px; }
.muted { color: var(--muted); font-size: 0.9rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.link-button {
  background: none; border: none; color: var(--blue); cursor: pointer;
  padding: 0; font: inherit; text-decoration: underline;
}
.admin-tabs { display: flex; gap: 8px; margin: 16px 0; border-bottom: 1px solid var(--border); }
.admin-tab {
  background: none; border: none; padding: 10px 16px; cursor: pointer;
  color: var(--muted); font: inherit; border-bottom: 2px solid transparent;
}
.admin-tab.is-active { color: var(--text); border-bottom-color: var(--blue); font-weight: 600; }
.admin-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.admin-search input {
  width: 100%; max-width: 420px; padding: 8px 12px; border: 1px solid var(--control-border);
  border-radius: 8px; background: var(--control-bg); color: var(--text); margin-bottom: 12px;
}
.admin-hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 12px; }
.admin-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.admin-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft);
}
.admin-row-main { display: flex; align-items: center; gap: 10px; }
.admin-status { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--gray); color: var(--text); }
.admin-status-open { background: var(--green); }
.admin-status-closed { background: var(--rose); }
.admin-status-not_started { background: var(--gray); }
.admin-row-actions { display: flex; gap: 6px; }
.admin-action { padding: 5px 12px; font-size: 0.85rem; }
.admin-managers-layout { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 16px; }
.admin-managers-list .admin-list { max-height: 62vh; }
.admin-manager-item {
  display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); cursor: pointer;
}
.admin-manager-item.is-selected { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.admin-manager-detail {
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: 8px; padding: 16px; min-height: 200px;
}
.admin-manager-detail h4 { margin: 16px 0 6px; }
.admin-access-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.admin-access-list li { display: flex; align-items: center; gap: 10px; }
.admin-tag { font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; background: var(--aqua); color: var(--text); }
.admin-grant-add { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.admin-grant-add select {
  padding: 8px 12px; border: 1px solid var(--control-border); border-radius: 8px;
  background: var(--control-bg); color: var(--text); min-width: 240px;
}
@media (max-width: 720px) { .admin-managers-layout { grid-template-columns: 1fr; } }
