/* ---- V9: the Vault home. Division tiles, Most used, a division's list, Sort these, the Division
   picker, the quick login view on a phone, and what Simple view folds away. Quiet Glass tokens
   (quiet-glass.css), light and dark; the division colour is only a dot and an edge, always next
   to the division's name. */

.vd-home { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.vd-home[hidden], .vd-drill[hidden], .vd-most[hidden], .vd-welcome[hidden], .vd-tiles[hidden] { display: none; }
.vd-label { margin: 0 0 10px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------------- the tiles ---------------- */
.vd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.vd-tile {
  --c: #8c9bba;
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 88px; padding: 14px 14px 14px 18px;
  overflow: hidden; border: 0; border-radius: var(--r-lg); background: var(--glass); box-shadow: var(--elevation);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: transform 120ms var(--ease-calm, ease-out), background-color 120ms;
}
.vd-tile::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
.vd-tile:hover { background: var(--raised); }
.vd-tile:active { transform: scale(0.985); }
.vd-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vd-tile.empty { box-shadow: inset 0 0 0 1px var(--line); background: none; }
.vd-tile.empty .vd-tile-name { color: var(--muted); }
.vd-tile-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c, #8c9bba); }
.vd-tile > .vd-tile-dot { display: none; } /* the edge says it on a tile */
.vd-tile-text { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
.vd-tile-name { display: -webkit-box; overflow: hidden; font-size: var(--fs-item, 17px); font-weight: 600; line-height: 22px; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.vd-tile-meta, .vd-tile-tidy { color: var(--muted); font-size: var(--fs-meta, 14px); line-height: 20px; }
.vd-tile-tidy { color: var(--text); font-weight: 500; }
.vd-ring { --size: 40px; }
.vd-ring::before { inset: 4px; }
.vd-ring b { font-size: 12px; }

/* ---------------- Most used ---------------- */
.vd-most-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.vd-use { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 6px 8px 6px 6px; border-radius: var(--r-row, 16px); background: var(--glass); box-shadow: var(--elevation); }
.vd-use-open { display: flex; flex: 1 1 auto; align-items: center; gap: 12px; min-width: 0; min-height: 52px; padding: 4px 8px; border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.vd-use-open:hover { background: var(--raised); }
.vd-use-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vd-use-open .avatar, .vd-use-open .kind-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; }
.vd-use-text { display: flex; flex-direction: column; min-width: 0; }
.vd-use-text b, .vd-use-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-use-text b { font-size: 16px; font-weight: 600; line-height: 22px; }
.vd-use-text small { color: var(--muted); font-size: 13px; line-height: 18px; }
.vd-use .vd-use-copy { flex: none; min-width: 72px; height: 44px; min-height: 44px; }
.vd-use-copy.code { min-width: 104px; }

/* ---------------- the welcome (nothing saved yet) ---------------- */
.vd-welcome { display: flex; flex-direction: column; gap: 10px; padding: 28px 24px; border-radius: var(--r-lg); background: var(--glass); box-shadow: var(--elevation); }
.vd-welcome h3 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 30px; }
.vd-welcome p { max-width: 52ch; margin: 0; }
.vd-welcome .row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.vd-welcome .btn { height: 52px; min-height: 52px; padding: 0 20px; }

/* ---------------- a division's list ---------------- */
.vd-drill { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 20px; }
.vd-drill .vd-back { gap: 6px; height: 44px; min-height: 44px; }
.vd-back svg { width: 18px; height: 18px; transform: scaleX(-1); }
.vd-drill-head { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.vd-drill-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 30px; }
.vd-drill-head small { font-size: var(--fs-meta, 14px); }
.vd-drill-acts .btn { height: 44px; min-height: 44px; }
#vaults-page .head-actions #vd-share, :root[data-view="simple"] #vaults-page .head-actions .btn { height: 44px; min-height: 44px; } /* 44 px targets on his screens */

/* ---------------- Sort these ---------------- */
.vd-sort .panel-inner { gap: 12px; }
:is(.vd-sort, .vd-share-sheet) .panel-head .icon-btn { width: 44px; height: 44px; }
.vd-sort-count { margin: 0; font-size: var(--fs-meta, 14px); }
.vd-sort-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-row, 16px); background: var(--raised); }
.vd-sort-item .avatar, .vd-sort-item .kind-icon { flex: none; width: 48px; height: 48px; border-radius: 14px; font-size: 18px; }
.vd-sort-text { display: flex; flex-direction: column; min-width: 0; }
.vd-sort-text b { overflow: hidden; font-size: 20px; font-weight: 600; line-height: 26px; text-overflow: ellipsis; white-space: nowrap; }
.vd-sort-text small { color: var(--muted); font-size: var(--fs-meta, 14px); }
.vd-sort-ask { margin: 4px 0 0; font-weight: 600; }
.vd-sort-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vd-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.vd-chip small { color: var(--muted); font-size: 12px; font-weight: 500; }
.vd-chip:hover { background: var(--raised); }
.vd-chip[aria-pressed="true"] { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.vd-chip[aria-pressed="true"] small { color: inherit; opacity: 0.8; }
.vd-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- Simple view's Share ---------------- */
:root:not([data-view="simple"]) .vd-simple-only { display: none !important; }
:root[data-view="simple"] #vaults-page #members-btn { display: none !important; } /* Share stands in for it */
.vd-share-sheet .panel-inner { gap: 12px; }
.vd-share-sheet .panel-inner > p { margin: 0; }
.vd-share-list { display: flex; flex-direction: column; gap: 6px; }
.vd-share-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 10px; border: 0; border-radius: var(--r-row, 16px); background: var(--raised); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.vd-share-row:hover { background: var(--glass); box-shadow: var(--elevation); }
.vd-share-row .avatar { flex: none; width: 40px; height: 40px; border-radius: 12px; }
.vd-share-new { display: flex; flex-direction: column; gap: 8px; }
.vd-share-new input { min-height: 52px; }
.vd-share-new .btn { height: 52px; min-height: 52px; }
.vd-label + .vd-share-list, .vd-label + .vd-share-new { margin-top: -4px; }

/* ---------------- phone: a saved login, quick ---------------- */
.vd-quick { display: flex; flex-direction: column; gap: 12px; }
.vd-q-head { display: flex; align-items: center; gap: 14px; }
.vd-q-head .avatar { flex: none; width: 52px; height: 52px; border-radius: 14px; font-size: 20px; }
.vd-q-text { display: flex; flex-direction: column; min-width: 0; }
.vd-q-name { overflow: hidden; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 30px; text-overflow: ellipsis; white-space: nowrap; }
.vd-q-text small { overflow: hidden; color: var(--muted); font-size: var(--fs-meta, 14px); text-overflow: ellipsis; white-space: nowrap; }
.vd-quick :is(.vd-q-copy, .vd-q-more) { width: 100%; height: var(--btn-h-lg, 52px); min-height: 52px; }
.vd-q-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 8px 8px 8px 16px; border-radius: var(--r-row, 16px); background: var(--raised); }
.vd-q-code > div { display: flex; flex-direction: column; }
.vd-q-digits { font-size: 26px; font-weight: 600; letter-spacing: 0.06em; line-height: 32px; font-variant-numeric: tabular-nums; }
.vd-q-code .vd-q-codebtn { flex: none; height: 44px; min-height: 44px; }
#item-panel.vd-compact #item-form > :not(.panel-head, .vd-quick) { display: none !important; }
#item-panel.vd-compact #item-title { visibility: hidden; }

/* ---------------- Simple view: only the overview, search, Add and Share ---------------- */
:root[data-view="simple"] #vaults-page { grid-template-columns: minmax(0, 1fr); }
:root[data-view="simple"] #vaults-page > .sidebar,
:root[data-view="simple"] #vaults-page :is(#import-btn, #activity-btn, #empty-trash-btn, #kind-filter),
:root[data-view="simple"] :is(#import-tab, #export-sheet, #breach-sheet, #sl-sheet),
:root[data-view="simple"] #health-main .vh-status,
:root[data-view="simple"] #travel-sheet:not(:has(#travel-pill:not([hidden]))), /* set-up waits; while it's on, the way off stays */
:root[data-view="simple"] #ea-sheet:not(:has(#ea-received-wrap:not([hidden]))) { display: none !important; }
:root[data-view="simple"] #vaults-page > .main { max-width: 1120px; }

@media (max-width: 760px) {
  .vd-home { gap: 16px; margin-top: 16px; }
  .vd-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .vd-tile { flex-direction: column; align-items: flex-start; gap: 6px; min-height: 104px; padding: 14px 12px 12px 16px; }
  .vd-tile .vd-ring { position: absolute; top: 10px; right: 10px; --size: 34px; }
  .vd-tile .vd-ring b { font-size: 11px; }
  .vd-tile-text { width: 100%; padding-right: 36px; }
  .vd-most-list { grid-template-columns: minmax(0, 1fr); }
  .vd-welcome { padding: 22px 18px; }
  .vd-welcome .btn { flex: 1 1 auto; }
  .vd-drill-title { font-size: 22px; }
  /* Simple view on a phone: search first, then Most used and the tiles; the title waits below */
  :root[data-view="simple"] #vaults-page > .main { display: flex; flex-direction: column; }
  :root[data-view="simple"] #vaults-page > .main > * { order: 3; }
  :root[data-view="simple"] #vaults-page > .main > :is(#travel-banner, #ea-notice, #hp-notice, #hp-line) { order: 0; } /* integration: V11 notices too */
  :root[data-view="simple"] #vaults-page > .main > :is(#search, .vv-search-row) { order: 1; margin-top: 0; } /* integration: V10 puts the search box in a row with the mic */
  :root[data-view="simple"] #vaults-page > .main > #biz-coming { order: 2; } /* integration: V12 "Coming up" sits under the search, above the tiles */
  :root[data-view="simple"] #vaults-page > .main > :is(#vd-home, #vd-drill) { order: 2; }
  :root[data-view="simple"] #vaults-page > .main > .vh-card { order: 4; }
  :root[data-view="simple"] #vaults-page > .main > .main-head { order: 5; margin-top: 24px; }
  :root[data-view="simple"] #vaults-page .main-head h2 { display: none; }
}
@media (prefers-reduced-motion: reduce) { .vd-tile { transition: none; } .vd-tile:active { transform: none; } }

/* ---- UI clean-up */
/* Show everything: the tiles sit inside one vault's page but count every vault, so they say so */
:root[data-view="full"] #vd-home:not([hidden])::before { content: 'Across all your vaults'; display: block; margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* a part-filled ring keeps a faint track, so 50 reads as half, not cut off */
.vd-ring { background: conic-gradient(var(--ok) calc(var(--p) * 1%), color-mix(in srgb, var(--text) 14%, transparent) 0); }
