/* KlinikMS print styles.
   Used by prescription, invoice and medical summary printouts. */

@page {
    size: A4;
    margin: 14mm 14mm 16mm;
}

/* ---------- On-screen appearance of printable documents ---------- */

body.print-body {
    background: #eef2f5;
    margin: 0;
    padding: 0 0 40px;
    font-family: var(--km-font, "Segoe UI", system-ui, -apple-system, sans-serif);
    color: #1f2a30;
}

.print-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #d5dee4;
    padding: 0.75rem 1.25rem;
}

.print-sheet {
    max-width: 210mm;
    margin: 20px auto;
    background: #ffffff;
    border: 1px solid #d5dee4;
    border-radius: 6px;
    padding: 18mm 16mm;
}

.print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #16697a;
    padding-bottom: 10px;
    margin-bottom: 16px;
}

.print-clinic h1 {
    font-size: 1.4rem;
    margin: 0;
    color: #16697a;
    font-weight: 700;
}

.print-clinic p {
    margin: 0;
    color: #6b7c85;
    font-size: 0.85rem;
}

.print-doc-title {
    text-align: right;
}

.print-doc-title h2 {
    font-size: 1.1rem;
    margin: 0;
    letter-spacing: 0.08em;
    color: #1f2a30;
}

.print-doc-title p {
    margin: 0;
    color: #6b7c85;
    font-size: 0.85rem;
}

.print-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.print-meta strong {
    display: block;
    color: #6b7c85;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.print-note {
    border: 1px solid #d5dee4;
    border-left: 4px solid #16697a;
    background: #f7fafb;
    padding: 0.6rem 0.8rem;
    font-size: 0.82rem;
    margin: 14px 0;
    border-radius: 3px;
}

.print-section-title {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #16697a;
    border-bottom: 1px solid #d5dee4;
    padding-bottom: 4px;
    margin: 22px 0 10px;
}

table.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table.print-table th {
    background: #f2f6f8;
    text-align: left;
    padding: 7px 8px;
    border-bottom: 1px solid #c8d4da;
    font-weight: 600;
}

table.print-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #e4ebef;
    vertical-align: top;
}

table.print-table .num {
    text-align: right;
}

table.print-table .muted,
.print-sheet .muted {
    color: #6b7c85;
    font-size: 0.78rem;
}

.print-totals {
    width: 100%;
    max-width: 340px;
    margin: 14px 0 0 auto;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.print-totals td {
    padding: 4px 0;
    border: 0;
}

.print-totals td.label {
    text-align: right;
    color: #6b7c85;
    padding-right: 12px;
}

.print-totals td.value {
    text-align: right;
    width: 140px;
    font-weight: 600;
}

.print-totals tr.print-grand td {
    border-top: 1px solid #16697a;
    padding-top: 8px;
    font-size: 1rem;
}

.print-sign {
    margin-top: 56px;
    display: flex;
    justify-content: flex-end;
}

.print-sign-box {
    text-align: center;
    font-size: 0.82rem;
    color: #1f2a30;
}

.print-sign-line {
    width: 210px;
    border-top: 1px solid #1f2a30;
    margin-bottom: 4px;
}

.print-footer {
    margin-top: 28px;
    padding-top: 8px;
    border-top: 1px solid #e4ebef;
    font-size: 0.72rem;
    color: #8a99a1;
    text-align: center;
}

.print-only {
    display: none;
}

@media (max-width: 767.98px) {
    .print-sheet {
        margin: 0;
        border: 0;
        border-radius: 0;
        padding: 16px;
    }

    .print-meta {
        grid-template-columns: 1fr;
    }

    .print-head {
        flex-direction: column;
        gap: 6px;
    }

    .print-doc-title {
        text-align: left;
    }
}

@media print {
    body.app-body {
        background: #fff;
        font-size: 12px;
        color: #000;
    }

    .app-sidebar,
    .app-topbar,
    .app-footer,
    .sidebar-backdrop,
    .no-print,
    .page-actions,
    .filter-bar,
    .pagination-bar,
    .alert {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .app-content {
        padding: 0;
    }

    .print-only {
        display: block !important;
    }

    .print-sheet {
        max-width: 100%;
        border: 0;
        padding: 0;
        margin: 0;
    }

    .print-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        border-bottom: 2px solid #000;
        padding-bottom: 8px;
        margin-bottom: 14px;
    }

    .print-clinic {
        font-size: 18px;
        font-weight: 700;
    }

    .print-doc-title {
        text-align: right;
    }

    .print-doc-title h1 {
        font-size: 16px;
        margin: 0;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    .print-meta {
        font-size: 11px;
        color: #333;
    }

    table.km {
        font-size: 11px;
    }

    table.km th {
        background: #eee !important;
        color: #000;
        border-bottom: 1px solid #666;
    }

    table.km td {
        border-bottom: 1px solid #ccc;
    }

    .print-totals {
        width: 100%;
        margin-top: 10px;
    }

    .print-totals td {
        border: 0;
        padding: 2px 0;
    }

    .print-totals td.label {
        text-align: right;
        color: #333;
        padding-right: 10px;
    }

    .print-totals td.value {
        text-align: right;
        width: 130px;
        font-weight: 600;
    }

    .print-grand {
        border-top: 1px solid #000;
        font-size: 13px;
    }

    .print-sign {
        margin-top: 50px;
        display: flex;
        justify-content: space-between;
    }

    .print-sign div {
        border-top: 1px solid #000;
        width: 200px;
        text-align: center;
        padding-top: 4px;
        font-size: 11px;
    }

    .print-note {
        margin-top: 14px;
        font-size: 10px;
        color: #444;
        border-top: 1px dashed #999;
        padding-top: 6px;
    }

    a {
        color: #000;
        text-decoration: none;
    }

    .card, .panel {
        border: 0;
    }
}
