:root {
    color-scheme: light;
    --ink: #183231;
    --ink-soft: #5f716f;
    --teal: #0f5954;
    --teal-dark: #0a423e;
    --teal-pale: #e7f1ef;
    --gold: #c99552;
    --gold-pale: #f8eddc;
    --paper: #ffffff;
    --canvas: #f5f4ef;
    --line: #dfe4e1;
    --line-strong: #cbd4d0;
    --danger: #a33a3a;
    --danger-pale: #fbeaea;
    --success: #24715f;
    --shadow: 0 16px 44px rgba(25, 53, 51, 0.09);
    --shadow-soft: 0 8px 24px rgba(25, 53, 51, 0.06);
    --radius: 18px;
    --radius-small: 11px;
    --sidebar-width: 258px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background: var(--canvas);
}

body {
    min-height: 100vh;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
    background: var(--canvas);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

button {
    color: inherit;
}

[hidden] {
    display: none !important;
}

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

h1,
h2,
h3 {
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
    letter-spacing: -0.025em;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(31px, 3.4vw, 46px);
    line-height: 1.08;
}

h2 {
    margin-bottom: 0;
    font-size: 24px;
    line-height: 1.2;
}

.eyebrow {
    margin-bottom: 7px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-lockup > span:last-child {
    display: grid;
    line-height: 1.15;
}

.brand-lockup strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    font-weight: 600;
}

.brand-lockup small {
    margin-top: 4px;
    color: var(--ink-soft);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-mark {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 25px;
    font-style: italic;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-logo {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.button {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 750;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:focus-visible,
.nav-button:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(201, 149, 82, 0.32);
    outline-offset: 2px;
}

.button:disabled {
    cursor: wait;
    opacity: 0.58;
}

.button.primary {
    background: var(--teal);
    color: #fff;
    box-shadow: 0 7px 16px rgba(15, 89, 84, 0.18);
}

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

.button.secondary {
    border-color: var(--line-strong);
    background: var(--paper);
    color: var(--teal);
}

.button.ghost {
    border-color: var(--line);
    background: transparent;
    color: var(--ink-soft);
}

.button.danger {
    border-color: #edc9c9;
    background: var(--danger-pale);
    color: var(--danger);
}

.button.small {
    min-height: 35px;
    padding: 7px 11px;
    font-size: 12px;
}

.wide-button {
    width: 100%;
}

label {
    display: grid;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    padding: 9px 12px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #aebcb6;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 89, 84, 0.09);
}

input::placeholder {
    color: #9ba7a4;
}

textarea {
    resize: vertical;
}

.noscript {
    padding: 14px;
    background: var(--danger);
    color: #fff;
    text-align: center;
}

/* Login */
.login-view {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 15% 12%, rgba(201, 149, 82, 0.13), transparent 28%),
        radial-gradient(circle at 85% 88%, rgba(15, 89, 84, 0.12), transparent 30%),
        var(--canvas);
}

.login-card {
    width: min(100%, 455px);
    padding: 38px;
    border: 1px solid rgba(15, 89, 84, 0.1);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 30px 80px rgba(25, 53, 51, 0.13);
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.login-brand-logo {
    width: min(100%, 286px);
}

.login-copy h1 {
    margin-bottom: 10px;
    font-size: 41px;
}

.login-copy > p:last-child {
    margin-bottom: 28px;
    color: var(--ink-soft);
}

.stack-form {
    display: grid;
    gap: 17px;
}

.form-error {
    margin: -2px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--danger-pale);
    color: var(--danger);
    font-size: 13px;
}

.login-help-button {
    display: block;
    margin: 15px auto 0;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--teal);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
    text-decoration: underline;
    text-decoration-color: rgba(15, 89, 84, 0.35);
    text-underline-offset: 3px;
}

.login-help-button:hover {
    color: var(--teal-dark);
    text-decoration-color: currentColor;
}

.privacy-note {
    margin: 24px 0 0;
    color: #899693;
    font-size: 11px;
    text-align: center;
}

/* Application shell */
.app-shell {
    min-height: 100vh;
}

.app-shell:not(.is-admin) #monthly-tab,
.app-shell:not(.is-admin) #doctor-monthly-tab,
.app-shell:not(.is-admin) #cnas-tab,
.app-shell:not(.is-admin) #invoices-tab,
.app-shell:not(.is-admin) #settings-tab {
    display: none !important;
}

.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: #123f3c;
    color: #fff;
    padding: 23px 16px 20px;
}

.sidebar-brand {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 0 2px 19px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-logo {
    width: 220px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 28px rgba(4, 27, 25, 0.2);
}

.sidebar-brand small {
    color: rgba(255, 255, 255, 0.68);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.main-nav {
    display: grid;
    min-height: 0;
    gap: 6px;
    margin-top: 21px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.nav-button {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    font-weight: 700;
    text-align: left;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.nav-button.active {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.11);
    color: #fff;
}

.nav-icon {
    display: grid;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    place-items: center;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.08);
    transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.nav-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-icon-daily { background: rgba(226, 163, 80, 0.18); color: #f0bd78; }
.nav-icon-daily-report { background: rgba(58, 166, 154, 0.18); color: #74d0c5; }
.nav-icon-monthly { background: rgba(75, 136, 195, 0.18); color: #8dc4ef; }
.nav-icon-pdf { background: rgba(139, 111, 192, 0.2); color: #c4a9ed; }
.nav-icon-cnas { background: rgba(41, 157, 183, 0.2); color: #79d3e5; }
.nav-icon-invoices { background: rgba(218, 133, 93, 0.2); color: #eda77f; }
.nav-icon-suppliers { background: rgba(94, 160, 111, 0.2); color: #91d5a2; }
.nav-icon-settings { background: rgba(226, 163, 80, 0.22); color: #f2bd73; }

.nav-button.active .nav-icon {
    color: #fff;
    box-shadow: 0 5px 14px rgba(3, 30, 28, 0.2);
    transform: scale(1.04);
}

.nav-button.active .nav-icon-daily,
.nav-button.active .nav-icon-settings { background: #cf9143; }
.nav-button.active .nav-icon-daily-report { background: #299688; }
.nav-button.active .nav-icon-monthly { background: #477fb5; }
.nav-button.active .nav-icon-pdf { background: #7e63ad; }
.nav-button.active .nav-icon-cnas { background: #258ca4; }
.nav-button.active .nav-icon-invoices { background: #c87950; }
.nav-button.active .nav-icon-suppliers { background: #4f8d5e; }

.sidebar-footer {
    margin-top: auto;
    padding: 17px 7px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-summary {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    margin-bottom: 14px;
}

.user-summary > span:last-child {
    display: grid;
    min-width: 0;
}

.user-summary strong {
    overflow: hidden;
    color: #fff;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-summary small {
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
}

.user-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    font-weight: 800;
}

.text-button {
    display: block;
    width: 100%;
    padding: 7px 0;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}

.text-button:hover {
    color: #fff;
}

.danger-text:hover {
    color: #ffb6b6;
}

.workspace {
    min-height: 100vh;
    min-width: 0;
    max-width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    overflow-x: clip;
    padding: 46px clamp(28px, 4vw, 64px) 70px;
}

.mobile-header {
    display: none;
}

.tab-panel {
    width: min(100%, 1440px);
    min-width: 0;
    margin: 0 auto;
}

.report-page-brand {
    display: flex;
    align-items: center;
    margin-bottom: 22px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
}

.report-page-brand img {
    width: 230px;
    height: auto;
    max-height: 68px;
    object-fit: contain;
}

.app-error-banner {
    width: min(100%, 1440px);
    margin: 0 auto 22px;
    padding: 15px 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid #e6bebe;
    border-radius: 14px;
    background: var(--danger-pale);
    color: var(--danger);
}

.app-error-banner[hidden] {
    display: none;
}

.app-error-banner > span {
    display: grid;
    gap: 3px;
}

.app-error-banner .button {
    flex: 0 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 29px;
}

.page-header > *,
.card-heading > * {
    min-width: 0;
}

.page-header > div > p:last-child {
    max-width: 680px;
    margin-bottom: 0;
    color: var(--ink-soft);
}

.date-control {
    width: 190px;
    flex: 0 0 190px;
}

.entry-card,
.data-card,
.kpi-card {
    border: 1px solid rgba(24, 50, 49, 0.08);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
}

.entry-card,
.data-card {
    border-radius: var(--radius);
}

.entry-card {
    margin-bottom: 22px;
    padding: 23px 25px 25px;
}

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

.card-heading .eyebrow {
    margin-bottom: 4px;
}

.entry-form {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(240px, 1.5fr) minmax(140px, 0.6fr) auto;
    align-items: end;
    gap: 14px;
}

.entry-submit {
    min-width: 158px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 17px;
    margin-bottom: 22px;
}

.kpi-card {
    display: grid;
    min-height: 139px;
    align-content: center;
    padding: 22px 24px;
    border-radius: 15px;
}

.kpi-card > span {
    margin-bottom: 8px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.kpi-card strong {
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(25px, 2.6vw, 35px);
    font-weight: 500;
    line-height: 1.15;
}

.kpi-card small {
    margin-top: 7px;
    color: #8a9895;
    font-size: 11px;
}

.kpi-card.accent {
    border-color: transparent;
    background: var(--teal);
}

.kpi-card.accent > span,
.kpi-card.accent small {
    color: rgba(255, 255, 255, 0.66);
}

.kpi-card.accent strong {
    color: #fff;
}

.daily-grid {
    display: grid;
    grid-template-columns: minmax(270px, 0.72fr) minmax(520px, 1.7fr);
    gap: 22px;
    align-items: start;
}

.data-card {
    overflow: hidden;
    min-width: 0;
    padding: 23px 25px;
}

.doctor-total-list {
    display: grid;
    gap: 3px;
}

.doctor-total-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 13px 4px;
    border-bottom: 1px solid var(--line);
}

.doctor-total-item:last-child {
    border-bottom: 0;
}

.doctor-total-item span {
    display: grid;
    min-width: 0;
}

.doctor-total-item strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doctor-total-item small {
    color: var(--ink-soft);
    font-size: 11px;
}

.doctor-total-item > b {
    color: var(--teal);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: 600;
    white-space: nowrap;
}

.empty-state {
    display: grid;
    min-height: 155px;
    place-items: center;
    padding: 25px;
    color: #899693;
    font-size: 13px;
    text-align: center;
}

.table-scroll {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}

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

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #758481;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr:hover {
    background: #fafbf9;
}

td.numeric,
th.numeric {
    text-align: right;
    white-space: nowrap;
}

td.numeric {
    color: var(--ink);
    font-weight: 750;
}

.actions-column {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.row-button {
    min-height: 31px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--teal);
    cursor: pointer;
    font-size: 11px;
    font-weight: 750;
}

.row-button:hover {
    border-color: var(--teal);
}

.row-button:disabled {
    border-color: var(--line);
    background: #f3f5f4;
    color: #8d9997;
    cursor: not-allowed;
    opacity: 0.78;
}

.row-button.danger {
    color: var(--danger);
}

.row-button.danger:hover {
    border-color: var(--danger);
}

.muted-cell {
    color: var(--ink-soft);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--teal-pale);
    color: var(--teal);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-badge.inactive {
    background: #edf0ef;
    color: #788481;
}

/* Monthly report */
.monthly-kpis {
    grid-template-columns: 1.25fr 1fr 1fr;
}

.report-heading {
    margin-bottom: 11px;
}

.report-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.report-help {
    margin: 0 0 13px;
    color: var(--ink-soft);
    font-size: 12px;
}

.daily-report-table {
    min-width: 760px;
}

.daily-report-table .service-summary {
    width: 46%;
    min-width: 300px;
    color: var(--ink-soft);
    line-height: 1.45;
}

.doctor-monthly-table {
    min-width: 0;
    table-layout: fixed;
}

.doctor-monthly-table th {
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: normal;
}

.doctor-monthly-table td {
    min-width: 0;
    overflow-wrap: anywhere;
}

.doctor-monthly-table th:nth-child(1) { width: 26%; }
.doctor-monthly-table th:nth-child(2) { width: 8%; }
.doctor-monthly-table th:nth-child(3) { width: 12%; }
.doctor-monthly-table th:nth-child(4) { width: 9%; }
.doctor-monthly-table th:nth-child(5) { width: 15%; }
.doctor-monthly-table th:nth-child(6) { width: 30%; }

.doctor-monthly-table .invoice-total {
    color: var(--teal);
    font-weight: 850;
}

.doctor-report-actions {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(102px, 0.8fr) minmax(174px, 1.2fr);
}

.email-report-button {
    min-width: 0;
}

.email-report-action {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.email-send-confirmation {
    color: var(--success);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
}

.email-send-confirmation[hidden] {
    display: none;
}

.doctor-report-actions .row-button {
    width: 100%;
    min-width: 0;
    white-space: normal;
}

/* Raport lunar CAS */
.cnas-source-card {
    margin-bottom: 22px;
}

.cnas-source-actions {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cnas-decont-table {
    min-width: 900px;
}

.cnas-report-table {
    min-width: 0;
    table-layout: fixed;
}

.cnas-report-table .doctor-report-actions {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    align-items: stretch;
}

.cnas-report-table th,
.cnas-report-table td {
    padding-inline: 10px;
}

.cnas-report-table th:nth-child(1) { width: 24%; }
.cnas-report-table th:nth-child(2) { width: 13%; }
.cnas-report-table th:nth-child(3) { width: 7%; }
.cnas-report-table th:nth-child(4) { width: 13%; }
.cnas-report-table th:nth-child(5) { width: 13%; }
.cnas-report-table th:nth-child(6) { width: 30%; }

.cnas-report-table td.numeric {
    white-space: normal;
    overflow-wrap: normal;
    font-variant-numeric: tabular-nums;
}

.cnas-report-table .percentage-pill {
    min-width: 0;
    padding-inline: 10px;
}

.cnas-doctor-identity,
.cnas-delivery-cell {
    display: grid;
    min-width: 0;
    gap: 7px;
    text-align: left;
}

.cnas-doctor-identity small,
.cnas-recipient {
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.cnas-email-summary {
    margin: 0 0 18px;
    padding: 11px 14px;
    border: 1px solid #d8e7e3;
    border-radius: 10px;
    background: #f3f8f6;
    color: var(--teal);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

/* Persistent confirmation for private and CAS doctor reports only. */
.report-email-status {
    display: grid;
    grid-column: 1 / -1;
    min-width: 0;
    gap: 4px;
    margin-top: 5px;
    padding: 9px 10px;
    border: 1px solid #dce4e1;
    border-radius: 9px;
    background: #f5f7f6;
    color: var(--ink-soft);
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.report-email-status strong { font-size: 12px; font-weight: 800; }
.report-email-status small { font-size: 11px; line-height: 1.4; }
.report-email-status.sent { background: #edf8f1; border-color: #b8ddc6; color: #19613c; }
.report-email-status.failed,
.report-email-status.missing_email { background: #fff3f2; border-color: #edceca; color: #9d3030; }
.report-email-status.pending,
.report-email-status.sending { background: #fff8eb; border-color: #eedbb7; color: #80591e; }
.report-email-retry-error { color: #9d3030; }

.cnas-status-note {
    display: block;
    max-width: 360px;
    margin-top: 5px;
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.4;
}

.cnas-status-note.error-text {
    color: var(--danger);
    font-weight: 700;
}

.cnas-checkbox-field {
    min-height: 42px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding-bottom: 9px;
    white-space: nowrap;
}

.cnas-checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--teal);
}

.cnas-checkbox-field span {
    margin: 0;
}

/* Facturi și plăți — exclusiv administrator */
.invoice-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.invoice-kpis .kpi-card {
    min-height: 126px;
}

.invoice-entry-card {
    margin-bottom: 22px;
}

.invoice-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    align-items: end;
    gap: 14px;
}

.invoice-file-field {
    grid-column: span 2;
}

.invoice-file-field input[type="file"] {
    min-height: 44px;
    padding: 7px 9px;
    background: #fafbf9;
}

.invoice-file-field small {
    color: #82908d;
    font-size: 10px;
    font-weight: 500;
}

.invoice-notes-field {
    grid-column: span 2;
}

.invoice-submit {
    min-height: 47px;
}

.invoice-table {
    min-width: 0;
    table-layout: fixed;
}

.invoice-table th {
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: normal;
}

.invoice-table td {
    min-width: 0;
    overflow-wrap: anywhere;
}

.invoice-table th:nth-child(1) { width: 31%; }
.invoice-table th:nth-child(2) { width: 9%; }
.invoice-table th:nth-child(3) { width: 10%; }
.invoice-table th:nth-child(4) { width: 11%; }
.invoice-table th:nth-child(5) { width: 10%; }
.invoice-table th:nth-child(6) { width: 9%; }
.invoice-table th:nth-child(7) { width: 8%; }
.invoice-table th:nth-child(8) { width: 12%; }

.invoice-row-detail,
.document-link {
    display: block;
    margin-top: 3px;
    font-size: 10px;
}

.invoice-row-detail {
    color: var(--ink-soft);
}

.document-link {
    color: var(--teal);
    font-weight: 750;
    text-decoration-color: rgba(15, 89, 84, 0.32);
    text-underline-offset: 2px;
}

.invoice-status {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 850;
    white-space: nowrap;
}

.invoice-status.unpaid {
    background: var(--danger-pale);
    color: var(--danger);
}

.invoice-status.partial {
    background: var(--gold-pale);
    color: #805b27;
}

.invoice-status.paid {
    background: var(--teal-pale);
    color: var(--success);
}

.invoice-actions {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
}

.invoice-actions .row-button {
    width: 100%;
    min-width: 0;
    padding-inline: 6px;
    white-space: normal;
}

.supplier-directory-card {
    margin-bottom: 22px;
}

.supplier-form {
    display: grid;
    grid-template-columns: 1.25fr 0.65fr 0.65fr 1fr;
    align-items: end;
    gap: 13px;
    margin: 0 -25px 18px;
    padding: 18px 25px 21px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fafbf9;
}

.supplier-notes-field {
    grid-column: span 3;
}

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

.supplier-table {
    min-width: 900px;
}

.supplier-invoice-form {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.supplier-category {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--gold-pale);
    color: #805b27;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.email-import-card {
    margin-bottom: 22px;
}

.email-import-heading,
.email-settings-heading {
    align-items: flex-start;
}

.email-import-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.email-import-table {
    min-width: 1040px;
}

.email-import-table td:first-child {
    max-width: 300px;
}

.email-detected-details {
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.65;
    white-space: nowrap;
}

.email-settings-form {
    display: grid;
    grid-template-columns: 1.25fr 0.45fr 0.65fr 1.35fr;
    align-items: end;
    gap: 14px;
    margin: 0 -25px;
    padding: 19px 25px 22px;
    border-top: 1px solid var(--line);
    background: #fafbf9;
}

.settings-button-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.automation-status-table {
    min-width: 760px;
}

.automation-detail {
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-soft);
    font-size: 12px;
}

.email-enabled-field {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}

.email-enabled-field input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 0;
    accent-color: var(--teal);
}

.email-sync-note {
    margin: 0 -25px;
    padding: 12px 25px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 12px;
}

.email-sync-note.success {
    background: #eef8f5;
    color: var(--success);
}

.email-sync-note.error {
    background: var(--danger-pale);
    color: var(--danger);
}

.email-mapping-section {
    margin: 0 -25px -25px;
    padding: 23px 25px 25px;
    border-top: 1px solid var(--line);
}

.pdf-download-button {
    min-width: 108px;
    border-color: #b9d9d1;
    background: #eef8f5;
}

.pdf-download-button:hover {
    background: #e2f2ee;
}

.report-table tbody tr:last-child td {
    border-bottom-color: var(--line-strong);
}

.report-table tfoot td {
    padding-top: 17px;
    border-bottom: 0;
    color: var(--teal);
    font-weight: 850;
}

.percentage-pill {
    display: inline-block;
    min-width: 54px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--gold-pale);
    color: #8a612d;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

/* Settings */
.settings-section + .settings-section {
    margin-top: 22px;
}

.section-description {
    max-width: 720px;
    margin: 8px 0 0;
    color: var(--ink-soft);
    font-size: 13px;
}

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

.status-pill {
    display: inline-flex;
    min-height: 30px;
    flex: 0 0 auto;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.status-pill.active {
    border-color: #b9d9d1;
    background: #eaf7f4;
    color: var(--success);
}

.status-pill.inactive,
.status-pill.neutral {
    background: #f3f5f4;
    color: var(--ink-soft);
}

.status-pill.locked {
    border-color: #ead2a8;
    background: #fff6e6;
    color: #855f25;
}

.recovery-key-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin: 0 -25px;
    padding: 18px 25px 22px;
    border-top: 1px solid var(--line);
    background: #fafbf9;
}

.recovery-key-result {
    display: grid;
    gap: 13px;
    margin: 0 -25px -25px;
    padding: 20px 25px 24px;
    border-top: 1px solid #b9d9d1;
    border-radius: 0 0 var(--radius) var(--radius);
    background: #edf8f5;
}

.recovery-key-result strong {
    color: var(--teal);
}

.recovery-key-result p {
    margin: 4px 0 0;
    color: var(--ink-soft);
    font-size: 12px;
}

.recovery-code {
    border-color: #9ec9bf;
    background: #fff;
    color: var(--teal-dark);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: clamp(12px, 1.8vw, 16px);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: center;
}

.recovery-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.inline-create-form,
.user-create-form {
    display: grid;
    align-items: end;
    gap: 12px;
    margin: 0 -25px 18px;
    padding: 17px 25px 20px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fafbf9;
}

.inline-create-form {
    grid-template-columns: minmax(190px, 1fr) 110px minmax(210px, 1fr) auto minmax(210px, 1fr) auto;
}

.user-create-form {
    grid-template-columns: 1.2fr 0.8fr 0.72fr 1fr auto;
}

.grow {
    min-width: 0;
}

.suffix-input {
    position: relative;
}

.suffix-input input {
    padding-right: 32px;
}

.suffix-input b {
    position: absolute;
    top: 50%;
    right: 12px;
    color: var(--ink-soft);
    transform: translateY(-50%);
}

.settings-input {
    min-width: 200px;
    min-height: 36px;
    padding: 6px 9px;
    font-size: 12px;
}

.settings-share {
    width: 86px;
    min-height: 36px;
    padding: 6px 9px;
    font-size: 12px;
}

.settings-select {
    min-width: 110px;
    min-height: 36px;
    padding: 6px 9px;
    font-size: 12px;
}

.settings-doctors-table {
    table-layout: fixed;
}

.settings-doctors-table th,
.settings-doctors-table td {
    padding-inline: 6px;
}

.settings-doctors-table th:nth-child(1) { width: 18%; }
.settings-doctors-table th:nth-child(2) { width: 8%; }
.settings-doctors-table th:nth-child(3) { width: 20%; }
.settings-doctors-table th:nth-child(4) { width: 9%; }
.settings-doctors-table th:nth-child(5) { width: 20%; }
.settings-doctors-table th:nth-child(6) { width: 10%; }
.settings-doctors-table th:nth-child(7) { width: 9%; }

.settings-doctors-table .settings-input,
.settings-doctors-table .settings-select,
.settings-doctors-table .settings-share {
    width: 100%;
    min-width: 0;
}

.settings-doctors-table .doctor-share-cell .suffix-input {
    max-width: 78px;
}

.settings-doctors-table .doctor-share-cell .settings-share {
    padding-right: 24px;
}

.settings-doctors-table .doctor-share-cell .suffix-input b {
    right: 8px;
}

.settings-doctors-table .doctor-cnas-cell .settings-select {
    max-width: 82px;
}

.settings-doctors-table .doctor-cnas-name-cell .settings-input {
    max-width: 180px;
}

.settings-doctors-table .doctor-status-cell .settings-select {
    max-width: 96px;
}

.settings-doctors-table .actions-column .row-button {
    min-width: 72px;
    padding-inline: 8px;
}

/* Toasts and modal */
.toast-region {
    position: fixed;
    z-index: 100;
    top: 20px;
    right: 22px;
    display: grid;
    width: min(390px, calc(100vw - 40px));
    gap: 9px;
    pointer-events: none;
}

.toast {
    padding: 13px 15px;
    border: 1px solid #bbd9d2;
    border-radius: 10px;
    background: #eef8f5;
    color: #145c4f;
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 700;
    animation: toast-in 180ms ease-out;
}

.toast.error {
    border-color: #ecc3c3;
    background: var(--danger-pale);
    color: var(--danger);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-7px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal {
    width: min(92vw, 470px);
    padding: 0;
    border: 0;
    border-radius: 19px;
    background: transparent;
    box-shadow: 0 30px 90px rgba(12, 42, 39, 0.3);
}

.modal::backdrop {
    background: rgba(11, 37, 35, 0.56);
    backdrop-filter: blur(3px);
}

.modal-card {
    display: grid;
    gap: 16px;
    padding: 25px;
    border-radius: 19px;
    background: #fff;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 2px;
}

.modal-description {
    margin: 0;
    color: var(--ink-soft);
}

.icon-button {
    display: grid;
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
    font-size: 20px;
}

.field-help {
    margin: -7px 0 0;
    color: var(--ink-soft);
    font-size: 11px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 4px;
}

/* Installer */
.install-page {
    background:
        radial-gradient(circle at 12% 10%, rgba(201, 149, 82, 0.12), transparent 26%),
        var(--canvas);
}

.install-shell {
    width: min(100% - 36px, 910px);
    margin: 0 auto;
    padding: 52px 0 70px;
}

.install-header {
    display: flex;
    align-items: center;
    gap: 17px;
    margin-bottom: 29px;
}

.install-brand-logo {
    width: 250px;
    flex: 0 0 250px;
    max-height: 72px;
}

.install-header h1 {
    margin-bottom: 4px;
    font-size: 38px;
}

.install-header p:last-child {
    margin-bottom: 0;
    color: var(--ink-soft);
}

.install-card {
    border: 1px solid rgba(24, 50, 49, 0.09);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow);
}

.install-form {
    padding: 29px;
}

.install-form > section {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    column-gap: 18px;
    padding: 24px 0 30px;
    border-bottom: 1px solid var(--line);
}

.install-form > section:first-of-type {
    padding-top: 2px;
}

.section-number {
    display: grid;
    width: 37px;
    height: 37px;
    place-items: center;
    border-radius: 50%;
    background: var(--teal-pale);
    color: var(--teal);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    font-weight: 700;
}

.section-copy p {
    margin: 7px 0 19px;
    color: var(--ink-soft);
    font-size: 13px;
}

.section-copy small {
    color: var(--ink-soft);
    font-family: Inter, ui-sans-serif, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: normal;
}

.install-grid {
    display: grid;
    grid-column: 2;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.install-grid .wide {
    grid-column: 1 / -1;
}

.install-submit {
    width: 100%;
    min-height: 50px;
    margin-top: 28px;
}

.install-note {
    margin: 14px 0 0;
    color: var(--ink-soft);
    font-size: 11px;
    text-align: center;
}

.install-success {
    padding: 35px;
    text-align: center;
}

.install-success p {
    color: var(--ink-soft);
}

.alert {
    margin-bottom: 16px;
    padding: 13px 15px;
    border-radius: 10px;
}

.alert.error {
    border: 1px solid #eccaca;
    background: var(--danger-pale);
    color: var(--danger);
}

/* Tabele responsive: la lățimi mai mici, fiecare rând devine un card lizibil. */
@media screen and (max-width: 1480px) {
    .table-scroll {
        overflow: visible;
    }

    .table-scroll > table {
        display: block;
        width: 100%;
        min-width: 0 !important;
    }

    .table-scroll > table > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .table-scroll > table > tbody,
    .table-scroll > table > tfoot {
        display: grid;
        gap: 10px;
        width: 100%;
    }

    .table-scroll > table > tfoot {
        margin-top: 12px;
    }

    .table-scroll > table > tbody > tr,
    .table-scroll > table > tfoot > tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(25, 53, 51, 0.045);
    }

    .table-scroll > table > tfoot > tr {
        border-color: #b8d6cf;
        background: #eff7f5;
    }

    .table-scroll > table > tbody > tr:hover {
        background: #fff;
    }

    .table-scroll > table > tbody > tr > td,
    .table-scroll > table > tfoot > tr > td {
        display: grid;
        min-width: 0;
        grid-template-columns: minmax(108px, 0.4fr) minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        border: 0;
        border-bottom: 1px solid #edf0ee;
        text-align: right;
        white-space: normal;
    }

    .table-scroll > table > tbody > tr > td:nth-last-child(-n + 2),
    .table-scroll > table > tfoot > tr > td:nth-last-child(-n + 2) {
        border-bottom-color: transparent;
    }

    .table-scroll > table td::before {
        min-width: 0;
        color: #758481;
        content: attr(data-label);
        font-size: 9px;
        font-weight: 850;
        letter-spacing: 0.07em;
        line-height: 1.35;
        text-align: left;
        text-transform: uppercase;
    }

    .table-scroll > table td[data-label=""],
    .table-scroll > table td[colspan] {
        display: block;
        grid-column: 1 / -1;
        text-align: left;
    }

    .table-scroll > table td[data-label=""]::before,
    .table-scroll > table td[colspan]::before {
        display: none;
    }

    .table-scroll > table td.numeric,
    .table-scroll > table .actions-column {
        width: auto;
        text-align: right;
        white-space: normal;
    }

    .table-scroll > table input,
    .table-scroll > table select,
    .table-scroll > table textarea {
        justify-self: stretch;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }

    .table-scroll > table .suffix-input {
        width: min(100%, 120px);
        max-width: none !important;
        justify-self: end;
    }

    .table-scroll > table .row-actions,
    .table-scroll > table .doctor-report-actions,
    .table-scroll > table .invoice-actions {
        width: 100%;
        min-width: 0;
        justify-content: flex-end;
    }

    .table-scroll > table .doctor-report-actions,
    .table-scroll > table .invoice-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .table-scroll > table .row-actions:not(.doctor-report-actions):not(.invoice-actions) {
        flex-wrap: wrap;
    }

    .table-scroll > table .row-actions .row-button,
    .table-scroll > table .doctor-report-actions .row-button,
    .table-scroll > table .invoice-actions .row-button {
        width: 100%;
        min-width: 0;
    }

    .table-scroll > table .email-detected-details,
    .table-scroll > table .automation-detail,
    .table-scroll > table .invoice-row-detail,
    .table-scroll > table .document-link {
        max-width: none;
        overflow-wrap: anywhere;
        white-space: normal;
    }
}

/* Responsive */
@media (max-width: 1180px) {
    .entry-form {
        grid-template-columns: 1fr 1.3fr 0.7fr;
    }

    .entry-submit {
        grid-column: 1 / -1;
    }

    .invoice-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

    .invoice-submit {
        grid-column: 1 / -1;
    }

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

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

    .inline-create-form .button {
        grid-column: 1 / -1;
    }

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

    .supplier-notes-field {
        grid-column: 1 / -1;
    }

    .supplier-form-actions {
        grid-column: 1 / -1;
    }

    .user-create-form .button {
        grid-column: 1 / -1;
    }
}

@media (max-width: 980px) {
    :root {
        --sidebar-width: 244px;
    }

    .workspace {
        padding-inline: 25px;
    }

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

@media (max-width: 760px) {
    .sidebar {
        width: min(88vw, 310px);
        transform: translateX(-102%);
        transition: transform 180ms ease;
        box-shadow: 22px 0 60px rgba(12, 42, 39, 0.28);
    }

    .app-shell.menu-open .sidebar {
        transform: translateX(0);
    }

    .app-shell.menu-open::after {
        position: fixed;
        z-index: 20;
        inset: 0;
        background: rgba(11, 37, 35, 0.42);
        content: "";
    }

    .workspace {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        padding: 0 12px 42px;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0 -12px 21px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.92);
    }

    .mobile-brand-logo {
        width: min(62vw, 200px);
        height: auto;
        max-height: 52px;
    }

    .page-header {
        display: grid;
        align-items: start;
        gap: 15px;
        margin-bottom: 18px;
    }

    .page-header h1 {
        font-size: clamp(28px, 9vw, 36px);
    }

    .report-page-brand {
        margin-bottom: 16px;
        padding-bottom: 11px;
    }

    .date-control {
        width: 100%;
    }

    .app-error-banner {
        align-items: stretch;
        flex-direction: column;
    }

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

    .invoice-form,
    .invoice-kpis,
    .email-settings-form,
    .supplier-form {
        grid-template-columns: 1fr;
    }

    .supplier-form {
        margin-inline: -12px;
        padding-inline: 12px;
    }

    .supplier-notes-field,
    .supplier-form-actions {
        grid-column: auto;
    }

    .supplier-form-actions,
    .supplier-form-actions .button {
        width: 100%;
    }

    .email-import-heading {
        flex-direction: column;
    }

    .email-import-actions,
    .email-import-actions .button {
        width: 100%;
    }

    .email-import-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .email-settings-form {
        margin-inline: -12px;
        padding-inline: 12px;
    }

    .settings-button-group,
    .settings-button-group .button {
        width: 100%;
    }

    .settings-button-group {
        align-items: stretch;
        flex-direction: column;
    }

    .email-sync-note {
        margin-inline: -12px;
        padding-inline: 12px;
    }

    .email-mapping-section {
        margin-inline: -12px;
        padding-inline: 12px;
    }

    .invoice-file-field,
    .invoice-notes-field,
    .invoice-submit {
        grid-column: auto;
    }

    .entry-submit {
        grid-column: auto;
    }

    .kpi-grid,
    .monthly-kpis {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .kpi-card {
        min-height: 92px;
        padding: 15px 16px;
    }

    .entry-card,
    .data-card {
        padding: 15px 12px;
        border-radius: 14px;
    }

    .entry-card,
    .cnas-source-card,
    .invoice-entry-card,
    .supplier-directory-card,
    .email-import-card {
        margin-bottom: 15px;
    }

    .card-heading {
        gap: 12px;
        margin-bottom: 14px;
    }

    .report-help {
        margin-bottom: 10px;
        font-size: 11px;
        line-height: 1.45;
    }

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

    .report-actions,
    .report-actions .button {
        width: 100%;
    }

    .report-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .cnas-source-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .report-page-brand img {
        width: min(76vw, 235px);
        height: auto;
        max-height: 67px;
    }

    .table-scroll > table > tbody > tr,
    .table-scroll > table > tfoot > tr {
        grid-template-columns: minmax(0, 1fr);
    }

    .table-scroll > table > tbody > tr > td,
    .table-scroll > table > tfoot > tr > td {
        grid-template-columns: minmax(94px, 0.38fr) minmax(0, 1fr);
        gap: 8px;
        padding: 8px 9px;
        font-size: 12px;
    }

    .table-scroll > table > tbody > tr > td:nth-last-child(-n + 2),
    .table-scroll > table > tfoot > tr > td:nth-last-child(-n + 2) {
        border-bottom: 1px solid #edf0ee;
    }

    .table-scroll > table > tbody > tr > td:last-child,
    .table-scroll > table > tfoot > tr > td:last-child {
        border-bottom-color: transparent;
    }

    .table-scroll > table .row-actions,
    .table-scroll > table .doctor-report-actions,
    .table-scroll > table .invoice-actions {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
    }

    .table-scroll > table .row-button {
        width: 100%;
        min-height: 36px;
        padding: 5px 7px;
    }

    .table-scroll > table td > *,
    .table-scroll > table td a,
    .table-scroll > table td small,
    .table-scroll > table td strong {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .table-scroll > table td::before {
        font-size: 8.5px;
        letter-spacing: 0.055em;
    }

    .button {
        min-height: 40px;
        padding: 8px 13px;
    }

    .inline-create-form,
    .user-create-form,
    .recovery-key-form {
        grid-template-columns: 1fr;
        margin-inline: -12px;
        padding-inline: 12px;
    }

    .recovery-key-result {
        margin-inline: -12px;
        padding-inline: 12px;
    }

    .recovery-actions .button {
        width: 100%;
    }

    .inline-create-form .button,
    .user-create-form .button {
        grid-column: auto;
    }

    .login-card {
        padding: 28px 23px;
    }

    .login-brand {
        margin-bottom: 28px;
    }

    .login-brand-logo {
        width: min(100%, 260px);
    }

    .install-form {
        padding: 22px 18px;
    }

    .install-form > section {
        grid-template-columns: 36px minmax(0, 1fr);
        column-gap: 12px;
    }

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

    .install-grid .wide {
        grid-column: auto;
    }

    .install-header {
        align-items: flex-start;
    }

    .install-header h1 {
        font-size: 31px;
    }

    .install-brand-logo {
        width: min(100%, 230px);
        flex-basis: 230px;
        max-height: 66px;
    }
}

@media (max-width: 480px) {
    .login-view {
        padding: 14px;
    }

    .login-card {
        border-radius: 19px;
    }

    .mobile-brand-logo {
        width: 185px;
    }

    .table-scroll > table > tbody > tr > td,
    .table-scroll > table > tfoot > tr > td {
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 7px;
    }

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

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .button {
        width: 100%;
    }

    .install-form > section {
        display: block;
    }

    .section-number {
        margin-bottom: 12px;
    }
}

/* Print-only monthly statement */
@media print {
    @page {
        size: A4 landscape;
        margin: 14mm;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 10pt;
    }

    .sidebar,
    .mobile-header,
    #daily-tab,
    #doctor-daily-tab,
    #doctor-monthly-tab,
    #invoices-tab,
    #suppliers-tab,
    #settings-tab,
    #print-report,
    .toast-region {
        display: none !important;
    }

    .workspace {
        margin: 0;
        padding: 0;
    }

    #monthly-tab {
        display: block !important;
    }

    .report-page-brand {
        margin-bottom: 9px;
        padding-bottom: 7px;
    }

    .report-page-brand img {
        width: 185px;
        height: auto;
        max-height: 54px;
    }

    .page-header {
        margin-bottom: 14px;
    }

    .page-header h1 {
        font-size: 25pt;
    }

    .page-header p,
    .eyebrow,
    .date-control span {
        color: #333;
    }

    .date-control input {
        border: 0;
        padding: 0;
    }

    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 13px;
    }

    .kpi-card,
    .kpi-card.accent {
        min-height: 80px;
        padding: 10px;
        border: 1px solid #aaa;
        background: #fff;
        box-shadow: none;
    }

    .kpi-card strong,
    .kpi-card.accent strong,
    .kpi-card > span,
    .kpi-card.accent > span,
    .kpi-card small,
    .kpi-card.accent small {
        color: #000;
    }

    .data-card {
        padding: 12px;
        border: 1px solid #aaa;
        box-shadow: none;
    }

    th,
    td {
        padding: 7px 8px;
        border-color: #ccc;
    }

    tbody tr:hover {
        background: transparent;
    }

    .percentage-pill {
        padding: 0;
        background: transparent;
        color: #000;
    }
}

/* Payment import and per-invoice mail feedback; scoped to the doctor invoice view. */
.payment-import-table { min-width: 850px; width: 100%; table-layout: fixed; }
.payment-import-table th:nth-child(1) { width: 28%; }
.payment-import-table th:nth-child(2) { width: 18%; }
.payment-import-table th:nth-child(3) { width: 25%; }
.payment-import-table td { vertical-align: top; overflow-wrap: anywhere; }
.payment-import-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.payment-import-actions select { width: 100%; min-width: 0; max-width: 100%; }
.payment-email-status { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.payment-email-status small { display: block; font-weight: normal; margin-top: 4px; }
.payment-email-status.success { color: #105a49; background: #e7f5ed; border: 1px solid #b6dac7; }
.payment-email-status.failed { color: #a32828; background: #fff0ee; }
.payment-email-status.pending { color: #805512; background: #fff5df; }

#invoices-tab .invoice-table { min-width: 1280px; }
#invoices-tab .invoice-table th:nth-child(1) { width: 24%; }
#invoices-tab .invoice-table th:nth-child(2) { width: 7%; }
#invoices-tab .invoice-table th:nth-child(3) { width: 10%; }
#invoices-tab .invoice-table th:nth-child(4) { width: 13%; }
#invoices-tab .invoice-table th:nth-child(5) { width: 9%; }
#invoices-tab .invoice-table th:nth-child(6) { width: 8%; }
#invoices-tab .invoice-table th:nth-child(7) { width: 9%; }
#invoices-tab .invoice-table th:nth-child(8) { width: 20%; }
#invoices-tab .invoice-table .invoice-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#invoices-tab .invoice-table [data-invoice-payment], #invoices-tab .invoice-table [data-payment-email] { grid-column: 1 / -1; white-space: normal; }
.payment-import-history { margin-top: 18px; }
.payment-import-history summary { cursor: pointer; color: #125c55; font-weight: 600; padding: 10px 0; }
@media (max-width: 760px) {
    #invoices-tab .invoice-table { min-width: 0; }
}

/* Screen layout repair: doctor invoices, payment evidence and report delivery.
   Keep the document, amount and actions inside their own cells at every width.
   Business logic and the print layout are unchanged. */
@media screen {
    #invoices-tab .payment-import-card {
        margin-bottom: 22px;
    }

    #invoices-tab .invoice-kpis .kpi-card {
        min-width: 0;
        padding-inline: 20px;
    }

    #invoices-tab .invoice-kpis strong {
        min-width: 0;
        font-size: clamp(24px, 2vw, 30px);
        font-variant-numeric: tabular-nums;
        overflow-wrap: anywhere;
    }

    #invoices-tab .email-import-heading {
        flex-wrap: wrap;
    }

    #invoices-tab .email-import-heading > :first-child {
        flex: 1 1 360px;
    }

    #invoices-tab .email-import-actions {
        flex: 1 1 500px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    #invoices-tab .email-import-actions .button {
        min-width: 0;
        max-width: 100%;
        white-space: normal;
    }

    #invoices-tab :is(.email-import-table, .payment-import-table, .invoice-table) {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
    }

    #invoices-tab .email-import-table th:nth-child(1) { width: 28%; }
    #invoices-tab .email-import-table th:nth-child(2) { width: 17%; }
    #invoices-tab .email-import-table th:nth-child(3) { width: 24%; }
    #invoices-tab .email-import-table th:nth-child(4) { width: 15%; }
    #invoices-tab .email-import-table th:nth-child(5) { width: 16%; }

    #invoices-tab .invoice-table th:nth-child(1) { width: 16%; }
    #invoices-tab .invoice-table th:nth-child(2) { width: 8%; }
    #invoices-tab .invoice-table th:nth-child(3) { width: 10%; }
    #invoices-tab .invoice-table th:nth-child(4) { width: 12%; }
    #invoices-tab .invoice-table th:nth-child(5) { width: 10%; }
    #invoices-tab .invoice-table th:nth-child(6) { width: 10%; }
    #invoices-tab .invoice-table th:nth-child(7) { width: 9%; }
    #invoices-tab .invoice-table th:nth-child(8) { width: 25%; }

    #invoices-tab :is(.email-import-table, .payment-import-table, .invoice-table) :is(th, td) {
        min-width: 0;
        padding: 14px 8px;
        overflow-wrap: anywhere;
        white-space: normal;
    }

    #invoices-tab :is(.email-import-table, .payment-import-table, .invoice-table) td {
        vertical-align: top;
        line-height: 1.5;
    }

    #invoices-tab .invoice-table td {
        font-size: 12px;
    }

    #invoices-tab :is(.invoice-row-detail, .document-link, .email-detected-details) {
        max-width: 100%;
        font-size: 12px;
        line-height: 1.5;
        overflow-wrap: anywhere;
        white-space: normal;
    }

    #invoices-tab .invoice-status {
        max-width: 100%;
        font-size: 11px;
        line-height: 1.4;
        white-space: normal;
    }

    #invoices-tab .row-button {
        min-height: 36px;
        max-width: 100%;
        padding: 7px 9px;
        line-height: 1.4;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    #invoices-tab .email-import-table .invoice-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    #invoices-tab .payment-import-actions {
        display: grid;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }

    #invoices-tab .payment-import-actions select {
        grid-column: 1 / -1;
    }

    #invoices-tab .payment-email-status {
        min-width: 0;
        line-height: 1.5;
    }

    #invoices-tab .payment-import-history {
        padding-top: 8px;
        border-top: 1px solid var(--line);
    }

    #invoices-tab .payment-import-history summary {
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    #doctor-monthly-tab .doctor-report-actions {
        grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
        align-items: start;
    }

    #doctor-monthly-tab .email-report-action {
        display: contents;
    }

    :is(#doctor-monthly-tab, #cnas-tab) .doctor-monthly-table td.numeric {
        white-space: normal;
        overflow-wrap: anywhere;
        font-variant-numeric: tabular-nums;
    }
}

@media screen and (max-width: 1480px) {
    #invoices-tab .invoice-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Multiple child elements belong to the value column, not to the label. */
    :is(#invoices-tab, #doctor-monthly-tab, #cnas-tab) .table-scroll > :is(.email-import-table, .payment-import-table, .invoice-table, .doctor-monthly-table) > tbody > tr > td {
        align-content: start;
        align-items: start;
        column-gap: 12px;
        row-gap: 4px;
        text-align: left;
    }

    :is(#invoices-tab, #doctor-monthly-tab, #cnas-tab) .table-scroll > :is(.email-import-table, .payment-import-table, .invoice-table, .doctor-monthly-table) > tbody > tr > td > * {
        grid-column: 2;
        min-width: 0;
        max-width: 100%;
    }

    :is(#invoices-tab, #doctor-monthly-tab, #cnas-tab) .table-scroll > :is(.email-import-table, .payment-import-table, .invoice-table, .doctor-monthly-table) > tbody > tr > td:first-child {
        grid-column: 1 / -1;
        max-width: none;
        background: #f5f9f7;
    }

    /* Give actions and persistent delivery confirmation the full row width. */
    :is(#invoices-tab, #doctor-monthly-tab, #cnas-tab) .table-scroll > :is(.email-import-table, .payment-import-table, .invoice-table, .doctor-monthly-table) > tbody > tr > td:last-child:not([colspan]) {
        display: block;
        grid-column: 1 / -1;
        text-align: left;
        border-top: 1px solid var(--line);
    }

    :is(#invoices-tab, #doctor-monthly-tab, #cnas-tab) .table-scroll > :is(.email-import-table, .payment-import-table, .invoice-table, .doctor-monthly-table) > tbody > tr > td:last-child:not([colspan])::before {
        display: block;
        margin-bottom: 8px;
    }

    #invoices-tab .email-import-table .invoice-actions {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

@media screen and (max-width: 1180px) {
    :is(#invoices-tab, #doctor-monthly-tab, #cnas-tab) .table-scroll > :is(.email-import-table, .payment-import-table, .invoice-table, .doctor-monthly-table) > tbody > tr {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media screen and (max-width: 760px) {
    #invoices-tab .payment-import-card {
        margin-bottom: 15px;
    }

    #invoices-tab .email-import-heading > :first-child,
    #invoices-tab .email-import-actions {
        flex: 0 1 auto;
    }

    #invoices-tab .email-import-actions .status-pill {
        align-self: flex-start;
    }

    #doctor-monthly-tab .doctor-report-actions,
    #cnas-tab .doctor-report-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media screen and (max-width: 600px) {
    #invoices-tab .invoice-kpis {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Review only the bank proof selected from the doctor's invoice queue. */
#payment-review-dialog {
    width: min(92vw, 700px);
    max-height: calc(100dvh - 24px);
}

#payment-review-dialog .modal-card {
    min-width: 0;
}

#payment-review-dialog :is(label, input, select, p, a) {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

#payment-review-dialog .document-link {
    font-size: 13px;
}

#payment-review-dialog .payment-review-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

#payment-review-dialog .payment-review-note {
    margin: 0;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--teal-pale);
    color: var(--ink);
    font-size: 12px;
    line-height: 1.5;
}

#payment-review-dialog .payment-review-note.error {
    background: var(--danger-pale);
    color: var(--danger);
}

#payment-review-dialog .payment-review-confirmation {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
}

#payment-review-dialog .payment-review-confirmation input {
    width: 18px;
    height: 18px;
    min-height: 0;
    margin-top: 2px;
    accent-color: var(--teal);
}

#payment-review-dialog .payment-review-confirmation span {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.5;
}

#payment-review-dialog .modal-actions {
    flex-wrap: wrap;
}

#payment-review-dialog .button {
    white-space: normal;
}

#invoices-tab [data-payment-review] {
    background: var(--teal-pale);
    border-color: #b6d8d0;
    color: var(--teal);
}

@media screen and (max-width: 480px) {
    #payment-review-dialog .modal-card { padding: 18px 14px; }
    #payment-review-dialog .payment-review-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Additional doctor payments: keep the new action and its balance readable. */
#invoices-tab .invoice-table [data-invoice-payment-add] {
    grid-column: 1 / -1;
    white-space: normal;
    color: #105a49;
    background: #edf7f3;
    border-color: #b6dac7;
}
#invoices-tab .invoice-additional-payments {
    margin-top: 10px;
    font-size: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
}
#invoices-tab .invoice-additional-payments summary {
    color: #125c55;
    cursor: pointer;
    font-weight: 600;
}
#invoices-tab .invoice-payment-history-entry {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #d6e3de;
}
#invoices-tab .invoice-payment-history-entry small {
    display: block;
    margin-top: 4px;
}
#payment-dialog { max-width: min(600px, calc(100vw - 24px)); }
#payment-dialog :is(label, input, p, small) { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
#payment-dialog .payment-balance-preview {
    margin: 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #edf7f3;
    color: #105a49;
    font-size: 14px;
    line-height: 1.65;
}
#payment-dialog .modal-actions { flex-wrap: wrap; }
#payment-dialog .button { white-space: normal; }
@media (max-width: 540px) {
    #payment-dialog .modal-card { padding: 18px 14px; }
}

/* Supplier workspace only: optional directory and legible row actions. */
#suppliers-tab .supplier-directory-toggle {
    display: flex;
    width: fit-content;
    max-width: calc(100% - 40px);
    margin: 0 20px 20px;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    text-align: left;
    white-space: normal;
}
#suppliers-tab .supplier-directory-toggle::-webkit-details-marker { display: none; }
#suppliers-tab .supplier-directory-toggle:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
#suppliers-tab .supplier-directory-hide { display: none; }
#suppliers-tab .supplier-directory-disclosure[open] .supplier-directory-show { display: none; }
#suppliers-tab .supplier-directory-disclosure[open] .supplier-directory-hide { display: inline; }
#suppliers-tab .supplier-directory-chevron { flex: 0 0 auto; font-size: 20px; }
#suppliers-tab .supplier-directory-disclosure[open] .supplier-directory-chevron { transform: rotate(180deg); }
#suppliers-tab :is(.supplier-table, .email-import-table) .invoice-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
}
#suppliers-tab :is(.supplier-table, .email-import-table) .row-button {
    width: 100%;
    max-width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}
@media screen and (min-width: 1481px) {
    #suppliers-tab :is(.supplier-table, .email-import-table) {
        width: 100%; min-width: 0; table-layout: fixed;
    }
    #suppliers-tab :is(.supplier-table, .email-import-table) :is(th, td) {
        white-space: normal; overflow-wrap: anywhere; padding-inline: 12px;
    }
    #suppliers-tab .supplier-table th:nth-child(1) { width: 30%; }
    #suppliers-tab .supplier-table th:nth-child(2) { width: 11%; }
    #suppliers-tab .supplier-table th:nth-child(3) { width: 12%; }
    #suppliers-tab .supplier-table th:nth-child(4) { width: 23%; }
    #suppliers-tab .supplier-table th:nth-child(5) { width: 10%; }
    #suppliers-tab .supplier-table .actions-column { width: 14%; }
    #suppliers-tab .email-import-table th:nth-child(1) { width: 27%; }
    #suppliers-tab .email-import-table th:nth-child(2) { width: 15%; }
    #suppliers-tab .email-import-table th:nth-child(3) { width: 23%; }
    #suppliers-tab .email-import-table th:nth-child(4) { width: 17%; }
    #suppliers-tab .email-import-table .actions-column { width: 18%; }
}

/* Mobile density only: retain every field, action and status. */
@media screen and (max-width: 760px) {
    #app-view .workspace { padding-inline: 10px; }
    #app-view .page-header { gap: 10px; margin-bottom: 14px; }
    #app-view .page-header h1 { font-size: 27px; line-height: 1.15; }
    #app-view .page-header > div > p:last-child { font-size: 12px; line-height: 1.45; margin-top: 6px; }
    #app-view .entry-card, #app-view .data-card { padding: 12px; border-radius: 12px; margin-bottom: 12px; }
    #app-view .card-heading { gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
    #app-view .card-heading h2 { font-size: 21px; line-height: 1.2; }
    #app-view .eyebrow { font-size: 9px; letter-spacing: .08em; }
    #app-view .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
    #app-view .kpi-grid > :first-child:nth-last-child(3) { grid-column: 1 / -1; }
    #app-view .kpi-card { min-height: 0; padding: 12px; border-radius: 11px; gap: 3px; }
    #app-view .kpi-card > span { font-size: 10px; letter-spacing: .035em; margin: 0; }
    #app-view .kpi-card strong { font-size: clamp(18px,5.1vw,25px); line-height: 1.2; overflow-wrap: anywhere; }
    #app-view .kpi-card small { margin-top: 2px; font-size: 10px; line-height: 1.35; }
    #app-view .daily-grid { gap: 10px; }
    #app-view .doctor-total-item { padding: 8px 0; gap: 8px; }
    #app-view .doctor-total-item > b { font-size: 20px; }
    #app-view .entry-form, #app-view .invoice-form, #app-view .supplier-form,
    #app-view .email-settings-form { gap: 10px; }
    #app-view input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    #app-view select, #app-view textarea { font-size: 16px; min-width: 0; max-width: 100%; }
    #app-view .button, #app-view .row-button { min-height: 44px; padding: 7px 10px; line-height: 1.25; white-space: normal; }
    #app-view .report-actions, #app-view .email-import-actions, #app-view .settings-button-group,
    #app-view .cnas-source-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; width: 100%; }
    #app-view :is(.report-actions,.email-import-actions,.settings-button-group,.cnas-source-actions) > .button {
        flex: 1 1 140px; width: auto; min-width: 0; font-size: 12px;
    }
    #app-view .email-import-actions > .status-pill { flex: 0 0 auto; }
    #app-view .table-scroll > table > :is(tbody,tfoot) { gap: 8px; }
    #app-view .tab-panel .table-scroll > table > :is(tbody,tfoot) > tr {
        grid-template-columns: repeat(2,minmax(0,1fr)); border-radius: 10px; box-shadow: none;
    }
    #app-view .tab-panel .table-scroll > table > :is(tbody,tfoot) > tr > td {
        display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
        gap: 3px; padding: 8px 10px; text-align: left; font-size: 13px; line-height: 1.4;
        grid-column: auto; max-width: none; border-bottom: 1px solid #edf0ee;
    }
    #app-view .tab-panel .table-scroll > table > :is(tbody,tfoot) > tr > td:first-child,
    #app-view .tab-panel .table-scroll > table > :is(tbody,tfoot) > tr > td[colspan],
    #app-view .tab-panel .table-scroll > table > :is(tbody,tfoot) > tr > td:has(.row-actions,.invoice-actions,.doctor-report-actions) {
        grid-column: 1 / -1;
    }
    #app-view .tab-panel .table-scroll > table > :is(tbody,tfoot) > tr > td::before {
        font-size: 9px; letter-spacing: .035em; margin: 0; line-height: 1.3;
    }
    #app-view .tab-panel .table-scroll > table td > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
    #app-view .tab-panel .table-scroll > table :is(.row-actions,.invoice-actions,.doctor-report-actions) {
        display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; gap: 6px;
    }
    #app-view .tab-panel .table-scroll > table :is(.row-actions,.invoice-actions,.doctor-report-actions) .row-button {
        width: 100%; min-width: 0; min-height: 44px; font-size: 12px; padding: 7px 6px;
        grid-column: auto;
    }
    #app-view .tab-panel .table-scroll > table :is(.row-actions,.invoice-actions,.doctor-report-actions) .row-button:only-child { grid-column: 1 / -1; }
    #app-view .tab-panel .table-scroll > table :is(.email-detected-details,.invoice-row-detail,.automation-detail) {
        font-size: 11px; line-height: 1.4; margin-block: 2px; white-space: normal;
    }
    #app-view .tab-panel .table-scroll > table .status-pill { align-self: flex-start; width: auto; }
    #app-view .supplier-directory-toggle { padding: 12px; }
    #app-view .section-description, #app-view .report-help { font-size: 12px; line-height: 1.45; }
    dialog .modal-card { padding: 16px 12px; }
    dialog input:not([type="checkbox"]), dialog select, dialog textarea { font-size: 16px; }
    dialog .modal-actions { gap: 8px; flex-wrap: wrap; }
    dialog .button { min-height: 44px; }
}

/* Doctor identities only; financial values and status colours stay unchanged. */
@media screen {
    :is(#entries-body, #daily-report-body, #monthly-body, #doctor-monthly-body,
        #invoices-body, #email-mappings-body) > tr > td:first-child > strong,
    #cnas-report-body .cnas-doctor-identity > strong,
    #email-imports-body > tr > td:nth-child(2) > strong,
    .doctor-total-item > span > strong {
        color: #175da6;
        font-weight: 800;
    }
}

/* Daily entry list only: insertion time and boundaries between doctors. */
#entries-body .entry-created-time {
    font-size: 0.85em;
    font-weight: 300;
    color: #697c80;
    white-space: nowrap;
    margin-right: 0.2em;
}
#entries-body > tr.entry-doctor-group-start > td {
    border-top: 2px solid #aac6c3;
}
@media (max-width: 760px) {
    #app-view .tab-panel .table-scroll > table > #entries-body > tr.entry-doctor-group-start {
        border-top: 2px solid #aac6c3;
        margin-top: 8px;
    }
    #entries-body > tr.entry-doctor-group-start > td { border-top: 0; }
}

/* Inline supplier creation is scoped to invoice verification. */
.supplier-review-choice { display: grid; gap: .55rem; align-content: start; }
.supplier-review-choice label { display: grid; gap: .5rem; }
.supplier-review-new { grid-column: 1 / -1; padding: 1rem; border: 1px solid #b6d4d1; border-radius: 14px; background: #f5faf9; }
.supplier-review-new p { margin: 0 0 .8rem; }
.supplier-review-fields { display: grid; grid-template-columns: 2fr 1fr 2fr 1fr; gap: .8rem; }
.supplier-review-fields label { min-width: 0; }
.supplier-review-fields input, .supplier-review-fields select { width: 100%; }
.supplier-review-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.supplier-review-reading { grid-column: 1 / -1; margin: 0; font-size: .9rem; color: #446260; }
@media (max-width: 760px) { .supplier-review-fields { grid-template-columns: 1fr; } .supplier-review-actions .button { width: 100%; } }
