/* Nano Screen Remote: desain dari pc-detail.html + tambahan untuk login, daftar PC, hasil, viewer. */
  :root {
    color-scheme: light;
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #f0f2f6;
    --line: #dde2ea;
    --text: #1b2230;
    --muted: #5f6b7d;
    --accent: #2f64d6;
    --accent-ink: #ffffff;
    --accent-soft: #e5edfc;
    --ok: #1f9a62;
    --ok-soft: #e1f4ea;
    --warn: #b7791f;
    --warn-soft: #fbf0dc;
    --danger: #c8412e;
    --danger-soft: #fbe7e3;
    --off: #8a94a5;
    --off-soft: #eceff3;
    --radius-lg: 14px;
    --radius: 9px;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --bg: #14171c;
      --surface: #1b1f26;
      --surface-2: #232832;
      --line: #2d333e;
      --text: #e5e8ee;
      --muted: #929bab;
      --accent: #6a96f0;
      --accent-ink: #0f1520;
      --accent-soft: #1f2a40;
      --ok: #45c08a;
      --ok-soft: #173327;
      --warn: #e3ab4b;
      --warn-soft: #362a15;
      --danger: #ec6f5b;
      --danger-soft: #3a1d19;
      --off: #7d8696;
      --off-soft: #262b34;
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #14171c; --surface: #1b1f26; --surface-2: #232832; --line: #2d333e;
    --text: #e5e8ee; --muted: #929bab; --accent: #6a96f0; --accent-ink: #0f1520;
    --accent-soft: #1f2a40; --ok: #45c08a; --ok-soft: #173327; --warn: #e3ab4b;
    --warn-soft: #362a15; --danger: #ec6f5b; --danger-soft: #3a1d19;
    --off: #7d8696; --off-soft: #262b34;
  }

  *, *::before, *::after { box-sizing: inherit; }
  html { scroll-padding-top: env(safe-area-inset-top, 0px); }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  button { font: inherit; color: inherit; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

  /* ---------- Top bar ---------- */
  .topbar {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  body::before {
    content: ""; position: fixed; inset: 0 0 auto;
    height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface);
  }
  .topbar-inner {
    max-width: 1120px; margin: 0 auto; padding: 12px 24px;
    display: flex; align-items: center; gap: 16px;
  }
  .brand { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 10px; }
  .brand-mark {
    width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
    display: grid; place-items: center; color: var(--accent-ink);
  }
  .crumbs { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; }
  .crumbs a { color: var(--muted); text-decoration: none; }
  .crumbs a:hover { color: var(--text); }
  .crumbs strong { color: var(--text); font-weight: 500; }
  .topbar .spacer { flex: 1; }
  .account { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
  .avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2);
    border: 1px solid var(--line); display: grid; place-items: center;
    color: var(--text); font-weight: 600; font-size: 13px;
  }

  /* ---------- Layout ---------- */
  main { max-width: 1120px; margin: 0 auto; padding: 24px 24px 64px; }
  .grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
  .stack { display: grid; gap: 20px; }
  @media (max-width: 920px) {
    .grid { grid-template-columns: 1fr; }
    .crumbs .sep, .crumbs a { display: none; }
  }
  @media (max-width: 560px) {
    main { padding: 16px 14px 48px; }
    .topbar-inner { padding: 10px 14px; }
    .account .name { display: none; }
  }

  .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }
  .panel-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 18px 20px 0;
  }
  .panel-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
  .panel-head p { margin: 0; color: var(--muted); font-size: 13px; }
  .panel-body { padding: 16px 20px 20px; }

  /* ---------- Hero / identity ---------- */
  .hero {
    display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px;
    padding: 22px 24px;
  }
  .hero-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
  .pc-icon {
    width: 52px; height: 52px; flex: none; border-radius: 12px;
    background: var(--surface-2); border: 1px solid var(--line);
    display: grid; place-items: center; color: var(--muted); position: relative;
  }
  .pc-icon .dot {
    position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px;
    border-radius: 50%; border: 3px solid var(--surface); background: var(--off);
  }
  body[data-state="online"] .pc-icon .dot { background: var(--ok); }
  .hero h1 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
  .hero-meta { margin-top: 4px; color: var(--muted); font-size: 14px; }
  .hero .spacer { flex: 1; }
  .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

  .pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 500;
    background: var(--off-soft); color: var(--off);
  }
  .pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .pill.ok { background: var(--ok-soft); color: var(--ok); }
  .pill.fail { background: var(--danger-soft); color: var(--danger); }
  .pill.wait { background: var(--warn-soft); color: var(--warn); }

  .notice {
    display: flex; gap: 12px; align-items: flex-start;
    margin: 0 24px 22px; padding: 12px 14px;
    background: var(--surface-2); border-radius: var(--radius);
    font-size: 14px; color: var(--muted);
  }
  .notice svg { flex: none; margin-top: 2px; color: var(--off); }
  .notice b { color: var(--text); font-weight: 500; }
  body[data-state="online"] .notice { display: none; }

  /* ---------- Buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 8px 16px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
    transition: background-color .12s, border-color .12s;
  }
  .btn:hover:not(:disabled) { background: var(--surface-2); }
  .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .btn.primary:hover:not(:disabled) { filter: brightness(1.07); background: var(--accent); }
  .btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
  .btn.danger:hover:not(:disabled) { background: var(--danger-soft); }
  .btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
  .btn:disabled { opacity: .45; cursor: not-allowed; }
  .btn svg { flex: none; }

  /* ---------- Command groups ---------- */
  .group + .group { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
  .group-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
  .group-title h3 { margin: 0; font-size: 14px; font-weight: 600; }
  .group-title span { font-size: 13px; color: var(--muted); }
  .cmds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .cmd {
    display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
    padding: 14px; min-height: 92px; text-align: left;
    background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius);
    cursor: pointer; transition: border-color .12s, background-color .12s;
  }
  .cmd:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
  .cmd .ic {
    width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
    background: var(--surface); color: var(--accent);
  }
  .cmd b { font-size: 14px; font-weight: 500; display: block; }
  .cmd small { font-size: 12px; color: var(--muted); display: block; margin-top: 1px; line-height: 1.35; }
  .cmd.warn .ic { color: var(--warn); }
  .cmd.warn:hover:not(:disabled) { border-color: var(--warn); background: var(--warn-soft); }
  .cmd.risk .ic { color: var(--danger); }
  .cmd.risk:hover:not(:disabled) { border-color: var(--danger); background: var(--danger-soft); }
  .cmd:disabled { cursor: not-allowed; opacity: .5; }
  .cmd.plain { background: transparent; border: 1px dashed var(--line); }

  /* ---------- Spec list ---------- */
  .specs { margin: 0; display: grid; gap: 0; }
  .spec { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
  .spec:last-child { border-bottom: 0; }
  .spec dt { color: var(--muted); }
  .spec dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
  .spec dd.empty { color: var(--off); font-weight: 400; }
  .subhead { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 4px; }
  .subhead:first-child { margin-top: 0; }
  .meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
  .meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; width: 0; }
  .res { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
  .res:last-child { border-bottom: 0; }
  .res-row { display: flex; justify-content: space-between; gap: 12px; }
  .res-row span:first-child { color: var(--muted); }
  .res-row span:last-child { font-weight: 500; }

  /* ---------- History ---------- */
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
  th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
  td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
  tr:last-child td { border-bottom: 0; }
  th:first-child, td:first-child { padding-left: 0; }
  th:last-child, td:last-child { padding-right: 0; text-align: right; }
  .muted { color: var(--muted); }
  .err { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); max-width: 46ch; }
  .err code { font-family: inherit; color: var(--danger); }
  .link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 500; }

  /* ---------- Danger zone ---------- */
  .danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
  .danger-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 20px; }
  .danger-row h2 { margin: 0; font-size: 15px; font-weight: 600; }
  .danger-row p { margin: 2px 0 0; color: var(--muted); font-size: 13px; max-width: 60ch; }

  /* ---------- Dialog ---------- */
  dialog {
    border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0;
    background: var(--surface); color: var(--text); width: min(440px, calc(100% - 32px));
  }
  dialog::backdrop { background: rgba(10, 14, 20, .55); }
  .dlg { padding: 22px; }
  .dlg h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
  .dlg p { margin: 0; color: var(--muted); font-size: 14px; }
  .dlg label { display: block; margin-top: 16px; font-size: 13px; font-weight: 500; }
  .dlg input, .dlg textarea {
    width: 100%; margin-top: 6px; padding: 9px 12px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit;
  }
  .dlg textarea { min-height: 80px; resize: vertical; }
  .dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

  /* ---------- Toast ---------- */
  .toast {
    position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius);
    font-size: 14px; transition: opacity .18s, transform .18s; z-index: 50;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Tambahan aplikasi ---------- */
[hidden] { display: none !important; }
.crumbs[hidden] { display: none !important; }
.pcid { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.small { font-size: 13px; }
a.btn { text-decoration: none; }
.err-text { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 10px 0 0; }

/* Login: lihat bagian Login (desain login.html) */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.field input, .field select, .vbar select, .keys input[type=text] {
  width: 100%; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px;
}
.download { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 20px; }
.download h2 { margin: 0; font-size: 15px; font-weight: 600; }
.download p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.download .acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* Daftar PC */
.list-head { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 0 12px; }
.list-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.list-head p { margin: 0; color: var(--muted); font-size: 13px; }
.pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.pc-card {
  display: flex; gap: 14px; align-items: center; text-align: left; width: 100%;
  padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  cursor: pointer; transition: border-color .12s;
}
.pc-card:hover { border-color: var(--accent); }
.pc-card .pc-icon { width: 44px; height: 44px; }
.pc-card.on .pc-icon .dot, body[data-state="online"] .hero .pc-icon .dot { background: var(--ok); }
.pc-card .main { min-width: 0; flex: 1; }
.pc-card .name { font-weight: 600; font-size: 16px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pc-card .host { font-weight: 400; color: var(--muted); font-size: 13px; }
.pc-card .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-state { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* Hasil perintah */
.result img { display: block; max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.result pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 13px; max-height: 420px; overflow: auto; background: var(--surface-2); padding: 12px; border-radius: var(--radius); }
.result table { min-width: 0; }
.result td, .result th { padding: 9px 8px; }
.result .act { text-align: right; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check input { width: auto !important; margin: 0 !important; }

/* Isi grid boleh menyempit (tabel riwayat menggulir sendiri, halaman tidak melebar di HP) */
.grid > *, .stack > *, .panel-body { min-width: 0; }
@media (max-width: 560px) {
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }
}

/* Audio, clipboard, file */
dialog.dlg-file { width: min(720px, calc(100% - 24px)); }
.fhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.fhead h3 { margin: 0; }
.fsec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.fsec h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.frow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.frow input[type=file] { flex: 1 1 220px; font: inherit; font-size: 13px; color: var(--text); }
.fpath { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; flex: 1; }
.flist { margin-top: 8px; max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.flist table { min-width: 0; font-size: 13px; }
.flist td { padding: 8px 10px; }
.flist tr.dir td:first-child { cursor: pointer; color: var(--accent); }
.flist td:first-child { overflow-wrap: anywhere; padding-left: 10px !important; }
.flist td:last-child { padding-right: 10px !important; white-space: nowrap; }

/* ---------- Viewer (desain pc-layar.html): tampilan penuh bergaya aplikasi ---------- */
body[data-view="v-view"] .topbar { display: none; }
body[data-view="v-view"] main { max-width: none; padding: 0; }
body[data-view="v-view"] { overflow: hidden; }
#v-view {
  --stage: #0e1116;
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; height: 100dvh;
  background: var(--bg); color: var(--text); font-size: 14px;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
#v-view[hidden] { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #v-view { --stage: #0b0d11; } }
#v-view button, #v-view input, #v-view select { font: inherit; color: inherit; }

#v-view .vbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; min-height: 0; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
#v-view .vbtn:hover:not(:disabled) { background: var(--surface-2); }
#v-view .vbtn.icon { width: 36px; padding: 0; }
#v-view .vbtn.ghost { border-color: transparent; background: transparent; }
#v-view .vbtn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
#v-view .vbtn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.07); }
#v-view .vbtn.end { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
#v-view .vbtn.end:hover { background: var(--danger-soft); }
#v-view .vbtn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
#v-view .vbtn:disabled { opacity: .4; cursor: not-allowed; }
#v-view .vbtn svg { flex: none; }

#v-view .vseg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--radius); }
#v-view .vseg button {
  height: 30px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
#v-view .vseg button:hover { color: var(--text); }
#v-view .vseg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

#v-view .switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; white-space: nowrap; position: relative; }
#v-view .switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#v-view .switch .track { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; flex: none; transition: background-color .15s; }
#v-view .switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
#v-view .switch input:checked + .track { background: var(--accent); }
#v-view .switch input:checked + .track::after { transform: translateX(16px); }
#v-view .switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
#v-view .label { font-size: 12px; color: var(--muted); margin-right: 6px; white-space: nowrap; }

/* header */
#v-view .vhead { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
#v-view .vhead-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
#v-view .vhead-title h1 { margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
#v-view .vhead-title .host { color: var(--muted); font-weight: 400; }
#v-view .live { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 500; white-space: nowrap; }
#v-view .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: nsr-pulse 2s infinite; }
#v-view .live.off { background: var(--off-soft); color: var(--off); }
#v-view .live.off::before { animation: none; }
@keyframes nsr-pulse { 50% { opacity: .35; } }
#v-view .stats { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#v-view .spacer { flex: 1; }
#v-view .control-switch { padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); }
#v-view .control-switch .state { font-size: 13px; }
body[data-control="on"] #v-view .control-switch { border-color: var(--accent); background: var(--accent-soft); }

/* toolbar */
#v-view .vtoolbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
#v-view .vtoolbar::-webkit-scrollbar { display: none; }
#v-view .tgroup { display: flex; align-items: center; gap: 4px; flex: none; }
#v-view .divider { width: 1px; height: 24px; background: var(--line); flex: none; margin: 0 4px; }
#v-view .vtoolbar .spacer { min-width: 8px; }
#v-view .vselect { position: relative; display: inline-flex; align-items: center; flex: none; }
#v-view .vselect select {
  appearance: none; height: 36px; padding: 0 34px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); min-width: 220px; max-width: 300px; font-weight: 500; cursor: pointer; text-overflow: ellipsis;
}
#v-view .vselect .lead, #v-view .vselect .chev { position: absolute; pointer-events: none; color: var(--muted); }
#v-view .vselect .lead { left: 11px; }
#v-view .vselect .chev { right: 11px; }

/* stage */
#v-view .vstage { flex: 1; min-height: 0; position: relative; background: var(--stage); display: grid; place-items: center; padding: 12px; overflow: hidden; }
#v-view .vstage canvas { display: block; outline: none; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
body[data-control="on"] #v-view .vstage canvas { touch-action: none; }
#v-view .vstage .msg {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 90%;
  background: rgba(15,18,25,.85); color: #e5e8ee; padding: 10px 16px; border-radius: var(--radius); font-size: 14px; text-align: center;
}
#v-view .vstage .msg:empty { display: none; }
#v-view .mode-hint, #v-view .flash {
  position: absolute; left: 50%; top: 20px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: rgba(15,18,25,.82); color: #e5e8ee; padding: 7px 14px; border-radius: 999px;
  font-size: 13px; display: flex; align-items: center; gap: 8px; pointer-events: none; backdrop-filter: blur(6px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body[data-control="on"] #v-view .mode-hint { display: none; }
#v-view .flash { top: auto; bottom: 20px; opacity: 0; transition: opacity .2s; }
#v-view .flash.show { opacity: 1; }
#v-view .stage-tools { position: absolute; right: 18px; bottom: 18px; display: flex; gap: 6px; }
#v-view .stage-tools .vbtn { background: rgba(15,18,25,.78); border-color: rgba(255,255,255,.12); color: #e5e8ee; backdrop-filter: blur(6px); }
#v-view .stage-tools .vbtn:hover { background: rgba(30,35,45,.9); }
#v-view .vstage:fullscreen, #v-view .vstage.pseudo-full { padding: 0; }
#v-view .vstage.pseudo-full { position: fixed; inset: 0; z-index: 100; }

/* input bar */
#v-view .vinput { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px; display: grid; gap: 8px; }
#v-view .row { display: flex; align-items: center; gap: 8px; }
#v-view .typer { flex: 1; display: flex; gap: 8px; min-width: 0; }
#v-view .typer input { flex: 1; min-width: 0; width: auto; height: 38px; margin: 0; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
#v-view .typer input::placeholder { color: var(--muted); }
#v-view .keys { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; margin: 0; }
#v-view .keys::-webkit-scrollbar { display: none; }
#v-view .key {
  height: 38px; min-width: 42px; padding: 0 10px; border-radius: 8px; flex: none; border: 1px solid var(--line); border-bottom-width: 2px;
  background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
#v-view .key:hover:not(:disabled) { background: var(--surface-2); }
#v-view .key:active:not(:disabled) { transform: translateY(1px); border-bottom-width: 1px; }
#v-view .key:disabled { opacity: .4; cursor: not-allowed; }
#v-view .keys .sep { width: 1px; background: var(--line); margin: 6px 2px; flex: none; }
#v-view .foot { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 12px; }
#v-view .foot .switch { font-size: 13px; color: var(--text); font-weight: 400; }
#v-view .foot .switch .track { width: 32px; height: 18px; }
#v-view .foot .switch .track::after { width: 12px; height: 12px; }
#v-view .foot .switch input:checked + .track::after { transform: translateX(14px); }
#v-view .privacy { display: flex; align-items: center; gap: 6px; }
#v-view .privacy::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); flex: none; }
body[data-control="off"] #v-view .needs-control { opacity: .4; pointer-events: none; }

/* popover clipboard */
#v-view .popover { position: fixed; z-index: 40; min-width: 260px; max-width: calc(100vw - 16px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 12px 32px rgba(0,0,0,.25); display: none; }
#v-view .popover.open { display: block; }
#v-view .popover .item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 8px; text-align: left; cursor: pointer; min-height: 0; }
#v-view .popover .item:hover { background: var(--surface-2); }
#v-view .popover .item small { display: block; color: var(--muted); font-size: 12px; }
#v-view .popover .item svg { margin-top: 2px; color: var(--muted); flex: none; }
#v-view .popover hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
#v-view .popover .switch { padding: 9px 10px; width: 100%; justify-content: space-between; font-weight: 400; white-space: normal; }
#v-view #v-clip { width: 100%; margin-top: 6px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 12px/1.4 ui-monospace, monospace; }

#v-view .only-wide { display: inline; }
@media (max-width: 900px) {
  #v-view .stats, #v-view .only-wide { display: none; }
  #v-view .row.main { flex-wrap: wrap; }
  #v-view .typer { flex-basis: 100%; }
  #v-view .keys { flex: 1; min-width: 0; }
  #v-view .vselect select { min-width: 170px; }
}
@media (max-width: 560px) {
  #v-view .vhead, #v-view .vtoolbar, #v-view .vinput { padding-left: 12px; padding-right: 12px; }
  #v-view .vhead-title .host { display: none; }
  #v-view .control-switch .state { display: none; }
  #v-view .vstage { padding: 6px; }
  #v-view .foot .privacy span { display: none; }
}
/* bilah input: isi grid boleh menyempit (deretan tombol menggulir sendiri, tombol Kirim tetap terlihat) */
#v-view .vinput { grid-template-columns: minmax(0, 1fr); }
#v-view .vinput > *, #v-view .row.main > * { min-width: 0; }
@media (max-width: 560px) {
  #v-view .mode-hint { white-space: normal; border-radius: 12px; text-align: center; width: max-content; }
}

/* ---------- Login (desain login.html) ---------- */
body[data-view="v-login"] .topbar { display: none; }
body[data-view="v-login"] main { max-width: none; padding: 0; }
#v-login {
  --radius-lg: 16px;
  min-height: 100dvh; display: grid; place-items: center; position: relative; isolation: isolate; overflow-x: hidden;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
#v-login[hidden] { display: none !important; }
#v-login button, #v-login input { font: inherit; color: inherit; }
#v-login::before { position: fixed; }
/* Faint dot grid that drifts slowly behind everything */
  #v-login::before {
    content: ""; position: fixed; inset: -40px; z-index: -1; pointer-events: none;
    background-image: radial-gradient(color-mix(in srgb, var(--muted) 22%, transparent) 1px, transparent 1.2px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
    animation: nsr-drift 40s linear infinite;
  }
  @keyframes nsr-drift { to { transform: translate(28px, 28px); } }

  #v-login .wrap { width: 100%; max-width: 400px; }

  /* ---------- Hero animation: phone → PC ---------- */
  #v-login .scene { display: flex; justify-content: center; margin-bottom: 8px; }
  #v-login .scene svg { width: 260px; height: auto; overflow: visible; }
  #v-login .scene .dev { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
  #v-login .scene .scr { fill: var(--surface-2); }
  #v-login .scene .stand { stroke: var(--line); stroke-width: 1.5; stroke-linecap: round; fill: none; }
  #v-login .scene .path { stroke: color-mix(in srgb, var(--accent) 30%, var(--line)); stroke-width: 1.5; stroke-dasharray: 3 5; fill: none; }
  #v-login .scene .packet { fill: var(--accent); }
  #v-login .scene .glow { fill: var(--accent); opacity: 0; }
  #v-login .scene .mirror { fill: var(--accent); opacity: .0; }
  #v-login .scene .cursor { fill: var(--text); }

  #v-login .packet { offset-path: path("M78 70 C 120 30, 160 30, 196 62"); offset-distance: 0%; animation: travel 2.4s cubic-bezier(.5,0,.3,1) infinite; }
  #v-login .packet.p2 { animation-delay: .8s; }
  #v-login .packet.p3 { animation-delay: 1.6s; }
  @keyframes travel {
    0% { offset-distance: 0%; opacity: 0; }
    12% { opacity: 1; }
    85% { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
  }
  #v-login .pc-glow { animation: pcpulse 2.4s ease-in-out infinite; animation-delay: 2s; }
  @keyframes pcpulse { 0%, 100% { opacity: 0; } 20% { opacity: .18; } }
  #v-login .tap { transform-origin: 54px 82px; animation: tap 2.4s ease-out infinite; }
  @keyframes tap { 0% { r: 2; opacity: .7; } 40% { r: 9; opacity: 0; } 100% { r: 9; opacity: 0; } }
  #v-login .rcursor { animation: cur 4.8s ease-in-out infinite; }
  @keyframes cur {
    0%, 100% { transform: translate(0, 0); }
    30% { transform: translate(14px, 8px); }
    60% { transform: translate(-6px, 14px); }
  }

  /* ---------- Card ---------- */
  #v-login .card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 28px; position: relative;
  }
  #v-login .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
  #v-login .brand-mark {
    width: 24px; height: 24px; border-radius: 7px; background: var(--accent);
    display: grid; place-items: center; color: var(--accent-ink);
  }
  #v-login h1 { margin: 18px 0 4px; font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
  #v-login .lede { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

  #v-login .field { margin-bottom: 16px; }
  #v-login .field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
  #v-login .input {
    position: relative; display: flex; align-items: center;
    border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
  }
  #v-login .input:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
  #v-login .input svg.lead { position: absolute; left: 12px; color: var(--muted); pointer-events: none; transition: color .15s; }
  #v-login .input:focus-within svg.lead { color: var(--accent); }
  #v-login .input input {
    flex: 1; min-width: 0; height: 44px; padding: 0 12px 0 40px; border: 0; background: transparent; outline: none;
  }
  #v-login .input input::placeholder { color: var(--muted); opacity: .7; }
  #v-login .reveal {
    height: 36px; width: 36px; margin-right: 4px; border: 0; background: transparent; border-radius: 7px;
    color: var(--muted); cursor: pointer; display: grid; place-items: center;
  }
  #v-login .reveal:hover { color: var(--text); background: var(--surface-2); }
  #v-login .hint { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--warn); height: 0; overflow: hidden; opacity: 0; transition: height .15s, opacity .15s; }
  #v-login .hint.show { height: 18px; opacity: 1; }

  #v-login .row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 20px; font-size: 13px; }
  #v-login .check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); }
  #v-login .check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

  #v-login .submit {
    position: relative; width: 100%; height: 46px; border: 0; border-radius: var(--radius);
    background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer;
    overflow: hidden; transition: filter .15s, transform .1s;
  }
  #v-login .submit:hover:not(:disabled) { filter: brightness(1.07); }
  #v-login .submit:active:not(:disabled) { transform: scale(.99); }
  #v-login .submit .label, #v-login .submit .busy, #v-login .submit .done {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: transform .25s ease, opacity .25s ease;
  }
  #v-login .submit .busy, #v-login .submit .done { opacity: 0; transform: translateY(100%); }
  #v-login .submit[data-state="busy"] .label, #v-login .submit[data-state="done"] .label { opacity: 0; transform: translateY(-100%); }
  #v-login .submit[data-state="busy"] .busy { opacity: 1; transform: none; }
  #v-login .submit[data-state="done"] { background: var(--ok); }
  #v-login .submit[data-state="done"] .done { opacity: 1; transform: none; }
  #v-login .submit[data-state="done"] .busy { opacity: 0; transform: translateY(-100%); }
  #v-login .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: nsr-spin .7s linear infinite; }
  @keyframes nsr-spin { to { transform: rotate(360deg); } }
  #v-login .check-draw { stroke-dasharray: 24; stroke-dashoffset: 24; }
  #v-login .submit[data-state="done"] .check-draw { animation: draw .35s .1s ease-out forwards; }
  @keyframes draw { to { stroke-dashoffset: 0; } }

  #v-login .error {
    display: flex; gap: 10px; align-items: flex-start;
    background: var(--danger-soft); color: var(--danger); border-radius: var(--radius);
    font-size: 13px; padding: 0 12px; max-height: 0; opacity: 0; overflow: hidden; margin-bottom: 0;
    transition: max-height .25s, opacity .2s, padding .25s, margin .25s;
  }
  #v-login .error.show { max-height: 80px; opacity: 1; padding: 10px 12px; margin-bottom: 16px; }
  #v-login .error svg { flex: none; margin-top: 1px; }
  #v-login .shake { animation: nsr-shake .4s; }
  @keyframes nsr-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

  /* ---------- Download panel ---------- */
  #v-login .dl {
    margin-top: 14px; padding: 16px 18px; border-radius: var(--radius-lg);
    border: 1px dashed var(--line); display: flex; align-items: center; gap: 14px;
  }
  #v-login .dl-ic {
    width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--surface-2);
    display: grid; place-items: center; color: var(--accent);
  }
  #v-login .dl-text { flex: 1; min-width: 0; }
  #v-login .dl-text b { display: block; font-size: 14px; font-weight: 600; }
  #v-login .dl-text span { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
  #v-login .dl-actions { display: flex; gap: 6px; flex: none; }
  #v-login .btn {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
    border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
    font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap;
  }
  #v-login .btn:hover { background: var(--surface-2); }
  #v-login .btn.primary { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
  #v-login .btn.primary:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
  @media (max-width: 420px) {
    #v-login .card { padding: 22px; }
    #v-login .dl { flex-wrap: wrap; }
    #v-login .dl-actions { width: 100%; }
    #v-login .dl-actions .btn { flex: 1; justify-content: center; }
    #v-login .scene svg { width: 220px; }
  }

  #v-login .foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted); }

  /* ---------- Entrance: one orchestrated sequence ---------- */
  #v-login .in { opacity: 0; transform: translateY(10px); animation: rise .6s cubic-bezier(.2,.7,.2,1) forwards; }
  #v-login .in.d1 { animation-delay: .05s; } #v-login .in.d2 { animation-delay: .18s; } #v-login .in.d3 { animation-delay: .32s; } #v-login .in.d4 { animation-delay: .46s; }
  @keyframes rise { to { opacity: 1; transform: none; } }

  /* Success exit */
  #v-login.leaving .wrap { animation: leave .5s .5s ease-in forwards; }
  @keyframes leave { to { opacity: 0; transform: scale(.97); } }

  @media (prefers-reduced-motion: reduce) {
    #v-login *, #v-login *::before, #v-login *::after { animation: none !important; transition: none !important; }
    #v-login .in { opacity: 1; transform: none; }
    #v-login .packet { offset-distance: 50%; }
  }

/* aturan global lama (.field grid, .check !important) tidak berlaku di login */
#v-login .field { display: block; }
#v-login .check { display: inline-flex !important; font-weight: 400 !important; }
#v-login .check input { width: 16px !important; height: 16px; }

/* ---------- Multi grup ---------- */
.list-tools { display: flex; align-items: center; gap: 12px; }
.list-tools select, .grup-pindah select { padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag.off { background: var(--off-soft); color: var(--off); }
.grup-baru { padding: 18px 20px; margin-bottom: 18px; }
.grup-baru h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.grup-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 10px; }
.grup-form .wide { grid-column: 1 / -1; }
.grup-form .field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.grup-acts { display: flex; align-items: center; gap: 12px; }
.grup-card { padding: 16px 20px; margin-bottom: 12px; }
.grup-card .gk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.grup-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.grup-card .gk-dom { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.grup-card .gk-acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.grup-card .gk-akun { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.grup-card table { min-width: 0; font-size: 13px; }
.grup-card td { padding: 8px 6px; }
.grup-card td:last-child { text-align: right; white-space: nowrap; }
.grup-pindah { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .grup-form { grid-template-columns: 1fr; } }
