/* ============================================================
   assets/css/style.css
   Modern, Professional, Responsive - Puskesmas RME
   ============================================================ */

/* === RESET & BASE === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #e0f2fe;
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    --success: #16a34a;
    --success-light: #f0fdf4;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --teal: #0d9488;
    --teal-light: #f0fdfa;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 256px;
    --header-height: 60px;
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --transition: all 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: var(--gray-700);
    background: var(--gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

/* === LAYOUT === */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* === OVERLAY (mobile) === */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-800);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    min-height: var(--header-height);
}

.brand-icon-wrap {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.brand-text {
    flex: 1;
    min-width: 0;
}

.brand-name {
    font-weight: 700;
    font-size: 14px;
    color: #f1f5f9;
    line-height: 1.2;
}

.brand-sub {
    font-size: 10px;
    color: var(--gray-400);
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 10px 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #e2e8f0;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(14, 165, 233, 0.18);
    color: #7dd3fc;
}

.nav-icon {
    font-size: 16px;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    /* background: rgba(0, 0, 0, 0.15); */
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info-wrap {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: #f1f5f9;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10.5px;
    color: var(--gray-400);
    text-transform: capitalize;
    margin-top: 1px;
}

.btn-logout {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.2);
    text-decoration: none;
}

/* === TOPBAR (mobile) === */
.topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 98;
    box-shadow: var(--shadow-sm);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    color: var(--gray-800);
}

.btn-hamburger {
    width: 38px;
    height: 38px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: none;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    padding: 8px;
    transition: var(--transition);
}

.btn-hamburger:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.btn-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--gray-700);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}

/* Hamburger → X animation */
.sidebar.open~* .btn-hamburger span:nth-child(1),
#btn-hamburger.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

#btn-hamburger.is-open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

#btn-hamburger.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 28px;
    min-height: 100vh;
    max-width: 100%;
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
}

/* === FOOTER === */
.footer {
    margin-left: var(--sidebar-width);
    padding: 14px 28px;
    font-size: 12px;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-200);
    text-align: center;
    background: #fff;
}

/* === CARD === */
.card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
    border: 1px solid var(--gray-200);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === STATS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card:nth-child(1)::before {
    background: var(--primary);
}

.stat-card:nth-child(2)::before {
    background: var(--success);
}

.stat-card:nth-child(3)::before {
    background: var(--teal);
}

.stat-card:nth-child(4)::before {
    background: var(--warning);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card:nth-child(1) .stat-icon-wrap {
    background: var(--primary-light);
}

.stat-card:nth-child(2) .stat-icon-wrap {
    background: var(--success-light);
}

.stat-card:nth-child(3) .stat-icon-wrap {
    background: var(--teal-light);
}

.stat-card:nth-child(4) .stat-icon-wrap {
    background: var(--warning-light);
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
    margin-top: 2px;
}

/* === TABEL === */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--border-radius-sm);
}

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

thead th {
    background: var(--gray-50);
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}

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

tbody tr:hover {
    background: var(--gray-50);
}

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

/* === TOMBOL === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: var(--transition);
    line-height: 1.2;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #b45309;
    color: #fff;
}

.btn-sm {
    padding: 5px 11px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* === FORM === */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    color: var(--gray-900);
    background: #fff;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* === ALERT === */
.alert {
    padding: 13px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 18px;
    font-size: 13.5px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid;
    line-height: 1.5;
}

.alert-success {
    background: var(--success-light);
    color: #15803d;
    border-color: #bbf7d0;
}

.alert-error {
    background: var(--danger-light);
    color: #b91c1c;
    border-color: #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-color: #fde68a;
}

.alert-info {
    background: var(--primary-light);
    color: #0369a1;
    border-color: #bae6fd;
}

/* === BADGE === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-green {
    background: #dcfce7;
    color: #15803d;
}

.badge-red {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-yellow {
    background: #fef3c7;
    color: #92400e;
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-teal {
    background: #ccfbf1;
    color: #0f766e;
}

/* === SEARCH BAR === */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.search-bar .form-control {
    max-width: 320px;
}

/* === QR CODE === */
.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
}

.qr-box img {
    border: 3px solid var(--gray-200);
    border-radius: 10px;
    padding: 6px;
    background: #fff;
}

#qr-reader {
    width: 100%;
    max-width: 400px;
}

/* === LOGIN PAGE === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0c4a6e 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.12) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .icon-wrap {
    width: 72px;
    height: 72px;
    background: var(--primary-gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 14px;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--gray-900);
}

.login-logo .subtitle {
    color: var(--gray-400);
    font-size: 13px;
    margin-top: 4px;
}

/* === UTILITIES === */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--gray-400);
}

.text-sm {
    font-size: 12px;
}

.text-xs {
    font-size: 11px;
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.font-bold {
    font-weight: 700;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 14px;
}

.mt-4 {
    margin-top: 20px;
}

.mb-1 {
    margin-bottom: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 14px;
}

.mb-4 {
    margin-bottom: 20px;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 8px;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

.divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 16px 0;
}

.info-box {
    background: var(--primary-light);
    border: 1px solid #bae6fd;
    border-radius: var(--border-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13.5px;
    align-items: flex-start;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    min-width: 140px;
    color: var(--gray-500);
    font-size: 12.5px;
    padding-top: 1px;
}

.info-value {
    color: var(--gray-900);
    font-size: 13.5px;
    flex: 1;
}

.resep-item {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.resep-item .form-group {
    margin-bottom: 0;
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state-icon {
    font-size: 52px;
    margin-bottom: 14px;
}

.empty-state-text {
    font-size: 15px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .main-content {
        padding: 22px;
    }

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



    .konten_medines {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {

    /* Tampilkan topbar di mobile/tablet */
    .topbar {
        display: flex;
    }

    /* Sidebar slide-out ke kiri by default */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    /* Sidebar terbuka saat .open ditambahkan via JS */
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }

    /* Main content dimulai dari top (karena sidebar overlay) */
    .main-content {
        margin-left: 0;
        padding: 80px 16px 20px;
    }

    .konten_medines {
        display: grid;
        grid-template-columns: 1fr;
    }

    .footer {
        margin-left: 0;
        padding: 12px 16px;
    }

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

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 22px;
    }

    .page-header {
        margin-bottom: 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .page-title {
        font-size: 18px;
    }

    .search-bar .form-control {
        max-width: 100%;
        flex: 1;
    }

    .search-bar {
        flex-wrap: wrap;
    }

    .card {
        padding: 16px;
    }

    table {
        font-size: 12.5px;
    }

    thead th {
        padding: 9px 10px;
    }

    tbody td {
        padding: 9px 10px;
    }

    /* Info rows lebih compact */
    .info-label {
        min-width: 110px;
    }

    .login-card {
        margin: 16px;
        padding: 28px 22px;
    }

    /* Dashboard grids responsive */
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns: 300px 1fr"],
    [style*="grid-template-columns: auto 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-icon-wrap {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .stat-value {
        font-size: 20px;
    }

    .td-actions {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    .td-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .page-header {
        gap: 8px;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
}

/* === PRINT (halaman biasa) === */
@media print {

    .sidebar,
    .topbar,
    .sidebar-overlay,
    .footer,
    .btn,
    .search-bar,
    .form-actions,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    body {
        background: #fff !important;
    }
}



/* Screen layout untuk halaman print card */
.print-page-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f4f8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    margin: 0;
}

.print-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 16px;
}

.print-page-hint {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 24px;
    text-align: center;
}

/* Stage: placeholder ukuran scaled untuk layout flow */
.card-stage {
    /* 85.60mm × 53.98mm scaled 2.4x */
    width: calc(85.60mm * 2.4);
    height: calc(53.98mm * 2.4);
    position: relative;
    flex-shrink: 0;
}

/* Kartu pasien — dalam satuan mm agar presisi tinggi */
.patient-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 85.60mm;
    height: 53.98mm;
    transform: scale(2.4);
    transform-origin: top left;
    background: #ffffff;
    border-radius: 3mm;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}


/* HEADER */
.pc-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 50%, #065f8a 100%);
    padding: 2mm 3mm;
    display: flex;
    align-items: center;
    gap: 2mm;
    flex-shrink: 0;
    height: 16mm;
    position: relative;
    overflow: hidden;
}

.pc-header::before {
    content: '';
    position: absolute;
    width: 30mm;
    height: 30mm;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    top: -10mm;
    right: -5mm;
    pointer-events: none;
}

.pc-logo {
    width: 10mm;
    height: 10mm;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 2mm;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5mm;
    flex-shrink: 0;
    border: 0.3mm solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1;
}

.pc-header-text {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.pc-pusk-name {
    font-size: 5.5pt;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.2;
    white-space: nowrap;
}

.pc-pusk-addr {
    font-size: 4pt;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.35;
    margin-top: 0.4mm;
}

.pc-badge {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 0.3mm solid rgba(255, 255, 255, 0.3);
    border-radius: 1mm;
    padding: 0.5mm 1.5mm;
    position: relative;
    z-index: 1;
}

.pc-badge span {
    font-size: 3pt;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* WAVE */
.pc-wave {
    height: 3mm;
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    clip-path: ellipse(55% 100% at 50% 0%);
    flex-shrink: 0;
    margin-top: -0.5mm;
}

/* BODY */
.pc-body {
    flex: 1;
    display: flex;
    padding: 2mm 5mm 2mm;
    background: #ffffff;
    overflow: hidden;
}

.pc-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-right: 25px;
    margin-right: 25px;
    border-right: 0.3mm dashed #e2e8f0;
    flex-shrink: 0;
}

.pc-qr-section canvas,
.pc-qr-section img {
    width: 20mm !important;
    height: 20mm !important;
    border: 0.5mm solid #e2e8f0;
    border-radius: 1mm;
    padding: 0.5mm;
    background: #fff;
    display: block;
}

.pc-qr-label {
    font-size: 3pt;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 1mm;
    text-align: center;
}

.pc-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 0.7mm;
}

.pc-info-row {
    display: flex;
    align-items: baseline;
    gap: 1mm;
    /* line-height: 1.5; */
}

.pc-lbl {
    font-size: 5pt;
    font-weight: 600;
    color: #64748b;
    min-width: 16mm;
    flex-shrink: 0;
}

.pc-sep {
    font-size: 3.5pt;
    color: #94a3b8;
    flex-shrink: 0;
}

.pc-val {
    font-size: 5pt;
    color: #0f172a;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.pc-val.rm {
    font-size: 5.5pt;
    font-weight: 800;
    color: #0284c7;
    letter-spacing: 0.04em;
}

/* FOOTER STRIP */
.pc-footer-strip {
    background: linear-gradient(90deg, #f1f5f9 0%, #e0f2fe 100%);
    padding: 1mm 3mm;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 0.3mm solid #e2e8f0;
    flex-shrink: 0;
    height: 6mm;
}

.pc-footer-text {
    font-size: 3.5pt;
    color: #64748b;
}

.pc-footer-badge {
    font-size: 3pt;
    font-weight: 700;
    color: #0369a1;
    background: #dbeafe;
    padding: 0.5mm 1.5mm;
    border-radius: 999px;
}

/* PRINT BUTTONS */
.pc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.pc-btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.pc-btn:active {
    transform: translateY(0);
}

.pc-btn-print {
    background: #0ea5e9;
    color: #fff;
}

.pc-btn-print:hover {
    background: #0284c7;
    color: #fff;
}

.pc-btn-png {
    background: #16a34a;
    color: #fff;
}

.pc-btn-png:hover {
    background: #15803d;
    color: #fff;
}

.pc-btn-close {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.pc-btn-close:hover {
    background: #e2e8f0;
    color: #334155;
}

/* === PRINT MEDIA — CARD PAGE === */
@media print {
    .print-page-body {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: unset !important;
        display: block !important;
    }

    @page {
        size: 85.6mm 54mm;
        margin: 0;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .print-controls,
    .print-page-hint {
        display: none !important;
    }

    .card-stage {
        width: 85.6mm !important;
        height: 54mm !important;
        position: relative !important;
        margin: 0 !important;
    }

    .patient-card {
        transform: none !important;
        width: 85.6mm !important;
        height: 54mm !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        position: absolute !important;
        top: 0;
        left: 0;
    }
}



@media (max-width: 700px) {

    .card-stage {
        width: 100%;
        height: auto;
    }

    .patient-card {
        position: relative;
        transform: none;
        /* MATIKAN scale */
        width: 100%;
        height: auto;
    }
}