:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #eef3f7;
  --line: #d8e0e8;
  --text: #1f2a37;
  --muted: #5e6b78;
  --primary: #0e7490;
  --primary-dark: #155e75;
  --danger: #b42318;
  --warning: #b54708;
  --success: #027a48;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --radius-small: 10px;
  --font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fbfd 0%, #edf2f7 100%);
  color: var(--text);
  font-family: var(--font);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #102a43;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 12px 24px rgba(16, 42, 67, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: absolute;
  left: 24px;
  text-decoration: none;
}

.topbar-logo-image {
  display: block;
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.topbar-menu {
  display: flex;
  width: auto;
  max-width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: visible;
}

.topbar-menu-button {
  border: none;
  background: transparent;
  color: #d5e2ec;
  padding: 8px 12px;
  border-radius: 12px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  flex: 0 0 auto;
  font-size: 0.92rem;
  font-weight: 600;
}

.topbar-menu-button:hover,
.topbar-menu-button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.topbar-session {
  position: absolute;
  right: 24px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.topbar-user-copy {
  margin: 0;
  color: #dbe7ef;
  font-size: 0.9rem;
  font-weight: 600;
}

.topbar-power-button {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.topbar-power-button:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.topbar-power-button svg {
  width: 20px;
  height: 20px;
}

.topbar-company-portal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  justify-content: stretch;
  gap: 20px;
}

.topbar-company-portal .topbar-logo-link,
.topbar-company-portal .topbar-session {
  position: static;
}

.topbar-company-portal .topbar-menu {
  justify-content: center;
  gap: 10px;
}

.topbar-company-portal .topbar-session {
  gap: 14px;
  padding-left: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.topbar-company-portal .topbar-user-copy {
  white-space: nowrap;
}

.topbar-menu-dropdown {
  position: relative;
  flex: 0 0 auto;
}

.searchable-select {
  position: relative;
  cursor: text;
}

.searchable-select-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.searchable-select-input {
  min-width: 0;
  flex: 1;
  cursor: text;
  caret-color: #102a43;
}

.searchable-select-input:focus {
  border-color: #2f80ed;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.2);
  outline: none;
}

.searchable-select-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.searchable-select-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #102a43;
  padding: 9px 10px;
  text-align: left;
}

.searchable-select-option:hover,
.searchable-select-option.is-highlighted {
  background: #e6f0f7;
}

.searchable-select-empty {
  margin-top: 6px;
  color: #64748b;
  font-size: 0.88rem;
}

.portal-studies-list {
  display: grid;
  gap: 12px;
}

.portal-study-card {
  padding: 16px;
}

.portal-study-card > p {
  margin: 7px 0;
}

.portal-study-files-title {
  margin: 16px 0 8px;
  color: #334e68;
  font-size: 0.9rem;
  font-weight: 700;
}

.portal-study-file-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid #e2e8f0;
}

.portal-study-file-name {
  overflow-wrap: anywhere;
}

.topbar-menu-dropdown > summary {
  list-style: none;
  cursor: pointer;
}

.topbar-menu-dropdown > summary::-webkit-details-marker {
  display: none;
}

.topbar-menu-dropdown > summary::after {
  content: '▾';
  margin-left: 6px;
  font-size: 0.75em;
}

.topbar-menu-dropdown > summary::after {
  content: '\25be';
  font-size: 1.28em;
  line-height: 0;
  vertical-align: -0.08em;
}

.topbar-menu-dropdown[open] > summary::after {
  content: '\25b4';
}

.topbar-menu-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  min-width: 220px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: #173b5b;
  box-shadow: 0 12px 24px rgba(16, 42, 67, 0.22);
}

.topbar-menu-dropdown-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  background: transparent;
  color: #d5e2ec;
  text-align: left;
  white-space: nowrap;
  font: inherit;
  font-weight: 600;
}

.topbar-menu-dropdown-item:hover,
.topbar-menu-dropdown-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.main-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.home-placeholder-panel {
  width: min(720px, 100%);
  margin: 24px auto 0;
  padding: 40px 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.home-placeholder-panel h2 {
  margin: 0 0 14px;
  font-size: 1.8rem;
}

.home-placeholder-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.home-placeholder-panel p + p {
  margin-top: 8px;
}

.home-cover {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: calc(100vh - 75px);
  background-color: #261A43;
  border: 0;
  outline: 0;
  box-shadow: none;
}

.home-cover-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 320px;
  height: 320px;
  max-width: 88vw;
  max-height: 70vh;
  transform: translate(-50%, -50%);
  object-fit: contain;
  clip-path: inset(0 2px 0 0);
}

.main-content:has(.home-cover) {
  padding: 0;
}

.home-cover-overlay {
  position: relative;
  z-index: 2;
  min-height: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #ffffff;
  text-align: center;
}

.home-cover-content h2,
.home-cover-content p {
  margin: 0;
}

.home-cover-content {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.68);
}

.home-cover-content h2 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.home-cover-content p {
  margin-top: 12px;
  font-size: clamp(1.1rem, 2.4vw, 1.8rem);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.page-header h2 {
  margin: 0;
  font-size: 1.6rem;
}

.page-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.attention-page-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.attention-worklist-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.attention-worklist-toolbar {
  margin-bottom: 18px;
}

.attention-worklist-heading-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attention-worklist-toolbar h3 {
  margin: 0;
}

.attention-queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.attention-queue-counter {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.9rem;
  font-weight: 700;
}

.attention-worklist-search-form {
  flex: 0 1 360px;
}

.attention-worklist-search-field {
  min-width: 220px;
}

.practice-page-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.study-page-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.attention-create-trigger {
  white-space: nowrap;
}

#attentions-table th:last-child,
#attentions-table th:nth-last-child(2),
#attentions-table td:last-child,
#attentions-table td:nth-last-child(2) {
  white-space: nowrap;
}

.summary-card .compact-list > div {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.2rem 0;
}

.summary-card .compact-list > div > strong::after {
  content: ':';
}

.reception-circuit-status-pending {
  color: var(--danger) !important;
  font-weight: 700;
}

.reception-circuit-status-completed {
  color: var(--success) !important;
  font-weight: 700;
}

.summary-card .compact-list + p {
  margin-top: 1rem;
}

.reception-circuit-missing-items {
  color: var(--danger);
  font-weight: 700;
}

.reception-circuit-closure-pending {
  color: var(--danger);
  font-weight: 700;
}

.study-create-trigger {
  white-space: nowrap;
}

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

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

.practice-form-header-right {
  justify-content: flex-end;
}

.study-flow-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.attention-create-header h3 {
  margin: 0;
}

.practice-form-header h3 {
  margin: 0;
}

.study-flow-header h3 {
  margin: 0;
}

#create-practice-form input[name="basePrice"],
#update-practice-form input[name="basePrice"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

#create-practice-form input[name="basePrice"]::-webkit-outer-spin-button,
#create-practice-form input[name="basePrice"]::-webkit-inner-spin-button,
#update-practice-form input[name="basePrice"]::-webkit-outer-spin-button,
#update-practice-form input[name="basePrice"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#patients-page-stack {
  margin-top: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.panel p.panel-help {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.panel-spacious {
  padding: 22px;
}

.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.section-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  padding: 16px;
}

.section-block h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.section-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.section-block + .section-block {
  margin-top: 14px;
}

.hero-search {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-search input {
  width: 100%;
  font-size: 1.05rem;
  padding: 14px 16px;
  border-radius: 14px;
}

.clinical-history-detail-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.clinical-history-date-search {
  width: clamp(220px, 24vw, 280px);
}

.clinical-history-back-action {
  margin-left: auto;
}

.create-company-access-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1.5fr) minmax(180px, 1.5fr);
  gap: 12px;
  align-items: end;
}

.create-company-access-username {
  margin: 0 0 10px;
}

@media (max-width: 760px) {
  .create-company-access-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .create-company-access-username {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .create-company-access-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .clinical-history-detail-toolbar {
    flex-wrap: wrap;
  }

  .clinical-history-back-action {
    margin-left: 0;
  }
}

.table-scroll {
  overflow-x: auto;
}

.billing-totals {
  margin-left: auto;
  margin-top: 1rem;
  max-width: 24rem;
}

.billing-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
}

.billing-totals .billing-total {
  border-top: 1px solid var(--border-color, #d7dce5);
  font-size: 1.05rem;
  margin-top: 0.35rem;
  padding-top: 0.7rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #ffffff;
}

.summary-card h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.summary-card p {
  margin: 0;
  color: var(--muted);
}

.summary-card p + p {
  margin-top: 6px;
}

.doctor-worklist {
  display: grid;
  gap: 10px;
}

.doctor-worklist-card {
  border: 1px solid var(--line);
  border-left-width: 8px;
  border-radius: 18px;
  background: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.doctor-worklist-card-recent {
  border-left-color: var(--success);
  background: #edfdf3;
}

.doctor-worklist-card-warning {
  border-left-color: #f2b533;
  background: #fff8e7;
}

.doctor-worklist-card-critical {
  border-left-color: var(--danger);
  background: #fef0f0;
}

.doctor-worklist-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.doctor-worklist-card-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.doctor-worklist-card-copy h4 {
  margin: 0;
  font-size: 0.98rem;
}

.doctor-worklist-card-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.doctor-worklist-card-name {
  font-weight: 800;
}

.doctor-worklist-card-separator {
  color: var(--muted);
}

.doctor-worklist-card-status {
  flex: 0 0 auto;
}

.doctor-worklist-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 0;
}

.doctor-worklist-waiting {
  margin: 0;
  display: block;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.92rem;
}

.attention-selected-patient-card {
  padding: 12px 14px;
}

.attention-selected-patient-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.attention-selected-patient-copy {
  min-width: 0;
}

.attention-selected-patient-header p {
  flex: 1 1 auto;
  min-width: 0;
}

.attention-create-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.attention-create-details-shell {
  min-width: 0;
}

.attention-create-details-shell .field-group label {
  font-weight: 700;
  color: var(--text);
}

.attention-create-details-column {
  display: grid;
  gap: 12px;
}

.attention-create-detail-fields {
  display: grid;
  gap: 12px;
}

.attention-selected-patient-card p {
  color: var(--text);
}

.attention-selected-patient-actions {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  flex: 0 0 auto;
}

.attention-create-detail-fields .attention-compact-textarea {
  min-height: 72px;
}

.attention-practice-list-title {
  margin: 14px 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.attention-practice-entry-list {
  display: grid;
  gap: 10px;
}

.attention-practice-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.attention-practice-entry-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.attention-practice-entry-copy span {
  color: var(--muted);
}

#doctor-practice-results .doctor-practice-result .attention-practice-entry-copy {
  display: block;
}

#doctor-practice-results .attention-practice-entry {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-color: #8f9ba8;
}

#doctor-practice-results .attention-practice-entry-copy {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#doctor-practice-results .doctor-practice-result-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

#doctor-practice-results .doctor-practice-result-disclosure {
  width: 100%;
}

#doctor-practice-results .doctor-practice-result-summary {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  max-width: 100%;
  cursor: pointer;
  list-style: none;
}

#doctor-practice-results .doctor-practice-result-summary::-webkit-details-marker {
  display: none;
}

#doctor-practice-results .doctor-practice-result-summary::before {
  content: '▶';
  flex: 0 0 auto;
  font-size: 0.8rem;
  line-height: 1;
  color: #000;
}

#doctor-practice-results details[open] .doctor-practice-result-summary::before {
  content: '▼';
}

.patient-portal-attention-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.patient-portal-attention-summary::-webkit-details-marker {
  display: none;
}

#doctor-practice-results details[open] > .attention-practice-entry-copy {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

#doctor-practice-results .doctor-practice-result-grid {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#doctor-practice-results .doctor-practice-result-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#doctor-practice-results .doctor-practice-result-meta > div {
  min-width: 0;
  padding: 0 18px;
}

#doctor-practice-results .doctor-practice-result-meta > div + div {
  border-left: 1px solid var(--line);
}

#doctor-practice-results .doctor-practice-result-meta > div:first-child {
  padding-left: 0;
}

#doctor-practice-results .doctor-practice-result-detail {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

#doctor-practice-results .doctor-practice-result-grid span {
  display: block;
}

#doctor-practice-results .doctor-practice-result-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

#doctor-practice-results .doctor-practice-result-grid .button-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
}

#doctor-practice-results .doctor-practice-result .attention-practice-entry-copy > .button-row {
  margin-top: 18px;
}

@media (max-width: 700px) {
  #doctor-practice-results .doctor-practice-result-meta {
    grid-template-columns: 1fr;
  }

  #doctor-practice-results .doctor-practice-result-meta > div {
    padding: 12px 0;
  }

  #doctor-practice-results .doctor-practice-result-meta > div + div {
    border-left: 0;
  }
}

.finalized-attention-hero {
  display: grid;
  gap: 12px;
  padding: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(14, 116, 144, 0.05), rgba(255, 255, 255, 0.95)),
    #ffffff;
}

.finalized-attention-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 18px;
  padding: 0 18px 18px;
}

.finalized-attention-hero-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.finalized-attention-hero-label {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.finalized-attention-hero-value {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.finalized-attention-sheet {
  display: grid;
  gap: 14px;
}

.finalized-attention-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  padding: 16px 18px;
}

.finalized-attention-section-title {
  margin-bottom: 12px;
  color: #12354f;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.finalized-attention-diagnosis-card {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.finalized-attention-diagnosis-body {
  color: var(--text);
  font-size: 1.12rem;
  line-height: 1.55;
  text-align: left;
  white-space: pre-wrap;
}

.finalized-attention-diagnosis-notes {
  color: var(--text);
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
}

.finalized-attention-occupational-result-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: baseline;
}

.occupational-result {
  font-weight: 800;
  text-transform: uppercase;
}

.occupational-result--fit {
  color: #177a38;
}

.occupational-result--fit-with-observations {
  color: #9a6700;
}

.occupational-result--unfit {
  color: #b42318;
}

.finalized-attention-diagnosis-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.finalized-attention-empty-copy {
  color: var(--muted);
  font-size: 0.92rem;
}

.finalized-attention-studies-shell {
  border-radius: 16px;
}

.finalized-attention-studies-table th,
.finalized-attention-studies-table td {
  padding: 10px 12px;
}

.finalized-attention-studies-table th:last-child,
.finalized-attention-studies-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.finalized-attention-studies-table tbody tr:hover {
  background: transparent;
}

.finalized-attention-study-detail-row td {
  background: #f9fbfd;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  padding-top: 0;
}

.finalized-attention-study-detail-item + .finalized-attention-study-detail-item {
  margin-top: 4px;
}

.finalized-attention-signatures-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.finalized-attention-signature-card {
  display: grid;
  gap: 10px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
}

.finalized-attention-signature-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.finalized-attention-signature-image {
  justify-self: center;
  width: min(100%, 440px);
  max-height: 140px;
  object-fit: contain;
}

.finalized-attention-signature-pending {
  display: grid;
  gap: 6px;
  color: var(--muted);
  line-height: 1.5;
}

#create-practice-actions-shell {
  margin-top: 14px;
}

.patient-profile-overview-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.patient-summary-shell-spacer {
  visibility: hidden;
}

.patient-compact-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.patient-identity-card h4 {
  font-size: 1.08rem;
}

.subsection-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.practice-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(120px, 1fr)) minmax(0, 1.6fr);
  gap: 12px;
}

.practice-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafc;
  font-weight: 600;
}

.helper-text {
  color: var(--muted);
  font-size: 0.9rem;
}

.picker-results {
  display: grid;
  gap: 10px;
}

.picker-result-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fbfdff;
}

.picker-result-copy {
  display: grid;
  gap: 4px;
}

.picker-result-copy h4 {
  margin: 0;
  font-size: 0.98rem;
}

.picker-result-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.picker-result-actions {
  display: flex;
  align-items: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#attention-medication-lines .grid-form-row {
  display: grid;
  grid-template-columns: 0.65fr 1.6fr 1.4fr 1.15fr auto;
  gap: 8px;
  align-items: center;
}

#attention-finalization-modal .modal-panel {
  width: min(1080px, calc(100vw - 48px));
  overflow-x: hidden;
}

#attention-medication-lines .medication-line-headings {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

#attention-medication-lines input[name="medication-price"]::-webkit-outer-spin-button,
#attention-medication-lines input[name="medication-price"]::-webkit-inner-spin-button,
#attention-medication-lines input[name="medication-quantity"]::-webkit-outer-spin-button,
#attention-medication-lines input[name="medication-quantity"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#attention-medication-lines input[name="medication-price"],
#attention-medication-lines input[name="medication-quantity"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 0.9rem;
  color: var(--muted);
}

.field-group input,
.field-group select,
.field-group textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 10px 12px;
  background: #ffffff;
  color: var(--text);
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
}

.field-group.is-invalid input,
.field-group.is-invalid select,
.field-group.is-invalid textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.08);
}

.field-group textarea {
  min-height: 92px;
  resize: vertical;
}

.form-inline-error {
  margin-top: 2px;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.5);
}

.modal-card {
  width: min(100%, 480px);
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.attention-clinical-history-modal {
  width: min(1120px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attention-clinical-history-modal-actions {
  justify-content: flex-end;
  margin-bottom: 12px;
}

.attention-clinical-history-modal-content {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.button-primary,
.button-secondary,
.button-danger,
.button-soft {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
}

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

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

.button-secondary {
  background: #d9e6ef;
  color: #12354f;
}

.button-soft {
  background: var(--panel-soft);
  color: var(--text);
}

.button-secondary:hover,
.button-soft:hover,
.button-danger:hover {
  filter: brightness(0.98);
}

.button-danger {
  background: #fce9e7;
  color: var(--danger);
}

.button-full {
  width: 100%;
}

.button-small {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.86rem;
}

.button-row form {
  margin: 0;
}

.study-status-choice-row {
  margin-top: 12px;
}

.study-status-choice-button.is-selected {
  background: var(--primary);
  color: #ffffff;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.patient-list-status-nowrap {
  display: inline-block;
  min-width: max-content;
  white-space: nowrap;
}

#attentions-table tr.doctor-worklist-card-recent > td {
  background: #edfdf3;
}

#attentions-table tr.doctor-worklist-card-warning > td {
  background: #fff8e7;
}

#attentions-table tr.doctor-worklist-card-critical > td {
  background: #fef0f0;
}

#attentions-table tr.doctor-worklist-card-recent > td:first-child {
  border-left: 8px solid var(--success);
}

#attentions-table tr.doctor-worklist-card-warning > td:first-child {
  border-left: 8px solid #f2b533;
}

#attentions-table tr.doctor-worklist-card-critical > td:first-child {
  border-left: 8px solid var(--danger);
}

#study-files-section,
#study-files-table,
#study-files-table .table-shell {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#study-files-table .table-shell {
  overflow-x: hidden;
}

#study-files-table table {
  width: 100%;
  table-layout: fixed;
}

#study-files-table th,
#study-files-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#study-files-table th:nth-child(1),
#study-files-table td:nth-child(1) {
  width: 25%;
}

#study-files-table th:nth-child(2),
#study-files-table td:nth-child(2) {
  width: 60%;
}

#study-files-table th:nth-child(3),
#study-files-table td:nth-child(3) {
  width: 15%;
}

#study-files-table .button-row {
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  #study-files-table th,
  #study-files-table td {
    padding: 8px;
    font-size: 0.85rem;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.attention-date-cell {
  display: inline-block;
  min-width: 10ch;
  white-space: nowrap;
  overflow-wrap: normal;
}

th {
  background: #f7fafc;
  color: var(--muted);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #f9fbfd;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-neutral {
  background: #e5edf4;
  color: #375268;
}

.badge-success {
  background: #dff8eb;
  color: var(--success);
}

.badge-warning {
  background: #fff0db;
  color: var(--warning);
}

.badge-danger {
  background: #fde8e8;
  color: var(--danger);
}

.notice {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  overflow-wrap: anywhere;
}

.panel .notice {
  margin-top: 10px;
}

.notice-warning {
  border-color: #f0d4b4;
  background: #fff7ed;
  color: #8a3f08;
}

.notice-error {
  border-color: #f3c7c1;
  background: #fff1f0;
  color: #912018;
}

.notice-success {
  border-color: #c5ead4;
  background: #eefbf3;
  color: #11633f;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.modal-panel {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

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

.modal-header h3 {
  margin: 6px 0 0;
}

.modal-detail-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.modal-detail-list li {
  color: var(--text);
}

.modal-detail-list li span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.patient-signature-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #f8fbff;
}

.patient-signature-shell.is-invalid {
  border-color: #f3c7c1;
  background: #fff7f6;
}

.patient-signature-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.patient-signature-status {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.patient-signature-preview-shell {
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #ffffff;
  padding: 12px;
  min-height: 156px;
  display: grid;
  place-items: center;
}

.patient-signature-preview-shell img {
  max-width: 100%;
  max-height: 182px;
  display: block;
}

.patient-signature-capture-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #d8e3ee;
  border-radius: 16px;
  padding: 14px;
  background: #ffffff;
}

.patient-signature-capture-shell canvas {
  width: 100%;
  max-width: 640px;
  min-height: 220px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  touch-action: none;
}

.patient-photo-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.patient-photo-frame {
  width: min(320px, 100%);
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #f7fafc;
  display: grid;
  place-items: center;
}

.patient-photo-preview,
.patient-photo-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.patient-photo-placeholder {
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.patient-photo-placeholder p {
  margin: 0;
}

.inline-data {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-data .notice {
  padding: 8px 10px;
  font-size: 0.88rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.password-visibility-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-visibility-field input {
  width: 100%;
  padding-right: 48px;
}

.password-visibility-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.password-visibility-button:hover {
  background: rgba(14, 116, 144, 0.08);
  color: var(--primary);
}

.password-visibility-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
}

.password-visibility-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

.password-visibility-icon-slash {
  opacity: 1;
  transition: opacity 0.15s ease;
}

.password-visibility-button.is-password-visible {
  color: var(--primary);
}

.password-visibility-button.is-password-visible .password-visibility-icon-slash {
  opacity: 0;
}

.notification-stack {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.notification-card {
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  color: #ffffff;
}

.notification-card strong {
  display: block;
  margin-bottom: 4px;
}

.notification-success {
  background: var(--success);
}

.notification-error {
  background: var(--danger);
}

.notification-info {
  background: var(--primary);
}

.global-loading {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 45;
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(16, 42, 67, 0.95);
  color: #ffffff;
  box-shadow: var(--shadow);
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

.compact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#selected-study-upload-files .field-group > button {
  align-self: flex-start;
  width: auto;
}

#selected-study-upload-files [data-study-upload-description] {
  width: 40ch;
  max-width: 100%;
}

.user-service-assignments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: .4rem 1.25rem;
  align-items: start;
}
.user-service-assignment-column { display: grid; gap: .4rem; align-content: start; }

.medical-circuits-note { margin-top: .35rem; color: var(--color-text-muted, #64748b); font-size: .9rem; }
.medical-circuit-tabs { display: flex; flex-wrap: wrap; gap: .65rem; margin: 1.25rem 0; }
.medical-circuit-tab { width: auto; min-width: 0; padding: .6rem 1rem; border: 1px solid var(--color-border, #cbd5e1); border-radius: .5rem; background: #fff; color: inherit; cursor: pointer; }
.medical-circuit-tab.is-selected { background: var(--color-primary, #0f766e); border-color: var(--color-primary, #0f766e); color: #fff; font-weight: 600; }
.medical-circuit-detail { max-width: 100%; }
.medical-circuit-detail-header { margin: 1.25rem 0 1rem; }
.medical-circuit-detail-header h2 { margin-bottom: .3rem; }
.medical-circuit-detail-header p { margin: 0; color: var(--color-text-muted, #64748b); }
.medical-circuit-practice-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, minmax(2.45rem, auto)); grid-auto-columns: minmax(15rem, 1fr); gap: .55rem 1rem; max-width: 100%; }
.medical-circuit-practice { display: flex; align-items: center; gap: .65rem; min-width: 0; padding: .55rem .7rem; border: 1px solid var(--color-border, #d8dee9); border-radius: .45rem; background: #fff; cursor: pointer; }
.medical-circuit-practice:hover { background: #f8fafc; }
.medical-circuit-practice.is-selected { border-color: var(--color-primary, #0f766e); background: #ecfdf5; }
.medical-circuit-practice input { flex: 0 0 auto; margin: 0; }
.medical-circuit-practice span { overflow-wrap: anywhere; }
.medical-circuit-save-row { margin-top: 1.25rem; }
@media (max-width: 700px) { .medical-circuit-practice-grid { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: minmax(0, 1fr); } .medical-circuit-tab { flex: 1 1 auto; } }
@media (max-width: 700px) {
  .user-service-assignments { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: 1fr; }
}

.compact-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfdff;
}

.compact-item h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.compact-item p {
  margin: 4px 0;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.two-column-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.issued-documents-filters {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 16px;
}

.issued-documents-filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pending-receiver-row {
  cursor: pointer;
}

.pending-receiver-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  margin: 0 6px 0 0;
  padding: 0;
}

.pending-receiver-details > td {
  background: rgba(38, 26, 67, 0.04);
  padding: 0;
}

.pending-receiver-details-inner {
  padding: 8px 12px 10px 34px;
}

.pending-attentions-table {
  font-size: 0.9rem;
}

.billing-document-status {
  min-width: 96px;
  white-space: nowrap;
}

.billing-document-actions {
  padding-top: 6px;
  padding-bottom: 6px;
  white-space: nowrap;
}

.billing-document-actions .button-small {
  margin: 1px 2px;
}

.users-edit-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: start;
}

.users-search-field {
  width: clamp(280px, 34vw, 420px);
}

.users-search-field input {
  width: 100%;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .attention-create-overview {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 16px;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
  }

  .topbar-logo-link {
    position: static;
  }

  .topbar-menu {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: visible;
  }

  .topbar-session {
    position: static;
  }

  .topbar-company-portal {
    display: flex;
  }

  .topbar-company-portal .topbar-menu {
    order: 3;
    width: 100%;
  }

  .topbar-company-portal .topbar-session {
    padding-left: 12px;
  }

  .portal-study-file-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-content {
    padding: 16px;
  }

  .home-placeholder-panel {
    margin-top: 8px;
    padding: 32px 24px;
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

  .patient-profile-overview-grid,
  .patient-compact-summary-grid {
    grid-template-columns: 1fr;
  }

  .practice-editor-grid {
    grid-template-columns: 1fr;
  }

  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .pending-receiver-details-inner {
    padding-left: 12px;
  }

  .users-search-field {
    width: 100%;
    margin-left: 0;
  }

  .attention-create-header {
    flex-direction: column;
    align-items: stretch;
  }

  .study-flow-header {
    flex-direction: column;
    align-items: stretch;
  }

  .doctor-worklist-card-header,
  .doctor-worklist-card-footer,
  .attention-queue-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .doctor-worklist-waiting {
    white-space: normal;
  }

  .doctor-worklist-card-line {
    gap: 4px;
  }

  .picker-result-card {
    flex-direction: column;
  }

  .finalized-attention-hero {
    padding: 16px;
  }

  .finalized-attention-hero-grid,
  .finalized-attention-signatures-grid {
    grid-template-columns: 1fr;
  }

  .finalized-attention-section {
    padding: 14px;
  }
}
