/* ==========================================================================
   ZØRVAE 3D — Design System
   Hitam pekat + merah krom. Semua font di-host lokal (tanpa CDN).
   ========================================================================== */
@font-face {
  font-family: 'Zv Display';
  src: url('/fonts/Orbitron-Black.ttf') format('truetype');
  font-weight: 900; font-display: swap;
}
@font-face {
  font-family: 'Zv Mono';
  src: url('/fonts/ChakraPetch-Bold.ttf') format('truetype');
  font-weight: 700; font-display: swap;
}

:root {
  --red-400: #ff4455;
  --red-500: #ff1f2e;
  --red-600: #e00a1e;
  --red-700: #a80615;
  --red-glow: rgba(255, 31, 46, .38);

  --bg-0: #040406;
  --bg-1: #08080c;
  --bg-2: #0d0d13;
  --bg-3: #13131b;

  --panel: rgba(13, 13, 19, .82);
  --panel-solid: #0d0d13;
  --line: rgba(255, 255, 255, .085);
  --line-strong: rgba(255, 255, 255, .16);
  --line-red: rgba(255, 31, 46, .42);

  --text-0: #f4f4f7;
  --text-1: #a6a6b4;
  --text-2: #6d6d7d;
  --ok: #2ee6a8;
  --warn: #ffb02e;

  --r-xs: 8px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px;
  --shadow-1: 0 10px 30px rgba(0, 0, 0, .55);
  --shadow-red: 0 0 24px rgba(255, 31, 46, .28);
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Zv Display', var(--font-ui);
  --font-mono: 'Zv Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
body.scrollable { overflow: auto; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--red-400); text-decoration: none; }
a:hover { color: #fff; }
::selection { background: rgba(255, 31, 46, .35); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 31, 46, .5), rgba(255, 255, 255, .12));
  border-radius: 99px; border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 31, 46, .75); background-clip: padding-box; }

/* ---------------------------------------------------------------- backdrop */
.zv-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(1000px 620px at 78% -10%, rgba(255, 31, 46, .16), transparent 60%),
    radial-gradient(760px 520px at 6% 108%, rgba(255, 31, 46, .10), transparent 62%),
    linear-gradient(180deg, #060609, #040406 55%, #08080c);
}
.zv-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 64px 64px, 64px 64px;
  mask-image: radial-gradient(circle at 50% 40%, rgba(0,0,0,.85), transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, rgba(0,0,0,.85), transparent 78%);
  opacity: .5;
}
.zv-bg .scan {
  position: absolute; inset: -40% 0 auto 0; height: 42%;
  background: linear-gradient(180deg, transparent, rgba(255, 31, 46, .07), transparent);
  animation: scanline 9s linear infinite;
}
@keyframes scanline { 0% { transform: translateY(-20%); } 100% { transform: translateY(320%); } }

/* ------------------------------------------------------------------- brand */
.brand { display: inline-flex; align-items: center; gap: 12px; user-select: none; }
.brand__logo { height: 34px; width: auto; filter: drop-shadow(0 3px 10px rgba(255, 31, 46, .35)); }
.brand__logo--lg { height: 96px; }
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__name {
  font-family: var(--font-display); font-weight: 900; letter-spacing: .14em;
  font-size: 15px;
  background: linear-gradient(180deg, #fff 20%, #b9bcc6 55%, #6a6d78 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand__tag { font-size: 9px; letter-spacing: .3em; color: var(--red-500); text-transform: uppercase; margin-top: 3px; }

/* ------------------------------------------------------------------ button */
.btn {
  --btn-bg: rgba(255, 255, 255, .04);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--btn-bg); color: var(--text-0);
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
  cursor: pointer; transition: all .18s var(--ease); white-space: nowrap;
  text-align: center;
}
.btn:hover { border-color: var(--line-red); background: rgba(255, 31, 46, .1); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.995); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--primary {
  border: none; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--red-500), var(--red-700) 65%, #7a0510);
  box-shadow: 0 8px 22px rgba(224, 10, 30, .28), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn--primary:hover { filter: brightness(1.12); box-shadow: 0 12px 30px rgba(255, 31, 46, .45); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text-1); }
.btn--ghost:hover { color: #fff; }
.btn--block { width: 100%; }
.btn--lg { padding: 14px 22px; font-size: 14px; border-radius: var(--r-md); }
.btn--sm { padding: 7px 11px; font-size: 12px; border-radius: var(--r-xs); }
.btn--icon { padding: 8px; width: 34px; height: 34px; }
.btn--danger { border-color: rgba(255, 31, 46, .5); color: #ff8a94; }
.btn--danger:hover { background: rgba(255, 31, 46, .16); color: #fff; }

/* ------------------------------------------------------------------- field */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field__label {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.field__label .hint { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-2); font-size: 11px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .028); border: 1px solid var(--line);
  color: var(--text-0); transition: border-color .16s, box-shadow .16s, background .16s;
  outline: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--line-red); background: rgba(255, 31, 46, .06);
  box-shadow: 0 0 0 3px rgba(255, 31, 46, .12);
}
.input::placeholder { color: var(--text-2); }
.textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a6a6b4' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.select option { background: #12121a; color: var(--text-0); }
.input--mono { font-family: var(--font-mono); letter-spacing: .04em; }

/* range */
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, var(--red-500), rgba(255, 255, 255, .16));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: #fff; border: 2px solid var(--red-500);
  box-shadow: 0 0 10px rgba(255, 31, 46, .8); transition: transform .15s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(255,255,255,.16); }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 2px solid var(--red-500); }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 12.5px; color: var(--text-1); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__dot {
  width: 36px; height: 20px; border-radius: 99px; flex: none;
  background: rgba(255, 255, 255, .1); border: 1px solid var(--line-strong);
  position: relative; transition: all .2s var(--ease);
}
.switch__dot::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #b9b9c4; transition: all .2s var(--ease);
}
.switch input:checked + .switch__dot { background: linear-gradient(135deg, var(--red-500), var(--red-700)); border-color: transparent; box-shadow: 0 0 14px var(--red-glow); }
.switch input:checked + .switch__dot::after { left: 18px; background: #fff; }

/* checkbox */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-1); cursor: pointer; }
.check input { accent-color: var(--red-500); width: 15px; height: 15px; }

/* -------------------------------------------------------------------- card */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-1);
}
.card--red { border-color: var(--line-red); box-shadow: var(--shadow-1), 0 0 0 1px rgba(255,31,46,.08) inset; }

/* badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--line-strong); color: var(--text-1); background: rgba(255, 255, 255, .04);
}
.badge--red { color: #ffd2d6; border-color: var(--line-red); background: rgba(255, 31, 46, .14); }
.badge--ok { color: #b6ffe4; border-color: rgba(46, 230, 168, .4); background: rgba(46, 230, 168, .12); }
.badge--warn { color: #ffe2b6; border-color: rgba(255, 176, 46, .4); background: rgba(255, 176, 46, .12); }
.badge--off { color: var(--text-2); }

/* section head */
.section-head {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px;
  font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--text-2);
}
.section-head::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-sm); background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.tabs__btn {
  flex: 1; padding: 9px 10px; border-radius: 7px; border: none; background: transparent;
  color: var(--text-2); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; transition: all .18s var(--ease);
}
.tabs__btn:hover { color: var(--text-0); }
.tabs__btn.is-active {
  color: #fff; background: linear-gradient(135deg, rgba(255, 31, 46, .9), rgba(150, 6, 18, .9));
  box-shadow: 0 4px 14px rgba(224, 10, 30, .3);
}

/* ------------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px;
  background: rgba(2, 2, 4, .78); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  opacity: 0; pointer-events: none; transition: opacity .22s var(--ease);
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(760px, 100%); max-height: 88vh; overflow: auto;
  background: linear-gradient(180deg, #12121a, #0a0a10);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 31, 46, .1) inset;
  transform: translateY(14px) scale(.985); transition: transform .24s var(--ease);
}
.modal-backdrop.is-open .modal { transform: none; }
.modal__head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal__title { font-family: var(--font-display); font-size: 17px; letter-spacing: .08em; margin: 0; }
.modal__sub { font-size: 12.5px; color: var(--text-1); margin: 4px 0 0; }
.modal__body { padding: 20px 22px; }
.modal__foot { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal__close {
  margin-left: auto; width: 32px; height: 32px; flex: none; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--text-1);
  display: grid; place-items: center; font-size: 17px; line-height: 1;
}
.modal__close:hover { color: #fff; border-color: var(--line-red); background: rgba(255, 31, 46, .14); }

/* ------------------------------------------------------------------- toast */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, 92vw); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm);
  background: rgba(18, 18, 26, .96); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-1); font-size: 12.8px; color: var(--text-0);
  animation: toast-in .25s var(--ease);
}
.toast.is-out { animation: toast-out .2s var(--ease) forwards; }
.toast__icon { width: 18px; height: 18px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.toast--ok { border-color: rgba(46, 230, 168, .45); } .toast--ok .toast__icon { background: rgba(46, 230, 168, .18); color: var(--ok); }
.toast--err { border-color: rgba(255, 31, 46, .55); } .toast--err .toast__icon { background: rgba(255, 31, 46, .18); color: var(--red-400); }
.toast--info .toast__icon { background: rgba(255, 255, 255, .1); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---------------------------------------------------------------- spinner */
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); border-top-color: var(--red-500); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner--lg { width: 30px; height: 30px; border-width: 3px; }

/* ------------------------------------------------------------------ utils */
.u-flex { display: flex; } .u-between { justify-content: space-between; } .u-center { align-items: center; }
.u-gap-6 { gap: 6px; } .u-gap-10 { gap: 10px; } .u-gap-14 { gap: 14px; }
.u-mt-8 { margin-top: 8px; } .u-mt-14 { margin-top: 14px; } .u-mt-20 { margin-top: 20px; }
.u-mb-0 { margin-bottom: 0; } .u-grow { flex: 1; }
.u-muted { color: var(--text-1); } .u-dim { color: var(--text-2); }
.u-small { font-size: 11.5px; } .u-mono { font-family: var(--font-mono); letter-spacing: .03em; }
.u-hide { display: none !important; }
.u-nowrap { white-space: nowrap; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.kbd {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; font-family: var(--font-mono);
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line-strong); color: var(--text-1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------ list & note */
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: rgba(255, 255, 255, .025); font-size: 12px;
}
.mini-item b { font-weight: 600; }
.mini-item small { color: var(--text-2); font-size: 10.5px; display: block; }
.mini-item .u-grow { min-width: 0; }
.mini-item button { flex: none; }

.empty-note {
  padding: 16px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-md);
  color: var(--text-2); font-size: 11.5px;
}

