/* ============ Variabel Tema ============ */
:root {
  --bg: #0e1116;
  --bg-soft: #161b22;
  --bg-card: #1b2129;
  --border: #2a313c;
  --text: #e6edf3;
  --text-dim: #9aa4b2;
  --accent: #7c6cf0;
  --accent-2: #5a4fd6;
  --danger: #e5534b;
  --ok: #2ea043;
  --radius: 14px;
}

/* Light mode */
body.theme-light {
  --bg: #f4f6fb;
  --bg-soft: #ffffff;
  --bg-card: #ffffff;
  --border: #e2e6ef;
  --text: #1a1f2b;
  --text-dim: #5a6472;
  --accent: #6a5cf0;
  --accent-2: #5a4fd6;
}

/* Tema khusus (hijau + animasi) */
body.theme-special {
  --bg: #05130a;
  --bg-soft: #0a2515;
  --bg-card: #0d301b;
  --border: #135a30;
  --text: #d6ffe4;
  --text-dim: #7fce9c;
  --accent: #1fbf59;
  --accent-2: #17a34a;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .3s, color .3s;
}

a { color: var(--accent); }

/* ============ Login ============ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p { color: var(--text-dim); font-size: 14px; margin-bottom: 22px; }
.code-input {
  width: 100%;
  font-size: 26px;
  letter-spacing: 10px;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  margin-bottom: 16px;
}
.error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ============ Layout dashboard ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 220px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  flex-shrink: 0;
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 4px;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }

.content { flex: 1; padding: 24px; overflow: auto; }
.panel { display: none; }
.panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2.panel-title { font-size: 20px; margin-bottom: 16px; }

/* ============ Komponen ============ */
.btn {
  border: none;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 14px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.input, .textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  margin-bottom: 10px;
  font-family: inherit;
}
.textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

.product-card { border-left: 3px solid var(--accent); }
.product-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.product-head h3 { font-size: 16px; }
.muted { color: var(--text-dim); font-size: 13px; }
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.variant-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-top: 1px dashed var(--border); font-size: 13px;
}
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: var(--ok); color: #fff; padding: 12px 18px;
  border-radius: 10px; opacity: 0; transform: translateY(10px);
  transition: .3s; z-index: 50;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--danger); }

.toggle-theme { display: flex; gap: 6px; }

/* ============ Animasi daun (tema khusus) ============ */
.leaves { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; display: none; }
body.theme-special .leaves { display: block; }
body.theme-special .content, body.theme-special .sidebar, body.theme-special .topbar { position: relative; z-index: 1; }
.leaf {
  position: absolute;
  top: -40px;
  font-size: 22px;
  animation: fall linear infinite;
  opacity: .85;
}
@keyframes fall {
  0%   { transform: translateY(-40px) rotate(0deg); }
  100% { transform: translateY(105vh) rotate(360deg); }
}
body.theme-special { background: radial-gradient(circle at 50% 0%, #0a3d21, #05130a 70%); }
