:root {
  --bg: #0f1115; --surface: #181b22; --surface2: #1f232c; --border: #2a2f3a;
  --text: #e8eaed; --muted: #9aa0ab; --primary: #4f8a7b; --primary-d: #3c6d61;
  --danger: #c4564b; --radius: 14px; --shadow: 0 6px 24px rgba(0,0,0,.3);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* topbar */
#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
#topbar[hidden] { display: none; } /* hormati atribut hidden (UA dilangkahi display:flex) */
#topbar .brand { font-weight: 700; color: var(--text); }
#topbar nav { display: flex; align-items: center; gap: 14px; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 22px 80px; }
.container.narrow { max-width: 640px; }
.loading, .empty { padding: 48px; text-align: center; color: var(--muted); }
.empty { border: 1px dashed var(--border); border-radius: var(--radius); }

.row { display: flex; }
.row.gap { gap: 12px; }
.row.between { justify-content: space-between; }
.row.center { align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

h2 { margin: 18px 0; }
h3 { margin: 0 0 8px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
  padding: 11px 18px; border-radius: 10px; cursor: pointer; font-size: .95rem;
  font-weight: 600; transition: .15s; text-align: center;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 13px; font-size: .85rem; }
.btn.lg { padding: 15px 26px; font-size: 1.05rem; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font-size: .9rem; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 18px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.acct { position: relative; }
.acct-dot { width: 36px; height: 36px; border-radius: 9px; margin-bottom: 10px; }
.hero { text-align: center; margin: 18px 0 26px; }
.hero .btn { margin: 14px 0 6px; }
.strategy { margin-bottom: 18px; }

/* auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 22px; }
.card.auth { width: 100%; max-width: 400px; }
.card.auth h1 { margin: 0 0 6px; font-size: 1.4rem; }

/* forms */
form label { display: block; margin: 14px 0; font-size: .9rem; color: var(--muted); }
input, textarea, select {
  width: 100%; margin-top: 6px; padding: 11px 13px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
  font: inherit;
}
input[type=color] { padding: 4px; height: 44px; cursor: pointer; }
textarea { resize: vertical; }
.form fieldset { border: 1px solid var(--border); border-radius: 10px; margin: 14px 0; padding: 10px 14px 14px; }
.form legend { color: var(--muted); font-size: .85rem; padding: 0 6px; }
.colors { display: flex; gap: 10px; }
.colors .col { flex: 1; margin: 0; }
.msg { color: var(--danger); min-height: 1em; margin-top: 10px; }

/* content cards */
.content .media { background: var(--bg); border-radius: 10px; overflow: hidden; margin: 10px 0;
  display: flex; align-items: center; justify-content: center; min-height: 200px; }
.content .thumb { width: 100%; max-height: 420px; object-fit: contain; display: block; }
.content .caption { font-size: .9rem; white-space: pre-wrap; max-height: 120px; overflow: auto; }
.content .tags { color: var(--primary); font-size: .85rem; }
.content details.audio { margin: 8px 0; }
.content details summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.content details ol { margin: 8px 0; padding-left: 20px; }
.content details li { margin: 6px 0; font-size: .88rem; }

/* progress */
.steps { list-style: none; padding: 0; }
.steps li { padding: 9px 0 9px 30px; position: relative; color: var(--muted); }
.steps li::before { content: '○'; position: absolute; left: 0; }
.steps li.on { color: var(--text); }
.steps li.on::before { content: '●'; color: var(--primary); }
.bar { height: 10px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.fill { height: 100%; background: var(--primary); transition: width .4s; }

/* history & badges */
.history { list-style: none; padding: 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.badge { font-size: .72rem; padding: 2px 9px; border-radius: 99px; background: var(--surface2); color: var(--muted); text-transform: uppercase; }
.badge.done { background: #1f3a32; color: #6fd3b6; }
.badge.error { background: #3a2120; color: #e08a82; }
.badge.researching, .badge.generating, .badge.pending { background: #2a2c3a; color: #9fb4ff; }

/* toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 10px; opacity: 0; transition: .25s; pointer-events: none; z-index: 100; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--danger); color: #f0a8a1; }
