:root {
  --wechat-green: #07c160;
  --wechat-green-dark: #06ad57;
  --bg: #ededed;
  --surface: #f7f7f7;
  --text: #191919;
  --muted: #868686;
  --line: #dedede;
  --self-bubble: #95ec69;
  --other-bubble: #ffffff;
  --badge: #fa5151;
  --iphone17pro-w: 1206;
  --iphone17pro-h: 2622;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Noto Sans SC", sans-serif;
  background: linear-gradient(180deg, #dce6dc, #cdd9cd 35%, #c6d2c6);
  color: var(--text);
}

body {
  display: block;
  min-height: 100dvh;
}

.phone-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.auth-view {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(180deg, rgba(238, 245, 238, 0.96), rgba(235, 240, 235, 0.98));
}

.auth-view.active {
  display: flex;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e7e7e7;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.09);
  padding: 18px 14px 14px;
}

.auth-card h2 {
  margin: 0;
  font-size: 20px;
}

.auth-subtitle {
  margin: 5px 0 0;
  color: #6f6f6f;
  font-size: 12px;
}

.auth-mode {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-mode-btn {
  border: 1px solid #dddddd;
  border-radius: 8px;
  background: #f8f8f8;
  color: #5a5a5a;
  font-size: 13px;
  padding: 8px 0;
}

.auth-mode-btn.active {
  border-color: #9dd2b4;
  background: #ecf8f1;
  color: #257248;
  font-weight: 700;
}

.auth-form {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.auth-form label {
  font-size: 12px;
  color: #666;
}

.auth-form input,
.auth-form select {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  font-size: 14px;
  padding: 9px 10px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.auth-form input:focus,
.auth-form input:focus-visible,
.auth-form select:focus,
.auth-form select:focus-visible {
  border-color: #8ac7a7;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.13);
}

.auth-submit {
  margin-top: 4px;
}

.auth-tip {
  margin: 10px 2px 0;
  font-size: 12px;
  color: #666;
}

.form-status {
  margin: 10px 2px 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
}

.form-status.error {
  background: #fff3f2;
  border: 1px solid #f2c8c4;
  color: #b23a31;
}

.form-status.success {
  background: #f1fbf4;
  border: 1px solid #c7e8d1;
  color: #1d7a43;
}

.editor-input.input-error {
  border-color: #db6b62;
  box-shadow: 0 0 0 2px rgba(219, 107, 98, 0.12);
}

.top-bar {
  background: #f7f7f7;
  color: #1f1f1f;
  border-bottom: none;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 18px 10px;
}

.top-main {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.back-btn,
.icon-btn {
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f1f1f1;
  color: #2b2b2b;
  font-size: 18px;
}

.back-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.back-btn.hidden {
  display: none;
}

.title-wrap h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1f1f1f;
}

.title-wrap {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.title-wrap p {
  display: none;
}

.view {
  display: none;
  min-height: 0;
}

.view.active {
  display: grid;
}

#chatView {
  min-height: 0;
}

.chat-list-pane,
.chat-detail-pane {
  min-height: 0;
  display: grid;
}

.chat-list-pane {
  grid-template-rows: auto auto 1fr;
  background: #ededed;
}

.search-row {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f7;
}

.search-row input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-row input:focus,
.search-row input:focus-visible {
  border-color: #7fd9a8;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.16);
}

.chat-list {
  overflow-y: auto;
  background: #ffffff;
}

.record-focus-card {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  background:
    radial-gradient(circle at top right, rgba(24, 179, 104, 0.14), transparent 38%),
    linear-gradient(135deg, #f8fff8, #eef8f0);
  border-bottom: 1px solid #dceadf;
}

.record-focus-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.record-focus-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: #173927;
}

.record-focus-meta {
  font-size: 11px;
  color: #4e8468;
  text-align: right;
}

.record-focus-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.record-focus-action {
  flex: 0 0 auto;
  border: 1px solid #d2e6d7;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #21543a;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
}

.record-focus-action:hover {
  background: #ffffff;
}

.chat-row {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid #f0f0f0;
}

.chat-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  width: var(--chat-actions-width, 192px);
}

.chat-action-btn {
  border: none;
  color: #fff;
  font-size: 13px;
  width: 64px;
}

.chat-action-btn.pin-btn {
  background: #6a9cf5;
}

.chat-action-btn.mute-btn {
  background: #8d8d8d;
}

.chat-action-btn.delete-btn {
  background: #fa5151;
}

.chat-item {
  border: none;
  background: #fff;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  transition: transform 0.2s ease;
  transform: translateX(0);
  position: relative;
  z-index: 1;
}

.chat-row.open .chat-item {
  transform: translateX(calc(var(--chat-actions-width, 192px) * -1));
}

.chat-item.active {
  background: #f5f5f5;
}

.chat-avatar {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #dfe6dd;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.chat-avatar,
.message-item .avatar,
.role-avatar,
.archive-avatar,
.avatar-preview,
.avatar-upload-preview {
  position: relative;
  overflow: hidden;
  user-select: none;
  font-weight: 600;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-main {
  min-width: 0;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.chat-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chat-name {
  font-size: 16px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-pin {
  flex: 0 0 auto;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 999px;
  color: #4d79d6;
  background: #e8efff;
}

.chat-pin.hidden {
  display: none;
}

.chat-archived {
  flex: 0 0 auto;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 999px;
  color: #8a5d1c;
  background: #f5e7c8;
}

.chat-archived.hidden {
  display: none;
}

.chat-time {
  font-size: 11px;
  color: #9a9a9a;
  white-space: nowrap;
}

.chat-preview {
  margin-top: 4px;
  font-size: 13px;
  color: #989898;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 5px;
  min-width: 34px;
}

.chat-muted {
  font-size: 12px;
  line-height: 1;
}

.chat-muted.hidden {
  display: none;
}

.chat-row.swiping .chat-item {
  transition: none;
}

.chat-row .chat-item {
  cursor: pointer;
}

.chat-row.archived .chat-item {
  background: #fcfcfc;
}

.chat-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--badge);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
}

.chat-badge.hidden {
  display: none;
}

.chat-detail-pane {
  grid-template-rows: 1fr auto;
}

.chat-detail-pane.hidden,
.chat-list-pane.hidden {
  display: none;
}

.message-list {
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background: #ebebeb;
  background-image: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.3), transparent 35%);
}

.message-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 12px;
}

.message-day-divider {
  width: fit-content;
  max-width: 100%;
  margin: 4px auto 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #7b7b7b;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.message-item.self {
  flex-direction: row-reverse;
}

.message-item .avatar {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #d8d8d8;
  font-size: 16px;
}

.message-item.self .avatar {
  background: #cdeac1;
}

.bubble-wrap {
  max-width: calc(100% - 50px);
}

.meta {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}

.bubble {
  border-radius: 5px;
  padding: 9px 10px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.message-item.self .bubble {
  background: var(--self-bubble);
}

.message-item:not(.self) .bubble {
  background: var(--other-bubble);
}

.message-item.proactive .bubble {
  border: 1px dashed #6aa882;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
  border-top: 1px solid var(--line);
  background: #f6f6f6;
}

.composer.readonly {
  background: #f2f2f2;
}

.composer textarea {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  min-height: 38px;
  max-height: 160px;
  resize: none;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer.readonly textarea {
  background: #f4f4f4;
  color: #888;
  border-color: #dddddd;
}

.composer textarea:focus,
.composer textarea:focus-visible {
  border-color: #62cd94;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.2);
}

.composer textarea:disabled {
  cursor: not-allowed;
}

.composer button,
.save-btn {
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  background: var(--wechat-green);
  color: #fff;
}

#sendBtn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

#sendBtn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer button:disabled {
  opacity: 0.6;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f4f4f4;
  border-bottom: 1px solid var(--line);
}

.view-header h2 {
  margin: 0;
  font-size: 16px;
}

#timelineView {
  grid-template-rows: auto auto 1fr;
  background: #f3f3f3;
}

.timeline-summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 12px 12px 0;
  padding: 10px 14px;
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(24, 179, 104, 0.16), transparent 34%),
    linear-gradient(145deg, #ffffff, #f4fbf6);
  box-shadow: 0 6px 16px rgba(31, 64, 46, 0.06);
}

.timeline-summary-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: #173927;
}

.timeline-summary-desc {
  font-size: 11px;
  color: #5d6e66;
  text-align: right;
}

@media (max-width: 560px) {
  .record-focus-head,
  .timeline-summary-card {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .record-focus-meta,
  .timeline-summary-desc {
    text-align: left;
  }
}

.timeline-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 12px 0;
}

.timeline-generate-btn,
.timeline-export-btn {
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.timeline-generate-btn {
  background: linear-gradient(135deg, #18b368, #07c160);
  color: #fff;
  box-shadow: 0 8px 18px rgba(7, 193, 96, 0.18);
}

.timeline-generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(7, 193, 96, 0.22);
}

.timeline-export-btn {
  background: #ffffff;
  color: #2f5e47;
  border: 1px solid #d8e4d8;
  box-shadow: 0 6px 16px rgba(29, 58, 43, 0.08);
}

.timeline-export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(29, 58, 43, 0.12);
}

.timeline-generate-btn:disabled,
.timeline-export-btn:disabled {
  cursor: default;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

.setting-card input,
.setting-card textarea,
.setting-card select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.setting-card textarea {
  resize: vertical;
  min-height: 72px;
}

.setting-card input:focus,
.setting-card input:focus-visible,
.setting-card textarea:focus,
.setting-card textarea:focus-visible,
.setting-card select:focus,
.setting-card select:focus-visible {
  border-color: #7fd9a8;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.16);
}

.hidden {
  display: none;
}

.timeline-list {
  overflow-y: auto;
  padding: 12px 10px 20px;
  position: relative;
}

.timeline-list::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #d5d5d5, #e5e5e5);
}

.timeline-empty {
  margin: 40px 12px;
  padding: 16px 14px;
  border-radius: 10px;
  background: #fff;
  color: #7a7a7a;
  font-size: 13px;
  text-align: center;
}

.timeline-entry {
  position: relative;
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.timeline-track {
  position: relative;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 13px;
  margin-left: 2px;
  border-radius: 50%;
  background: #07c160;
  box-shadow: 0 0 0 3px #e8f8ef;
}

.timeline-entry.gap-entry .timeline-dot {
  background: #ff7a45;
  box-shadow: 0 0 0 3px #fff1ea;
}

.timeline-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  padding: 10px 11px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.timeline-entry.gap-entry .timeline-card {
  border-color: #ffd8c9;
  background: linear-gradient(180deg, #fffaf7, #fff6f1);
}

.timeline-content {
  display: block;
}

.timeline-date-outside {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 1px 0 6px;
  color: #2d2d2d;
}

.timeline-date-day {
  font-size: 23px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.timeline-date-month {
  font-size: 12px;
  color: #6d6d6d;
  font-weight: 600;
}

.timeline-date-weekday {
  font-size: 11px;
  color: #8a8a8a;
  font-weight: 500;
}

.timeline-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.diary-title {
  font-weight: 700;
  font-size: 14px;
}

.diary-style {
  font-size: 11px;
  background: #e6f6ec;
  color: #2a8c54;
  border-radius: 999px;
  padding: 2px 8px;
}

.timeline-entry.gap-entry .diary-style {
  background: #ffe9de;
  color: #cc4e1d;
}

.diary-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.diary-content {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  position: relative;
}

.diary-content.collapsed {
  max-height: calc(1.6em * 5);
  overflow: hidden;
  white-space: pre-wrap;
}

.diary-content.collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.1em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 76%);
}

.diary-more-btn {
  margin-top: 4px;
  border: none;
  background: transparent;
  color: #576b95;
  font-size: 13px;
  padding: 0;
  line-height: 1.4;
  cursor: pointer;
}

.diary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.diary-tag {
  background: #f3f3f3;
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 7px;
  color: #4f4f4f;
}

.settings-view {
  min-height: 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.settings-view.view.active {
  display: block;
  min-height: 0;
}

.profile-panel {
  margin: 0 12px;
  border-radius: 12px;
  border: 1px solid #e2e2e2;
  background: #fff;
  overflow: hidden;
}

.profile-row {
  border: none;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 13px 12px;
}

.profile-row:last-child {
  border-bottom: none;
}

.profile-row:active {
  background: #f7f7f7;
}

.row-label {
  font-size: 15px;
  color: #1e1e1e;
}

.row-value {
  justify-self: end;
  max-width: 70%;
  color: #8b8b8b;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-preview {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dfe6dd;
  display: grid;
  place-items: center;
  font-size: 21px;
  line-height: 1;
}

.row-arrow {
  color: #b3b3b3;
  font-size: 19px;
  line-height: 1;
}

.settings-section-title {
  margin: 10px 14px 4px;
  color: #8b8b8b;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.settings-tip {
  margin: 0 14px;
  color: #8a8a8a;
  font-size: 12px;
  line-height: 1.5;
}

.setting-card {
  margin: 0 12px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e1e1e1;
  padding: 10px;
}

.setting-card label {
  display: block;
  color: #6a6a6a;
  font-size: 12px;
  margin-bottom: 7px;
}

.setting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 12px;
}

.setting-grid .setting-card {
  margin: 0;
}

.save-btn {
  margin: 0 12px;
  background: var(--wechat-green-dark);
}

.logout-btn {
  margin: 0 12px;
  display: block;
  width: calc(100% - 24px);
  border: 1px solid #d9d9d9;
  background: #fff;
  color: #666;
  border-radius: 6px;
  font-size: 13px;
  padding: 8px 12px;
}

.profile-editor-sheet {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: none;
}

.profile-editor-sheet.active {
  display: block;
}

.editor-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.24);
}

.editor-card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: calc(100% - 8px);
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.2s ease;
}

.profile-editor-sheet.active .editor-card {
  transform: translateY(0);
}

.editor-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 8px;
  border-bottom: 1px solid #efefef;
}

.editor-btn {
  border: none;
  background: transparent;
  color: #666;
  font-size: 14px;
  padding: 6px 8px;
}

.editor-btn.primary {
  color: var(--wechat-green-dark);
  font-weight: 700;
}

.editor-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

.editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.editor-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  border: 1px solid #d8d8d8;
  border-radius: 9px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  outline: none;
}

.editor-input:focus,
.editor-input:focus-visible {
  border-color: #8ac7a7;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.12);
}

.editor-body textarea.editor-input {
  resize: vertical;
  min-height: 120px;
}

.password-editor-body label {
  display: block;
  margin: 0 0 8px;
  color: #585858;
  font-size: 13px;
}

.password-editor-body .editor-input {
  margin-bottom: 14px;
}

.password-editor-tip {
  margin: 4px 2px 0;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  transform: translateX(-50%);
  max-width: min(88vw, 360px);
  background: rgba(28, 28, 28, 0.88);
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  z-index: 40;
  text-align: center;
}

.api-status {
  margin: 0 12px;
  color: #5a5a5a;
  font-size: 12px;
}

.tab-bar {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fafafa;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab {
  border: none;
  background: none;
  padding: 8px 4px 7px;
  color: #777;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.tab-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.tab-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-label {
  line-height: 1;
}

.tab.active {
  color: var(--wechat-green);
  font-weight: 700;
}

.empty-block {
  font-size: 13px;
  color: #7a7a7a;
  text-align: center;
  margin-top: 22px;
  padding: 0 20px;
}

.roles-view {
  align-content: start;
  gap: 10px;
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
  overflow-y: auto;
  background: #f3f3f3;
}

@media (min-width: 900px) {
  body {
    padding: 20px;
  }

  .phone-shell {
    width: min(100%, 1440px);
    height: calc(100vh - 40px);
    height: calc(100dvh - 40px);
    margin: 0 auto;
    border-radius: 28px;
    border: 1px solid rgba(153, 171, 153, 0.4);
    overflow: hidden;
    box-shadow: 0 18px 56px rgba(48, 66, 48, 0.14);
  }

  .top-bar {
    padding-left: max(24px, env(safe-area-inset-left, 0px) + 16px);
    padding-right: max(24px, env(safe-area-inset-right, 0px) + 16px);
  }

  .title-wrap p {
    display: block;
    margin: 4px 0 0;
    font-size: 12px;
    color: #878787;
  }

  #chatView.view.active {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  }

  .chat-list-pane {
    border-right: 1px solid #dddddd;
    background: #fff;
  }

  .chat-detail-pane {
    display: grid;
    min-width: 0;
  }

  .chat-detail-pane.hidden {
    display: grid;
  }

  .search-row {
    padding: 12px;
  }

  .record-focus-card,
  .timeline-summary-card {
    width: min(100%, 1040px);
    margin-left: auto;
    margin-right: auto;
  }

  .record-focus-card {
    margin-top: 0;
    border-bottom: none;
    border-radius: 0 0 22px 22px;
  }

  .timeline-summary-card {
    margin-top: 0;
  }

  .chat-detail-pane .message-list {
    padding: 18px 24px;
  }

  .composer {
    padding-left: 24px;
    padding-right: 24px;
  }

  #timelineView {
    padding: 18px 24px 24px;
  }

  .timeline-list {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 20px 0 28px;
  }

  .roles-view,
  .settings-view {
    padding: 18px 24px 24px;
  }

  .roles-toolbar,
  .role-list,
  .archive-panel,
  .settings-section-title,
  .settings-tip,
  .profile-panel,
  .logout-btn,
  .api-status {
    width: min(100%, 1040px);
    margin-left: auto;
    margin-right: auto;
  }

  .profile-editor-sheet,
  .action-sheet {
    padding: 28px;
  }

  .editor-card {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(100%, 560px);
    max-height: min(86vh, 720px);
    border-radius: 20px;
    transform: translate(-50%, calc(-50% + 28px));
  }

  .profile-editor-sheet.active .editor-card {
    transform: translate(-50%, -50%);
  }

  .action-sheet.active {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .action-sheet-card {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    top: auto;
    width: min(100%, 460px);
    margin: 0 auto;
    transform: none;
    border-radius: 16px;
    z-index: 1;
  }
}

.roles-toolbar {
  display: grid;
  gap: 8px;
}

.role-quick-btn {
  border: 1px solid #e7e7e7;
  border-radius: 12px;
  background: #fff;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  text-align: left;
}

.role-quick-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
}

.role-quick-icon.custom {
  background: linear-gradient(180deg, #35cf84, #1fb86f);
  color: #fff;
}

.role-quick-icon.preset {
  background: linear-gradient(180deg, #7fa6ff, #5a82e0);
  color: #fff;
}

.role-quick-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.role-quick-title {
  font-size: 14px;
  font-weight: 600;
  color: #232323;
}

.role-quick-hint {
  font-size: 11px;
  color: #7e7e7e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-quick-arrow {
  color: #b0b0b0;
  font-size: 18px;
  line-height: 1;
}

.role-list {
  display: grid;
  gap: 8px;
}

.role-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 11px;
  padding: 10px;
}

.role-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #dfe6dd;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.role-main {
  min-width: 0;
}

.role-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-name {
  font-size: 15px;
  font-weight: 600;
}

.role-kind {
  font-size: 10px;
  color: #6d6d6d;
  background: #f0f0f0;
  border-radius: 999px;
  padding: 1px 6px;
}

.role-desc {
  margin-top: 3px;
  color: #7d7d7d;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.role-action {
  border: 1px solid #e4e8ed;
  background: #f7f9fb;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #5e6f86;
}

.role-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.role-action svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.role-action.edit {
  color: #4a7fdf;
}

.role-action.delete {
  color: #d86060;
  border-color: #f3dcdc;
  background: #fff6f6;
}

.role-editor-body {
  display: grid;
  gap: 7px;
}

.role-editor-body label {
  color: #676767;
  font-size: 12px;
}

.proactive-template-tip {
  margin: 2px 0 0;
}

.avatar-upload-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.avatar-upload-preview {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 1px solid #e2e2e2;
  background: #e6ece4;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.avatar-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avatar-upload-btn {
  border: 1px solid #d2d2d2;
  background: #fff;
  color: #444;
  font-size: 12px;
  border-radius: 7px;
  padding: 6px 10px;
}

.avatar-upload-btn.secondary {
  background: #f7f7f7;
  color: #666;
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.role-section-title {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #efefef;
  font-size: 12px;
  font-weight: 700;
  color: #4b4b4b;
}

.role-proactive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.role-proactive-field {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.role-proactive-item {
  display: grid;
  gap: 5px;
}

.role-proactive-item-span-2 {
  grid-column: 1 / -1;
}

.role-proactive-item label {
  font-size: 11px;
  color: #6f6f6f;
}

.role-proactive-field.hidden,
.role-proactive-item.hidden {
  display: none;
}

.role-time-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.role-time-range-separator {
  font-size: 12px;
  color: #8a8a8a;
}

.role-proactive-hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.45;
  color: #7a7a7a;
}

.role-proactive-summary {
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 10px;
  background: #f6f7f3;
  border: 1px solid #e8eadf;
}

.role-proactive-summary-text {
  font-size: 12px;
  line-height: 1.55;
  color: #4b4f42;
}

.preset-list {
  display: grid;
  gap: 8px;
}

.preset-item {
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 9px;
  display: grid;
  gap: 6px;
}

.preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preset-title {
  display: flex;
  align-items: center;
  gap: 7px;
}

.preset-title .avatar {
  font-size: 20px;
}

.preset-title .name {
  font-size: 14px;
  font-weight: 600;
}

.preset-desc {
  font-size: 12px;
  color: #727272;
}

.preset-add-btn {
  border: none;
  border-radius: 6px;
  font-size: 12px;
  padding: 5px 10px;
  background: var(--wechat-green-dark);
  color: #fff;
}

.preset-add-btn:disabled {
  background: #b6b6b6;
}

.archive-panel {
  margin-top: 2px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 11px;
  overflow: hidden;
}

.archive-head {
  padding: 9px 10px;
  border-bottom: 1px solid #efefef;
  background: #f8f8f8;
}

.archive-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #4e4e4e;
}

.archive-list {
  display: grid;
}

.archive-item {
  border: none;
  border-top: 1px solid #f2f2f2;
  background: #fff;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
}

.archive-item:first-child {
  border-top: none;
}

.archive-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: #ececec;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.archive-main {
  min-width: 0;
}

.archive-line-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.archive-name {
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.archive-time {
  font-size: 11px;
  color: #9a9a9a;
  white-space: nowrap;
}

.archive-preview {
  margin-top: 4px;
  font-size: 12px;
  color: #7a7a7a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-actions {
  display: grid;
  gap: 5px;
}

.archive-action-btn {
  border: none;
  border-radius: 6px;
  font-size: 12px;
  padding: 4px 8px;
  color: #fff;
}

.archive-action-btn.view {
  background: #6a9cf5;
}

.archive-action-btn.delete {
  background: #fa5151;
}

.archive-card {
  max-height: min(88vh, 680px);
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.archive-viewer-meta {
  border-bottom: 1px solid #efefef;
  padding: 8px 12px;
  color: #666;
  font-size: 12px;
}

.archive-message-list {
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background: #ebebeb;
}

.action-sheet {
  position: absolute;
  inset: 0;
  z-index: 52;
  display: none;
}

.action-sheet.active {
  display: block;
}

.action-sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.action-sheet-card {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: #f2f2f2;
  border-radius: 12px;
  overflow: hidden;
}

.action-sheet-title {
  padding: 11px 10px;
  text-align: center;
  color: #7a7a7a;
  font-size: 12px;
  background: #fafafa;
  border-bottom: 1px solid #ececec;
}

.action-sheet-btn {
  width: 100%;
  border: none;
  border-top: 1px solid #ededed;
  background: #fff;
  padding: 13px 12px;
  font-size: 16px;
}

.action-sheet-btn:first-of-type {
  border-top: none;
}

.action-sheet-btn.primary {
  color: #07c160;
  font-weight: 600;
}

.action-sheet-btn.danger {
  color: #fa5151;
}

.action-sheet-btn.danger.stronger {
  font-weight: 700;
}

.action-sheet-btn.cancel {
  margin-top: 8px;
  font-weight: 600;
  color: #3d3d3d;
}

@media (max-width: 430px) {
  .phone-shell {
    height: 100vh;
    height: 100dvh;
  }
}
