/* EdgeVault — 界面样式
   浅色为主，跟随系统深色。无外部字体/依赖。 */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d4d7dd;
  --text: #16181d;
  --muted: #6b7280;
  --faint: #9aa1ac;
  --accent: #4f46e5;
  --accent-weak: #eef0ff;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --danger-weak: #fef2f2;
  --ok: #059669;
  --warn: #b45309;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1b202a;
    --border: #262c36;
    --border-strong: #333b47;
    --text: #e8eaee;
    --muted: #9aa3b2;
    --faint: #6b7383;
    --accent: #7c7cff;
    --accent-weak: #1e2033;
    --accent-text: #0e1116;
    --danger: #f87171;
    --danger-weak: #2a1618;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12px; }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }

/* ── 按钮 ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--danger-weak); border-color: var(--danger); }
.btn.block { width: 100%; height: 40px; font-size: 14px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── 输入 ─────────────────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 88px; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
select { cursor: pointer; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field-row { display: flex; gap: 8px; align-items: center; }

/* ── 启动 / 登录 ───────────────────────────────────────────────────────── */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(900px 500px at 12% -10%, var(--accent-weak), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 412px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px 28px 26px;
  box-shadow: var(--shadow-md);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), #8b5cf6);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}
.brand h1 { font-size: 17px; margin: 0; letter-spacing: -0.2px; }
.brand p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.auth h2 { font-size: 20px; margin: 0 0 6px; letter-spacing: -0.3px; }
.auth .lede { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.fineprint { margin: 14px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.6; }
.meter { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin: -6px 0 14px; }
.meter > i { display: block; height: 100%; width: 0; background: var(--danger); transition: width 0.2s, background 0.2s; }
.err {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--danger-weak);
  color: var(--danger);
  font-size: 12.5px;
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}

/* ── 主框架 ───────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 10px;
  min-height: 0;
}
.sidebar .brand { padding: 0 6px; margin-bottom: 14px; }
.sidebar .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.sidebar .brand h1 { font-size: 14px; }
.sidebar .brand p { font-size: 10.5px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.nav-item .glyph { width: 16px; text-align: center; opacity: 0.85; }
.nav-item .count { margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-item.active .count { color: var(--accent); }

.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.nav-scroll { overflow-y: auto; min-height: 0; flex: 1; }
.folder-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--border-strong); flex: none; }
.folder-dot.on { background: var(--accent); }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; display: flex; gap: 6px; }
.sidebar-foot .btn { flex: 1; height: 32px; font-size: 12.5px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.search-wrap { position: relative; flex: 1; max-width: 460px; }
.search-wrap input { height: 36px; padding-left: 34px; background: var(--surface-2); }
.search-wrap .mag {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 13px; pointer-events: none;
}

.panes { display: grid; grid-template-columns: 348px minmax(0, 1fr); flex: 1; min-height: 0; }

.list-pane { border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface); }
.list { padding: 8px; display: flex; flex-direction: column; gap: 2px; }

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
}
.item:hover { background: var(--surface-2); }
.item.active { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex: none;
  letter-spacing: -0.2px;
}
.item-body { min-width: 0; flex: 1; }
.item-name {
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-sub {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item .star { color: var(--warn); font-size: 11px; }

.empty-list { padding: 44px 20px; text-align: center; color: var(--faint); font-size: 13px; }

/* ── 详情 ─────────────────────────────────────────────────────────────── */
.detail-pane { overflow-y: auto; padding: 22px 26px 60px; min-width: 0; }
.empty-state {
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--faint);
  gap: 8px;
}
.empty-state .big { font-size: 34px; opacity: 0.35; }

.detail-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.detail-head .avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 16px; }
.detail-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.3px; word-break: break-word; }
.detail-head .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.detail-actions { display: flex; gap: 6px; margin-left: auto; flex: none; }

.section { margin-bottom: 22px; }
.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.kv {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
}
.kv .k { width: 92px; flex: none; font-size: 12px; color: var(--muted); }
.kv .v { flex: 1; min-width: 0; font-size: 13.5px; word-break: break-all; }
.kv .v.mono { font-family: var(--mono); font-size: 13px; }
.kv .acts { display: flex; gap: 2px; flex: none; }
.notes-box {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.65;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}
.pill.accent { background: var(--accent-weak); border-color: transparent; color: var(--accent); }

/* ── 弹层 ─────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 16, 24, 0.42);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 24px 16px;
  z-index: 60;
  animation: fade 0.14s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 540px;
  max-height: min(86dvh, 780px);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop 0.16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal.wide { max-width: 660px; }
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  gap: 2px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.seg button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.seg button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  background: #111827;
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 90;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* 密码强度条 */
.strength { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.strength .bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.strength .bar > i { display: block; height: 100%; width: 0; transition: width 0.2s, background 0.2s; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* 移动端 */
.menu-btn { display: none; padding: 0 9px; font-size: 16px; }
.only-mobile { display: none; }
.drawer-mask { display: none; }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 264px;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .drawer-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 16, 24, 0.42);
    z-index: 65;
  }
  .panes { grid-template-columns: 1fr; }
  .detail-pane { display: none; }
  .panes.show-detail .list-pane { display: none; }
  .panes.show-detail .detail-pane { display: block; }
  .detail-pane { padding: 16px 16px 80px; }
  .app.detail-open .mobile-bar { display: flex; }
  .menu-btn { display: inline-flex; }
  .only-desktop { display: none; }
  .only-mobile { display: inline; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .search-wrap input { padding-left: 30px; }
}
.mobile-bar { display: none; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
