:root {
  --bg: #05070f;
  --bg-2: #080c18;
  --panel: #0a0f1d;
  --ink: #eef1ff;
  --muted: #99a1bf;
  --muted-2: #6f7795;
  --accent: #2c67ed;
  --accent-2: #5b93ff;
  --danger: #f0567a;
  --ok: #12b981;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --font-sans: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

/* Atribut hidden harus selalu menang atas display dari kelas */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(70% 50% at 85% 0%, rgba(44, 103, 237, 0.12), transparent 65%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.03em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input, textarea, select { font: inherit; color: inherit; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Lompat langsung ke area kerja (muncul saat Tab) */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), #16389b);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.brand__title { font-size: 13.5px; font-weight: 500; letter-spacing: -0.01em; }
.brand__sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------- Auth ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth__card {
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012));
  backdrop-filter: blur(10px);
  box-shadow: 0 40px 100px -50px rgba(0, 0, 0, 0.9);
}
.auth__form { display: grid; gap: 8px; margin-top: 26px; }
.auth__form label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth__form input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.auth__form input:focus {
  outline: none;
  border-color: rgba(91, 147, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(44, 103, 237, 0.14);
}
.auth__form .btn { margin-top: 8px; }
.auth__error {
  min-height: 18px;
  font-size: 11.5px;
  color: var(--danger);
}
.auth__note {
  margin-top: 18px;
  font-size: 11px;
  color: var(--muted-2);
  text-align: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.3s, transform 0.3s var(--ease), border-color 0.3s;
}
.btn:active { transform: scale(0.985); }
.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 30px -14px rgba(44, 103, 237, 0.9);
}
.btn--primary:hover { background: #3573ff; }
.btn--primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--ghost {
  border: 1px solid var(--border-strong);
  color: var(--ink);
  background: transparent;
}
.btn--ghost:hover { background: rgba(255, 255, 255, 0.06); }
.btn--danger { color: var(--danger); border-color: rgba(240, 86, 122, 0.4); }
.btn--danger:hover { background: rgba(240, 86, 122, 0.1); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 11px; }

/* ---------- App layout ---------- */
.app {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: rgba(6, 9, 19, 0.7);
  backdrop-filter: blur(12px);
  overflow-y: auto;
}

.side__nav { display: grid; gap: 18px; align-content: start; }
.side__group { display: grid; gap: 6px; }
.side__label {
  margin: 0 0 0 14px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.side__list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.side__nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  text-align: left;
  transition: background 0.25s, color 0.25s;
}
.side__nav button:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.side__nav button.is-active {
  background: rgba(44, 103, 237, 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(91, 147, 255, 0.3);
}

.pill {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink);
}
.side__nav button.is-active .pill { background: var(--accent); }

.side__foot {
  margin-top: auto;
  display: grid;
  gap: 2px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.ghost-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  transition: background 0.25s, color 0.25s;
}
.ghost-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.ghost-link--danger:hover { color: var(--danger); }
.ghost-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-left: auto;
}

.main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 clamp(20px, 3vw, 44px) 80px;
}
.main__inner {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 7, 15, 0.88);
  backdrop-filter: blur(14px);
}
.topbar__eyebrow {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 6px;
}
.topbar__title {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.1;
}
.topbar__desc {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 52ch;
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  transition: color 0.3s;
}
.status.is-dirty { color: #f5b544; }
.status.is-saved { color: var(--ok); }
.status.is-error { color: var(--danger); }

/* ---------- Panel ---------- */
.panel {
  display: grid;
  gap: 16px;
  outline: none;
  scroll-margin-top: 120px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.022);
  overflow: hidden;
  transition: border-color 0.3s;
}
.card:hover { border-color: rgba(255, 255, 255, 0.16); }
.card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.card__index {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: 0.1em;
}
.card__name {
  font-size: 12.5px;
  font-weight: 400;
  color: #cfd5ee;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__tools {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--muted);
  transition: background 0.25s, color 0.25s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.icon-btn--danger:hover { background: rgba(240, 86, 122, 0.12); color: var(--danger); }
.icon-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.card__body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}
.card__body .field--wide { grid-column: 1 / -1; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 13px;
  font-weight: 300;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.field select { cursor: pointer; }
.field select option { background: #0a0f1d; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(91, 147, 255, 0.7);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(44, 103, 237, 0.12);
}
.field__hint { font-size: 10.5px; color: var(--muted-2); }

/* Image field */
.image-field { display: flex; gap: 14px; align-items: center; }
.image-field__preview {
  position: relative;
  width: 118px;
  height: 74px;
  flex-shrink: 0;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.25);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.image-field__preview img { width: 100%; height: 100%; object-fit: cover; }
.image-field__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.image-field input[type="file"] { display: none; }

/* Empty state */
.empty {
  display: grid;
  gap: 8px;
  place-items: center;
  padding: 56px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}
.empty strong { font-weight: 500; color: var(--ink); font-size: 14px; }
.empty p { font-size: 12px; max-width: 40ch; }
.empty .btn { margin-top: 8px; }

/* Messages */
.msg {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.022);
}
.msg__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.msg__name { font-size: 13.5px; font-weight: 500; }
.msg__email {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent-2);
}
.msg__date {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted-2);
}
.msg__body { font-size: 13px; color: #c7cde6; white-space: pre-wrap; }
.msg__tools { display: flex; gap: 8px; }

/* Dialog */
.dialog {
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: #080c17;
  color: var(--ink);
  padding: 0;
  width: min(420px, calc(100vw - 32px));
  box-shadow: 0 40px 120px -40px rgba(0, 0, 0, 0.95);
}
.dialog::backdrop { background: rgba(3, 5, 11, 0.75); backdrop-filter: blur(6px); }
.dialog__body { display: grid; gap: 8px; padding: 24px; }
.dialog__body h2 { font-size: 1.15rem; margin-bottom: 8px; }
.dialog__body label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.dialog__body input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.3);
}
.dialog__body input:focus {
  outline: none;
  border-color: rgba(91, 147, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(44, 103, 237, 0.12);
}
.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  padding: 11px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(10, 15, 28, 0.96);
  backdrop-filter: blur(10px);
  font-size: 12px;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.4s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .side {
    position: relative;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .side__nav {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .side__nav::-webkit-scrollbar { display: none; }
  .side__group { flex-shrink: 0; }
  .side__label { display: none; }
  .side__list { display: flex; gap: 6px; }
  .side__nav button { width: auto; white-space: nowrap; padding: 8px 12px; }
  .side__foot { margin: 0; display: flex; gap: 4px; padding: 0; border: 0; }
  .side__foot .ghost-link { padding: 8px 10px; white-space: nowrap; }
  .ghost-link svg { margin-left: 0; }
  .main { height: auto; overflow: visible; padding: 0 16px 60px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px 0 14px; }
  .topbar__actions { width: 100%; justify-content: space-between; }
  .card__body { grid-template-columns: 1fr; }
}

/* Preview video TikTok di kartu admin */
.tiktok-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.tiktok-preview__thumb {
  flex: 0 0 56px;
  width: 56px;
  aspect-ratio: 9 / 16;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 8px;
  line-height: 1.2;
  text-align: center;
  color: var(--muted-2);
}
.tiktok-preview__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tiktok-preview__info {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.tiktok-preview__info strong {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}
.tiktok-preview__info span {
  font-size: 11px;
  color: var(--muted-2);
}
.tiktok-preview__info .tiktok-preview__error { color: var(--danger); }
.tiktok-preview__link {
  width: max-content;
  font-size: 11px;
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 560px) {
  .brand__sub { display: none; }
  .side { flex-wrap: wrap; gap: 12px; padding: 12px; }
  .side__nav { order: 3; width: 100%; }
  .side__foot { gap: 2px; }
  .side__foot .ghost-link { padding: 8px 8px; font-size: 11px; }
  .side__foot .ghost-link__text { display: none; }
  .topbar {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 16px;
  }
  .topbar__eyebrow,
  .topbar__desc { display: none; }
  .topbar__title { font-size: 1.2rem; }
  .topbar__actions { width: auto; margin-left: auto; }
  .topbar .btn { height: 38px; padding: 0 14px; }
  .status {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .image-field { flex-direction: column; align-items: flex-start; }
}
