/* Brankas — tema "papan kunci": setiap akun adalah tombol seperti tuts keyboard. */
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dmsans.woff") format("woff");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --desk: #e9edf3;
  --desk-dot: #d3dae5;
  --cap: #ffffff;
  --cap-line: #dce2eb;
  --cap-edge: #c9d1dd;
  --ink: #141924;
  --ink-2: #333b4c;
  --muted: #667085;
  --dim: #98a2b3;
  --field: #f3f5f9;
  --cobalt: #2448f5;
  --cobalt-2: #1a37d1;
  --danger: #d92d4a;
  --ok: #0f9f6e;
  --amber: #b25e09;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--desk);
  background-image: radial-gradient(var(--desk-dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 400 15px/1.55 "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 25px; line-height: 1.15; font-weight: 750; letter-spacing: -.025em; margin: 0; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -.015em; margin: 0 0 14px; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.center { text-align: center; }
.pad { padding: 40px 0; }
.error { color: var(--danger); font-size: 14px; margin: 4px 0 0; }
.error:empty, .hint:empty { display: none; }
.note { color: var(--amber); background: #fff6e5; border: 1px solid #f6d9a8; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin: 14px 0 0; }
::selection { background: rgba(36, 72, 245, .2); }
:focus-visible { outline: 3px solid rgba(36, 72, 245, .45); outline-offset: 2px; }

/* ---------- Logo tombol ---------- */
.logo-key {
  width: 56px; height: 56px; border-radius: 15px; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: #fff;
  box-shadow: 0 5px 0 #000, 0 12px 20px -10px rgba(0, 0, 0, .5);
  font-weight: 800; font-size: 26px; letter-spacing: -.03em;
}
.logo-key span { transform: translateY(-1px); }
.logo-key.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; box-shadow: 0 3px 0 #000; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap;
  border-radius: 12px; padding: 10px 16px; border: 1px solid transparent; color: var(--ink);
  text-decoration: none; transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--cobalt); color: #fff; box-shadow: 0 3px 0 var(--cobalt-2); }
.btn-primary:hover:not(:disabled) { background: #3156ff; }
.btn-primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--cobalt-2); }
.btn-ink { background: var(--ink); color: #fff; box-shadow: 0 3px 0 #000; }
.btn-soft { background: var(--cap); border-color: var(--cap-line); box-shadow: 0 2px 0 var(--cap-edge); }
.btn-soft:hover:not(:disabled) { background: #f8fafc; }
.btn-soft:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.btn-soft[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: 0 2px 0 #000; }
.btn-danger { background: #fdecef; color: var(--danger); border-color: #f7c5ce; }
.btn-icon { width: 40px; height: 40px; padding: 0; background: var(--cap); border-color: var(--cap-line); box-shadow: 0 2px 0 var(--cap-edge); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; padding: 13px; font-size: 15px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Form ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
label small, .lbl small { font-weight: 400; }
.lbl { font-size: 14px; font-weight: 600; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 400; cursor: pointer; }
label.inline { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 400; }
input, textarea, select {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--cap-line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(36, 72, 245, .14); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--cobalt); }
input[type=range] { padding: 0; accent-color: var(--cobalt); border: 0; }
textarea { resize: vertical; }
.mono-input, .code-input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.code-input { letter-spacing: .3em; font-size: 18px; text-align: center; }
.input-row { display: flex; gap: 6px; }
.input-row input { flex: 1; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; max-width: 400px; }
.warn { background: #fff6e5; border: 1px solid #f6d9a8; color: #7a4a05; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.warn strong { display: block; margin-bottom: 2px; }
.meter { height: 5px; background: var(--cap-line); border-radius: 3px; overflow: hidden; margin-top: -4px; }
.meter span { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }
.meter span.s1 { width: 25%; background: var(--danger); }
.meter span.s2 { width: 50%; background: #f2a900; }
.meter span.s3 { width: 75%; background: #23a55a; }
.meter span.s4 { width: 100%; background: var(--ok); }

/* ---------- Kartu umum ---------- */
.sheet { background: var(--cap); border: 1px solid var(--cap-line); border-radius: 22px; box-shadow: 0 6px 0 var(--cap-edge), 0 30px 50px -30px rgba(20, 30, 50, .35); }

/* ---------- Login & setup ---------- */
.center-view { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 18px; gap: 16px; }
.auth-card { width: 100%; max-width: 430px; padding: 30px; display: flex; flex-direction: column; gap: 14px; }
.auth-head { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.auth-head p { margin: 4px 0 0; font-size: 14px; }

/* ---------- Kerangka aplikasi ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .88); border-right: 1px solid var(--cap-line);
  padding: 22px 14px 16px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.side-brand { display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 18px; letter-spacing: -.02em; padding: 0 8px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font: inherit; font-size: 14px; font-weight: 550; color: var(--ink-2); text-align: left;
  background: none; border: 0; border-radius: 10px; padding: 8px 10px; cursor: pointer; text-decoration: none;
}
.nav-link:hover { background: #f1f4f8; }
.nav-link.active { background: #eaeefe; color: var(--cobalt); }
.nav-link .count { margin-left: auto; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.nav-link .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.nav-sep { font-size: 12px; color: var(--dim); padding: 14px 10px 4px; }
.nav-add {
  display: flex; align-items: center; gap: 8px; margin: 6px 0 0;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--cobalt);
  background: none; border: 1px dashed #b8c5f9; border-radius: 10px; padding: 8px 10px; cursor: pointer;
}
.nav-add:hover { background: #f1f4ff; }
.nav-add svg { width: 15px; height: 15px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--cap-line); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding: 4px 10px 8px; }
.who-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(15, 159, 110, .15); }

.main { min-width: 0; padding: 26px 34px 80px; }
.mbar { display: none; }
.toolbar { display: flex; gap: 10px; align-items: center; }
.search { flex: 1; position: relative; max-width: 560px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search input { padding-left: 40px; height: 44px; box-shadow: 0 2px 0 var(--cap-edge); }
.toolbar .btn { height: 44px; }
.toolbar .btn-primary { margin-left: auto; }
.chips { display: none; }

.arrange-bar {
  display: flex; align-items: center; gap: 14px; margin: 18px 0 0;
  background: var(--ink); color: #dfe5f1; border-radius: 14px; padding: 12px 14px 12px 18px; font-size: 14px;
}
.arrange-bar p { margin: 0; flex: 1; }
.arrange-bar strong { color: #fff; }
.arrange-bar .btn-ink { background: #fff; color: var(--ink); box-shadow: 0 2px 0 #9aa5b8; }

/* ---------- Papan & grup ---------- */
.board { margin-top: 8px; }
.group { margin-top: 26px; scroll-margin-top: 20px; }
.group-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; min-height: 32px; }
.group-head h2 { margin: 0; font-size: 17px; }
.group-head .dot { width: 12px; height: 12px; border-radius: 4px; }
.group-head .count { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.group-tools { margin-left: auto; display: flex; gap: 6px; }
.group-tools .btn-icon { width: 34px; height: 34px; border-radius: 10px; }
.group-tools svg { width: 16px; height: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 20px 18px; }
.grid:empty::after {
  content: "Kosong — seret kotak ke sini"; grid-column: 1 / -1;
  display: grid; place-items: center; min-height: 96px; color: var(--dim); font-size: 14px;
  border: 2px dashed var(--cap-line); border-radius: 18px;
}
.board:not(.arranging) .grid:empty::after { content: "Belum ada akun di grup ini"; }

/* ---------- Tombol akun (keycap) ---------- */
.key {
  position: relative; aspect-ratio: 1 / 1.04;
  background: linear-gradient(180deg, #fff, #fbfcfe);
  border: 1px solid var(--cap-line); border-radius: 18px;
  box-shadow: 0 5px 0 var(--cap-edge), 0 14px 22px -14px rgba(20, 30, 50, .35);
  transition: transform .08s ease, box-shadow .08s ease;
  -webkit-user-select: none; user-select: none;
}
.key-main {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 16px 12px 12px; font: inherit; color: inherit; text-align: center;
  background: none; border: 0; border-radius: 18px; cursor: pointer;
}
.board:not(.arranging) .key:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--cap-edge), 0 6px 12px -8px rgba(20, 30, 50, .3); }
.key-name { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; margin-top: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-sub { font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-more {
  position: absolute; top: 7px; right: 7px; width: 30px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; color: var(--dim); background: none; border: 0; cursor: pointer;
}
.key-more:hover { background: #eef1f6; color: var(--ink); }
.key-more svg { width: 18px; height: 18px; }

/* Wajah: logo unggahan atau monogram berwarna */
.face { width: 64px; height: 64px; border-radius: 17px; flex: none; display: grid; place-items: center; overflow: hidden; }
.face img { width: 100%; height: 100%; object-fit: contain; }
.face.logo { background: #fff; }
.face.mono { color: #fff; font-weight: 800; font-size: 23px; letter-spacing: -.03em; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .25); }
.acc-1 { background: linear-gradient(160deg, #4d6bff, #2448f5); }
.acc-2 { background: linear-gradient(160deg, #22c493, #0b9a6d); }
.acc-3 { background: linear-gradient(160deg, #ffc23d, #f29d00); }
.acc-4 { background: linear-gradient(160deg, #f0679a, #d02f6a); }
.acc-5 { background: linear-gradient(160deg, #9277ff, #6440f0); }
.acc-6 { background: linear-gradient(160deg, #28c3d6, #0b93a8); }
.acc-7 { background: linear-gradient(160deg, #ff8a4c, #ee5d14); }
.acc-8 { background: linear-gradient(160deg, #56627a, #2f3a50); }
.dot.acc-1, .dot.acc-2, .dot.acc-3, .dot.acc-4, .dot.acc-5, .dot.acc-6, .dot.acc-7, .dot.acc-8 { box-shadow: none; }

/* Mode atur */
.board.arranging .key { cursor: grab; touch-action: none; animation: wobble .28s ease-in-out infinite alternate; }
.board.arranging .grid > .key:nth-child(2n) { animation-delay: -.14s; }
.board.arranging .key-main { cursor: grab; }
.board.arranging .key-more { display: none; }
.board.arranging .grid { min-height: 60px; }
@keyframes wobble { from { transform: rotate(-.7deg); } to { transform: rotate(.7deg); } }
.key.ghost {
  position: fixed; z-index: 100; pointer-events: none; margin: 0; animation: none !important;
  transform: rotate(3deg) scale(1.06); box-shadow: 0 10px 0 var(--cap-edge), 0 30px 40px -16px rgba(20, 30, 50, .5);
}
.key.src-hidden { display: none; }
.key.ghost .key-more { display: none; }
.key-ph { aspect-ratio: 1 / 1.04; border: 2px dashed #9fb0ff; background: rgba(36, 72, 245, .06); border-radius: 18px; }
.key.flash { animation: flash .6s ease; }
@keyframes flash { 0% { box-shadow: 0 5px 0 var(--cobalt), 0 0 0 6px rgba(36, 72, 245, .25); } 100% { box-shadow: 0 5px 0 var(--cap-edge), 0 14px 22px -14px rgba(20, 30, 50, .35); } }

/* ---------- Menu ⋯ ---------- */
.menu {
  position: fixed; z-index: 90; min-width: 220px; padding: 6px;
  background: #fff; border: 1px solid var(--cap-line); border-radius: 14px;
  box-shadow: 0 4px 0 var(--cap-edge), 0 24px 40px -18px rgba(20, 30, 50, .45);
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px;
  font: inherit; font-size: 14px; color: var(--ink); text-decoration: none; text-align: left;
  background: none; border: 0; cursor: pointer;
}
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: #f1f4f8; outline: none; }
.menu svg { width: 16px; height: 16px; color: var(--muted); }
.menu .sep { height: 1px; background: var(--cap-line); margin: 6px 4px; }
.menu .menu-label { font-size: 12px; color: var(--dim); padding: 4px 10px 2px; }
.menu .current { color: var(--cobalt); font-weight: 650; }

/* ---------- Dialog ---------- */
dialog {
  border: 1px solid var(--cap-line); border-radius: 22px; padding: 26px;
  background: #fff; color: var(--ink);
  box-shadow: 0 6px 0 var(--cap-edge), 0 40px 80px -30px rgba(10, 20, 40, .55);
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
}
dialog.wide { width: min(660px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(20, 26, 38, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.dlg-head h2 { margin: 0; }
.dlg-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.spacer { flex: 1; }
.set { border-top: 1px solid var(--cap-line); padding: 18px 0 8px; }
.set .muted { font-size: 14px; margin: 0 0 12px; }
.steps { margin: 14px 0; padding-left: 20px; font-size: 14px; }
.qr { display: flex; justify-content: center; margin: 10px 0; }
.qr svg { width: 220px; height: 220px; border-radius: 14px; border: 1px solid var(--cap-line); }
.secret { font-size: 13px; letter-spacing: .06em; word-break: break-all; background: var(--field); padding: 5px 10px; border-radius: 8px; }
dialog form.inline-form { flex-direction: row; gap: 8px; max-width: 340px; margin: 4px auto 0; }

/* Detail akun */
.detail { width: min(480px, calc(100vw - 24px)); }
.detail-head { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--cap-line); }
.detail-id { flex: 1; min-width: 0; }
.detail-id h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host { font-size: 13px; color: var(--muted); }
.detail-fields { display: flex; flex-direction: column; gap: 14px; padding: 18px 0 6px; }
.field-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field-label svg { width: 15px; height: 15px; }
.field-row { display: flex; align-items: stretch; gap: 8px; }
.val {
  flex: 1; min-width: 0; text-align: left; cursor: pointer;
  font: inherit; font-size: 15.5px; font-weight: 550; color: var(--ink-2);
  padding: 11px 14px; border-radius: 12px; border: 1px solid transparent; background: var(--field);
}
.val:hover { border-color: var(--cap-line); }
.val .txt { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; filter: blur(6px); opacity: .7; transition: filter .3s ease, opacity .3s ease; }
.val.revealed .txt { filter: none; opacity: 1; }
.val.pw .txt { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14.5px; }
.val.multi .txt { white-space: pre-wrap; word-break: break-word; max-height: 9em; overflow: auto; }
.copy {
  width: 46px; flex: none; border-radius: 12px; cursor: pointer; display: grid; place-items: center;
  color: var(--ink); background: #fff; border: 1px solid var(--cap-line); box-shadow: 0 2px 0 var(--cap-edge);
}
.copy:active { transform: translateY(2px); box-shadow: none; }
.copy.done { color: var(--ok); border-color: #a7e3cc; background: #ecfbf4; }

/* Editor: logo */
.logo-row { display: flex; align-items: center; gap: 14px; }
.logo-preview .face { width: 56px; height: 56px; border-radius: 15px; font-size: 20px; }
.logo-ctl { display: flex; flex-direction: column; gap: 6px; }

/* Generator */
.gen { background: var(--field); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.gen-out code { display: block; font-size: 15px; word-break: break-all; padding: 10px 12px; background: #fff; border: 1px solid var(--cap-line); border-radius: 10px; }
.gen-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.range { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.range output { width: 2ch; font-weight: 700; }
.row-right { display: flex; justify-content: flex-end; gap: 8px; }

/* Kosong */
.empty { text-align: center; padding: 44px 24px; margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty .key.demo { width: 120px; margin-bottom: 14px; }
.empty h2 { margin: 0; }
.empty p { max-width: 420px; margin: 0 0 12px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 120;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px;
  max-width: calc(100vw - 32px); box-shadow: 0 4px 0 #000, 0 18px 30px -12px rgba(0, 0, 0, .5);
}

/* ---------- HP & tablet ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 0 14px 70px; }
  .mbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
    margin: 0 -14px 14px; padding: 12px 14px; background: rgba(233, 237, 243, .92);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--cap-line);
  }
  .mbar .side-brand { padding: 0; margin-right: auto; font-size: 17px; }
  .toolbar { flex-wrap: wrap; }
  .search { flex-basis: 100%; max-width: none; }
  .toolbar .btn { flex: 1; }
  .toolbar .btn-primary { margin-left: 0; }
  .chips { display: flex; gap: 8px; overflow-x: auto; margin: 14px -14px 0; padding: 2px 14px 6px; scrollbar-width: none; }
  .chips .nav-link { width: auto; flex: none; background: #fff; border: 1px solid var(--cap-line); border-radius: 999px; padding: 6px 12px; box-shadow: 0 2px 0 var(--cap-edge); }
  .chips .nav-link .count { margin-left: 2px; }
  .arrange-bar { flex-direction: column; align-items: stretch; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px 12px; }
  .key, .key-main { border-radius: 15px; }
  .key-main { padding: 12px 6px 8px; }
  .face { width: 48px; height: 48px; border-radius: 13px; }
  .face.mono { font-size: 18px; }
  .key-name { font-size: 13px; margin-top: 7px; }
  .key-sub { display: none; }
  .key-more { top: 3px; right: 3px; }
  .two { grid-template-columns: 1fr; }
  .group { margin-top: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
