/* ============ 人脉列表 ============ */
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 2px 10px;
}
.list-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .03em;
}
.list-head .count { font-size: 12px; color: var(--muted); }

.contact-list { display: flex; flex-direction: column; gap: 9px; }
.contact-row {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.contact-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.contact-row:active { transform: scale(.995); }

.avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--av-bg, #e9e2d4);
  color: var(--av-ink, #5c5344);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  user-select: none;
}
.c-main { min-width: 0; }
.c-name-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.c-name-line .c-name {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12em;
}
.level-dots { display: inline-flex; gap: 2.5px; align-items: center; }
.level-dots i {
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: var(--line-strong);
}
.level-dots i.on { background: var(--accent); }
.chip-group {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--sage-wash);
  color: var(--sage);
  white-space: nowrap;
}
.c-meta {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c-tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.tag {
  font-size: 10.5px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  white-space: nowrap;
}
.c-cols { display: none; }
.c-mobile-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c-mobile-meta b { font-weight: 500; color: var(--ink-2); }
.c-mobile-meta .sep { opacity: .45; }
.c-mobile-meta .due-soon { color: var(--accent); font-weight: 500; }
.c-arrow { color: var(--line-strong); justify-self: end; }
.c-arrow svg { width: 16px; height: 16px; }

.c-col .k { display: block; font-size: 10px; letter-spacing: .08em; color: var(--muted); }
.c-col .v { display: block; font-size: 12.5px; margin-top: 3px; color: var(--ink-2); }
.c-col .v.accent { color: var(--accent); font-weight: 600; }

.list-foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 18px 0 4px;
}

/* ============ 任务 ============ */
.task-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0 14px;
}
.tabs {
  display: inline-flex;
  padding: 4px;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  align-self: flex-start;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--ink-2);
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.tab span {
  font-size: 10.5px;
  min-width: 17px;
  padding: 0 5px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
}
.tab.active { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
.tab.active span { background: rgba(255, 253, 247, .18); color: var(--paper); }
.toolbar-hint { font-size: 11.5px; color: var(--muted); }

.task-group { margin-bottom: 22px; }
.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px 9px;
}
.group-head h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
}
.group-head .n { font-size: 11.5px; color: var(--muted); }
.group-head.overdue h2 { color: var(--accent); }
.group-head .rule { flex: 1; height: 1px; background: var(--line); }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.task-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.task-item.is-overdue { border-left: 3px solid var(--accent); padding-left: 12px; }
.task-item.is-today { border-left: 3px solid #c99a4e; padding-left: 12px; }

.tcheck {
  position: relative;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  margin-top: 1px;
  border: 1.6px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: transparent;
  background: var(--surface);
  transition: all .16s ease;
}
/* 扩大触控热区，便于单手操作 */
.tcheck::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}
.tcheck svg { width: 12px; height: 12px; stroke-width: 2.6; }
.tcheck:hover { border-color: var(--sage); color: var(--sage); background: var(--sage-wash); }

.t-body { flex: 1; min-width: 0; }
.t-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
}
.t-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.t-meta .sep { opacity: .5; }
.t-meta .due { font-weight: 500; color: var(--ink-2); }
.t-meta .due.overdue { color: var(--accent); }
.t-meta .due.today { color: #9a6c22; font-weight: 600; }
.t-note {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.chip-type {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-weight: 400;
}
.chip-repeat {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-dark);
  font-weight: 400;
}
.t-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  margin: -2px -4px 0 0;
}
.t-actions button {
  padding: 4px 7px;
  font-size: 11px;
  color: var(--muted);
  border-radius: 6px;
}
.t-actions button:hover { background: var(--surface-2); color: var(--ink); }
.t-actions button.del:hover { color: var(--danger); background: #faeae5; }

.task-item.done { opacity: .62; }
.task-item.done .t-title { text-decoration: line-through; text-decoration-thickness: 1px; }
.task-item.done .tcheck { background: var(--sage); border-color: var(--sage); color: var(--paper); }

/* ============ 空状态 ============ */
.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--surface-2);
  padding: 44px 24px;
  text-align: center;
}
.empty .ill { width: 92px; height: 76px; margin: 0 auto 16px; color: var(--line-strong); }
.empty h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 6px;
}
.empty p { font-size: 13px; color: var(--muted); max-width: 26em; margin: 0 auto; line-height: 1.65; }
.empty .btn { margin-top: 18px; }

/* ============ 抽屉内容 ============ */
.drawer-head {
  position: relative;
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.drawer-head .close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
}
.drawer-head .close:hover { background: var(--paper); }
.drawer-head .close svg { width: 15px; height: 15px; }
.dh-id { display: flex; align-items: center; gap: 13px; padding-right: 40px; }
.dh-id .avatar { width: 54px; height: 54px; flex-basis: 54px; font-size: 22px; }
.dh-name {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dh-role { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.dh-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.dh-actions { display: flex; gap: 8px; margin-top: 16px; }
.dh-actions .btn { flex: 1; min-height: 38px; font-size: 12.5px; padding: 0 10px; }

.drawer-body { padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.d-section > h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.d-section > h3 .mini { font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--accent); font-weight: 500; }

.info-grid { border-top: 1px solid var(--line); }
.info-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.info-item .k { color: var(--muted); flex: 0 0 auto; font-size: 12px; }
.info-item .v { text-align: right; color: var(--ink-2); overflow-wrap: anywhere; }
.info-item .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.d-note {
  padding: 12px 14px;
  background: var(--surface-2);
  border-left: 2px solid var(--line-strong);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.65;
  white-space: pre-wrap;
}

.timeline { position: relative; padding-left: 18px; display: flex; flex-direction: column; gap: 16px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 5px;
  bottom: 5px;
  width: 1px;
  background: var(--line);
}
.tl-item { position: relative; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
}
.tl-item:first-child::before { border-color: var(--accent); background: var(--accent); }
.tl-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tl-date { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.tl-note { margin-top: 3px; font-size: 13px; color: var(--ink-2); line-height: 1.55; overflow-wrap: anywhere; }
.tl-empty { font-size: 12.5px; color: var(--muted); padding: 4px 0; }

.ix-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ix-form input, .ix-form select, .ix-form textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
}
.ix-form textarea { grid-column: 1 / -1; min-height: 52px; resize: vertical; }
.ix-form input:focus, .ix-form select:focus, .ix-form textarea:focus { border-color: var(--accent); }
.ix-form .btn { grid-column: 1 / -1; min-height: 36px; font-size: 12.5px; }

.mini-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.mini-task:last-child { border-bottom: 0; }
.mini-task .tcheck { width: 20px; height: 20px; flex-basis: 20px; margin: 0; }
.mini-task .mt-main { flex: 1; min-width: 0; }
.mini-task .mt-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-task .mt-date { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.mini-task .mt-date.overdue { color: var(--accent); }

.drawer-foot {
  margin-top: auto;
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  gap: 8px;
}
.drawer-foot .btn { flex: 1; min-height: 40px; font-size: 12.5px; }

/* 移动端避免 iOS 聚焦输入框时自动放大 */
@media (max-width: 559px) {
  .search-box input,
  .field input,
  .field select,
  .field textarea,
  .ix-form input,
  .ix-form select,
  .ix-form textarea { font-size: 16px; }
}

/* ============ 响应式 ============ */
@media (min-width: 560px) {
  .main { padding: calc(26px + env(safe-area-inset-top)) 28px 100px; }
  .view-head h1 { font-size: 38px; }
  .stat-row { grid-template-columns: repeat(4, 1fr); }
  .stat:nth-child(odd) { border-right: 0; }
  .stat { border-bottom: 0; border-right: 1px solid var(--line); }
  .stat:last-child { border-right: 0; }
  .toolbar { flex-direction: row; align-items: center; }
  .search-box { flex: 1; }
  .toolbar-actions { flex: 0 0 auto; }
  .toolbar-actions .btn { flex: 0 0 auto; }
  .contact-row { grid-template-columns: 46px minmax(0, 1fr) auto 18px; }
  .c-mobile-meta { display: none; }
  .c-cols { display: flex; gap: 26px; }
  .grid-2 { gap: 14px; }
  .form-actions .btn { flex: 0 0 auto; min-width: 96px; }
  .form-actions .btn.primary { flex: 0 0 auto; }
  .form-actions { justify-content: flex-end; }
  .modal-overlay { align-items: center; padding: 28px; }
  .modal {
    max-width: 580px;
    border-radius: 20px;
    max-height: 88vh;
    padding: 26px 26px 22px;
    animation: modal-pop .26s cubic-bezier(.22, .8, .3, 1) both;
  }
  @keyframes modal-pop {
    from { transform: translateY(14px) scale(.985); opacity: .4; }
    to { transform: none; opacity: 1; }
  }
  .drawer { border-left: 1px solid var(--line); }
  .dh-actions { max-width: 100%; }
}

@media (min-width: 980px) {
  .app { display: flex; }
  .bottom-nav, .topbar { display: none; }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 34px;
    position: fixed;
    inset: 0 auto 0 0;
    width: 252px;
    padding: 30px 22px 24px;
    background: var(--sidebar);
    color: var(--sidebar-ink);
    z-index: 50;
  }
  .sidebar .brand { color: var(--sidebar-ink); }
  .sidebar .brand-text span { color: var(--sidebar-muted); }
  .side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
  .side-nav .nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 11px;
    font-size: 14px;
    color: var(--sidebar-muted);
    text-align: left;
    transition: background .16s ease, color .16s ease;
  }
  .side-nav .nav-btn svg { width: 19px; height: 19px; }
  .side-nav .nav-btn:hover { background: rgba(240, 236, 223, .06); color: var(--sidebar-ink); }
  .side-nav .nav-btn.active {
    background: rgba(240, 236, 223, .1);
    color: var(--sidebar-ink);
    box-shadow: inset 2px 0 0 var(--accent);
  }
  .nav-count {
    margin-left: auto;
    font-size: 10.5px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: none;
    place-items: center;
    border-radius: 999px;
    background: rgba(240, 236, 223, .14);
    color: var(--sidebar-ink);
  }
  .nav-count.has-count { display: inline-grid; }
  .nav-count.alert.has-count { background: var(--accent); }
  .side-foot { margin-top: auto; border-top: 1px solid rgba(240, 236, 223, .12); padding-top: 16px; }
  .side-date { font-size: 12px; color: var(--sidebar-ink); letter-spacing: .04em; }
  .side-note { font-size: 10.5px; color: var(--sidebar-muted); margin-top: 4px; }

  .main { margin-left: 252px; padding: 54px 54px 90px; }
  .view { max-width: 1000px; margin: 0 auto; }
  .view-head { margin-bottom: 26px; }
  .view-head h1 { font-size: 42px; }
  .view-head .sub { font-size: 14px; }
  .stat-row { background: transparent; border: 0; gap: 12px; box-shadow: none; }
  .stat {
    background: var(--surface);
    border: 1px solid var(--line) !important;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
  }
  .stat .v { font-size: 30px; }
  .contact-row { grid-template-columns: 46px minmax(0, 1fr) 108px 108px 20px; padding: 15px 18px; }
  .contact-row .avatar { width: 46px; height: 46px; }
  .toolbar { margin: 24px 0 14px; }
  .task-toolbar { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 24px; }
  .task-item { padding: 16px 18px; }
  .drawer { max-width: 440px; }
  .dh-actions { gap: 10px; }
  .list-head { margin-top: 26px; }
  .toast { bottom: 34px; }
}

/* 折叠屏展开态（vivo X Fold5 内屏约 733px 宽） */
@media (min-width: 680px) and (max-width: 979px) {
  .main { padding: calc(30px + env(safe-area-inset-top)) 34px 104px; }
  .view-head h1 { font-size: 40px; }
  .contact-row { grid-template-columns: 46px minmax(0, 1fr) 118px 118px 20px; padding: 15px 18px; }
  .drawer { max-width: 520px; }
  .modal { max-width: 600px; }
  .bottom-nav {
    padding-left: max(14px, calc((100vw - 760px) / 2));
    padding-right: max(14px, calc((100vw - 760px) / 2));
  }
}

@supports (height: 100dvh) {
  .drawer { height: 100dvh; }
  .modal { max-height: 92dvh; }
}
