/* ============================================================
   RSUD RAA Soewondo Pati — Manajemen Mutu
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --teal-900: #0f4c4a;
    --teal-700: #0f766e;
    --teal-600: #14867d;
    --teal-500: #17a094;
    --teal-100: #e3f3f1;
    --teal-50: #f2f9f8;

    --ink-900: #16211f;
    --ink-700: #3c4a48;
    --ink-500: #6b7876;
    --ink-300: #9aa5a3;

    --line: #e4e9e8;
    --line-soft: #edf1f0;
    --bg: #f6f8f7;
    --card: #ffffff;

    --amber-bg: #fdf1de;
    --amber-fg: #b4690e;
    --red-bg: #fbe7e6;
    --red-fg: #c2382e;
    --green-bg: #e2f4ea;
    --green-fg: #1f8a4c;
    --blue-bg: #e5edfb;
    --blue-fg: #2a5cb8;

    --radius: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 1px 2px rgba(15, 33, 31, 0.05), 0 1px 0 rgba(15, 33, 31, 0.03);
    --shadow-modal: 0 24px 60px rgba(12, 30, 28, 0.24);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ink-900);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

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

.sidebar {
    width: 264px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-top { display: flex; flex-direction: column; gap: 22px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-icon {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(160deg, var(--teal-600), var(--teal-900));
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.brand-title { font-weight: 800; font-size: 14.5px; line-height: 1.2; letter-spacing: -0.01em; }
.brand-sub { font-size: 10.5px; color: var(--ink-500); letter-spacing: 0.06em; font-weight: 600; }

.nav-section-label {
    font-size: 11px; font-weight: 700; color: var(--ink-300);
    letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 10px;
}

.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    font-size: 13.5px; font-weight: 600; color: var(--ink-700);
    transition: background .12s ease, color .12s ease;
}
.nav-item svg { flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--teal-50); color: var(--teal-900); }
.nav-item.active { background: var(--teal-100); color: var(--teal-900); }

.sidebar-bottom { display: flex; flex-direction: column; gap: 12px; position: relative; }

.workspace-note {
    display: flex; gap: 9px; align-items: flex-start;
    background: var(--teal-50); border: 1px solid var(--teal-100);
    border-radius: var(--radius); padding: 10px 12px;
}
.workspace-title { font-size: 12.5px; font-weight: 700; color: var(--teal-900); }
.workspace-sub { font-size: 11px; color: var(--ink-500); margin-top: 1px; }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 10px; border: 1px solid var(--line);
    cursor: pointer; background: #fff; transition: background .12s ease;
}
.user-chip:hover { background: var(--teal-50); }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--teal-700); color: #fff; font-weight: 700; font-size: 13px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10.5px; color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip svg { color: var(--ink-300); flex-shrink: 0; }

.user-menu {
    display: none; position: absolute; bottom: 58px; left: 0; right: 0;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-card); overflow: hidden;
}
.user-menu.open { display: block; }
.user-menu-item { display: block; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--red-fg); }
.user-menu-item:hover { background: var(--red-bg); }

/* ---------- Main / topbar ---------- */
.main { flex: 1; min-width: 0; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 32px; border-bottom: 1px solid var(--line); background: #fff;
}
.breadcrumb { font-size: 13px; color: var(--ink-500); }
.breadcrumb .sep { margin: 0 6px; color: var(--ink-300); }
.breadcrumb strong { color: var(--ink-900); font-weight: 700; }
.topbar-date {
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; color: var(--ink-500); font-weight: 600;
}

.page-body { padding: 28px 32px 60px; max-width: 1400px; }

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; margin-bottom: 26px; flex-wrap: wrap;
}
.eyebrow {
    display: flex; align-items: center; gap: 7px;
    font-size: 12.5px; font-weight: 700; color: var(--teal-700);
    letter-spacing: 0.03em; margin-bottom: 8px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-teal { background: var(--teal-500); }

.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
.page-desc { font-size: 14px; color: var(--ink-500); margin: 0; max-width: 520px; line-height: 1.5; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 18px; border-radius: 9px; border: none;
    font-size: 13.5px; font-weight: 700; white-space: nowrap;
    transition: transform .06s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal-700); color: #fff; box-shadow: 0 1px 2px rgba(15,76,74,.25); }
.btn-primary:hover { background: var(--teal-900); }
.btn-ghost { background: #fff; color: var(--ink-700); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--teal-50); border-color: var(--teal-100); }
.btn-block { width: 100%; justify-content: center; padding: 12px; }

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 18px; display: flex; gap: 14px; align-items: flex-start;
    box-shadow: var(--shadow-card);
}
.stat-icon {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.stat-icon-blue { background: var(--blue-bg); color: var(--blue-fg); }
.stat-icon-amber { background: var(--amber-bg); color: var(--amber-fg); }
.stat-icon-red { background: var(--red-bg); color: var(--red-fg); }
.stat-icon-green { background: var(--green-bg); color: var(--green-fg); }

.stat-label { font-size: 12.5px; color: var(--ink-500); font-weight: 600; }
.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -0.01em; margin: 3px 0 2px; }
.stat-sub { font-size: 11.5px; color: var(--ink-300); }

/* ---------- Panel / table ---------- */
.panel {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card); overflow: hidden;
}
.panel-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 22px 24px 18px; gap: 16px; flex-wrap: wrap;
}
.panel-head h2 { font-size: 18px; font-weight: 800; margin: 0 0 4px; }
.panel-head p { font-size: 13px; color: var(--ink-500); margin: 0; }
.count-pill {
    background: var(--teal-50); color: var(--teal-700); font-weight: 700; font-size: 12px;
    padding: 6px 12px; border-radius: 100px; white-space: nowrap;
}

.toolbar {
    display: flex; gap: 10px; padding: 0 24px 18px; flex-wrap: wrap;
}
.search-box {
    flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
    color: var(--ink-300); background: #fbfcfc;
}
.search-box input {
    border: none; outline: none; background: transparent; flex: 1;
    font-size: 13.5px; color: var(--ink-900);
}
.select-input {
    border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
    font-size: 13.5px; color: var(--ink-700); background: #fbfcfc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7876' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none; padding-right: 30px; min-width: 150px; font-weight: 600;
}

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    text-align: left; font-size: 11px; font-weight: 700; color: var(--ink-300);
    letter-spacing: 0.06em; text-transform: uppercase;
    padding: 10px 24px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line);
    background: #fbfcfc; white-space: nowrap;
}
.data-table tbody td { padding: 15px 24px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfdfc; }
.data-table tbody tr:last-child td { border-bottom: none; }

.cell-strong { font-size: 13.5px; font-weight: 700; color: var(--ink-900); }
.cell-meta {
    font-size: 12px; color: var(--ink-500); margin-top: 3px;
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.cell-meta svg { flex-shrink: 0; }
.cell-kategori { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; max-width: 320px; }

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 100px;
}
.badge-dampak-ringan { background: var(--green-bg); color: var(--green-fg); }
.badge-dampak-sedang { background: var(--amber-bg); color: var(--amber-fg); }
.badge-dampak-berat { background: var(--red-bg); color: var(--red-fg); }
.badge-dampak-kritis { background: #4a1414; color: #ffb4ab; }

.badge-status-baru { background: var(--blue-bg); color: var(--blue-fg); }
.badge-status-proses { background: var(--amber-bg); color: var(--amber-fg); }
.badge-status-selesai { background: var(--green-bg); color: var(--green-fg); }

.cell-action { text-align: right; }
.icon-btn {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
    background: #fff; display: inline-flex; align-items: center; justify-content: center;
    color: var(--ink-500); transition: all .12s ease;
}
.icon-btn:hover { background: var(--teal-50); border-color: var(--teal-100); color: var(--teal-700); }

.empty-row td, .no-results { text-align: center; color: var(--ink-300); padding: 40px 24px; font-size: 13.5px; }
.no-results { display: none; }

.panel-foot {
    display: flex; align-items: center; gap: 8px;
    padding: 16px 24px; border-top: 1px solid var(--line-soft);
    font-size: 12px; color: var(--ink-300);
}
.panel-foot svg { color: var(--teal-500); flex-shrink: 0; }

/* ---------- Statistik / Charts ---------- */
.range-form { flex-shrink: 0; }
.range-form .select-input { min-width: 190px; }

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.chart-card-wide { grid-column: 1 / -1; }
.chart-card .panel-head { padding-bottom: 8px; }
.chart-body { padding: 6px 24px 24px; height: 260px; position: relative; }
.chart-body-tall { height: 320px; }

@media (max-width: 1080px) {
    .chart-grid { grid-template-columns: 1fr; }
    .chart-card-wide { grid-column: auto; }
}

/* ---------- Modal ---------- */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 100;
    background: rgba(15, 33, 31, 0.45); backdrop-filter: blur(2px);
    align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal-panel {
    background: #fff; border-radius: 16px; width: 100%; max-width: 640px;
    padding: 30px 32px 26px; box-shadow: var(--shadow-modal); position: relative;
}
.modal-close {
    position: absolute; top: 20px; right: 20px;
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: #f2f4f3; color: var(--ink-500); display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--line); }

.modal-eyebrow { font-size: 11.5px; font-weight: 800; color: var(--teal-600); letter-spacing: 0.08em; margin-bottom: 6px; }
.modal-title { font-size: 22px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.01em; }
.modal-desc { font-size: 13.5px; color: var(--ink-500); margin: 0 0 20px; }

.modal-section { border-top: 1px solid var(--line-soft); padding-top: 20px; margin-top: 20px; }
.modal-section:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }

.section-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.section-num {
    width: 24px; height: 24px; border-radius: 7px; background: var(--teal-100); color: var(--teal-700);
    font-size: 11.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.section-title { font-size: 14.5px; font-weight: 800; }
.section-sub { font-size: 12px; color: var(--ink-500); margin-top: 1px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row.two { grid-template-columns: 1fr 1fr; }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field.full { width: 100%; }
.form-field label { font-size: 12.5px; font-weight: 700; color: var(--ink-700); }

.form-field input, .form-field select, .form-field textarea {
    border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
    font-size: 13.5px; color: var(--ink-900); outline: none; background: #fff;
    transition: border-color .12s ease, box-shadow .12s ease;
    width: 100%;
}
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--ink-300); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(23, 160, 148, 0.13);
}
.form-field textarea { resize: vertical; min-height: 70px; }
.input-readonly { background: var(--teal-50); color: var(--teal-700); font-weight: 700; border-color: var(--teal-100) !important; }

.modal-error {
    background: var(--red-bg); color: var(--red-fg); font-size: 13px; font-weight: 600;
    padding: 10px 14px; border-radius: 9px; margin-bottom: 16px;
}

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 20% 15%, #eaf5f3, var(--bg) 55%);
    padding: 24px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
    background: #fff; border: 1px solid var(--line); border-radius: 18px;
    padding: 34px 32px; box-shadow: 0 20px 50px rgba(15, 33, 31, 0.10);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.login-heading { font-size: 21px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.01em; }
.login-desc { font-size: 13.5px; color: var(--ink-500); margin: 0 0 22px; }

.login-form { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--ink-700); margin-top: 10px; }
.login-form input {
    border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px;
    font-size: 13.5px; outline: none; margin-bottom: 4px;
}
.login-form input:focus { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(23,160,148,.13); }
.login-form .btn { margin-top: 18px; }

.alert-error {
    background: var(--red-bg); color: var(--red-fg); font-size: 13px; font-weight: 600;
    padding: 10px 14px; border-radius: 9px; margin-bottom: 16px;
}

.login-hint {
    display: flex; align-items: center; gap: 7px; margin-top: 22px;
    font-size: 11.5px; color: var(--ink-500); background: var(--teal-50);
    border-radius: 9px; padding: 10px 12px; line-height: 1.5;
}
.shield-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-500); flex-shrink: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; }
    .sidebar-top, .sidebar-bottom { flex-direction: row; align-items: center; }
    .nav-list { flex-direction: row; }
    .page-body { padding: 20px 16px 40px; }
    .topbar { padding: 14px 16px; }
    .stat-grid { grid-template-columns: 1fr; }
}
