:root {
  --bg: #0d1117;
  --panel: #151b23;
  --panel-border: #262d38;
  --text: #e6edf3;
  --muted: #8b96a5;
  /* Warna utama diselaraskan dengan logo Cek Pak: navy + biru, hijau & oranye sebagai aksen */
  --accent: #3b82f6;
  --accent-dim: #1d4ed8;
  --accent-text: #dbeafe;
  --success: #3fb950;
  --success-dim: #12351f;
  --success-text: #7ee2a8;
  --danger: #f85149;
  --danger-dim: #3a1414;
  --danger-text: #f5a3a0;
  --warn: #f59e0b;
  --live-green: #22c55e;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); background: #1c232c; padding: 1px 5px; border-radius: 4px; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar a {
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 11px;
  line-height: 1;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar a:hover { background: #1c232c; text-decoration: none; color: var(--text); }
.sidebar a.active { background: var(--accent-dim); color: var(--accent-text); }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--panel-border); }
.user-chip { color: var(--muted); padding: 8px 12px; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.logout { display: flex; align-items: center; gap: 11px; padding: 8px 12px; color: var(--danger); line-height: 1; }
.logout:hover { text-decoration: none; background: #1c232c; border-radius: 6px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 12px 20px; }
.brand.center { justify-content: center; padding-bottom: 6px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-dim); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.brand-logo-img { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: #fff; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.2px; }
.brand-cek { color: var(--text); }
.brand-pak-text { color: var(--accent); }

.current-logo-preview {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  padding-bottom: 16px; border-bottom: 1px solid var(--panel-border);
}
.current-logo-preview img { max-width: 120px; max-height: 60px; border-radius: 6px; background: #fff; padding: 4px; }

/* ===== Widget jam/tanggal/LIVE di sidebar ===== */
.sidebar-clock {
  padding: 10px 12px 16px; margin-bottom: 6px; border-bottom: 1px solid var(--panel-border);
}
.sidebar-clock-time { font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.sidebar-clock-date { color: var(--muted); font-size: 11px; margin-top: 2px; }
.sidebar-live { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--live-green);
  box-shadow: 0 0 6px var(--live-green);
  animation: live-blink 1.1s infinite;
}
.live-text { color: var(--live-green); font-weight: 700; font-size: 11px; letter-spacing: .08em; }
@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ===== Hamburger toggle (mobile only) ===== */
.mobile-menu-toggle {
  display: none;
  position: sticky; top: 0; z-index: 110;
  background: var(--panel); border-bottom: 1px solid var(--panel-border);
  padding: 12px 16px; align-items: center; gap: 10px;
}
.mobile-menu-toggle button {
  background: none; border: 1px solid var(--panel-border); color: var(--text);
  width: 36px; height: 36px; border-radius: 8px; font-size: 18px; cursor: pointer;
}
.mobile-menu-toggle .brand-name { font-size: 15px; }

.sidebar-overlay { display: none; }

.content { flex: 1; padding: 28px 36px; max-width: 1100px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 16px; margin: 28px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat-card { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 18px; border-left: 3px solid transparent; }
.stat-card-blue { border-left-color: var(--accent); }
.stat-card-green { border-left-color: var(--success); }
.stat-card-orange { border-left-color: var(--warn); }
.stat-number { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-sub { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.range-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.range-tab {
  font-size: 12px; padding: 6px 12px; border-radius: 999px; color: var(--muted);
  background: #1c232c; border: 1px solid var(--panel-border);
}
.range-tab:hover { text-decoration: none; color: var(--text); }
.range-tab.active { background: var(--accent-dim); color: var(--accent-text); border-color: transparent; }

.chart-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 10px;
}
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 160px; flex-shrink: 0; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #0f151c; border-radius: 5px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width .3s ease; }
.bar-count { width: 36px; text-align: right; flex-shrink: 0; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
@media (max-width: 768px) {
  .bar-label { width: 100px; font-size: 11.5px; }
}

.pill {
  display: inline-block; background: #1c232c; border: 1px solid var(--panel-border);
  color: var(--muted); font-size: 12px; padding: 3px 9px; border-radius: 999px; margin-right: 6px;
}

/* Chip vendor berwarna - warna dihitung per-vendor lewat helper Python, dipakai sebagai inline style */
.vendor-chip {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; margin-right: 6px; border: 1px solid transparent;
}

.data-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--panel-border); font-size: 13px; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.data-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 12px; }
.inline-form { display: inline; }
.link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 0; }
.link-danger:hover { text-decoration: underline; }

.status { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.status-ok { background: var(--success-dim); color: var(--success-text); }
.status-error, .status-auth_failed, .status-timeout { background: var(--danger-dim); color: var(--danger-text); }

.form-card, .login-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px;
  padding: 24px; max-width: 480px; display: flex; flex-direction: column; gap: 14px;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.checkbox-label { flex-direction: row; align-items: center; gap: 8px; }
input, select {
  background: #0f151c; border: 1px solid var(--panel-border); color: var(--text);
  padding: 9px 11px; border-radius: 7px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.btn, button[type="submit"] {
  background: var(--accent-dim); color: var(--accent-text); border: none; padding: 10px 18px;
  border-radius: 7px; font-weight: 600; cursor: pointer; font-size: 13px; display: inline-block;
}
.btn:hover { background: var(--accent); color: #06152f; text-decoration: none; }
.btn-secondary { background: #1c232c; color: var(--muted); padding: 10px 18px; border-radius: 7px; font-size: 13px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 12px; }

.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash-stack-login { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 10; }
.flash { padding: 10px 14px; border-radius: 7px; font-size: 13px; }
.flash-success { background: var(--success-dim); color: var(--success-text); }
.flash-error { background: var(--danger-dim); color: var(--danger-text); }

.terminal-output {
  background: #05080c; border: 1px solid var(--panel-border); border-radius: 10px;
  padding: 18px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto; margin-bottom: 18px;
}
.result-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.output-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }

.settings-add {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px;
  margin: 10px 0 24px; padding: 4px 16px;
}
.settings-add summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--accent); font-size: 13px; }
.settings-add .form-card { border: none; padding: 4px 0 16px; max-width: 560px; }
.settings-add textarea {
  background: #0f151c; border: 1px solid var(--panel-border); color: var(--text);
  padding: 9px 11px; border-radius: 7px; font-size: 13px; font-family: var(--mono); resize: vertical;
}
code.wrap { white-space: pre-wrap; display: inline-block; max-width: 420px; }

.edit-row { display: none; }
.edit-row.open { display: table-row; }
.edit-row td { background: #0f151c; padding: 16px !important; }
.inline-edit-form { border: none; padding: 0; max-width: 480px; background: transparent; }

/* ===== Mobile responsive (<=768px): sidebar jadi drawer show/hide ===== */
@media (max-width: 768px) {
  .mobile-menu-toggle { display: flex; }
  .shell { flex-direction: column; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    z-index: 120;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 2px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 115;
  }
  .sidebar-overlay.open { display: block; }
  .content { padding: 16px; max-width: 100%; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .form-card, .login-card { max-width: 100%; }
  h1 { font-size: 19px; }
}
