/* ============================================================================
   AuraVault — iOS-inspired glassmorphism stylesheet
   ----------------------------------------------------------------------------
   Design language: frosted glass over a flowing wallpaper, inset-grouped lists,
   large titles, spring easings and tactile press feedback. Light & dark.
   ========================================================================== */

/* ---------- palette & tokens ---------- */

:root {
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease: cubic-bezier(0.4, 0.2, 0.2, 1);

  --accent: #0a84ff;
  --accent-2: #5e5ce6;
  --accent-grad: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
  --danger: #ff3b30;
  --warn: #ff9f0a;
  --success: #34c759;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text",
    "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;

  --noise: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNDAiIGhlaWdodD0iMTQwIj48ZmlsdGVyIGlkPSJuIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC45IiBudW1PY3RhdmVzPSIyIiBzdGl0Y2hUaWxlcz0ic3RpdGNoIi8+PC9maWx0ZXI+PHJlY3Qgd2lkdGg9IjE0MCIgaGVpZ2h0PSIxNDAiIGZpbHRlcj0idXJsKCNuKSIgb3BhY2l0eT0iMC4wNSIvPjwvc3ZnPg==");
}

[data-theme="light"] {
  color-scheme: light;
  --text: #17171e;
  --text-2: rgba(58, 58, 66, 0.62);
  --text-3: rgba(58, 58, 66, 0.38);

  --glass: rgba(255, 255, 255, 0.58);
  --content-glass: rgba(250, 251, 253, 0.55);
  --card: rgba(255, 255, 255, 0.68);
  --card-2: rgba(255, 255, 255, 0.52);
  --sheet-bg: rgba(248, 250, 253, 0.80);

  --hover: rgba(120, 132, 166, 0.10);
  --hover-strong: rgba(120, 132, 166, 0.17);
  --press: rgba(120, 132, 166, 0.22);
  --sep: rgba(58, 58, 66, 0.10);
  --field: rgba(120, 132, 166, 0.13);
  --chip: rgba(120, 132, 166, 0.15);
  --accent-chip: rgba(10, 132, 255, 0.13);
  --accent-border: rgba(10, 132, 255, 0.30);
  --focus-ring: rgba(10, 132, 255, 0.28);
  --accent-shadow: rgba(10, 110, 255, 0.32);
  --danger-chip: rgba(255, 59, 48, 0.12);

  --shadow-lg: 0 24px 60px rgba(31, 41, 72, 0.18);
  --card-shadow: 0 10px 30px rgba(31, 41, 72, 0.10), inset 0 0 0 0.5px rgba(255, 255, 255, 0.55);
  --panel-border: inset 0 0 0 0.5px rgba(255, 255, 255, 0.6);
  --hairline: rgba(255, 255, 255, 0.7);

  --toast-bg: rgba(26, 28, 38, 0.86);
  --toast-text: #f5f6fa;
  --grab: rgba(58, 58, 66, 0.24);
  --track: rgba(120, 132, 166, 0.26);
  --seg-bg: rgba(120, 132, 166, 0.15);
  --seg-border: rgba(58, 58, 66, 0.07);
  --seg-thumb-bg: rgba(255, 255, 255, 0.95);
  --switch-off: rgba(120, 132, 166, 0.32);
  --bar-bg: rgba(247, 249, 252, 0.62);
}

[data-theme="dark"] {
  color-scheme: dark;
  --text: #f0f1f7;
  --text-2: rgba(228, 230, 244, 0.6);
  --text-3: rgba(228, 230, 244, 0.35);

  --glass: rgba(23, 25, 37, 0.56);
  --content-glass: rgba(17, 19, 29, 0.52);
  --card: rgba(38, 41, 56, 0.55);
  --card-2: rgba(30, 32, 46, 0.5);
  --sheet-bg: rgba(26, 28, 40, 0.84);

  --hover: rgba(255, 255, 255, 0.06);
  --hover-strong: rgba(255, 255, 255, 0.11);
  --press: rgba(255, 255, 255, 0.15);
  --sep: rgba(255, 255, 255, 0.08);
  --field: rgba(255, 255, 255, 0.07);
  --chip: rgba(255, 255, 255, 0.09);
  --accent-chip: rgba(10, 132, 255, 0.22);
  --accent-border: rgba(10, 132, 255, 0.42);
  --focus-ring: rgba(10, 132, 255, 0.35);
  --accent-shadow: rgba(10, 110, 255, 0.4);
  --danger-chip: rgba(255, 69, 58, 0.16);

  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 0 0 0.5px rgba(255, 255, 255, 0.09);
  --panel-border: inset 0 0 0 0.5px rgba(255, 255, 255, 0.1);
  --hairline: rgba(255, 255, 255, 0.16);

  --toast-bg: rgba(58, 60, 76, 0.92);
  --toast-text: #f5f6fa;
  --grab: rgba(255, 255, 255, 0.22);
  --track: rgba(255, 255, 255, 0.16);
  --seg-bg: rgba(255, 255, 255, 0.07);
  --seg-border: rgba(255, 255, 255, 0.06);
  --seg-thumb-bg: rgba(80, 84, 106, 0.95);
  --switch-off: rgba(255, 255, 255, 0.22);
  --bar-bg: rgba(16, 18, 28, 0.58);
}

/* ---------- reset & base ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* The [hidden] attribute must always win — layers like .lock-layer set an
 * explicit `display`, which would otherwise override the browser's default
 * [hidden] handling and leave invisible overlays blurring/blocking the UI. */
[hidden] { display: none !important; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  color: var(--text);
  background: #0a0b10;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}

img { -webkit-user-drag: none; }

button { font-family: inherit; }

::selection { background: rgba(10, 132, 255, 0.28); }

:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--text-3);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-2); background-clip: content-box; border: 3px solid transparent; }

/* ---------- wallpaper ---------- */

.wallpaper { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #0a0b10; }

.wp-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 1.1s var(--ease);
  animation: wpDrift 70s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
.wp-img.dark { opacity: 0; }
[data-theme="dark"] .wp-img { opacity: 0; }
[data-theme="dark"] .wp-img.dark { opacity: 1; }

.wp-tint {
  position: absolute; inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 1s var(--ease);
}
[data-theme="dark"] .wp-tint { background: rgba(5, 8, 18, 0.28); }

@keyframes wpDrift {
  from { transform: scale(1.05) translate(0, 0); }
  to { transform: scale(1.11) translate(-1.6%, -1.2%); }
}

/* ---------- app shell & window ---------- */

.app {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column;
  animation: appOpen 0.55s var(--spring);
}
.app.closing { animation: appClose 0.26s var(--ease) forwards; }

@keyframes appOpen {
  from { opacity: 0; transform: scale(0.965) translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes appClose {
  to { opacity: 0; transform: scale(0.965); }
}

.titlebar {
  height: 46px; flex: none;
  display: flex; align-items: center;
  padding: 0 7px 0 16px;
  -webkit-app-region: drag;
  position: relative; z-index: 60;
}

.tb-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 13.5px; letter-spacing: 0.2px; }
.tb-logo { width: 22px; height: 22px; display: block; border-radius: 6px; box-shadow: 0 3px 10px rgba(10, 60, 180, 0.35); }
.tb-pill {
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  padding: 2.5px 8px; border-radius: 99px;
  background: var(--accent-chip); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}
.tb-drag { flex: 1; height: 100%; }

.win-controls { display: flex; gap: 2px; -webkit-app-region: no-drag; }
.wc {
  width: 46px; height: 36px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2);
  cursor: default;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.15s var(--spring);
}
.wc:hover { background: var(--hover-strong); color: var(--text); }
.wc:active { transform: scale(0.9); }
.wc-close:hover { background: #e5484d; color: #fff; }
.wc .max-b { display: none; }
body.is-max .wc .max-a { display: none; }
body.is-max .wc .max-b { display: block; }

/* ---------- layout ---------- */

.layout {
  flex: 1; min-height: 0;
  display: flex; gap: 14px;
  padding: 2px 14px 14px;
}

/* ---------- sidebar (glass) ---------- */

.sidebar {
  width: 262px; flex: none;
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: blur(30px) saturate(1.7);
  -webkit-backdrop-filter: blur(30px) saturate(1.7);
  box-shadow: var(--shadow-lg), var(--panel-border);
  padding: 12px 10px 12px;
  overflow: hidden;
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background-image: var(--noise);
  opacity: 0.5; pointer-events: none;
}
.sidebar { position: relative; }

.sb-nav {
  position: relative;
  display: flex; flex-direction: column; gap: 1px;
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 2px;
}

.sb-pill {
  position: absolute; left: 2px; right: 2px; top: 0;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-chip);
  box-shadow: inset 0 0 0 1px var(--accent-border);
  transition: transform 0.42s var(--spring), height 0.42s var(--spring);
  will-change: transform;
}

.nav-item {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 11px;
  height: 40px; padding: 0 11px;
  border: 0; border-radius: 11px;
  background: transparent; color: var(--text-2);
  font: 600 13.5px var(--font);
  cursor: pointer;
  transition: color 0.2s var(--ease), transform 0.14s var(--spring);
  white-space: nowrap;
}
.nav-item:hover { color: var(--text); }
.nav-item:active { transform: scale(0.97); }
.nav-item.active { color: var(--accent); }

.nav-ic { width: 21px; height: 21px; display: grid; place-items: center; flex: none; }
.nav-ic svg { display: block; }

.nav-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }

.nav-count {
  font-size: 11.5px; font-weight: 700;
  color: var(--text-3);
  background: var(--chip);
  padding: 1.5px 8px; border-radius: 99px;
  min-width: 26px; text-align: center;
  transition: color 0.2s, background 0.2s;
}
.nav-item.active .nav-count { color: var(--accent); background: rgba(255, 255, 255, 0.35); }
[data-theme="dark"] .nav-item.active .nav-count { background: rgba(255, 255, 255, 0.12); }

.sb-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.9px; text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 11px 6px;
}
.sb-label:first-child { padding-top: 4px; }

.sb-spacer { flex: 1; min-height: 10px; }

.sb-lock { flex: none; padding-top: 6px; }
.lock-nav { width: 100%; color: var(--text-2); }
.lock-nav:hover { color: var(--danger); }
.lock-kbd {
  font: 700 10px var(--mono);
  color: var(--text-3);
  background: var(--chip);
  padding: 2px 6px; border-radius: 6px;
}

/* ---------- content card (glass) ---------- */

.content {
  flex: 1; min-width: 0;
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--content-glass);
  backdrop-filter: blur(30px) saturate(1.6);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: var(--shadow-lg), var(--panel-border);
  overflow: hidden;
}
.content::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--noise);
  opacity: 0.45; pointer-events: none; z-index: 0;
}

/* ---------- pages & transitions ---------- */

.pages { position: absolute; inset: 0; z-index: 1; }

.page { position: absolute; inset: 0; visibility: hidden; }
.page.active,
.page.enter-fwd, .page.enter-bwd, .page.enter-fade,
.page.exit-fwd, .page.exit-bwd, .page.exit-fade { visibility: visible; }

.page-scroll {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 24px 30px 48px;
  overscroll-behavior: contain;
}
.page-inner { max-width: 800px; margin: 0 auto; }

/* iOS push navigation */
.page.enter-fwd { animation: pushIn 0.42s var(--spring); }
.page.exit-bwd { animation: pushOut 0.36s var(--ease) forwards; }
.page.enter-bwd { animation: popIn 0.42s var(--spring); }
.page.exit-fwd { animation: popOut 0.34s var(--ease) forwards; }

@keyframes pushIn { from { opacity: 0; transform: translateX(64px); } }
@keyframes pushOut { to { opacity: 0.4; transform: translateX(-24%); } }
@keyframes popIn { from { opacity: 0.4; transform: translateX(-24%); } }
@keyframes popOut { to { opacity: 0; transform: translateX(48%); } }

/* crossfade for sibling pages */
.page.enter-fade { animation: pageFade 0.36s var(--spring); }
.page.exit-fade { animation: pageFadeOut 0.26s var(--ease) forwards; }
@keyframes pageFade { from { opacity: 0; transform: translateY(14px) scale(0.995); } }
@keyframes pageFadeOut { to { opacity: 0; transform: translateY(-6px); } }

/* ---------- home: header ---------- */

.compact-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 50px;
  z-index: 6;
  display: flex; align-items: center; justify-content: center;
  background: var(--bar-bg);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: inset 0 -0.5px 0 var(--sep);
  opacity: 0; transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.compact-title { font-size: 14px; font-weight: 700; }
.page.scrolled .compact-bar { opacity: 1; transform: none; }

.ph-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.big-title {
  font-size: 33px; font-weight: 800; letter-spacing: -0.6px;
  animation: fadeUp 0.5s var(--spring);
}

.btn-add {
  width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%;
  background: var(--accent-grad); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 10px 24px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.22s var(--spring), box-shadow 0.22s var(--ease), filter 0.2s;
}
.btn-add:hover { transform: scale(1.07); filter: brightness(1.05); }
.btn-add:active { transform: scale(0.9); }

.search {
  display: flex; align-items: center; gap: 9px;
  height: 42px; padding: 0 13px;
  border-radius: 13px;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--seg-border);
  margin-bottom: 22px;
  transition: box-shadow 0.22s var(--ease), background 0.22s;
  animation: fadeUp 0.5s var(--spring) 0.05s backwards;
}
.search:focus-within {
  background: var(--card);
  box-shadow: 0 0 0 3.5px var(--focus-ring), inset 0 0 0 1px var(--accent-border);
}
.search-icon { color: var(--text-3); display: grid; place-items: center; }
.search input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  font: 500 14px var(--font); color: var(--text);
  user-select: text;
}
.search input::placeholder { color: var(--text-3); }
.search-clear {
  border: 0; background: var(--chip); color: var(--text-2);
  width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.search-clear:hover { background: var(--hover-strong); }
.search-clear:active { transform: scale(0.85); }

/* ---------- list groups & rows ---------- */

.list-group { margin-bottom: 24px; }
.group-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.9px; text-transform: uppercase;
  color: var(--text-3);
  padding: 0 8px 8px;
}

.group {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.row-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.4s var(--ease), opacity 0.3s var(--ease); }
.row-wrap.removing { grid-template-rows: 0fr; opacity: 0; }
.row-wrap > .row { overflow: hidden; min-height: 0; }
.row-wrap.adding .row { animation: rowPop 0.55s var(--spring); }

.row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  cursor: pointer; position: relative;
  animation: rowIn 0.5s var(--spring) backwards;
  animation-delay: calc(var(--i, 0) * 28ms);
  transition: background 0.16s var(--ease);
}
.row:hover { background: var(--hover); }
.row:active { background: var(--press); }
.row-wrap:not(:first-child) > .row::before {
  content: ""; position: absolute; top: 0; left: 70px; right: 0; height: 0.5px;
  background: var(--sep);
}

.row-icon {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700; font-size: 16.5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 5px 12px rgba(20, 30, 70, 0.18);
}
.row-icon svg { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18)); }

.ic-0 { background: linear-gradient(135deg, #0a84ff, #5e5ce6); }
.ic-1 { background: linear-gradient(135deg, #ff5a5f, #ff9f0a); }
.ic-2 { background: linear-gradient(135deg, #34c759, #00c7be); }
.ic-3 { background: linear-gradient(135deg, #ff2d92, #af52de); }
.ic-4 { background: linear-gradient(135deg, #ff9500, #ffd60a); }
.ic-5 { background: linear-gradient(135deg, #00c7be, #0a84ff); }
.ic-6 { background: linear-gradient(135deg, #bf5af2, #5e5ce6); }
.ic-7 { background: linear-gradient(135deg, #ff3b30, #ff2d92); }
.ic-8 { background: linear-gradient(135deg, #66d4cf, #30d158); }
.ic-9 { background: linear-gradient(135deg, #5856d6, #64d2ff); }
.ic-10 { background: linear-gradient(135deg, #b08d57, #ff9f0a); }
.ic-11 { background: linear-gradient(135deg, #8e8e93, #5a5a5f); }

.row-main { flex: 1; min-width: 0; }
.row-title {
  font-size: 14.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-sub {
  font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1.5px;
}
.row-trail { display: flex; align-items: center; gap: 2px; flex: none; }
.chev { color: var(--text-3); display: grid; place-items: center; margin-left: 4px; }

.icon-btn {
  width: 34px; height: 34px;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.15s var(--spring);
}
.icon-btn:hover { background: var(--hover-strong); color: var(--text); }
.icon-btn:active { transform: scale(0.88); }

.row-copy { opacity: 0; transform: translateX(5px); transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), background 0.16s, color 0.16s; }
.row:hover .row-copy, .row:focus-within .row-copy { opacity: 1; transform: none; }

.row-fav.is-fav { color: var(--warn); }
.row-fav.pop svg { animation: popIcon 0.4s var(--spring); }

/* ---------- empty state ---------- */

.empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 58px 24px 30px;
  animation: fadeUp 0.55s var(--spring);
}
.empty-art { width: 108px; height: 108px; margin-bottom: 22px; opacity: 0.95; }
.empty-title { font-size: 19px; font-weight: 700; }
.empty-sub { color: var(--text-2); font-size: 13.5px; line-height: 1.55; max-width: 330px; margin: 9px 0 24px; }
.empty-cta { min-width: 190px; }

/* ---------- buttons ---------- */

.btn {
  height: 46px; padding: 0 22px;
  border: 0; border-radius: 14px;
  font: 700 15px var(--font);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  transition: transform 0.18s var(--spring), box-shadow 0.2s var(--ease), filter 0.2s var(--ease), background 0.2s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-grad); color: #fff;
  box-shadow: 0 10px 26px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:disabled { filter: grayscale(0.5) brightness(0.8); cursor: default; }

.btn-soft { background: var(--card); color: var(--text); box-shadow: var(--card-shadow); }
.btn-soft:hover { filter: brightness(1.03); }

.btn-text {
  border: 0; background: transparent; color: var(--accent);
  font: 600 14px var(--font); cursor: pointer;
  padding: 7px 10px; border-radius: 9px;
  transition: background 0.15s, transform 0.15s var(--spring);
}
.btn-text:hover { background: var(--accent-chip); }
.btn-text:active { transform: scale(0.95); }
.btn-text.danger { color: var(--danger); }
.btn-text.danger:hover { background: var(--danger-chip); }

/* ---------- detail page ---------- */

.d-top { display: flex; align-items: center; margin-bottom: 4px; }

.back-btn {
  display: inline-flex; align-items: center; gap: 1px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--accent); font: 600 14px var(--font);
  padding: 7px 9px; border-radius: 9px;
  transition: background 0.15s, transform 0.15s var(--spring);
}
.back-btn:hover { background: var(--accent-chip); }
.back-btn:active { transform: scale(0.95) translateX(-2px); }

.d-hero { display: flex; align-items: center; gap: 18px; margin: 10px 0 24px; animation: fadeUp 0.5s var(--spring); }
.d-icon {
  width: 64px; height: 64px; flex: none;
  border-radius: 18px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 12px 26px rgba(20, 30, 70, 0.24);
}
.d-hero-main { flex: 1; min-width: 0; }
.d-title { font-size: 27px; font-weight: 800; letter-spacing: -0.4px; word-break: break-word; }
.d-sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; word-break: break-all; }
.d-hero-actions { display: flex; gap: 6px; flex: none; }
.d-hero-actions .icon-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--card); box-shadow: var(--card-shadow); }
.d-fav.is-fav { color: var(--warn); }
.d-fav.pop svg { animation: popIcon 0.4s var(--spring); }

.field {
  display: flex; align-items: center; gap: 12px;
  padding: 12.5px 16px; position: relative;
  transition: background 0.15s;
}
.field:hover .f-copy { opacity: 1; transform: none; }
.field + .field::before {
  content: ""; position: absolute; top: 0; left: 122px; right: 0; height: 0.5px; background: var(--sep);
}
.f-label { width: 106px; flex: none; font-size: 13px; color: var(--text-2); font-weight: 500; }
.f-value { flex: 1; min-width: 0; font-size: 14.5px; user-select: text; word-break: break-all; line-height: 1.45; }
.f-value.mono { font-family: var(--mono); letter-spacing: 0.4px; }
.f-value.muted { color: var(--text-2); font-size: 13px; }
.f-value.link { color: var(--accent); cursor: pointer; }
.f-value.pre { white-space: pre-wrap; }
.f-hint { font-size: 11px; color: var(--text-3); font-weight: 500; }
.use-row { margin-top: 2px; }
.f-actions { display: flex; gap: 2px; flex: none; }
.f-copy { opacity: 0; transform: translateX(4px); transition: opacity 0.18s, transform 0.18s, background 0.15s, color 0.15s; }

.notes-card { padding: 14px 16px; }
.notes-text { font-size: 14px; line-height: 1.6; color: var(--text); white-space: pre-wrap; user-select: text; word-break: break-word; }

.meter-row { padding: 13px 16px; }
.meter-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 7px; }
.meter-label b { font-weight: 700; }

.meter { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.meter i {
  display: block; height: 100%; width: 0%;
  border-radius: 99px; background: var(--text-3);
  transition: width 0.5s var(--spring), background 0.3s var(--ease);
}
.meter.s0 i { background: #ff453a; }
.meter.s1 i { background: #ff9f0a; }
.meter.s2 i { background: #ffd60a; }
.meter.s3 i { background: #30d158; }
.meter.s4 i { background: #28c840; }

.danger-btn {
  width: 100%; padding: 14px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--danger); font: 600 14.5px var(--font);
  transition: background 0.15s;
}
.danger-btn:hover { background: var(--danger-chip); }
.danger-btn:active { background: rgba(255, 59, 48, 0.2); }

/* ---------- security checkup ---------- */

.sec-hero { padding: 18px 16px 16px; }
.sec-score-row { display: flex; align-items: center; gap: 16px; margin-bottom: 13px; }
.sec-score { display: flex; align-items: baseline; }
.sec-score b { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.sec-score span { color: var(--text-3); font-weight: 600; font-size: 13px; margin-left: 4px; }
.sec-score-side { flex: 1; min-width: 0; }
.sec-band { font-weight: 700; font-size: 14.5px; }
.sec-band-sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.row-sub.warn { color: var(--warn); }
.row-icon.ok-ic { background: linear-gradient(135deg, #34c759, #00c7be); }
.row.allclear { cursor: default; }
.row.allclear:hover { background: transparent; }

/* ---------- generator ---------- */

.gen-hero {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 24px 24px 20px;
  margin-bottom: 24px;
  animation: fadeUp 0.5s var(--spring);
}
.gen-pass-row { display: flex; align-items: center; gap: 8px; }
.gen-pass {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-weight: 600;
  font-size: clamp(15px, 1.9vw, 20px);
  letter-spacing: 0.6px; line-height: 1.55;
  word-break: break-all; user-select: text;
  min-height: 2.2em;
}
.gen-pass.swap { animation: passSwap 0.35s var(--ease); }
.gen-actions { display: flex; gap: 6px; flex: none; }
.gen-actions .icon-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--field); }
.gen-actions .icon-btn:hover { background: var(--hover-strong); }
.gen-btn.busy svg { animation: spin 0.5s var(--ease); }

.gen-strength { margin-top: 18px; }
.gen-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-top: 7px; }

.g-row { padding: 11px 16px; gap: 14px; }
.g-row .f-label { width: 150px; }
.g-row .f-value { display: flex; align-items: center; justify-content: flex-end; }

.range-val {
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  min-width: 30px; text-align: right; margin-right: 12px;
  color: var(--text);
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 30px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 99px;
  background: linear-gradient(var(--accent), var(--accent)) 0 0 / var(--fill, 50%) 100% no-repeat var(--track);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 25px; height: 25px; margin-top: -8.5px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s var(--spring);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.14); }

.gen-hist-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; position: relative; }
.gen-hist-row + .gen-hist-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 0.5px; background: var(--sep); }
.gh-pass {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 13px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  user-select: text;
}

/* ---------- settings & trash ---------- */

.trash-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.set-note { font-size: 12px; color: var(--text-3); line-height: 1.55; padding: 12px 16px 14px; }

.field.clickable { cursor: pointer; }
.field.clickable:hover { background: var(--hover); }
.field.clickable:active { background: var(--press); }

.restore-btn { color: var(--accent); }
.del-forever-btn { color: var(--danger); }

/* ---------- switch ---------- */

.switch {
  width: 51px; height: 31px; flex: none;
  border: 0; border-radius: 99px; cursor: pointer;
  background: var(--switch-off);
  position: relative;
  transition: background 0.25s var(--ease);
}
.switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.32s var(--spring);
}
.switch.on { background: var(--success); }
.switch.on::after { transform: translateX(20px); }

/* ---------- segmented control ---------- */

.seg {
  position: relative;
  display: inline-flex;
  background: var(--seg-bg);
  border-radius: 11px; padding: 3px;
  box-shadow: inset 0 0 0 1px var(--seg-border);
}
.seg-thumb {
  position: absolute; top: 3px; left: 0; bottom: 3px;
  border-radius: 8.5px;
  background: var(--seg-thumb-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), inset 0 0 0 0.5px var(--hairline);
  transition: transform 0.35s var(--spring), width 0.35s var(--spring);
}
.seg button {
  position: relative; z-index: 1;
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 15px; min-width: 52px;
  border-radius: 9px;
  font: 600 13px var(--font); color: var(--text-2);
  transition: color 0.2s var(--ease);
  white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { color: var(--text); }

.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; }

/* ---------- sheets (add/edit modal) ---------- */

.sheet-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }

.backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 10, 20, 0.4);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  animation: fadeIn 0.3s var(--ease);
}
.backdrop.closing { animation: fadeOut 0.24s var(--ease) forwards; }

.sheet {
  position: relative;
  width: min(568px, calc(100vw - 48px));
  max-height: min(84vh, 740px);
  display: flex; flex-direction: column;
  background: var(--sheet-bg);
  backdrop-filter: blur(44px) saturate(1.8);
  -webkit-backdrop-filter: blur(44px) saturate(1.8);
  border-radius: 26px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.4), var(--panel-border);
  overflow: hidden;
  animation: sheetIn 0.5s var(--spring);
}
.sheet::before { content: ""; position: absolute; inset: 0; background-image: var(--noise); opacity: 0.5; pointer-events: none; }
.sheet.closing { animation: sheetOut 0.28s var(--ease) forwards; }

.sheet-grab { width: 42px; height: 5px; border-radius: 3px; background: var(--grab); margin: 11px auto 0; flex: none; }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 12px 10px;
  position: relative; z-index: 1;
}
.sheet-title { font-size: 17px; font-weight: 700; position: absolute; left: 50%; transform: translateX(-50%); }
.sheet-save { font-weight: 700; }

.sheet-body { overflow-y: auto; padding: 2px 22px 10px; position: relative; z-index: 1; }

.field-group {
  background: var(--card-2);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--seg-border);
  margin-bottom: 16px;
  overflow: hidden;
}

.in-row {
  display: flex; align-items: center;
  min-height: 50px; padding: 0 15px;
  position: relative;
}
.in-row + .in-row::before { content: ""; position: absolute; top: 0; left: 15px; right: 0; height: 0.5px; background: var(--sep); }
.in-label { width: 96px; flex: none; font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.in-row input, .in-row textarea {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  font: 500 14.5px var(--font); color: var(--text);
  user-select: text;
}
.in-row input::placeholder, .in-row textarea::placeholder { color: var(--text-3); }
.in-row input:focus { outline: none; }
.in-act { width: 32px; height: 32px; flex: none; }

.in-row.notes { display: block; padding: 13px 15px 15px; }
.in-row.notes + .in-row.notes::before { left: 15px; }
.in-row.notes .in-label { display: block; margin-bottom: 8px; }
.in-row.notes textarea {
  display: block; width: 100%; min-height: 92px;
  border: 0; background: transparent; resize: vertical;
  font: 500 14px var(--font); color: var(--text); line-height: 1.5;
}

.swatches { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; padding: 9px 0; }
.sw {
  width: 27px; height: 27px; border-radius: 9px;
  border: 0; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.18s var(--spring), box-shadow 0.18s;
}
.sw:hover { transform: scale(1.14); }
.sw.on { box-shadow: 0 0 0 2px var(--bg-solid, #fff), 0 0 0 4.5px var(--accent); transform: scale(1.08); }

.mini-meter { padding: 4px 15px 12px; }
.mini-meter .meter { height: 4.5px; }
.mini-hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }

.sheet-type { margin: 2px 0 16px; display: flex; }
.sheet-type button { flex: 1; }

.shakeit { animation: shake 0.45s var(--ease); }

/* ---------- action sheet ---------- */

.action-layer { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; }

.action-card {
  position: relative;
  width: min(330px, calc(100vw - 64px));
  background: var(--sheet-bg);
  backdrop-filter: blur(38px) saturate(1.7);
  -webkit-backdrop-filter: blur(38px) saturate(1.7);
  border-radius: 22px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.36), var(--panel-border);
  overflow: hidden;
  animation: sheetIn 0.42s var(--spring);
}
.action-card.closing { animation: sheetOut 0.24s var(--ease) forwards; }

.action-msg { padding: 21px 22px 15px; text-align: center; }
.action-title { font-weight: 700; font-size: 15.5px; }
.action-sub { color: var(--text-2); font-size: 13px; margin-top: 6px; line-height: 1.5; }
.action-btn {
  display: block; width: 100%;
  padding: 14.5px;
  border: 0; background: transparent; cursor: pointer;
  font: 600 15px var(--font); color: var(--text);
  transition: background 0.14s;
}
.action-btn:hover { background: var(--hover); }
.action-btn:active { background: var(--press); }
.action-btn + .action-btn { border-top: 0.5px solid var(--sep); }
.action-btn.danger { color: var(--danger); font-weight: 700; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed; top: 58px; left: 50%; transform: translateX(-50%);
  z-index: 220;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 10px;
  border-radius: 99px;
  background: var(--toast-bg); color: var(--toast-text);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), var(--panel-border);
  font: 600 13.5px var(--font);
  animation: toastIn 0.5s var(--spring);
  pointer-events: auto;
  cursor: default;
  max-width: min(560px, calc(100vw - 48px));
}
.toast.hide { animation: toastOut 0.28s var(--ease) forwards; }
.toast-ic {
  width: 23px; height: 23px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center; color: #fff;
}
.toast-ic.ok { background: var(--success); }
.toast-ic.info { background: var(--accent); }
.toast-ic.warn { background: var(--warn); }
.toast-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-act {
  border: 0; background: transparent; cursor: pointer;
  color: #6cb8ff; font: 700 13.5px var(--font);
  padding: 5px 8px; border-radius: 8px; flex: none;
}
.toast-act:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- lock & setup ---------- */

.lock-layer {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: rgba(10, 12, 22, 0.25);
  backdrop-filter: blur(36px) saturate(1.5);
  -webkit-backdrop-filter: blur(36px) saturate(1.5);
  animation: fadeIn 0.45s var(--ease);
}
.lock-layer.closing { animation: lockOut 0.4s var(--ease) forwards; }

.lock-card {
  width: min(400px, calc(100vw - 56px));
  text-align: center;
  animation: lockIn 0.6s var(--spring);
}
.lock-logo {
  width: 92px; height: 92px;
  margin: 0 auto 22px; display: block;
  border-radius: 24px;
  filter: drop-shadow(0 16px 34px rgba(10, 90, 220, 0.4));
  animation: floaty 5.5s ease-in-out infinite;
}
.lock-title { font-size: 25px; font-weight: 800; letter-spacing: -0.4px; color: #fff; }
.lock-sub { color: rgba(255, 255, 255, 0.66); font-size: 13.5px; margin: 8px 0 24px; line-height: 1.55; }

.lock-form { display: flex; flex-direction: column; gap: 12px; }
.lock-input-wrap {
  display: flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: box-shadow 0.2s, background 0.2s;
}
.lock-input-wrap:focus-within { background: rgba(255, 255, 255, 0.17); box-shadow: 0 0 0 3.5px rgba(10, 132, 255, 0.4), inset 0 0 0 0.5px rgba(255, 255, 255, 0.3); }
.lock-input-wrap svg { color: rgba(255, 255, 255, 0.55); flex: none; }
.lock-input-wrap input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  font: 600 15px var(--font); color: #fff;
  user-select: text;
}
.lock-input-wrap input::placeholder { color: rgba(255, 255, 255, 0.45); }
.lock-peek { border: 0; background: transparent; color: rgba(255, 255, 255, 0.55); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.lock-peek:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }

.unlock-btn { width: 100%; }
.lock-err { color: #ff9f9f; font-size: 13px; font-weight: 600; min-height: 18px; margin-top: 2px; }
.lock-hint { color: rgba(255, 255, 255, 0.5); font-size: 12px; margin-top: 14px; }
.lock-hint code { font-family: var(--mono); background: rgba(255, 255, 255, 0.14); padding: 2px 7px; border-radius: 6px; }

.wiz-step { display: none; }
.wiz-step.on { display: block; animation: stepIn 0.45s var(--spring); }
.wiz-step.back { animation: stepInBack 0.45s var(--spring); }
.wiz-checks { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin: 16px 0 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.18);
  transition: background 0.25s, color 0.25s;
}
.chip.ok { background: rgba(52, 199, 89, 0.22); color: #7ce8a0; box-shadow: inset 0 0 0 0.5px rgba(52, 199, 89, 0.45); }
.wiz-meter { margin: 18px 0 0; }
.wiz-back { margin-top: 16px; }
.lock-note { color: rgba(255, 255, 255, 0.45); font-size: 12px; line-height: 1.6; margin-top: 20px; }

/* ---------- demo banner (browser preview mode) ---------- */

.demo-banner {
  position: fixed; right: 18px; bottom: 16px; z-index: 150;
  display: none; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 99px;
  background: var(--toast-bg); color: var(--toast-text);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26), var(--panel-border);
  font: 600 12.5px var(--font);
  animation: toastIn 0.6s var(--spring) 0.8s backwards;
}
body.demo .demo-banner { display: flex; }
.demo-banner .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); animation: pulse 2s ease-in-out infinite; }

/* ---------- keyframes ---------- */

@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
@keyframes rowIn { from { opacity: 0; transform: translateY(9px) scale(0.985); } }
@keyframes rowPop { 0% { opacity: 0; transform: scale(0.9); } 60% { transform: scale(1.015); } }
@keyframes groupIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(30px) scale(0.965); } }
@keyframes sheetOut { to { opacity: 0; transform: translateY(22px) scale(0.97); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.94); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(0.96); } }
@keyframes lockIn { from { opacity: 0; transform: translateY(26px) scale(0.96); } }
@keyframes lockOut { to { opacity: 0; transform: scale(1.03); } }
@keyframes stepIn { from { opacity: 0; transform: translateX(42px); } }
@keyframes stepInBack { from { opacity: 0; transform: translateX(-42px); } }
@keyframes passSwap { from { opacity: 0; filter: blur(7px); transform: translateY(4px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes popIcon { 0% { transform: scale(0.6); } 55% { transform: scale(1.35); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@keyframes shake {
  10%, 90% { transform: translateX(-1.5px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .sidebar { width: 216px; }
  .nav-label { font-size: 13px; }
  .page-scroll { padding: 20px 18px 40px; }
  .big-title { font-size: 27px; }
}

@media (max-width: 700px) {
  .sidebar { display: none; }
}

/* ---------- static capture mode (docs screenshots) ---------- */

/* Applied by the screenshot pipeline (see scripts/web-shots.js): every
 * animation and transition is frozen at its natural final state. */
.av-static *, .av-static *::before, .av-static *::after {
  animation: none !important;
  transition: none !important;
}
/* the fine noise overlay turns to mush when downscaled for the README */
.av-static .content::before,
.av-static .sidebar::before,
.av-static .sheet::before { opacity: 0.22; }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
