@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
:root {
    --brand-primary: #2C84C1;
    --brand-primary-dark: #236FA4;
    --brand-primary-soft: #E7F2FA;
    --brand-success: #27AE60;
    --brand-success-soft: #E9F7EF;
    --brand-warning: #F59E0B;
    --brand-error: #EB5757;
    --brand-info: #2C84C1;
    --brand-edit: #91B842;
    --brand-edit-dark: #7A9E38;

    --text-primary: #1F2937;
    --text-secondary: #374151;
    --border-subtle: #E5E7EB;
    --page-bg: #F9FAFB;
    --card-bg: #FFFFFF;

    --radius-md: 8px;
    --radius-sm: 6px;
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--page-bg);
    color: var(--text-primary);
}

.smart-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.ss-smart-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.smart-table td {
    padding: 6px 12px;
    line-height: 1.2;
    vertical-align: middle;
}

.ss-smart-table td {
    padding: 6px 12px;
    line-height: 1.2;
    vertical-align: middle;
}

.smart-table tbody tr:nth-child(even) > * {
    background-color: rgba(31, 41, 55, 0.02);
}

.ss-smart-table tbody tr:nth-child(even) > * {
    background-color: rgba(31, 41, 55, 0.02);
}

.smart-table-search input {
    border-color: var(--border-subtle);
}

.smart-table-footer {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 12px;
}

.smart-table tbody tr:hover {
    background-color: var(--brand-primary-soft);
}

.smart-table tbody tr:hover > * {
    background-color: var(--brand-primary-soft);
}

.ss-smart-table .ss-smart-link-cell {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
}

.ss-smart-table .ss-smart-link {
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.18s ease;
}

.ss-smart-table .ss-smart-link:hover {
    color: var(--brand-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ss-smart-table .ss-smart-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    color: var(--brand-primary);
    background: var(--brand-primary-soft);
    border-radius: 6px;
    padding: 3px 5px;
    margin-left: 6px;
    text-decoration: none;
    flex-shrink: 0;
}

.ss-smart-table .ss-smart-edit-btn:hover {
    background: var(--brand-primary);
    color: #ffffff;
}

.ss-smart-table tbody tr:hover > td,
.ss-smart-table tbody tr:focus-within > td {
    background-color: var(--brand-primary-soft);
}

.ss-smart-table tbody tr:hover .ss-smart-edit-btn,
.ss-smart-table tbody tr:focus-within .ss-smart-edit-btn {
    opacity: 1;
}

.ss-smart-table .ss-smart-sort-icon {
    display: inline-flex;
    width: 0.95rem;
    height: 0.95rem;
    margin-left: 0.2rem;
    vertical-align: middle;
    flex-shrink: 0;
}

.ss-smart-table .ss-smart-sort-icon svg {
    width: 100%;
    height: 100%;
}

.ss-smart-table .ss-smart-sort-icon path {
    fill: currentColor;
    opacity: 0.35;
    transition: opacity 0.15s ease;
}

.ss-smart-table .ss-smart-sort-icon.is-asc .ss-smart-sort-icon-up,
.ss-smart-table .ss-smart-sort-icon.is-desc .ss-smart-sort-icon-down {
    opacity: 1;
}

.ss-smart-title-trailing {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.ss-smart-settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1050;
}

.ss-smart-settings-modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ss-smart-settings-modal {
    width: min(900px, 96vw);
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ss-smart-settings-modal .card-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #ffffff;
    flex-shrink: 0;
}

.ss-smart-settings-modal .card-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ss-smart-error-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1070;
}

.ss-smart-error-modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ss-smart-error-modal {
    width: min(760px, 96vw);
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-top: 4px solid var(--brand-error);
}

.ss-smart-error-modal .card-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #ffffff;
    flex-shrink: 0;
}

.ss-smart-error-modal .card-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ss-smart-error-modal .card-footer {
    background-color: #ffffff;
    flex-shrink: 0;
}

.ss-smart-error-details {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8f9fa;
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    max-height: 38vh;
    overflow: auto;
    font-size: 0.9rem;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.ss-smart-view-name-input,
.ss-smart-view-select {
    min-width: 240px;
    max-width: 360px;
}

.ss-smart-view-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.55rem 0.3rem 0.7rem;
    border: 1px solid rgba(31, 41, 55, 0.12);
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    box-shadow: 0 1px 2px rgba(31, 41, 55, 0.08);
}

.ss-smart-view-picker-label {
    margin: 0;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary);
    user-select: none;
}

.ss-smart-view-select-header {
    min-width: 240px;
    max-width: 420px;
    border-radius: 999px;
    border-color: rgba(31, 41, 55, 0.18);
    background-color: #ffffff;
    font-weight: 500;
    color: var(--text-primary);
}

.ss-smart-view-select-header:focus {
    border-color: rgba(44, 132, 193, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(44, 132, 193, 0.15);
}

@media (max-width: 576px) {
    .ss-smart-view-picker {
        width: 100%;
        justify-content: space-between;
    }

    .ss-smart-view-select-header {
        min-width: 0;
        width: 100%;
        max-width: none;
    }
}

.ss-smart-settings-column-row {
    border: 1px solid rgba(31, 41, 55, 0.08);
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
    background: #ffffff;
}

.ss-smart-filter-builder {
    --kendo-color-primary: var(--brand-primary);
    --kendo-color-primary-hover: var(--brand-primary-dark);
    --kendo-color-primary-active: var(--brand-primary-dark);
    --kendo-color-primary-subtle: rgba(44, 132, 193, 0.12);
    --kendo-color-primary-subtle-hover: rgba(44, 132, 193, 0.18);
    --kendo-color-primary-subtle-active: rgba(44, 132, 193, 0.24);
    --kendo-color-primary-emphasis: rgba(44, 132, 193, 0.28);
    --kendo-color-primary-on-subtle: var(--brand-primary-dark);
    --kendo-color-primary-on-surface: var(--brand-primary);
    --kendo-color-on-primary: #ffffff;
    padding: 0.9rem;
    border: 1px solid rgba(44, 132, 193, 0.14);
    border-radius: 0.9rem;
    background: linear-gradient(180deg, rgba(44, 132, 193, 0.06), rgba(44, 132, 193, 0.02));
}

.ss-smart-filter-builder .k-filter,
.ss-smart-filter-builder .k-toolbar,
.ss-smart-filter-builder .k-filter-toolbar {
    background: transparent;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.status-final {
    background: var(--brand-success-soft);
    color: var(--brand-success);
    border-color: rgba(39, 174, 96, 0.35);
}

.status-inprogress {
    background: rgba(245, 158, 11, 0.15);
    color: #B45309;
    border-color: rgba(245, 158, 11, 0.35);
}

.status-pending {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
    border-color: rgba(47, 128, 237, 0.35);
}

.status-default {
    background: #EEF1F5;
    color: #3F4756;
    border-color: #D9DEE5;
}

.status-ordered {
    background: #EEF1F5;
    color: #3F4756;
    border-color: #D9DEE5;
}

.status-cancelled {
    background: rgba(220, 53, 69, 0.1);
    color: #B42318;
    border-color: rgba(220, 53, 69, 0.35);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--brand-primary);
}

.top-nav .menu-flyout .menu-item {
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: 0;
    text-align: left;
}

.top-nav .menu-flyout .menu-action {
    width: 100%;
}

.top-nav .menu-flyout .menu-item:hover,
.top-nav .menu-flyout .menu-item:focus,
.top-nav .menu-flyout .menu-item:active,
.top-nav .menu-flyout .menu-item.active {
    color: var(--text-primary) !important;
    text-decoration: none !important;
}

.top-nav .brand-link img {
    max-height: 30px;
    max-width: 160px;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.btn-primary {
    color: #fff;
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}

.btn-outline-primary {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    border-radius: var(--radius-sm);
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.smart-table .btn-edit {
    color: var(--brand-edit);
    border-color: var(--brand-edit);
}

.smart-table .btn-edit:hover,
.smart-table .btn-edit:focus,
.smart-table .btn-edit:active {
    color: #fff;
    background-color: var(--brand-edit);
    border-color: var(--brand-edit);
}

.ss-smart-table .btn-edit {
    color: var(--brand-edit);
    border-color: var(--brand-edit);
}

.ss-smart-table .btn-edit:hover,
.ss-smart-table .btn-edit:focus,
.ss-smart-table .btn-edit:active {
    color: #fff;
    background-color: var(--brand-edit);
    border-color: var(--brand-edit);
}

.btn-success {
    background-color: var(--brand-success);
    border-color: var(--brand-success);
    border-radius: var(--radius-sm);
}

.btn-success:hover {
    background-color: #219653;
    border-color: #219653;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.card.shadow-sm {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(47, 128, 237, 0.35);
}

.content {
    padding-top: 1.1rem;
}

h1 {
    font-size: 28px;
    font-weight: 600;
}

h2, h3 {
    font-size: 20px;
    font-weight: 600;
}

.card-title, h4, h5 {
    font-size: 16px;
    font-weight: 600;
}

body, p, label, input, textarea, select, button {
    font-size: 14px;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eG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1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress-wrap {
    position: relative;
    width: 8rem;
    height: 8rem;
    margin: 0.5rem auto 0;
}

.loading-progress {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #2C84C1;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 700;
}

.loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

.auth-page {
    min-height: calc(100vh - 96px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.auth-card {
    width: min(420px, 100%);
    text-align: center;
}

.auth-card .form-label {
    text-align: left;
    display: block;
}

.auth-card .mb-3 {
    text-align: left;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.auth-logo {
    max-width: 216px;
    height: auto;
}

.logo-preview-frame {
    width: 100%;
    aspect-ratio: 4 / 1;
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f8f9fa;
}

.logo-preview-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.auth-title {
    margin-bottom: 1.5rem;
}

.snackbar {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: #fff;
    background: var(--brand-success);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    font-size: 0.95rem;
    max-width: min(720px, 92vw);
    text-align: center;
}

.snackbar-success {
    background: var(--brand-success);
}

.snackbar-error {
    background: var(--brand-error);
}

.snackbar-info {
    background: var(--brand-info);
}

.hl7-pre {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 60vh;
    overflow: auto;
    background: #f8f9fa;
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin: 0;
}
