/* ==========================================================
   TOKEN DESAIN
   ========================================================== */
:root{
  --bg:            #F3F4F8;
  --surface:       #FFFFFF;
  --sidebar:       #12141F;
  --sidebar-hover: #1D2033;
  --text:          #1D1F2B;
  --muted:         #8A8FA3;
  --border:        #E7E8F0;
  --accent:        #FF6B4A;
  --accent-dark:   #E4552F;
  --teal:          #17BEB0;
  --violet:        #6C5CE7;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow: 0 8px 24px -12px rgba(18,20,31,0.18);
  --font-head: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
}
a{ text-decoration:none; color:inherit; }
ul{ list-style:none; margin:0; padding:0; }
button{ font-family:inherit; cursor:pointer; }

/* ==========================================================
   LAYOUT SHELL
   ========================================================== */
.app-shell{
  display:flex;
  min-height:100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar{
  width:250px;
  flex-shrink:0;
  background:var(--sidebar);
  color:#fff;
  padding:26px 16px;
  position:sticky;
  top:0;
  height:100vh;
  overflow-y:auto;
}
.sidebar-brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 10px 26px;
  margin-bottom:10px;
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.brand-mark{
  width:34px; height:34px;
  border-radius:10px;
  background:linear-gradient(135deg, var(--accent), var(--violet));
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-head); font-weight:800; font-size:16px;
}
.brand-name{ font-family:var(--font-head); font-weight:700; font-size:17px; letter-spacing:.2px; }
.brand-name em{ font-style:normal; color:var(--accent); }

.sidebar-nav{ display:flex; flex-direction:column; gap:2px; }
.nav-item{
  display:flex; align-items:center; gap:12px;
  padding:11px 12px;
  border-radius:var(--radius-sm);
  color:rgba(255,255,255,0.72);
  font-size:14px; font-weight:500;
  border-left:3px solid transparent;
  transition:background .15s ease, color .15s ease;
}
.nav-item svg{ width:18px; height:18px; flex-shrink:0; }
.nav-item:hover{ background:var(--sidebar-hover); color:#fff; }
.nav-item.active{
  background:var(--sidebar-hover);
  color:#fff;
  border-left-color:var(--accent);
}

/* ---------- MAIN AREA ---------- */
.main-area{ flex:1; min-width:0; display:flex; flex-direction:column; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:22px 32px;
  background:var(--surface);
  border-bottom:1px solid var(--border);
}
.topbar h1{ font-family:var(--font-head); font-size:21px; margin:0; }
.topbar-user{ display:flex; align-items:center; gap:10px; }
.avatar{
  width:38px; height:38px; border-radius:50%;
  background:linear-gradient(135deg, var(--teal), var(--violet));
  color:#fff; display:flex; align-items:center; justify-content:center;
  font-family:var(--font-head); font-weight:700; font-size:13px;
}
.user-meta{ display:flex; flex-direction:column; line-height:1.25; }
.user-meta strong{ font-size:13.5px; }
.user-meta span{ font-size:12px; color:var(--muted); }

.content{ padding:28px 32px; flex:1; }

/* ==========================================================
   KARTU & KOMPONEN UMUM
   ========================================================== */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:22px;
}
.card + .card{ margin-top:20px; }

.page-head{
  display:flex; align-items:flex-end; justify-content:space-between;
  margin-bottom:20px; gap:16px; flex-wrap:wrap;
}
.page-head p{ margin:4px 0 0; color:var(--muted); font-size:13.5px; }

.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 18px;
  border-radius:var(--radius-sm);
  border:none;
  font-weight:600; font-size:13.5px;
  transition:transform .12s ease, box-shadow .12s ease;
}
.btn-primary{ background:var(--accent); color:#fff; }
.btn-primary:hover{ background:var(--accent-dark); }
.btn-outline{ background:transparent; color:var(--text); border:1px solid var(--border); }
.btn-outline:hover{ background:var(--bg); }
.btn-sm{ padding:6px 12px; font-size:12.5px; border-radius:7px; }
.btn-danger-outline{ background:transparent; color:#D64545; border:1px solid #F2C9C9; }
.btn-danger-outline:hover{ background:#FDF1F1; }

/* Stat mini widget (dashboard) */
.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(190px,1fr)); gap:16px; margin-bottom:24px; }
.stat-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  padding:18px; position:relative; overflow:hidden;
}
.stat-card .stat-icon{
  width:36px; height:36px; border-radius:9px; display:flex; align-items:center; justify-content:center;
  margin-bottom:14px; color:#fff;
}
.stat-card h3{ font-family:var(--font-head); font-size:24px; margin:0 0 2px; }
.stat-card span{ color:var(--muted); font-size:13px; }

/* ==========================================================
   TABEL
   ========================================================== */
.table-wrap{ overflow-x:auto; }
table.tabel-data{ width:100%; border-collapse:collapse; font-size:13.5px; }
table.tabel-data th{
  text-align:left; padding:12px 14px; background:var(--bg);
  color:var(--muted); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.04em;
  border-bottom:1px solid var(--border);
  white-space:nowrap;
}
table.tabel-data td{ padding:12px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
table.tabel-data tr:last-child td{ border-bottom:none; }
table.tabel-data tr:hover td{ background:#FAFAFC; }

.foto-produk-mini{ width:44px; height:44px; border-radius:8px; object-fit:cover; background:var(--bg); border:1px solid var(--border); }
.foto-produk-kosong{
  width:44px; height:44px; border-radius:8px; background:var(--bg); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:10px;
}

.kode-link-chip{
  display:inline-flex; align-items:center; gap:6px;
  background:#F2ECFE; color:var(--violet);
  padding:5px 10px; border-radius:20px; font-weight:600; font-size:12px;
  font-family:monospace;
}
.badge-share{
  display:inline-flex; padding:4px 10px; border-radius:20px; font-size:11.5px; font-weight:600;
  background:#E7F8F5; color:#0E9384;
}
.komisi-text{ color:var(--accent-dark); font-weight:700; }
.aksi-cell{ display:flex; gap:6px; }

.btn-copy{
  display:inline-flex; align-items:center; gap:6px;
  background:transparent; border:1px dashed var(--violet); color:var(--violet);
  padding:5px 10px; border-radius:20px; font-size:12px; font-weight:600;
}
.btn-copy.copied{ background:var(--violet); color:#fff; border-style:solid; }

/* ==========================================================
   FORM
   ========================================================== */
.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:18px 22px; }
.form-grid .full{ grid-column:1 / -1; }
.field label{ display:block; font-size:13px; font-weight:600; margin-bottom:6px; }
.field .hint{ display:block; font-size:11.5px; color:var(--muted); margin-top:5px; font-weight:400; }
.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea{
  width:100%; padding:10px 12px;
  border:1px solid var(--border); border-radius:var(--radius-sm);
  font-family:inherit; font-size:13.5px; background:var(--surface); color:var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus{
  outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(255,107,74,0.14);
}
.field textarea{ resize:vertical; min-height:70px; }

.input-rupiah{ position:relative; }
.input-rupiah span{
  position:absolute; left:12px; top:50%; transform:translateY(-50%);
  color:var(--muted); font-size:13.5px; font-weight:600;
}
.input-rupiah input{ padding-left:38px !important; }

.subsection-title{
  font-family:var(--font-head); font-size:14px; font-weight:700;
  margin:4px 0 2px; padding-top:8px; border-top:1px dashed var(--border);
  color:var(--muted); text-transform:uppercase; letter-spacing:.05em; font-size:11.5px;
}

.upload-foto{
  display:flex; align-items:center; gap:14px;
  border:1.5px dashed var(--border); border-radius:var(--radius-sm); padding:12px;
}
.upload-foto .preview{
  width:64px; height:64px; border-radius:10px; object-fit:cover; background:var(--bg); flex-shrink:0;
}
.upload-foto .preview-kosong{
  width:64px; height:64px; border-radius:10px; background:var(--bg);
  display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:10px; flex-shrink:0;
}

.form-actions{ display:flex; gap:10px; margin-top:22px; padding-top:18px; border-top:1px solid var(--border); }

/* Alert */
.alert{ padding:12px 16px; border-radius:var(--radius-sm); font-size:13.5px; margin-bottom:18px; }
.alert-sukses{ background:#E9F9EF; color:#1B8A46; border:1px solid #CDEFDA; }
.alert-galat{ background:#FDF0EE; color:#C13B25; border:1px solid #F6D2CB; }

/* Empty state */
.empty-state{ text-align:center; padding:50px 20px; color:var(--muted); }
.empty-state svg{ width:46px; height:46px; margin-bottom:12px; color:var(--border); }

/* Placeholder halaman modul lain */
.placeholder-modul{
  text-align:center; padding:70px 20px; color:var(--muted);
}
.placeholder-modul .icon-wrap{
  width:64px; height:64px; border-radius:16px; margin:0 auto 18px;
  background:linear-gradient(135deg, var(--violet), var(--teal));
  display:flex; align-items:center; justify-content:center; color:#fff;
}
.placeholder-modul h2{ color:var(--text); font-family:var(--font-head); margin-bottom:6px; }

/* Responsif */
@media (max-width: 900px){
  .sidebar{ width:76px; padding:20px 10px; }
  .sidebar .brand-name, .sidebar .nav-item span{ display:none; }
  .sidebar-brand{ justify-content:center; padding:0 0 20px; }
  .nav-item{ justify-content:center; }
  .content{ padding:20px 16px; }
  .topbar{ padding:16px 20px; }
  .form-grid{ grid-template-columns:1fr; }
}
