:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1c1e21;
  --text-2: #65676b;
  --text-3: #8a8d91;
  --line: #dadde1;
  --line-2: #e4e6eb;
  --primary: #1877f2;
  --primary-hover: #166fe5;
  --primary-soft: #e7f3ff;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.02);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.auth-view {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
}

.brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: inline-block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
}

.brand-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.step-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.auth-title {
  font-size: 19px;
  font-weight: 600;
  margin: 12px 0 8px;
}

.auth-desc {
  font-size: 13px;
  color: var(--text-2);
  margin: 0 0 18px;
  line-height: 1.6;
}

.auth-desc code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.field {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid #ccd0d5;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.input::placeholder {
  color: #9aa0a6;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12);
}

#login-totp,
#enroll-code {
  letter-spacing: 0.32em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-size: 17px;
}

.btn {
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-ghost {
  background: #e4e6eb;
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: #d8dade;
}

.btn-block {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.msg {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--danger);
  line-height: 1.5;
}

.msg.ok {
  color: var(--ok);
}

.auth-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
}

.dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 6px;
  vertical-align: 1px;
}

.qr-box {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  min-height: 120px;
  align-items: center;
}

.qr-box svg {
  display: block;
  width: 200px;
  height: 200px;
}

.secret-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 16px;
}

.secret-label {
  font-size: 11.5px;
  color: var(--text-2);
  flex-shrink: 0;
}

.secret-value {
  font-size: 12px;
  letter-spacing: 0.06em;
  word-break: break-all;
  color: var(--text);
  user-select: all;
}

.dropzone {
  border: 1.5px dashed #ccd0d5;
  border-radius: var(--radius);
  padding: 30px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
  outline: none;
}

.dropzone:hover,
.dropzone:focus,
.dropzone.over {
  border-color: var(--primary);
  background: #f7fbff;
}

.dz-icon {
  color: var(--text-3);
  margin-bottom: 10px;
}

.dz-title {
  font-size: 13.5px;
  font-weight: 500;
}

.dz-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.paste-wrap {
  margin-top: 12px;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  padding: 4px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--primary);
}

.paste-box {
  margin-top: 10px;
  text-align: left;
}

.textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  margin-bottom: 8px;
}

.unlock-progress {
  margin-top: 16px;
}

.bar {
  height: 4px;
  background: var(--line-2);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.2s ease;
}

.bar-text {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
}

.app-view {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.topbar-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.topbar-title {
  font-size: 13.5px;
  color: var(--text-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  font-size: 12.5px;
  color: var(--text-2);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 372px 1fr;
  min-height: 0;
}

.list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
}

.search-wrap {
  position: relative;
  padding: 12px 12px 8px;
}

.search-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-40%);
  color: var(--text-3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 18px;
  outline: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.search-input:focus {
  background: #fff;
  border-color: var(--primary);
}

.filters {
  display: flex;
  gap: 6px;
  padding: 0 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  height: 26px;
  padding: 0 11px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover {
  background: var(--line-2);
}

.chip.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(24, 119, 242, 0.25);
  font-weight: 500;
}

.list-meta {
  padding: 0 14px 8px;
  font-size: 11.5px;
  color: var(--text-3);
  border-bottom: 1px solid var(--line-2);
}

.list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.row {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}

.row:hover {
  background: #f2f3f5;
}

.row.active {
  background: var(--primary-soft);
}

.row-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
}

.row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-body {
  min-width: 0;
  flex: 1;
}

.row-name {
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.row-name span {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-3);
}

.row-sub {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-more {
  padding: 12px;
  text-align: center;
}

.detail-pane {
  overflow-y: auto;
  padding: 20px;
  min-height: 0;
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}

.empty-title {
  font-size: 13.5px;
  color: var(--text-2);
}

.empty-sub {
  font-size: 12px;
  margin-top: 4px;
}

.detail-card {
  max-width: 720px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-head {
  display: flex;
  gap: 18px;
  padding: 20px;
  border-bottom: 1px solid var(--line-2);
}

.portrait {
  width: 104px;
  height: 138px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 11.5px;
  text-align: center;
  line-height: 1.4;
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.head-info {
  min-width: 0;
  flex: 1;
  padding-top: 2px;
}

.head-name {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.head-name em {
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
}

.head-id {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.head-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--bg);
  padding: 3px 9px;
  border-radius: 4px;
}

.tag-accent {
  color: var(--primary);
  background: var(--primary-soft);
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.field-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-2);
  min-width: 0;
}

.field-row:nth-child(odd) {
  border-right: 1px solid var(--line-2);
}

.f-key {
  font-size: 11.5px;
  color: var(--text-3);
}

.f-val {
  font-size: 13.5px;
  margin-top: 2px;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

.f-val.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.detail-foot {
  padding: 12px 20px;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 880px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 46% 54%;
  }

  .list-pane {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .detail-pane {
    padding: 12px;
  }

  .fields {
    grid-template-columns: 1fr;
  }

  .field-row:nth-child(odd) {
    border-right: none;
  }

  .user-chip {
    display: none;
  }
}
