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

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

body {
    background: #eef2f7;
    color: #1f2d3d;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 14px;
}

.font-mono, .mono {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

.text-purple { color: #6d45d9 !important; }

.min-w-0 { min-width: 0; }

.border-dashed { border-style: dashed !important; }

/* ---------------------------------------------------------------- Layout */

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

.app-sidebar {
    width: 268px;
    flex: 0 0 268px;
    background: linear-gradient(180deg, #0f2540 0%, #102f4d 45%, #0b2038 100%);
    color: #e6eef8;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    overflow-y: auto;
    box-shadow: 4px 0 28px rgba(15, 37, 64, .18);
    z-index: 20;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
    padding: 4px 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.sidebar-brand:hover { color: #fff; }

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2f9bf5, #17c3a2);
    box-shadow: 0 6px 18px rgba(23, 195, 162, .35);
    font-size: 1.15rem;
    color: #fff;
}

.brand-text strong {
    display: block;
    font-size: 1.05rem;
    letter-spacing: .3px;
}

.brand-text small {
    color: rgba(230, 238, 248, .6);
    font-size: .72rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.sidebar-institusi {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 16px 8px 8px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .07);
    font-size: .82rem;
}

.sidebar-institusi .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ee6a8;
    box-shadow: 0 0 0 4px rgba(46, 230, 168, .18);
    margin-top: 6px;
    flex: 0 0 auto;
}

.sidebar-nav {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-label {
    font-size: .66rem;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: rgba(230, 238, 248, .42);
    padding: 16px 12px 6px;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(230, 238, 248, .78);
    text-decoration: none;
    font-size: .885rem;
    font-weight: 500;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-item i { font-size: 1rem; opacity: .9; }

.nav-item:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    transform: translateX(3px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(47, 155, 245, .95), rgba(23, 195, 162, .7));
    color: #fff;
    box-shadow: 0 6px 16px rgba(47, 155, 245, .3);
}

.sidebar-foot { margin-top: auto; padding-top: 22px; }

.sidebar-foot .card-soft {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .1);
    color: #e6eef8;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 26px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e3e9f2;
}

.topbar-title { flex: 1 1 auto; min-width: 0; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid #e3e9f2;
}

.avatar-chip {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    color: #fff;
    background: linear-gradient(135deg, #2f9bf5, #6f5ef9);
    box-shadow: 0 6px 16px rgba(47, 155, 245, .32);
}

.app-content {
    flex: 1 1 auto;
    padding: 24px 26px 8px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 26px 24px;
    font-size: .78rem;
    color: #7b8a9e;
}

.app-offcanvas .nav-item {
    color: #34465c;
    margin-bottom: 4px;
}

.app-offcanvas .nav-item.active {
    color: #fff;
}

/* ------------------------------------------------------------ Components */

.app-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: 14px;
    padding: 14px 16px;
    color: #fff;
}

.app-alert > i { font-size: 1.25rem; margin-top: 2px; }
.app-alert > div { flex: 1 1 auto; }
.app-alert .btn-close { filter: invert(1) grayscale(1) brightness(2); }

.alert-success.app-alert { background: linear-gradient(120deg, #12855f, #17a673); }
.alert-danger.app-alert { background: linear-gradient(120deg, #b02a37, #dc3545); }
.alert-info.app-alert { background: linear-gradient(120deg, #0a7ea4, #17a2b8); }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-head h2 {
    font-weight: 800;
    letter-spacing: -.4px;
    margin: 0;
}

.card-soft {
    background: #fff;
    border: 1px solid #e6ecf5;
    border-radius: 16px;
    box-shadow: 0 6px 22px rgba(31, 45, 61, .06);
}

.card-soft .card-header {
    background: transparent;
    border-bottom: 1px solid #eef2f7;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    flex-wrap: wrap;
}

.card-soft .card-body { padding: 18px; }

.card-hover {
    transition: transform .18s ease, box-shadow .18s ease;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 34px rgba(31, 45, 61, .11);
}

/* Stat cards */

.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--sc-1), var(--sc-2));
    box-shadow: 0 12px 28px var(--sc-shadow);
    height: 100%;
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -34px;
    top: -34px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.stat-card::before {
    content: '';
    position: absolute;
    right: 18px;
    bottom: -46px;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.stat-card .stat-ikon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .2);
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.stat-card .stat-nilai {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.6px;
}

.stat-card .stat-label {
    font-size: .82rem;
    opacity: .92;
    font-weight: 600;
}

.stat-card .stat-ket {
    font-size: .74rem;
    opacity: .78;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.sc-primary { --sc-1: #2f9bf5; --sc-2: #1c6fd0; --sc-shadow: rgba(47, 155, 245, .28); }
.sc-success { --sc-1: #23c48c; --sc-2: #0f8f68; --sc-shadow: rgba(35, 196, 140, .28); }
.sc-info    { --sc-1: #38bdf8; --sc-2: #0284c7; --sc-shadow: rgba(56, 189, 248, .28); }
.sc-warning { --sc-1: #fbbf24; --sc-2: #d97706; --sc-shadow: rgba(251, 191, 36, .3); }
.sc-danger  { --sc-1: #fb7185; --sc-2: #d32f4a; --sc-shadow: rgba(251, 113, 133, .28); }
.sc-dark    { --sc-1: #64748b; --sc-2: #334155; --sc-shadow: rgba(71, 85, 105, .3); }
.sc-purple  { --sc-1: #a78bfa; --sc-2: #6d45d9; --sc-shadow: rgba(167, 139, 250, .3); }

/* Tables */

.table-app {
    margin: 0;
    font-size: .875rem;
}

.table-app > thead th {
    background: #f7f9fc;
    border-bottom: 1px solid #e6ecf5;
    color: #6b7a8f;
    font-size: .72rem;
    letter-spacing: .9px;
    text-transform: uppercase;
    font-weight: 700;
    padding: 12px 14px;
    white-space: nowrap;
}

.table-app > tbody td {
    padding: 13px 14px;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.table-app > tbody tr { transition: background .14s ease; }
.table-app > tbody tr:hover { background: #f8fbff; }

.table-wrap {
    overflow-x: auto;
    border-radius: 0 0 16px 16px;
}

/* Badges & pills */

.soft-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .2px;
}

.soft-primary { background: #e3f0ff; color: #1263b5; }
.soft-success { background: #dcf7ea; color: #0b7a52; }
.soft-info    { background: #dcf5fc; color: #066b91; }
.soft-warning { background: #fdf0d5; color: #96620a; }
.soft-danger  { background: #fde2e6; color: #b02a37; }
.soft-dark    { background: #e4e8ee; color: #34465c; }
.soft-purple  { background: #ede6fd; color: #5b32c4; }
.soft-secondary { background: #eef1f5; color: #5a6b80; }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .8rem;
    color: #fff;
    flex: 0 0 auto;
}

.avatar-lg { width: 62px; height: 62px; border-radius: 18px; font-size: 1.1rem; }

.bg-primary { background: linear-gradient(135deg, #2f9bf5, #1c6fd0) !important; }
.bg-success { background: linear-gradient(135deg, #23c48c, #0f8f68) !important; }
.bg-info    { background: linear-gradient(135deg, #38bdf8, #0284c7) !important; }
.bg-warning { background: linear-gradient(135deg, #fbbf24, #d97706) !important; }
.bg-danger  { background: linear-gradient(135deg, #fb7185, #d32f4a) !important; }
.bg-dark    { background: linear-gradient(135deg, #64748b, #334155) !important; }
.bg-purple  { background: linear-gradient(135deg, #a78bfa, #6d45d9) !important; }
.bg-secondary { background: linear-gradient(135deg, #94a3b8, #64748b) !important; }

/* Filter toolbar */

.filter-bar {
    background: #fff;
    border: 1px solid #e6ecf5;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 6px 20px rgba(31, 45, 61, .05);
}

.filter-bar .form-label {
    font-size: .72rem;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #6b7a8f;
    font-weight: 700;
    margin-bottom: 4px;
}

.form-control, .form-select {
    border-radius: 10px;
    border-color: #dde5ef;
    font-size: .875rem;
    padding: 9px 12px;
}

.form-control:focus, .form-select:focus {
    border-color: #2f9bf5;
    box-shadow: 0 0 0 .2rem rgba(47, 155, 245, .14);
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    font-size: .86rem;
    padding: 9px 16px;
}

.btn-lg { padding: 11px 20px; font-size: .92rem; }

.btn-primary {
    background: linear-gradient(135deg, #2f9bf5, #1c6fd0);
    border: none;
    box-shadow: 0 6px 16px rgba(47, 155, 245, .28);
}

.btn-primary:hover { background: linear-gradient(135deg, #1c6fd0, #155aa8); }

.btn-soft {
    background: #fff;
    border: 1px solid #e0e7f1;
    color: #34465c;
}

.btn-soft:hover { background: #f4f8fd; border-color: #cbd8e8; }

/* Patient panel */

.info-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.info-list li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px dashed #eaeff6;
    font-size: .85rem;
}

.info-list li:last-child { border-bottom: 0; }

.info-list .label { color: #7b8a9e; flex: 0 0 auto; }

.info-list .value {
    font-weight: 600;
    color: #1f2d3d;
    text-align: right;
    word-break: break-word;
}

.section-title {
    font-size: .74rem;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    color: #8c9bb0;
    font-weight: 700;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: #eaeff6;
}

/* Timeline */

.timeline {
    position: relative;
    padding-left: 30px;
    margin: 0;
    list-style: none;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(180deg, #2f9bf5, #e6ecf5);
    border-radius: 2px;
}

.tl-item {
    position: relative;
    margin-bottom: 14px;
}

.tl-item .tl-dot {
    position: absolute;
    left: -26px;
    top: 18px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #2f9bf5;
    box-shadow: 0 0 0 3px #fff;
}

.tl-card {
    background: #fff;
    border: 1px solid #e8eef6;
    border-left: 4px solid #2f9bf5;
    border-radius: 13px;
    padding: 12px 14px;
    transition: box-shadow .16s ease, transform .16s ease;
}

.tl-card:hover {
    box-shadow: 0 10px 24px rgba(31, 45, 61, .09);
    transform: translateX(2px);
}

.tl-card.w-info    { border-left-color: #0ea5e9; }
.tl-card.w-success { border-left-color: #10b981; }
.tl-card.w-warning { border-left-color: #f59e0b; }
.tl-card.w-danger  { border-left-color: #ef4444; }
.tl-card.w-secondary { border-left-color: #94a3b8; }
.tl-card.w-purple  { border-left-color: #8b5cf6; }

.tl-item .tl-dot.w-info    { border-color: #0ea5e9; }
.tl-item .tl-dot.w-success { border-color: #10b981; }
.tl-item .tl-dot.w-warning { border-color: #f59e0b; }
.tl-item .tl-dot.w-danger  { border-color: #ef4444; }
.tl-item .tl-dot.w-secondary { border-color: #94a3b8; }
.tl-item .tl-dot.w-purple  { border-color: #8b5cf6; }

.tl-time {
    font-size: .74rem;
    font-weight: 700;
    color: #5a6b80;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
}

.tl-text {
    font-size: .9rem;
    font-weight: 600;
    color: #1f2d3d;
    line-height: 1.45;
}

.tl-item.done .tl-text { text-decoration: line-through; color: #94a3b8; }
.tl-item.done .tl-card { background: #fafbfd; }

.tl-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px -30px;
    padding-left: 30px;
}

.tl-group-date {
    font-weight: 800;
    font-size: .9rem;
    color: #1f2d3d;
}

.tl-group-line { flex: 1 1 auto; height: 1px; background: #eaeff6; }

.dpjp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #47576b;
}

.dpjp-chip .mini-avatar {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: .58rem;
    color: #fff;
    background: #64748b;
}

/* KPI strip */

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    background: #eaeff6;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #eaeff6;
}

.kpi-item {
    background: #fff;
    padding: 14px 12px;
    text-align: center;
}

.kpi-item .kpi-nilai {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1f2d3d;
    line-height: 1.1;
}

.kpi-item .kpi-label {
    font-size: .7rem;
    color: #8c9bb0;
    letter-spacing: .7px;
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 3px;
}

.chart-box { position: relative; height: 260px; }

.legend-list { list-style: none; margin: 0; padding: 0; }

.legend-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    font-size: .83rem;
    border-bottom: 1px dashed #eef2f7;
}

.legend-list li:last-child { border-bottom: 0; }

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: 0 0 auto;
}

.bar-row { margin-bottom: 12px; }
.bar-row:last-child { margin-bottom: 0; }

.bar-track {
    height: 8px;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
    margin-top: 5px;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2f9bf5, #17c3a2);
}

.empty-state {
    text-align: center;
    padding: 46px 20px;
    color: #8c9bb0;
}

.empty-state i {
    font-size: 2.6rem;
    opacity: .35;
    display: block;
    margin-bottom: 10px;
}

.pagination {
    gap: 4px;
}

.page-link {
    border-radius: 9px !important;
    border-color: #e6ecf5;
    color: #47576b;
    font-size: .84rem;
    padding: 7px 12px;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #2f9bf5, #1c6fd0);
    border-color: transparent;
}

.step-badge {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    font-size: .75rem;
    font-weight: 800;
    background: #e3f0ff;
    color: #1263b5;
    flex: 0 0 auto;
}

.form-section {
    border: 1px solid #eaeff6;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    background: #fcfdff;
}

.form-section > h3 {
    font-size: .95rem;
    font-weight: 800;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section > h3 i { color: #2f9bf5; }

.patient-preview {
    background: linear-gradient(135deg, #f0f7ff, #f4fbf8);
    border: 1px dashed #bcd8f5;
    border-radius: 14px;
    padding: 14px;
}

.auto-note {
    background: linear-gradient(120deg, #f0f9f4, #eef6ff);
    border: 1px dashed #9fdcc0;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: .82rem;
    color: #1f4f3d;
}

.auto-note ul { margin: 6px 0 0; padding-left: 18px; }
.auto-note li { margin-bottom: 2px; }

.dropdown-menu {
    border-radius: 12px;
    border-color: #e6ecf5;
    box-shadow: 0 12px 30px rgba(31, 45, 61, .12);
    font-size: .85rem;
}

.dropdown-item:active { background: #2f9bf5; }

.modal-content { border-radius: 18px; border: 0; }

.list-group-soft > .list-group-item {
    background: transparent;
    border-color: #f1f5f9;
    padding: 12px 0;
}

.scroll-y { max-height: 420px; overflow-y: auto; }

.slim-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.slim-scroll::-webkit-scrollbar-thumb { background: #d3dde9; border-radius: 9px; }
.slim-scroll::-webkit-scrollbar-track { background: transparent; }

.clock-badge { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Auth */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(900px 520px at 8% -12%, rgba(47, 155, 245, .18), transparent 60%),
        radial-gradient(820px 500px at 108% 112%, rgba(23, 195, 162, .16), transparent 55%),
        #eef2f7;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #e6ecf5;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 37, 64, .14);
    padding: 30px 28px 26px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    margin-bottom: 20px;
}

.login-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    display: block;
    margin: 0 auto 4px;
}

.login-brand .brand-text strong { color: #0f2540; }
.login-brand .brand-text small { color: #7b8a9e; }

/* ------------------------------------------------------------- Responsive */

@media (max-width: 991.98px) {
    .app-content { padding: 18px 16px 8px; }
    .app-topbar { padding: 12px 16px; }
    .app-footer { padding: 14px 16px 20px; }
}

/* ----------------------------------------------------------------- Print */

@media print {
    .app-sidebar,
    .app-topbar,
    .app-footer,
    .no-print,
    .offcanvas { display: none !important; }

    body, .app-body { background: #fff; }
    .app-shell, .app-main { display: block; }
    .app-content { padding: 0; gap: 10px; }
    .card-soft, .tl-card { box-shadow: none !important; border-color: #d5dde8 !important; break-inside: avoid; }
    .print-only { display: block !important; }
    .tl-item { break-inside: avoid; }
    a { text-decoration: none; color: inherit; }
}

.print-only { display: none; }

/* ---------------------------------------------------------------- Terapi */

.terapi-box {
    border: 1px dashed #b9e4cd;
    border-radius: 14px;
    padding: 16px;
    background: #f5fcf8;
}

.terapi-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 800;
    font-size: .9rem;
    color: #147a4b;
}

.terapi-box-head i { color: #1a9a5f; }

.terapi-row {
    border: 1px solid #d9ede2;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}

.tim-dokter-row {
    border: 1px solid #eaeff6;
    border-radius: 14px;
    padding: 12px;
    background: #fbfdff;
}

.tim-dokter-row + .tim-dokter-row { margin-top: 10px; }
