/* === app.css — Cerita30an Dashboard === */
:root {
  --latar: #0e1116;
  --kartu: #181c24;
  --garis: #343a46;
  --teks: #eef0f5;
  --redup: #8c92a0;
  --hijau: #c6f24d;
  --ungu: #7b68ee;
  --biru: #8fb7ff;
  --merah: #c84646;
  --kuning: #f0c040;
  --radius: 8px;
  --sidebar-w: 260px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Fira Code", "Fira Mono", "Cascadia Code", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--latar);
  color: var(--teks);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--kartu);
  border-right: 1px solid var(--garis);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--teks);
  border-bottom: 1px solid var(--garis);
}

.sidebar-logo span {
  color: var(--hijau);
}

.sidebar-group {
  margin-top: 16px;
}

.sidebar-group-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: lowercase;
  color: var(--redup);
  padding: 0 16px 6px;
  letter-spacing: .08em;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  color: var(--redup);
  text-decoration: none;
  font-size: 13.5px;
  transition: background .1s, color .1s;
  border-radius: 0;
}

.sidebar-item:hover {
  background: #1e2330;
  color: var(--teks);
}

.sidebar-item.active {
  background: #202530;
  color: #ffffff;
}

.sidebar-dot {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--garis);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--merah);
  flex-shrink: 0;
}

.status-dot.running { background: var(--hijau); }

.sidebar-footer-name {
  font-weight: 600;
  color: var(--teks);
}

.sidebar-footer-status {
  font-size: 11px;
  color: var(--redup);
}

.sidebar-footer-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--redup);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: background .1s, color .1s;
}

.sidebar-footer-logout:hover {
  background: var(--merah);
  color: #fff;
}

/* ── Main content ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 28px 48px;
  min-width: 0;
}

/* ── Cards ── */
.card {
  background: var(--kartu);
  border: 1px solid var(--garis);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
}

/* ── Heading ── */
h1, h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}
h2 { font-size: 16px; margin-bottom: 12px; }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--garis);
  color: var(--redup);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
td {
  padding: 8px 10px;
  border-bottom: 1px solid #1e2330;
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #1a1f2c; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
  text-decoration: none;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary { background: var(--hijau); color: #0e1116; border-color: var(--hijau); }
.btn-danger   { background: var(--merah); color: #fff; border-color: var(--merah); }
.btn-ghost    { background: transparent; color: var(--teks); border-color: var(--garis); }
.btn-sm       { padding: 4px 10px; font-size: 12px; }

/* ── Inputs ── */
input[type="text"],
input[type="password"],
input[type="search"],
textarea,
select {
  background: #0e1116;
  border: 1px solid var(--garis);
  border-radius: var(--radius);
  color: var(--teks);
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: var(--font);
  width: 100%;
  outline: none;
  transition: border .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--biru);
}
textarea { resize: vertical; min-height: 80px; }

/* ── Error box ── */
.error-box {
  background: #2a1010;
  border: 1px solid var(--merah);
  color: var(--merah);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 13px;
  display: none;
}
.error-box.show { display: block; }

/* ── Loading spinner ── */
.loading {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--garis);
  border-top-color: var(--hijau);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status badge ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-hijau  { background: #1a2d0a; color: var(--hijau); }
.badge-merah  { background: #2a1010; color: var(--merah); }
.badge-biru   { background: #0a1a2d; color: var(--biru); }
.badge-ungu   { background: #1a1028; color: var(--ungu); }
.badge-kuning { background: #2a220a; color: var(--kuning); }
.badge-redup  { background: #1a1e26; color: var(--redup); }

/* ── Token bar ── */
.token-bar-wrap {
  background: var(--latar);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin-top: 6px;
  flex: 1;
}
.token-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--hijau);
  transition: width .4s;
}
.token-bar.warn  { background: var(--kuning); }
.token-bar.crit  { background: var(--merah); }

/* ── Agent card grid ── */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.agent-card {
  background: var(--kartu);
  border: 1px solid var(--garis);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border .15s;
}
.agent-card:hover { border-color: var(--biru); }
.agent-card-emoji { font-size: 28px; margin-bottom: 8px; }
.agent-card-name { font-weight: 700; font-size: 15px; }
.agent-card-role { color: var(--redup); font-size: 12px; margin-bottom: 10px; }
.agent-card-boss { font-size: 11px; color: var(--redup); }
.agent-card-skills { font-size: 11px; color: var(--biru); margin: 4px 0 10px; }

/* ── Task board columns ── */
.task-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
}
.task-col-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--redup);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--garis);
  margin-bottom: 10px;
}
.task-col-header .badge { margin-left: 6px; font-size: 10px; }
.task-card {
  background: var(--kartu);
  border: 1px solid var(--garis);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}
.task-card.perlu-setuju {
  background: #2e2816;
  border-color: #5a4a20;
}
.task-card-agent { font-size: 11px; color: var(--redup); margin-bottom: 3px; }
.task-card-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.task-card-time  { font-size: 11px; color: var(--redup); }

/* ── Command box ── */
.cmd-wrap {
  display: flex; gap: 10px;
  margin-bottom: 24px;
}
.cmd-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
}

/* ── BRIEF viewer ── */
.brief-pre {
  background: var(--latar);
  border: 1px solid var(--garis);
  border-radius: var(--radius);
  padding: 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--teks);
  max-height: 500px;
  overflow-y: auto;
}

/* ── Persetujuan ── */
.draft-preview {
  background: var(--latar);
  border: 1px solid var(--garis);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.draft-preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--redup);
  margin-bottom: 4px;
}
.draft-preview-value {
  font-size: 14px;
  color: var(--teks);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Riset page ── */
.riset-source-group { margin-bottom: 20px; }
.riset-source-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--hijau);
  margin-bottom: 8px;
}
.sudut-card {
  background: var(--kartu);
  border: 1px solid var(--garis);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.sudut-judul { font-weight: 600; margin-bottom: 6px; }
.sudut-insight { color: var(--redup); font-size: 12.5px; margin-bottom: 8px; }
.sudut-hook {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--latar);
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

/* ── Schedule timeline ── */
.jadwal-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #1e2330; }
.jadwal-time { font-family: var(--mono); font-size: 12px; color: var(--redup); min-width: 100px; }
.jadwal-title { font-size: 13px; }

/* ── Responsive mobile ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    transition: transform .25s;
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 16px 14px 60px;
  }

  .task-board {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .agent-grid {
    grid-template-columns: 1fr;
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  .cmd-wrap {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .task-board {
    grid-template-columns: 1fr;
  }
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  background: var(--kartu);
  border: 1px solid var(--garis);
  border-radius: 50%;
  width: 48px; height: 48px;
  align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: var(--teks);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.overlay.show { display: block; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--latar);
}

.login-card {
  background: var(--kartu);
  border: 1px solid var(--garis);
  border-radius: var(--radius);
  padding: 36px 32px 32px;
  width: 100%;
  max-width: 380px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--teks);
}

.login-sub {
  text-align: center;
  color: var(--redup);
  font-size: 12px;
  margin-bottom: 28px;
}

.login-field {
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  font-size: 12px;
  color: var(--redup);
  margin-bottom: 5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--redup);
  margin-bottom: 5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Muted text */
.text-muted { color: var(--redup); }
.text-hijau  { color: var(--hijau); }
.text-merah  { color: var(--merah); }
.text-biru   { color: var(--biru); }

/* ── Info kunci (pengaturan page) ── */
.setting-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #1e2330;
  gap: 12px;
}
.setting-row:last-child { border-bottom: none; }
.setting-key {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--biru);
  min-width: 200px;
}
.setting-value {
  font-size: 13px;
  flex: 1;
}

/* Empty state */
.empty {
  color: var(--redup);
  font-size: 13px;
  padding: 24px;
  text-align: center;
}

/* scroll on overflow */
.table-wrap { overflow-x: auto; }
