/* ==========================================================================
   h.dddn.net 书签导航 —— 样式
   ========================================================================== */

:root {
  --bg: #0f1420;
  --bg-2: #131a28;
  --fg: #e6ecf7;
  --fg-2: #c3cfe4;
  --muted: #8b98b3;
  --card: rgba(26, 34, 52, 0.74);
  --card-2: rgba(34, 44, 66, 0.92);
  --card-hover: rgba(42, 55, 82, 0.95);
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.16);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
  --accent: #3b6fe0;
  --accent-2: #5b8cf0;
  --danger: #dd5f5f;
  --ok: #4fbf85;
  --warn: #e0b050;
  --input: #0d1320;
  --input-border: #33405e;
  --mask: rgba(8, 12, 20, 0.62);
  --ov-rgb: 8, 13, 22;
  --ov-alpha: 0.4;
  --radius: 14px;
  --radius-sm: 10px;
  --grid-min: 210px;
}

html[data-theme="light"] {
  --bg: #eaeff7;
  --bg-2: #f3f6fb;
  --fg: #1a2334;
  --fg-2: #38445c;
  --muted: #6a7893;
  --card: rgba(255, 255, 255, 0.8);
  --card-2: rgba(255, 255, 255, 0.95);
  --card-hover: #ffffff;
  --border: rgba(22, 36, 60, 0.1);
  --border-2: rgba(22, 36, 60, 0.18);
  --shadow: 0 8px 24px rgba(30, 50, 90, 0.12);
  --accent: #2f63d8;
  --accent-2: #4a7fe0;
  --danger: #cf4747;
  --input: #ffffff;
  --input-border: #c3cee2;
  --mask: rgba(232, 238, 248, 0.7);
  --ov-rgb: 240, 244, 250;
  --ov-alpha: 0.35;
}

html[data-theme="light"] .topbar { background: rgba(255, 255, 255, .86); }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent-2); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3 { font-weight: 600; }

/* ---------- 背景层 ---------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.04);
  filter: blur(var(--blur, 0px));
  transition: filter .2s ease;
}
.bg-mask {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(var(--ov-rgb), var(--ov-alpha));
  pointer-events: none;
}
body[data-bg="0"] .bg-mask { background: transparent; }
body[data-bg="0"] .bg-layer {
  background-image: radial-gradient(900px 520px at 12% -5%, rgba(80, 130, 255, .22), transparent 60%),
                    radial-gradient(760px 460px at 100% 0%, rgba(160, 90, 255, .16), transparent 55%);
}
html[data-theme="light"] body[data-bg="0"] .bg-layer {
  background-image: radial-gradient(900px 520px at 12% -5%, rgba(110, 155, 255, .34), transparent 60%),
                    radial-gradient(760px 460px at 100% 0%, rgba(170, 120, 255, .22), transparent 55%);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: rgba(15, 20, 32, .82);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand-logo { font-size: 20px; }
.brand-name { font-weight: 600; font-size: 16px; white-space: nowrap; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; }

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 620px;
  margin: 0 auto;
}
.search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: .6;
  pointer-events: none;
}
#searchInput {
  width: 100%;
  padding: 10px 38px 10px 34px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: var(--input);
  color: var(--fg);
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#searchInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 111, 224, .18); }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.search-clear:hover { color: var(--fg); }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--card-2);
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, transform .06s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--card-hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--card-2); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { display: block; width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--card-2);
  color: var(--fg);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.icon-btn:hover { background: var(--card-hover); }
.icon-btn.sm { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }
.link-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 0;
  text-align: left;
}
.link-btn:hover { color: var(--fg); }

/* ---------- 布局 ---------- */
.layout {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 18px;
  max-width: 1680px;
  margin: 0 auto;
}

/* ---------- 侧边分类 ---------- */
.sidebar {
  position: sticky;
  top: 74px;
  width: 208px;
  flex-shrink: 0;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 20;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 10px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .04em;
}
.cat-list { overflow-y: auto; flex: 1; margin: 0; padding: 0; }
.cat-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--fg-2);
  font-size: 14px;
  user-select: none;
  transition: background .12s;
  margin-bottom: 2px;
}
.cat-item:hover { background: var(--card-2); }
.cat-item.active { background: var(--accent); color: #fff; }
.cat-item .cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .cat-count { font-size: 12px; opacity: .65; }
.cat-item .cat-tools { display: none; gap: 2px; }
.cat-item:hover .cat-tools { display: flex; }
.cat-item .cat-tools button {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .7;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 3px;
  border-radius: 5px;
}
.cat-item .cat-tools button:hover { opacity: 1; background: rgba(128, 128, 128, .25); }
.cat-item .drag-handle.mini { opacity: .45; }
.cat-item:hover .drag-handle.mini { opacity: 1; }
.side-foot {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding: 10px 6px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.muted { color: var(--muted); font-size: 13px; }

/* ---------- 内容区 ---------- */
.content { flex: 1; min-width: 0; }

.cat-section { margin-bottom: 26px; }
.cat-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px 2px;
  padding: 4px 0;
}
.cat-section-head h2 { font-size: 15px; margin: 0; color: var(--fg); opacity: .92; }
.cat-section-head .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cat-section-head .count { font-size: 12px; color: var(--muted); }
.cat-section-head .sec-tools { display: flex; gap: 6px; margin-left: auto; opacity: 0; transition: opacity .15s; }
.cat-section:hover .sec-tools { opacity: 1; }

.bm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr));
  gap: 12px;
  min-height: 8px;
  border-radius: var(--radius);
  transition: background .15s, box-shadow .15s;
}
.content[data-cols="3"] .bm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.content[data-cols="4"] .bm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.content[data-cols="5"] .bm-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.content[data-cols="6"] .bm-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bm-grid[data-empty="1"] { min-height: 66px; border: 1px dashed var(--border); padding: 4px; }

.bm-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .12s, background .15s, border-color .15s, opacity .15s;
  min-height: 62px;
  user-select: none;
}
body[data-card="solid"] .bm-card { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--card-2); }
.bm-card:hover {
  background: var(--card-hover);
  border-color: var(--border-2);
  transform: translateY(-2px);
}
.bm-card.is-dragging { opacity: .95; cursor: grabbing; }
.bm-card.drag-placeholder {
  background: transparent !important;
  border: 1px dashed var(--accent);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.bm-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: inherit;
}
.bm-icon {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(128, 150, 200, .16);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bm-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; }
img.img-failed { display: none !important; }
.bm-icon .letter { font-weight: 700; font-size: 16px; color: var(--accent-2); text-transform: uppercase; }
.bm-text { min-width: 0; display: flex; flex-direction: column; }
.bm-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-url { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-card:hover .bm-title { color: var(--accent-2); }

.bm-tools {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(10, 14, 22, .8);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s;
}
.bm-card:hover .bm-tools { opacity: 1; pointer-events: auto; }
.bm-tools button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.bm-tools button:hover { background: var(--card-hover); color: var(--fg); }
.bm-tools button.del:hover { background: var(--danger); color: #fff; }
.bm-note-dot {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 11px;
  opacity: .85;
  cursor: pointer;
}

.drag-handle {
  flex-shrink: 0;
  width: 16px;
  color: var(--muted);
  cursor: grab;
  font-size: 13px;
  opacity: 0;
  transition: opacity .15s;
  touch-action: none;
  text-align: center;
  line-height: 1;
}
.bm-card:hover .drag-handle { opacity: .8; }
.drag-handle:active { cursor: grabbing; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; }
.bm-grid.drop-active {
  background: rgba(59, 111, 224, .10);
  box-shadow: inset 0 0 0 2px rgba(59, 111, 224, .45);
}
.count-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  color: var(--muted);
  opacity: 0;
}
.bm-card:hover .count-badge { opacity: .7; }

.empty-tip {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 2;
}
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- 移动端悬浮按钮 ---------- */
.fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 25;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .32);
  display: none;
}
.fab:active { transform: scale(.96); }

/* ---------- 提示条 ---------- */
.alert-bar {
  position: relative;
  z-index: 5;
  margin: 12px 18px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(224, 90, 90, .16);
  border: 1px solid rgba(224, 90, 90, .45);
  color: var(--fg);
  font-size: 13.5px;
}
.alert-bar code { background: rgba(0, 0, 0, .3); padding: 1px 5px; border-radius: 5px; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--mask);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}
.mask[hidden] { display: none; }
.modal {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  overflow: hidden;
  animation: pop .16s ease-out;
}
.modal.sm { max-width: 460px; }
.modal.xs { max-width: 380px; }
.modal[hidden] { display: none; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(10, 14, 22, .35);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.label-text { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.label-text em { color: var(--danger); font-style: normal; }
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--border-2);
  color: var(--fg-2);
  font-size: 11px;
  font-style: normal;
  cursor: help;
  margin-left: 3px;
}
input[type="text"], input[type="password"], input[type="url"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 111, 224, .16); }
textarea { resize: vertical; line-height: 1.6; }
select { cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 8px; cursor: pointer; }
.switch-row input { width: auto; accent-color: var(--accent); }

.icon-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-row input { flex: 1; min-width: 160px; }
.icon-preview {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(128, 150, 200, .16);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.icon-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.icon-preview .letter { font-weight: 700; color: var(--accent-2); text-transform: uppercase; }
.fetch-state { font-size: 13px; color: var(--muted); margin: -6px 0 10px; min-height: 18px; }
.fetch-state.ok { color: var(--ok); }
.fetch-state.err { color: var(--danger); }
.fetch-state.loading::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 6px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 设置面板 ---------- */
.sec { padding: 14px 0; border-bottom: 1px solid var(--border); }
.sec:last-child { border-bottom: 0; padding-bottom: 0; }
.sec-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.sec-title .muted { font-weight: 400; font-size: 12px; }
.bg-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bg-row input[type="text"] { flex: 1; min-width: 180px; }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-bottom: 14px; }
.upload-item {
  position: relative;
  height: 62px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--input);
}
.upload-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-item.active { border-color: var(--accent); }
.upload-item .del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.tips { padding-left: 18px; line-height: 1.9; }
.tips b { color: var(--fg-2); }

/* ---------- 备忘 ---------- */
.note-view {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 14px;
  line-height: 1.7;
  min-height: 60px;
  user-select: text;
}
.note-view.masked { color: var(--muted); letter-spacing: 2px; }

/* ---------- 登录 ---------- */
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  padding: 30px 26px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  text-align: center;
}
.login-logo { font-size: 34px; margin-bottom: 6px; }
.login-box h1 { font-size: 19px; margin: 0 0 6px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login-box input { margin-bottom: 10px; text-align: center; }
.login-msg { min-height: 20px; font-size: 13px; color: var(--danger); margin: 10px 0 0; }
.login-foot { font-size: 12px; color: var(--muted); margin: 14px 0 0; }

/* ---------- 拖拽跟随提示 ---------- */
.drag-ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  transform: translate(14px, 12px);
  white-space: nowrap;
}
.drag-ghost[hidden] { display: none; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(8px);
  z-index: 999;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  color: var(--fg);
  font-size: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity .18s, transform .18s;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none; }
.toast.err { border-color: rgba(224, 90, 90, .6); color: #ffb4b4; }
.toast.ok { border-color: rgba(79, 191, 133, .55); }

/* ---------- 搜索命中高亮 ---------- */
mark { background: rgba(255, 214, 102, .35); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- 响应式 ---------- */
.only-mobile { display: none; }

@media (max-width: 900px) {
  .only-mobile { display: inline-flex; }
  .brand-name { font-size: 15px; max-width: 34vw; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .topbar-actions .btn.primary { display: none; }
  .layout { padding: 12px; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    max-height: none;
    border-radius: 0;
    transform: translateX(-102%);
    transition: transform .22s ease;
    z-index: 60;
    padding-top: 18px;
  }
  .sidebar.open { transform: none; }
  .fab { display: block; }
  .content[data-cols] .bm-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
  .bm-tools { opacity: 1; pointer-events: auto; background: transparent; border: 0; padding: 0; }
  .bm-card { padding-right: 84px; }
  .drag-handle { opacity: .6; }
  .modal { max-height: 92vh; }
}
