/* =========================================================
   WebTab · 样式表
   ========================================================= */
:root {
  --bg: #f4f6f9;
  --bg-image: radial-gradient(1200px 600px at 12% -10%, #dbe7ff 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #e8f7f0 0%, transparent 55%);
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e6e9ef;
  --line-strong: #d6dbe4;
  --text: #16191d;
  --text-2: #6b7482;
  --text-3: #9aa3af;
  --brand: #2f6feb;
  --brand-ink: #ffffff;
  --brand-soft: #eaf1ff;
  --danger: #e5484d;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 24px -14px rgba(16, 24, 40, .18);
  --shadow-lg: 0 24px 60px -20px rgba(16, 24, 40, .3);
}

html[data-theme="dark"] {
  --bg: #101317;
  --bg-image: radial-gradient(1200px 600px at 10% -10%, #1b2a44 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #172c26 0%, transparent 55%);
  --panel: #191d23;
  --panel-2: #1f242b;
  --line: #2a3038;
  --line-strong: #363d47;
  --text: #e7eaee;
  --text-2: #9ba4b1;
  --text-3: #6f7987;
  --brand: #5b8cff;
  --brand-ink: #0b1220;
  --brand-soft: #1e2b42;
  --danger: #ff6b6b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 28px -16px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .85);
}

* { box-sizing: border-box; }

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

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

button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ------------------------- 布局 ------------------------- */
.app {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: 66px minmax(0, 1fr) auto;
  grid-template-areas:
    "top top"
    "side main"
    "foot foot";
  height: 100vh;
}

/* ------------------------- 页脚 ------------------------- */
/* 备案信息：工信部要求每个对外页面底部都能看到、且可以点开核验 */
.site-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 14px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.4;
}
.site-foot a { color: var(--text-3); transition: color .16s; }
.site-foot a:hover { color: var(--brand); }
/* 主界面：占满 grid 第三行，与滚动内容之间加一条分隔线 */
.app > .site-foot {
  grid-area: foot;
  border-top: 1px solid var(--line);
}

/* ------------------------- 顶栏 ------------------------- */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 178px; }
a.brand { cursor: pointer; }
a.brand .brand-text strong { transition: color .16s; }
a.brand:hover .brand-text strong { color: var(--brand); }
a.brand:hover .logo { box-shadow: 0 8px 18px -6px rgba(47, 111, 235, 1); }
.logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--brand), #7aa6ff);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .5px;
  box-shadow: 0 6px 14px -6px rgba(47, 111, 235, .8);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; letter-spacing: .2px; }
.brand-text span { font-size: 11px; color: var(--text-3); }

.search-wrap {
  flex: 1;
  max-width: 620px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap .ico {
  position: absolute; left: 13px;
  width: 17px; height: 17px;
  color: var(--text-3);
  pointer-events: none;
}
#search {
  width: 100%;
  height: 40px;
  padding: 0 42px 0 38px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
#search::placeholder { color: var(--text-3); }
#search:focus {
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
/* type=search 会带浏览器原生的清除按钮，和右侧的 kbd / 按钮挤在一起，去掉 */
#search::-webkit-search-cancel-button,
#search::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
#search { -webkit-appearance: none; appearance: none; }
.search-wrap kbd {
  position: absolute; right: 12px;
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0 6px;
  line-height: 17px;
  background: var(--panel);
}

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.engine {
  height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text-2);
  outline: none;
  cursor: pointer;
}

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  cursor: pointer;
  color: var(--text-2);
  transition: .16s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); border-color: var(--text-3); background: var(--panel); }

.btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  transition: .16s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--panel); border-color: var(--text-3); }
.btn.primary {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(47, 111, 235, .9);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }

/* ------------------------- 侧栏 ------------------------- */
.sidebar {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px 14px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.side-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 10px 8px;
}
.group-list { display: flex; flex-direction: column; gap: 2px; }

.group-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  transition: .15s;
}
.group-item:hover { background: var(--panel); color: var(--text); }
.group-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.group-item .g-ico { width: 16px; text-align: center; font-size: 13px; opacity: .85; }
.group-item .g-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}
.group-item .g-count {
  font-size: 11px;
  color: var(--text-3);
  min-width: 18px;
  text-align: right;
}
.group-item.active .g-count { color: var(--brand); }
.group-divider { height: 1px; background: var(--line); margin: 8px 6px; }

.side-btn {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
}
.side-btn svg { width: 16px; height: 16px; }
.side-btn:hover { color: var(--brand); border-color: var(--brand); }

.side-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
}
.storage-tip { display: flex; align-items: center; gap: 6px; }
.storage-tip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3fb950;
}
.storage-tip.offline::before { background: #d29922; }
.side-links { display: flex; gap: 12px; }
.side-links a:hover, .link-btn:hover { color: var(--brand); }
.link-btn {
  border: none; background: none; padding: 0;
  color: var(--text-3); cursor: pointer; font-size: 11.5px;
}

/* ------------------------- 主内容 ------------------------- */
.content {
  grid-area: main;
  overflow-y: auto;
  padding: 24px 30px 60px;
}
.content-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.head-title h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.head-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.head-tools { margin-left: auto; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  gap: 2px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ------------------------- 卡片网格 ------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 15px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .18s cubic-bezier(.2, .8, .3, 1), box-shadow .18s, border-color .18s;
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, transparent 55%, color-mix(in srgb, var(--brand) 6%, transparent));
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
}
.card:hover::after { opacity: 1; }
.card.dragging { opacity: .4; }
.card.drop-target { border-color: var(--brand); border-style: dashed; }

.card-top { display: flex; align-items: center; gap: 11px; min-width: 0; }

.favicon {
  position: relative;
  width: 36px; height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.favicon .letter {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  width: 100%; height: 100%;
  display: grid; place-items: center;
  letter-spacing: .5px;
}
.favicon img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  padding: 6px;
  background: var(--panel);
  opacity: 0;
  transition: opacity .2s;
}
.favicon img.loaded { opacity: 1; }

.card-meta { min-width: 0; }
.card-meta h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-meta .host {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-meta .acct {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-meta .acct::before { content: "账号 "; color: var(--text-3); opacity: .7; }
.card .desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 39px;
}
.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}
.tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.clicks {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.card-actions {
  position: absolute;
  top: 9px; right: 9px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: .16s;
}
.card:hover .card-actions { opacity: 1; transform: none; }
.card-actions button {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.card-actions button svg { width: 14px; height: 14px; }
.card-actions button:hover { color: var(--brand); border-color: var(--brand); }
.card-actions button[data-act="del"]:hover { color: var(--danger); border-color: var(--danger); }
.card-actions button.on { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

.pwd-link {
  padding: 0;
  border: none;
  background: none;
  font-size: 11px;
  color: var(--brand);
  cursor: pointer;
  white-space: nowrap;
}
.pwd-link:hover { text-decoration: underline; }
.pwd-link.on { color: var(--text-2); }

/* 卡片里的密码行：默认整行隐藏，点眼睛才出现，鼠标移出卡片自动收起 */
.card .pwd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  min-width: 0;
  border-radius: 8px;
  border: 1px dashed color-mix(in srgb, var(--brand) 40%, var(--line));
  background: var(--panel-2);
}
.card .pwd-text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}
.card .pwd-copy {
  flex: 0 0 auto;
  padding: 1px 7px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
}
.card .pwd-copy:hover { color: var(--brand); border-color: var(--brand); }

/* 空状态 */
.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-2);
}
.empty-ico {
  font-size: 40px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.empty h3 { margin: 0 0 4px; font-size: 16px; color: var(--text); }
.empty p { margin: 0 0 18px; font-size: 13px; }

/* ------------------------- 弹窗 ------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}
.modal.open { display: block; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(15, 20, 28, .42);
  backdrop-filter: blur(3px);
  animation: fade .18s ease;
}
.modal-card {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  margin: 9vh auto 0;
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1);
  overflow: hidden;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
}
.modal-head {
  display: flex;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-head .icon-btn { margin-left: auto; border: none; background: transparent; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field > span i { color: var(--danger); font-style: normal; }
.field input, .field select {
  height: 38px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  outline: none;
  transition: .16s;
  width: 100%;
}
.field input:focus, .field select:focus {
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent);
}
.field-row { display: flex; gap: 12px; }

/* 密码框：右侧小眼睛切换「打码 / 明文」 */
.pwd-wrap { position: relative; display: flex; }
.pwd-wrap input { width: 100%; padding-right: 38px; }
.pwd-eye {
  position: absolute;
  right: 5px; top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  transition: color .16s, background .16s;
}
.pwd-eye svg { width: 15px; height: 15px; }
.pwd-eye:hover { color: var(--text-2); background: color-mix(in srgb, var(--text-3) 12%, transparent); }
.pwd-eye.on { color: var(--brand); }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

/* ------------------------- 新用户引导 ------------------------- */
/* 不是一层毛玻璃遮罩：在真实控件上「挖一个洞」把它照亮，
 * 卡片贴着那个控件摆放，用户看到的就是自己界面上的位置。 */
.ob-root {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
}
.ob-root.open { display: block; }

.ob-hole {
  position: fixed;
  display: none;
  border-radius: 12px;
  pointer-events: none;
  /* 用超大阴影铺满全屏，中间那块就是透亮的洞 */
  box-shadow: 0 0 0 9999px rgba(12, 17, 25, .58),
              0 0 0 2px color-mix(in srgb, var(--brand) 62%, transparent);
  transition: left .26s cubic-bezier(.3, .9, .3, 1),
              top .26s cubic-bezier(.3, .9, .3, 1),
              width .26s cubic-bezier(.3, .9, .3, 1),
              height .26s cubic-bezier(.3, .9, .3, 1);
}
.ob-hole.show { display: block; }

.ob-card {
  position: fixed;
  width: min(356px, calc(100vw - 24px));
  padding: 16px 20px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2, .9, .3, 1);
}
.ob-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ob-count {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.ob-skip {
  border: none;
  background: none;
  padding: 2px 0;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
}
.ob-skip:hover { color: var(--text-2); }
.ob-title {
  margin: 0 0 8px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -.2px;
  line-height: 1.5;
}
.ob-text {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.8;
}
.ob-text b { color: var(--text); font-weight: 600; }
.ob-action {
  margin-top: 12px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--brand) 34%, transparent);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: .16s;
}
.ob-action:hover { border-color: var(--brand); }
.ob-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.ob-dots { display: flex; gap: 5px; }
.ob-dots i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: width .2s, background .2s;
}
.ob-dots i.on { width: 16px; border-radius: 3px; background: var(--brand); }
.ob-nav { display: flex; gap: 8px; }
.ob-nav .btn { height: 32px; padding: 0 12px; font-size: 13px; }
.ob-nav .btn[disabled] { opacity: .4; pointer-events: none; }

/* 分组管理 */
.add-group { display: flex; gap: 8px; }
.add-group input {
  flex: 1;
  height: 38px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  outline: none;
}
.add-group input:focus { border-color: var(--brand); }
.group-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.group-rows li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.group-rows .row-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-rows .row-count { font-size: 11.5px; color: var(--text-3); }
.group-rows .mini {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 12px;
}
.group-rows .mini:hover { color: var(--brand); border-color: var(--brand); }
.group-rows .mini.del:hover { color: var(--danger); border-color: var(--danger); }
.hint { margin: 0; font-size: 11.5px; color: var(--text-3); }
/* 账号资料弹窗：一个弹窗两个面板，复用 .field / .modal-foot */
.acct-pane { display: flex; flex-direction: column; gap: 14px; }

/* ------------------------- 书签导入 ------------------------- */
.import-drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  background: var(--panel-2);
  transition: .18s;
}
.import-drop.over {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.import-drop .drop-ico {
  font-size: 26px;
  color: var(--text-3);
  line-height: 1;
  margin-bottom: 8px;
}
.import-drop p { margin: 0 0 8px; font-size: 13.5px; }
.import-tip {
  font-size: 12px !important;
  color: var(--text-3);
  line-height: 1.65;
  max-width: 420px;
  margin: 0 auto 14px !important;
}
.import-summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--brand-soft);
  font-size: 12.5px;
  color: var(--text-2);
}
.import-summary strong { color: var(--text); font-size: 12.5px; word-break: break-all; }
.import-summary b { color: var(--brand); }
.import-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.import-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.import-list .ig-name { font-size: 13px; font-weight: 500; }
.import-list .ig-count {
  font-size: 11.5px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 0 8px;
  height: 18px;
  line-height: 18px;
}
.import-list .ig-sample {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 16px);
  background: #16191d;
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------- 登录页 ------------------------- */
.auth-page {
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
/* 登录/注册页的备案行：贴在卡片下方，跟着页面高度走 */
.auth-page > .site-foot {
  grid-area: auto;
  align-self: end;
  padding: 0;
  font-size: 11.5px;
}
.auth-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.auth-bg .blob {
  position: absolute;
  width: 46vw; height: 46vw;
  min-width: 320px; min-height: 320px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .42;
}
.auth-bg .b1 { background: #7aa6ff; top: -12%; left: -8%; }
.auth-bg .b2 { background: #8ef0c8; bottom: -16%; right: -6%; }
.auth-bg .b3 { background: #ffd6a5; top: 32%; right: 26%; width: 26vw; height: 26vw; min-width: 200px; min-height: 200px; opacity: .3; }
html[data-theme="dark"] .auth-bg .blob { opacity: .35; }

.auth-card {
  position: relative;
  z-index: 1;
  width: min(404px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .logo { width: 40px; height: 40px; border-radius: 13px; font-size: 19px; }
.auth-brand strong { font-size: 17px; display: block; line-height: 1.3; }
.auth-brand p { margin: 0; font-size: 12.5px; color: var(--text-3); }

.auth-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.auth-tab {
  flex: 1;
  height: 32px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: .16s;
}
.auth-tab.active {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.auth-hint {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--brand-soft);
  border-radius: 10px;
  padding: 9px 11px;
  line-height: 1.55;
}
.auth-hint.success { background: color-mix(in srgb, #3fb950 14%, transparent); color: #2f8f45; }

#authForm { display: flex; flex-direction: column; gap: 13px; }
.auth-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-radius: 9px;
  padding: 8px 11px;
}
.auth-submit { height: 42px; justify-content: center; margin-top: 4px; font-size: 14.5px; }
.auth-back {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12.5px;
}
.auth-back a { color: var(--brand); }
.auth-back a:hover { text-decoration: underline; }
.auth-foot {
  margin: 16px 0 0;
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
}

/* ------------------------- 游客模式 ------------------------- */
.guest-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
}
.guest-banner .gb-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.guest-banner strong { font-size: 13.5px; }
.guest-banner span { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.guest-banner .btn { flex: 0 0 auto; }
/* 本地模式（服务端不可用）用琥珀色区分，别和游客提示混淆 */
.guest-banner.local {
  border-color: color-mix(in srgb, #d29922 34%, var(--line));
  background: color-mix(in srgb, #d29922 10%, var(--panel));
}

html.guest .guest-hide { display: none !important; }
html:not(.guest) .guest-only { display: none !important; }
/* 本地模式：依赖服务端的功能（扩展令牌、服务端导出）先藏起来 */
html.offline .server-only { display: none !important; }
html:not(.offline) .local-only { display: none !important; }

/* ------------------------- 用户菜单 ------------------------- */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 11px 0 5px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  cursor: pointer;
  transition: .16s;
}
.user-chip:hover { border-color: var(--text-3); background: var(--panel); }
.avatar {
  width: 27px; height: 27px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  flex: 0 0 27px;
}
.user-chip .u-name {
  max-width: 96px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-wrap { position: relative; }
.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 60;
}
.user-menu.open { display: block; animation: pop .16s ease; }
.user-menu .um-head {
  padding: 9px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.user-menu .um-head strong { display: block; font-size: 13.5px; }
.user-menu .um-head span { font-size: 11.5px; color: var(--text-3); word-break: break-all; }
.user-menu button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-menu button:hover { background: var(--panel-2); color: var(--text); }
.user-menu button.danger:hover { color: var(--danger); }

/* ------------------------- 壁纸 ------------------------- */
html[data-wallpaper="plain"] body { background-image: none; }
html[data-wallpaper="aurora"] body { background-image: var(--bg-image); }
html[data-wallpaper="grid"] body {
  background-image:
    linear-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px;
  background-attachment: fixed;
}
html[data-wallpaper="mesh"] body {
  background-image:
    radial-gradient(880px 520px at 6% 4%, color-mix(in srgb, #7aa6ff 45%, transparent) 0%, transparent 60%),
    radial-gradient(760px 520px at 96% 2%, color-mix(in srgb, #8ef0c8 38%, transparent) 0%, transparent 58%),
    radial-gradient(900px 620px at 58% 104%, color-mix(in srgb, #ffd6a5 38%, transparent) 0%, transparent 62%);
  background-attachment: fixed;
}
html[data-wallpaper="dots"] body {
  background-image: radial-gradient(color-mix(in srgb, var(--text) 14%, transparent) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  background-attachment: fixed;
}

/* ------------------------- 卡片风格 ------------------------- */
html[data-card="soft"] .card { box-shadow: var(--shadow-sm); }
html[data-card="solid"] .card { box-shadow: var(--shadow); }
html[data-card="solid"] .card::after { display: none; }
html[data-card="flat"] .card {
  box-shadow: none;
  background: var(--panel);
}
html[data-card="flat"] .card::after { display: none; }
html[data-card="flat"] .card:hover {
  transform: none;
  box-shadow: none;
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}
html[data-card="glass"] .card {
  background: color-mix(in srgb, var(--panel) 62%, transparent);
  border-color: color-mix(in srgb, var(--panel) 34%, var(--line));
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
}
html[data-card="glass"] .favicon { background: color-mix(in srgb, var(--panel) 80%, transparent); }

/* ------------------------- 密度 ------------------------- */
html[data-density="compact"] .content { padding: 18px 26px 44px; }
html[data-density="compact"] .grid {
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 10px;
}
html[data-density="compact"] .card { padding: 11px 12px 10px; gap: 7px; border-radius: 12px; }
html[data-density="compact"] .card .desc { display: none; }
html[data-density="compact"] .favicon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; }
html[data-density="compact"] .favicon .letter { font-size: 13px; }
html[data-density="compact"] .card-meta h3 { font-size: 13.5px; }

/* ------------------------- 设置抽屉 ------------------------- */
.drawer { position: fixed; inset: 0; z-index: 90; display: none; }
.drawer.open { display: block; }
.drawer-mask {
  position: absolute; inset: 0;
  background: rgba(15, 20, 28, .38);
  backdrop-filter: blur(2px);
  animation: fade .2s ease;
}
.drawer-panel {
  position: absolute; top: 0; right: 0;
  height: 100%;
  width: min(402px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideIn .26s cubic-bezier(.2, .9, .3, 1);
}
@keyframes slideIn { from { transform: translateX(100%); } }
.drawer-head {
  display: flex; align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 { margin: 0; font-size: 15.5px; }
.drawer-head .icon-btn { margin-left: auto; border: none; background: transparent; }
.drawer-body { overflow-y: auto; padding: 4px 18px 30px; }
.set-section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.set-section:last-child { border-bottom: none; }
.set-section h4 {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.set-row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.set-row:last-child { margin-bottom: 0; }
.set-label { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.chips { display: flex; gap: 6px; }
.chips.wrap { flex-wrap: wrap; }
.chip {
  height: 28px; padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: .15s;
}
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip.active {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 45%, transparent);
  color: var(--brand);
  font-weight: 600;
}
.set-note { margin: 0 0 10px; font-size: 12px; color: var(--text-3); line-height: 1.7; }
.token-box {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.token-box code {
  flex: 1; min-width: 0;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.token-actions { display: flex; gap: 6px; }
.mini-btn {
  height: 28px; padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex; align-items: center;
  transition: .15s;
}
.mini-btn:hover { color: var(--brand); border-color: var(--brand); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.set-details { margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.set-details summary { cursor: pointer; color: var(--brand); }
.set-details ol { margin: 8px 0 0; padding-left: 18px; line-height: 1.95; }
.set-details code {
  background: var(--panel-2);
  border-radius: 4px; padding: 1px 4px;
  font-size: 11.5px;
}
.set-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.set-links .mini-btn { text-decoration: none; display: inline-flex; align-items: center; }
.acct-row { display: flex; align-items: center; gap: 10px; }
.acct-row .avatar { width: 34px; height: 34px; flex: 0 0 34px; font-size: 13px; }
.acct-row strong { display: block; font-size: 13.5px; }
.acct-row span { font-size: 11.5px; color: var(--text-3); word-break: break-all; }

/* 分组图标选择器 */
.group-rows .row-ico {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 12px;
  transition: .15s;
}
.group-rows .row-ico:hover { color: var(--brand); border-color: var(--brand); }
.icon-pop {
  position: fixed;
  z-index: 300;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 26px);
  gap: 4px;
}
.icon-pop button {
  width: 26px; height: 26px;
  border: none; border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  display: grid; place-items: center;
}
.icon-pop button:hover { background: var(--brand-soft); color: var(--brand); }

/* ------------------------- 响应式 ------------------------- */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "top"
      "side"
      "main";
    height: 100vh;
  }
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; height: auto; }
  .brand { min-width: 0; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .engine { display: none; }
  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
  }
  .side-label, .side-foot { display: none; }
  .group-list { flex-direction: row; }
  .group-item { white-space: nowrap; padding: 6px 10px; }
  .group-item .g-count { display: none; }
  .side-btn { margin: 0; flex: 0 0 auto; }
  .content { padding: 18px 16px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .field-row { flex-direction: column; }
}
