:root {
  --bg: #F1F5F9; --card: #FFFFFF; --text: #0F172A; --muted: #64748B; --line: #E2E8F0;
  --primary: #4F46E5; --primary-2: #6366F1; --ok: #10B981; --warn: #F59E0B; --danger: #EF4444; --idle: #94A3B8;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* layout */
.layout { display: flex; min-height: 100vh; }
.side { width: 230px; background: #0F172A; color: #CBD5E1; padding: 18px 12px; position: sticky; top: 0; height: 100vh; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; padding: 4px 8px 18px; }
.brand img { width: 34px; height: 34px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #CBD5E1; padding: 10px 12px; border-radius: 10px; margin-bottom: 2px; }
.nav a:hover { background: #1E293B; color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav .ico { width: 20px; text-align: center; }
.side .foot { margin-top: auto; font-size: 12px; color: #64748B; padding: 8px; }
.main { flex: 1; min-width: 0; padding: 22px 26px 80px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { font-size: 22px; margin: 0; flex: 1; }
.mobile-head { display: none; }
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .side { display: none; }
  .main { padding: 14px 12px 90px; }
  .mobile-head { display: flex; align-items: center; gap: 10px; background: #0F172A; color: #fff; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 5; font-weight: 700; font-size: 17px; }
  .mobile-head img { width: 28px; height: 28px; }
  .mobile-head .sp { flex: 1; }
  .layout { flex-direction: column; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; text-align: center; padding: 8px 2px 6px; color: var(--muted); font-size: 11px; }
  .bottom-nav a .ico { display: block; font-size: 20px; line-height: 1.2; }
  .bottom-nav a.active { color: var(--primary); font-weight: 600; }
  .topbar h1 { font-size: 19px; }
}

/* components */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid > .card, .stats > .card { margin-top: 0; }
.grid > *, .stats > * { min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid.pcs { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .grid.two { grid-template-columns: minmax(0, 1fr); } .grid.pcs { grid-template-columns: minmax(0, 1fr); } .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .main { width: 100%; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, monospace; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #CBD5E1; background: #F8FAFC; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #4338CA; }
.btn.danger { background: #FEF2F2; border-color: #FECACA; color: #B91C1C; }
.btn.warn { background: #FFFBEB; border-color: #FDE68A; color: #B45309; }
.btn.ok { background: #ECFDF5; border-color: #A7F3D0; color: #047857; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: #fff; color: var(--text); width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.days input { display: none; }
.days input:checked + span { color: var(--primary); font-weight: 700; }
.days label:has(input:checked) { border-color: var(--primary); background: #EEF2FF; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #F1F5F9; color: var(--muted); white-space: nowrap; }
.badge.ok { background: #ECFDF5; color: #047857; }
.badge.warn { background: #FFFBEB; color: #B45309; }
.badge.danger { background: #FEF2F2; color: #B91C1C; }
.badge.info { background: #EEF2FF; color: #4338CA; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* pc card */
.pc { cursor: pointer; transition: transform .1s; position: relative; }
.pc:hover { transform: translateY(-2px); }
.pc .head { display: flex; align-items: center; gap: 10px; }
.pc .name { font-weight: 700; font-size: 16px; }
.pc .who { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #E2E8F0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.pc .app { margin-top: 10px; background: #F8FAFC; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.pc .meta { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat .v { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; }

.bar { height: 8px; background: #EEF2FF; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #0EA5E9); border-radius: 99px; }
.app-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px; gap: 4px 12px; align-items: center; padding: 7px 0; }
.app-row .bar { grid-column: 1 / -1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.shot { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; }
.shot img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #E2E8F0; }
.shot .cap { padding: 7px 9px; font-size: 12px; }

.live { background: #0F172A; border-radius: var(--radius); overflow: hidden; position: relative; min-height: 220px; display: flex; align-items: center; justify-content: center; color: #94A3B8; }
.live img { width: 100%; display: block; }
.live.control img { cursor: crosshair; }
.live .tag { position: absolute; top: 10px; left: 10px; background: rgba(239,68,68,.9); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }

.timeline td.dur { white-space: nowrap; text-align: right; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #312E81, #0EA5E9); padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login img { width: 64px; height: 64px; display: block; margin: 0 auto 8px; }
.login h2 { text-align: center; margin: 0 0 4px; }

/* toast & modal */
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: #0F172A; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 90vw; }
#toast div.err { background: #B91C1C; }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; padding: 20px; }
.modal-box.wide { max-width: 1000px; padding: 10px; }
.modal-box h3 { margin: 0 0 14px; }
.modal-box img.full { width: 100%; border-radius: 10px; display: block; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: s .7s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }

/* permintaan izin istirahat */
.req-wrap { border: 2px solid #FDE68A; background: #FFFBEB; margin-bottom: 14px; }
.reqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.req { display: flex; gap: 12px; background: #fff; border-radius: 12px; padding: 10px; box-shadow: var(--shadow); min-width: 0; }
.req img, .req .noimg { width: 110px; height: 82px; border-radius: 10px; object-fit: cover; flex-shrink: 0; cursor: pointer; background: #E2E8F0; }
.req .noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; cursor: default; }
.req-body { min-width: 0; flex: 1; }
.req-name { font-weight: 700; font-size: 15px; }
.req-reason { font-style: italic; margin-top: 4px; font-size: 13px; }
@media (max-width: 860px) { .reqs { grid-template-columns: minmax(0, 1fr); } .req img, .req .noimg { width: 90px; height: 68px; } }
