/* 企业微信侧边栏 · 窄屏优先 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 关键：.sheet / .search 自带 display:flex，会盖掉 hidden 属性，必须强制隐藏 */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px; color: #0f172a; background: #f6f7f9;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; overflow: hidden; }

/* 顶栏 */
.hd {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: #fff; border-bottom: 1px solid #e8eaee;
}
.who { flex: 1; min-width: 0; }
.who-name {
  font-size: 15px; font-weight: 600; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who-meta {
  margin-top: 2px; font-size: 12px; color: #64748b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who-meta b { color: #dc2626; font-weight: 600; }
.who-meta i { color: #059669; font-style: normal; }

.ghost {
  flex: 0 0 auto; border: 1px solid #cbd5e1; background: #fff; color: #334155;
  border-radius: 6px; padding: 5px 10px; font-size: 13px; cursor: pointer;
}
.ghost:active { background: #f1f5f9; }

/* 提示条 */
.warn {
  flex: 0 0 auto; padding: 8px 12px; font-size: 12px; line-height: 1.5;
  background: #fff7ed; color: #9a3412; border-bottom: 1px solid #fed7aa;
}
.warn button {
  border: 0; background: none; color: #c2410c; text-decoration: underline;
  font-size: 12px; cursor: pointer; padding: 0 2px;
}

/* 分类 */
.tabs {
  flex: 0 0 auto; display: flex; gap: 6px; padding: 8px 10px;
  overflow-x: auto; background: #fff; border-bottom: 1px solid #e8eaee;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; border: 1px solid #e2e8f0; background: #fff; color: #475569;
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tab.on { background: #0f172a; border-color: #0f172a; color: #fff; }

/* 列表 */
.list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px; -webkit-overflow-scrolling: touch;
}
.list::after { content: ''; display: block; height: 12px; }

.card {
  background: #fff; border: 1px solid #e8eaee; border-radius: 10px;
  padding: 12px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .12s;
}
.card:active { border-color: #94a3b8; background: #fcfcfd; }
.card-top { display: flex; align-items: center; gap: 6px; }
.card-title { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.card-desc { margin-top: 4px; font-size: 12px; color: #64748b; line-height: 1.5; }
.card-need {
  margin-top: 6px; font-size: 11px; color: #b45309; background: #fffbeb;
  border: 1px solid #fde68a; border-radius: 4px; padding: 2px 6px; display: inline-block;
}

/* 底部预览 */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-mask { position: absolute; inset: 0; background: rgba(15,23,42,.35); }
.sheet-body {
  position: relative; background: #fff; border-radius: 14px 14px 0 0;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  max-height: 82%; display: flex; flex-direction: column;
  animation: up .16s ease-out;
}
@keyframes up { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }
.sheet-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-hd span { font-weight: 600; font-size: 14px; }
#sheetText {
  width: 100%; min-height: 120px; max-height: 40vh; resize: none;
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px;
  font-size: 14px; line-height: 1.7; font-family: inherit; color: #0f172a; background: #fbfcfd;
}
#sheetText:focus { outline: none; border-color: #94a3b8; background: #fff; }
.sheet-tip { margin-top: 6px; font-size: 12px; color: #b45309; min-height: 16px; }
.sheet-actions { margin-top: 8px; display: flex; gap: 8px; }
.btn {
  flex: 1; border: 1px solid #cbd5e1; background: #fff; color: #334155;
  border-radius: 8px; padding: 10px; font-size: 14px; font-weight: 500; cursor: pointer;
}
.btn.primary { flex: 2; background: #2563eb; border-color: #2563eb; color: #fff; }
.btn:active { opacity: .85; }
.btn[disabled] { opacity: .5; }

/* 搜索 */
.search { position: fixed; inset: 0; z-index: 30; background: #f6f7f9; display: flex; flex-direction: column; }
.search-inner { display: flex; gap: 8px; padding: 10px; background: #fff; border-bottom: 1px solid #e8eaee; }
.search-inner input {
  flex: 1; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px;
  font-size: 14px; font-family: inherit; outline: none;
}
.search-inner input:focus { border-color: #94a3b8; }
.search-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.srow {
  padding: 12px; background: #fff; border-bottom: 1px solid #f1f5f9; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.srow:active { background: #f8fafc; }
.srow-name { font-weight: 600; }
.srow-meta { font-size: 12px; color: #64748b; margin-left: auto; }
.empty { padding: 40px 16px; text-align: center; color: #94a3b8; font-size: 13px; }

/* 桌面浏览器预览：中间放一个手机宽度的窗体，模拟企微侧边栏 */
@media (min-width: 560px) {
  html { background: #eef1f5; height: 100%; }
  body {
    max-width: 400px; margin: 0 auto; height: 100vh; height: 100dvh;
    border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0;
    box-shadow: 0 0 24px rgba(15, 23, 42, .06);
  }
  .sheet, .search {
    width: 400px; left: 50%; right: auto; transform: translateX(-50%);
    max-height: 100vh; max-height: 100dvh;
  }
  .sheet-body { border-radius: 14px 14px 0 0; max-height: 76%; }
}
