:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --accent: #6c8cff;
  --accent-2: #4f6fef;
  --danger: #ff6b6b;
  --ok: #44d07b;
  --warn: #f5b73d;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.userbar { display: flex; align-items: center; gap: 10px; }
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.user-name { font-size: 14px; font-weight: 600; }
.user-team { font-size: 12px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 26px;
  color: var(--accent);
}
.brand h1 { margin: 0; font-size: 17px; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  padding: 18px;
  height: calc(100vh - 59px);
}

.sidebar { display: flex; flex-direction: column; gap: 16px; min-height: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.uploader input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
}
.uploader input[type="text"]:focus { outline: none; border-color: var(--accent); }

.full-select {
  width: 100%; padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; margin-bottom: 10px;
}
.ctx-note {
  width: 100%; padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; margin-bottom: 10px; resize: vertical;
  font-family: inherit;
}
.ctx-note:focus, .full-select:focus { outline: none; border-color: var(--accent); }
.logo-img { height: 34px; width: auto; border-radius: 6px; display: block; }
.logo-prev { max-height: 60px; max-width: 200px; border-radius: 6px; border: 1px solid var(--border); }

.export-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.export-bar select {
  padding: 6px 10px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px;
}

.check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); margin-bottom: 12px; cursor: pointer;
}
.check-row input { accent-color: var(--accent); width: 15px; height: 15px; }

.url-row { display: flex; gap: 8px; }
.url-row input {
  flex: 1; min-width: 0; padding: 9px 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px;
}
.url-row input:focus { outline: none; border-color: var(--accent); }
.url-row .btn { white-space: nowrap; }

/* ---- Ikon SVG ---- */
.ic { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; flex-shrink: 0; }
.ic-lg { width: 24px; height: 24px; }
.btn .ic { margin-right: 6px; vertical-align: -3px; }
.btn.small .ic { width: 14px; height: 14px; margin-right: 5px; }
.tab .ic { margin-right: 6px; opacity: .8; }
.brand .logo { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: #1c2440; }
.mobile-only { display: none !important; }

/* ---- Panel rekam ---- */
.rec-panel { display: flex; flex-direction: column; gap: 10px; }
.btn.record { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 12px 16px; font-weight: 600; }
.rec-status { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.rec-time { font-variant-numeric: tabular-nums; color: var(--danger); font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: .02em; }
.rec-time::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); margin-right: 8px; vertical-align: 3px; animation: blink 1.2s ease-in-out infinite; }
.rec-time.paused-warning::before { background: var(--warn); animation: none; }
@keyframes blink { 50% { opacity: .25; } }
.rec-storage-badge { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.rec-storage-badge.ok { color: var(--ok); }
.rec-storage-badge.warn { color: var(--warn); }
.rec-level { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.rec-level-bar { height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.rec-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rec-hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.rec-hint.warn { color: var(--warn); }
.rec-hint.danger { color: var(--danger); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0;
  white-space: nowrap;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  transition: .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--text); background: var(--panel-2); }
.dz-icon { opacity: .7; }

.joblist { flex: 1; overflow-y: auto; min-height: 0; }
#jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.job {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--panel-2);
}
.job:hover { border-color: var(--border); }
.job.active { border-color: var(--accent); background: #232a3d; }
.job .job-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .job-sub { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }

.detail {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  overflow-y: auto;
  min-height: 0;
}
.empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}
.empty-icon { width: 46px; height: 46px; opacity: .5; }

.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.detail-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.detail-head h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.job-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex-shrink: 0; display: inline-block; }
.job-dot.done { background: var(--ok); }
.job-dot.error { background: var(--danger); }
.job-dot.idle { background: var(--muted); }

/* ---- Jendela mini (Document Picture-in-Picture) ---- */
.pip-body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
.pip-wrap { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; height: 100vh; box-sizing: border-box; justify-content: center; }
.pip-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pip-time { font-size: 30px; font-weight: 700; color: var(--danger); font-variant-numeric: tabular-nums; line-height: 1; }
.pip-time::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); margin-right: 8px; vertical-align: 4px; animation: blink 1.2s ease-in-out infinite; }
.pip-sub { font-size: 12px; color: var(--muted); }
.pip-wrap .btn { margin-top: 4px; width: 100%; }
.detail-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.badge.done { color: var(--ok); border-color: var(--ok); }
.badge.error { color: var(--danger); border-color: var(--danger); }
.badge.working { color: var(--warn); border-color: var(--warn); }

.muted { color: var(--muted); font-size: 13px; }

.progress {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  color: var(--warn);
  font-size: 14px;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  background: none; border: none; color: var(--muted);
  padding: 10px 14px; cursor: pointer; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.panel-actions { display: flex; gap: 8px; margin-bottom: 12px; }

.markdown { line-height: 1.7; }
.markdown h2 { font-size: 16px; margin: 20px 0 8px; color: var(--accent); }
.markdown h2:first-child { margin-top: 0; }
.markdown ul { padding-left: 22px; margin: 6px 0; }
.markdown li { margin: 4px 0; }
.markdown p { margin: 6px 0; }
.markdown input[type="checkbox"] { margin-right: 6px; }

.player { width: 100%; max-height: 280px; background: #000; border-radius: 10px; margin-bottom: 14px; }

.timeline { display: flex; flex-direction: column; gap: 4px; }
.tl-item {
  display: flex; align-items: baseline; gap: 10px; padding: 9px 10px; border-radius: 8px;
  cursor: pointer; border: 1px solid transparent;
}
.tl-item:hover { background: var(--panel-2); border-color: var(--border); }
.tl-time { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; flex-shrink: 0; min-width: 56px; }
.tl-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: .03em; padding: 1px 7px;
  border-radius: 20px; flex-shrink: 0; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.tag-keputusan { color: var(--ok); border-color: var(--ok); }
.tag-action { color: var(--warn); border-color: var(--warn); }
.tag-diskusi { color: var(--accent); border-color: var(--accent); }
.tl-body { font-size: 14px; line-height: 1.5; }

.transcript { white-space: pre-wrap; line-height: 1.8; color: #d4d8e0; }
.transcript .seg { cursor: pointer; border-radius: 6px; padding: 2px 4px; }
.transcript .seg:hover { background: var(--panel-2); }
.transcript .seg-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 8px; }
.transcript .seg-spk { font-size: 12px; font-weight: 600; margin-right: 8px; }
.seg { margin-bottom: 8px; }

/* Buttons */
.btn {
  background: var(--accent-2);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: .15s;
}
.btn:hover { background: var(--accent); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.btn.record { background: var(--danger); }
.btn.record.recording { background: var(--panel-2); border: 1px solid var(--danger); color: var(--danger); }

/* ---- Login ---- */
.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; width: 340px; display: flex; flex-direction: column; gap: 8px;
}
.auth-brand { text-align: center; margin-bottom: 14px; }
.auth-brand .logo { font-size: 34px; color: var(--accent); display: block; }
.auth-brand h1 { margin: 8px 0 2px; font-size: 18px; }
.auth-brand p { margin: 0; font-size: 13px; color: var(--muted); }
.auth-card label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.auth-card input {
  padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-card .btn { margin-top: 14px; }
.auth-err { background: #3a1d22; color: var(--danger); padding: 8px 10px; border-radius: 8px; font-size: 13px; }

/* ---- Admin ---- */
.admin-wrap { max-width: 920px; margin: 0 auto; padding: 22px; }
.admin-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.atab {
  background: none; border: none; color: var(--muted); padding: 10px 16px; cursor: pointer;
  font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.atab.active { color: var(--text); border-bottom-color: var(--accent); }
.admin-sec { display: flex; flex-direction: column; gap: 16px; }

.form-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.form-grid input, .form-grid select {
  padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; flex: 1; min-width: 140px;
}

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.ok { color: var(--ok); }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; }
.set-row label { font-size: 14px; }
.set-row input[type="text"], .set-row input[type="password"], .set-row input:not([type]), .set-row select {
  padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; width: 320px; max-width: 55%;
}
.set-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.save-bar { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 8px 0 30px; }

.notice {
  background: #2a2410; border: 1px solid var(--warn); color: #f0d9a0;
  padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px;
}
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
label.inline input[type="datetime-local"], label.inline input[type="number"] {
  padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px;
}

/* ---- Modal pilih proses ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 28px 20px; max-width: 520px; width: 90%; display: flex; flex-direction: column; gap: 14px;
}
.modal-title { margin: 0; font-size: 18px; }
.modal-meta { margin: 0; font-size: 13px; color: var(--muted); }
.modal-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-opt {
  background: var(--panel-2); border: 2px solid var(--border); border-radius: 12px;
  padding: 18px 14px; cursor: pointer; display: flex; flex-direction: column;
  gap: 6px; text-align: left; color: var(--text); transition: .15s;
}
.modal-opt:hover { border-color: var(--accent); background: #232a3d; }
.modal-opt-icon { width: 28px; height: 28px; color: var(--accent); }
.modal-opt strong { font-size: 15px; }
.modal-opt-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.modal-opt-warn { font-size: 11px; color: var(--warn); margin-top: 4px; }
.modal-opt-recommended { font-size: 11px; color: var(--ok); margin-top: 4px; font-weight: 600; }

/* ---- Warning banner proses lokal ---- */
.local-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: #2a1f00; border-bottom: 2px solid var(--warn);
  color: #f0d090; font-size: 13px; padding: 10px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.local-banner-detail { color: var(--warn); font-variant-numeric: tabular-nums; }

/* ---- Mode standalone (PWA terpasang) ---- */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(14px + env(safe-area-inset-top)); }
}

/* ---- Tablet & HP ---- */
@media (max-width: 900px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .brand p { display: none; }
  .brand h1 { font-size: 15px; }
  .user-meta { display: none; }
  .btn-label { display: none; }
  .btn.small .ic { margin-right: 0; }
  .userbar .btn.small { padding: 8px 10px; }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 55px);
    padding: 12px;
    gap: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .sidebar { min-height: 0; }
  .joblist { max-height: 40vh; }
  .detail { padding: 16px; }

  /* Satu panel pada satu waktu: daftar ATAU detail */
  .layout.show-detail .sidebar { display: none; }
  .layout:not(.show-detail) .detail { display: none; }
  .mobile-only { display: inline-flex !important; }

  .detail-head { flex-direction: column; }
  .detail-meta { flex-wrap: wrap; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 10px 12px; }
  .export-bar .muted { display: none; }

  .modal-box { padding: 20px 16px 16px; width: 94%; }
  .modal-options { grid-template-columns: 1fr; }
  .local-banner { padding: 10px 14px; flex-direction: column; align-items: flex-start; gap: 4px; }

  .btn.record { padding: 16px; font-size: 16px; }
  .rec-time { font-size: 32px; }
  .dropzone { padding: 16px; }
}

@media (max-width: 480px) {
  .userbar .btn.small { padding: 8px; }
  .detail { padding: 14px 12px; }
}

.hidden { display: none !important; }
