:root {
  color-scheme: dark;
  --gold: #fcad03;
  --gold-soft: rgba(252, 173, 3, .14);
  --gold-glow: rgba(252, 173, 3, .30);
  --teal: #00c8d4;
  --bg: #001217;
  --panel: rgba(0, 18, 24, .95);
  --panel2: rgba(0, 31, 38, .90);
  --line: rgba(252, 173, 3, .18);
  --line2: rgba(0, 200, 212, .20);
  --text: #dceef2;
  --muted: #7aa5af;
  --danger: #ff6565;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(0, 11, 14, .92), rgba(0, 38, 43, .58), rgba(0, 11, 14, .88)),
    url("/vault/assets/powervault-wallpaper.png") center/cover fixed,
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 200, 212, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 212, .04) 1px, transparent 1px);
  background-size: 46px 46px;
}
button, input, textarea, select { font: inherit; }
.shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0;
}
.appFrame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(0,18,24,.97), rgba(0,28,34,.93));
  box-shadow: 0 0 70px rgba(252,173,3,.08), 0 28px 90px rgba(0,0,0,.62);
  backdrop-filter: blur(18px);
  overflow: visible;
  isolation: isolate;
}
.appFrame::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(0,200,212,.08);
  border-radius: 8px;
}
.frameSticker {
  position: absolute;
  z-index: 80;
  pointer-events: none;
  opacity: 1;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,.45));
  object-fit: contain;
  object-position: right bottom;
}
.authSticker {
  width: clamp(196px, 54%, 250px);
  right: -3px;
  bottom: clamp(-45px, -4.7vw, -30px);
}
.vaultSticker {
  width: clamp(218px, 23vw, 282px);
  right: -3px;
  bottom: clamp(-51px, -4vw, -34px);
}
.companion {
  position: fixed;
  z-index: 45;
  width: 210px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(.98);
  transition: transform .22s ease, opacity .22s ease;
}
.companion.awake { opacity: 1; transform: translateY(0) scale(1); }
.companion img {
  display: block;
  width: 145px;
  margin-left: auto;
  filter: drop-shadow(0 18px 26px rgba(0,0,0,.54));
}
.companionBubble {
  margin-top: -14px;
  padding: 10px 12px;
  color: #fff8dc;
  background: rgba(0,18,24,.94);
  border: 1px solid rgba(252,173,3,.34);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0,0,0,.42);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .6px;
  text-transform: uppercase;
  text-align: center;
}
.auth {
  width: min(460px, 100%);
  margin: 7vh auto 0;
  padding: 28px;
}
.brand, .topbar, .actions, .passwordRow, .toolbar, .railHeader, .vaultBrand, .entryHeader, .detailActions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand {
  position: relative;
  z-index: 1;
  justify-content: center;
  text-align: center;
  margin-bottom: 24px;
}
.mark {
  display: grid;
  place-items: center;
  inline-size: 58px;
  block-size: 58px;
  min-inline-size: 58px;
  min-block-size: 58px;
  aspect-ratio: 1 / 1;
  flex: 0 0 58px;
  border-radius: 9999px;
  clip-path: circle(50%);
  overflow: hidden;
  background: #001217;
  border: 1px solid rgba(255,221,116,.68);
  box-shadow: 0 0 0 4px rgba(252,173,3,.14), 0 0 28px rgba(252,173,3,.42);
}
.mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.markSmall {
  inline-size: 46px;
  block-size: 46px;
  min-inline-size: 46px;
  min-block-size: 46px;
  flex-basis: 46px;
  box-shadow: 0 0 0 3px rgba(252,173,3,.12), 0 0 20px rgba(252,173,3,.30);
}
h1, h2, p { margin: 0; }
h1 {
  color: var(--gold);
  font-size: clamp(1.35rem, 2.6vw, 2.25rem);
  font-weight: 950;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 22px var(--gold-glow);
}
h2 {
  color: #fff8dc;
  font-size: 1rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
p {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}
.tabs {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 18px;
}
.tab {
  border: 0;
  padding: 11px;
  color: var(--muted);
  background: rgba(0,0,0,.25);
  cursor: pointer;
  font-size: .66rem;
  font-weight: 950;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.tab.active {
  color: var(--gold);
  background: var(--gold-soft);
  box-shadow: inset 0 -2px 0 var(--gold);
}
.panel, .modalPanel {
  position: relative;
  z-index: 3;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}
input, textarea, select {
  width: 100%;
  color: var(--text);
  background: rgba(0,0,0,.43);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 11px;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(252,173,3,.10);
}
button, .ghost {
  min-height: 38px;
  border: 0;
  border-radius: 4px;
  padding: 0 12px;
  background: var(--gold);
  color: #050300;
  font-size: .68rem;
  font-weight: 950;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:hover, .ghost:hover { filter: brightness(1.1); box-shadow: 0 0 20px var(--gold-glow); }
button:disabled { opacity: .45; cursor: default; box-shadow: none; filter: none; }
.ghost {
  background: rgba(0,200,212,.08);
  color: var(--teal);
  border: 1px solid var(--line2);
}
.danger { color: var(--danger); border-color: rgba(255,101,101,.25); }
.hidden { display: none !important; }
.status {
  position: relative;
  z-index: 3;
  min-height: 22px;
  margin-top: 10px;
  color: var(--teal);
  text-align: center;
}
.vault {
  min-height: calc(100vh - 48px);
  padding: 14px;
}
.topbar {
  position: relative;
  z-index: 3;
  justify-content: space-between;
  padding: 10px 12px 14px;
  border-bottom: 1px solid rgba(252,173,3,.14);
}
.toolbar {
  position: relative;
  z-index: 3;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,200,212,.12);
}
.railHeader button,
.entryHeader #newEntryButton {
  width: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  background: none;
  color: var(--gold);
  border-radius: 4px;
  opacity: .7;
}
.railHeader button:hover,
.entryHeader #newEntryButton:hover {
  background: rgba(252,173,3,.1);
  filter: none;
  box-shadow: none;
  opacity: 1;
}
.toolbar input {
  max-width: 320px;
  margin-left: auto;
}
.workspace {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  min-height: 560px;
}
.folderRail {
  padding: 12px 12px 12px 0;
  border-right: 1px solid rgba(0,200,212,.14);
}
.railHeader {
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 950;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}
.folders {
  display: grid;
  gap: 6px;
}
.folderItem {
  display: flex;
  align-items: center;
  gap: 4px;
}
.folderItem .folderChip {
  flex: 1;
  width: auto;
}
.folderChip {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  min-height: 34px;
  background: rgba(0,0,0,.20);
  color: var(--muted);
  border: 1px solid transparent;
  text-align: left;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}
.folderChip.active {
  color: var(--gold);
  background: rgba(252,173,3,.09);
  border-color: rgba(252,173,3,.32);
}
.entryTablePane {
  padding: 12px;
  overflow: auto;
  min-width: 0;
}
.entryHeader {
  justify-content: flex-start;
  margin-bottom: 10px;
}
.entryHeader h2 {
  min-width: 58px;
}
.entryTable {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.entryTable th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: rgba(0,18,24,.98);
  border-bottom: 1px solid var(--line2);
  padding: 9px 10px;
  text-align: left;
  font-size: .58rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.entryTable td {
  border-bottom: 1px solid rgba(0,200,212,.09);
  padding: 10px;
  color: #dceef2;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entryTable tr {
  cursor: pointer;
}
.entryTable tbody tr:hover {
  background: rgba(0,200,212,.06);
}
.entryTable tr.selected {
  background: rgba(252,173,3,.10);
  outline: 1px solid rgba(252,173,3,.28);
}
.entryTable td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}
.emptyTable {
  text-align: center;
  color: var(--muted) !important;
  padding: 32px !important;
}
.shortcutHint {
  margin-top: 10px;
  color: rgba(122,165,175,.86);
  font-size: .58rem;
}
.detailPane {
  padding: 14px;
  border-left: 1px solid rgba(0,200,212,.14);
  background: rgba(0,10,13,.20);
  min-width: 0;
}
.detailActions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.detailActions .ghost {
  min-height: 34px;
  padding: 0 10px;
}
.detailPane h2 {
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
.detailPane dl {
  margin: 0;
  display: grid;
  gap: 8px;
}
.detailPane dt {
  color: var(--muted);
  font-size: .56rem;
  font-weight: 950;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.detailPane dd {
  margin: -4px 0 8px;
  color: #fff8dc;
  overflow-wrap: anywhere;
}
.detailIcon .pvIcon {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
}
.pvIcon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(252,173,3,.18));
}
.pvIcon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.folderIconAll {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--gold);
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(8px);
}
.modalPanel {
  width: min(520px, 100%);
  box-shadow: 0 24px 80px rgba(0,0,0,.65);
}
.modalSmall { width: min(380px, 100%); }
.modalPanel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.passwordRow { align-items: stretch; }
.passwordRow input { min-width: 0; }
.iconButton {
  background: rgba(0,200,212,.10);
  color: var(--teal);
  border: 1px solid var(--line2);
}
.iconPicker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}
.iconChoice {
  min-height: 38px;
  width: 100%;
  padding: 0;
  background: rgba(0,0,0,.26);
  color: var(--muted);
  border: 1px solid rgba(0,200,212,.16);
}
.iconChoice.active {
  color: var(--gold);
  background: rgba(252,173,3,.13);
  border-color: rgba(252,173,3,.55);
  box-shadow: 0 0 18px rgba(252,173,3,.18);
}
.iconChoice .pvIcon {
  width: 20px;
  height: 20px;
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .detailPane {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid rgba(0,200,212,.14);
  }
  .vaultSticker { opacity: .20; }
  .detailActions { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 14px, 1320px); padding: 10px 0; }
  .auth { margin-top: 4vh; padding: 20px 14px; }
  /* Prevent iOS Safari auto-zoom on input focus */
  input, textarea, select { font-size: 16px !important; }
  .brand, .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .toolbar input {
    max-width: none;
    width: 100%;
    margin-left: 0;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .folderRail {
    border-right: 0;
    border-bottom: 1px solid rgba(0,200,212,.14);
    padding-right: 0;
  }
  .folders {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .entryTablePane {
    padding: 10px 0;
  }
  .entryTable th:nth-child(4),
  .entryTable th:nth-child(5),
  .entryTable td:nth-child(4),
  .entryTable td:nth-child(5) {
    display: none;
  }
  /* Sticker: keep visible on mobile, just smaller */
  .authSticker  { width: 110px; bottom: -18px; }
  .vaultSticker { width: 110px; bottom: -18px; }
  /* Chibi: fixed bottom-left instead of hidden */
  .companion { width: 150px; left: 8px !important; bottom: 10px !important; top: auto !important; right: auto !important; }
  .companion img { width: 100px; }

/* ── Color input (native hex picker) ── */
.colorInputWrap { display: flex; }
.colorInput {
  -webkit-appearance: none;
  appearance: none;
  width: 36px !important;
  height: 28px;
  padding: 2px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}
.colorInput::-webkit-color-swatch-wrapper { padding: 0; }
.colorInput::-webkit-color-swatch { border: none; border-radius: 2px; }
.colorInput::-moz-color-swatch { border: none; border-radius: 2px; }

/* ── Folder delete button ── */
.folderDelBtn {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  color: var(--danger) !important;
  background: rgba(0,0,0,.20) !important;
  border-radius: 3px;
  cursor: pointer;
  border: none;
  padding: 0;
  user-select: none;
  opacity: .8;
}

button.folderChip { background: rgba(0,0,0,.20); min-height: 34px; color: var(--muted); }
button.folderChip:hover { filter: none; box-shadow: none; background: rgba(0,0,0,.30); }
button.folderChip.active { background: rgba(252,173,3,.09); color: var(--gold); }
.folderDelBtn:hover { opacity: 1; background: rgba(0,0,0,.35); }

/* ── Bulk action bar ── */
.bulkBar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  background: rgba(0,200,212,.05);
  border: 1px solid rgba(0,200,212,.15);
  border-radius: 4px;
  font-size: .62rem;
  flex-wrap: wrap;
}
.bulkCount {
  color: var(--teal);
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-right: 4px;
  flex: 0 0 auto;
}
.bulkBar select { padding: 2px 6px; font-size: .62rem; width: auto; min-width: 100px; height: 24px; }
.bulkBar button { min-height: 24px; padding: 0 8px; font-size: .6rem; }
.cbCol {
  width: 28px;
  padding: 0 0 0 8px !important;
  flex: none;
}
.iconCol {
  width: 28px;
  padding: 0 4px !important;
  text-align: center;
}
.cbCol input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--teal);
  padding: 0;
  border: none;
  background: transparent;
}

/* ── Danger warning block ── */
.dangerWarn {
  color: var(--danger);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: none;
  line-height: 1.5;
  padding: 10px 12px;
  background: rgba(255,101,101,.07);
  border: 1px solid rgba(255,101,101,.28);
  border-radius: 5px;
  margin-bottom: 14px;
}
.dangerBtn {
  background: rgba(255,101,101,.15);
  color: var(--danger);
  border: 1px solid rgba(255,101,101,.45);
}
.dangerBtn:hover {
  background: rgba(255,101,101,.28);
  border-color: var(--danger);
}

/* Refresh spin animation */
@keyframes pv-spin { to { transform: rotate(360deg); } }
.spinning { animation: pv-spin .7s linear infinite; }

/* ── Password eye toggle ──────────────────────────── */
.pwWrap {
  position: relative;
  display: block;
}
.passwordRow > .pwWrap {
  flex: 1;
  min-width: 0;
}
.pwWrap > input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 34px;
}
.eyeToggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  cursor: pointer;
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  user-select: none;
}
.eyeToggle:hover { opacity: 1; }
.eyeToggle svg { display: block; width: 14px; height: 14px; }
