:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f7f8fa;
  color: #15171a;
  --blue: #246bfd;
  --blue-pressed: #1657dc;
  --text: #15171a;
  --muted: #737982;
  --line: #e1e4e8;
  --surface: #ffffff;
  --danger: #d83b35;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; background: #f7f8fa; overflow: hidden; }
body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: #f7f8fa; overscroll-behavior-y: none; }
#app { height: 100%; }
body, button, input { font: inherit; }
button { color: inherit; }
button, [role="button"] { touch-action: manipulation; }

.visually-hidden {
  position: fixed; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.shell {
  width: min(100%, 560px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px max(92px, calc(env(safe-area-inset-bottom) + 78px));
  display: grid;
  grid-template-rows: 54px auto minmax(0, 1fr);
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 5;
  height: 54px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.topbar h1 { margin: 0; font-size: 20px; font-weight: 720; letter-spacing: -0.025em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }

.sync-status {
  appearance: none;
  min-height: 30px;
  margin-left: 9px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #69717b;
  font-size: 12px;
  cursor: pointer;
}
.sync-status[data-state="已同步"] { color: #287849; }
.sync-status[data-state="待同步"],
.sync-status[data-state="同步中…"] { color: #946200; }
.sync-status[data-state="离线"],
.sync-status[data-state="需重新解锁"] { color: #8a4a45; }
.sync-status:active { background: #e9ecf1; }

.icon-button,
.row-action,
.text-button,
.site-name,
.detail-copy,
.menu-item,
.tab-button {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.icon-button,
.row-action {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 13px;
}

.icon-button { color: var(--blue); }
.icon-button.add { font-size: 30px; font-weight: 300; line-height: 1; }
.icon-button.more { color: #515761; font-size: 21px; letter-spacing: 2px; padding-bottom: 10px; }
.icon-button:active, .row-action:active { background: #e9ecf1; }
.icon-button svg, .row-action svg { width: 19px; height: 19px; display: block; }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: 46px;
  width: 152px;
  padding: 6px;
  border: 1px solid rgba(19, 24, 32, .11);
  border-radius: 14px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 12px 30px rgba(20,28,40,.14);
  backdrop-filter: blur(16px);
  animation: menu-in .14s ease-out;
}
.menu-item { width: 100%; min-height: 42px; padding: 0 11px; text-align: left; border-radius: 9px; font-size: 15px; }
.menu-item:active { background: #edf0f4; }

.site-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.search-wrap {
  padding: 9px 0 8px;
  border-bottom: 1px solid var(--line);
}
.search-input {
  appearance: none;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 11px;
  outline: 0;
  padding: 0 12px;
  background: #e9ecf1;
  color: var(--text);
  font-size: 16px;
}
.search-input:focus { box-shadow: 0 0 0 2px rgba(36,107,253,.16); }
.search-input::placeholder { color: #858b94; }
.site-item { border-bottom: 1px solid var(--line); }
.site-row {
  min-height: 59px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 39px 39px;
  gap: 1px;
  align-items: center;
}
.site-name {
  min-height: 44px;
  padding: 8px 3px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-name { font-size: 16px; font-weight: 660; letter-spacing: -0.012em; }
.site-name:active { color: var(--blue); }
.row-action { min-width: 39px; color: #626973; }
.row-action.chevron svg { transition: transform .22s cubic-bezier(.2,.75,.25,1); }
.row-action.chevron.expanded svg { transform: rotate(180deg); }

.details {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .24s cubic-bezier(.2,.75,.25,1), opacity .18s ease;
}
.details.open { grid-template-rows: 1fr; opacity: 1; }
.details-inner { min-height: 0; overflow: hidden; }
.details-content { padding: 0 3px 8px; }
.credential-details + .credential-details {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid #eceef1;
}
.credential-number {
  min-height: 23px;
  display: flex;
  align-items: center;
  color: #555c66;
  font-size: 13px;
  font-weight: 650;
}
.detail-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 12px;
}
.detail-copy {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  text-align: left;
}
.detail-copy-full { grid-template-columns: 70px minmax(0,1fr); }
.detail-copy span { color: var(--muted); font-size: 14px; white-space: nowrap; }
.detail-copy strong { overflow: hidden; color: #30343a; font-size: 14px; font-weight: 510; text-overflow: ellipsis; white-space: nowrap; }
.detail-copy:active strong { color: var(--blue); }

.empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  font-size: 15px;
}
.empty button { margin-top: 8px; }

.tabbar {
  position: fixed;
  z-index: 12;
  left: 50%;
  bottom: 0;
  width: min(100%, 560px);
  min-height: calc(64px + env(safe-area-inset-bottom));
  padding: 7px 16px max(7px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  transform: translateX(-50%);
  border-top: 1px solid rgba(23, 28, 36, .1);
  background: rgba(247, 248, 250, .94);
  backdrop-filter: blur(18px);
}
.tab-button {
  min-height: 50px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  border-radius: 12px;
  color: #747a83;
  font-size: 11px;
}
.tab-button svg { width: 22px; height: 22px; }
.tab-button.active { color: var(--blue); }
.tab-button:active { background: #e9ecf1; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  display: grid;
  align-content: center;
  background: #f7f8fa;
}
.auth-box { width: min(100%, 360px); margin: 0 auto; }
.mark {
  width: 50px; height: 50px; margin-bottom: 28px; border-radius: 15px;
  display: grid; place-items: center; background: var(--blue); color: white;
  box-shadow: 0 8px 22px rgba(36,107,253,.2);
}
.mark svg { width: 28px; height: 28px; }
.auth-box h1 { margin: 0 0 8px; font-size: 25px; letter-spacing: -0.03em; }
.auth-box p { margin: 0 0 24px; color: var(--muted); font-size: 15px; line-height: 1.55; }

.field { display: block; margin-bottom: 17px; }
.field > span { display: block; margin: 0 0 7px; color: #555c66; font-size: 14px; font-weight: 560; }
.field em { color: #9398a0; font-style: normal; font-weight: 450; }
.field input {
  appearance: none;
  width: 100%;
  min-height: 48px;
  border: 1px solid #d8dce2;
  border-radius: 12px;
  outline: 0;
  padding: 0 13px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,107,253,.12); }
.field input::placeholder { color: #adb1b8; }

.primary-button,
.secondary-button,
.danger-button {
  appearance: none;
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
}
.primary-button { border: 0; background: var(--blue); color: white; }
.primary-button:active { background: var(--blue-pressed); }
.primary-button:disabled { opacity: .48; cursor: default; }
.secondary-button { border: 1px solid #d6dae0; background: transparent; color: #33383f; }
.danger-button { border: 1px solid rgba(216,59,53,.34); background: transparent; color: var(--danger); }
.text-button { min-height: 44px; padding: 0 8px; color: var(--blue); font-size: 15px; }
.auth-secondary { display: flex; justify-content: center; margin-top: 12px; }

.editor {
  position: fixed;
  z-index: 20;
  inset: 0;
  overflow: hidden;
  background: #f7f8fa;
  animation: editor-in .22s cubic-bezier(.2,.78,.25,1);
}
.editor-inner {
  width: min(100%, 560px);
  height: 100%;
  overflow-y: auto;
  margin: 0 auto;
  padding: max(5px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
}
.editor-bar { height: 46px; display: flex; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 11px; }
.editor-bar h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.editor-bar .text-button:first-child { margin-left: -8px; margin-right: 5px; }
.editor-form { padding: 0 2px; }
.editor .field { margin-bottom: 9px; }
.editor .field > span { margin-bottom: 3px; }
.editor .field input { min-height: 42px; border-radius: 10px; }
.editor-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.credential-editor {
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.credential-editor-head {
  min-height: 29px;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
}
.credential-editor-head strong { font-size: 15px; }
.remove-credential {
  appearance: none;
  min-height: 29px;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
}
.editor .primary-button,
.editor .secondary-button,
.editor .danger-button { min-height: 42px; }
.add-credential { margin: 0 0 9px; }
.form-actions { display: grid; gap: 8px; padding: 3px 0; }
.danger-zone { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 76px));
  transform: translate(-50%, 18px);
  max-width: calc(100vw - 34px);
  padding: 10px 14px;
  border-radius: 11px;
  background: rgba(29,33,39,.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  backdrop-filter: blur(10px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes editor-in { from { transform: translateY(12px); opacity: 0; } }
@keyframes menu-in { from { transform: translateY(-4px) scale(.98); opacity: 0; } }
@media (min-width: 700px) {
  .shell { padding-top: 34px; }
  .editor-inner { padding-top: 34px; }
  .screen { padding-top: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
