html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f6f8fb;
    color: #172033;
    max-width: 100%;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

main,
.content,
.panel,
.metric-card,
.table-responsive,
.form-control,
.form-select {
    min-width: 0;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.public-shell {
    min-height: 100vh;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.landing-page {
    background: #f7fbf9;
    color: #172033;
    min-height: 100vh;
}

.landing-hero {
    background:
        linear-gradient(90deg, rgba(12, 35, 38, .74), rgba(12, 35, 38, .38), rgba(12, 35, 38, .1)),
        url("/images/clinic-landing-hero.png") center/cover no-repeat;
    color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 78vh;
    padding: 1.25rem clamp(1rem, 4vw, 4rem) 4rem;
}

.landing-nav {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.carehealth-logo {
    align-items: center;
    color: inherit;
    display: inline-flex;
    font-size: 1.15rem;
    gap: .65rem;
    letter-spacing: .01em;
    text-decoration: none;
}

.carehealth-logo:hover {
    color: inherit;
}

.carehealth-mark {
    align-items: center;
    background: linear-gradient(135deg, #38b89d, #eef8f1);
    border-radius: 8px;
    color: #103d3b;
    display: inline-flex;
    font-size: 1.35rem;
    font-weight: 800;
    height: 2.35rem;
    justify-content: center;
    line-height: 1;
    width: 2.35rem;
}

.landing-copy {
    margin: auto 0;
    max-width: 46rem;
    padding-top: 4rem;
}

.landing-kicker {
    color: #bdebd9;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .12em;
    margin-bottom: .75rem;
    text-transform: uppercase;
}

.landing-copy h1 {
    font-size: clamp(2.45rem, 5vw, 5rem);
    font-weight: 800;
    line-height: .98;
    margin-bottom: 1rem;
    max-width: 44rem;
}

.landing-copy p {
    color: rgba(255, 255, 255, .88);
    font-size: 1.1rem;
    line-height: 1.65;
    max-width: 39rem;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .85rem;
    margin-top: 1.8rem;
}

.landing-actions .btn-primary {
    background: #38b89d;
    border-color: #38b89d;
}

.landing-feature-band {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: -3rem auto 0;
    max-width: 72rem;
    padding: 0 1rem 4rem;
    position: relative;
}

.landing-feature-band article {
    background: rgba(255, 255, 255, .96);
    border: 1px solid #dbeae4;
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(18, 50, 50, .1);
    padding: 1.35rem;
}

.landing-feature-band span {
    color: #38b89d;
    font-weight: 800;
}

.landing-feature-band h2 {
    font-size: 1.15rem;
    margin: .35rem 0 .45rem;
}

.landing-feature-band p {
    color: #536273;
    margin: 0;
}

.page-heading {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-heading > div {
    min-width: 0;
}

.page-heading h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    overflow-wrap: anywhere;
}

.eyebrow {
    color: #487085;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    margin-bottom: .25rem;
    text-transform: uppercase;
}

.metric-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card,
.panel {
    background: #fff;
    border: 1px solid #dbe5eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(21, 39, 58, .05);
}

.metric-card {
    padding: 1rem;
}

.metric-card span {
    color: #5f6f7c;
    display: block;
    font-size: .9rem;
}

.metric-card strong {
    display: block;
    font-size: 2rem;
    margin-top: .25rem;
}

.panel {
    padding: 1.25rem;
}

.panel h2 {
    font-size: 1.1rem;
    margin: 0;
}

.panel-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-header > * {
    min-width: 0;
}

.form-panel {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.form-panel label,
.report-filters label {
    color: #425466;
    font-size: .88rem;
    font-weight: 700;
}

.doctor-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.record-list-item,
.access-request {
    align-items: center;
    border-top: 1px solid #e7edf2;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: .85rem 0;
}

.record-list-item:first-of-type,
.access-request:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.record-list-item span {
    color: #5f6f7c;
    display: block;
    font-size: .9rem;
}

.access-request p {
    margin: .25rem 0;
}

.access-actions {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-width: 8rem;
}

.status-select {
    min-width: 8.5rem;
}

.patient-data-sections {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.patient-data-section {
    border: 1px solid #dbe5eb;
    border-radius: 8px;
    overflow: hidden;
}

.patient-data-section h3 {
    background: #f6f9fb;
    border-bottom: 1px solid #dbe5eb;
    font-size: 1rem;
    margin: 0;
    padding: .8rem .9rem;
}

.patient-summary-table {
    border: 1px solid #dbe5eb;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
}

.summary-row {
    border-bottom: 1px solid #dbe5eb;
    display: grid;
    gap: .35rem;
    padding: .75rem;
}

.patient-data-section .summary-row:last-child {
    border-bottom: 0;
}

.patient-data-section .summary-row:nth-child(odd) {
    border-right: 0;
}

.record-list-item.active-record {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, .18);
}

.summary-row:nth-child(odd) {
    border-right: 1px solid #dbe5eb;
}

.summary-row-wide {
    grid-column: 1 / -1;
}

.summary-row-wide:nth-child(odd) {
    border-right: 0;
}

.summary-row label {
    margin: 0;
}

.summary-static-value {
    align-items: center;
    background: #f6f8fb;
    border: 1px solid #dbe5eb;
    border-radius: .375rem;
    color: #172033;
    display: flex;
    min-height: 2.375rem;
    padding: .375rem .75rem;
}

.top-row {
    gap: .75rem;
}

.top-row form {
    margin: 0;
}

.login-shell {
    display: grid;
    min-height: calc(100vh - 7rem);
    place-items: center;
    padding: 1rem;
}

.public-shell .login-shell {
    background:
        radial-gradient(circle at top left, rgba(56, 184, 157, .18), transparent 32rem),
        linear-gradient(135deg, #f7fbf9, #eef6f3);
    min-height: 100vh;
}

.login-panel {
    background: #fff;
    border: 1px solid #dbe5eb;
    border-radius: 8px;
    box-shadow: 0 14px 35px rgba(21, 39, 58, .08);
    max-width: 28rem;
    padding: 2rem;
    width: 100%;
}

.login-panel h1 {
    font-size: 1.8rem;
    margin-bottom: .5rem;
}

.login-logo {
    color: #172033;
    margin-bottom: 1.25rem;
}

.demo-credentials {
    background: #f6f8fb;
    border: 1px solid #dbe5eb;
    border-radius: 8px;
    display: grid;
    gap: .2rem;
    margin-top: 1.25rem;
    padding: .85rem;
}

.demo-credentials span {
    color: #425466;
    font-size: .9rem;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.chart-tabs-panel {
    display: grid;
    gap: 1.25rem;
}

.chart-tabs {
    border-bottom: 1px solid #dbe5eb;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: .15rem;
}

.chart-tab {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: #425466;
    font-weight: 700;
    padding: .65rem .9rem;
    white-space: nowrap;
}

.chart-tab.active {
    border-bottom-color: #1b6ec2;
    color: #172033;
}

.in-panel {
    margin-bottom: .4rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: .75rem;
}

.chart-record {
    align-items: flex-start;
}

.chart-record p {
    color: #172033;
    margin: .35rem 0 0;
}

.prescription-item-editor {
    border: 1px solid #dbe5eb;
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    margin-bottom: 1rem;
    padding: 1rem;
}

.empty-state {
    background: #f6f8fb;
    border: 1px dashed #cfdbe4;
    border-radius: 8px;
    color: #5f6f7c;
    margin: 0;
    padding: 1rem;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
}

.table-responsive table {
    margin-bottom: 0;
    min-width: 42rem;
}

.table td,
.table th {
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .65rem;
}

.assignment-check-grid {
    display: grid;
    gap: .4rem;
    margin-top: .75rem;
}

.upload-file-list {
    display: grid;
    gap: .75rem;
}

.upload-file-item {
    background: #f6f8fb;
    border: 1px solid #dbe5eb;
    border-radius: 8px;
    display: grid;
    gap: .45rem;
    padding: .75rem;
}

.upload-file-item span {
    color: #5f6f7c;
    display: block;
    font-size: .85rem;
}

.document-card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.document-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    justify-content: space-between;
    min-height: 14rem;
}

.document-card h2 {
    font-size: 1.35rem;
    margin-bottom: .5rem;
}

.print-link-grid,
.check-grid,
.print-check-grid {
    display: grid;
    gap: .75rem;
}

.print-link-grid {
    grid-template-columns: 1fr;
}

.check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-grid label,
.checkbox-line {
    align-items: center;
    display: flex;
    gap: .5rem;
}

.print-sheet {
    background: #fff;
    border: 1px solid #d4dde5;
    border-radius: 8px;
    box-shadow: 0 14px 35px rgba(21, 39, 58, .08);
    color: #111827;
    margin: 1.5rem auto;
    max-width: 58rem;
    min-height: 70rem;
    padding: 2.5rem;
    width: min(100%, 58rem);
}

.document-header {
    align-items: flex-start;
    border-bottom: 2px solid #172033;
    display: flex;
    gap: 2rem;
    justify-content: space-between;
    padding-bottom: 1rem;
}

.document-header > * {
    min-width: 0;
}

.document-header h1 {
    font-size: 1.6rem;
    margin: 0 0 .3rem;
}

.document-header p,
.document-title span,
.signature-row p {
    color: #536273;
    margin: 0;
}

.document-title {
    text-align: right;
}

.document-title strong {
    display: block;
    font-size: 1.45rem;
    text-transform: uppercase;
}

.personalized-clinic-header {
    --header-accent: #172033;
    align-items: stretch;
    flex-direction: column;
    gap: .85rem;
}

.personalized-clinic-header .document-clinic-title {
    width: 100%;
}

.personalized-clinic-header.header-style-classic {
    border-bottom-color: var(--header-accent);
}

.personalized-clinic-header.header-style-centered {
    align-items: center;
    border-bottom-color: var(--header-accent);
    gap: .75rem;
    text-align: center;
}

.personalized-clinic-header.header-style-centered .document-title {
    text-align: center;
}

.personalized-clinic-header.header-style-compact {
    border-bottom: 1px solid var(--header-accent);
    gap: 1rem;
    padding-bottom: .6rem;
}

.personalized-clinic-header.header-style-compact h1 {
    font-size: 1.25rem;
    margin-bottom: .15rem;
}

.personalized-clinic-header.header-style-compact p,
.personalized-clinic-header.header-style-compact .document-title span {
    font-size: .78rem;
}

.personalized-clinic-header.header-style-compact .document-title strong {
    font-size: 1.05rem;
}

.personalized-clinic-header.header-style-modern {
    border-bottom: 2px solid var(--header-accent);
    border-top: .35rem solid var(--header-accent);
    padding-top: .75rem;
}

.document-clinic-subtitle {
    color: var(--header-accent) !important;
    font-weight: 700;
}

.header-info-columns {
    align-items: stretch;
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    min-width: 0;
    width: 100%;
}

.header-info-column {
    background: var(--header-column-bg, color-mix(in srgb, var(--header-accent) 6%, #fff));
    border-left: 3px solid var(--header-column-border, var(--header-accent));
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--header-accent) 18%, transparent);
    padding: .65rem .75rem;
    text-align: var(--header-column-align, left);
}

.header-info-column-style-plain {
    background: var(--header-column-bg, transparent);
    border-left-color: var(--header-column-border, transparent);
    box-shadow: none;
}

.header-info-column-style-outline {
    background: var(--header-column-bg, #fff);
    border: 1px solid var(--header-column-border, color-mix(in srgb, var(--header-accent) 45%, #dbe5eb));
    border-left-width: 3px;
}

.header-info-column-style-accent {
    background: var(--header-column-bg, color-mix(in srgb, var(--header-accent) 14%, #fff));
    border-left-color: var(--header-column-border, var(--header-accent));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--header-accent) 24%, transparent);
}

.header-info-title {
    color: var(--header-column-title-color, var(--header-accent));
    display: block;
    font-size: var(--header-column-title-size, .78rem);
    font-weight: 800;
    letter-spacing: .04em;
    margin-bottom: .2rem;
    text-transform: uppercase;
}

.header-info-text {
    color: var(--header-column-text-color, #425466);
    font-size: var(--header-column-text-size, .88rem);
    line-height: 1.35;
    white-space: pre-line;
}

.personalized-clinic-header.header-style-centered .header-info-columns {
    width: min(100%, 42rem);
}

.personalized-clinic-header.header-style-centered .header-info-column {
    border-left: 0;
    border-top: 3px solid var(--header-column-border, var(--header-accent));
    padding: .65rem .75rem;
}

.personalized-clinic-header.header-style-compact .header-info-columns {
    gap: .5rem;
}

.personalized-clinic-header.header-style-compact .header-info-column {
    border-radius: 4px;
    padding: .45rem .55rem;
}

.personalized-clinic-header.header-style-compact .header-info-title,
.personalized-clinic-header.header-style-compact .header-info-text {
    font-size: .78rem;
}

.document-patient-grid {
    border: 1px solid #d4dde5;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 1.5rem 0;
}

.document-patient-grid div {
    border-bottom: 1px solid #d4dde5;
    padding: .75rem;
}

.document-patient-grid div:nth-child(odd) {
    border-right: 1px solid #d4dde5;
}

.document-patient-grid div:nth-last-child(-n+2) {
    border-bottom: 0;
}

.document-patient-grid span {
    color: #536273;
    display: block;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.document-section {
    margin-top: 1.5rem;
}

.document-section h2 {
    border-bottom: 1px solid #d4dde5;
    font-size: 1rem;
    margin-bottom: .75rem;
    padding-bottom: .35rem;
    text-transform: uppercase;
}

.print-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: .75rem;
}

.rx-body {
    display: grid;
    gap: 1rem;
    grid-template-columns: 5rem 1fr;
    margin: 2rem 0;
    min-height: 18rem;
}

.prescription-sheet {
    display: flex;
    flex-direction: column;
    font-size: .9rem;
}

.prescription-sheet .document-patient-grid {
    border: 0;
    gap: .2rem 1rem;
    grid-template-columns: 1.15fr .95fr;
    margin: .75rem 0 1rem;
}

.prescription-sheet .document-patient-grid div {
    border: 0;
    padding: .42rem .55rem;
}

.prescription-sheet .document-patient-grid span {
    font-size: .66rem;
    letter-spacing: .02em;
}

.prescription-sheet .document-patient-grid strong {
    display: block;
    font-size: .8rem;
    line-height: 1.25;
}

.prescription-sheet .rx-body {
    gap: .65rem;
    grid-template-columns: 3.25rem 1fr;
    margin: 1.25rem 0;
    min-height: 10rem;
}

.prescription-sheet .signature-row {
    margin-top: auto;
}

.prescription-sheet .rx-symbol {
    font-size: 2.15rem;
}

.prescription-items {
    display: grid;
    gap: var(--rx-row-spacing, .55rem);
}

.prescription-print-item {
    border-bottom: 1px solid rgba(15, 23, 42, .12);
    padding: .15rem 0 .45rem;
}

.prescription-medicine-line {
    align-items: baseline;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.prescription-medicine-line strong {
    font-size: var(--rx-medicine-size, .86rem);
    font-weight: 700;
}

.prescription-medicine-line span {
    flex: 0 0 4rem;
    font-size: var(--rx-quantity-size, .8rem);
    font-weight: 700;
    text-align: right;
}

.prescription-sig-line,
.prescription-notes-line {
    line-height: 1.35;
}

.prescription-sig-line {
    font-size: var(--rx-sig-size, .76rem);
}

.prescription-notes-line {
    font-size: var(--rx-sig-size, .76rem);
}

.prescription-sig-line {
    margin-top: .1rem;
}

.prescription-sig-line span {
    font-weight: 700;
}

.prescription-notes-line {
    color: #64748b;
    margin-top: .05rem;
}

.rx-symbol {
    font-family: Georgia, serif;
    font-size: 3rem;
    font-weight: 700;
}

.rx-body pre {
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 1rem;
    margin: 0;
    white-space: pre-wrap;
}

.clearance-statement {
    font-size: 1.05rem;
    line-height: 1.7;
}

.medical-abstract-sheet {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.medical-abstract-header {
    margin-bottom: .25rem;
}

.medical-abstract-section {
    break-inside: avoid;
}

.medical-abstract-section h2 {
    border-bottom: 1px solid #dbe5eb;
    color: #172033;
    font-size: .92rem;
    letter-spacing: .04em;
    margin: 0 0 .4rem;
    padding-bottom: .25rem;
    text-transform: uppercase;
}

.medical-abstract-section p {
    color: #334155;
    line-height: 1.6;
    margin: 0;
    white-space: pre-line;
}

.medical-abstract-signature {
    margin-top: auto;
    padding-top: 2rem;
}

.doctor-signature-image {
    display: block;
    height: 3rem;
    margin: 0 auto .5rem;
    max-width: 12rem;
    object-fit: contain;
}

.signature-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 5rem;
}

.signature-row div {
    max-width: 100%;
    min-width: min(18rem, 100%);
    text-align: center;
}

.signature-row span {
    border-bottom: 1px solid #111827;
    display: block;
    height: 3rem;
    margin-bottom: .5rem;
}

.personalized-document-template {
    display: flex;
    flex: 1;
    flex-direction: column;
    position: relative;
}

.document-watermark {
    color: #0f172a;
    font-weight: 800;
    left: 50%;
    letter-spacing: .08em;
    pointer-events: none;
    position: absolute;
    text-transform: uppercase;
    top: 44%;
    transform: translate(-50%, -50%) rotate(-32deg);
    white-space: nowrap;
    z-index: 0;
}

.document-watermark-repeat {
    align-content: center;
    display: grid;
    gap: 2rem 3rem;
    grid-template-columns: repeat(3, max-content);
    inset: 0;
    justify-content: center;
    left: 0;
    overflow: hidden;
    top: 0;
    transform: rotate(-28deg);
    white-space: nowrap;
}

.document-watermark-repeat span {
    display: inline-block;
}

.document-watermark-image {
    left: 50%;
    max-height: 45%;
    max-width: 55%;
    object-fit: contain;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    z-index: 0;
}

.document-template-block {
    align-self: flex-start;
    max-width: 100%;
    position: relative;
    width: var(--template-block-width, 100%);
    z-index: 1;
}

.document-template-block + .document-template-block {
    margin-top: 1rem;
}

.document-template-block.align-center {
    align-self: center;
    text-align: center;
}

.document-template-block.align-right {
    align-self: flex-end;
    text-align: right;
}

.document-template-text {
    line-height: 1.7;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.document-template-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.document-template-image {
    max-height: 12rem;
    max-width: 100%;
    object-fit: contain;
}

.document-template-signature {
    margin-top: 2rem;
}

.template-editor-layout {
    align-items: start;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(20rem, .9fr) minmax(24rem, 1.1fr);
}

.template-editor-panel {
    position: sticky;
    top: 1rem;
}

.template-actions,
.placeholder-palette {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

.template-actions .btn,
.placeholder-palette .btn {
    white-space: normal;
}

.template-block-editor {
    background: #f8fafc;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    margin-top: 1rem;
    padding: 1rem;
    min-width: 0;
}

.template-header-editor {
    display: grid;
    gap: .75rem;
}

.template-header-editor h3 {
    font-size: .95rem;
    margin: 0;
}

.template-column-style-panel {
    background: #fff;
    border: 1px solid #dbe5eb;
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    margin-top: .75rem;
    padding: .75rem;
}

.template-column-style-panel h4 {
    font-size: .9rem;
    margin: 0;
}

.template-color-input {
    min-height: 2.35rem;
    min-width: 4.5rem;
    padding: .2rem;
}

.template-drag-handle {
    cursor: grab;
}

.template-visible-toggle {
    align-items: end;
    display: flex;
}

.template-image-preview {
    align-items: center;
    display: flex;
    gap: 1rem;
    margin-top: .75rem;
}

.template-image-preview img {
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 6px;
    max-height: 6rem;
    max-width: 10rem;
    object-fit: contain;
    padding: .25rem;
}

.template-preview-panel {
    min-width: 0;
    overflow-x: auto;
}

.template-preview-sheet {
    margin-top: 1rem;
    min-height: 48rem;
}

.rx-lines {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.signature-canvas {
    aspect-ratio: 3 / 1;
    background: #fff;
    border: 1px dashed #94a3b8;
    border-radius: .75rem;
    cursor: crosshair;
    touch-action: none;
    width: 100%;
}

.signature-preview {
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    display: flex;
    min-height: 10rem;
    padding: 1rem;
}

.signature-preview img,
.printed-signature {
    display: block;
    margin: 0 auto;
    max-height: 4rem;
    max-width: 16rem;
    object-fit: contain;
}

.app-toast-container {
    display: grid;
    gap: .75rem;
    position: fixed;
    right: 1.25rem;
    top: 1.25rem;
    width: min(24rem, calc(100vw - 2rem));
    z-index: 2000;
}

.app-toast {
    align-items: center;
    border: 1px solid transparent;
    border-radius: .75rem;
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, .16);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    line-height: 1.4;
    padding: .9rem 1rem;
}

.app-toast button {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    opacity: .72;
}

.app-toast-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.app-toast-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.app-toast-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.calendar-toolbar {
    align-items: center;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.calendar-toolbar > strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.calendar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.appointment-calendar {
    display: grid;
    gap: .75rem;
}

.appointment-calendar-week {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.appointment-calendar-day {
    grid-template-columns: 1fr;
}

.calendar-day {
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: .75rem;
    min-height: 13rem;
    padding: .75rem;
    min-width: 0;
}

.calendar-day header {
    align-items: baseline;
    display: flex;
    justify-content: space-between;
    margin-bottom: .65rem;
    gap: .5rem;
}

.calendar-day header span {
    color: #64748b;
    font-size: .82rem;
}

.calendar-empty {
    font-size: .82rem;
    margin: 0;
    padding: .75rem .25rem;
}

.calendar-appointment-card {
    background: #fff;
    border: 1px solid rgba(37, 99, 235, .16);
    border-left: 3px solid var(--role-accent);
    border-radius: .65rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
    color: #172033;
    display: grid;
    gap: .12rem;
    margin-bottom: .55rem;
    padding: .65rem;
    text-align: left;
    width: 100%;
}

.calendar-appointment-card:hover,
.calendar-appointment-card:focus {
    border-color: var(--role-accent);
}

.calendar-appointment-card span,
.calendar-appointment-card small,
.calendar-appointment-card em {
    overflow-wrap: anywhere;
}

.calendar-appointment-card small,
.calendar-appointment-card em {
    color: #64748b;
    font-size: .76rem;
}

.calendar-appointment-card em {
    font-style: normal;
}

@media (max-width: 900px) {
    .content {
        padding-top: .85rem;
    }

    .metric-grid,
    .doctor-grid,
    .document-card-grid,
    .landing-feature-band {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .appointment-calendar-week {
        grid-template-columns: 1fr;
    }

    .template-editor-layout {
        grid-template-columns: 1fr;
    }

    .template-editor-panel {
        position: static;
    }

    .template-preview-panel {
        border: 1px solid #dbe5eb;
        border-radius: 8px;
        padding: .75rem;
    }

    .template-preview-sheet,
    .print-sheet {
        min-width: 42rem;
    }

    .calendar-day {
        min-height: auto;
    }
}

.activity-timeline {
    display: grid;
    gap: .85rem;
}

.activity-timeline-item {
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    display: grid;
    gap: 1rem;
    grid-template-columns: 12rem 1fr;
    padding: .85rem 0;
}

.activity-time {
    color: #64748b;
    font-size: .88rem;
}

.activity-body p {
    margin: .35rem 0;
}

.activity-title {
    align-items: center;
    display: flex;
    gap: .5rem;
}

.announcement-banner {
    align-items: center;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: .75rem;
    color: #14532d;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: .85rem 1rem;
}

.announcement-banner > div {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.announcement-banner button,
.announcement-modal-header button {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 1.4rem;
    line-height: 1;
}

.announcement-type {
    background: rgba(22, 101, 52, .12);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .2rem .5rem;
    text-transform: uppercase;
}

.announcement-modal-backdrop {
    align-items: center;
    background: rgba(15, 23, 42, .42);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1rem;
    position: fixed;
    z-index: 1080;
}

.announcement-modal {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .24);
    max-height: min(86vh, 48rem);
    max-width: 44rem;
    overflow: auto;
    padding: 1.25rem;
    width: min(100%, 44rem);
}

.announcement-modal-header {
    align-items: start;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
}

.announcement-modal-header h2 {
    font-size: 1.35rem;
    margin: 0;
}

.announcement-modal-group {
    display: grid;
    gap: .6rem;
    margin-top: 1rem;
}

.announcement-modal-group h3 {
    color: #334155;
    font-size: .9rem;
    margin: 0;
    text-transform: uppercase;
}

.announcement-card {
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .7rem;
    padding: .8rem;
}

.announcement-card p {
    margin: .35rem 0;
}

.announcement-card span,
.announcement-card li {
    color: #64748b;
    font-size: .85rem;
}

.announcement-card ul {
    margin: .35rem 0;
    padding-left: 1.2rem;
}

.announcement-doctor-picker {
    border: 1px solid #dbe4ef;
    border-radius: .65rem;
    display: grid;
    gap: .35rem;
    max-height: 12rem;
    overflow: auto;
    padding: .75rem;
}

.history-section {
    border-top: 1px solid rgba(15, 23, 42, .08);
    display: grid;
    gap: .5rem;
    margin-top: 1rem;
    padding-top: 1rem;
}

.history-section h3 {
    color: #334155;
    font-size: .95rem;
    margin: 0;
}

.history-option-row {
    display: grid;
    gap: .4rem;
}

@media (max-width: 640px) {
    .content {
        padding-top: .65rem;
    }

    .page-heading,
    .panel-header,
    .record-list-item,
    .access-request,
    .signature-row {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading {
        gap: .75rem;
        margin-bottom: 1rem;
    }

    .page-heading h1 {
        font-size: 1.55rem;
    }

    .page-heading .btn,
    .page-heading a.btn,
    .panel-header .btn {
        width: 100%;
    }

    .panel {
        padding: .9rem;
    }

    .metric-card {
        padding: .85rem;
    }

    .metric-card strong {
        font-size: 1.6rem;
    }

    .metric-grid,
    .doctor-grid,
    .document-card-grid,
    .landing-feature-band,
    .check-grid,
    .patient-data-sections,
    .patient-summary-table,
    .document-patient-grid,
    .print-check-grid,
    .template-editor-layout {
        grid-template-columns: 1fr;
    }

    .chart-tabs {
        flex-wrap: nowrap;
        margin-left: -.25rem;
        margin-right: -.25rem;
        padding-left: .25rem;
        padding-right: .25rem;
    }

    .chart-tab {
        flex: 0 0 auto;
        padding: .6rem .75rem;
    }

    .action-row,
    .form-actions,
    .access-actions,
    .attachment-list {
        align-items: stretch;
        flex-direction: column;
    }

    .action-row .btn,
    .form-actions .btn,
    .access-actions .btn,
    .attachment-list .btn {
        width: 100%;
    }

    .table-responsive {
        margin-left: -.25rem;
        margin-right: -.25rem;
        padding-bottom: .35rem;
    }

    .template-image-preview {
        align-items: stretch;
        flex-direction: column;
    }

    .document-header {
        flex-direction: column;
        gap: .85rem;
    }

    .header-info-columns {
        flex-basis: auto;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .document-patient-grid div,
    .document-patient-grid div:nth-child(odd),
    .document-patient-grid div:nth-last-child(-n+2) {
        border-right: 0;
    }

    .document-patient-grid div {
        border-bottom: 1px solid #dbe5eb;
    }

    .document-patient-grid div:last-child {
        border-bottom: 0;
    }

    .print-check-grid {
        gap: .45rem;
    }

    .signature-row {
        align-items: stretch;
        margin-top: 2rem;
    }

    .signature-row div {
        width: 100%;
    }

    .rx-body,
    .prescription-sheet .rx-body {
        grid-template-columns: 2.25rem 1fr;
        min-height: auto;
    }

    .prescription-medicine-line {
        gap: .65rem;
    }

    .summary-row,
    .summary-row:nth-child(odd) {
        border-right: 0;
    }

    .landing-hero {
        min-height: 86vh;
    }

    .landing-copy {
        padding-top: 2.5rem;
    }

    .activity-timeline-item {
        grid-template-columns: 1fr;
        gap: .45rem;
    }

    .activity-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .announcement-banner,
    .announcement-banner > div,
    .announcement-modal-header {
        align-items: stretch;
        flex-direction: column;
    }

    .calendar-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .calendar-nav,
    .calendar-toolbar .btn-group {
        width: 100%;
    }

    .calendar-nav .btn,
    .calendar-toolbar .btn-group .btn {
        flex: 1;
    }

    .calendar-day header {
        align-items: flex-start;
        flex-direction: column;
    }

    .template-actions,
    .placeholder-palette {
        display: grid;
        grid-template-columns: 1fr;
    }

    .template-block-editor {
        padding: .85rem;
    }

    .template-preview-panel {
        margin-left: -.15rem;
        margin-right: -.15rem;
        padding: .5rem;
    }

    .login-panel {
        padding: 1.25rem;
    }

    .announcement-modal-backdrop {
        align-items: stretch;
        padding: .5rem;
    }

    .announcement-modal {
        border-radius: .75rem;
        max-height: calc(100vh - 1rem);
        padding: 1rem;
    }
}

@media (max-width: 420px) {
    .landing-nav,
    .landing-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .landing-actions .btn {
        width: 100%;
    }

    .page-heading .d-flex,
    .panel-header .d-flex,
    .d-flex.justify-content-between.align-items-center {
        align-items: stretch !important;
        flex-direction: column;
        gap: .5rem;
    }

    .d-flex.justify-content-between.align-items-center .btn {
        width: 100%;
    }
}

@media print {
    body {
        background: #fff;
    }

    .sidebar,
    .top-row,
    .no-print,
    #blazor-error-ui,
    script {
        display: none !important;
    }

    main,
    .content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-sheet {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
        max-width: none;
        min-height: auto;
        padding: .25in;
    }

    .prescription-sheet {
        font-size: .82rem;
    }

    .prescription-medicine-line strong {
        font-size: var(--rx-medicine-size, .78rem);
    }

    .prescription-medicine-line span {
        font-size: var(--rx-quantity-size, .72rem);
    }

    .prescription-sig-line,
    .prescription-notes-line {
        font-size: var(--rx-sig-size, .72rem);
    }

    .document-header {
        break-inside: avoid;
    }

    .document-section,
    .signature-row,
    .document-template-block {
        break-inside: avoid;
    }

    .document-watermark,
    .document-watermark-image {
        position: fixed;
    }
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.error-log-message {
    max-width: 22rem;
    white-space: normal;
    word-break: break-word;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
