/* Vowed Vault: iOS system look (grouped lists, large titles, bottom tab bar).
   The layout copies the 1Password iOS structure. The colours are the iOS system palette, not a vendor brand. */

:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --bg-plain: #ffffff;
  --card: #ffffff;
  --card-pressed: #e5e5ea;
  --label: #000000;
  --secondary: #6c6c70;
  --tertiary: #aeaeb2;
  --separator: rgba(60, 60, 67, 0.22);
  --fill: rgba(118, 118, 128, 0.12);
  --accent: #007aff;
  --danger: #ff3b30;
  --warn: #ff9500;
  --ok: #34c759;
  --bar: rgba(249, 249, 249, 0.86);
  --backdrop: rgba(0, 0, 0, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: calc(50px + var(--safe-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-plain: #000000;
    --card: #1c1c1e;
    --card-pressed: #2c2c2e;
    --label: #ffffff;
    --secondary: #98989f;
    --tertiary: #636366;
    --separator: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --accent: #0a84ff;
    --danger: #ff453a;
    --warn: #ff9f0a;
    --ok: #30d158;
    --bar: rgba(22, 22, 24, 0.86);
    --backdrop: rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--label); }
body { overscroll-behavior-y: none; font-size: 17px; line-height: 1.29; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.small { width: 16px; height: 16px; }
.icon.fill { fill: currentColor; stroke: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- app frame */
#app, .app { height: 100%; }
.app { display: flex; flex-direction: column; position: relative; overflow: hidden; }
.screen { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(var(--tabbar-h) + 24px); }
.screen.plain { background: var(--bg-plain); }

/* ---------------------------------------------------------------- nav bar + large title */
.navbar { position: sticky; top: 0; z-index: 5; background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); padding-top: var(--safe-top); }
.navbar-row { display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 12px; gap: 8px; }
.navbar-side { display: flex; align-items: center; gap: 14px; min-width: 64px; }
.navbar-side.right { justify-content: flex-end; }
.navbar-title { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navbar-btn { color: var(--accent); display: inline-flex; align-items: center; gap: 2px; min-height: 44px; }
.navbar-btn:disabled { color: var(--tertiary); }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: 0.37px; padding: 2px 16px 8px; display: flex; align-items: center; gap: 10px; }
.navbar.hairline { box-shadow: 0 0.5px 0 var(--separator); }

.account-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.account-btn .avatar { width: 30px; height: 30px; font-size: 14px; }
.account-btn .account-name { font-weight: 600; font-size: 15px; }

.fake-chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: 0.4px; color: #fff; background: var(--warn); border-radius: 6px; padding: 2px 6px; text-transform: uppercase; white-space: nowrap; }

/* ---------------------------------------------------------------- avatars */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; color: #fff; font-weight: 600; font-size: 16px; flex: none; }
.avatar.lg { width: 72px; height: 72px; border-radius: 17px; font-size: 32px; }
.hue-0 { background: #e0533d; } .hue-1 { background: #e98b2a; } .hue-2 { background: #d4a72c; }
.hue-3 { background: #4caf50; } .hue-4 { background: #1ea896; } .hue-5 { background: #1f9bd1; }
.hue-6 { background: #3b6fd8; } .hue-7 { background: #5b5bd6; } .hue-8 { background: #8e4ec6; }
.hue-9 { background: #c2419b; } .hue-10 { background: #7a7a80; } .hue-11 { background: #a0673c; }

/* ---------------------------------------------------------------- plain list (Items) */
.list { background: var(--bg-plain); }
.section-header { position: sticky; top: 0; z-index: 1; padding: 4px 16px; font-size: 15px; font-weight: 600; color: var(--secondary); background: var(--bg); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 16px; min-height: 56px; text-align: left; background: var(--bg-plain); position: relative; }
.row::after { content: ""; position: absolute; left: 64px; right: 0; bottom: 0; height: 0.5px; background: var(--separator); }
.row:active { background: var(--card-pressed); }
.row-text { flex: 1; min-width: 0; }
.row-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 14px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row-accessory { display: flex; align-items: center; gap: 6px; color: var(--tertiary); flex: none; }
.wallet-tag { font-size: 12px; color: var(--secondary); border: 0.5px solid var(--separator); border-radius: 5px; padding: 1px 5px; }
.star { color: var(--warn); }
.icon.dots { stroke-width: 3.4; }

.list-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 10px; gap: 10px; }
.filter-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 15px; font-weight: 600; min-height: 32px; }
.count { color: var(--secondary); font-size: 15px; }

/* ---------------------------------------------------------------- grouped (inset) lists */
.group { margin: 0 16px 24px; }
.group-title { display: flex; align-items: baseline; justify-content: space-between; font-size: 20px; font-weight: 700; margin: 0 4px 8px; }
.group-title.small { font-size: 13px; font-weight: 400; text-transform: uppercase; color: var(--secondary); letter-spacing: 0.2px; }
.group-title .navbar-btn { font-size: 15px; font-weight: 400; min-height: 0; }
.group-body { background: var(--card); border-radius: 10px; overflow: hidden; }
.group-foot { font-size: 13px; color: var(--secondary); margin: 7px 16px 0; }
.cell { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 16px; text-align: left; position: relative; background: var(--card); }
.cell + .cell::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 0.5px; background: var(--separator); }
.cell.with-avatar + .cell.with-avatar::before { left: 64px; }
button.cell:active { background: var(--card-pressed); }
.cell-text { flex: 1; min-width: 0; }
.cell-label { font-size: 13px; color: var(--secondary); }
.cell-value { font-size: 17px; overflow-wrap: anywhere; }
.cell-main { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-detail { color: var(--secondary); font-size: 17px; white-space: nowrap; }
.cell-accessory { color: var(--tertiary); display: flex; align-items: center; gap: 8px; }
.cell.destructive { color: var(--danger); justify-content: center; }
.cell.action { color: var(--accent); }
.cell.disabled { color: var(--tertiary); }
.cell .check { color: var(--accent); }

/* ---------------------------------------------------------------- banners */
.banner { display: flex; gap: 10px; align-items: flex-start; margin: 0 16px 16px; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: var(--card); }
.banner .icon { width: 18px; height: 18px; margin-top: 1px; }
.banner.warn { background: rgba(255, 149, 0, 0.15); color: var(--label); }
.banner.warn .icon { color: var(--warn); }
.banner.error { background: rgba(255, 59, 48, 0.12); }
.banner.error .icon { color: var(--danger); }
.banner.info .icon { color: var(--accent); }
.banner-title { font-weight: 600; }

/* ---------------------------------------------------------------- empty states */
.empty-state { text-align: center; color: var(--secondary); padding: 48px 32px; }
.empty-state .icon { width: 44px; height: 44px; color: var(--tertiary); margin-bottom: 10px; }
.empty-state .empty-title { font-size: 20px; font-weight: 600; color: var(--label); margin-bottom: 6px; }
.skeleton { height: 56px; margin: 0 16px 8px; border-radius: 10px; background: var(--fill); }

/* ---------------------------------------------------------------- search */
.search-wrap { padding: 0 16px 10px; display: flex; gap: 8px; align-items: center; }
.search-field { flex: 1; display: flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 10px; padding: 0 8px; height: 36px; color: var(--secondary); }
.search-field input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--label); min-width: 0; height: 100%; }
.search-field input::placeholder { color: var(--secondary); }
.scope-pill { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; border-radius: 18px; background: var(--fill); color: var(--accent); font-size: 15px; font-weight: 600; white-space: nowrap; }
.scope-pill.active { background: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--card); font-size: 15px; }
.chip.token { background: var(--accent); color: #fff; }
.chip .chip-count { color: var(--secondary); }
.chip.token .chip-count { color: rgba(255, 255, 255, 0.8); }
.hint { font-size: 13px; color: var(--secondary); padding: 0 20px 12px; }
.hint code { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: var(--fill); padding: 1px 4px; border-radius: 4px; }
.result-group-title { font-size: 13px; text-transform: uppercase; color: var(--secondary); padding: 14px 20px 6px; letter-spacing: 0.2px; }
mark { background: transparent; color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- item detail */
.detail-header { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 16px 20px; text-align: center; }
.detail-title { font-size: 24px; font-weight: 700; }
.detail-meta { display: flex; align-items: center; gap: 8px; color: var(--secondary); font-size: 14px; }
.field { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; min-height: 58px; text-align: left; position: relative; background: var(--card); }
.field + .field::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 0.5px; background: var(--separator); }
.field:active { background: var(--card-pressed); }
.field-main { flex: 1; min-width: 0; }
.field-label { font-size: 13px; color: var(--accent); }
.field-value { font-size: 17px; overflow-wrap: anywhere; font-variant-ligatures: none; }
.field-value.masked { letter-spacing: 2px; color: var(--secondary); }
.field-value.mono, .otp-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.field-value.note { white-space: pre-wrap; }
.field-actions { display: flex; align-items: center; gap: 4px; color: var(--accent); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 20px; color: var(--accent); }
.icon-btn:active { background: var(--fill); }
.otp-code { font-size: 22px; letter-spacing: 1px; }
.otp.expiring .otp-code { color: var(--danger); }
.otp-ring { width: 26px; height: 26px; }
.otp-ring circle { fill: none; stroke-width: 3; }
.otp-ring .track { stroke: var(--fill); }
.otp-ring .progress { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.otp.expiring .otp-ring .progress { stroke: var(--danger); }
.revealed-note { font-size: 12px; color: var(--secondary); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; }
.tag { font-size: 13px; background: var(--fill); border-radius: 6px; padding: 3px 8px; color: var(--secondary); }
.readonly-note { text-align: center; font-size: 13px; color: var(--secondary); margin: 0 24px 24px; }

/* ---------------------------------------------------------------- large type */
.large-type { position: absolute; inset: 0; z-index: 40; background: var(--bg-plain); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); }
.lt-chars { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 100%; }
.lt-char { display: flex; flex-direction: column; align-items: center; min-width: 38px; padding: 6px 4px 4px; border-radius: 8px; background: var(--card); }
.lt-glyph { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 40px; line-height: 1.1; }
.lt-index { font-size: 11px; color: var(--secondary); }
.lt-char.digit .lt-glyph { color: var(--accent); }
.lt-char.symbol .lt-glyph { color: var(--danger); }
.lt-caption { margin-top: 20px; color: var(--secondary); font-size: 14px; text-align: center; }

/* ---------------------------------------------------------------- tab bar */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; height: var(--tabbar-h); padding-bottom: var(--safe-bottom); display: flex; background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 -0.5px 0 var(--separator); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 500; color: var(--tertiary); }
.tab .icon { width: 26px; height: 26px; }
.tab.selected { color: var(--accent); }

/* ---------------------------------------------------------------- clipboard bar + toast */
.clipboard-bar { position: absolute; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 10px); z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); }
.clipboard-bar .icon { color: var(--warn); }
.clipboard-bar .cb-text { flex: 1; min-width: 0; font-size: 14px; }
.clipboard-bar .cb-title { font-weight: 600; }
.clipboard-bar .cb-sub { color: var(--secondary); font-size: 13px; }
.btn-small { color: var(--accent); font-weight: 600; font-size: 15px; padding: 6px 4px; }
.toast { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 54px); z-index: 45; background: rgba(40, 40, 42, 0.92); color: #fff; padding: 8px 14px; border-radius: 18px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.toast .icon { color: var(--ok); width: 18px; height: 18px; }

/* ---------------------------------------------------------------- sheets */
.sheet-backdrop { position: absolute; inset: 0; z-index: 30; background: var(--backdrop); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 88%; overflow-y: auto; background: var(--bg); border-radius: 12px 12px 0 0; padding: 6px 0 calc(16px + var(--safe-bottom)); }
.sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--tertiary); margin: 0 auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 16px 12px; }
.sheet-title { font-size: 17px; font-weight: 600; }
.sheet .group { margin-bottom: 16px; }
.sheet-note { font-size: 13px; color: var(--secondary); padding: 0 20px 12px; }

/* ---------------------------------------------------------------- lock screen */
.lock-screen { position: absolute; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(24px + var(--safe-top)) 32px calc(32px + var(--safe-bottom)); text-align: center; }
.lock-icon { width: 96px; height: 96px; border-radius: 22px; }
.lock-title { font-size: 28px; font-weight: 700; }
.lock-sub { color: var(--secondary); font-size: 15px; max-width: 300px; }
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 240px; height: 50px; padding: 0 20px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 600; }
.btn-primary:disabled { opacity: 0.5; }
.lock-status { min-height: 40px; font-size: 15px; color: var(--secondary); }
.lock-status.error { color: var(--danger); }
.lock-foot { position: absolute; bottom: calc(18px + var(--safe-bottom)); left: 0; right: 0; font-size: 12px; color: var(--secondary); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- privacy cover (app switcher) */
.privacy-cover { position: absolute; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--secondary); }
.privacy-cover img { width: 72px; height: 72px; }

/* ---------------------------------------------------------------- settings switches */
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill); position: relative; flex: none; margin: 0; transition: background 0.2s; }
.switch::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.2); transition: transform 0.2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }
.reorder { display: flex; gap: 2px; }
.reorder .icon-btn { width: 32px; height: 32px; }
