/* ═══════════════════════════════════════════════
   阿波罗平台 · 备忘录模块（memo.css）
   - 仅作用于 #view-memo，复用 ui.css / app.css 的设计令牌
   - 结构：页签 → 搜索/新建 → 看板筛选 → 紧凑卡片列表 → 弹窗
   ═══════════════════════════════════════════════ */

#view-memo{--memo-rail:4px}

/* ── 页签基础样式见 ui.css 的 .tabs / .tab ── */

/* ── 搜索与新建 ── */
.memo-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.memo-search{flex:1 1 320px;max-width:520px}
.memo-toolbar__act{display:flex;align-items:center;gap:10px;margin-left:auto}
.memo-toolbar .btn{margin-left:0}
.memo-notify{
  appearance:none;height:32px;padding:0 12px;border:1px dashed var(--line-2);border-radius:var(--radius-sm);
  background:transparent;color:var(--muted);font-size:11.5px;
  transition:border-color .15s ease,color .15s ease;
}
.memo-notify:hover{border-color:var(--brand);color:var(--brand)}

/* ── 看板：未完成在上、已完成在下，各自带一组下拉筛选 ── */
.memo-boards{display:flex;flex-direction:column;gap:18px}
.memo-board__head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  padding:0 2px 9px;margin-bottom:12px;border-bottom:1px solid var(--line);
}
.memo-board__title{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--ink);font-weight:600}
.memo-board__title b{font-size:13px}
.memo-board__dot{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--brand)}
.memo-board.is-done .memo-board__dot{background:var(--good)}
.memo-board__count{
  font-style:normal;display:inline-flex;align-items:center;height:20px;padding:0 8px;
  border-radius:999px;font-size:11.5px;font-weight:600;font-variant-numeric:tabular-nums;
  color:var(--brand);background:var(--brand-soft);
}
.memo-board.is-done .memo-board__count{color:var(--good);background:var(--good-soft)}
.memo-board__filters{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.memo-board__field{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--muted)}
.memo-board__field select{
  appearance:none;height:30px;min-width:108px;max-width:168px;padding:0 26px 0 9px;
  border:1px solid var(--line);border-radius:var(--radius-sm);
  background:var(--card);color:var(--ink);font-size:12px;cursor:pointer;outline:none;
  background-image:linear-gradient(45deg,transparent 50%,var(--muted-2) 50%),
    linear-gradient(135deg,var(--muted-2) 50%,transparent 50%);
  background-position:calc(100% - 14px) 13px,calc(100% - 9px) 13px;
  background-size:5px 5px,5px 5px;background-repeat:no-repeat;
  transition:border-color .15s ease,box-shadow .15s ease;
}
.memo-board__field select:hover{border-color:var(--line-2)}
.memo-board__field select:focus{border-color:var(--brand);box-shadow:var(--focus-ring)}
.memo-board__list{display:flex;flex-direction:column;gap:10px}
.memo-board__empty{
  padding:26px 16px;text-align:center;font-size:12.5px;color:var(--muted);
  background:var(--card);border:1px dashed var(--line);border-radius:var(--radius);
}

/* ── 卡片列表 ── */
.memo-card{
  position:relative;display:flex;overflow:hidden;cursor:pointer;
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow);
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease,opacity .16s ease;
}
.memo-card:hover{border-color:var(--line-2);box-shadow:var(--shadow-2);transform:translateY(-1px)}
.memo-card:focus-visible{outline:none;box-shadow:var(--focus-ring),var(--shadow-2)}
.memo-card__rail{position:absolute;inset:0 auto 0 0;width:var(--memo-rail);background:var(--muted-2)}
.memo-card.is-normal .memo-card__rail{background:#8b74d9}
.memo-card.is-important .memo-card__rail{background:#f59e0b}
.memo-card.is-urgent .memo-card__rail{background:var(--bad)}
.memo-card.is-done .memo-card__title{text-decoration:line-through;color:var(--muted)}
.memo-card.is-done .memo-card__top,
.memo-card.is-done .memo-card__content,
.memo-card.is-done .memo-card__foot{opacity:.72}
.memo-card__main{flex:1 1 auto;min-width:0;padding:11px 14px 10px 18px}
.memo-card__top{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-bottom:6px;font-size:11.5px;color:var(--muted)}
.memo-card__title{margin:0 0 3px;font-size:14.5px;font-weight:600;color:var(--ink);line-height:1.4;word-break:break-word}
.memo-level{
  display:inline-flex;align-items:center;height:20px;padding:0 7px;border-radius:4px;
  font-size:11px;font-weight:600;letter-spacing:.02em;white-space:nowrap;
}
.memo-level.is-normal{background:#f2eefe;color:#5b46c9;border:1px solid #ddd4f9}
.memo-level.is-important{background:var(--warn-soft);color:var(--warn);border:1px solid #fcd9b4}
.memo-level.is-urgent{background:var(--bad-soft);color:var(--bad);border:1px solid var(--bad-line)}
.memo-cat{color:var(--brand);font-weight:500}
.memo-status{
  display:inline-flex;align-items:center;height:20px;padding:0 6px;border-radius:4px;
  font-size:11px;color:var(--brand);background:var(--brand-soft);
}
.memo-status.is-done{color:var(--good);background:var(--good-soft)}
.memo-share-tag{color:var(--good)}
.memo-share-tag.is-muted{color:var(--muted-2)}
.memo-card__content{
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;
  margin:0;font-size:12.5px;color:var(--muted);line-height:1.6;word-break:break-word;
}
.memo-card__foot{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:7px 0 0;font-size:11.5px;color:var(--muted-2)}
.memo-card__acts{
  display:flex;align-items:center;gap:4px;flex-wrap:wrap;margin-left:auto;
}
.memo-act{
  appearance:none;height:26px;padding:0 9px;border:1px solid transparent;border-radius:var(--radius-sm);
  background:var(--bg-soft);color:var(--muted);font-size:11px;
  transition:background .15s ease,color .15s ease,border-color .15s ease;
}
.memo-act:hover{background:var(--card);border-color:var(--line);color:var(--ink)}
.memo-act.is-primary{color:var(--on-brand);background:var(--brand);border-color:var(--brand);font-weight:600}
.memo-act.is-primary:hover{background:#003a88;border-color:#003a88;color:var(--on-brand)}
.memo-act.is-danger{color:var(--bad);background:var(--bad-soft)}
.memo-act.is-danger:hover{background:var(--card);border-color:var(--bad-line);color:var(--bad)}
.memo-foot{display:inline-flex;align-items:center;gap:4px;min-width:0}
.memo-foot svg{width:13px;height:13px;color:var(--muted-2)}
.memo-foot.is-muted{color:var(--muted-2)}
.memo-foot.is-late{color:var(--bad)}
.memo-foot.is-late svg{color:var(--bad)}
.memo-foot--share{max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ── 状态 / 空态 ── */
.memo-state{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;
  padding:56px 20px;background:var(--card);border:1px dashed var(--line);border-radius:var(--radius);
  color:var(--muted);font-size:13px;
}
.memo-state.is-error{color:var(--bad);border-color:var(--bad-line)}
.memo-state.is-error span{color:var(--muted);font-size:12px;max-width:520px;text-align:center}
.memo-state .btn{margin-top:4px}
.memo-spin{
  width:18px;height:18px;border:2px solid var(--line);border-top-color:var(--brand);
  border-radius:50%;animation:memoSpin .8s linear infinite;
}

/* ── 弹窗内容（遮罩 / 定位 / 动画 / 滚动锁由通用弹窗 A.ui.modal 提供） ── */
/* 通用弹窗正文默认带 16/22 内边距，备忘录弹窗由内部「头 / 身 / 脚」接管留白，滚动交给 .memo-modal__body */
.ui-modal__body.memo-modal__host{padding:0;overflow:hidden;display:flex;flex-direction:column;min-height:0}
.memo-modal__panel{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
.memo-modal__panel > .memo-form{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
.memo-modal__head{
  display:flex;align-items:flex-start;justify-content:space-between;gap:12px;
  padding:16px 20px 12px;border-bottom:1px solid var(--line);flex:0 0 auto;
}
.memo-modal__head h2{margin:5px 0 3px;font-size:17px;line-height:1.4;font-weight:650;color:var(--ink);word-break:break-word}
.memo-modal__body{flex:1 1 auto;overflow-y:auto;padding:14px 20px;min-height:0}
.memo-modal__foot{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;flex:0 0 auto;
  padding:12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top:1px solid var(--line);background:var(--card);
}
.memo-modal__spacer{flex:1 1 auto}
.memo-iconbtn{
  appearance:none;flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;
  width:30px;height:30px;padding:0;border:1px solid var(--line);border-radius:var(--radius-sm);
  background:var(--card);color:var(--muted);font-size:17px;line-height:1;
  transition:background .15s ease,color .15s ease,border-color .15s ease;
}
.memo-iconbtn:hover{background:var(--bg-soft);color:var(--ink);border-color:var(--line-2)}
.memo-id-btn{
  appearance:none;display:inline-flex;align-items:center;gap:5px;padding:2px 6px;
  border:1px solid transparent;border-radius:4px;background:transparent;
  color:var(--muted-2);font-size:11px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  transition:background .15s ease,color .15s ease,border-color .15s ease;
}
.memo-id-btn:hover{background:var(--bg-soft);border-color:var(--line);color:var(--brand)}
.memo-id-btn svg{width:12px;height:12px}

/* ── 详情 ── */
.memo-facts{display:grid;grid-template-columns:1fr 1fr;gap:12px 18px;margin:0 0 18px}
.memo-facts div{min-width:0}
.memo-facts dt{font-size:11.5px;color:var(--muted);margin-bottom:3px}
.memo-facts dd{margin:0;font-size:12.5px;color:var(--ink);word-break:break-word}
.memo-facts__id{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;color:var(--muted)}
.memo-done-tag{display:inline-block;padding:1px 7px;border-radius:4px;background:var(--good-soft);color:var(--good);font-size:11.5px}
.memo-detail{padding-top:14px;border-top:1px dashed var(--line);margin-top:14px}
.memo-detail h3{margin:0 0 8px;font-size:12.5px;font-weight:600;color:var(--ink);letter-spacing:.02em}
.memo-detail__text{margin:0;font-size:13px;line-height:1.75;color:var(--ink-2);word-break:break-word}
.memo-detail__perm{margin:0 0 8px;font-size:11.5px;color:var(--muted)}
.memo-empty-text{margin:0;font-size:12px;color:var(--muted-2)}
.memo-share-list{display:flex;flex-wrap:wrap;gap:8px}
.memo-share-chip{
  display:inline-flex;align-items:center;gap:7px;padding:4px 9px 4px 5px;
  border:1px solid var(--line);border-radius:999px;background:var(--bg-soft);
  font-size:12px;color:var(--ink-2);
}
.memo-share-chip i{
  display:inline-flex;align-items:center;justify-content:center;
  width:20px;height:20px;border-radius:50%;background:var(--brand-soft);color:var(--brand);
  font-style:normal;font-size:11px;font-weight:600;
}
.memo-share-chip small{font-size:10.5px;color:var(--muted-2)}

/* ── 表单 ── */
.memo-form__eyebrow{font-size:11.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--brand);font-weight:600}
.memo-form__id{display:block;font-size:11px;color:var(--muted-2);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;margin-top:2px}
.memo-form__head{align-items:center;gap:16px}
.memo-form__headinfo{flex:1 1 auto;min-width:0}
.memo-form__headact{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.memo-quick-row{grid-column:2 / -1;margin-top:-2px}
.memo-quick-row .memo-quick{margin-top:0}
.memo-form__body{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 18px}
.memo-form__body .fg--full{grid-column:1/-1}
.memo-form__sect{
  grid-column:1/-1;display:flex;align-items:center;gap:10px;margin:6px 0 0;
  font-size:11px;font-weight:600;letter-spacing:.08em;color:var(--muted-2);
}
.memo-form__sect:first-child{margin-top:0}
.memo-form__sect::after{content:"";flex:1 1 auto;height:1px;background:var(--line)}
.memo-level-select.is-normal{background:#f2eefe;border-color:#ddd4f9;color:#5b46c9}
.memo-level-select.is-important{background:var(--warn-soft);border-color:#fcd34d;color:var(--warn)}
.memo-level-select.is-urgent{background:var(--bad-soft);border-color:var(--bad-line);color:var(--bad)}
#memoContent{min-height:88px}
.memo-form__warn{
  grid-column:1/-1;margin:0;padding:9px 12px;border-radius:var(--radius-sm);
  background:var(--warn-soft);border:1px solid #fed7aa;color:var(--warn);font-size:12px;line-height:1.6;
}

/* 开关 */
.memo-switch{display:inline-flex;align-items:center;gap:8px;cursor:pointer;user-select:none;font-size:12.5px;color:var(--ink-2)}
.memo-switch input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.memo-switch i{
  position:relative;display:inline-block;flex:0 0 auto;
  width:36px;height:20px;border-radius:999px;background:var(--line-2);
  transition:background .16s ease;
}
.memo-switch i::after{
  content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;
  background:var(--card);box-shadow:0 1px 3px rgba(15,23,42,.28);
  transition:transform .16s ease;
}
.memo-switch input:checked + i{background:var(--brand)}
.memo-switch input:checked + i::after{transform:translateX(16px)}
.memo-switch input:focus-visible + i{box-shadow:var(--focus-ring)}

/* 分段控件 */
.memo-seg{
  display:flex;align-items:center;gap:2px;width:100%;padding:3px;
  background:var(--bg-soft);border:1px solid var(--line);border-radius:var(--radius-sm);
}
.memo-seg__btn,.memo-seg button{
  appearance:none;flex:1 1 0;height:30px;padding:0 8px;border:0;border-radius:4px;
  background:transparent;color:var(--muted);font-size:12px;font-weight:500;
  transition:background .15s ease,color .15s ease,box-shadow .15s ease;
}
.memo-seg button:hover{color:var(--ink)}
.memo-seg button.is-on{background:var(--card);color:var(--ink);box-shadow:var(--shadow)}

.memo-subfield{margin-top:8px}
.memo-quick{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}
.memo-quick__btn{
  appearance:none;height:25px;padding:0 9px;border:1px solid var(--line);border-radius:999px;
  background:var(--card);color:var(--muted);font-size:11.5px;
  transition:border-color .15s ease,color .15s ease,background .15s ease;
}
.memo-quick__btn:hover{border-color:var(--brand);color:var(--brand)}
.memo-quick__btn.is-on{background:var(--brand-soft);border-color:var(--brand);color:var(--brand)}

/* 共享 */
.memo-share-block{grid-column:1/-1}
.memo-share-block__head{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.memo-share-block__label{font-size:12.5px;font-weight:500;color:var(--ink-2)}
.memo-share-block__hint{font-size:11.5px;color:var(--muted-2)}
.memo-share-block.is-locked .memo-share-block__head{align-items:flex-start;flex-direction:column;gap:4px}
.memo-share-wrap{margin-top:10px}
.memo-share-perm{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:10px}
.memo-share-perm>span{font-size:11.5px;color:var(--muted);white-space:nowrap}
.memo-share-perm .memo-seg{max-width:280px}
.memo-share-pick{background:var(--card);border:1px solid var(--line);border-radius:var(--radius-sm);overflow:hidden}
.memo-share-pick__head{display:flex;align-items:center;gap:10px;padding:8px 10px;border-bottom:1px solid var(--line)}
.memo-share-pick__head>span{font-size:11.5px;color:var(--muted);white-space:nowrap}
.memo-share-pick__head b{color:var(--ink);font-weight:600}
.memo-share-search{flex:1 1 auto;min-width:0}
.memo-share-search .ui-search{height:28px}
.memo-share-search .ui-search__input{font-size:12px}
.memo-pick-list{max-height:210px;overflow-y:auto;padding:4px}
.memo-pick{
  display:flex;align-items:center;gap:9px;padding:6px 8px;border-radius:var(--radius-sm);
  cursor:pointer;transition:background .15s ease;
}
.memo-pick:hover{background:var(--bg-soft)}
.memo-pick input{width:15px;height:15px;flex:0 0 auto;accent-color:var(--brand)}
.memo-pick__avatar{
  display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;
  width:26px;height:26px;border-radius:50%;background:var(--brand-soft);color:var(--brand);
  font-style:normal;font-size:12px;font-weight:600;
}
.memo-pick__text{display:flex;flex-direction:column;min-width:0;line-height:1.35}
.memo-pick__text b{font-size:12.5px;color:var(--ink);font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.memo-pick__text small{font-size:10.5px;color:var(--muted-2);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.memo-pick__check{margin-left:auto;font-style:normal;font-size:13px;color:var(--good);opacity:0}
.memo-pick:has(input:checked){background:var(--brand-soft)}
.memo-pick:has(input:checked) .memo-pick__check{opacity:1}

/* ── 关于 ── */
.memo-about{display:flex;flex-direction:column;gap:16px}
.memo-about__hero{
  display:flex;align-items:flex-end;justify-content:space-between;gap:24px;flex-wrap:wrap;
  padding:26px 28px;border-radius:var(--radius);
  background:linear-gradient(120deg,#223a5a,#2f5c94 62%,#3b82c4);
  color:var(--nav-ink);box-shadow:var(--shadow-2);
}
.memo-about__hero h2{margin:6px 0 8px;font-size:22px;line-height:1.35;font-weight:650;color:var(--nav-ink)}
.memo-about__hero p{margin:0;max-width:640px;font-size:12.5px;line-height:1.75;color:rgba(242,247,255,.78)}
.memo-about__eyebrow{font-size:11px;letter-spacing:.16em;color:rgba(242,247,255,.62);text-transform:uppercase}
.memo-about__stats{display:flex;gap:10px;flex-wrap:wrap}
.memo-about__stats div{min-width:82px;padding:10px 13px;border:1px solid rgba(255,255,255,.18);border-radius:var(--radius-sm);background:rgba(255,255,255,.08)}
.memo-about__stats b{display:block;font-size:20px;line-height:1.2;color:var(--nav-ink)}
.memo-about__stats span{font-size:11px;color:rgba(242,247,255,.7)}
.memo-about__card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:18px 20px}
.memo-about__card header{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap;padding-bottom:10px;border-bottom:1px solid var(--line)}
.memo-about__card header h3{margin:0;font-size:14px;font-weight:600;color:var(--ink)}
.memo-about__card header span{font-size:11.5px;color:var(--muted-2)}
.memo-about__grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.memo-about-fields{display:grid;grid-template-columns:1fr 1fr;gap:0 24px;margin:0;padding-top:6px}
.memo-about-field{padding:8px 0;border-bottom:1px dashed var(--line)}
.memo-about-field:last-child{border-bottom:0}
.memo-about-field dt{font-size:12px;font-weight:600;color:var(--ink)}
.memo-about-field dd{margin:2px 0 0;font-size:11.5px;line-height:1.65;color:var(--muted)}
.memo-about__steps{margin:8px 0 0;padding-left:18px;font-size:12px;line-height:1.8;color:var(--ink-2)}
.memo-about__steps li{margin-bottom:6px}
.memo-about__steps code{
  padding:1px 5px;border-radius:3px;background:var(--bg-soft);
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;color:var(--brand);
}

/* ── 动画 ── */
@keyframes memoSpin{to{transform:rotate(360deg)}}
@keyframes memoFade{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}
.memo-board__list{animation:memoFade .2s ease both}

/* ── 响应式 ── */
@media (max-width:960px){
  .memo-form__body{grid-template-columns:repeat(2,minmax(0,1fr))}
  .memo-about__grid{grid-template-columns:1fr}
  .memo-about-fields{grid-template-columns:1fr}
  .memo-facts{grid-template-columns:1fr}
}
@media (max-width:720px){
  .memo-toolbar .search{flex:1 1 100%;max-width:none}
  .memo-toolbar__act{width:100%;margin-left:0}
  .memo-toolbar__act .btn{flex:1 1 auto}
  .memo-card__main{padding:11px 13px 10px 17px}
  .memo-card__foot{gap:10px}
  .memo-card__acts{margin-left:0;width:100%}
  .memo-board__filters{width:100%}
  .memo-board__field{flex:1 1 0;min-width:0}
  .memo-board__field select{flex:1 1 auto;width:100%;min-width:0;max-width:none}
  .memo-form__body{grid-template-columns:1fr}
  .memo-form__head{flex-wrap:wrap}
  .memo-form__headact{width:100%;justify-content:flex-end}
  .memo-about__hero{padding:22px 18px}
  .memo-about__hero h2{font-size:19px}
}
