:root{
  --bg0:#061826;
  --bg1:#0b2b45;
  --card:rgba(255,255,255,.07);
  --line:rgba(255,255,255,.12);
  --text:#eaf2ff;
  --muted:rgba(234,242,255,.72);

  --brand:#2f89ff;
  --brand2:#00d4ff;
  --danger:#ff4d6d;
  --ok:#22c55e;
  --warn:#f97316;

  --r:18px;
  --shadow:0 18px 60px rgba(0,0,0,.35);
  --shadow2:0 16px 40px rgba(47,137,255,.22);
  --ring: 0 0 0 4px rgba(47,137,255,.18);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background: linear-gradient(180deg, var(--bg0), var(--bg1));
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  overflow-x:hidden;
}
a{color:inherit;text-decoration:none}
.muted{color:var(--muted)}
.tiny{font-size:12px}

.bgFX{
  position:fixed; inset:-40px;
  background:
    radial-gradient(1200px 600px at 12% 10%, rgba(47,137,255,.24), transparent 55%),
    radial-gradient(900px 520px at 92% 20%, rgba(0,212,255,.16), transparent 55%),
    radial-gradient(700px 520px at 50% 100%, rgba(255,77,109,.10), transparent 60%);
  filter: saturate(1.1);
  animation: bgFloat 10s ease-in-out infinite;
  z-index:-1;
}
@keyframes bgFloat{
  0%{transform: translateY(0px)}
  50%{transform: translateY(-10px)}
  100%{transform: translateY(0px)}
}

.appShell{
  min-height:100vh;
  display:grid;
  grid-template-columns: 290px 1fr;
}
@media (max-width: 920px){
  .appShell{grid-template-columns: 1fr}
}

/* Sidebar fixed kiri */
.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  padding:18px 16px;
  border-right:1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  backdrop-filter: blur(10px);
  animation: sideIn .55s ease both;
  overflow:auto;
}
@keyframes sideIn{
  from{opacity:0; transform: translateX(-12px); filter: blur(3px);}
  to{opacity:1; transform: translateX(0); filter: blur(0);}
}

.sideBrand{
  display:flex; gap:12px; align-items:center;
  padding:12px 12px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:18px;
  background: rgba(0,0,0,.10);
  box-shadow: var(--shadow2);
}
.logoPulse{
  width:40px;height:40px;border-radius:14px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  font-weight:900;
  position:relative;
  overflow:hidden;
}
.logoPulse::after{
  content:"";
  position:absolute;
  inset:-2px;
  background: radial-gradient(30px 30px at 30% 30%, rgba(255,255,255,.45), transparent 60%);
  animation: glowMove 5.5s ease-in-out infinite;
}
@keyframes glowMove{
  0%{transform: translateX(-16%) translateY(-8%); opacity:.55;}
  50%{transform: translateX(14%) translateY(4%); opacity:.95;}
  100%{transform: translateX(-16%) translateY(-8%); opacity:.55;}
}

.sideTitle{font-weight:900; letter-spacing:.2px}
.sideSub{font-size:12px; margin-top:2px}

.sideNav{margin-top:14px; display:flex; flex-direction:column; gap:8px}
.navItem{
  display:flex; align-items:center; gap:10px;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
  position:relative;
  overflow:hidden;
}
.navItem .ico{
  width:30px; height:30px;
  display:grid; place-items:center;
  border-radius:12px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  font-size:16px;
  transform: translateZ(0);
  transition: transform .15s ease, filter .15s ease;
}
.navItem:hover .ico{transform: rotate(-6deg) scale(1.06); filter:brightness(1.08)}
.navItem:hover{transform: translateY(-1px); border-color: rgba(47,137,255,.32); background: rgba(47,137,255,.08)}
.navItem.active{
  border-color: rgba(47,137,255,.55);
  background: linear-gradient(90deg, rgba(47,137,255,.22), rgba(0,212,255,.08));
}
.navItem.active::before{
  content:"";
  position:absolute;
  left:0; top:10px; bottom:10px;
  width:4px;
  border-radius:999px;
  background: linear-gradient(180deg, var(--brand), var(--brand2));
  box-shadow: 0 0 0 4px rgba(47,137,255,.15);
}
.chip{
  margin-left:auto;
  font-size:11px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
}

.sideFooter{margin-top:14px; display:flex; flex-direction:column; gap:10px}

/* Main */
.appMain{
  padding:22px 18px;
  animation: mainIn .55s ease both;
}
@keyframes mainIn{
  from{opacity:0; transform: translateY(12px); filter: blur(3px);}
  to{opacity:1; transform: translateY(0); filter: blur(0);}
}

.pageHead{
  display:flex; align-items:flex-end; justify-content:space-between;
  gap:12px; flex-wrap:wrap;
  margin-bottom:14px;
}
.pageHead h1{margin:0; font-size:20px; letter-spacing:.2px}
.pageHead p{margin:6px 0 0}
.headActions{display:flex; gap:10px; flex-wrap:wrap}

/* Card */
.card{
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow:hidden;
  margin-bottom:14px;
  position:relative;
}
.card::before{
  content:"";
  position:absolute; inset:-1px;
  background: radial-gradient(700px 340px at 10% 0%, rgba(47,137,255,.20), transparent 55%);
  pointer-events:none;
  animation: glowMove 7s ease-in-out infinite;
}
.cardTitle{
  position:relative;
  padding:14px 16px;
  font-weight:900;
  border-bottom:1px solid rgba(255,255,255,.08);
  background: linear-gradient(90deg, rgba(47,137,255,.16), rgba(0,212,255,.07));
}
.cardInner{position:relative; padding:14px 16px}

/* Form */
.form .field{margin-top:12px}
label{display:block; margin-bottom:8px; font-size:13px; color:var(--muted)}
.help{margin-top:8px; font-size:12px; color:var(--muted)}

input, select, textarea{
  width:100%;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.14);
  color:var(--text);
  padding:12px 12px;
  outline:none;
  transition: box-shadow .12s ease, border-color .12s ease, transform .12s ease, background .12s ease;
}
textarea{min-height:120px; resize:vertical}

input:focus, select:focus, textarea:focus{
  border-color: rgba(47,137,255,.55);
  box-shadow: var(--ring);
  background: rgba(0,0,0,.20);
}

input[type="file"]{padding:10px 12px}
input[type="file"]::file-selector-button{
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  margin-right:10px;
  cursor:pointer;
}
input[type="file"]::file-selector-button:hover{filter:brightness(1.07)}

.grid2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
@media (max-width: 760px){ .grid2{grid-template-columns:1fr} }

.actions{
  margin-top:16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.btn{
  border:0;
  cursor:pointer;
  padding:12px 16px;
  border-radius:16px;
  font-weight:900;
  letter-spacing:.2px;
  color:white;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: var(--shadow2);
  transition: transform .12s ease, filter .12s ease;
  position:relative;
  overflow:hidden;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.btnIco{
  display:inline-grid;
  place-items:center;
  width:24px;height:24px;
  border-radius:10px;
  background: rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.18);
  animation: icoFloat 3.4s ease-in-out infinite;
}
@keyframes icoFloat{
  0%{transform: translateY(0)}
  50%{transform: translateY(-2px)}
  100%{transform: translateY(0)}
}
.btn:hover{filter:brightness(1.06); transform: translateY(-1px)}
.btn:active{transform: translateY(0px)}
.btn.full{width:100%}
.btn.ghost{
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  box-shadow:none;
}
.btn.danger{
  background: rgba(255,77,109,.14);
  border:1px solid rgba(255,77,109,.30);
  box-shadow:none;
}
.btn.sm{padding:8px 12px; border-radius:14px; font-size:12px}
.btn::after{
  content:"";
  position:absolute;
  top:-40%;
  left:-60%;
  width:50%;
  height:180%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shine 2.8s ease-in-out infinite;
}
@keyframes shine{
  0%{transform: translateX(-140%) skewX(-18deg); opacity:0;}
  20%{opacity:.32;}
  100%{transform: translateX(240%) skewX(-18deg); opacity:0;}
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  font-size:12px;
}
.dot{width:9px;height:9px;border-radius:999px;background:var(--ok); box-shadow:0 0 0 4px rgba(34,197,94,.14)}

.alert{
  padding:12px 12px;
  border-radius:16px;
  border:1px solid rgba(255,77,109,.35);
  background: rgba(255,77,109,.10);
  margin-bottom:12px;
}
.alert.ok{
  border-color: rgba(34,197,94,.35);
  background: rgba(34,197,94,.10);
}
.alert.warn{
  border-color: rgba(249,115,22,.35);
  background: rgba(249,115,22,.10);
}

.tableWrap{overflow:auto}
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  border:1px solid rgba(255,255,255,.12);
  border-radius:18px;
  overflow:hidden;
  background: rgba(0,0,0,.10);
}
.table th, .table td{
  padding:12px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
  text-align:left;
  font-size:13px;
}
.table th{font-weight:900; color:rgba(234,242,255,.90)}
.table tr:last-child td{border-bottom:0}

.tag{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.tag.sent{border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.10)}
.tag.failed{border-color: rgba(255,77,109,.35); background: rgba(255,77,109,.10)}
.tag.queued{border-color: rgba(47,137,255,.35); background: rgba(47,137,255,.10)}
.tag.cancelled{border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.06)}

.inline{display:inline}
.rowActions{white-space:nowrap}

.footerNote{
  margin-top:12px;
  text-align:center;
  color:var(--muted);
  font-size:12px;
}

/* Template cards */
.tplCard{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  border-radius:18px;
  padding:12px;
  margin-bottom:10px;
}
.tplHead{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; flex-wrap:wrap}
.tplName{font-weight:900}
.tplActions{display:flex; gap:8px; flex-wrap:wrap}
.tplPreview{
  margin:10px 0 0;
  padding:12px;
  border-radius:16px;
  border:1px dashed rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  color: rgba(234,242,255,.90);
  white-space:pre-wrap;
}

/* KV */
.kv{
  display:grid;
  grid-template-columns: 160px 1fr;
  gap:10px 12px;
}
.kv .k{color:var(--muted); font-size:13px}
.kv .v{font-weight:800}
code{background: rgba(255,255,255,.08); padding:3px 6px; border-radius:10px; border:1px solid rgba(255,255,255,.10)}

/* Auth */
.authShell{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:16px;
}
.authCard{
  width:min(520px, 100%);
  animation: mainIn .55s ease both;
}
.authTop{
  display:flex; gap:12px; align-items:center;
  margin-bottom:10px;
}
.authLogo{
  width:44px;height:44px;border-radius:16px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: var(--shadow2);
  position:relative;
  overflow:hidden;
}
.authLogo::after{
  content:"";
  position:absolute; inset:-2px;
  background: radial-gradient(30px 30px at 30% 30%, rgba(255,255,255,.45), transparent 60%);
  animation: glowMove 5.5s ease-in-out infinite;
}
.authTitle{font-weight:900; font-size:16px}

/* Toast */
.toast{
  position:fixed;
  left:50%;
  bottom:16px;
  transform:translateX(-50%) translateY(10px);
  opacity:0;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  font-size:12px;
  transition: opacity .18s ease, transform .18s ease;
  z-index:50;
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0)}

@media (prefers-reduced-motion: reduce){
  *{transition:none!important; animation:none!important}
  .btn::after{display:none}
}

.tag.running{border-color: rgba(249,115,22,.35); background: rgba(249,115,22,.10)}
