/* NigiPassManager - the web app */
:root {
  --bg: #0f0d24; --bg2: #16133a; --card: #1c1846; --card2: #241f57; --line: #2f2a6b; --fg: #f5f3ff; --fg2: #a9a3d9; --fg3: #7d77b3;
  --ac: #8b5cf6; --ac2: #ec4899; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(1200px 700px at 85% -20%, #3b0764 0, transparent 60%), var(--bg); color: var(--fg); font: 15px/1.5 "Segoe UI", Rubik, system-ui, sans-serif; }
#app { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: #c4b5fd; }
.boot { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--fg2); }
.boot img { width: 72px; height: 72px; border-radius: 18px; }
.ltr { direction: ltr; unicode-bidi: plaintext; }
.mono { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; }
.muted { color: var(--fg2); } .small { font-size: 13px; } .grow { flex: 1; } .hide { display: none !important; }
.err { color: #fca5a5; min-height: 1.2em; } .okc { color: #86efac; }

/* buttons + fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card2); border-radius: 11px; padding: 8px 14px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--fg); }
.btn:hover { border-color: #5b52b8; }
.btn.p { background: linear-gradient(135deg, var(--ac), var(--ac2)); border: 0; font-weight: 700; }
.btn.d { background: #3f1d2e; border-color: #6b2440; color: #fecdd3; }
.btn.w { width: 100%; }
.btn.s { padding: 5px 10px; font-size: 13px; border-radius: 9px; }
.ib { border: 0; background: transparent; color: var(--fg2); cursor: pointer; border-radius: 8px; padding: 5px 7px; font-size: 15px; line-height: 1; }
.ib:hover { background: var(--card2); color: var(--fg); }
input, select, textarea { width: 100%; background: #0c0a20; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ac); box-shadow: 0 0 0 3px rgba(139,92,246,.2); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--fg2); margin: 12px 0 4px; }
.chk { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; font-size: 14px; cursor: pointer; }
.chk input { width: auto; margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inrow { display: flex; gap: 6px; align-items: center; } .inrow input { flex: 1; min-width: 0; }

/* sign in */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 430px; background: rgba(28,24,70,.9); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.auth .logo { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.auth .logo img { width: 52px; height: 52px; border-radius: 14px; }
.auth h1 { margin: 0; font-size: 24px; } .auth h2 { margin: 6px 0 4px; font-size: 18px; }
.auth .links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 14px; }
.auth .links a { cursor: pointer; }
.lang { position: fixed; top: 12px; inset-inline-end: 12px; }
.code { font-size: 22px; letter-spacing: 2px; text-align: center; background: #0c0a20; border: 1px dashed var(--ac); border-radius: 12px; padding: 14px; margin: 12px 0; user-select: all; }
.warnbox { background: #3a2a0a; border: 1px solid #7c5a14; color: #fde68a; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }

/* strength meter */
.meter { height: 6px; border-radius: 4px; background: #2a2560; margin-top: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; transition: width .2s; }
.s0 { background: var(--bad); } .s1 { background: #f97316; } .s2 { background: var(--warn); } .s3 { background: #84cc16; } .s4 { background: var(--ok); }

/* the app */
.shell { height: 100%; display: grid; grid-template-columns: 240px 360px 1fr; grid-template-rows: 56px 1fr; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: rgba(22,19,58,.85); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.top .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; width: 218px; }
.top .brand img { width: 30px; height: 30px; border-radius: 8px; }
.top .search { max-width: 460px; }
.nav { overflow: auto; padding: 10px 8px 30px; border-inline-end: 1px solid var(--line); }
.nav .h { font-size: 12px; color: var(--fg3); margin: 14px 10px 4px; display: flex; align-items: center; justify-content: space-between; text-transform: uppercase; letter-spacing: .5px; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 10px; cursor: pointer; color: var(--fg); text-decoration: none; font-size: 14px; }
.nav a:hover { background: var(--card); }
.nav a.on { background: linear-gradient(90deg, rgba(139,92,246,.35), rgba(139,92,246,.08)); }
.nav a .n { margin-inline-start: auto; color: var(--fg3); font-size: 12px; }
.list { overflow: auto; border-inline-end: 1px solid var(--line); }
.list .lh { position: sticky; top: 0; background: rgba(15,13,36,.95); padding: 10px 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); z-index: 1; }
.list .lh b { flex: 1; }
.it { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid rgba(47,42,107,.5); }
.it:hover { background: var(--card); } .it.on { background: var(--card2); }
.av { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; background: #251f5c; font-size: 16px; }
.it .t { flex: 1; min-width: 0; } .it .t b, .it .t small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .it .t small { color: var(--fg2); font-size: 12.5px; }
.it .tag { font-size: 11px; background: #2b2466; color: #c4b5fd; border-radius: 999px; padding: 1px 8px; }
.empty { padding: 40px 20px; text-align: center; color: var(--fg2); }
.detail { overflow: auto; padding: 22px 26px 60px; }
.detail h2 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.detail .sub { color: var(--fg2); font-size: 13px; margin: 4px 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 14px; margin: 12px 0; }
.card h3 { margin: 12px 0 6px; font-size: 15px; }
.f { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid rgba(47,42,107,.55); }
.f:last-child { border-bottom: 0; }
.f .k { width: 120px; flex: none; color: var(--fg2); font-size: 13px; }
.f .v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.f .v.pw { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
.totp { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: 2px; color: #c4b5fd; }
.ring { width: 22px; height: 22px; }
.pane { max-width: 820px; }
.pane h2 { margin: 0 0 6px; }
.gen { font-family: ui-monospace, Consolas, monospace; font-size: 22px; padding: 16px; background: #0c0a20; border: 1px solid var(--line); border-radius: 14px; overflow-wrap: anywhere; direction: ltr; text-align: center; margin: 12px 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: start; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--fg2); font-weight: 600; font-size: 12.5px; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; background: #2b2466; }
.pill.bad { background: #4c1d24; color: #fecaca; } .pill.warn { background: #422f0a; color: #fde68a; } .pill.ok { background: #14361f; color: #bbf7d0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.stat b { display: block; font-size: 26px; }
.qr { background: #fff; border-radius: 12px; padding: 8px; width: 190px; height: 190px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #312e81; color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 92vw; }
.toast.bad { background: #7f1d1d; }
.modal { position: fixed; inset: 0; background: rgba(5,4,15,.7); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal .box { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: 100%; max-width: 460px; max-height: 92vh; overflow: auto; }
.modal h3 { margin: 0 0 8px; }
.menu-btn { display: none; }
.back { display: none; }
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center; color: var(--fg2); cursor: pointer; }
.dropzone.over { border-color: var(--ac); color: var(--fg); }
.install .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.install ol { padding-inline-start: 20px; margin: 6px 0; } .install li { margin: 4px 0; }
code { direction: ltr; unicode-bidi: embed; background: #0c0a20; border-radius: 6px; padding: 1px 6px; font-size: 13px; }

/* phones: one column at a time */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 56px 1fr; }
  .top .brand { width: auto; } .top .brand span { display: none; }
  .menu-btn { display: inline-flex; }
  .nav { position: fixed; top: 56px; bottom: 0; inset-inline-start: 0; width: 270px; background: var(--bg2); z-index: 20; transform: translateX(var(--off, 100%)); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  html[dir=ltr] .nav { --off: -100%; }
  .nav.open { transform: none; }
  .list, .detail { grid-column: 1; grid-row: 2; }
  .shell.sel .list { display: none; } .shell:not(.sel) .detail { display: none; }
  .back { display: inline-flex; margin-bottom: 10px; }
  .detail { padding: 16px 14px 60px; }
  .f .k { width: 92px; }
}
