/* SIKAT-RS — Sistem Informasi Keluhan dan Aset TI Rumah Sakit */
:root {
    --brand: #0b3d5c; --brand-2: #1f7a8c; --brand-soft: #e6f1f4;
    --ink: #16222b; --ink-2: #4a5a66; --ink-3: #7b8b96;
    --line: #dde5ea; --bg: #f4f7f9; --card: #fff;
    --ok: #17794a; --ok-bg: #e4f5ec; --bad: #b42318; --bad-bg: #fdecea;
    --warn: #a16207; --warn-bg: #fef3d6; --info: #175cd3; --info-bg: #e8f0fe;
    --r: 10px; --shadow: 0 1px 2px rgba(16,33,43,.06), 0 2px 8px rgba(16,33,43,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; } h2 { font-size: 1.05rem; margin: 0 0 .75rem; } h3 { font-size: .95rem; margin: 0 0 .5rem; }
.muted { color: var(--ink-3); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* Layout admin */
.app { display: flex; min-height: 100vh; }
.side { width: 230px; background: var(--brand); color: #fff; padding: 1rem .75rem; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { font-weight: 800; font-size: 1.2rem; letter-spacing: .5px; padding: .25rem .5rem; }
.side .logo small { display: block; font-weight: 400; font-size: .72rem; opacity: .75; letter-spacing: 0; }
.side nav { margin-top: 1rem; display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: #d6e6ee; padding: .55rem .75rem; border-radius: 8px; display: block; }
.side nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.side nav a.on { background: #fff; color: var(--brand); font-weight: 600; }
.side .me { margin-top: 1.5rem; padding: .75rem; border-top: 1px solid rgba(255,255,255,.2); font-size: .85rem; }
.side .me button { margin-top: .5rem; }
.main { flex: 1; min-width: 0; padding: 1.25rem 1.5rem 3rem; max-width: 1200px; }
.topbar-m { display: none; }

/* Layout pelapor (mobile first) */
.ubody { max-width: 560px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.uhead { background: var(--brand); color: #fff; padding: .75rem 1rem; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 5; }
.uhead b { font-size: 1.05rem; } .uhead span { font-size: .8rem; opacity: .85; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 5; }
.tabbar a { flex: 1; text-align: center; padding: .6rem 0 .7rem; color: var(--ink-2); font-size: .8rem; }
.tabbar a b { display: block; font-size: 1.3rem; line-height: 1.2; }
.tabbar a.on { color: var(--brand-2); font-weight: 600; }

/* Komponen */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .n { font-size: 1.8rem; font-weight: 700; line-height: 1.1; } .stat .l { color: var(--ink-2); font-size: .85rem; }
.stat.bad .n { color: var(--bad); } .stat.warn .n { color: var(--warn); } .stat.ok .n { color: var(--ok); }

.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .5rem .9rem; border-radius: 8px; font: inherit; cursor: pointer; text-align: center; }
.btn:hover { background: var(--brand-soft); text-decoration: none; }
.btn.pri { background: var(--brand-2); border-color: var(--brand-2); color: #fff; } .btn.pri:hover { background: var(--brand); }
.btn.danger { color: var(--bad); border-color: #f1b5af; } .btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: .25rem .6rem; font-size: .85rem; } .btn.block { display: block; width: 100%; padding: .8rem; font-size: 1.02rem; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }

label { display: block; font-weight: 600; font-size: .88rem; margin: .8rem 0 .25rem; }
label .req { color: var(--bad); }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid #c5d1d9; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,122,140,.35); border-color: var(--brand-2); }
.err { color: var(--bad); font-size: .85rem; margin-top: .2rem; }
.hint { color: var(--ink-3); font-size: .82rem; margin-top: .2rem; }
.row { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; } .check input { width: auto; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; } .filters > * { width: auto; min-width: 130px; } .filters input[type=search] { flex: 1; min-width: 180px; }

.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: #b7e2c9; }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: #f1b5af; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #f1dc9c; }
.alert.info { background: var(--info-bg); color: var(--info); border-color: #bcd0f7; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-2); background: #f8fafb; }
tr:hover td { background: #fbfdfe; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 1rem; }
.tablewrap table { min-width: 640px; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: .35rem .75rem; margin: 0; } dl.kv dt { color: var(--ink-3); font-size: .86rem; } dl.kv dd { margin: 0; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; background: #eef2f5; color: var(--ink-2); }
.prio-p1 { background: #fde2df; color: #a1160c; } .prio-p2 { background: #ffe8cf; color: #a24a00; } .prio-p3 { background: #fff3c4; color: #8a6100; } .prio-p4 { background: #e4eefc; color: #1a4fa8; }
.st-open { background: #e4eefc; color: #1a4fa8; } .st-assigned { background: #ece5fb; color: #5b34b1; } .st-in-progress { background: #d9f2f6; color: #0b6679; }
.st-pending { background: #fff3c4; color: #8a6100; } .st-resolved { background: #dff3e7; color: #17794a; } .st-closed { background: #e6e9ec; color: #4a5a66; }
.st-reopened { background: #fde2df; color: #a1160c; } .st-cancelled { background: #e6e9ec; color: #7b8b96; text-decoration: line-through; }
.as-aktif { background: #dff3e7; color: #17794a; } .as-dalam-perbaikan { background: #fff3c4; color: #8a6100; } .as-rusak { background: #fde2df; color: #a1160c; }
.as-cadangan { background: #e4eefc; color: #1a4fa8; } .as-dihapuskan { background: #e6e9ec; color: #7b8b96; }
.sla-ok { color: var(--ok); } .sla-warning { color: var(--warn); font-weight: 600; } .sla-breach { color: var(--bad); font-weight: 700; } .sla-jeda, .sla-selesai { color: var(--ink-3); }

.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #eef2f5; }
.foto-big { width: 100%; max-height: 300px; object-fit: contain; border-radius: 8px; background: #eef2f5; border: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1rem .9rem; } .timeline li::before { content: ""; position: absolute; left: -1.62rem; top: .35rem; width: 11px; height: 11px; border-radius: 50%; background: var(--brand-2); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand-2); }
.timeline li.internal::before { background: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.timeline li.t-tiket::before { background: #5b34b1; box-shadow: 0 0 0 1px #5b34b1; } .timeline li.t-perbaikan::before { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); } .timeline li.t-mutasi::before { background: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.timeline .when { font-size: .78rem; color: var(--ink-3); }

.pagination { display: flex; gap: .25rem; list-style: none; padding: 0; justify-content: center; flex-wrap: wrap; }
.page-link, .pagination span.page-link { display: block; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.page-item.active .page-link { background: var(--brand-2); color: #fff; border-color: var(--brand-2); } .page-item.disabled .page-link { color: var(--ink-3); }

/* Pilihan besar (dampak / urgensi) */
.pilih { display: grid; gap: .5rem; } .pilih label { margin: 0; font-weight: 400; border: 1px solid #c5d1d9; border-radius: 10px; padding: .6rem .8rem; display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; background: #fff; }
.pilih label:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand-2); }
.pilih input { width: auto; margin-top: .25rem; } .pilih b { display: block; }
.prio-preview { text-align: center; padding: .75rem; border-radius: 10px; background: var(--brand-soft); margin-top: .75rem; }

/* Scanner */
#reader { width: 100%; border-radius: 14px; overflow: hidden; background: #0b1a22; min-height: 260px; }
#reader video { border-radius: 14px; }
.scan-box { text-align: center; }
.aset-hero { display: flex; gap: .9rem; } .aset-hero img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); flex-shrink: 0; background: #eef2f5; }
.aset-hero h1 { margin-bottom: .1rem; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, var(--brand), var(--brand-2)); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 1.75rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { text-align: center; color: var(--brand); font-size: 1.6rem; margin: 0; }
.login-card .sub { text-align: center; color: var(--ink-3); font-size: .85rem; margin-bottom: 1rem; }

/* Label QR (cetak) */
.labels { display: flex; flex-wrap: wrap; gap: 6mm; }
.lbl { width: 50mm; height: 30mm; border: 1px dashed #999; display: flex; align-items: center; gap: 2mm; padding: 2mm; overflow: hidden; page-break-inside: avoid; background: #fff; }
.lbl svg { width: 24mm; height: 24mm; flex-shrink: 0; } .lbl .t { font-size: 7.5pt; line-height: 1.25; min-width: 0; }
.lbl .t b { font-size: 9.5pt; display: block; } .lbl .t div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noprint-bar { padding: 1rem; display: flex; gap: .5rem; align-items: center; background: #fff; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.qr-box svg { width: 100%; max-width: 220px; height: auto; }

@media (max-width: 860px) {
    .app { display: block; }
    .side { position: fixed; z-index: 20; left: -250px; width: 230px; transition: left .2s; } .side.open { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
    .topbar-m { display: flex; align-items: center; gap: .75rem; background: var(--brand); color: #fff; padding: .6rem 1rem; position: sticky; top: 0; z-index: 10; }
    .topbar-m button { background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
    .main { padding: 1rem 1rem 3rem; }
    .g3, .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) { .g2, .g3, .row { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, 1fr); } dl.kv { grid-template-columns: 110px 1fr; } }

@media print {
    body { background: #fff; } .noprint, .noprint-bar { display: none !important; }
    .lbl { border: 1px solid #bbb; } @page { margin: 8mm; }
}
