:root {
  --bg: #f5f6fb; --card: #ffffff; --text: #1d2033; --muted: #6b7088;
  --primary: #5b5bf0; --primary-dark: #4545d6; --accent: #14b8a6;
  --border: #e4e6f0; --danger: #e5484d; --ok: #16a34a;
  --radius: 14px; --shadow: 0 2px 12px rgba(30, 32, 70, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); font-size: .9rem; }

/* Layout aplikasi */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--card); border-right: 1px solid var(--border); padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 800; font-size: 1.3rem; color: var(--primary); padding: 0 10px 22px; }
.brand span { color: var(--accent); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.nav a:hover { background: #f0f1fb; color: var(--text); }
.nav a.active { background: var(--primary); color: #fff; }
.sidebar .bottom { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.plan-badge { display: inline-block; background: #eef0ff; color: var(--primary); padding: 2px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.main { flex: 1; padding: 28px 34px; max-width: 1100px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 12px; flex-wrap: wrap; }

/* Komponen */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; }
.g3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat .num { font-size: 1.9rem; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: .85rem; }
.btn { display: inline-block; border: 0; cursor: pointer; background: var(--primary); color: #fff; padding: 10px 20px; border-radius: 10px; font-weight: 600; font-size: .95rem; font-family: inherit; }
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn.ghost:hover { background: #f0f1fb; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #f3c4c6; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
input, textarea, select { width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: #fff; }
input:focus, textarea:focus, select:focus { outline: 2px solid #c9c9fb; border-color: var(--primary); }
textarea { resize: vertical; min-height: 220px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: #e7f7ed; color: var(--ok); } .flash.error { background: #fdecec; color: var(--danger); }
.tag { display: inline-block; background: #eef0ff; color: var(--primary); padding: 3px 10px; border-radius: 20px; font-size: .8rem; margin: 3px 4px 3px 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: .92rem; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.progress { height: 8px; background: #eceefb; border-radius: 8px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--primary); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* Grafik batang */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 150px; margin-top: 14px; }
.bar { flex: 1; text-align: center; font-size: .75rem; color: var(--muted); }
.bar .fill { background: linear-gradient(var(--primary), #8b8bff); border-radius: 8px 8px 0 0; min-height: 4px; margin-bottom: 6px; }
.bar b { display: block; color: var(--text); }

/* Ringkas */
.result { background: #f8f9ff; border: 1px solid #dfe1fb; border-radius: var(--radius); padding: 20px; white-space: pre-wrap; }
.hidden { display: none; }
.counter { font-size: .8rem; color: var(--muted); text-align: right; margin-top: 4px; }

/* Unggah file */
.dropzone {
  border: 2px dashed #c9c9fb;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: #fafaff;
  transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: #f0f1fb; }
.dropzone strong { display: block; margin-top: 4px; }
.dropzone .muted { margin-top: 2px; }
#dz-info { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; }
#dz-info.hidden, #dz-kosong.hidden { display: none; }  /* supaya .hidden menang atas display:flex */

/* Statistik hasil */
.badge {
  display: inline-block;
  background: #eef0ff;
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}
.badge b { color: var(--text); }
#loading { font-size: .9rem; }

/* Langganan */
.plans { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plan { position: relative; }
.plan.current { border: 2px solid var(--primary); }
.plan .price { font-size: 1.8rem; font-weight: 800; margin: 8px 0; }
.plan .price small { font-size: .85rem; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; margin: 14px 0 20px; }
.plan li { padding: 4px 0; font-size: .92rem; } .plan li::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.ribbon { position: absolute; top: 14px; right: 14px; background: var(--accent); color: #fff; font-size: .7rem; padding: 3px 10px; border-radius: 20px; font-weight: 700; }

/* Halaman publik */
.pub-nav { display: flex; justify-content: space-between; align-items: center; padding: 20px 6vw; }
.hero { text-align: center; padding: 70px 6vw 50px; max-width: 880px; margin: 0 auto; }
.hero h1 { font-size: 2.8rem; line-height: 1.15; margin-bottom: 16px; }
.hero h1 em { color: var(--primary); font-style: normal; }
.hero p { color: var(--muted); font-size: 1.1rem; margin-bottom: 28px; }
.features { max-width: 1000px; margin: 0 auto 60px; padding: 0 6vw; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 410px; }

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .brand { padding: 0 10px 0 0; } .nav { display: flex; flex-wrap: wrap; gap: 2px; } .sidebar .bottom { display: none; }
  .main { padding: 18px; } .hero h1 { font-size: 2rem; }
}
