/* kith: design tokens first, then layout, components and views. Inline
   style attributes are blocked by the CSP, so every look lives here. */

:root {
  --bg: #fafaf9;
  --panel: #ffffff;
  --sunken: #f5f5f4;
  --hover: #f0efed;
  --fg: #1c1917;
  --muted: #6f6762;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --accent-soft: #eaf1ff;
  --link: #1d4ed8;
  --warn-bg: #fef3c7;
  --warn-fg: #8a3c0c;
  --info-bg: #eff6ff;
  --info-fg: #1e40af;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #15803d;
  --digit: #1d4ed8;
  --sym: #c2410c;
  --star: #d97706;
  --shadow: 0 12px 40px rgb(28 25 23 / 0.16);
  --shadow-sm: 0 1px 2px rgb(28 25 23 / 0.08);

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141210;
    --panel: #1d1a18;
    --sunken: #181614;
    --hover: #26231f;
    --fg: #ece9e6;
    --muted: #a8a29e;
    --line: #33302c;
    --line-strong: #46413c;
    --accent: #3b82f6;
    --accent-fg: #ffffff;
    --accent-soft: #1d2940;
    --link: #93b4fb;
    --warn-bg: #3b2408;
    --warn-fg: #fcd34d;
    --info-bg: #172036;
    --info-fg: #93c5fd;
    --danger: #f87171;
    --danger-bg: #2a1414;
    --ok: #4ade80;
    --digit: #93c5fd;
    --sym: #fdba74;
    --star: #f59e0b;
    --shadow: 0 12px 40px rgb(0 0 0 / 0.5);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141210;
  --panel: #1d1a18;
  --sunken: #181614;
  --hover: #26231f;
  --fg: #ece9e6;
  --muted: #a8a29e;
  --line: #33302c;
  --line-strong: #46413c;
  --accent: #3b82f6;
  --accent-fg: #ffffff;
  --accent-soft: #1d2940;
  --link: #93b4fb;
  --warn-bg: #3b2408;
  --warn-fg: #fcd34d;
  --info-bg: #172036;
  --info-fg: #93c5fd;
  --danger: #f87171;
  --danger-bg: #2a1414;
  --ok: #4ade80;
  --digit: #93c5fd;
  --sym: #fdba74;
  --star: #f59e0b;
  --shadow: 0 12px 40px rgb(0 0 0 / 0.5);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
code, pre, kbd, .value, .mono { font-family: var(--mono); font-size: 13px; }
pre { margin: 0; white-space: pre-wrap; word-break: break-all; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -0.015em; margin: 0 0 var(--s4); }
h2 { font-size: 16px; margin: var(--s6) 0 var(--s2); letter-spacing: -0.005em; }
h3 { font-size: 14px; margin: var(--s4) 0 var(--s2); }
p { margin: 0 0 var(--s3); }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted, .meta { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); }
.wrap { word-break: break-all; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The page index.html shows until the app draws: it fades in only after a
   moment, so a fast load doesn't flash it. */
.splash {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  animation: splash-in 0.3s ease-out 0.3s both;
}
/* The outline keeps the dark tile visible on a dark page. */
.splash img { width: 56px; height: 56px; border-radius: 13px; box-shadow: 0 0 0 1px var(--line); }
.splash-name { font-size: 20px; font-weight: 600; letter-spacing: 0.01em; color: var(--fg); }
.splash-bar { position: relative; width: 120px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.splash-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: 3px;
  background: var(--accent);
  animation: splash-slide 1.2s ease-in-out infinite;
}
.splash-noscript { position: fixed; inset: auto 0 24px; text-align: center; color: var(--muted); }
@keyframes splash-in { from { opacity: 0; } }
@keyframes splash-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
  .splash { animation: none; }
  .splash-bar::after { animation: none; width: 100%; opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- forms */

input, select, textarea, button, .button { font: inherit; border-radius: var(--r); }
input, select, textarea {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--fg);
  padding: 7px 10px;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="range"] { padding: 0; border: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
label { display: block; }

/* In a row (a flex container) .grow takes the free space, so the row's
   actions end up at its end. Rows may tune it. */
.grow { flex: 1; min-width: 0; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 36px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
}
button:hover, .button:hover { filter: brightness(1.07); }
button:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
/* A running action shows in the button, not the cursor: the button often
   disappears when the action is done (unlocking redraws the page), and
   browsers keep the cursor of what was under it until the mouse moves. */
button[aria-busy="true"] { cursor: default; }
button[aria-busy="true"]::after {
  content: "";
  width: 0.8em;
  height: 0.8em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button[aria-busy="true"]::after { animation: none; } }
button.secondary, .button.secondary {
  background: var(--panel);
  color: var(--fg);
  border-color: var(--line-strong);
}
button.secondary:hover, .button.secondary:hover { background: var(--hover); filter: none; }
button.small, a.small, .button.small { min-height: 28px; padding: 0 10px; font-size: 13px; }
button.danger, .button.danger { background: none; color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger-bg); filter: none; }
button.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
button.ghost { background: none; border-color: transparent; color: var(--fg); }
button.ghost:hover { background: var(--hover); filter: none; }

.icon-btn {
  min-height: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: none;
  color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--fg); filter: none; }
.icon-btn .icon { width: 17px; height: 17px; }
.icon-btn.on { color: var(--star); }

/* ---------------------------------------------------------------- app shell */

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--sunken);
  border-right: 1px solid var(--line);
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 1000px; margin: 0 auto; padding: 28px 32px 56px; }
main.narrow { max-width: 560px; }

.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--fg); text-decoration: none; }
.brand img { width: 26px; height: 26px; }
.search-btn {
  justify-content: flex-start;
  width: 100%;
  background: var(--panel);
  border-color: var(--line-strong);
  color: var(--muted);
  font-weight: 400;
}
.search-btn:hover { background: var(--panel); border-color: var(--muted); filter: none; }
.search-btn span { flex: 1; text-align: left; }

.side-section { display: flex; flex-direction: column; gap: 1px; }
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.side-head a { color: inherit; text-decoration: none; }
.side-head a:hover { color: var(--fg); }
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--r);
  color: var(--fg);
  text-decoration: none;
}
.nav:hover { background: var(--hover); }
.nav.on { background: var(--accent-soft); font-weight: 600; }
.nav .icon { color: var(--muted); }
.nav.on .icon { color: var(--fg); }
.nav .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .count { font-size: 12px; color: var(--muted); font-weight: 400; }
.nav .icon.star { color: var(--star); }
.nav .icon.warn { color: var(--warn-fg); }
.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  line-height: 18px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.warn { background: var(--star); }
.dot.info { background: var(--accent); }
.dot.danger { background: var(--danger); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--line); padding-top: 10px; }
.me { display: flex; align-items: center; gap: 8px; padding: 10px 6px 0 10px; }
.me .who { flex: 1; min-width: 0; line-height: 1.25; }
.me .who strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { font-size: 12px; color: var(--muted); }
.me .avatar { width: 30px; height: 30px; margin: 0; }
.version { font-size: 11px; color: var(--muted); padding: 8px 10px 0; }
.version code { font-size: 11px; }

.topbar { display: none; }
.scrim { display: none; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.18s ease-out;
    box-shadow: var(--shadow);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(12 10 9 / 0.35); }
  .topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 8px 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand { flex: 1; }
  main { padding: 20px 16px 48px; }
}

/* ---------------------------------------------------------------- banners & badges */

.banner {
  display: flex;
  gap: var(--s3);
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  margin: 0 0 var(--s3);
}
.banner > .icon { width: 18px; height: 18px; }
.banner .grow { flex: 1; min-width: 12rem; }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: transparent; }
.banner.info { background: var(--info-bg); color: var(--info-fg); border-color: transparent; }
.banner.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.content > .banner { margin: 12px 16px 0; }
p.warn, div.warn { padding: 8px 12px; border-radius: var(--r); background: var(--warn-bg); color: var(--warn-fg); }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info-fg); border-color: transparent; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  line-height: 20px;
}
a.tag:hover { color: var(--fg); border-color: var(--muted); }
.tag.inherited { border-style: dashed; background: none; }
p.tags, .tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.tag button.x { min-height: 0; background: none; border: none; color: inherit; padding: 0; font-size: 14px; line-height: 1; }

.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.tile::before { content: attr(data-initials); }
.tile.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }
.tile.sm { width: 26px; height: 26px; border-radius: 7px; font-size: 11px; }
.c0 { background: #0f766e; }
.c1 { background: #6d28d9; }
.c2 { background: #be185d; }
.c3 { background: #b45309; }
.c4 { background: #0369a1; }
.c5 { background: #4d7c0f; }
.c6 { background: #57534e; }
.c7 { background: #c2410c; }

/* Profile photos (served by kith) or initials drawn from data-initials. */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 6px;
  flex: none;
}
.avatar.initials { color: #fff; font-size: 10px; font-weight: 600; line-height: 1; }
.avatar.initials::before { content: attr(data-initials); }
.with-avatar { white-space: nowrap; }
td.with-avatar { white-space: normal; }

/* ---------------------------------------------------------------- menus, tabs, dialogs, toast */

.menu-wrap { position: relative; display: inline-flex; }
.menu {
  position: fixed;
  z-index: 20;
  min-width: 200px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.menu[hidden] { display: none; }
.menu button {
  justify-content: flex-start;
  min-height: 34px;
  border: 0;
  background: none;
  color: var(--fg);
  font-weight: 400;
  padding: 0 10px;
  border-radius: var(--r-sm);
}
.menu button:hover, .menu button:focus-visible { background: var(--hover); filter: none; outline: none; }
.menu button.danger { color: var(--danger); }
.menu .icon { color: var(--muted); }
.menu button.danger .icon { color: var(--danger); }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 0 0 var(--s4); overflow-x: auto; }
.tab {
  min-height: 0;
  padding: 10px 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.tab:hover { color: var(--fg); filter: none; }
.tab.on { color: var(--fg); border-bottom-color: var(--accent); }
.tab .count { color: var(--muted); font-weight: 400; margin-left: 4px; }

dialog.ask {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--fg);
  padding: 20px 20px 16px;
  width: min(30rem, calc(100% - 2rem));
  box-shadow: var(--shadow);
}
dialog.ask::backdrop { background: rgb(12 10 9 / 0.4); }
dialog.ask h2 { margin: 0 0 8px; font-size: 17px; }
dialog.ask .dialog-body { margin: 0 0 12px; white-space: pre-line; color: var(--muted); }
dialog.ask label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 8px);
  z-index: 100;
  background: var(--fg);
  color: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  max-width: calc(100% - 2rem);
  box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }
.toast-text { display: block; padding: 10px 16px; }
.toast-drain { display: block; height: 3px; background: var(--accent); transform-origin: left; animation: drain 3s linear forwards; }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------------------------------------------------------------- generic layout helpers */

.stack { display: flex; flex-direction: column; gap: 10px; }
.row-gap { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: var(--s3); align-items: center; margin-bottom: var(--s4); flex-wrap: wrap; }
.toolbar h1 { margin: 0; }
.toolbar input[type="search"] { flex: 1; min-width: 12rem; width: auto; }
.toolbar select { width: auto; }
.toolbar.spaced { margin-top: var(--s4); }
.actions { display: flex; gap: var(--s3); align-items: center; margin: var(--s4) 0; flex-wrap: wrap; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.card-pad { padding: var(--s4) 18px; }
.page-head { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.page-head h1 { margin: 0; flex: 1; min-width: 10rem; }
.lede { color: var(--muted); max-width: 46rem; }
label.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
label.inline select { width: auto; min-width: 12rem; }
label.check { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-lg); margin: 12px 0; padding: 8px 16px; }
.scroll { overflow-x: auto; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain > li:not([class]) { padding: 3px 0; }
ul.attachments li { word-break: break-all; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); }
div.row-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
div.row-actions select { width: auto; min-height: 30px; font-size: 13px; }
.nowrap, table.admin-table th { white-space: nowrap; }
td select { width: auto; }

details { margin: 12px 0; }
details.group { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 16px; background: var(--panel); }
details.group > input { margin: 8px 0; }
summary { cursor: pointer; }
.checks { columns: 2; margin: 8px 0; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 48px 16px; color: var(--muted); }
.empty-state .empty-icon { display: inline-flex; width: 52px; height: 52px; align-items: center; justify-content: center; border-radius: 14px; background: var(--sunken); border: 1px solid var(--line); color: var(--fg); margin-bottom: 6px; }
.empty-state .empty-icon .icon { width: 24px; height: 24px; }
.empty-state .empty-title { color: var(--fg); font-weight: 600; font-size: 15px; margin: 0; }
.empty-state p { margin: 0; max-width: 28rem; }
.empty-state .row-gap { margin-top: 10px; justify-content: center; }

button.id {
  min-height: 0;
  background: none;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 400;
  border-radius: 5px;
}
button.id:hover { color: var(--fg); border-color: var(--muted); filter: none; }

/* ---------------------------------------------------------------- item list + detail */

main.split { max-width: none; padding: 0; display: flex; align-items: stretch; height: 100vh; }
.pane-list {
  width: clamp(340px, 28vw, 500px);
  flex: none;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--panel);
  min-height: 0;
}
.pane-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.pane-title { display: flex; align-items: center; gap: 8px; }
.pane-title h2 { margin: 0; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-title .button { min-height: 32px; padding: 0 12px; }
.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--muted);
}
.searchbox:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.searchbox input { border: 0; background: none; padding: 7px 0; outline: none; }
.list-tools { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.list-tools select { width: auto; min-height: 0; padding: 2px 6px; font-size: 12px; border-color: var(--line); background: var(--panel); color: var(--muted); }
.list-tools .grow { flex: 1; }
.pane-scroll { flex: 1; overflow-y: auto; min-height: 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
button.chip {
  min-height: 0;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 12.5px;
  font-weight: 400;
}
button.chip:hover { background: var(--hover); filter: none; }
button.chip .count { color: var(--muted); margin-left: 4px; font-size: 11.5px; }
button.chip.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
button.chip.active .count { color: inherit; opacity: 0.75; }
.chips .label { color: var(--muted); font-size: 12px; }

.items { list-style: none; margin: 0; padding: 6px; }
.items li.row { position: relative; display: flex; align-items: center; border-radius: 10px; }
.items li.row:hover { background: var(--hover); }
.items li.row.selected { background: var(--accent-soft); }
.items li.row > a {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  color: var(--fg);
  text-decoration: none;
}
.items .row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.items .title { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.items .title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.items .row-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.items .row-tags .tag { font-size: 11px; line-height: 17px; padding: 0 6px; }
.items .quick {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  padding-left: 8px;
  border-radius: var(--r);
  background: var(--hover);
  box-shadow: -12px 0 12px -4px var(--hover);
  opacity: 0;
  transition: opacity 0.12s;
}
.items li.row.selected .quick { background: var(--accent-soft); box-shadow: -12px 0 12px -4px var(--accent-soft); }
.items li.row:hover .quick, .items li.row:focus-within .quick { opacity: 1; }
.items li.row > a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.starred-mark { display: inline-flex; color: var(--star); flex: none; }
.starred-mark .icon { width: 12px; height: 12px; fill: currentColor; }
.items .empty { padding: 32px 16px; color: var(--muted); text-align: center; list-style: none; }

.pane-detail { flex: 1; min-width: 0; overflow-y: auto; background: var(--bg); }
.pane-detail > article, .pane-detail > .detail-inner { max-width: 1120px; padding: 24px 32px 56px; }

/* Plain list rows (vaults, trash) */
ul.items.boxed { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); padding: 4px; }
ul.items li:not(.row) > a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; color: var(--fg); text-decoration: none; flex-wrap: wrap; border-radius: 10px; }
ul.items li:not(.row) > a:hover { background: var(--hover); }
.items li.row > .row-actions { display: flex; gap: 6px; padding: 0 12px; align-self: center; }

@media (max-width: 860px) {
  main.split { height: auto; min-height: calc(100vh - 53px); }
  .pane-list { width: 100%; border-right: 0; }
  .pane-detail { overflow: visible; }
  main.split.has-item .pane-list { display: none; }
  main.split:not(.has-item) .pane-detail { display: none; }
  .pane-detail > article, .pane-detail > .detail-inner { padding: 16px 16px 48px; }
  .items .quick { opacity: 1; }
}
@media (min-width: 861px) { .only-narrow { display: none !important; } }

/* Item detail */
.detail-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.detail-head .grow { flex: 1; min-width: 0; }
.detail-head h1 { margin: 2px 0 0; overflow-wrap: anywhere; }
.crumbs { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.detail-head .tags { margin-top: 8px; }
.detail-actions { display: flex; gap: 4px; align-items: center; }
.detail-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: var(--s4); }
.section { margin-top: var(--s5); }

button.star { min-height: 0; background: none; border: none; color: var(--muted); padding: 0; }
button.star .icon { width: 18px; height: 18px; }
button.star.on { color: var(--star); }
button.star.on .icon { fill: currentColor; }
button.star:hover { filter: none; color: var(--star); }
.items .quick button.star { width: 32px; height: 32px; border-radius: var(--r); }
.items .quick button.star .icon { width: 16px; height: 16px; }

.payload { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.field { display: flex; gap: 12px; align-items: center; padding: 8px 8px 8px 16px; min-height: 44px; flex-wrap: wrap; }
.payload .field + .field { border-top: 1px solid var(--line); }
.payload .field:hover { background: var(--sunken); }
.field > label { width: 8.5rem; color: var(--muted); flex-shrink: 0; font-size: 12.5px; }
.field .value { flex: 1; min-width: 10rem; word-break: break-all; font-size: 14px; }
.field .value.plain-text { font-family: var(--font); }
.field .masked { letter-spacing: 0.12em; color: var(--muted); }
.field .totp { font-size: 20px; font-weight: 500; letter-spacing: 0.04em; flex: none; min-width: 0; }
.field .controls { display: flex; gap: 2px; margin-left: auto; }
.field .ring { width: 22px; height: 22px; }
.field .ring circle { fill: none; stroke-width: 2.5; }
.field .ring .track { stroke: var(--line); }
.field .ring .left { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.9s linear; }
.field .ring.low .left { stroke: var(--danger); }
.field .secs { font-size: 12px; color: var(--muted); font-family: var(--font); }
.totp-wrap { flex: 1; display: flex; align-items: center; gap: 10px; }
.ch-d { color: var(--digit); }
.ch-s { color: var(--sym); }

.notes-block { white-space: pre-wrap; font-family: var(--font); font-size: 14px; word-break: break-word; }

.attachments-list { display: flex; flex-direction: column; gap: 6px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.file-row .grow { flex: 1; min-width: 0; word-break: break-all; }

/* Large type */
dialog.large {
  border: 0;
  border-radius: 16px;
  background: var(--panel);
  color: var(--fg);
  padding: 24px 28px;
  max-width: min(960px, calc(100% - 2rem));
  box-shadow: var(--shadow);
  text-align: center;
}
dialog.large::backdrop { background: rgb(12 10 9 / 0.6); }
.large-chars { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-family: var(--mono); }
.large-chars span { display: inline-flex; flex-direction: column; align-items: center; min-width: 36px; padding: 6px 2px; border-radius: var(--r); background: var(--sunken); }
.large-chars b { font-size: 36px; line-height: 1.1; font-weight: 500; }
.large-chars i { font-size: 10px; color: var(--muted); font-style: normal; font-family: var(--font); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: flex; gap: 12px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; }
.timeline .rail .avatar { margin: 0; width: 28px; height: 28px; }
.timeline .rail::after { content: ""; flex: 1; width: 2px; background: var(--line); margin: 4px 0; }
.timeline > li:last-child .rail::after { display: none; }
.timeline .body { flex: 1; min-width: 0; padding-bottom: 16px; }
.timeline .when { color: var(--muted); font-size: 12.5px; }
.diff { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.diff .d { display: flex; gap: 8px; align-items: baseline; }
.diff .sign { width: 14px; font-family: var(--mono); font-weight: 600; }
.diff .add .sign { color: var(--ok); }
.diff .del .sign { color: var(--danger); }
.diff .chg .sign { color: var(--sym); }
.diff .lbl { width: 8rem; color: var(--muted); flex: none; }
.diff .txt { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.events li.unread { font-weight: 600; }

/* ---------------------------------------------------------------- editor */

form.editor { max-width: 860px; display: flex; flex-direction: column; gap: 18px; }
.editor-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.editor-head h1 { margin: 0; flex: 1; }
.vault-pick { display: flex; align-items: center; gap: 8px; }
.vault-pick select { width: auto; min-width: 10rem; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.templates a.tpl {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
}
.templates a.tpl:hover { border-color: var(--muted); }
.templates a.tpl.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.templates a.tpl .muted { font-size: 12px; }
input.title-input { font-size: 22px; font-weight: 600; padding: 8px 10px; border-color: transparent; background: none; letter-spacing: -0.01em; }
input.title-input:hover { border-color: var(--line-strong); }

.fields-edit { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.field-item + .field-item { border-top: 1px solid var(--line); }
.field-edit { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 4px; flex-wrap: wrap; }
.field-edit.tall { align-items: flex-start; }
.field-edit.dragging { opacity: 0.5; }
.field-edit .grip { color: var(--muted); cursor: grab; display: inline-flex; padding: 0 2px; }
.field-edit input.label { width: 9.5rem; flex: none; font-size: 13px; color: var(--muted); }
.field-edit select.type { width: auto; flex: none; font-size: 13px; padding: 6px 28px 6px 8px; background-position: right 7px center; }
.field-edit .value { flex: 1 1 14rem; width: auto; }
.field-edit textarea.value { min-height: 6rem; }
.field-edit .remove { margin-left: auto; }
.totp-preview { font-size: 15px; color: var(--fg); min-width: 4.5rem; }
.totp-preview.error { color: var(--danger); font-family: var(--font); font-size: 12px; }
.fields-foot { padding: 10px 12px; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .field-edit input.label { flex: 1 1 8rem; width: auto; }
  .field-edit .value { flex-basis: 100%; }
}

.gen { margin: 0 12px 12px 40px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--sunken); display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.segmented { display: inline-flex; align-self: flex-start; padding: 3px; border-radius: var(--r); background: var(--hover); }
.segmented .seg { min-height: 28px; border: 0; background: none; color: var(--muted); padding: 0 12px; border-radius: 6px; font-weight: 500; }
.segmented .seg[aria-pressed="true"] { background: var(--panel); color: var(--fg); box-shadow: var(--shadow-sm); }
.segmented .seg:hover { filter: none; color: var(--fg); }
.gen-preview { font-size: 16px; padding: 10px 12px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); word-break: break-all; }
.gen-strength { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.gen-meter { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.gen-meter span { display: block; height: 100%; background: var(--ok); width: 0; transition: width 0.15s; }
.gen-meter[data-level="weak"] span { background: var(--danger); }
.gen-meter[data-level="fair"] span { background: var(--star); }
.gen-row { display: flex; align-items: center; gap: 10px; }
.gen-row input { flex: 1; }
.gen-len-label { width: 4rem; font-size: 13px; }
.gen-len { width: 2rem; text-align: right; }
.gen-actions { justify-content: flex-end; }

.stack-label { display: flex; flex-direction: column; gap: 6px; }
.stack-label .eyebrow { margin: 0; }
.small-print { font-size: 12.5px; margin: 0; }
.dropzone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  cursor: pointer;
  color: var(--fg);
}
.dropzone:hover, .drop-on .dropzone { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-row.pending { color: var(--muted); }

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  margin-top: 4px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.save-note { flex: 1; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.save-note.on::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--star); }
kbd.on-accent { background: none; color: inherit; border-color: rgb(255 255 255 / 0.45); opacity: 0.9; }

.field-row { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
.tag-edit {
  flex: 1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--panel);
  padding: 4px 6px;
}
.tag-edit:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.tag-edit input { border: none; flex: 1; min-width: 10rem; width: auto; padding: 3px; outline: none; }
.preview { padding: 12px 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); }
.preview .added { color: var(--ok); font-weight: 600; }
.preview .removed { color: var(--danger); margin-top: 4px; }
.preview .warn { margin-top: 8px; }

.pane-head > div:empty, .chips:empty { display: none; }
.side-head .icon-btn { width: 22px; height: 22px; }
.side-head .icon-btn .icon { width: 14px; height: 14px; }
a.scope-warn { text-decoration: none; margin: 0; font-size: 13px; padding: 8px 10px; }
.back-link { margin-bottom: 12px; }
a.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 640px) {
  .field { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px; padding: 10px 8px 10px 14px; }
  .field > label { width: auto; grid-column: 1; }
  .field .value, .field .totp-wrap { grid-column: 1; min-width: 0; }
  .field .controls { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .detail-head { flex-wrap: wrap; }
  .detail-head .grow { flex: 1 1 200px; }
  .detail-actions { width: 100%; justify-content: flex-end; }
}
@media (max-width: 640px) { kbd.on-accent { display: none; } }

/* ---------------------------------------------------------------- command palette */

dialog.palette {
  margin: 12vh auto auto;
  width: min(640px, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--fg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
dialog.palette::backdrop { background: rgb(12 10 9 / 0.38); }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-search .icon { width: 18px; height: 18px; }
input.palette-input { border: 0; background: none; font-size: 16px; padding: 4px 0; outline: none; color: var(--fg); }
input.palette-input:focus { outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: min(420px, 60vh); overflow-y: auto; }
.palette-head { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.palette-row { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: var(--r); cursor: pointer; }
.palette-row.on { background: var(--accent-soft); }
.palette-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-title { font-weight: 500; }
.palette-row .muted { font-size: 12.5px; }
.palette-icon { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--sunken); color: var(--muted); flex: none; }
.palette-hint { font-size: 12px; color: var(--muted); white-space: nowrap; }
.palette-empty { padding: 16px 10px; }
.palette-foot { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.palette-foot kbd { margin-right: 2px; }
table.keys td { border: 0; padding: 5px 8px 5px 0; }
table.keys td:first-child { white-space: nowrap; color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- vaults */

.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 8px; }
.vault-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; color: var(--fg); text-decoration: none; min-height: 150px; }
a.vault-card:hover { border-color: var(--muted); box-shadow: var(--shadow-sm); }
.vault-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.vault-name { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.vault-icon { display: inline-flex; width: 32px; height: 32px; border-radius: 9px; align-items: center; justify-content: center; background: var(--sunken); border: 1px solid var(--line); color: var(--fg); flex: none; }
.vault-icon.lg { width: 52px; height: 52px; border-radius: 14px; }
.vault-icon.lg .icon { width: 24px; height: 24px; }
.health-line { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; }
.health-line .icon { width: 14px; height: 14px; }
.health-line.ok { color: var(--ok); }
.health-line.warn { color: var(--warn-fg); }
.health-line.info { color: var(--info-fg); }
.health-line.danger { color: var(--danger); }
.new-vault { border-style: dashed; background: none; }
.new-vault .muted { font-size: 12.5px; }
.new-vault button { align-self: flex-start; }

.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { margin: 0 0 0 -6px; border: 2px solid var(--panel); width: 28px; height: 28px; box-sizing: content-box; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar.more { background: var(--sunken); color: var(--muted); font-size: 11px; font-weight: 600; }
.vault-head .avatar-stack .avatar { border-color: var(--bg); }

.vault-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 6px 0 20px; }
.vault-head .grow { flex: 1; min-width: 14rem; }
.vault-head h1 { margin: 0; }
.vault-head p { margin: 2px 0 0; }
.vault-head .tags { margin-top: 8px; }
main > .crumbs { margin-bottom: 8px; }

.health { overflow: hidden; margin-bottom: 20px; }
.health-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.health-head.warn { background: var(--warn-bg); color: var(--warn-fg); }
.health-head.info { background: var(--info-bg); color: var(--info-fg); }
.health-head .icon { width: 18px; height: 18px; }
.health-list { list-style: none; margin: 0; padding: 0; }
.health-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.health-row .grow { flex: 1 1 18rem; min-width: 0; }
.health-title { font-weight: 600; }
.issue-icon { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; flex: none; }
.issue-icon .icon { width: 15px; height: 15px; }
.issue-icon.warn { background: var(--warn-bg); color: var(--warn-fg); }
.issue-icon.info { background: var(--info-bg); color: var(--info-fg); }
.issue-icon.danger { background: var(--danger-bg); color: var(--danger); }

table.members { border-collapse: separate; border-spacing: 0; overflow: hidden; }
table.members td { border-bottom: 1px solid var(--line); padding: 10px 14px; }
table.members tr:last-child td { border-bottom: 0; }
table.members td.person { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
table.members td.person .avatar { width: 34px; height: 34px; margin: 0; }
table.members .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
table.members .name { font-weight: 500; }
.small { font-size: 12.5px; }
.role-pill { display: inline-block; font-size: 12px; padding: 1px 10px; border-radius: 999px; border: 1px solid var(--line-strong); text-transform: capitalize; }
.role-pill.owner { background: var(--fg); color: var(--bg); border-color: var(--fg); }
/* Controls in a row are small, like the row's small buttons; pills are
   only for labels (.role-pill, .badge). */
select.role-select { width: auto; min-height: 28px; padding: 0 26px 0 10px; font-size: 13px; }
td.actions-cell { text-align: right; width: 1%; white-space: nowrap; }

.picker h3, .pending h3, .groups h3, .card h3 { margin: 0 0 8px; }
.picker-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; margin: 8px 0 12px; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r); cursor: pointer; }
.picker-row:hover { background: var(--hover); }
.picker-row .avatar { margin: 0; }
.picker .row-gap select { width: auto; }
.pending-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.pending-row .avatar { margin: 0; }
.groups .row-gap select { width: auto; }

.danger-zone { border-color: var(--danger); overflow: hidden; }
.danger-zone h3 { margin: 0; padding: 12px 16px; background: var(--danger-bg); color: var(--danger); }
.danger-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.danger-row .grow { flex: 1 1 16rem; }
/* The control at a row's end has a fixed width, so the rows line up. */
.danger-row > button, .danger-row > select { flex: 0 0 13rem; }
/* A field with its button: the button has a fixed width, so fields line up
   across cards whatever the label. */
.field-row > :not(button) { flex: 1; min-width: 0; }
.field-row > button { flex: 0 0 9rem; }

dialog.progress { width: min(26rem, calc(100% - 2rem)); }
.progress-bar { display: block; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 8px 0 10px; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* ---------------------------------------------------------------- sign in, set up, unlock */

.auth { display: grid; grid-template-columns: min(640px, 45%) minmax(0, 1fr); min-height: 100vh; }
.auth-side { min-width: 0; padding: 56px 56px 32px; background: var(--sunken); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 24px; }
.auth-side h1 { font-size: 30px; line-height: 1.2; letter-spacing: -0.02em; margin: 0; max-width: 28rem; }
.auth-side > p { max-width: 30rem; margin: 0; }
.auth-foot { margin-top: auto !important; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.auth-foot code { font-size: 11px; word-break: break-all; }
.auth-main { min-width: 0; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.auth-card h2 { margin: 0; font-size: 24px; letter-spacing: -0.015em; }
.auth-card p { margin: 0; }
.auth-icon { display: inline-flex; width: 64px; height: 64px; border-radius: 18px; align-items: center; justify-content: center; background: var(--panel); border: 1px solid var(--line); color: var(--accent); box-shadow: var(--shadow-sm); }
.auth-icon .icon { width: 28px; height: 28px; }
.auth-avatar .avatar { width: 64px; height: 64px; margin: 0; font-size: 20px; }
button.wide, .button.wide { width: 100%; min-height: 46px; font-size: 15px; }
.other-keys { display: flex; flex-direction: column; gap: 6px; }
.other-keys .eyebrow { margin: 6px 0 0; }
details.lost { margin: 6px 0 0; color: var(--muted); }
details.lost p { margin: 8px 0; }
.auth-links { font-size: 13px; color: var(--muted); }
.mini-steps { margin: 0; padding-left: 20px; font-size: 13px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; max-width: 30rem; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps p { margin: 2px 0 0; font-size: 13px; }
.step-dot { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; border: 1.5px solid var(--line-strong); color: var(--muted); }
.steps li.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.now .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps li.done .step-dot .icon { width: 15px; height: 15px; stroke-width: 2.6; }
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-side { padding: 28px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-side h1 { font-size: 22px; }
  .auth-side .steps { display: none; }
}

/* ---------------------------------------------------------------- activity */

.day { margin-bottom: 18px; }
.day h2.eyebrow { margin: 0 0 8px; }
ul.activity { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.activity-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.activity-row + .activity-row { border-top: 1px solid var(--line); }
.activity-row.unread { background: var(--accent-soft); font-weight: 400; }
.activity-row .avatar { width: 32px; height: 32px; margin: 0; }
.activity-row .grow { flex: 1; min-width: 0; }
.activity-row .when { font-size: 12px; white-space: nowrap; }
.activity-row .verb.warn { color: var(--warn-fg); }
.activity-row .verb.danger { color: var(--danger); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.activity-row.unread .unread-dot { background: var(--accent); }

/* ---------------------------------------------------------------- settings */

.settings { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.settings-nav { flex: 0 0 180px; position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav .nav { border: 0; background: none; justify-content: flex-start; font-weight: 400; min-height: 34px; }
.settings-nav .nav:hover { filter: none; }
.settings-body { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.settings-section { scroll-margin-top: 24px; padding-bottom: 12px; }
.settings-section h2 { margin: 12px 0 10px; font-size: 18px; }
.key-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.key-words { font-size: 20px; font-weight: 600; letter-spacing: 0.01em; display: flex; flex-wrap: wrap; gap: 6px; }
.key-words .dotsep { color: var(--muted); font-weight: 400; }
/* The same look as on Settings, where the other person reads them. */
.dialog-body .key-words { margin: 4px 0 6px; color: var(--fg); font-weight: 600; white-space: normal; }
.dialog-body .key-fp { display: block; margin-bottom: 12px; }
.dialog-body .export-pass-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.dialog-body .export-pass { flex: 1; min-width: 0; padding: 10px 12px; border-radius: var(--r); background: var(--sunken); border: 1px solid var(--line); color: var(--fg); font-size: 14px; word-break: break-word; white-space: normal; user-select: all; }
code.inline { padding: 1px 5px; border-radius: 4px; background: var(--sunken); border: 1px solid var(--line); color: var(--fg); white-space: nowrap; }
code.pubkey { flex: 1; min-width: 12rem; font-size: 12px; color: var(--muted); }
ul.passkeys { margin-bottom: 12px; }
li.passkey { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
li.passkey + li.passkey { border-top: 1px solid var(--line); }
li.passkey .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
li.passkey .when { white-space: nowrap; }
.settings-card { overflow: hidden; }
.setting { display: flex; align-items: center; gap: 16px; padding: 14px 18px; flex-wrap: wrap; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting .grow { flex: 1 1 16rem; }
.setting-title { font-weight: 500; }
.setting select { width: auto; }
code.hash { display: block; padding: 10px 12px; border-radius: var(--r); background: var(--sunken); border: 1px solid var(--line); margin-bottom: 8px; }
.export-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.export-row .stack-label { flex: 1 1 14rem; }
.export > .muted:not(:empty) { display: block; margin-top: 8px; }
@media (max-width: 860px) { .settings-nav { display: none; } }

input.switch {
  appearance: none;
  width: 40px;
  height: 24px;
  border-radius: 12px;
  border: 0;
  padding: 0;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex: none;
}
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(16px); }
input.switch:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------------- trash, admin */

ul.trash li.row > a { padding: 10px 12px; }
ul.trash .badge { margin-left: auto; }
ul.items.boxed li.row + li.row { border-top: 1px solid var(--line); border-radius: 0; }
table.admin-table th, table.admin-table td { padding: 10px 14px; }
table.admin-table tr:last-child td { border-bottom: 0; }
table.admin-table td.person { display: flex; align-items: center; gap: 10px; }
table.admin-table td.person .avatar { margin: 0; width: 30px; height: 30px; }
table.admin-table .who { display: flex; flex-direction: column; }
tr.is-disabled td { opacity: 0.6; }
details.group { padding: 0; }
details.group summary { padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-weight: 500; }
details.group summary .avatar-stack { margin-left: auto; }
details.group summary .avatar { width: 22px; height: 22px; font-size: 9px; }
details.group[open] summary { border-bottom: 1px solid var(--line); }
.group-body { padding: 12px 16px 0; }
details.group .actions { padding: 0 16px 12px; margin: 8px 0 0; }
.checks { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2px 16px; }
label.check.picker-row { align-items: center; }

/* Sidebar: the vault list scrolls on its own so the footer stays in view. */
.sidebar { overflow-y: auto; }
/* Vaults and tags each keep their heading and scroll their own list, so
   both stay in view however many there are. They shrink in proportion
   down to a few rows each; only below that does the sidebar scroll. */
.sidebar .side-scroll { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.side-scroll > .side-section { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.side-tags .side-list { max-height: 40vh; }
.sidebar > :not(.side-scroll) { flex-shrink: 0; }
.side-list { position: relative; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin-right: -6px; padding-right: 6px; }
.side-tags .nav.depth-1 { padding-left: 26px; }
.side-tags .nav.depth-2 { padding-left: 42px; }
.side-tags .nav.depth-3 { padding-left: 58px; }
.side-tags .nav.depth-4 { padding-left: 74px; }
.side-tags .nav .icon { width: 14px; height: 14px; }
.tag-tools { display: inline-flex; }

/* Selects look like the other inputs. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
  min-height: 36px;
  cursor: pointer;
}
select.role-select { background-position: right 7px center; }
.list-tools select { padding-right: 22px; background-position: right 5px center; background-size: 12px; min-height: 0; }
td.with-avatar.nowrap { white-space: nowrap; }
.starred-mark[hidden] { display: none; }

/* Tag suggestions under a tag input */
.tag-field { position: relative; flex: 1; min-width: 0; }
.tag-field .tag-edit { width: 100%; }
.tag-suggest {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 220px;
  max-width: 100%;
  max-height: 260px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.tag-suggest[hidden] { display: none; }
.tag-suggest li { padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.tag-suggest li:hover, .tag-suggest li.on { background: var(--accent-soft); }
.field-edit.tall .grip { padding-top: 9px; }
/* Nothing open: the hint sits in the middle of the pane, a little high. */
.pane-detail > .detail-inner.detail-empty { max-width: none; min-height: 100%; display: flex; align-items: center; justify-content: center; padding-bottom: 12vh; }

/* Fold toggles on sidebar section headings */
.side-title { display: inline-flex; align-items: center; gap: 2px; margin-left: -6px; }
button.side-toggle {
  min-height: 0;
  padding: 2px 4px 2px 2px;
  gap: 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  border-radius: var(--r-sm);
}
button.side-toggle:hover { color: var(--fg); filter: none; }
button.side-toggle .icon { width: 12px; height: 12px; transition: transform 0.12s; }
.side-head.folded button.side-toggle .icon { transform: rotate(-90deg); }
.side-list[hidden] { display: none; }

/* A narrow item pane (beside a wide sidebar and list, or on a phone):
   tile and actions share the top row with the title under them, and
   field controls sit beside the value, as on phones. */
.pane-detail { container-type: inline-size; }
@container (max-width: 560px) {
  .pane-detail > article, .pane-detail > .detail-inner { padding: 18px 18px 48px; }
  .detail-head { flex-wrap: wrap; row-gap: 10px; }
  .detail-head .grow { order: 3; flex: 1 1 100%; }
  .detail-actions { width: auto; margin-left: auto; }
  .field { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px; padding: 10px 8px 10px 14px; }
  .field > label { width: auto; grid-column: 1; }
  .field .value, .field .totp-wrap { grid-column: 1; min-width: 0; }
  .field .controls { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* Sidebar folded to a rail of icons (wide screens only). */
.side-top .brand { margin-right: auto; }
.side-top { gap: 2px; }
@media (max-width: 860px) { .rail-btn { display: none; } }
@media (min-width: 861px) {
  .app.rail .sidebar { width: 60px; padding: 14px 8px 12px; overflow-x: hidden; }
  .app.rail .side-top { flex-direction: column; gap: 8px; padding: 2px 0; }
  .app.rail .side-top .brand { margin: 0; font-size: 0; gap: 0; }
  .app.rail .search-btn { justify-content: center; padding: 0; }
  .app.rail .search-btn span, .app.rail .search-btn kbd { display: none; }
  .app.rail .side-categories, .app.rail .side-scroll, .app.rail .version, .app.rail .me .who { display: none; }
  .app.rail .nav { justify-content: center; padding: 0; position: relative; }
  .app.rail .nav .grow { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .app.rail .nav .count { display: none; }
  .app.rail .nav .pill { position: absolute; top: 1px; right: 1px; font-size: 10px; line-height: 15px; padding: 0 5px; }
  .app.rail .me { flex-direction: column; padding: 10px 0 0; gap: 6px; }
}
