/* Vault — dark, rounded grouped cards, green accents, magenta selected tab. */
:root {
  --bg: #000;
  --card: #1c1c1e;
  --card-press: #2c2c2e;
  --sep: rgba(84, 84, 88, 0.55);
  --text: #fff;
  --sec: #8e8e93;
  --green: #2ecc71;
  --magenta: #d63af9;
  --red: #ff453a;
  --radius: 12px;
  --nav-h: 52px;
  --tab-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  overflow: hidden; /* app scrolls inside its own containers; also keeps host-injected markup off-screen */
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.icon { width: 22px; height: 22px; flex: none; }
.mini { width: 14px; height: 14px; flex: none; }
.accent { color: var(--green); }
.muted { color: var(--sec); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.02em; }
.offscreen { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

#app { height: 100%; }

/* ---------- shell ---------- */
.shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.navbar, .sheet-header {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr);
  align-items: center;
  gap: 8px;
  min-height: var(--nav-h);
  padding: 0 16px;
}

.navbar {
  padding-top: var(--safe-top);
  min-height: calc(var(--nav-h) + var(--safe-top));
  background: rgba(0, 0, 0, 0.92);
  border-bottom: 0.5px solid var(--sep);
  flex: none;
  z-index: 2;
}

.nav-left { justify-self: start; display: flex; align-items: center; min-width: 0; }
.nav-right { justify-self: end; display: flex; align-items: center; gap: 12px; }
.nav-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
}

.circle-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: #000;
  display: grid;
  place-items: center;
}
.circle-btn .icon { width: 18px; height: 18px; stroke-width: 2.8; }
.circle-btn:active { opacity: 0.7; }

.back-btn { display: flex; align-items: center; gap: 2px; color: var(--green); margin-left: -8px; max-width: 36vw; }
.back-btn .icon { width: 26px; height: 26px; stroke-width: 2.4; }
.back-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-text { color: var(--green); padding: 6px 0; }
.nav-text.bold { font-weight: 600; }
.nav-text:disabled { color: #3a3a3c; }

.search-wrap { padding: 8px 16px 4px; flex: none; }
.search-box {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border-radius: 10px; padding: 0 10px; height: 38px;
}
.search-icon { width: 18px; height: 18px; color: var(--sec); }
.search-input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 17px; height: 100%;
}
.search-input::placeholder { color: var(--sec); }
.search-input::-webkit-search-cancel-button { filter: invert(0.6); }

.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 28px;
}

/* ---------- tab bar ---------- */
.tabbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(18, 18, 18, 0.96);
  border-top: 0.5px solid var(--sep);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--sec);
  padding-top: 6px;
}
.tab-icon { width: 27px; height: 27px; stroke-width: 1.6; }
.tab-label { font-size: 10.5px; font-weight: 500; }
.tab.selected { color: var(--magenta); }
.tab.selected .tab-icon { fill: color-mix(in srgb, var(--magenta) 30%, transparent); }
.tab .knob { fill: rgba(18, 18, 18, 1); }

/* ---------- cards & rows ---------- */
.stack { display: flex; flex-direction: column; gap: 28px; }
.section { display: flex; flex-direction: column; gap: 7px; }
.section-title {
  margin: 0 0 0 16px; font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; color: var(--sec);
}
.footnote { margin: 2px 16px 0; font-size: 13px; color: var(--sec); line-height: 1.35; }

.card { background: var(--card); border-radius: var(--radius); overflow: hidden; }

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  text-align: left;
}
.card > .row + .row::before,
.card > .row + .field-row::before,
.card > .field-row + .row::before,
.card > .field-row + .field-row::before,
.card > .field-editor + .field-editor::before,
.card > .field-editor + .row::before,
.card > .symbol-grid + .row::before,
.card > .row + .symbol-grid::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 0.5px;
  background: var(--sep);
}
.card > .row-category + .row-category::before { left: 70px; }
.card > .row-item + .row-item::before { left: 64px; }
button.row:active:not(:disabled) { background: var(--card-press); }
button.row:disabled { opacity: 1; }

.row-category { min-height: 58px; padding: 9px 14px; }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-category .row-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.row-count { color: var(--sec); font-variant-numeric: tabular-nums; font-size: 17px; }
.row-detail { color: var(--sec); }
.chev { width: 16px; height: 16px; color: #5a5a5e; stroke-width: 2.6; flex: none; }
.row.muted { color: var(--sec); }
.row.split { justify-content: space-between; }
.row.column { flex-direction: column; align-items: stretch; gap: 10px; }
.row.success { font-weight: 600; }

.row-category.editing { gap: 10px; }
.row-main { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; text-align: left; }
.delete-dot {
  width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; flex: none;
}
.delete-dot .icon { width: 16px; height: 16px; stroke-width: 3; }
.reorder { display: flex; gap: 2px; }

.row-item { min-height: 60px; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-sub { font-size: 14px; color: var(--sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .row-title { font-weight: 500; }
.fav-star { color: #ffd60a; }
.fav-star .icon { width: 15px; height: 15px; fill: currentColor; }
.row-when { color: var(--sec); font-size: 13px; white-space: nowrap; }

.row-setting { min-height: 50px; }
.setting-icon {
  width: 30px; height: 30px; border-radius: 8px; background: #2c2c2e; display: grid; place-items: center; color: var(--green); flex: none;
}
.setting-icon .icon { width: 18px; height: 18px; }
.setting-icon.destructive, .row.destructive { color: var(--red); }
.row.dim { opacity: 0.45; }
.about-row { align-items: flex-start; font-size: 15px; line-height: 1.35; }

/* ---------- badges ---------- */
.badge {
  --badge-color: #8e8e93;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.28), transparent 60%),
    var(--badge-color);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.badge-icon { width: 55%; height: 55%; stroke-width: 2.1; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25)); }
.badge-all { color: #2bd4b4; background: #173a36; box-shadow: none; }
.badge-all .badge-icon { filter: none; }

/* ---------- switches / selects ---------- */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-track {
  position: absolute; inset: 0; border-radius: 31px; background: #39393d; transition: background 0.2s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--green); outline-offset: 2px; }

.inline-select {
  appearance: none; -webkit-appearance: none; background: none; border: 0; color: var(--sec); text-align: right; text-align-last: right;
  font-size: 16px; max-width: 55%; padding: 4px 0;
}
.inline-select option, .type-select option, .overlay-select option { background: #1c1c1e; color: #fff; }

/* ---------- inputs ---------- */
.input {
  width: 100%; min-width: 0; background: transparent; border: 0; outline: none; font-size: 17px; padding: 6px 0; color: var(--text);
}
.input::placeholder, .label-input::placeholder { color: #5a5a5e; }
.input[type="date"] { color-scheme: dark; min-height: 36px; }
.textarea { resize: vertical; min-height: 72px; line-height: 1.35; }
.input-with-btn { display: flex; align-items: center; gap: 6px; width: 100%; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--sec); flex: none; text-decoration: none;
}
.icon-btn:active:not(:disabled) { background: var(--card-press); }
.icon-btn:disabled { opacity: 0.3; }
.icon-btn.accent { color: var(--green); }
.icon-btn.danger { color: var(--red); }
.link-btn { color: var(--green); display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; }
.link-btn.muted { color: var(--sec); }

.title-row .title-input { font-size: 20px; font-weight: 600; }
.badge-slot { display: contents; }

.field-row { position: relative; padding: 10px 16px; display: flex; flex-direction: column; gap: 4px; }
.field-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sec); }
.field-line { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.field-value { flex: 1; min-width: 0; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.field-value.note { white-space: pre-wrap; }
.field-actions { display: flex; gap: 2px; }

.field-editor { position: relative; padding: 8px 16px 10px; display: flex; flex-direction: column; gap: 4px; }
.field-editor-top { display: flex; align-items: center; gap: 8px; }
.label-input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--sec); font-size: 14px; padding: 4px 0;
}
.type-select {
  background: #2c2c2e; border: 0; border-radius: 8px; color: var(--text); font-size: 14px; padding: 6px 8px;
}
.template-row { gap: 8px; }
.add-row { color: var(--green); position: relative; }
.overlay-select { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; font-size: 16px; }

.symbol-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; padding: 14px; position: relative; }
.symbol-cell { aspect-ratio: 1; display: grid; place-items: center; color: var(--sec); border-radius: 50%; }
.symbol-cell .icon { width: 22px; height: 22px; }
.color-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; padding: 14px; justify-items: center; }
.color-cell { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.color-cell.selected { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px #fff; }
.color-cell .icon { stroke-width: 3; width: 18px; height: 18px; }
.preview { display: grid; place-items: center; padding: 4px 0 0; }

/* ---------- detail ---------- */
.detail-header { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; }
.detail-title { margin: 6px 0 0; font-size: 24px; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.detail-sub { margin: 0; color: var(--sec); }

/* ---------- generator ---------- */
.generated { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; padding: 6px 0; user-select: all; -webkit-user-select: all; }
.range { width: 100%; accent-color: var(--green); }
.meter { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.meter-track { height: 6px; background: #2c2c2e; border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--red); border-radius: 3px; transition: width 0.2s; }
.meter-fill[data-level="1"] { background: #ff9f0a; }
.meter-fill[data-level="2"], .meter-fill[data-level="3"] { background: var(--green); }
.meter-label { font-size: 13px; color: var(--sec); min-height: 16px; }

/* ---------- buttons ---------- */
.primary-btn, .secondary-btn {
  width: 100%; min-height: 50px; border-radius: 12px; font-weight: 600; font-size: 17px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.primary-btn { background: var(--green); color: #000; }
.primary-btn.destructive { background: var(--red); color: #fff; }
.primary-btn:disabled { background: #2c2c2e; color: #636366; }
.secondary-btn { background: var(--card); color: var(--green); }
.secondary-btn:disabled { color: #636366; }
.primary-btn:active:not(:disabled), .secondary-btn:active:not(:disabled) { opacity: 0.75; }

.error { color: var(--red); font-size: 14px; margin: 0 4px; }

/* ---------- auth screens ---------- */
.auth-screen {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
}
.auth { width: 100%; max-width: 420px; margin: auto 0; display: flex; flex-direction: column; gap: 16px; text-align: center; }
.auth h1 { margin: 4px 0 0; font-size: 26px; }
.auth-sub { margin: 0; color: var(--sec); font-size: 15px; line-height: 1.4; }
.auth-logo {
  margin: 0 auto; width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center;
  background: linear-gradient(160deg, #143d27, #0b1f14); color: var(--green);
}
.auth-icon { width: 50px; height: 50px; stroke-width: 1.6; }
.form-card { padding: 4px 16px; text-align: left; }
.divider { height: 0.5px; background: var(--sep); }
.auth .meter { text-align: left; }

.splash { height: 100%; display: grid; place-items: center; color: var(--green); }
.splash-icon { width: 64px; height: 64px; }

/* ---------- empty states ---------- */
.empty { text-align: center; color: var(--sec); padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty h3 { color: var(--text); margin: 8px 0 0; font-size: 20px; }
.empty p { margin: 0; max-width: 280px; line-height: 1.4; }
.empty-icon { width: 46px; height: 46px; stroke-width: 1.4; }

/* ---------- sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0); transition: background 0.25s;
  display: flex; align-items: flex-end;
}
.sheet-backdrop.open { background: rgba(0, 0, 0, 0.55); }
.sheet {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  height: calc(100% - var(--safe-top) - 12px);
  background: #000;
  border-radius: 14px 14px 0 0;
  border-top: 0.5px solid var(--sep);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet-header { border-bottom: 0.5px solid var(--sep); background: #0d0d0d; border-radius: 14px 14px 0 0; flex: none; }
.sheet-body {
  flex: 1; overflow-y: auto; padding: 20px 16px calc(32px + var(--safe-bottom));
  padding-left: calc(16px + var(--safe-left)); padding-right: calc(16px + var(--safe-right));
}

/* ---------- action sheet ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 8px calc(8px + var(--safe-bottom));
  animation: fade 0.15s ease-out;
}
.action-sheet { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; animation: rise 0.2s ease-out; }
.action-group { background: rgba(44, 44, 46, 0.98); border-radius: 14px; overflow: hidden; }
.action-header { padding: 14px 16px; text-align: center; font-size: 13px; color: var(--sec); border-bottom: 0.5px solid var(--sep); }
.action-header strong { color: #d1d1d6; font-size: 14px; }
.action-header p { margin: 6px 0 0; }
.action-btn { width: 100%; min-height: 56px; font-size: 19px; color: #0a84ff; }
.action-btn.destructive { color: var(--red); }
.action-btn.bold { font-weight: 600; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px); transform: translate(-50%, 20px);
  background: rgba(58, 58, 60, 0.96); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 60; white-space: nowrap; max-width: 92vw;
  overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .shell { max-width: 700px; margin: 0 auto; border-left: 0.5px solid var(--sep); border-right: 0.5px solid var(--sep); }
}

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

/* ---------- item type picker & card brand ---------- */
.kind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .kind-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kind-tile {
  display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px; text-align: left;
  background: #1c1c1e; color: #fff; border: 1.5px solid transparent; border-radius: 14px; cursor: pointer; font: inherit;
}
.kind-tile .badge { flex: none; }
.kind-tile.selected { border-color: #d63af9; background: #2a1a30; }
.kind-tile:focus-visible { outline: 2px solid #d63af9; outline-offset: 2px; }
.kind-text { display: flex; flex-direction: column; min-width: 0; }
.kind-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.kind-blurb { font-size: 11.5px; color: var(--sec); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.select-input { appearance: none; -webkit-appearance: none; width: 100%; background: transparent; color: inherit; }
.select-input option { background: #1c1c1e; color: #fff; }
.brand-badge {
  flex: none; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 3px 6px; border-radius: 5px;
  color: #fff; background: #48484a; font-style: italic;
}
.brand-visa { background: #1a1f71; }
.brand-mastercard { background: linear-gradient(90deg, #eb001b, #f79e1b); }
.brand-american-express { background: #2e77bb; font-style: normal; }
.brand-discover { background: #ff6000; }
.brand-jcb { background: linear-gradient(90deg, #0e4c96, #e21836, #007b40); }
.brand-diners-club { background: #0079be; }
.brand-unionpay { background: linear-gradient(90deg, #e21836, #00447c, #007b84); }
.select-input {
  background-image: linear-gradient(45deg, transparent 50%, #8e8e93 50%), linear-gradient(135deg, #8e8e93 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px;
}

/* ---------- card-style items ---------- */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.item-card { position: relative; display: block; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; border-radius: 16px; font: inherit; }
.item-card:focus-visible { outline: 2px solid var(--magenta); outline-offset: 3px; }
.item-card:active .face { transform: scale(0.985); }
.card-star { position: absolute; z-index: 5; top: -7px; right: -5px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #1c1c1e; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.face {
  --face-color: #8e8e93;
  position: relative; overflow: hidden; isolation: isolate; color: #fff; display: flex; flex-direction: column;
  width: 100%; aspect-ratio: 85.6 / 53.98; border-radius: 4.2cqw; container-type: inline-size;
  box-shadow: 0 1px 1px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.18), inset 0 -1px 0 rgba(0,0,0,.3);
  transition: transform .12s;
}
/* cqw on the face itself refers to the nearest container: wrap sizes so the face is its own container */
.item-card, .flip-front, .flip-back, .detail-header .face-wrap { container-type: inline-size; }
.face { border-radius: 4.2cqw; }
.face-mini { padding: 5.2cqw 6cqw; }
.face-hero { padding: 5.6cqw 6.4cqw; }
.detail-header > .face, .detail-header > .flip { width: min(100%, 380px); margin: 0 auto 4px; }
.face .face-title { flex: none; font-weight: 700; font-size: max(13px, 4.6cqw); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.face .row-sub { color: rgba(255, 255, 255, 0.82); }
.face-noise {
  position: absolute; inset: 0; z-index: -1; opacity: .22; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 3px);
}
.face-sheen { position: absolute; inset: -50% -30%; z-index: 2; pointer-events: none; mix-blend-mode: soft-light;
  background: linear-gradient(105deg, transparent 35%, rgba(255,120,220,.35) 42%, rgba(120,220,255,.45) 47%, rgba(255,255,170,.4) 52%, transparent 60%);
  transform: translateX(-60%); animation: sheen 7s ease-in-out infinite; will-change: transform; }
@keyframes sheen { 0%, 15% { transform: translateX(-60%); } 55%, 100% { transform: translateX(60%); } }
/* generic */
.face-generic { background: linear-gradient(135deg, color-mix(in srgb, var(--face-color) 92%, #fff 8%), color-mix(in srgb, var(--face-color) 55%, #000 45%)); gap: 6px; aspect-ratio: auto; min-height: 132px; padding: 14px 16px; border-radius: 16px; }
.face-generic .face-top { display: flex; align-items: center; gap: 8px; margin-bottom: auto; }
.face-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.2); }
.face-icon .icon { width: 20px; height: 20px; }
.face-kind { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
/* payment */
.face-payment { background: linear-gradient(135deg, #4a4a4f, #151517); display: grid; grid-template-rows: auto 1fr auto auto auto; }
.face-payment::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,.28), transparent 50%), radial-gradient(90% 70% at 100% 100%, rgba(0,0,0,.35), transparent 60%),
    linear-gradient(115deg, transparent 30%, rgba(255,255,255,.12) 45%, transparent 60%); }
.pay-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pay-top .face-title { letter-spacing: .02em; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.contactless { width: 5.2cqw; min-width: 14px; height: auto; color: rgba(255,255,255,.9); transform: rotate(0deg); flex: none; }
.pay-chip { align-self: center; }
.emv-chip { width: 14.5cqw; min-width: 38px; height: auto; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.emboss { color: #f4f4f4; text-shadow: 0 -1px 0 rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.35), 0 2px 2px rgba(0,0,0,.35); }
.face-number { font-size: max(14px, 6.4cqw); letter-spacing: .09em; white-space: nowrap; margin-top: 1.5cqw; font-family: 'OCR A Std', 'OCR-A', 'Courier New', ui-monospace, monospace; font-weight: 700; }
.pay-valid { display: flex; align-items: center; gap: 1.6cqw; justify-content: center; font-size: max(11px, 3.8cqw); margin: 1cqw 0; }
.pay-valid-k { font-size: max(6px, 1.8cqw); line-height: 1.05; letter-spacing: .05em; opacity: .85; font-family: sans-serif; }
.pay-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.face-holder { font-size: max(11px, 3.9cqw); letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'Courier New', ui-monospace, monospace; font-weight: 700; }
.brand-mark { height: max(18px, 7.5cqw); width: auto; flex: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.pay-visa { background: linear-gradient(135deg, #3d55d6 0%, #1c2a8a 45%, #0d1450 100%); }
.pay-mastercard { background: linear-gradient(135deg, #5c5f66 0%, #2b2d31 50%, #0e0f11 100%); }
.pay-american-express { background: linear-gradient(135deg, #b9c7d3 0%, #7f97ad 40%, #4f6b85 100%); }
.pay-discover { background: linear-gradient(135deg, #ffb36b 0%, #f07a2a 45%, #8e3509 100%); }
.pay-jcb { background: linear-gradient(135deg, #47b38d 0%, #1e7a66 45%, #0b3b48 100%); }
.pay-diners-club { background: linear-gradient(135deg, #a7b4c2 0%, #5f6f80 45%, #263241 100%); }
.pay-unionpay { background: linear-gradient(135deg, #d0505a 0%, #8e2e4a 45%, #22346e 100%); }
.pay-other { background: linear-gradient(135deg, #8a8a90 0%, #4a4a4f 50%, #1d1d20 100%); }
/* back of card */
.face-back { display: flex; flex-direction: column; padding: 0 !important; }
.mag-stripe { height: 19%; margin-top: 7%; background: linear-gradient(180deg, #111 0%, #2a2a2a 50%, #0b0b0b 100%); }
.sig-row { display: flex; align-items: center; gap: 3cqw; margin: 6% 6% 0; }
.sig-strip { flex: 1; height: 9cqw; min-height: 24px; border-radius: 2px; display: flex; align-items: center; padding: 0 2cqw; color: rgba(0,0,0,.45); font-size: max(7px, 2cqw); letter-spacing: .1em;
  background: repeating-linear-gradient(135deg, #f8f5ea 0 4px, #e7e1cf 4px 8px); }
.cvv-box { display: flex; flex-direction: column; align-items: center; background: #fff; color: #111; border-radius: 3px; padding: .8cqw 2.4cqw; font-size: max(12px, 4cqw); font-style: italic; }
.cvv-k { font-size: max(7px, 1.9cqw); font-style: normal; letter-spacing: .08em; color: #555; }
.back-fine { margin: 4% 6% 0; font-size: max(8px, 2.4cqw); line-height: 1.35; opacity: .75; }
.back-brand { margin: auto 6% 5% auto; }
/* flip */
.flip { display: block; padding: 0; border: 0; background: none; cursor: pointer; perspective: 1400px; border-radius: 4.2cqw; font: inherit; color: inherit; }
.flip:focus-visible { outline: 2px solid var(--magenta); outline-offset: 4px; }
.flip-inner { position: relative; display: grid; transition: transform .6s cubic-bezier(.3,.7,.2,1); transform-style: preserve-3d; }
.flip-front, .flip-back { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip-back { transform: rotateY(180deg); }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-hint { text-align: center; font-size: 12px; color: var(--sec); margin: 6px 0 0; }
/* ---------- ID documents ---------- */
.face-id { color: #1d2430; padding: 0 !important; background: linear-gradient(160deg, #f6f3ec, #e4dccb); text-shadow: none; }
.guilloche { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; color: var(--g, rgba(40, 90, 160, .16)); pointer-events: none; }
.id-holo { position: absolute; inset: 0; z-index: 3; pointer-events: none; mix-blend-mode: color-dodge; opacity: .35;
  background: radial-gradient(28cqw 22cqw at 78% 70%, rgba(255,255,255,0) 30%, rgba(160,255,230,.45) 45%, rgba(255,170,240,.45) 55%, rgba(255,255,170,.35) 65%, transparent 75%);
  animation: holo 9s ease-in-out infinite alternate; will-change: transform; }
@keyframes holo { from { transform: translate(-4%, 2%) rotate(-3deg); } to { transform: translate(4%, -2%) rotate(3deg); } }
.id-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2.2cqw 4.4cqw; color: #fff; background: var(--band, linear-gradient(90deg, #22508f, #3c88c4)); }
.id-region { font-size: max(9px, 2.9cqw); font-weight: 800; letter-spacing: .14em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-doc { font-size: max(9px, 2.8cqw); font-weight: 700; letter-spacing: .18em; font-style: italic; white-space: nowrap; }
.id-main { flex: 1; display: flex; gap: 3.4cqw; padding: 2.6cqw 4.4cqw 0; min-height: 0; }
.id-photo { flex: none; width: 23cqw; aspect-ratio: 3 / 4; height: auto; border-radius: 1.2cqw; overflow: hidden; display: grid; place-items: center; align-self: flex-start;
  background: linear-gradient(180deg, #cfd6df, #aeb8c4); color: rgba(30, 40, 60, .45); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.id-photo img, .id-ghost img { width: 100%; height: 100%; object-fit: cover; }
.id-photo img { filter: saturate(.85) contrast(1.05); }
.id-photo-icon { width: 70%; height: 70%; }
.id-ghost { flex: none; width: 11cqw; aspect-ratio: 3 / 4; align-self: flex-end; margin-bottom: 3cqw; border-radius: 1cqw; overflow: hidden; display: grid; place-items: center; opacity: .22; filter: grayscale(1) contrast(.8); mix-blend-mode: multiply; color: #345; }
.id-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .6cqw; }
.face-id .face-title { font-size: max(11px, 3.4cqw); color: #1d2430; opacity: .75; }
.idf { display: flex; flex-direction: column; min-width: 0; line-height: 1.12; }
.idf-row { display: flex; gap: 3cqw; }
.idf-row > .idf { flex: 1 1 0; }
.idf-k { font-size: max(7px, 2cqw); font-variant: small-caps; text-transform: lowercase; letter-spacing: .06em; color: #8a2b2b; font-weight: 700; }
.idf-v { font-size: max(10px, 3.2cqw); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idf.strong .idf-v { font-size: max(11px, 3.8cqw); color: #a01818; }
.idf.warn .idf-v { color: #a01818; }
.idf.mono .idf-v { font-family: ui-monospace, 'Courier New', monospace; }
.id-sig { position: absolute; left: 5cqw; bottom: 2.2cqw; font-family: 'Brush Script MT', 'Segoe Script', cursive; font-size: max(12px, 4.6cqw); color: #1d2a5a; opacity: .75; transform: rotate(-4deg); }
.id-drivers-license { --band: linear-gradient(90deg, #1f4e8c, #2f7fbf 60%, #8cc1e6); --g: rgba(40, 100, 170, .18); }
.id-green-card { background: linear-gradient(160deg, #eef7ec, #cfe6cd 60%, #b9dcc0); --band: linear-gradient(90deg, #2c6e49, #4f9a64); --g: rgba(30, 120, 70, .2); }
.id-green-card .idf-k { color: #2c6e49; }
.id-passport { aspect-ratio: 125 / 88; background: linear-gradient(170deg, #f5efe3, #e9dfcc 70%, #e1d4bd); --band: linear-gradient(90deg, #5a1730, #8e2c46); --g: rgba(140, 50, 80, .16); }
.id-passport .idf-k { color: #6b2138; }
.mrz { display: flex; flex-direction: column; padding: 1.2cqw 4cqw 2.4cqw; background: rgba(255,255,255,.55); font-size: max(7px, 2.75cqw); letter-spacing: .04em; line-height: 1.25; color: #111; white-space: pre; overflow: hidden; font-family: 'OCR B', 'OCR-B', ui-monospace, 'Courier New', monospace; }
.id-ssn { background: linear-gradient(180deg, #fbfcff, #e8eef8); --g: rgba(50, 90, 160, .2); align-items: center; text-align: center; padding: 3cqw 5cqw !important; gap: .8cqw; color: #1b2a4a; }
.id-ssn .guilloche { opacity: .9; }
.ssn-head { display: flex; flex-direction: column; align-items: center; width: 100%; border-bottom: 2px solid rgba(40, 70, 140, .35); padding-bottom: 1.4cqw; }
.ssn-title { font-size: max(12px, 5.2cqw); font-weight: 800; letter-spacing: .2em; color: #1e3f8a; }
.ssn-sub { font-size: max(7px, 2cqw); letter-spacing: .2em; color: #557; }
.id-ssn .ssn-label { font-size: max(9px, 2.6cqw); opacity: .6; }
.ssn-k { font-size: max(7px, 2.1cqw); letter-spacing: .12em; color: #557; }
.ssn-num { font-size: max(16px, 7.4cqw); font-weight: 700; letter-spacing: .14em; color: #a01818; }
.ssn-name { font-size: max(11px, 4.2cqw); font-weight: 700; letter-spacing: .1em; }
.ssn-sig { margin-top: auto; width: 70%; border-top: 1px solid #556; font-size: max(7px, 1.9cqw); letter-spacing: .2em; color: #556; padding-top: .6cqw; }
@media (prefers-reduced-motion: reduce) {
  .face-sheen, .id-holo { animation: none; }
  .flip-inner { transition: none; }
}
/* sort bar */
.sort-bar { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.sort-count { flex: 1; font-size: 13px; color: var(--sec); }
.sort-label { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border-radius: 999px; padding: 6px 12px; color: var(--sec); }
.sort-select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; color: #fff; font: inherit; font-size: 14px; }
.sort-select option { background: #1c1c1e; }
.view-toggle { background: var(--card); border-radius: 999px; width: 34px; height: 34px; }
/* photos */
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.photo-tile { margin: 0; background: var(--card); border-radius: 12px; overflow: hidden; }
.photo-open { display: block; width: 100%; aspect-ratio: 1.45; padding: 0; border: 0; background: #2c2c2e; cursor: zoom-in; }
.photo-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile figcaption { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; font-size: 13px; color: var(--sec); }
.photo-add { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; aspect-ratio: 1.2; border: 1.5px dashed #48484a; border-radius: 12px; color: var(--sec); }
.photo-add-label { font-weight: 600; color: #fff; }
.photo-add-btns { display: flex; gap: 12px; }
.photo-viewer { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.94); display: grid; place-items: center; padding: 56px 12px 24px; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer-close { position: absolute; top: calc(12px + var(--safe-top)); right: 16px; background: none; border: 0; color: var(--green); font: inherit; font-size: 17px; font-weight: 600; }
