* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f8fb;
    --sidebar: rgba(255, 255, 255, 0.96);

    --panel: rgba(255, 255, 255, 0.92);
    --panel-hover: #f8fbfc;

    --border: #e3e9ef;
    --border-soft: #edf1f4;

    --text: #1f2937;
    --text-strong: #15202b;
    --muted: #7b8a9a;

    --primary: #1aa6a6;
    --primary-dark: #168b8b;
    --primary-soft: #edfafa;

    --success: #2e9f68;
    --success-soft: #edf8f2;

    --warning: #b98416;
    --warning-soft: #fff8e7;

    --danger: #c65a67;
    --danger-soft: #fff1f3;

    --shadow:
        0 8px 24px rgba(17, 24, 39, 0.045);

    --radius: 14px;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(
            circle at 82% 6%,
            rgba(26, 166, 166, 0.055),
            transparent 26%
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;

    font-size: 14px;

    -webkit-font-smoothing: antialiased;
}


/* =========================================
   APP
========================================= */

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


/* =========================================
   SIDEBAR
========================================= */

.sidebar {
    position: fixed;

    inset: 0 auto 0 0;

    width: 230px;

    display: flex;
    flex-direction: column;

    padding: 21px 15px;

    background: var(--sidebar);

    border-right: 1px solid var(--border);

    backdrop-filter: blur(18px);

    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;

    gap: 11px;

    padding: 3px 7px 22px;
}

.brand-mark {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 10px;

    background: var(--primary-soft);

    border: 1px solid #d7eeee;

    color: var(--primary-dark);

    font-size: 16px;
    font-weight: 700;
}

.brand-text {
    display: flex;
    flex-direction: column;

    gap: 2px;
}

.brand-text strong {
    color: var(--text-strong);

    font-size: 14px;
    font-weight: 700;

    letter-spacing: 0.2px;
}

.brand-text span {
    color: var(--muted);

    font-size: 10.5px;
}

.nav {
    display: flex;
    flex-direction: column;

    gap: 5px;
}

.nav-item {
    width: 100%;

    padding: 10px 12px;

    border: 1px solid transparent;

    border-radius: 9px;

    background: transparent;

    color: #607080;

    text-align: left;

    font-size: 12px;
    font-weight: 550;

    cursor: pointer;

    transition:
        background 0.18s,
        border-color 0.18s,
        color 0.18s;
}

.nav-item:hover {
    background: #f7fafb;

    color: var(--text);
}

.nav-item.active {
    color: var(--primary-dark);

    background: var(--primary-soft);

    border-color: #d9eeee;
}

.sidebar-footer {
    margin-top: auto;

    padding: 14px 7px 2px;

    border-top: 1px solid var(--border-soft);

    color: #9aa7b4;

    font-size: 9.5px;
}


/* =========================================
   MAIN
========================================= */

.main {
    width: calc(100% - 230px);

    margin-left: 230px;

    padding: 29px 34px 48px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    max-width: 1450px;

    margin: 0 auto 21px;
}

.eyebrow {
    margin: 0 0 5px;

    color: var(--primary-dark);

    font-size: 9.5px;
    font-weight: 700;

    letter-spacing: 1.25px;

    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;

    color: var(--text-strong);

    font-size: 24px;
    font-weight: 650;

    letter-spacing: -0.45px;
}

.subtitle {
    margin: 7px 0 0;

    color: var(--muted);

    font-size: 11.5px;
    line-height: 1.55;
}

.status-chip {
    padding: 7px 11px;

    border: 1px solid #d9eee3;

    border-radius: 20px;

    background: var(--success-soft);

    color: var(--success);

    font-size: 9.5px;
    font-weight: 650;

    white-space: nowrap;
}


/* =========================================
   PANELS
========================================= */

.panel {
    max-width: 1450px;

    margin: 0 auto 16px;

    padding: 19px;

    background: var(--panel);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    backdrop-filter: blur(12px);

    box-shadow: var(--shadow);
}

.panel-heading,
.analysis-header,
.patient-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 15px;
}

.panel-heading {
    margin-bottom: 16px;
}

.panel h2 {
    margin: 0;

    color: var(--text-strong);

    font-size: 14.5px;
    font-weight: 650;
}

.panel-heading p,
.analysis-header p {
    margin: 5px 0 0;

    color: var(--muted);

    font-size: 10.5px;
    line-height: 1.5;
}


/* =========================================
   SEARCH
========================================= */

.search-form {
    display: grid;

    grid-template-columns:
        minmax(220px, 1.6fr)
        minmax(145px, 0.7fr)
        minmax(145px, 0.7fr)
        auto;

    gap: 10px;

    align-items: end;
}

.field {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.field label {
    color: #687887;

    font-size: 9.5px;
    font-weight: 650;
}

.field input {
    width: 100%;
    height: 38px;

    padding: 0 11px;

    border: 1px solid #dfe6eb;

    border-radius: 8px;

    outline: none;

    background: rgba(255, 255, 255, 0.98);

    color: var(--text);

    font-size: 11.5px;

    transition:
        border-color 0.18s,
        box-shadow 0.18s,
        background 0.18s;
}

.field input:focus {
    border-color: rgba(26, 166, 166, 0.55);

    box-shadow:
        0 0 0 3px rgba(26, 166, 166, 0.08);

    background: white;
}

.field input::placeholder {
    color: #acb7c1;
}

.primary-button,
.secondary-button {
    height: 38px;

    border-radius: 8px;

    font-size: 10.5px;
    font-weight: 650;

    cursor: pointer;

    transition:
        transform 0.15s,
        background 0.15s,
        border-color 0.15s,
        opacity 0.15s;
}

.primary-button {
    min-width: 105px;

    padding: 0 18px;

    border: none;

    background: var(--primary);

    color: white;

    box-shadow:
        0 5px 13px rgba(26, 166, 166, 0.12);
}

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

.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

.primary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.secondary-button {
    padding: 0 14px;

    border: 1px solid var(--border);

    background: white;

    color: #52616f;
}

.secondary-button:hover {
    background: #f7f9fa;

    border-color: #d8e0e6;
}


/* =========================================
   PATIENT
========================================= */

.patient-header h2 {
    margin-top: 0;
}

.patient-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 17px;

    margin-top: 10px;

    color: var(--muted);

    font-size: 10.5px;
}

.patient-meta strong {
    margin-left: 3px;

    color: #425160;

    font-weight: 600;
}


/* =========================================
   PROCEDURES
========================================= */

.count-chip {
    min-width: 28px;

    padding: 5px 8px;

    border-radius: 7px;

    background: var(--primary-soft);

    color: var(--primary-dark);

    text-align: center;

    font-size: 9px;
    font-weight: 700;
}

.procedures-list {
    display: flex;
    flex-direction: column;

    gap: 7px;
}

.procedure-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    min-height: 57px;

    padding: 10px 12px;

    border: 1px solid var(--border-soft);

    border-radius: 9px;

    background: #ffffff;

    transition:
        background 0.18s,
        border-color 0.18s,
        box-shadow 0.18s;
}

.procedure-item:hover {
    background: var(--panel-hover);

    border-color: #dce9e9;

    box-shadow:
        0 3px 10px rgba(15, 23, 42, 0.025);
}

.procedure-info h3 {
    margin: 0 0 4px;

    color: var(--text-strong);

    font-size: 11.5px;
    font-weight: 600;
}

.procedure-info p {
    margin: 0;

    color: var(--muted);

    font-size: 9.5px;
}


/* =========================================
   ANALYSIS
========================================= */

.analysis-header {
    margin-bottom: 16px;
}

.analysis-actions {
    display: flex;

    gap: 7px;
}

.measurements {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 9px;

    margin-bottom: 14px;
}

.measurement-card {
    display: flex;
    flex-direction: column;

    gap: 5px;

    padding: 10px 11px;

    border: 1px solid var(--border-soft);

    border-radius: 9px;

    background: #fbfcfd;
}

.measurement-card span {
    color: #8795a3;

    font-size: 8.5px;

    text-transform: uppercase;

    letter-spacing: 0.65px;
}

.measurement-card strong {
    color: #344250;

    font-size: 11.5px;
    font-weight: 600;
}


/* =========================================
   TABLE
========================================= */

.table-wrap {
    overflow-x: auto;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: white;
}

.analysis-table {
    width: 100%;

    border-collapse: collapse;

    table-layout: fixed;
}

.analysis-table th {
    padding: 10px 11px;

    background: #f7f9fa;

    border-bottom: 1px solid var(--border);

    color: #768594;

    text-align: left;

    font-size: 8.5px;
    font-weight: 700;

    letter-spacing: 0.4px;

    text-transform: uppercase;
}

.analysis-table th:first-child {
    width: 24%;
}

.analysis-table td {
    padding: 10px 11px;

    border-bottom: 1px solid var(--border-soft);

    color: #455463;

    vertical-align: top;

    font-size: 10.5px;
    line-height: 1.45;
}

.analysis-table tbody tr:hover {
    background: #fbfcfc;
}

.analysis-table tbody tr:last-child td {
    border-bottom: none;
}

.analysis-table td:first-child {
    color: #748392;

    font-size: 9.5px;
    font-weight: 650;

    background: #fcfdfd;
}


/* =========================================
   CONFIDENCE
========================================= */

.confidence {
    display: inline-flex;
    align-items: center;

    margin-left: 6px;

    padding: 2px 5px;

    border-radius: 5px;

    font-size: 7.5px;
    font-weight: 700;

    text-transform: uppercase;

    vertical-align: middle;
}

.confidence.high {
    color: #27815a;

    background: #edf8f2;

    border: 1px solid #dcefe4;
}

.confidence.medium {
    color: #9a7015;

    background: #fff8e7;

    border: 1px solid #f4e7bc;
}

.confidence.low {
    color: #b24b59;

    background: #fff1f3;

    border: 1px solid #f3dce0;
}


/* =========================================
   REVIEW
========================================= */

.review-note {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-top: 11px;

    padding: 9px 11px;

    border: 1px solid #f1e5bd;

    border-radius: 8px;

    background: var(--warning-soft);
}

.review-note strong {
    color: #966d14;

    font-size: 8.5px;

    white-space: nowrap;
}

.review-note span {
    color: #7e735d;

    font-size: 8.5px;
}


/* =========================================
   EMPTY STATE
========================================= */

.empty-state {
    max-width: 1450px;

    margin: 78px auto 0;

    text-align: center;

    color: var(--muted);
}

.empty-icon {
    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 12px;

    border: 1px solid #dceeee;

    border-radius: 11px;

    background: var(--primary-soft);

    color: var(--primary-dark);

    font-size: 10px;
    font-weight: 700;
}

.empty-state h3 {
    margin: 0 0 6px;

    color: #425160;

    font-size: 12.5px;
}

.empty-state p {
    max-width: 370px;

    margin: auto;

    color: #8b99a7;

    font-size: 9.5px;
    line-height: 1.6;
}


/* =========================================
   MESSAGES
========================================= */

.message {
    margin-top: 10px;

    padding: 9px 10px;

    border-radius: 7px;

    font-size: 9.5px;
}

.message.error {
    color: #ad4c58;

    background: var(--danger-soft);

    border: 1px solid #f1d9dd;
}

.message.success {
    color: #287b57;

    background: var(--success-soft);

    border: 1px solid #dceee4;
}


/* =========================================
   UTILITIES
========================================= */

.hidden {
    display: none !important;
}


/* =========================================
   SCROLLBAR
========================================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d6dee5;

    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #c6d0d8;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 900px) {

    .sidebar {
        position: relative;

        width: 100%;
        height: auto;

        padding: 13px 15px;

        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-footer {
        display: none;
    }

    .app-shell {
        display: block;
    }

    .main {
        width: 100%;

        margin-left: 0;

        padding: 20px 15px 35px;
    }

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

    .search-form .field:first-child {
        grid-column: 1 / -1;
    }

    .primary-button {
        width: 100%;
    }

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


@media (max-width: 560px) {

    .topbar {
        flex-direction: column;
    }

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

    .search-form .field:first-child {
        grid-column: auto;
    }

    .patient-meta {
        flex-direction: column;

        gap: 6px;
    }

    .analysis-table {
        min-width: 700px;
    }
}

.review-controls {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;

    margin-top: 12px;
}

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

    width: 240px;
}

.reviewer-field label {
    color: #687887;
    font-size: 9.5px;
    font-weight: 650;
}

.reviewer-field input {
    height: 38px;

    padding: 0 11px;

    border: 1px solid #dfe6eb;
    border-radius: 8px;

    outline: none;

    background: white;

    color: #1f2937;

    font-size: 11px;
}

.reviewer-field input:focus {
    border-color: rgba(26, 166, 166, 0.55);

    box-shadow:
        0 0 0 3px rgba(26, 166, 166, 0.08);
}

.review-buttons {
    display: flex;
    gap: 8px;
}

.editable-field {
    display: flex;
    align-items: flex-start;
    gap: 7px;
}

.review-input {
    width: 100%;
    min-height: 37px;

    padding: 7px 8px;

    resize: vertical;

    border: 1px solid #e1e7ec;
    border-radius: 7px;

    outline: none;

    background: #ffffff;

    color: #455463;

    font-family: inherit;
    font-size: 10.5px;
    line-height: 1.4;
}

.review-input:focus {
    border-color: rgba(26, 166, 166, 0.48);

    box-shadow:
        0 0 0 2px rgba(26, 166, 166, 0.07);
}

.editable-field .confidence {
    flex-shrink: 0;
    margin-top: 7px;
    margin-left: 0;
}

.review-input.approved-input {
    resize: none;

    background: #f7f9fa;

    border-color: #e4e9ed;

    color: #435160;

    cursor: default;
}

.reviewer-field input[readonly] {
    background: #f7f9fa;

    color: #435160;

    cursor: default;
}