/* 长青拾贝 Web 版 — 常绿主题（与小程序一致） */
:root {
  --primary: #0b7d55;
  --primary-light: #e6f3ee;
  --primary-active: #095f41;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a2233;
  --text-2: #5c667a;
  --text-3: #9aa3b5;
  --line: #eceef2;
  --warn: #e6a23c;
  --danger: #d43030;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; outline: none; }

.card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(20, 40, 60, 0.04);
}

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1280px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, #0b7d55, #14a06e);
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-name { font-size: 17px; font-weight: 700; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px; border-radius: 10px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 5px rgba(20, 40, 60, 0.06);
  color: var(--text-2);
  font-size: 17px;
}
.icon-btn.active { background: var(--primary-light); color: var(--primary); }
.badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--primary); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
  padding: 0 3px;
}
.btn-primary {
  background: var(--primary); color: #fff;
  border-radius: 10px; padding: 9px 18px;
  font-size: 14px; font-weight: 600;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-active); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-plain {
  background: #fff; color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 18px; font-size: 14px;
}

/* ---------- 双栏布局 ---------- */
.layout {
  display: flex;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 20px;
  align-items: flex-start;
}
.list-pane { flex: 0 0 400px; min-width: 0; }
.detail-pane {
  flex: 1; min-width: 0;
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
}

/* ---------- 筛选提示 ---------- */
.filter-tip {
  display: flex; justify-content: space-between;
  padding: 0 8px 8px; font-size: 12px; color: var(--text-2);
}
.filter-clear { color: var(--primary); cursor: pointer; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.item:hover { border-color: #d8e8e1; }
.item.selected { border-color: var(--primary); }
.item-main { flex: 1; min-width: 0; }
.item-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.item-subject {
  font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: var(--primary-light); color: var(--primary);
}
.tag.gray { background: #eef0f4; color: var(--text-2); }
.item-time { margin-left: auto; font-size: 11px; color: var(--text-3); }

.status { flex-shrink: 0; font-size: 12px; display: flex; align-items: center; gap: 5px; }
.status.pending { color: var(--warn); }
.status.done { color: var(--primary); }
.status.failed { color: var(--danger); }
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.empty {
  padding: 60px 0; text-align: center; color: var(--text-3); font-size: 13px;
}
.empty .empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ---------- 详情 ---------- */
.detail-card { flex: 1; overflow-y: auto; padding: 24px 28px; }
.detail-placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-3); font-size: 13px; gap: 12px;
  padding: 80px 0;
}
.detail-placeholder .ph-icon { font-size: 44px; opacity: 0.6; }
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.detail-subject { font-size: 20px; font-weight: 700; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.detail-meta .time { font-size: 12px; color: var(--text-3); }
.detail-actions { display: flex; gap: 8px; flex-shrink: 0; }
.detail-close { display: none; }
.btn-danger-plain {
  color: var(--danger); border: 1px solid #f3caca;
  border-radius: 8px; padding: 6px 14px; font-size: 13px; background: #fff;
}
.btn-danger-plain:hover { background: #fdf2f2; }

.gen-box { text-align: center; padding: 60px 0; color: var(--warn); font-size: 14px; }
.gen-box .pulse { display: inline-block; margin-right: 8px; }
.fail-box { text-align: center; padding: 60px 0; color: var(--danger); font-size: 14px; }

/* ---------- Markdown ---------- */
.md-body { line-height: 1.75; font-size: 14px; word-break: break-word; }
.md-h { font-weight: 700; margin: 18px 0 10px; line-height: 1.4; }
.md-h1 { font-size: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.md-h2 { font-size: 18px; color: var(--primary); }
.md-h3 { font-size: 16px; }
.md-h4 { font-size: 14px; }
.md-p { margin: 8px 0; }
.md-b { font-weight: 700; }
.md-i { font-style: italic; }
.md-del { text-decoration: line-through; }
.md-link { color: var(--primary); }
.md-code {
  font-family: "SF Mono", Consolas, Menlo, monospace;
  font-size: 0.9em; background: #f0f2f5; color: #c7254e;
  padding: 1px 5px; border-radius: 4px;
}
.md-pre {
  font-family: "SF Mono", Consolas, Menlo, monospace;
  font-size: 12.5px; background: #f6f8fa;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin: 10px 0;
  overflow-x: auto; line-height: 1.6;
}
.md-quote {
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
  padding: 8px 14px; margin: 10px 0;
  border-radius: 0 8px 8px 0; color: var(--text-2);
}
.md-list { margin: 8px 0; }
.md-li { display: flex; gap: 8px; margin: 4px 0; }
.md-bullet { flex-shrink: 0; color: var(--primary); font-weight: 600; }
.md-li-body { flex: 1; min-width: 0; }
.md-hr { height: 1px; background: var(--line); margin: 16px 0; }
.md-table {
  margin: 12px 0; border: 1px solid var(--line);
  border-radius: 8px; overflow-x: auto; font-size: 13px;
}
.md-tr { display: flex; border-bottom: 1px solid var(--line); min-width: fit-content; }
.md-tr:last-child { border-bottom: none; }
.md-th { background: #f4f6f8; font-weight: 600; }
.md-td {
  flex: 1; min-width: 90px; padding: 8px 10px;
  border-right: 1px solid var(--line);
}
.md-td:last-child { border-right: none; }

/* ---------- 弹层（筛选/新建/确认） ---------- */
.mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 25, 35, 0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.mask.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: 16px;
  width: min(520px, calc(100vw - 40px));
  max-height: 84vh; overflow-y: auto;
  padding: 24px;
  transform: translateY(12px); transition: transform 0.2s;
}
.mask.show .modal { transform: translateY(0); }
.modal-title { font-size: 17px; font-weight: 700; text-align: center; margin-bottom: 16px; }

.f-label { font-size: 13px; color: var(--text-2); margin: 16px 0 8px; }
.f-input {
  width: 100%; background: var(--bg); border: 1px solid transparent;
  border-radius: 10px; padding: 10px 14px; font-size: 14px;
}
.f-input:focus { border-color: var(--primary); background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 16px; border-radius: 999px;
  background: var(--bg); color: var(--text-2); font-size: 13px;
  border: 1px solid transparent;
}
.chip.on {
  background: var(--primary-light); color: var(--primary);
  border-color: var(--primary); font-weight: 600;
}
.date-range { display: flex; align-items: center; gap: 8px; }
.date-range input {
  flex: 1; background: var(--bg); border: 1px solid transparent;
  border-radius: 10px; padding: 9px 12px; font-size: 13px; color: var(--text);
}
.modal-actions { display: flex; gap: 12px; margin-top: 24px; }
.modal-actions > * { flex: 1; }

/* 新建：类型卡片 */
.type-group-label {
  font-size: 13px; color: var(--text-2); margin: 14px 0 8px;
  display: flex; align-items: center; gap: 6px;
}
.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.type-card {
  text-align: left; padding: 12px 14px;
  background: var(--bg); border: 1.5px solid transparent;
  border-radius: 12px; transition: all 0.15s;
}
.type-card.on { background: var(--primary-light); border-color: var(--primary); }
.type-name { font-size: 14px; font-weight: 600; }
.type-full { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.type-card.on .type-full { color: var(--primary); opacity: 0.75; }

.confirm-text { text-align: center; font-size: 14px; color: var(--text-2); padding: 8px 0 4px; }

/* ---------- 登录层 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: none; align-items: center; justify-content: center;
}
.login-mask.show { display: flex; }
.login-box {
  width: min(360px, calc(100vw - 48px));
  text-align: center; padding: 36px 28px;
}
.login-box .logo { width: 60px; height: 60px; font-size: 30px; border-radius: 16px; margin: 0 auto 14px; }
.login-title { font-size: 19px; font-weight: 700; }
.login-sub { font-size: 12px; color: var(--text-3); margin: 6px 0 22px; }
.login-err { color: var(--danger); font-size: 12px; margin-top: 10px; min-height: 16px; }
.login-box .btn-primary { width: 100%; margin-top: 14px; padding: 11px; }

/* ---------- FAB（移动端） ---------- */
.fab {
  display: none;
  position: fixed; right: 20px; bottom: 28px; z-index: 50;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 26px;
  box-shadow: 0 4px 16px rgba(11, 125, 85, 0.4);
  align-items: center; justify-content: center;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 14%; transform: translateX(-50%);
  z-index: 300; background: rgba(20, 30, 40, 0.85); color: #fff;
  padding: 9px 18px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
  max-width: 80vw;
}
.toast.show { opacity: 1; }

/* ---------- 响应式：移动端单列 ---------- */
@media (max-width: 900px) {
  .layout { display: block; padding: 0 12px 90px; }
  .list-pane { flex: none; }
  .detail-pane {
    display: none;
    position: fixed; inset: 0; z-index: 90;
    background: var(--bg); padding: 12px;
    max-height: none;
  }
  .detail-pane.open { display: flex; }
  .detail-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--bg); color: var(--text-2); font-size: 16px;
  }
  .fab { display: flex; }
  .btn-new-pc { display: none; }
  .modal { border-radius: 16px 16px 0 0; align-self: flex-end; width: 100vw; max-height: 88vh; }
  .mask { align-items: flex-end; }
  .detail-card { padding: 18px 16px; }
}
