
:root{
  --bg:#f4f6fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e6e8f0;
  --primary:#4f46e5;       /* ungu */
  --primary2:#4338ca;
  --primary3:#6366f1;
  --danger:#dc2626;
  --shadow: 0 10px 30px rgba(15,23,42,.08);
  --radius: 18px;
  --sidebar: 260px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  overflow-x:hidden; /* cegah keluar garis */
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

.app{ min-height:100%; display:flex; }

.sidebar{
  width: var(--sidebar);
  background:#fff;
  border-right: 1px solid var(--border);
  position: sticky;
  top:0;
  height: 100vh;
  display:flex;
  flex-direction:column;
  padding: 14px;
  gap: 12px;
}

.sidebar__brand{ display:flex; gap:10px; align-items:center; }
.brand__logo{
  width:42px; height:42px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  display:grid; place-items:center;
  color:#fff; font-weight:900;
  box-shadow: 0 10px 25px rgba(79,70,229,.22);
  flex:0 0 auto;
}
.brand__text{ min-width:0; }
.brand__name{ font-weight:900; letter-spacing:.2px; }
.brand__sub{ font-size:12px; color: var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.sidebar__user{
  display:flex; align-items:center; gap:10px;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
}
.avatar{
  width:36px; height:36px; border-radius: 14px;
  background: rgba(79,70,229,.12);
  color: var(--primary2);
  display:grid; place-items:center;
  font-weight:900;
}
.uname{ font-weight:900; font-size:14px; }
.umeta{ font-size:12px; color: var(--muted); }

.menu{ display:grid; gap:8px; }
.menu__item{
  width:100%;
  display:flex; align-items:center; gap:10px;
  border: 1px solid var(--border);
  background:#fff;
  padding: 12px 12px;
  border-radius: 16px;
  cursor:pointer;
  font-weight:900;
}
.menu__item.is-active{
  border-color: rgba(79,70,229,.25);
  background: rgba(79,70,229,.08);
  color: var(--primary2);
}
.mi__icon{ width:22px; text-align:center; }
.mi__label{ font-size:14px; }

.sidebar__foot{ margin-top:auto; display:grid; gap:10px; }
.btn--full{ width:100%; }
.footnote{ font-size:12px; color: var(--muted); text-align:center; }

.content{ flex:1; min-width:0; display:flex; flex-direction:column; }

.header{
  position: sticky; top:0; z-index:20;
  display:flex; align-items:center;
  padding: 14px 14px;
  color:#fff;
  background: linear-gradient(90deg, var(--primary2), var(--primary), var(--primary3));
  box-shadow: 0 10px 24px rgba(79,70,229,.18);
}
.header__title{ display:flex; flex-direction:column; gap:2px; }
.ht__kicker{ font-size:12px; opacity:.9; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.ht__title{ font-size:16px; font-weight:900; letter-spacing:.2px; }
.header__spacer{ flex:1; }

.main{ flex:1; padding: 14px; }
.view{ display:none; }
.view.is-active{ display:block; }

.loginwrap{ display:grid; gap:14px; max-width: 980px; margin: 14px auto; }
.login{ max-width: 520px; }

.section{ display:none; }
.section.is-active{ display:block; }

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card--ghost{
  background: transparent;
  border: 1px dashed var(--border);
  box-shadow: none;
}
.card__head{ padding: 14px 14px 0; }
.card__head--row{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.card__body{ padding: 14px; }

h2{ margin:0; font-size:18px; }
h3{ margin:0 0 10px; font-size:16px; }
p{ margin:8px 0 0; }
.muted{ color: var(--muted); font-size:13px; }
.kicker{ font-size:12px; color: var(--muted); font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.pill{
  display:inline-flex; align-items:center;
  padding: 8px 10px; border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size:13px;
}

.form{ padding: 14px; display:grid; gap:12px; }
.field{ display:grid; gap:6px; }
.field span{ font-size:12px; color: var(--muted); font-weight:800; letter-spacing:.02em; }
input, select{
  width:100%;
  border:1px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px;
  font-size:16px; /* cegah iOS zoom */
  outline:none;
  background:#fff;
}
input:focus, select:focus{ border-color: rgba(79,70,229,.55); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.row2{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }

.btn{
  appearance:none; border: 1px solid var(--border);
  background:#fff; color: var(--text);
  padding: 12px 12px;
  border-radius: 14px;
  font-weight:900;
  font-size:14px;
  cursor:pointer;
  box-shadow: 0 10px 22px rgba(15,23,42,.05);
}
.btn:active{ transform: translateY(1px); }
.btn--primary{
  border-color: rgba(79,70,229,.20);
  background: linear-gradient(135deg, var(--primary2), var(--primary3));
  color:#fff;
}
.btn--danger{
  border-color: rgba(220,38,38,.25);
  background: linear-gradient(135deg, var(--danger), #fb7185);
  color:#fff;
}
.iconbtn{
  border: 1px solid rgba(255,255,255,.22);
  width:40px; height:40px;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  cursor:pointer;
  font-size:16px;
  color:#fff;
}
.iconbtn--ghost{ box-shadow:none; }

.hint{ font-size:12px; color: var(--muted); text-align:center; padding-top:4px; }
.error{
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
}

.toolbar{
  padding: 12px 14px 0;
  display:grid; gap:10px;
}
.search input{ background:#f8fafc; }
.segmented{ display:flex; gap:8px; flex-wrap:wrap; }
.segbtn{
  border:1px solid var(--border);
  background:#fff;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight:900;
  font-size:13px;
  cursor:pointer;
}
.segbtn.is-active{
  border-color: rgba(79,70,229,.25);
  background: rgba(79,70,229,.08);
  color: var(--primary2);
}

.tablewrap{ overflow:auto; padding: 12px 14px 14px; }
.table{ width:100%; border-collapse: collapse; min-width: 560px; }
.table th, .table td{
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  font-size: 13px;
  vertical-align: top;
}
.table th{ text-align:left; color: var(--muted); font-weight:900; font-size:12px; }
.right{ text-align:right; }

.badge{
  display:inline-flex; align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background:#f8fafc;
  font-weight:900;
  font-size:12px;
}
.badge.low{ background: #fff7ed; border-color:#fed7aa; color:#9a3412; }
.badge.ok{ background: #eff6ff; border-color:#bfdbfe; color:#1d4ed8; }

.rowactions{ display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; }
.minibtn{
  border:1px solid var(--border);
  background:#fff;
  padding: 8px 10px;
  border-radius: 12px;
  font-weight:900;
  font-size:12px;
  cursor:pointer;
}
.minibtn--primary{ background: rgba(79,70,229,.08); border-color: rgba(79,70,229,.18); color: var(--primary2); }
.minibtn--danger{ background: rgba(220,38,38,.08); border-color: rgba(220,38,38,.18); color: #b91c1c; }

.empty{
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align:center;
}

.bullets{ margin:8px 0 0; padding-left:18px; color: var(--text); }
.bullets li{ margin:6px 0; color: var(--muted); }
.bullets b{ color: var(--text); }

.dashHeader{ margin: 6px 0 12px; }
.dashTitle{ font-weight:900; font-size:18px; }
.dashSub{ color: var(--muted); font-size:13px; margin-top:4px; }

.metricRow{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:12px;
  margin-bottom: 12px;
}
.metric{
  background:#fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 12px 12px;
  display:flex;
  gap:12px;
  align-items:center;
  min-width:0;
}
.micon{
  width:42px; height:42px;
  border-radius: 16px;
  display:grid;
  place-items:center;
  font-size:18px;
  font-weight:900;
  background: rgba(79,70,229,.10);
  color: var(--primary2);
  flex:0 0 auto;
}
.mtxt{ min-width:0; }
.mlabel{ color: var(--muted); font-weight:900; font-size:12px; text-transform:uppercase; letter-spacing:.08em; }
.mvalue{ margin-top:6px; font-weight:900; font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(15,23,42,.92);
  color:#fff;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight:900;
  display:none;
  z-index:60;
  max-width: calc(100vw - 24px);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.modal{ display:none; }
.modal.is-open{
  display:block;
  position:fixed; inset:0; z-index:50;
}
.modal__backdrop{
  position:absolute; inset:0;
  background: rgba(2,6,23,.35);
}
.modal__panel{
  position:absolute;
  left: 12px; right: 12px;
  bottom: 12px;
  background:#fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  max-height: 86vh;
  overflow:auto;
}
.modal__head{
  padding: 14px 14px 0;
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
}
.actions{
  display:flex; gap:10px; justify-content:flex-end;
  padding-top: 4px;
}

.scrim{
  display:none;
  position: fixed; inset:0; z-index:15;
  background: rgba(2,6,23,.35);
}

@media (max-width: 980px){
  .metricRow{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px){
  .app{ display:block; }
  .sidebar{
    position: fixed;
    left: -280px;
    top:0;
    height: 100vh;
    z-index: 40;
    width: 270px;
    transition: left .18s ease;
  }
  .sidebar.is-open{ left: 0; }
  .scrim.is-open{ display:block; }
  .main{ padding: 12px; }
  .grid2{ grid-template-columns: 1fr; }
  .table{ min-width: 520px; }
  .modal__panel{ left: 12px; right: 12px; transform:none; width:auto; }
}

@media (min-width: 861px){
  #btnSidebar{ display:none; }
  .modal__panel{ left: 50%; right: auto; transform: translateX(-50%); width: 520px; }
}
