/* ============================================================
   components.css  v1.0
   Every CSS class used in two or more domains lives here.
   ============================================================ */

/* Page containers — app pages use the full screen width; only the public portal forms stay narrow */
.page-container         { max-width: none; }
.page-container--narrow { max-width: var(--page-width-narrow); margin: 0 auto; }

/* Show headings as written (Title Case) instead of forced UPPERCASE */
.titlecase-headings th,
.titlecase-headings .k,
.titlecase-headings .record-section-title,
.titlecase-headings .record-visit-detail dt,
.titlecase-headings .form-label,
.titlecase-headings .c360-intel-sub { text-transform: none !important; }

/* Utility spacing */
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }

/* Utility text */
.text-bold      { font-weight: 600; }
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger    { color: var(--color-danger); }
.text-success   { color: var(--color-success); }
.text-sm        { font-size: var(--text-sm); }
.text-xs        { font-size: var(--text-xs); }

/* Split layout — used by every split-panel form (Allergies, Prescriptions) */
.split-layout   { display: flex; gap: var(--space-4); align-items: flex-start; }
.split-main     { flex: 1; min-width: 0; }
.split-panel    { flex-shrink: 0; width: 460px; }

/* Two-column form grid — reduces vertical scrolling on forms with many
   short fields (Allergies, Prescriptions). Use .form-group--full on any
   field that needs the full row (buttons, notes, long text). */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--space-3);
}
.form-grid .form-group--full { grid-column: 1 / -1; }

/* Sectioned registration form (patient-registration.aspx): small uppercase section
   headings over rows of up to four auto-fitting fields. */
.reg-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-secondary); margin: 18px 0 10px; padding-top: 14px;
  border-top: 1px solid var(--border-default);
}
.reg-form .validation-summary + .reg-section-title,
.reg-form > div:first-child + .reg-section-title { border-top: 0; padding-top: 0; margin-top: 4px; }
.reg-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* minmax(0,…) lets columns shrink instead of overflowing */
    gap: 0 var(--space-3);
}

@media (max-width: 900px) {
    .reg-fields {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .reg-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .reg-fields {
        grid-template-columns: minmax(0, 1fr);
    }
        /* fields that span 2 columns (e.g. Address Line 1 / Line 2) must not create an extra column */
        .reg-fields > * {
            grid-column: 1 / -1 !important;
        }
}

/* Smaller padding on phones so the form gets more room */
@media (max-width: 600px) {
    .reg-form {
        padding: var(--space-3);
    }
}
.reg-fieldss {
    display: grid;
    grid-template-columns: repeat(auto, minmax(170px, 1fr));
    gap: 0 var(--space-3);
}
.reg-fields .form-group { min-width: 0; }
/* ── Public booking page ──────────────────────────── */
.sb-pick {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.sb-pick__type {
    width: 240px;
    max-width: 100%;
}

.sb-pick__date {
    width: 200px;
    max-width: 100%;
}

/* Doctor radio list: bigger tap area, one doctor per line */
.sb-doctors input[type=radio] {
    margin-right: 6px;
}

.sb-doctors label {
    display: inline;
}

.sb-doctors input[type=radio] + label {
    line-height: 1.8;
}

/* Time slots: wrap neatly and are easy to tap */
.sb-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

    .sb-slots > span, .sb-slots > label {
        white-space: nowrap;
    }

@media (max-width: 600px) {
    .page-container--narrow {
        padding-left: 0;
        padding-right: 0;
    }

        /* MRN and phone: one column */
        .page-container--narrow .form-grid {
            grid-template-columns: 1fr;
        }

    /* Visit type and date: full width, stacked */
    .sb-pick__type,
    .sb-pick__date {
        width: 100%;
        flex: 1 1 100%;
    }

    /* Slots: two per row */
    .sb-slots > span {
        flex: 1 1 calc(50% - 14px);
    }
}
/* Multi-role checkboxes (user-management.aspx) */
.role-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 0; padding: 0; list-style: none; }
.role-checks li { display: flex; align-items: center; }
.role-checks label { margin-left: 4px; font-size: 13px; cursor: pointer; }

/* Cards */
.card {
/*    overflow-y: scroll;*/
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.metric-card {
  background: var(--surface-page);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.metric-card .metric-label { font-size: var(--text-xs); color: var(--text-muted); }
.metric-card .metric-value { font-size: var(--text-lg); font-weight: 600; margin-top: var(--space-1); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--text-primary);
  cursor: pointer;
}
.btn:hover { background: var(--surface-page); }
.btn:active { transform: scale(0.98); }
.btn--sm { height: 30px; padding: 0 var(--space-2); font-size: var(--text-xs); }
.btn--xs { height: 26px; padding: 0 var(--space-2); font-size: var(--text-xs); }
.btn--primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--text-on-primary);
}

.btn--success {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}

.btn--warning {
    background: var(--color-warning);
    border-color: var(--color-warning);
    color: #fff;
}

.btn--danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
}

/* Coloured buttons keep their colour on hover and just get a little darker */
.btn--primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: var(--text-on-primary);
}

.btn--success:hover,
.btn--warning:hover,
.btn--danger:hover {
    filter: brightness(0.9);
    color: #fff;
}

.btn--success:hover {
    background: var(--color-success);
}

.btn--warning:hover {
    background: var(--color-warning);
}

.btn--danger:hover {
    background: var(--color-danger);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
}

    .btn--ghost:hover {
        background: var(--surface-page);
    }
/* Outlined button: visible border + soft shadow (utility actions like Search / Excel / PDF) */
.btn--outline {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

    .btn--outline:hover {
        border-color: var(--text-muted);
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
    }

    .btn--outline:focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
    }

    .btn--outline:active {
        box-shadow: none;
    }

/* Colour only the icon so the buttons stay neutral */
.btn--excel i {
    color: var(--color-success);
}

.btn--pdf i {
    color: var(--color-danger);
}

.btn--search i {
    color: var(--color-primary);
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Form controls */
.form-group { margin-bottom: var(--space-3); }
.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}
/* Required-field asterisk: red wherever it appears (labels, card headers, table headings) */
.required { color: var(--color-danger); }
.form-control,
.form-select {
  box-sizing: border-box;
  width: 100%;
  height: 36px;
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-primary);
}
.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-control-sm { height: 30px; font-size: var(--text-xs); }
textarea.form-control { height: auto; min-height: 72px; padding: var(--space-2); font-family: inherit; }
.form-radio-group { display: flex; gap: var(--space-4); align-items: center; }
.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.data-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  background: var(--color-primary);
  color: var(--text-on-primary);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
    .data-table td {
        text-wrap: nowrap;
        padding: var(--space-2) var(--space-3);
        border-bottom: 1px solid var(--border-default);
    }
.data-table tbody tr:nth-child(even) td {
  background-color: var(--color-row-alt);
}
/* set on the row, not the cell, so tables with clickable rows can give their rows the hand cursor */
.data-table tbody tr { cursor: default; }
.data-table tbody tr:hover td {
  background-color: var(--color-row-hover);
}
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-5);
}

/* Chips (tri-state) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--surface-page);
  color: var(--text-secondary);
  cursor: pointer;
}
.chip[data-state="YES"] { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success); }
.chip[data-state="NO"]  { background: var(--color-danger-bg);  color: var(--color-danger);  border-color: var(--color-danger); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  padding: 4px 10px;
  border-radius: var(--radius-md);
}
.badge--danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge--warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge--success { background: var(--color-success-bg); color: var(--color-success); }
.badge--info    { background: var(--color-info-bg);    color: var(--color-info); }
/* Walk-in appointment (booked after the doctor's slots were full, 0030): outlined so it never reads as a status */
.badge--walkin  { background: transparent; color: var(--text-secondary, #475569); border: 1px dashed currentColor; }

/* Alert banners — used by Contradiction Engine, Rx Reconciler, safety alerts */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  border-left: 4px solid transparent;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.alert-banner--info     { background: var(--color-info-bg);    border-left-color: var(--severity-info-border); }
.alert-banner--warning  { background: var(--color-warning-bg); border-left-color: var(--severity-warning-border); }
.alert-banner--critical { background: var(--color-danger-bg);  border-left-color: var(--severity-critical-border); }

/* Modal frame */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 32, 45, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}
.modal-frame {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 480px;
  max-width: calc(100vw - var(--space-5));
  max-height: calc(100vh - var(--space-6));
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-default);
}
.modal-body   { padding: var(--space-4); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4);
  border-top: 1px solid var(--border-default);
}

/* Toasts */
.toast-stack {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
/* Toasts: solid colour card with a thin light border, a large type icon on the left (added by site.js),
   a bold type heading ("Information", "Success" ...), the message below, × top-right and a countdown bar. */
.toast {
  box-sizing: border-box;
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 14px 40px 16px 68px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, .55);
  outline: 1px solid rgba(0, 0, 0, .12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  background: #374151;
  color: #fff;
  font-size: 15px;
  line-height: 1.5;
  position: relative;
  overflow: hidden;
  animation: toast-in .25s ease-out;
}
.toast-kind { display: block; font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.toast strong:not(.toast-kind) { font-weight: 400; }
.toast .text-secondary, .toast .text-muted { color: rgba(255, 255, 255, .9); font-size: 13px; }
.toast a { color: #fff; text-decoration: underline; font-weight: 600; }
.toast-icon {
  position: absolute; top: 50%; left: 18px; transform: translateY(-50%);
  font-size: 34px; line-height: 1; color: #fff;
}
.toast-close {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-sm); background: transparent;
  color: rgba(255, 255, 255, .85); font-size: 22px; font-weight: 700; line-height: 1; cursor: pointer;
}
.toast-close:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.toast-close:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.toast--success { background: #2f9e5a; }
.toast--danger  { background: #d64541; }
.toast--warning { background: #d9891c; }
.toast--info    { background: #2e96b0; }
.toast-bar {
  position: absolute; left: 0; bottom: 0;
  height: 3px; width: 100%;
  background: rgba(255, 255, 255, .6);
  transform-origin: left;
  animation: toast-bar linear forwards;
}
@keyframes toast-bar {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Empty / error / loading states */
.state-panel {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
}
.state-panel i { font-size: 32px; margin-bottom: var(--space-2); display: block; }

/* A postback (and the API calls behind it) is in flight — see site.js duplicate-submit guard */
body.is-submitting { cursor: progress; }
.is-busy { position: relative; opacity: .7; pointer-events: none; }
.btn.is-busy::after {
  content: ""; width: 12px; height: 12px; margin-left: 8px; display: inline-block; vertical-align: middle;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: c360-spin .7s linear infinite;
}
@keyframes c360-spin { to { transform: rotate(360deg); } }

/* Accessibility utility */
.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;
}

/* Zone A — Patient Context Dashboard (35% viewport, always visible) */
.zone-a {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  margin-bottom: var(--space-2);
  overflow: hidden;
}
.zone-a-toggle {
  display: flex;
  justify-content: flex-end;
  padding: 1px var(--space-2);
  background: var(--surface-page);
  border-bottom: 1px solid var(--border-default);
}
.zone-a-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-default);
  max-height: 32vh;
  overflow-y: auto;
}
.zone-a-panel {
  background: var(--surface-card);
  padding: var(--space-2) var(--space-3);
  min-height: 60px;
}
.zone-a-panel-header {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.zone-a-panel--allergy { background: #fef8f8; }
.zone-a-item { font-size: var(--text-sm); color: var(--text-primary); padding: 2px 0; line-height: 1.4; }
.zone-a-item-muted { color: var(--text-muted); }
.zone-a-more { font-size: var(--text-xs); color: var(--color-primary); cursor: pointer; margin-top: var(--space-1); display: inline-block; }
.zone-a-more:hover { text-decoration: underline; }
.zone-a-empty { font-size: var(--text-xs); color: var(--text-muted); font-style: italic; }

.zone-a.collapsed .zone-a-grid { display: none; }
.zone-a.collapsed .zone-a-allergy-strip { display: flex !important; }
.zone-a-allergy-strip {
  padding: var(--space-2) var(--space-3);
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  background: #fef8f8; border-top: 1px solid var(--border-default);
}

/* Zone B — Current Visit Workspace */
.zone-b {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 400px;
}
.zone-b-rail { border-right: 1px solid var(--border-default); padding: var(--space-3) var(--space-2); background: var(--surface-page); }
.zone-b-workspace { padding: var(--space-4); overflow-y: auto; max-height: 55vh; }
.zone-b-progress { font-size: var(--text-xs); color: var(--text-secondary); font-weight: 600; padding: var(--space-2); margin-bottom: var(--space-2); text-align: center; }

.wf-step { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500; cursor: pointer; border-left: 3px solid transparent; margin-bottom: 2px; }
.wf-step--completed { border-left-color: var(--color-success); color: var(--color-success); }
.wf-step--active    { border-left-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
.wf-step--pending   { color: var(--text-muted); }
.wf-step--skipped   { border-left-color: var(--border-strong); color: var(--text-muted); opacity: 0.7; }

/* Consultation section cards — colored header bars for visual distinction */
.consult-section {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  overflow: hidden;
  background: var(--surface-card);
}
.consult-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-left: 4px solid var(--border-strong);
  background: var(--surface-page);
}
.consult-section-header--active {
  border-left-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.consult-section-header--completed {
  border-left-color: var(--color-success);
}
.consult-section-header .section-status {
  font-size: var(--text-xs);
  font-weight: 600;
}
.consult-section-header .section-status--done { color: var(--color-success); }
.consult-section-header .section-status--here { color: var(--color-primary); }
.consult-section-body {
  padding: var(--space-3);
}

/* Vitals inline validation */
.vital-error { font-size: var(--text-xs); color: var(--color-danger); margin-top: 2px; }
.vital-calc { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-2); }
.vital-calc strong { color: var(--text-primary); }

/* Complaints expansion */
.complaints-expanded { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border-default); }

/* Contextual hint banners — dismissible per doctor */
.hint-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}

/* Phrase chip rows below SOAP textareas — compact, one row if possible */
.phrase-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: var(--space-1);
}
.phrase-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-light);
  color: var(--color-primary);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.phrase-chip:hover { border-color: var(--color-primary); }
.phrase-chip--used {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Phrase trigger dropdown */
.phrase-dropdown {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  max-height: 180px;
  overflow-y: auto;
  z-index: var(--z-popover);
  font-size: var(--text-sm);
}
.phrase-dropdown-item {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-bottom: 1px solid var(--border-default);
}
.phrase-dropdown-item:hover { background: var(--color-primary-light); }

/* Drawer — slides from the right, preserves main page layout */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 32, 45, 0.35);
  z-index: var(--z-modal);
  display: flex;
  justify-content: flex-end;
}
.drawer-panel {
  width: 520px;
  max-width: 90vw;
  height: 100%;
  background: var(--surface-card);
  box-shadow: -4px 0 16px rgba(15, 45, 63, 0.15);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  background: var(--surface-card);
  z-index: 1;
}
.drawer-body { padding: var(--space-4); flex: 1; }
.drawer-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: var(--space-3) 0 var(--space-1);
}
.drawer-item {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-sm);
}

@media (max-width: 900px) { .zone-a-grid { grid-template-columns: repeat(2, 1fr); } .zone-b { grid-template-columns: 64px 1fr; } }
@media (max-width: 600px) { .zone-a-grid { grid-template-columns: 1fr; max-height: 30vh; } .zone-b { grid-template-columns: 1fr; } .zone-b-rail { display: none; } }

/* Consultation 360 — workflow rail, main content spacing, safety rail */
.consult-rail {
  padding: var(--space-2);
  border-right: 1px solid var(--border-default);
  background: var(--surface-page);
}
.consult-rail-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 0 var(--space-2) 6px;
}
.consult-rail-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  box-sizing: border-box;
  min-width: 0;
}
.consult-rail-item:hover { background: var(--surface-card); }
.consult-rail-item--active { background: var(--color-primary-light); color: var(--color-primary); }
.consult-rail-item[data-available="false"] { opacity: 0.55; }
.consult-rail-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.consult-main {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.consult-safety {
  padding: var(--space-3);
  border-left: 1px solid var(--border-default);
  background: var(--surface-page);
}
.consult-safety-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

/* Patient identifier strip — persistent banner on every patient-scoped page */
.patient-strip {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(15, 45, 63, 0.18);
}
.patient-strip-name {
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.patient-strip-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  width:100%;
  justify-content:space-evenly;
}
.patient-strip-meta .label {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
}

/* ── Settings Hub ─────────────────────────────────── */
.settings-hub { display: flex; gap: 0; min-height: 70vh; }
.settings-sidebar { width: 200px; border-right: 1px solid var(--border-default); padding: 8px 0; background: var(--surface-page); flex-shrink: 0; }
.settings-tab { display: flex; align-items: center; gap: 8px; padding: 10px 16px; cursor: pointer; font-size: 13px; color: var(--text-secondary); border-left: 3px solid transparent; transition: all 0.15s; }
.settings-tab:hover { background: var(--surface-hover, #f8fafc); color: var(--text-default); }
.settings-tab--active { background: var(--color-primary-light, #e0f2fe); color: var(--color-primary); font-weight: 600; border-left-color: var(--color-primary); }
.settings-content { flex: 1; padding: 16px 24px; overflow-y: auto; }
.settings-section { background: var(--surface-card); border: 1px solid var(--border-default); border-radius: 6px; padding: 16px; }
.settings-section-header { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text-default); }

/* ── Prescription form styles ─────────────────────── */
.rx-meta-text { font-size: 11px; color: #dc2626; font-style: italic; margin-top: 2px; min-height: 14px; }
.rx-hint { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; background: var(--border-default); color: var(--text-muted); font-size: 9px; cursor: help; font-style: normal; font-weight: 700; vertical-align: middle; margin-left: 2px; }
.rx-chip { display: inline-block; padding: 4px 10px; border: 1px solid var(--border-default); border-radius: 14px; font-size: 11px; cursor: pointer; background: var(--surface-card); transition: all 0.15s; user-select: none; }
.rx-chip:hover { border-color: var(--color-primary); }
.rx-chip--active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.chip-row { display: flex; gap: 4px; flex-wrap: wrap; }
.rx-timing-label { font-size: 12px; display: flex; align-items: center; gap: 3px; cursor: pointer; }
.rx-dynamic-instruction { font-size: 13px; color: #0d9488; font-weight: 600; font-style: italic; padding: 6px 8px; border-radius: 4px; min-height: 20px; }

/* ── Patient health record (tabs + summary tiles) ── */
.record-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin-bottom: var(--space-3); }
.record-summary-tile { display: block; min-width: 0; background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 8px 12px; color: inherit; text-decoration: none; }
.record-summary-tile:hover { border-color: var(--color-primary); text-decoration: none; }
.record-summary-tile .k { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.record-summary-tile .v { display: block; font-size: var(--text-sm); font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-summary-tile .v--warn { color: var(--color-warning); }
.record-onboarding { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); padding: 10px 14px; background: var(--color-success-bg); border: 1px solid var(--color-success); border-radius: var(--radius-md); color: var(--text-primary); }
.record-onboarding .btn { flex-shrink: 0; }
.record-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 2px solid var(--border-default); margin: 4px 0 var(--space-3); }
.record-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; margin-bottom: -2px; border-bottom: 2px solid transparent; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); text-decoration: none; }
.record-tab:hover { color: var(--text-primary); background: var(--surface-card); text-decoration: none; }
.record-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.record-tab .count { font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 10px; background: var(--surface-card); border: 1px solid var(--border-default); color: var(--text-secondary); }
.record-tab.active .count { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.record-tab .count--alert, .record-tab.active .count--alert { background: var(--color-warning-bg); border-color: #f59e0b; color: var(--color-warning); }
.record-section-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 16px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-secondary); }
.split-main > .record-section-title:first-child { margin-top: 0; }
.record-social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-3); }
.record-row--past td { color: var(--text-muted); }
.record-alert { background: var(--color-danger-bg); border: 1px solid var(--color-danger); color: var(--color-danger); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: var(--space-3); }
.src-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.src-badge--here { background: var(--color-info-bg); color: var(--color-info); }
.src-badge--outside { background: #f3e8ff; color: #7e22ce; }
@media (max-width: 1100px) {
  .record-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout { flex-direction: column; align-items: stretch; }
  .split-panel { width: auto; }
}

/* Health record → Visits */
.record-visit { margin-bottom: var(--space-3); }
.record-visit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); padding-bottom: 8px; border-bottom: 1px solid var(--border-default); }
.record-visit-dx { font-size: var(--text-sm); font-weight: 600; color: var(--color-primary); margin-top: 2px; }
.record-visit-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.record-visit-detail { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 10px 0 0; font-size: var(--text-sm); }
.record-visit-detail dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); padding-top: 2px; }
.record-visit-detail dd { margin: 0; min-width: 0; }
@media (max-width: 700px) { .record-visit-detail { grid-template-columns: 1fr; } .record-visit-head { flex-direction: column; } }

/* ── Home dashboard (/dashboard): period tiles and today's status pie ── */
.dash-welcome { font-size: 24px; font-weight: 600; color: var(--color-primary-dark); margin: 4px 0 14px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-card { padding: 20px 22px 24px; }
.dash-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin: 0 0 18px; }
.dash-title--center { text-align: center; }
.dash-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dash-tile { display: block; border-radius: 8px; padding: 14px 10px 16px; text-align: center; color: #1e293b; text-decoration: none;
  transition: transform .15s, box-shadow .15s; }
.dash-tile:hover, .dash-tile:focus-visible { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, .12); }
.dash-pie a { cursor: pointer; }
.dash-pie a:hover path, .dash-pie a:hover circle { opacity: .85; }
.dash-legend a { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.dash-legend a:hover { text-decoration: underline; }
.dash-tile-label { font-size: 14px; font-weight: 600; }
.dash-tile-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 10px; }
/* App-theme tints: today = brand blue, week = teal, month = navy */
.dash-tile--today { background: var(--color-primary-light); border: 1px solid #c5dceb; }
.dash-tile--today .dash-tile-value { color: var(--color-primary); }
.dash-tile--week  { background: #ccfbf1; border: 1px solid #99e9da; }
.dash-tile--week .dash-tile-value { color: #0f766e; }
.dash-tile--month { background: #dbeafe; border: 1px solid #bcd3f7; }
.dash-tile--month .dash-tile-value { color: #1e40af; }
.dash-chart { display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap; }
.dash-pie { width: 240px; max-width: 100%; height: auto; }
.dash-legend { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.dash-legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.dash-swatch { width: 28px; height: 12px; border-radius: 2px; flex-shrink: 0; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── Consultation Setup (settings/consultation): sections · fields · options · preview ── */
/* Full-screen editor: header bar on top, the four columns fill the rest of the window and each scrolls on its own. */
.ccfg-page { display: flex; flex-direction: column; height: 100vh; margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-4)); background: var(--surface-card); }
.ccfg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; flex-shrink: 0;
  padding: 12px 20px; background: var(--surface-card); border-bottom: 1px solid var(--border-default); }
.ccfg-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1 1 360px;
    min-width: 0;
}
.ccfg-title > .btn { flex-shrink: 0; }
.ccfg-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ccfg-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--color-warning-bg); color: var(--color-warning); }
.ccfg-badge--clean { background: var(--color-success-bg); color: var(--color-success); }
.ccfg-body { display: grid; grid-template-columns: minmax(250px, 1.1fr) minmax(230px, 1fr) minmax(200px, .9fr) minmax(250px, 1fr);
  grid-template-rows: minmax(0, 1fr); flex: 1; min-height: 0; background: var(--surface-card); overflow: hidden; }
.ccfg-col { min-width: 0; padding: 10px 12px 24px; border-right: 1px solid var(--border-default); overflow-y: auto; }
.ccfg-col:nth-child(2) { background: var(--surface-page); }
.ccfg-col--preview { background: var(--surface-page); border-right: 0; }
.ccfg-col-title { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--text-muted); padding: 4px 4px 10px; }
.ccfg-col-head { font-size: 13px; font-weight: 700; color: var(--text-primary); padding: 2px 4px 4px; }
.ccfg-col-desc { font-size: 11px; color: var(--text-muted); padding: 0 4px 10px; }
.ccfg-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; margin: 5px 0; background: var(--surface-card);
  border: 1.5px solid var(--border-default); border-radius: var(--radius-md); transition: border-color .15s, background .15s; }
.ccfg-row:hover { border-color: var(--color-primary); }
.ccfg-row--sel { border-color: var(--color-primary); background: var(--color-primary-light); }
.ccfg-row--off .ccfg-name { text-decoration: line-through; color: var(--text-muted); }
.ccfg-row--over { border-style: dashed; border-color: var(--color-primary); background: var(--color-primary-light); }
.ccfg-row--dragging { opacity: .4; }
.ccfg-drag { cursor: grab; color: var(--text-muted); user-select: none; flex-shrink: 0; }
.ccfg-check { width: 22px; height: 22px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px;
  border: 1.5px solid var(--border-strong); background: var(--surface-card); color: #fff; font-size: 13px; text-decoration: none; }
.ccfg-check:hover { border-color: var(--color-primary); }
.ccfg-check--on { background: var(--color-success); border-color: var(--color-success); }
.ccfg-lock { width: 22px; flex-shrink: 0; text-align: center; color: var(--text-muted); }
.ccfg-main { flex: 1; min-width: 0; display: block; color: inherit; text-decoration: none; }
.ccfg-main:hover { text-decoration: none; }
.ccfg-name { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccfg-sub { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccfg-col-head .ccfg-sub { display: inline; margin-left: 6px; text-transform: uppercase; letter-spacing: .5px; }
.ccfg-arrow { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.ccfg-move { display: flex; flex-direction: column; flex-shrink: 0; min-width: 18px; }
.ccfg-move a { color: var(--text-muted); line-height: 1; padding: 1px 2px; }
.ccfg-move a:hover { color: var(--color-primary); }
.ccfg-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px; }
.ccfg-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 600;
  border: 1.5px solid var(--border-strong); background: var(--surface-card); color: var(--text-muted); text-decoration: none; }
.ccfg-chip:hover { border-color: var(--color-primary); text-decoration: none; }
.ccfg-chip--on { background: var(--color-success-bg); border-color: var(--color-success); color: var(--color-success); }
.ccfg-chip--locked { cursor: default; }
.ccfg-hint { font-size: 10.5px; color: var(--text-muted); padding: 10px 4px 0; }
.ccfg-note { font-size: 11px; color: var(--color-warning); background: var(--color-warning-bg); border-radius: var(--radius-sm); padding: 6px 8px; margin: 0 0 6px; }
.ccfg-empty { padding: 20px 12px; text-align: center; color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }
.ccfg-diff { margin: 8px 0 12px; padding-left: 18px; font-size: 12px; }
.ccfg-diff li { margin-bottom: 3px; }
.ccfg-prev-steps { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.ccfg-prev-step { font-size: 10px; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-card); border: 1px solid var(--border-default); color: var(--text-secondary); }
.ccfg-prev-card { background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 8px 10px; margin-bottom: 8px; }
.ccfg-prev-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.ccfg-prev-field { font-size: 11px; color: var(--text-secondary); padding: 1px 0; }
.ccfg-prev-opt { display: inline-block; font-size: 10px; padding: 0 6px; margin: 1px 1px; border-radius: var(--radius-pill); background: var(--surface-page); border: 1px solid var(--border-default); }
@media (max-width: 1280px) { .ccfg-body { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ccfg-col--preview { display: none; } }
@media (max-width: 820px) { .ccfg-page { height: auto; } .ccfg-body { grid-template-columns: 1fr; grid-template-rows: none; overflow: visible; } .ccfg-col { border-right: 0; border-bottom: 1px solid var(--border-default); } }
/* Consultation Setup — custom sections / fields / options */
.ccfg-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: var(--radius-pill); font-size: 9px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; vertical-align: middle;
  background: var(--color-info-bg); color: var(--color-info); }
.ccfg-add { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 0 0; padding: 7px 8px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md);
  font-size: 12px; font-weight: 600; color: var(--color-primary); text-decoration: none; }
.ccfg-add:hover { border-color: var(--color-primary); background: var(--color-primary-light); text-decoration: none; }
.ccfg-col-head--actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.ccfg-item-actions { display: inline-flex; gap: 2px; }
.ccfg-danger { color: var(--color-danger); }
.ccfg-subtitle { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); padding: 4px 4px 6px; }
.ccfg-chipwrap { display: inline-flex; align-items: center; gap: 2px; }
.ccfg-chip-del { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; color: var(--text-muted); text-decoration: none; }
.ccfg-chip-del:hover { background: var(--color-danger-bg); color: var(--color-danger); text-decoration: none; }
.ccfg-addopt { display: flex; gap: 6px; padding: 10px 4px 0; }
.ccfg-addopt .form-control { flex: 1; min-width: 0; }
/* Consultation Setup — vital units */
.ccfg-subtitle--gap { margin-top: 14px; }
.ccfg-presets { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px 4px; }
.ccfg-row--muted .ccfg-name { color: var(--text-muted); }
.ccfg-urow { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--border-default); }
.ccfg-urow:last-of-type { border-bottom: 0; }
.ccfg-urow--off .ccfg-ulabel { color: var(--text-muted); }
.ccfg-ulabel { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.ccfg-tag--muted { background: var(--surface-page); color: var(--text-muted); }
.ccfg-chip--sm { padding: 2px 8px; font-size: 10.5px; }
.ccfg-addunit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 4px 0; }
.ccfg-addunit .form-control { width: 90px; flex: 0 0 auto; }
.ccfg-tag--new { background: var(--color-success-bg); color: var(--color-success); }
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.search-bar__input {
    flex: 1 1 260px; /* grows, but wraps to its own line below ~260px */
    min-width: 0;
}

.search-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

    .search-bar__actions .btn {
        white-space: nowrap;
    }

/* Phones */
@media (max-width: 600px) {
    .search-bar__input,
    .search-bar__actions {
        flex: 1 1 100%; /* both rows take full width */
    }

    .search-bar__actions {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr; /* Search | Excel | PDF */
    }

        .search-bar__actions .btn {
            justify-content: center;
            padding-inline: 8px;
        }

    .search-bar__new {
        grid-column: 1 / -1; /* New Patient spans the full row */
    }
}

/* Very small phones: icon-only for export buttons */
@media (max-width: 360px) {
    #<%= ExportExcelButton.ClientID % > span,
    #<%= ExportPdfButton.ClientID % > span {
        display: none;
    }
}
@media (max-width: 820px) {
    .ccfg-head {
        padding: 10px 12px;
        gap: 10px;
    }

    .ccfg-title {
        flex: 1 1 100%;
    }

    .ccfg-actions {
        flex: 1 1 100%;
    }

        .ccfg-actions .ccfg-badge {
/*            flex: 1 1 100%;*/
            text-align: center;
        }
        /* status badge gets its own row */
        .ccfg-actions .btn {
            flex: 1 1 0;
            justify-content: center;
            white-space: nowrap;
        }

    .ccfg-col {
        padding: 10px 12px 20px;
    }

    .ccfg-addunit .form-control {
        width: 100%;
        flex: 1 1 100%;
    }
    /* unit / factor inputs stack */
}
/* ── Settings hub: responsive ─────────────────────── */
.settings-content {
    min-width: 0;
}
/* lets the flex child shrink instead of overflowing */
.settings-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
    .settings-hub {
        flex-direction: column;
        min-height: 0;
    }

    .settings-sidebar {
        width: 100%;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 0;
        border-right: 0;
        border-bottom: 1px solid var(--border-default);
    }

    .settings-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 10px 14px;
        border-left: 0;
        border-bottom: 3px solid transparent;
    }

    .settings-tab--active {
        border-left-color: transparent;
        border-bottom-color: var(--color-primary);
    }

    .settings-content {
        padding: 12px;
        overflow-x: hidden;
    }

        /* Two-column forms become one column */
        .settings-content .form-grid {
            grid-template-columns: 1fr;
        }
}

@media (max-width: 600px) {
    .settings-content {
        padding: 10px;
    }

    .settings-section {
        padding: 12px;
    }

    /* Fixed-width inline inputs (leave, intake question, window times) must not overflow */
    .settings-content input.form-control[style*="width"],
    .settings-content select.form-select[style*="width"] {
        width: 100% !important;
        max-width: 100% !important;
    }
}
.appt-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.appt-side {
    width: 230px;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .appt-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .appt-side {
        width: 100%;
    }
}
.nv-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
}

    .nv-layout > * {
        min-width: 0;
    }

@media (max-width: 900px) {
    .nv-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .nv-layout .form-select.vital-unit {
        min-width: 70px;
    }

    .nv-layout table th,
    .nv-layout table td {
        padding-left: 4px;
        padding-right: 4px;
    }
}
/* ── Nurse vitals ─────────────────────────────────── */
.nv-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
}

    .nv-layout > * {
        min-width: 0;
    }

.nv-picker {
    display: none;
}
/* dropdown hidden on desktop */

@media (max-width: 900px) {
    .nv-layout {
        grid-template-columns: 1fr;
    }

    .nv-picker {
        display: block;
    }
    /* dropdown shown on small screens */
    .nv-list {
        display: none;
    }
    /* card list hidden on small screens */
}

@media (max-width: 600px) {
    .nv-layout .form-select.vital-unit {
        min-width: 70px;
    }

    .nv-layout table th,
    .nv-layout table td {
        padding-left: 4px;
        padding-right: 4px;
    }
}
.rpt-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

    .rpt-grid > .card {
        min-width: 0;
    }

.rpt-wide {
    grid-column: span 2;
}

@media (max-width: 900px) {
    .rpt-grid {
        grid-template-columns: 1fr;
    }

    .rpt-wide {
        grid-column: auto;
    }
}
/* ── Lab portal ───────────────────────────────────── */
.lp-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.lp-claim {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.lp-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-default);
}

.lp-row--found {
    padding: 10px 0;
}

.lp-bar {
    width: 4px;
    align-self: stretch;
    min-height: 50px;
    border-radius: 2px;
    flex-shrink: 0;
}

.lp-info {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.lp-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 700px) {
    .lp-row {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .lp-info {
        flex: 1 1 calc(100% - 20px);
    }
    /* details use the full width */
    .lp-actions {
        flex: 1 1 100%;
        justify-content: flex-start;
        padding-left: 16px;
    }

    .lp-row--found .btn {
        margin-left: auto;
    }

    .lp-claim > .form-group {
        flex: 1 1 100%;
    }

    .lp-claim .btn {
        flex: 1 1 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .lp-head {
        flex-wrap: wrap;
    }

    /* Upload dialog: one column, full width */
    .modal-frame--wide {
        width: auto;
    }

        .modal-frame--wide .form-grid {
            grid-template-columns: 1fr;
        }

    .modal-footer .btn {
        flex: 1 1 0;
        justify-content: center;
    }
}
/* ── Table pager ──────────────────────────────────── */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 12px;
}

.pager__size {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .pager__size .form-select {
        width: auto;
        min-width: 64px;
    }

.pager__nav {
    display: flex;
    gap: 8px;
}

.pager .btn.aspNetDisabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 600px) {
    .pager {
        justify-content: center;
    }
}
/* ── Sortable table headers ───────────────────────── */
.data-table th .sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

    .data-table th .sort-link:hover {
        text-decoration: underline;
    }

.sort-icon {
    font-size: 13px;
    opacity: .55;
}

.sort-icon--on {
    opacity: 1;
}
.consent-actions {
    display: flex;
    flex-wrap: wrap; /* wraps only when there isn't enough room */
    gap: 8px;
    align-items: center;
}

    .consent-actions .consent-template {
        width: 220px;
        max-width: 100%;
    }

    .consent-actions .consent-file {
        width: 260px;
        max-width: 100%;
    }

    .consent-actions .btn {
        white-space: nowrap;
    }

/* tablets and phones: stack, every control full width */
@media (max-width: 991px) {
    .consent-actions > * {
        flex: 1 1 100%;
    }

    .consent-actions .consent-template,
    .consent-actions .consent-file {
        width: 100%;
    }

    .consent-actions .btn {
        justify-content: center;
        text-align: center;
    }
}
/* Clinic Inventory */
@media (max-width: 600px) {
    /* Search | Receive stock on one row, Add item full width below */
    .search-bar__actions.search-bar__actions--2 {
        grid-template-columns: 1fr 1fr;
    }

    /* every popup form: one column */
    .modal-frame .form-grid {
        grid-template-columns: 1fr;
    }
}
/* ── Info icon inside an input (hover or focus shows the tip) ── */
.input-with-tip {
    position: relative;
}

    .input-with-tip .form-control {
        padding-right: 36px;
    }
/* keeps typed text clear of the icon */
.info-tip {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    cursor: help;
    line-height: 1;
}

.info-tip-text {
    display: none;
    position: absolute;
    right: -8px;
    bottom: 160%;
    width: 220px;
    max-width: 70vw; /* stays on screen on phones */
    padding: 8px 10px;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    text-align: left;
    border-radius: 6px;
    z-index: var(--z-popover);
    box-shadow: var(--shadow-popover);
    pointer-events: none;
}

.info-tip:hover .info-tip-text,
.info-tip:focus .info-tip-text {
    display: block;
}
.export-actions {
    display: flex;
    gap: 8px;
    margin-left: auto; /* push to the right edge of the row */
    padding-left: 16px;
    border-left: 1px solid #e2e8f0; /* subtle divider from the status pills */
}

    .export-actions .export-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 7px 12px;
        font-size: 13px;
        font-weight: 600;
        line-height: 1;
        text-decoration: none;
        color: #334155;
        background: #ffffff;
        border: 1px solid #cbd5e1;
        border-radius: 6px; /* squarer than the pills */
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
        cursor: pointer;
        transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
    }

        .export-actions .export-btn i {
            font-size: 16px;
        }

        .export-actions .export-btn:hover {
            background: #f1f5f9;
            border-color: #94a3b8;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
        }

        .export-actions .export-btn:active {
            transform: translateY(1px);
            box-shadow: none;
        }

        .export-actions .export-btn:focus-visible {
            outline: 2px solid #2563eb;
            outline-offset: 2px;
        }

    /* Keep color only on the icons, so the buttons stay neutral */
    .export-actions .export-btn--excel i {
        color: #16a34a;
    }

    .export-actions .export-btn--pdf i {
        color: #dc2626;
    }