/* Hallmark · base compatibility layer · macrostructure delegated to hsol-workbench.css · design-system: design.md · designed-as-app */
/* Hallmark · genre: modern-minimal clinical operations · tone: HSOL-faithful, dense, predictable · palette: HSOL teal · macrostructure: HSOL 60/210/25 workbench · design-system: design.md · designed-as-app */
/* Hallmark · pre-emit critique: P5 H5 E4 S5 R5 V4 · contrast: pass (40–41) · nav: clinical workbench · footer: n/a · honest: pass (46) · chrome: pass (47) · tokens: pass (48) · responsive: pass (49) · icons: pass (30) · mobile: pass (34, 49, 50–57) */
@import url("./tokens.css");

/*
 * App-wide HSOL alignment layer.
 * Loaded after the legacy stylesheet so the reference system is the final
 * visual authority without deleting clinical or workflow-specific rules.
 */
:root {
  --bg: var(--hsol-canvas);
  --panel: var(--hsol-paper);
  --panel-muted: var(--hsol-canvas-dark);
  --text: var(--hsol-space);
  --muted: var(--hsol-space-medium);
  --subtle: var(--hsol-space-light);
  --border: var(--hsol-table-line);
  --border-strong: var(--hsol-space-pale);
  --primary: var(--hsol-brand);
  --primary-strong: var(--hsol-brand-accessible);
  --primary-soft: var(--hsol-brand-light);
  --shadow: var(--hsol-shadow);
  --shadow-strong: var(--hsol-shadow-strong);
  --radius: var(--hsol-radius);
  --header-height: var(--hsol-header-height);
}

html {
  min-width: 0;
  background: var(--hsol-canvas);
  color: var(--hsol-space);
  font-family: var(--hsol-font-family);
}

body,
button,
input,
select,
textarea,
table,
pre {
  font-family: var(--hsol-font-family);
}

body {
  min-width: 0;
  overflow-x: hidden;
  background: var(--hsol-canvas);
  color: var(--hsol-space);
  font-size: var(--hsol-font-medium);
  font-weight: 400;
  line-height: 1.5;
}

::selection {
  background: var(--hsol-brand-light);
  color: var(--hsol-space-dark);
}

::placeholder {
  color: var(--hsol-space-medium);
  opacity: 1;
}

button,
input,
select,
textarea {
  border-radius: var(--hsol-radius-small);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  border-color: var(--hsol-disabled-border);
  background: var(--hsol-disabled-bg);
  color: var(--hsol-space-medium);
  cursor: not-allowed;
  opacity: 1;
}

:where(
  a[href],
  button,
  input,
  select,
  textarea,
  [tabindex]:not([tabindex="-1"])
):focus-visible {
  outline: 2px solid var(--hsol-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--hsol-paper);
}

.app-topbar
  :where(button, input, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline-color: var(--hsol-space-dark);
  box-shadow: 0 0 0 4px var(--hsol-brand-light);
}

.segmented-control input:focus-visible + span {
  outline: 2px solid var(--hsol-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--hsol-paper);
}

/* HSOL header: 60px brand bar, dense 15px navigation, no decorative chrome. */
.app-topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  display: grid;
  grid-template-columns: var(--hsol-sidebar-width) minmax(420px, 1fr) auto;
  align-items: stretch;
  width: 100%;
  height: var(--hsol-header-height);
  min-height: var(--hsol-header-height);
  border: 0;
  border-bottom: 1px solid var(--hsol-brand-border);
  background: var(--hsol-brand);
  box-shadow: none;
  color: var(--hsol-space-dark);
}

.topbar-brand {
  display: flex;
  min-width: 0;
  height: var(--hsol-header-height);
  align-items: center;
  gap: 9px;
  border: 0;
  border-right: 1px solid var(--hsol-ink-alpha-18);
  padding: 0 15px 0 20px;
  color: var(--hsol-space-dark);
}

.brand-mark {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--hsol-paper);
  color: var(--hsol-brand-accessible);
}

.brand-icon {
  width: 25px;
  height: 25px;
}

.topbar-brand-copy {
  min-width: 0;
  line-height: 1.2;
}

.topbar-brand strong {
  overflow: hidden;
  color: inherit;
  font-size: var(--hsol-font-large);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-current-customer {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--hsol-space);
  font-size: var(--hsol-font-small);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-nav {
  display: flex;
  min-width: 0;
  height: var(--hsol-header-height);
  align-items: stretch;
  gap: 0;
  overflow: visible;
  padding: 0 10px;
}

.topbar-nav > button,
.topbar-exam-button,
.topbar-exam-menu .exam-menu-header {
  display: inline-flex;
  height: var(--hsol-header-height);
  min-height: var(--hsol-header-height);
  align-items: center;
  justify-content: center;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--hsol-space-dark);
  padding: 0 15px;
  font-size: var(--hsol-font-large);
  font-weight: 700;
  line-height: var(--hsol-header-height);
  white-space: nowrap;
}

.topbar-nav > button:hover,
.topbar-nav > button.is-active,
.topbar-nav > button[aria-current="page"],
.topbar-exam-button:hover,
.topbar-exam-button.is-active,
.topbar-exam-menu:not(.is-collapsed) .topbar-exam-button {
  border-color: var(--hsol-space-dark);
  background: var(--hsol-ink-alpha-10);
  color: var(--hsol-space-dark);
}

.topbar-exam-menu {
  height: var(--hsol-header-height);
}

.topbar-exam-button strong {
  color: var(--hsol-space-dark);
  font-size: var(--hsol-font-small);
  font-weight: 700;
}

.topbar-exam-dropdown,
.topbar-exam-menu .nav-list {
  top: calc(var(--hsol-header-height) - 1px);
  border: 1px solid var(--hsol-table-border);
  border-top: 3px solid var(--hsol-space-dark);
  border-radius: 0 0 var(--hsol-radius) var(--hsol-radius);
  background: var(--hsol-paper);
  box-shadow: var(--hsol-shadow);
  padding: 5px 0;
}

.topbar-exam-dropdown .nav-item,
.topbar-exam-menu .nav-item {
  min-height: 32px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  color: var(--hsol-space-medium);
  padding: 4px 14px 4px 11px;
  font-size: var(--hsol-font-medium);
}

.topbar-exam-dropdown .nav-item:hover,
.topbar-exam-dropdown .nav-item.is-active,
.topbar-exam-menu .nav-item:hover,
.topbar-exam-menu .nav-item.is-active {
  border-left-color: var(--hsol-brand);
  background: var(--hsol-canvas-light);
  color: var(--hsol-brand-accessible);
}

.topbar-session {
  display: flex;
  height: var(--hsol-header-height);
  align-items: stretch;
  gap: 0;
  padding: 0;
}

.topbar-overview-toggle,
.topbar-new-customer,
.topbar-account,
.customer-search-toggle {
  height: var(--hsol-header-height);
  min-height: var(--hsol-header-height);
  border: 0;
  border-left: 1px solid var(--hsol-ink-alpha-16);
  border-radius: 0;
  background: transparent;
  color: var(--hsol-space-dark);
  font-size: var(--hsol-font-medium);
  font-weight: 700;
}

.topbar-overview-toggle:hover,
.topbar-new-customer:hover,
.topbar-account:hover,
.topbar-account[aria-expanded="true"],
.customer-search-toggle:hover,
.customer-search.is-open .customer-search-toggle {
  background: var(--hsol-ink-alpha-10);
  color: var(--hsol-space-dark);
}

.topbar-overview-toggle[aria-pressed="true"] {
  background: var(--hsol-paper);
  color: var(--hsol-brand-accessible);
}

.topbar-account {
  display: flex;
  min-width: 104px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 14px;
  line-height: 1.25;
}

.topbar-account span {
  color: var(--hsol-space);
  font-size: var(--hsol-font-small);
  font-weight: 700;
}

.topbar-account strong {
  color: var(--hsol-space-dark);
  font-size: var(--hsol-font-medium);
}

.account-menu,
.customer-search-panel {
  top: calc(var(--hsol-header-height) - 1px);
  border: 1px solid var(--hsol-table-border);
  border-top: 3px solid var(--hsol-space-dark);
  border-radius: 0 0 var(--hsol-radius) var(--hsol-radius);
  background: var(--hsol-paper);
  box-shadow: var(--hsol-shadow);
}

.account-menu {
  padding: 5px 0;
}

.account-menu [role="menuitem"] {
  min-height: 32px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  color: var(--hsol-space);
  padding: 5px 14px 5px 11px;
  font-size: var(--hsol-font-medium);
  text-align: left;
}

.account-menu [role="menuitem"]:hover,
.account-menu [role="menuitem"]:focus-visible {
  border-left-color: var(--hsol-brand);
  background: var(--hsol-canvas-light);
  color: var(--hsol-brand-accessible);
}

.customer-search-panel {
  padding: 10px;
}

.customer-search-panel .customer-search-input {
  height: var(--hsol-control-height);
  border: 1px solid var(--hsol-disabled-border);
  border-radius: var(--hsol-radius-small);
  background: var(--hsol-paper);
  color: var(--hsol-space);
  padding: 5px 10px;
  font-size: var(--hsol-font-medium);
}

/* HSOL admin macrostructure. */
.app-shell,
.app-shell.is-sidebar-collapsed {
  display: grid;
  grid-template-columns: var(--hsol-sidebar-width) minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  padding-top: var(--hsol-header-height);
  background: var(--hsol-canvas);
}

.app-shell.is-sidebar-collapsed {
  grid-template-columns: 44px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: var(--hsol-header-height);
  z-index: 30;
  display: block;
  width: auto;
  min-width: 0;
  height: calc(100vh - var(--hsol-header-height));
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--hsol-table-line);
  border-radius: 0;
  background: var(--hsol-paper);
  box-shadow: none;
  padding: 0;
}

.sidebar-body {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  scrollbar-gutter: stable;
}

.customer-panel {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: var(--hsol-paper);
  box-shadow: none;
}

.customer-card-header {
  min-height: 68px;
  border: 0;
  border-bottom: 1px solid var(--hsol-table-line);
  background: var(--hsol-paper);
  padding: 10px 10px 10px 14px;
}

.customer-avatar {
  border-radius: 3px;
}

.customer-title > span {
  color: var(--hsol-space-light);
  font-size: var(--hsol-font-small);
  font-weight: 700;
}

.patient-name-row {
  margin-top: 2px;
}

.patient-name-text {
  color: var(--hsol-space);
  font-size: var(--hsol-font-large);
  font-weight: 700;
}

.sidebar-toggle,
.sidebar-panel-toggle {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid var(--hsol-space-pale);
  border-radius: var(--hsol-radius-small);
  background: var(--hsol-paper);
  color: var(--hsol-space-medium);
}

.sidebar-toggle:hover,
.sidebar-panel-toggle:hover {
  border-color: var(--hsol-space);
  background: var(--hsol-space);
  color: var(--hsol-paper);
}

.customer-info-list {
  margin: 0;
  padding: 10px 14px;
}

.customer-info-list li {
  min-height: 24px;
  border: 0;
  padding: 3px 0;
  color: var(--hsol-space);
  font-size: var(--hsol-font-medium);
  line-height: 18px;
}

.customer-info-list strong {
  color: var(--hsol-space-medium);
  font-size: var(--hsol-font-small);
  font-weight: 700;
}

.customer-label-wrap {
  gap: 4px;
  margin: 0;
  padding: 0 14px 10px;
}

.customer-label {
  border: 0;
  border-radius: var(--hsol-radius-small);
  background: var(--hsol-canvas-dark);
  color: var(--hsol-space);
  padding: 3px 5px;
  font-size: var(--hsol-font-small);
}

.customer-section-title {
  min-height: 30px;
  border: 0;
  background: var(--hsol-table-head);
  color: var(--hsol-space);
  padding: 0 14px;
  font-size: var(--hsol-font-small);
  font-weight: 700;
  line-height: 30px;
  text-transform: uppercase;
}

.customer-section-title strong {
  color: var(--hsol-brand-accessible);
}

.condition-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  padding: 10px 14px 14px;
}

.field {
  display: flex;
  min-width: 0;
  min-height: 0;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.field span,
.field legend,
.form-field label,
.form-field > span {
  color: var(--hsol-space-medium);
  font-size: var(--hsol-font-small);
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.form-field input,
.form-field select,
.form-field textarea,
.inline-input,
.table-input,
.score-input,
.remarks-block textarea,
.customer-create-form input,
.customer-create-form select,
.customer-create-form textarea {
  width: 100%;
  min-width: 0;
  min-height: var(--hsol-control-height);
  border: 1px solid var(--hsol-disabled-border);
  border-radius: var(--hsol-radius-small);
  background: var(--hsol-paper);
  color: var(--hsol-space);
  padding: 5px 8px;
  font-size: var(--hsol-font-medium);
  line-height: 1.25;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.inline-input:focus,
.table-input:focus,
.score-input:focus,
.remarks-block textarea:focus {
  border-color: var(--hsol-brand-accessible);
  box-shadow: none;
}

.segmented-control {
  display: grid;
  min-height: var(--hsol-control-height);
  gap: 0;
  overflow: visible;
  border: 1px solid var(--hsol-disabled-border);
  border-radius: var(--hsol-radius-small);
  background: var(--hsol-paper);
  padding: 0;
}

.segmented-control span {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--hsol-table-line);
  border-radius: 0;
  background: var(--hsol-paper);
  color: var(--hsol-space-medium);
  font-size: var(--hsol-font-small);
  font-weight: 500;
}

.segmented-control label:last-child span {
  border-right: 0;
}

.segmented-control input:checked + span {
  background: var(--hsol-brand-light);
  color: var(--hsol-brand-accessible);
  box-shadow: none;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  background: var(--hsol-canvas);
  padding: 0;
}

.dashboard-grid,
.app-shell.is-sidebar-collapsed .dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  width: 100%;
  min-width: 0;
  padding: var(--hsol-content-padding);
}

.module-surface {
  min-width: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.module-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 58px;
  align-items: start;
  gap: 20px;
  border: 0;
  background: transparent;
  padding: 0 0 20px;
}

.module-header::before {
  content: none;
}

.module-header > div:first-child {
  min-width: 0;
}

.module-kicker:empty,
.module-header p:empty {
  display: none;
}

.module-header h1 {
  margin: 0;
  color: var(--hsol-space-dark);
  font-size: 20px;
  font-weight: 500;
  line-height: 38px;
}

.module-header p {
  max-width: 760px;
  margin: 2px 0 0;
  color: var(--hsol-space-medium);
  font-size: var(--hsol-font-medium);
  line-height: 1.5;
}

.module-actions {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

#moduleBody {
  min-width: 0;
  padding: 0;
}

.primary-button,
.secondary-button,
.ghost-button,
.mini-button,
.icon-button {
  min-height: var(--hsol-control-height);
  border-radius: var(--hsol-radius-small);
  padding: 5px 10px;
  font-size: var(--hsol-font-medium);
  font-weight: 500;
  line-height: 1.25;
}

.primary-button {
  border: 1px solid var(--hsol-brand-accessible);
  background: var(--hsol-brand-accessible);
  color: var(--hsol-paper);
}

.primary-button:hover {
  border-color: var(--hsol-space);
  background: var(--hsol-space);
  color: var(--hsol-paper);
}

.secondary-button {
  border: 2px solid var(--hsol-space);
  background: var(--hsol-paper);
  color: var(--hsol-space);
}

.secondary-button:hover {
  border-color: var(--hsol-space);
  background: var(--hsol-space);
  color: var(--hsol-paper);
}

.ghost-button,
.mini-button {
  border: 1px solid var(--hsol-space-pale);
  background: var(--hsol-paper);
  color: var(--hsol-space);
}

.ghost-button:hover,
.mini-button:hover {
  border-color: var(--hsol-space);
  background: var(--hsol-canvas-light);
  color: var(--hsol-space-dark);
}

.section-band {
  overflow: hidden;
  margin: 0 0 20px;
  border: 1px solid var(--hsol-table-border);
  border-radius: var(--hsol-radius);
  background: var(--hsol-paper);
  box-shadow: none;
}

.section-band:last-child {
  margin-bottom: 0;
}

.section-title {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--hsol-table-head-line);
  background: var(--hsol-table-head);
  padding: 7px 10px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  color: var(--hsol-space-dark);
  font-size: var(--hsol-font-large);
  font-weight: 700;
  line-height: 24px;
}

.section-title p {
  margin: 1px 0 0;
  color: var(--hsol-space-medium);
  font-size: var(--hsol-font-small);
  line-height: 1.4;
}

.section-content {
  min-width: 0;
  background: var(--hsol-paper);
  padding: 15px;
}

.protocol-panel {
  margin: 0 0 10px;
  border: 1px solid var(--hsol-table-border);
  border-radius: var(--hsol-radius);
  background: var(--hsol-canvas-light);
  padding: 10px;
}

.summary-strip {
  overflow: hidden;
  gap: 0;
  margin: 0 0 10px;
  border: 1px solid var(--hsol-table-border);
  border-radius: var(--hsol-radius);
  background: var(--hsol-paper);
}

.summary-item {
  border: 0;
  border-right: 1px solid var(--hsol-table-line);
  border-radius: 0;
  background: var(--hsol-paper);
  padding: 8px 10px;
}

.summary-item:last-child {
  border-right: 0;
}

.summary-item span,
.summary-item small {
  color: var(--hsol-space-medium);
  font-size: var(--hsol-font-small);
}

.summary-item strong {
  margin-top: 2px;
  color: var(--hsol-space-dark);
  font-size: var(--hsol-font-xl);
  font-weight: 700;
}

/* Exact HSOL list-table grammar from _table.scss. */
.table-wrap,
.admin-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  border: 0;
  border-radius: var(--hsol-radius);
  background: transparent;
}

.data-table,
.admin-table {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--hsol-table-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--hsol-radius);
  background: var(--hsol-paper);
  color: var(--hsol-space);
  font-size: var(--hsol-font-medium);
}

.data-table thead th,
.admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  border: 0;
  border-right: 1px solid var(--hsol-table-line);
  border-bottom: 2px solid var(--hsol-table-line);
  background: var(--hsol-table-head);
  color: var(--hsol-space-dark);
  padding: 7px 8px 9px;
  font-size: var(--hsol-font-small);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.data-table thead th:first-child,
.admin-table thead th:first-child {
  border-top-left-radius: 3px;
}

.data-table thead th:last-child,
.admin-table thead th:last-child {
  border-right: 0;
  border-top-right-radius: 3px;
}

.data-table tbody td,
.admin-table tbody td {
  border: 0;
  border-right: 1px solid var(--hsol-table-line);
  border-bottom: 1px solid var(--hsol-table-line);
  background: var(--hsol-paper);
  color: var(--hsol-space);
  padding: 7px 8px 9px;
  font-size: var(--hsol-font-medium);
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td,
.admin-table tbody tr:nth-child(even) td {
  background: var(--hsol-table-even);
}

.data-table tbody tr:hover td,
.admin-table tbody tr:hover td {
  background: var(--hsol-table-active);
}

.data-table tbody tr:last-child td,
.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody td:last-child,
.admin-table tbody td:last-child {
  border-right: 0;
}

.data-table .table-input,
.data-table .score-input,
.admin-table input,
.admin-table select {
  min-height: 30px;
  border: 1px solid var(--hsol-disabled-border);
  border-radius: var(--hsol-radius-small);
  padding: 4px 6px;
  font-size: var(--hsol-font-small);
}

.data-table .number-cell {
  color: var(--hsol-space-medium);
  font-size: var(--hsol-font-small);
  font-weight: 700;
  text-align: center;
}

.word-token {
  color: var(--hsol-space-dark);
  font-size: var(--hsol-font-large);
  font-weight: 700;
}

.question-list {
  overflow: hidden;
  border: 1px solid var(--hsol-table-border);
  border-radius: var(--hsol-radius);
  background: var(--hsol-paper);
}

.question-row {
  border-bottom: 1px solid var(--hsol-table-line);
  background: var(--hsol-paper);
  padding: 8px 10px;
}

.question-row:nth-child(even) {
  background: var(--hsol-table-even);
}

/* HSOL tabline: flat text tabs with a 3px active rule. */
.tabs-row,
.customer-view-tabs,
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 15px;
  border-bottom: 1px solid var(--hsol-table-line);
  background: var(--hsol-paper);
  padding: 0 2px;
}

.tab-button,
.customer-view-tab,
.admin-tab {
  min-height: 48px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--hsol-space);
  padding: 15px 20px 12px;
  font-size: var(--hsol-font-medium);
  font-weight: 500;
  line-height: 1;
}

.tab-button:hover,
.customer-view-tab:hover,
.admin-tab:hover {
  border-bottom-color: var(--hsol-space);
  background: transparent;
  color: var(--hsol-space-dark);
}

.tab-button.is-active,
.tab-button[aria-selected="true"],
.customer-view-tab.is-active,
.customer-view-tab[aria-selected="true"],
.admin-tab.is-active,
.admin-tab[aria-selected="true"] {
  border-color: var(--hsol-brand-accessible);
  background: transparent;
  color: var(--hsol-brand-accessible);
  font-weight: 700;
}

.insight-surface {
  position: sticky;
  top: calc(var(--hsol-header-height) + var(--hsol-content-padding));
  display: flex;
  align-self: start;
  height: auto;
  min-height: calc(100vh - var(--hsol-header-height) - 50px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--hsol-table-border);
  border-radius: var(--hsol-radius);
  background: var(--hsol-paper);
  box-shadow: var(--hsol-shadow);
}

.insight-surface > div {
  border: 0;
  border-bottom: 1px solid var(--hsol-table-line);
  border-radius: 0;
  background: var(--hsol-paper);
  box-shadow: none;
}

.insight-surface > div:last-child {
  flex: 1 1 auto;
  border-bottom: 0;
}

.insight-heading {
  min-height: 54px;
  border-color: var(--hsol-table-head-line);
  background: var(--hsol-table-head);
  padding: 9px 12px;
}

.insight-heading .eyebrow {
  color: var(--hsol-space-medium);
  font-size: var(--hsol-font-small);
  font-weight: 700;
  text-transform: none;
}

.insight-heading strong {
  margin-top: 2px;
  color: var(--hsol-space-dark);
  font-size: var(--hsol-font-large);
  font-weight: 700;
}

.score-block,
.progress-block,
.chart-block,
.remarks-block {
  padding: 12px;
}

.score-block {
  background: var(--hsol-canvas-light);
}

.score-value strong {
  color: var(--hsol-space-dark);
  font-size: var(--hsol-font-xxl);
  font-weight: 700;
}

.score-value span {
  border-radius: var(--hsol-radius-small);
  background: var(--hsol-brand-light);
  color: var(--hsol-brand-accessible);
}

.state-badge,
.session-badge {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.block-title span,
.score-block p,
.remark-list,
.chart-caption {
  color: var(--hsol-space-medium);
}

.chart-shell,
.mini-chart,
.remarks-block textarea {
  border-color: var(--hsol-table-border);
  border-radius: var(--hsol-radius);
  background: var(--hsol-paper);
}

.oneflow-modal {
  overflow: hidden;
  border: 1px solid var(--hsol-table-border);
  border-radius: var(--hsol-radius);
  background: var(--hsol-paper);
  box-shadow: var(--hsol-shadow-modal);
}

.oneflow-modal-header {
  min-height: 60px;
  border-bottom: 1px solid var(--hsol-table-line);
  background: var(--hsol-table-head);
  padding: 0 20px;
}

.oneflow-modal-header .oneflow-title {
  color: var(--hsol-space-dark);
  font-size: 20px;
  font-weight: 500;
  line-height: 38px;
}

.oneflow-modal-header .oneflow-title::before {
  content: none;
}

.oneflow-modal-body,
.oneflow-modal-footer {
  padding: 20px;
}

.oneflow-modal-footer {
  border-top: 1px solid var(--hsol-table-line);
  background: var(--hsol-canvas-light);
}

.auth-root {
  background: var(--hsol-canvas-dark);
}

.auth-stage,
.auth-panel {
  border-radius: var(--hsol-radius);
}

.auth-panel,
.auth-panel-inner {
  background: var(--hsol-paper);
}

.auth-heading h1 {
  color: var(--hsol-space-dark);
  font-size: 20px;
  font-weight: 500;
  line-height: 38px;
}

.auth-form label > span {
  color: var(--hsol-space);
  font-size: var(--hsol-font-small);
  font-weight: 700;
}

.auth-form input {
  height: var(--hsol-control-height);
  border: 1px solid var(--hsol-disabled-border);
  border-radius: var(--hsol-radius-small);
  color: var(--hsol-space);
  padding: 5px 10px;
  font-size: var(--hsol-font-medium);
}

.toast {
  border: 1px solid var(--hsol-space);
  border-radius: var(--hsol-radius-small);
  background: var(--hsol-space);
  color: var(--hsol-paper);
  box-shadow: var(--hsol-shadow);
}

@media (max-width: 1180px) {
  .app-topbar {
    grid-template-columns: 180px minmax(360px, 1fr) auto;
  }

  .topbar-brand {
    padding-right: 10px;
    padding-left: 12px;
  }

  .topbar-nav {
    padding: 0;
  }

  .topbar-nav > button,
  .topbar-exam-button,
  .topbar-exam-menu .exam-menu-header {
    padding-right: 10px;
    padding-left: 10px;
    font-size: var(--hsol-font-medium);
  }

  .topbar-new-customer,
  .topbar-overview-toggle {
    padding-right: 10px;
    padding-left: 10px;
  }

  .dashboard-grid,
  .app-shell.is-sidebar-collapsed .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 15px;
    padding: 20px;
  }
}

@media (max-width: 860px) {
  .app-topbar {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
  }

  .topbar-brand {
    flex: 0 0 170px;
  }

  .topbar-nav,
  .topbar-session {
    flex: 0 0 auto;
  }

  .app-shell,
  .app-shell.is-sidebar-collapsed {
    display: block;
    min-height: 100vh;
    padding-top: var(--hsol-header-height);
  }

  .sidebar,
  .app-shell.is-sidebar-collapsed .sidebar {
    position: relative;
    top: auto;
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--hsol-table-line);
  }

  .sidebar-body {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .app-shell.is-sidebar-collapsed .sidebar-body,
  .app-shell.is-sidebar-collapsed .customer-panel {
    display: block;
  }

  .app-shell.is-sidebar-collapsed .customer-panel > :not(.customer-card-header) {
    display: none;
  }

  .customer-card-header {
    min-height: 60px;
  }

  .condition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .app-shell.is-sidebar-collapsed .dashboard-grid {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }

  .module-surface {
    order: 1;
  }

  .insight-surface {
    position: static;
    order: 2;
    width: 100%;
    min-height: 0;
    height: auto;
  }

  .module-header {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-bottom: 15px;
  }

  .form-grid,
  .form-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-wrap,
  .admin-table-wrap {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  .topbar-brand {
    flex-basis: 150px;
    padding-left: 10px;
  }

  .topbar-brand-copy strong {
    font-size: var(--hsol-font-medium);
  }

  .topbar-nav > button,
  .topbar-exam-button,
  .topbar-exam-menu .exam-menu-header {
    min-width: 76px;
    padding-right: 8px;
    padding-left: 8px;
    font-size: var(--hsol-font-medium);
  }

  .dashboard-grid,
  .app-shell.is-sidebar-collapsed .dashboard-grid {
    gap: 10px;
    padding: 10px;
  }

  .module-header {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 8px;
    padding: 0 0 10px;
  }

  .module-header h1 {
    font-size: 18px;
    line-height: 32px;
  }

  .module-actions {
    width: 100%;
    min-height: 0;
    justify-content: flex-start;
  }

  .module-actions > button {
    flex: 1 1 auto;
  }

  .section-band {
    margin-bottom: 10px;
  }

  .section-title {
    align-items: flex-start;
    padding: 7px 8px;
  }

  .section-content {
    padding: 10px;
  }

  .form-grid,
  .form-grid.two-col {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-item:nth-child(2n) {
    border-right: 0;
  }

  .question-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .question-row > :last-child {
    grid-column: 1 / -1;
  }

  .tabs-row,
  .customer-view-tabs,
  .admin-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .tab-button,
  .customer-view-tab,
  .admin-tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 13px 14px 10px;
  }

  .oneflow-modal {
    width: calc(100% - 20px);
    max-height: calc(100vh - 20px);
  }

  .oneflow-modal-header {
    min-height: 52px;
    padding: 0 12px;
  }

  .oneflow-modal-body,
  .oneflow-modal-footer {
    padding: 12px;
  }
}

@media (max-width: 380px) {
  .condition-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-info-list,
  .customer-label-wrap,
  .condition-grid {
    padding-right: 10px;
    padding-left: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
}

/*
 * Legacy-cascade integration
 * The original app contains later high-specificity desktop and two-row header
 * patches. These declarations pin the final HSOL macrostructure explicitly.
 */
body {
  padding-top: var(--hsol-header-height);
}

.app-topbar {
  grid-template-columns: var(--hsol-sidebar-width) minmax(420px, 1fr) auto;
  grid-template-rows: var(--hsol-header-height);
}

.topbar-brand {
  grid-column: 1;
  grid-row: 1;
}

.topbar-nav {
  grid-column: 2;
  grid-row: 1;
  border-top: 0;
  background: transparent;
}

.topbar-session {
  grid-column: 3;
  grid-row: 1;
}

.app-shell,
.app-shell.is-sidebar-collapsed {
  padding-top: 0;
}

body:not(.is-overview-mode) .app-shell,
body:not(.is-overview-mode) .app-shell:not(.is-sidebar-collapsed) {
  grid-template-columns: var(--hsol-sidebar-width) minmax(0, 1fr);
}

body:not(.is-overview-mode) .dashboard-grid {
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  padding: var(--hsol-content-padding);
}

body:not(.is-overview-mode) .insight-surface {
  top: calc(var(--hsol-header-height) + var(--hsol-content-padding));
}

@media (max-width: 860px) {
  .app-shell,
  .app-shell.is-sidebar-collapsed {
    padding-top: 0;
  }
}

body:not(.is-overview-mode) .insight-surface {
  border: 1px solid var(--hsol-table-border);
  border-radius: var(--hsol-radius);
}

@media (max-width: 860px) {
  body:not(.is-overview-mode) .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 15px;
    padding: 15px;
  }

  body:not(.is-overview-mode) .insight-surface {
    top: auto;
  }
}

@media (max-width: 640px) {
  body:not(.is-overview-mode) .dashboard-grid {
    gap: 10px;
    padding: 10px;
  }
}

.topbar-current-customer,
.topbar-account span {
  color: var(--hsol-space-dark);
}

/* Keep the HSOL avatar treatment self-contained and available offline. */
.hsol-customer-avatar.icon-male,
.hsol-customer-avatar.icon-female,
.hsol-customer-avatar.icon-unknown {
  background-color: var(--hsol-canvas-dark);
  background-image: url("./assets/hsol-circle-mark.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 72%;
}

.topbar-new-customer {
  background: var(--hsol-brand-action-soft);
  color: var(--hsol-brand-action-ink);
}

.topbar-new-customer:hover {
  background: var(--hsol-paper);
  color: var(--hsol-brand-accessible);
}

@media (min-width: 861px) {
  body:not(.is-overview-mode) .topbar-brand {
    width: var(--hsol-sidebar-width);
    min-width: var(--hsol-sidebar-width);
    max-width: var(--hsol-sidebar-width);
    overflow: hidden;
  }
}

body:not(.is-overview-mode) .wrs-table {
  width: 662px;
  min-width: 662px;
  max-width: 662px;
}

.sidebar-toggle,
.sidebar-panel-toggle {
  width: 36px;
  height: 36px;
  min-height: 36px;
}

body.is-overview-mode .app-shell {
  min-height: calc(100vh - var(--hsol-header-height));
}

@media (min-width: 861px) {
  body.is-overview-mode .dashboard-grid,
  body.is-overview-mode .app-shell.is-sidebar-collapsed .dashboard-grid {
    padding: 0 10px;
  }
}

body.is-overview-mode .wrs-table {
  margin-top: 0;
}

body.is-overview-mode #moduleBody {
  padding-top: 0;
  padding-bottom: 0;
}

body.is-overview-mode .module-actions > button {
  height: 32px;
  min-height: 32px;
  padding: 3px 8px;
}

body.is-overview-mode .section-title,
body.is-overview-mode .section-content {
  padding-top: 0;
  padding-bottom: 0;
}

body.is-overview-mode .module-actions > button {
  height: 28px;
  min-height: 28px;
  padding: 2px 6px;
}

body.is-overview-mode .module-header {
  min-height: 28px;
}

body.is-overview-mode {
  overflow: hidden;
}

body.is-overview-mode .app-shell {
  height: calc(100vh - var(--hsol-header-height));
  max-height: calc(100vh - var(--hsol-header-height));
  overflow: hidden;
}

body.is-overview-mode .workspace,
body.is-overview-mode .dashboard-grid {
  height: 100%;
  max-height: 100%;
}

body.is-overview-mode .module-surface,
body.is-overview-mode .insight-surface {
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body:not(.is-overview-mode) .dashboard-grid {
  grid-template-columns: minmax(0, 1fr) 300px;
}

html,
body {
  overflow-x: clip;
}

button:active:not(:disabled) {
  filter: brightness(0.92);
}

button:disabled:active {
  filter: none;
}

@media (max-width: 860px) {
  body:not(.is-overview-mode) .dashboard-grid {
    padding: 15px !important;
  }
}

@media (max-width: 640px) {
  body:not(.is-overview-mode) .dashboard-grid {
    padding: 10px !important;
  }
}
