:root {
    color-scheme: light;
    font-family: Arial, Helvetica, sans-serif;
    color: #1f2937;
    background: #f5f7fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f5f7fb;
}

a {
    color: #0f6f78;
    text-decoration: none;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(420px, 100%);
    padding: 28px;
    background: #ffffff;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(31, 41, 55, 0.08);
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 30px;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 4px;
    font-size: 20px;
}

.muted,
.page-heading p,
.panel-heading span,
.empty {
    color: #64748b;
}

.form-stack {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #b8c3d2;
    border-radius: 6px;
    font: inherit;
    background: #ffffff;
}

textarea {
    resize: vertical;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    background: #0f6f78;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button-link.secondary {
    background: #eef2f7;
    color: #334155;
}

.button-link.compact {
    min-height: 38px;
    padding: 0 13px;
    font-size: 14px;
}

.alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
    background: #e8f5f1;
    color: #166534;
}

.alert.critical {
    background: #fdecec;
    color: #991b1b;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 64px;
    padding: 0 28px;
    background: #ffffff;
    border-bottom: 1px solid #d8e0eb;
}

.topbar div {
    display: flex;
    gap: 12px;
    align-items: baseline;
}

.topbar span {
    color: #64748b;
}

.topbar nav {
    display: flex;
    gap: 16px;
}

.client-dashboard {
    padding-top: 64px;
}

.client-topbar {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.scroll-progress {
    position: fixed;
    z-index: 49;
    top: 64px;
    left: 0;
    right: 0;
    height: 4px;
    background: #e2e8f0;
}

.scroll-progress-bar {
    width: 0;
    height: 100%;
    background: #0f6f78;
    transition: width 120ms linear;
}

.client-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 22px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.metric-card,
.panel {
    background: #ffffff;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
}

.metric-card {
    padding: 20px;
}

.metric-card span {
    display: block;
    margin-bottom: 10px;
    color: #64748b;
    font-size: 14px;
}

.metric-card strong {
    font-size: 34px;
}

.metric-card small {
    display: block;
    margin-top: 10px;
    color: #64748b;
    line-height: 1.35;
}

.kpi-card {
    border-left: 5px solid #94a3b8;
}

.kpi-card strong {
    display: block;
    min-height: 42px;
    font-size: 23px;
    line-height: 1.15;
}

.kpi-card small {
    display: block;
    margin-top: 10px;
    color: #64748b;
}

.kpi-card.good {
    border-left-color: #16a34a;
}

.kpi-card.warning {
    border-left-color: #dc8a00;
}

.kpi-card.critical {
    border-left-color: #b91c1c;
}

.panel {
    padding: 20px;
}

.spaced-panel {
    margin-top: 22px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    gap: 16px;
}

.task-list {
    display: grid;
    gap: 10px;
}

.task-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.task-row strong,
.task-row span {
    display: block;
}

.task-row span {
    margin-top: 4px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.35;
}

.task-row a {
    flex: 0 0 auto;
    font-weight: 700;
}

.summary-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 22px;
}

.summary-panel p {
    margin-bottom: 0;
    color: #475569;
    line-height: 1.6;
}

.diagnosis-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 28px;
    margin-bottom: 22px;
    padding: 26px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #d8e0eb;
    border-left: 7px solid #94a3b8;
}

.diagnosis-hero.good {
    border-left-color: #16a34a;
}

.diagnosis-hero.warning {
    border-left-color: #dc8a00;
}

.diagnosis-hero.critical {
    border-left-color: #b91c1c;
}

.diagnosis-hero span,
.message-card span,
.section-copy span,
.alert-card span {
    display: inline-flex;
    margin-bottom: 8px;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.diagnosis-hero h2 {
    margin-bottom: 10px;
    font-size: 32px;
}

.diagnosis-hero p {
    max-width: 780px;
    margin-bottom: 0;
    color: #475569;
    line-height: 1.6;
}

.comment-sections {
    display: grid;
    gap: 12px;
    max-width: 820px;
}

.comment-sections article {
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.comment-sections strong {
    display: block;
    margin-bottom: 5px;
}

.message-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.message-card {
    padding: 18px;
    border: 1px solid #d8e0eb;
    border-top: 5px solid #94a3b8;
    border-radius: 8px;
    background: #ffffff;
}

.message-card.good {
    border-top-color: #16a34a;
}

.message-card.warning {
    border-top-color: #dc8a00;
}

.message-card.critical {
    border-top-color: #b91c1c;
}

.message-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
}

.message-card p {
    margin-bottom: 0;
    color: #64748b;
    line-height: 1.45;
}

.guided-section {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.section-copy {
    padding: 20px;
    border-radius: 8px;
    background: #102a43;
    color: #ffffff;
}

.section-copy span {
    display: inline-flex;
    width: 30px;
    height: 30px;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.section-copy h2 {
    margin-bottom: 10px;
}

.section-copy p {
    margin-bottom: 0;
    color: #d8e0eb;
    line-height: 1.5;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    margin-bottom: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #475569;
    font-size: 13px;
}

th.actions-column {
    width: 250px;
}

th.menu-column {
    width: 150px;
}

td small {
    display: block;
    margin-top: 4px;
    color: #64748b;
}

td.actions {
    min-width: 250px;
    gap: 7px;
}

td.actions a {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

td.actions a:hover {
    border-color: #0f6f78;
    color: #0f6f78;
}

td.actions a.primary-action {
    border-color: #0f6f78;
    background: #0f6f78;
    color: #ffffff;
}

.menu-cell {
    min-width: 150px;
    text-align: right;
}

.action-menu-button {
    display: inline-flex;
    min-height: 36px;
    gap: 6px;
    align-items: center;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
    font-weight: 700;
    text-transform: none;
}

.action-dropdown {
    width: 210px;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
}

.danger-menu-item {
    width: 100%;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #b91c1c;
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.status {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef2f7;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.status.active {
    background: #dcfce7;
    color: #166534;
}

.status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.status.info {
    background: #e0f2fe;
    color: #075985;
}

.status.good {
    background: #dcfce7;
    color: #166534;
}

.status.warning {
    background: #fef3c7;
    color: #92400e;
}

.status.critical {
    background: #fee2e2;
    color: #991b1b;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.diagnostic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.chart-box {
    position: relative;
    width: 100%;
    height: 320px;
    min-height: 320px;
}

.chart-box canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.alert-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.alert-card {
    padding: 14px;
    border: 1px solid #d8e0eb;
    border-left: 5px solid #94a3b8;
    border-radius: 8px;
    background: #ffffff;
}

.alert-card.good {
    border-left-color: #16a34a;
}

.alert-card.warning {
    border-left-color: #dc8a00;
}

.alert-card.critical {
    border-left-color: #b91c1c;
}

.alert-card p {
    margin: 8px 0 0;
    color: #64748b;
    line-height: 1.45;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.action-panel {
    margin-bottom: 22px;
}

.action-card {
    padding: 16px;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
    background: #ffffff;
}

.action-card span {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 50%;
    background: #0f6f78;
    color: #ffffff;
    font-weight: 700;
}

.action-card strong {
    display: block;
    margin-bottom: 8px;
}

.action-card p {
    margin: 0;
    color: #64748b;
    line-height: 1.45;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.actions form {
    margin: 0;
}

.inline-form {
    margin: 18px 0 0;
}

.link-danger {
    min-height: auto;
    padding: 0;
    background: transparent;
    color: #b91c1c;
    font-weight: 700;
}

.report-page {
    background: #e7edf5;
}

.report-sheet {
    width: min(920px, calc(100% - 32px));
    margin: 28px auto;
    padding: 36px;
    background: #ffffff;
    border-radius: 8px;
}

.report-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    padding-bottom: 22px;
    border-bottom: 2px solid #d8e0eb;
}

.report-header span {
    color: #64748b;
    font-weight: 700;
}

.report-section {
    margin-top: 26px;
}

.report-note {
    margin-top: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.report-note p {
    margin: 6px 0 0;
    color: #475569;
    line-height: 1.5;
}

.print-button {
    white-space: nowrap;
}

@media (max-width: 760px) {
    .topbar,
    .page-heading,
    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .kpi-grid,
    .message-grid,
    .chart-grid,
    .diagnostic-grid,
    .admin-grid,
    .action-grid,
    .alert-grid {
        grid-template-columns: 1fr;
    }

    .task-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .guided-section,
    .kpi-row {
        grid-template-columns: 1fr;
    }

    .summary-panel,
    .diagnosis-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .client-dashboard {
        padding-top: 126px;
    }

    .client-topbar {
        gap: 12px;
    }

    .scroll-progress {
        top: 126px;
    }

    .client-actions {
        justify-content: flex-start;
    }
}

@media print {
    body {
        background: #ffffff;
    }

    .topbar,
    .print-button {
        display: none;
    }

    .report-sheet {
        width: 100%;
        margin: 0;
        padding: 0;
        border-radius: 0;
    }

    .report-section,
    .report-note {
        break-inside: avoid;
    }
}
