/* ============ 基础 ============ */
:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7ec;
  --border-strong: #d5d8e0;
  --text: #171a21;
  --text-2: #4b5162;
  --muted: #8b91a1;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --success: #059669;
  --success-soft: #ecfdf5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow: 0 4px 16px rgba(17, 24, 39, .07);
  --shadow-lg: 0 18px 48px rgba(17, 24, 39, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;
}

* { 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.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #d8dbe3;
  border-radius: 6px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #c2c6d1; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 启动占位 ============ */
.boot {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  color: var(--muted);
  z-index: 50;
}
.boot-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 通用控件 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 36px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s, box-shadow .16s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, .3);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #b9b6e8; box-shadow: none; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-2);
}
.btn-ghost:hover { background: #f2f3f7; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn-soft:hover { background: #e3e8ff; }
.btn-block { width: 100%; height: 40px; font-size: 14px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  transition: background .16s, color .16s;
}
.icon-btn:hover { background: #eceef3; color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.field {
  display: block;
  margin-bottom: 14px;
}
.field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field > span em {
  font-style: normal;
  color: var(--muted);
  font-weight: 400;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.field textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field input::placeholder,
.field textarea::placeholder { color: #b3b8c4; }

.field-row {
  position: relative;
  display: flex;
  align-items: center;
}
.field-row input { padding-right: 42px; }
.eye {
  position: absolute;
  right: 4px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.eye:hover { background: #f0f1f5; color: var(--text-2); }
.eye svg { width: 17px; height: 17px; }

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

.code-input {
  font-family: var(--mono);
  font-size: 22px !important;
  letter-spacing: .42em;
  text-align: center;
  height: 52px !important;
}

/* ============ 登录页 ============ */
.auth {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 12% -10%, #e7e9ff 0%, transparent 60%),
    radial-gradient(700px 460px at 96% 108%, #e6f4ff 0%, transparent 62%),
    var(--bg);
  overflow: auto;
}
.auth-card {
  display: grid;
  grid-template-columns: 340px 400px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .7);
  max-width: 100%;
}
.auth-brand {
  padding: 44px 34px;
  background: linear-gradient(160deg, #4f46e5 0%, #4338ca 55%, #3730a3 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  right: -140px;
  bottom: -150px;
}
.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.brand-logo svg { width: 26px; height: 26px; }
.auth-brand h1 {
  font-size: 23px;
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: .5px;
}
.brand-sub {
  margin: 0 0 26px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, .8);
}
.brand-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, .86);
  position: relative;
  z-index: 1;
}
.brand-points li { display: flex; align-items: center; gap: 9px; }
.brand-points span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a5b4fc;
  flex: none;
  box-shadow: 0 0 0 3px rgba(165, 180, 252, .22);
}
.auth-panel { padding: 38px 36px 32px; }
.auth-tabs {
  display: flex;
  gap: 4px;
  background: #f1f2f6;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 26px;
}
.auth-tabs button {
  flex: 1;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: all .16s;
}
.auth-tabs button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.auth-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}
.totp-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.totp-badge {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.totp-head h3 { margin: 1px 0 3px; font-size: 15px; font-weight: 600; }
.totp-head p { margin: 0; font-size: 12.5px; color: var(--muted); }

.strength {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: -8px 0 14px;
}
.strength i {
  height: 3px;
  flex: 1;
  background: var(--border);
  border-radius: 2px;
  transition: background .2s;
}
.strength span {
  font-size: 11.5px;
  color: var(--muted);
  min-width: 34px;
  text-align: right;
}
.strength[data-level="1"] i:nth-child(1) { background: #ef4444; }
.strength[data-level="2"] i:nth-child(-n+2) { background: #f59e0b; }
.strength[data-level="3"] i:nth-child(-n+3) { background: #10b981; }
.strength[data-level="4"] i { background: #059669; }

/* ============ 主界面 ============ */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.topbar {
  height: 58px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 9px; flex: none; }
#btn-menu { display: none; }
#btn-menu svg { width: 19px; height: 19px; }
.sidebar-backdrop {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(23, 26, 33, .38);
  z-index: 19;
}
.sidebar-backdrop.show { display: block; }
.brand-mini {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(140deg, #6366f1, #4338ca);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-mini svg { width: 17px; height: 17px; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: .2px; }

.searchbox {
  flex: 1;
  max-width: 460px;
  position: relative;
  display: flex;
  align-items: center;
}
.searchbox svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.searchbox input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 33px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  outline: none;
  transition: all .16s;
}
.searchbox input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .1);
}
.searchbox kbd {
  position: absolute;
  right: 9px;
  font-family: var(--font);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0 5px;
  line-height: 16px;
  background: #fff;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: none;
}
.topbar-right .btn-primary { margin-left: 6px; }

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

/* 侧栏 */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.side-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px;
  margin: 0 0 8px;
}
.cat {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 9px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-2);
  text-align: left;
  transition: background .14s, color .14s;
}
.cat:hover { background: #f3f4f8; color: var(--text); }
.cat.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 500; }
.cat svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.cat .cat-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cat.active .cat-count { color: var(--primary); }
.side-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 6px;
}
.side-footer {
  margin-top: auto;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, #818cf8, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  flex: none;
  text-transform: uppercase;
}
.side-user { min-width: 0; flex: 1; }
.side-user strong {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user span { font-size: 11.5px; color: var(--muted); }

/* 列表面板 */
.list-pane {
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.list-head {
  height: 46px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.list-head h2 { font-size: 13.5px; font-weight: 600; margin: 0; }
.count {
  font-size: 11.5px;
  color: var(--muted);
  background: #eceef3;
  border-radius: 20px;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
.item-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s;
  margin-bottom: 2px;
}
.item:hover { background: #fff; border-color: var(--border); }
.item.active {
  background: #fff;
  border-color: #c7cdf5;
  box-shadow: 0 1px 3px rgba(79, 70, 229, .1);
}
.item-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex: none;
  text-transform: uppercase;
}
.item-body { min-width: 0; flex: 1; }
.item-title {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}
.item-title .star { color: #f59e0b; font-size: 11px; }
.item-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.item-copy {
  opacity: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: opacity .14s, background .14s;
}
.item:hover .item-copy, .item.active .item-copy { opacity: 1; }
.item-copy:hover { background: var(--primary-soft); color: var(--primary); }
.item-copy svg { width: 15px; height: 15px; }

.empty {
  padding: 46px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty strong {
  display: block;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

/* 详情面板 */
.detail-pane {
  background: var(--surface);
  overflow-y: auto;
  min-height: 0;
}
.detail-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  padding: 40px;
  text-align: center;
}
.detail-empty svg { width: 44px; height: 44px; opacity: .35; }
.detail-empty p { margin: 0; font-size: 13px; }

.detail-head {
  padding: 26px 28px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.detail-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 600;
  color: #fff;
  flex: none;
  text-transform: uppercase;
}
.detail-title { min-width: 0; flex: 1; padding-top: 2px; }
.detail-title h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  word-break: break-word;
}
.detail-title .meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f2f6;
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11.5px;
  color: var(--text-2);
}
.detail-actions { display: flex; gap: 6px; flex: none; }

.detail-body { padding: 8px 28px 40px; }
.detail-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #f0f1f5;
}
.detail-row:last-child { border-bottom: none; }
.detail-row > .k {
  font-size: 12.5px;
  color: var(--muted);
}
.detail-row > .v {
  font-size: 13.5px;
  word-break: break-all;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-row .v.mono { font-family: var(--mono); letter-spacing: .2px; }
.detail-row .v a { color: var(--primary); text-decoration: none; }
.detail-row .v a:hover { text-decoration: underline; }
.detail-row .row-actions { display: flex; gap: 4px; }
.detail-row .row-actions .icon-btn { width: 30px; height: 30px; }
.detail-row .row-actions .icon-btn svg { width: 15px; height: 15px; }
.detail-notes {
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text-2);
  font-size: 13px;
}
.masked { font-family: var(--mono); letter-spacing: 2px; color: var(--text-2); }

/* ============ 锁屏 ============ */
.lock {
  position: fixed;
  inset: 0;
  background: rgba(23, 26, 33, .55);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.lock-card {
  width: 356px;
  max-width: 100%;
  background: var(--surface);
  border-radius: 16px;
  padding: 32px 30px 26px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.lock-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.lock-icon svg { width: 26px; height: 26px; }
.lock-card h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.lock-card > p { margin: 0 0 22px; font-size: 12.5px; color: var(--muted); }
.lock-card .field { text-align: left; }
.lock-card .btn-ghost { margin-top: 8px; }

/* ============ 模态框 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(23, 26, 33, .42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 300;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 480px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop .18s cubic-bezier(.2, .9, .3, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal.wide { width: 620px; }
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex: none;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.form-grid .full { grid-column: 1 / -1; }

/* 生成器 */
.gen-output {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.gen-output input {
  flex: 1;
  height: 46px;
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: .6px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  outline: none;
  text-align: center;
}
.gen-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  font-size: 13px;
}
.gen-row label { color: var(--text-2); flex: none; width: 62px; }
.gen-row input[type="range"] { flex: 1; accent-color: var(--primary); }
.gen-row .len-val {
  width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.gen-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 16px;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.toggle input { accent-color: var(--primary); margin: 0; }
.toggle:has(input:checked) { border-color: #c7cdf5; background: var(--primary-soft); color: var(--primary-dark); }

/* 审计 / 设置 */
.ev-list { display: flex; flex-direction: column; }
.ev {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #f0f1f5;
  font-size: 12.5px;
}
.ev:last-child { border-bottom: none; }
.ev-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd0db;
  margin-top: 7px;
  flex: none;
}
.ev.ok .ev-dot { background: #10b981; }
.ev.bad .ev-dot { background: #ef4444; }
.ev.warn .ev-dot { background: #f59e0b; }
.ev-main { flex: 1; min-width: 0; }
.ev-main strong { font-weight: 500; font-size: 13px; }
.ev-main div { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.ev-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

.settings-section { margin-bottom: 26px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-section h4 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f1f5;
}
.setting-row:last-child { border-bottom: none; }
.setting-row .info { flex: 1; min-width: 0; }
.setting-row .info strong { display: block; font-size: 13.5px; font-weight: 500; }
.setting-row .info span { font-size: 12px; color: var(--muted); }
.setting-row select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  outline: none;
}
.badge-on {
  font-size: 11px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 20px;
  padding: 2px 8px;
}
.badge-off {
  font-size: 11px;
  background: #f1f2f6;
  color: var(--muted);
  border-radius: 20px;
  padding: 2px 8px;
}

.totp-setup {
  text-align: center;
  padding: 6px 0 4px;
}
.qr-box {
  width: 176px;
  height: 176px;
  margin: 0 auto 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-box img { width: 100%; height: 100%; }
.secret-line {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
  word-break: break-all;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: var(--text-2);
}

/* ============ Toast ============ */
.toast-root {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 500;
  pointer-events: none;
}
.toast {
  background: #1f2430;
  color: #fff;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .2s ease;
  max-width: 90vw;
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #047857; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.toast.out { animation: toastOut .18s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ============ 响应式 ============ */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 186px 318px minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .auth-card { grid-template-columns: 1fr; width: 420px; }
  .auth-brand { display: none; }
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    position: relative;
  }
  .sidebar {
    position: absolute;
    z-index: 20;
    inset: 0 auto 0 0;
    width: 218px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  #btn-menu { display: inline-flex; }
  .list-pane { border-right: none; }
  .detail-pane {
    position: absolute;
    inset: 0;
    z-index: 15;
    transform: translateX(100%);
    transition: transform .22s ease;
  }
  .detail-pane.open { transform: none; }
  .brand-name { display: none; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar-right .icon-btn:not(#btn-settings) { display: none; }
  #btn-new { height: 34px; padding: 0 11px; font-size: 13px; }
  .searchbox kbd { display: none; }
  .detail-head { padding: 18px 18px 16px; }
  .detail-body { padding: 4px 18px 32px; }
}

@media (max-width: 560px) {
  .auth { padding: 0; align-items: stretch; }
  .auth-card { border-radius: 0; width: 100%; min-height: 100%; box-shadow: none; }
  .auth-panel { padding: 32px 22px; }
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal, .modal.wide {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
  .form-grid { grid-template-columns: 1fr; }
  .detail-row { grid-template-columns: 74px minmax(0, 1fr) auto; }
  .toast-root { bottom: 16px; }
}
