* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --danger: #dc2626; --success: #16a34a; --warning: #d97706;
  --sidebar: #0f172a; --sidebar-text: #cbd5e1; --bg: #f1f5f9; --card: #fff; --border: #e2e8f0;
  --text: #0f172a; --muted: #64748b;
}
body { font-family: "Segoe UI", Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 230px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; z-index: 10; }
.brand { padding: 18px 16px; font-weight: 700; color: #fff; font-size: 15px; border-bottom: 1px solid #1e293b; line-height: 1.3; }
.sidebar nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar nav a { display: block; padding: 10px 16px; color: var(--sidebar-text); text-decoration: none; font-size: 13px; }
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid #1e293b; font-size: 12px; }
.user-name { color: #fff; margin-bottom: 6px; }
.badge { background: var(--primary); color: #fff; padding: 1px 8px; border-radius: 10px; font-size: 11px; text-transform: uppercase; }
.logout { color: #f87171; text-decoration: none; font-size: 12px; }
.main { margin-left: 230px; padding: 20px 24px; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 8px; }
.topbar h1 { font-size: 20px; }
.date { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card h2 { font-size: 15px; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.stat .label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat .value { font-size: 19px; font-weight: 700; }
.stat .sub { color: var(--muted); font-size: 11px; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
thead th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 10px; border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
tbody tr:hover { background: #f8fafc; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.bold { font-weight: 700; }
.total-row td { font-weight: 700; background: #f8fafc; }
.table-wrap { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
th, td, .stat .value { font-variant-numeric: tabular-nums; }
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=month], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; }
.btn { display: inline-block; padding: 9px 16px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; background: #e2e8f0; color: var(--text); font-family: inherit; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13px; }
.tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 150px; }
.filters .field label { margin-bottom: 3px; }
.preview { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 14px; margin-top: 16px; }
.preview table { background: transparent; }
.preview td { border: none; padding: 6px 8px; font-size: 13px; }
.preview .sep td { border-top: 1px solid #cbd5e1; }
.muted { color: var(--muted); }
.durasi-group { display: flex; align-items: center; gap: 6px; }
.durasi-group input { width: 90px; }
.durasi-group .muted { white-space: nowrap; }
#durasi_text { margin-top: 4px; min-height: 14px; }
.small { font-size: 12px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.mt { margin-top: 12px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 370px; max-width: 94vw; }
.login-logo { text-align: center; margin-bottom: 16px; }
.login-logo img { max-height: 100px; max-width: 100%; object-fit: contain; }
.install-wrap { max-width: 660px; margin: 30px auto; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 18px; }
.chart-card canvas { width: 100%; height: 260px; display: block; }
.chart-card h2 { font-size: 14px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; margin-top: 10px; color: #475569; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .filters, .tabs, .toolbar, .form-actions, .alert, .stats, .no-print { display: none !important; }
  .main { margin-left: 0; padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  .table-wrap { border: none; }
  table { font-size: 11px; }
  a { color: inherit; text-decoration: none; }
}
@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .sidebar nav { display: flex; overflow-x: auto; overflow-y: hidden; padding: 6px 0; -webkit-overflow-scrolling: touch; }
  .sidebar nav a { flex-shrink: 0; white-space: nowrap; padding: 9px 14px; }
  .sidebar-foot { text-align: center; }
  .main { margin-left: 0; padding: 14px 12px; }
  .durasi-group input { width: 72px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .toolbar .btn, .form-actions .btn { flex: 1; text-align: center; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .field { min-width: 0; }
  .filters .btn { width: 100%; }
  .stat .value { font-size: 17px; }
  .chart-card canvas { height: 220px; }
  .durasi-group { flex-wrap: wrap; }
}
