:root {
    color-scheme: light;
    --navy: #142c39;
    --teal: #147566;
    --ink: #172d38;
    --muted: #64757c;
    --line: #dce4e5;
    --paper: #fff;
    --background: #f3f6f5;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font:
        15px/1.5 system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

a {
    color: var(--teal);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    height: 85px;
    padding: 0 max(32px, calc((100vw - 1400px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navy);
    color: white;
}

.brand {
    display: flex;
    gap: 13px;
    align-items: center;
    color: white;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.6px;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    background: #80c5b0;
    color: var(--navy);
    width: 39px;
    height: 44px;
    border-radius: 11px;
    font-size: 27px;
}

.brand small {
    display: block;
    font-size: 10px;
    letter-spacing: 1.4px;
    font-weight: 450;
    color: #bdced4;
    text-transform: uppercase;
}

.account {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 13px;
}

.account form {
    margin: 0;
}

.text-button {
    color: #c7e0d7;
    border: 0;
    background: none;
    cursor: pointer;
}

.navigation {
    display: flex;
    gap: 25px;
    align-items: center;
    background: white;
    padding: 0 max(32px, calc((100vw - 1400px) / 2));
    min-height: 57px;
    border-bottom: 1px solid var(--line);
    overflow: auto;
    white-space: nowrap;
}

.navigation a {
    font-size: 13px;
    color: #455f6b;
    padding: 17px 0;
}

.navigation a:hover {
    color: var(--teal);
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 38px 32px 70px;
}

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

h1 {
    font-size: 34px;
    letter-spacing: -1px;
    font-weight: 650;
    margin: 3px 0 8px;
}

h2 {
    font-size: 18px;
    letter-spacing: -0.25px;
    font-weight: 650;
    margin: 0 0 18px;
}

.eyebrow {
    color: var(--teal);
    font-size: 10px;
    letter-spacing: 1.7px;
    text-transform: uppercase;
    font-weight: 750;
    margin: 0 0 4px;
}

.muted {
    color: var(--muted);
    margin: 4px 0;
}

.badge {
    font-size: 12px;
    padding: 7px 13px;
    border-radius: 30px;
    background: #e4ece7;
    color: #446759;
    white-space: nowrap;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.metric {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
    display: grid;
    gap: 10px;
    color: var(--ink);
}

.metric:hover {
    border-color: #70a79a;
    text-decoration: none;
    box-shadow: 0 4px 18px #133c3210;
}

.metric>span {
    font-size: 13px;
    color: #536f7a;
}

.metric strong {
    font-size: 35px;
    letter-spacing: -1px;
    font-weight: 650;
}

.metric small {
    display: flex;
    justify-content: space-between;
    color: var(--teal);
    font-size: 11px;
}

.dashboard-columns {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 24px;
}

.panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 24px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.section-heading a {
    font-size: 12px;
}

.report-row {
    padding: 15px 0;
    border-top: 1px solid #edf0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--ink);
}

.report-row>div {
    display: grid;
    gap: 3px;
}

.report-row strong {
    font-size: 13px;
    font-weight: 600;
}

.report-row span {
    font-size: 12px;
    color: var(--muted);
}

.status {
    background: #f6efd9;
    padding: 5px 10px;
    border-radius: 20px;
    color: #836b26 !important;
    font-size: 10px !important;
}

.status.approved {
    background: #e6f2e8;
    color: #42724e !important;
}

.quick-links {
    display: grid;
}

.quick-links a {
    padding: 15px 0;
    border-top: 1px solid #edf0f0;
    font-weight: 600;
    font-size: 13px;
}

.quick-links span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    margin-top: 3px;
}

.button {
    display: inline-block;
    border: 1px solid var(--line);
    background: white;
    border-radius: 8px;
    color: var(--ink);
    padding: 9px 15px;
    line-height: 1.35;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.button:hover {
    text-decoration: none;
    background: #f1f5f3;
}

.button.primary {
    color: white;
    background: var(--teal);
    border-color: var(--teal);
}

.button.primary:hover {
    background: #0e5f52;
}

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

.record-panel {
    padding: 0;
    overflow: hidden;
}

.searchbar {
    padding: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.searchbar>input {
    max-width: 410px;
    flex: 1;
}

.searchbar>a {
    font-size: 12px;
}

.count {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd7d8;
    border-radius: 7px;
    background: white;
    padding: 9px 11px;
    color: var(--ink);
    min-height: 39px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #66a794;
    outline-offset: 1px;
}

input:disabled,
select:disabled {
    background: #f3f5f4;
}

textarea {
    min-height: 90px;
}

input[type="checkbox"] {
    width: 20px;
    min-height: 20px;
}

.table-scroll {
    overflow: auto;
    max-height: 430px;
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
}

th {
    text-align: left;
    background: #f7f9f8;
    color: #64777d;
    font-size: 10px;
    letter-spacing: 0.4px;
    font-weight: 650;
    padding: 13px 19px;
    border-top: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1;
    min-width: 140px;
}

td {
    padding: 14px 19px;
    border-top: 1px solid #edf1ef;
    white-space: nowrap;
}

tr:hover td {
    background: #f5f9f7;
}

.column-filter {
    font-size: 11px;
    min-height: 29px;
    padding: 4px 7px;
    margin-top: 7px;
    background: white;
}

.record-link {
    font-weight: 550;
}

.pagination {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}

.pagination>div {
    display: flex;
    gap: 8px;
}

.back-link {
    display: inline-block;
    margin-bottom: 19px;
    font-size: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.field {
    min-width: 0;
    position: relative;
}

.field>label {
    display: block;
    margin-bottom: 7px;
    color: #58707a;
    font-size: 12px;
    font-weight: 550;
}

.field .errorlist {
    font-size: 12px;
    color: #ac342e;
    padding-left: 17px;
}

.invalid input {
    border-color: #bc4b42;
}

.errorlist {
    color: #a53530;
}

.more-fields {
    margin-top: 25px;
    border-top: 1px solid var(--line);
    padding-top: 20px;
}

.more-fields summary {
    cursor: pointer;
    color: var(--teal);
    font-size: 13px;
    margin-bottom: 20px;
}

.savebar {
    position: sticky;
    bottom: 0;
    padding: 15px;
    background: #ffffffed;
    backdrop-filter: blur(7px);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5;
    margin-bottom: 24px;
}

.approval {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.approval h2 {
    margin-bottom: 5px;
}

.approval p {
    font-size: 12px;
}

.related-record {
    display: block;
    border-top: 1px solid var(--line);
    padding: 10px 0;
}

.notice {
    padding: 12px 18px;
    border-radius: 8px;
    background: #e5efe8;
    margin-bottom: 22px;
    font-size: 13px;
}

.notice.error {
    background: #fce9e4;
    color: #962f24;
}

.configuration-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.configuration-grid .panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0;
    color: var(--ink);
}

.configuration-grid span {
    font-size: 12px;
    color: var(--teal);
}

.login-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 450px;
    margin: 7vh auto;
}

.login-card h1 {
    font-size: 28px;
}

.login-card .field {
    margin: 20px 0;
}

.login-card .button {
    width: 100%;
    margin-top: 10px;
}

.password-control {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.password-control input {
    min-width: 0;
    flex: 1;
}

.login-card .password-toggle {
    width: auto;
    margin: 0;
    white-space: nowrap;
    min-height: 44px;
}

.password-toggle[hidden] {
    display: none;
}

.empty {
    padding: 35px 20px;
    color: var(--muted);
    text-align: center;
}

footer {
    padding: 20px 32px;
    max-width: 1400px;
    margin: 0 auto;
    color: #819292;
    font-size: 11px;
    display: flex;
    gap: 15px;
}

.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;
}

.combobox {
    position: relative;
}

.combo-input {
    display: flex;
}

.combo-input>input {
    border-radius: 7px 0 0 7px;
    min-width: 0;
}

.combo-toggle {
    border: 1px solid #cbd7d8;
    border-left: 0;
    background: #f8faf8;
    border-radius: 0 7px 7px 0;
    width: 37px;
    cursor: pointer;
}

.combo-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow: auto;
    background: white;
    box-shadow: 0 8px 22px #142c3920;
    border: 1px solid #a9c9bc;
    border-radius: 6px;
    z-index: 10;
}

.combo-options button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    padding: 9px 12px;
    background: white;
    font-size: 13px;
    cursor: pointer;
}

.combo-options button:hover,
.combo-options button:focus {
    background: #e6f0eb;
}

.combo-error {
    font-size: 11px;
    color: #a53530;
}

.combo-options p {
    padding: 0 12px;
    font-size: 12px;
    color: var(--muted);
}

@media (max-width: 850px) {
    .navigation {
        gap: 20px;
        padding: 0 20px;
    }

    .topbar {
        padding: 0 20px;
    }

    .account>span {
        display: none;
    }

    main {
        padding: 25px 18px 50px;
    }

    h1 {
        font-size: 28px;
    }

    .metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .metric {
        padding: 18px;
    }

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

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .configuration-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .panel {
        padding: 20px;
    }

    .record-panel {
        padding: 0;
    }

    .searchbar {
        flex-wrap: wrap;
        padding: 15px;
    }

    .searchbar>input {
        min-width: 140px;
    }

    .count {
        margin-left: 0;
    }
}

@media (max-width: 500px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

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

    .page-heading {
        align-items: flex-start;
    }

    .page-heading .badge {
        max-width: 100px;
        white-space: normal;
        font-size: 10px;
    }

    .page-heading .button {
        padding: 9px;
    }

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

    .login-card {
        padding: 27px;
    }

    .savebar {
        bottom: 0;
    }

    .metrics .metric strong {
        font-size: 29px;
    }
}

.note-entry {
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.note-entry small {
    color: var(--muted);
    font-size: 11px;
}

.note-entry p {
    margin: 6px 0;
    font-size: 13px;
}

.draft-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    justify-content: space-between
}

.draft-summary small,
.draft-summary strong {
    display: block
}

.draft-summary small {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px
}

.draft-summary strong {
    font-size: 14px
}

.calculation-table {
    min-width: 1100px
}

.calculation-table small {
    display: block;
    font-size: 11px;
    color: var(--muted)
}

.calculation-table strong {
    font-weight: 500
}

.calculation-changed {
    background: #edf6f0
}

.old-amount {
    text-decoration: line-through
}

.calculation-details {
    margin-top: 7px;
    font-size: 11px;
    max-width: 270px;
    white-space: normal
}

.calculation-details summary {
    color: var(--teal);
    cursor: pointer
}

.calculation-details dl {
    margin-bottom: 0
}

.calculation-details dt {
    font-weight: 600;
    margin-top: 6px
}

.calculation-details dd {
    margin: 0;
    color: var(--muted)
}

.review-notes { padding:16px 23px }
.review-notes summary { color:var(--teal);cursor:pointer;font-size:13px }
.review-notes .notice { margin-top:12px;margin-bottom:0 }

.searchbar { flex-wrap: wrap; align-items: flex-start; }
.searchbar > select { width: auto; max-width: 240px; }
.searchbar > input { min-width: 190px; }
.column-filter { min-width: 160px; margin-top: 8px; }
.column-filter label { display: block; font-size: 10px; margin-bottom: 4px; }
.table-scroll th:focus-within { z-index: 5; }
.column-filter input, .column-filter select { min-width: 0; width: 100%; }
.combo-actions { display: flex; gap: 12px; margin-top: 5px; }
.combo-actions button { border: 0; padding: 4px 0; background: transparent; color: var(--teal); cursor: pointer; font-size: 11px; }
.combo-options { max-height: min(38vh, 240px); z-index: 20; }
.field, .combobox { min-width: 0; }
.patient-panel .section-heading { flex-wrap: wrap; align-items: center; margin: 0; padding: 20px; }
.patient-panel .section-heading h2 { margin: 0; }
.patient-panel .section-heading span { color: var(--muted); font-size: 12px; }
.mobile-table-hint { display: none; }
@media (max-width: 600px) {
  input, select, textarea, .button, .combo-toggle { min-height: 44px; font-size: 16px; }
  .searchbar { padding: 14px; gap: 10px; }
  .searchbar > input, .searchbar > select { flex: 1 1 100%; max-width: none; min-width: 0; }
  .searchbar .count { margin-left: 0; flex-basis: 100%; }
  .column-filter { min-width: 165px; }
  .column-filter input, .column-filter select { font-size: 16px; }
  .combo-actions button { min-height: 44px; font-size: 13px; }
  .combo-options { min-width: 100%; }
  .combo-options button { min-height: 44px; }
  .savebar { flex-wrap: wrap; gap: 10px; }
  .savebar .button { flex: 1; text-align: center; white-space: normal; }
  .mobile-table-hint { display: block; font-size: 12px; color: var(--muted); margin: 0; padding: 0 14px 10px; }
  .draft-summary { gap: 15px; }
  .draft-summary > div { flex: 1 1 42%; }
  .patient-panel .section-heading { padding: 14px; gap: 10px; }
  td { overflow-wrap: anywhere; }
}
