.page-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--module-bottom-nav-offset, calc(54px + env(safe-area-inset-bottom, 0px)));
  z-index: 90;
  background: #f5f5f5;
  overflow: hidden;
}
.page-panel.show {
  display: flex;
  flex-direction: column;
  z-index: 130;
}
.page-panel .panel-topbar {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  z-index: 2;
}
.page-panel .panel-topbar .panel-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #333;
}
.page-panel .panel-topbar .panel-back {
  border: none;
  background: none;
  font-size: 28px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0 8px 0 0;
  flex: 0 0 auto;
}
.notes-panel-topbar .panel-title {
  flex: 1;
  min-width: 0;
}
.notes-manage-toggle {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: #444;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 2px 4px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.notes-manage-toggle:active {
  opacity: .7;
}
.notes-manage-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid #ececec;
  z-index: 2;
}
.notes-manage-bar[hidden] {
  display: none !important;
}
.notes-manage-count {
  font-size: 13px;
  color: #888;
}
.notes-delete-btn {
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #bbb;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: not-allowed;
  min-height: 0;
}
.notes-delete-btn:not(:disabled) {
  border-color: #d73a31;
  color: #d73a31;
  cursor: pointer;
}
.notes-delete-btn:not(:disabled):active {
  background: #fff5f5;
}
#notesPanel.notes-manage-mode .record-arrow,
#aiCasesPanel.notes-manage-mode .record-arrow {
  display: none;
}
#notesPanel.notes-manage-mode .record-item,
#aiCasesPanel.notes-manage-mode .record-item {
  cursor: default;
}
.record-check {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin-right: 2px;
}
.record-check-input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #333;
  cursor: pointer;
}
.record-item--manage {
  gap: 8px;
}
.page-panel .panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px 12px;
  -webkit-overflow-scrolling: touch;
}
#notesPanel .panel-body,
#aiCasesPanel .panel-body {
  padding: 12px 12px 12px;
  background: #f5f5f5;
}
#managePanel .panel-body,
#profilePanel .panel-body,
#referralPanel .panel-body {
  padding: 0;
  background: #f7f8f7;
}
#managePanel .manage-page,
#profilePanel .profile-page,
#referralPanel .profile-page {
  padding-bottom: 20px;
  box-sizing: border-box;
}
.record-list {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
  overflow: hidden;
}
.record-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  background: #fff;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease;
  box-sizing: border-box;
}
.record-item:last-child {
  border-bottom: none;
}
.ai-case-card.is-clickable {
  cursor: pointer;
}
.ai-case-card:not(.is-clickable):not(.record-item--manage) {
  cursor: default;
}
.ai-case-card:not(.is-clickable):not(.record-item--manage):active {
  background: #fff;
}
.record-item:active {
  background: #f7f7f7;
}
.record-main {
  flex: 1;
  min-width: 0;
}
.record-item .record-title {
  font-size: 15px;
  font-weight: 500;
  color: #222;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.record-item .record-time {
  margin-top: 2px;
  font-size: 11px;
  color: #aaa;
  line-height: 1.2;
}
.record-arrow {
  flex: 0 0 auto;
  color: #ccc;
  font-size: 20px;
  line-height: 1;
  font-weight: 300;
  padding-left: 2px;
}
#notesPanel .panel-empty,
#aiCasesPanel .panel-empty {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
.notes-mode-nav {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 18px;
  padding: 4px 12px 5px;
  background: #fff;
  border-bottom: 1px solid #cfcfcf;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.notes-mode-nav::-webkit-scrollbar {
  display: none;
}
.notes-mode-btn {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: #999;
  padding: 2px 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s ease;
}
.notes-mode-btn:hover {
  color: #222;
}
.notes-mode-btn.active {
  color: #111;
  font-size: 18px;
  font-weight: 700;
}
.page-panel .panel-empty {
  text-align: center;
  color: #999;
  padding: 24px 16px;
  font-size: 14px;
}
.note-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.note-card .note-time { font-size: 11px; color: #999; }
.note-card .note-title { font-size: 14px; font-weight: 700; color: #333; margin-top: 4px; }
.notes-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #666;
  margin: 4px 0 10px;
}
.note-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(20, 40, 20, .36);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
}
.note-editor-overlay.show { display: flex; }
.note-list-overlay {
  position: fixed;
  inset: 0;
  z-index: 280;
  background: rgba(20, 40, 20, .36);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
}
.note-list-overlay.show { display: flex; }
.note-list-panel {
  width: min(420px, 100%);
  max-height: 78vh;
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 42px rgba(0,0,0,.15);
}
.note-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  background: #fafafa;
  border-bottom: 1px solid #ececec;
}
.note-list-head .note-list-title {
  font-size: 15px;
  font-weight: 700;
}
.note-list-head .note-list-close {
  border: 1px solid #d4d4d4;
  background: #fff;
  color: #666;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.note-list-body {
  overflow-y: auto;
  padding: 12px 14px 16px;
  -webkit-overflow-scrolling: touch;
}
.note-list-body .panel-empty {
  text-align: center;
  color: #999;
  padding: 24px 16px;
  font-size: 14px;
}
.note-editor-panel {
  width: min(420px, 100%);
  max-height: 90vh;
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 42px rgba(0,0,0,.15);
}
.note-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  background: #fafafa;
  border-bottom: 1px solid #ececec;
}
.note-editor-head .ne-title { font-size: 15px; font-weight: 700; }
.note-editor-head .ne-close {
  border: 1px solid #d4d4d4;
  background: #fff;
  color: #666;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-size: 18px;
  cursor: pointer;
  min-height: 0;
  padding: 0;
  font-weight: 400;
}
.note-editor-body { padding: 12px 14px; overflow-y: auto; flex: 1; }
.note-editor-body textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
.ne-question-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}
.ne-question-display {
  padding: 10px 12px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #f8f8f8;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-all;
}
.note-editor-foot {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid #e0e0e0;
}
.note-editor-foot button {
  flex: 1;
  padding: 9px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #333;
  min-height: 0;
}
.note-editor-foot .ne-save {
  background: #000;
  border-color: #000;
  color: #fff;
}
.module-bottom-nav.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--nav-visual-bottom-inset, 0px);
  z-index: 200;
  min-height: 54px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  width: 100%;
  max-width: 100%;
  margin: 0;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  background: #fff;
  border-top: none;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  overflow: visible;
}
.module-bottom-nav.bottom-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: #e8e8e8;
  pointer-events: none;
  z-index: 2;
}
.module-bottom-nav .nav-item {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 2px;
  border: none;
  background: none;
  color: #999;
  font-size: 11px;
  line-height: 1.15;
  font-weight: 400;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  transition: color 0.15s ease;
}
.module-bottom-nav .nav-item:active,
.module-bottom-nav .nav-item.is-active {
  color: #111;
  font-weight: 500;
}
.module-bottom-nav .nav-item .nav-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}
.module-bottom-nav .nav-icon svg {
  width: 26px;
  height: 26px;
  display: block;
}
.module-bottom-nav .nav-item span:last-child {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}
@media (max-width: 380px) {
  .module-bottom-nav .nav-item {
    font-size: 10px;
    gap: 3px;
  }
  .module-bottom-nav .nav-item .nav-icon,
  .module-bottom-nav .nav-icon svg {
    width: 24px;
    height: 24px;
  }
}
.treasure-panel-body {
  padding: 12px 14px 20px;
}
.treasure-section + .treasure-section {
  margin-top: 16px;
}
.treasure-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
}
.treasure-card {
  background: #fafafa;
  border: 1px solid #ececec;
  border-radius: 12px;
  padding: 12px;
}
.treasure-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
}
.treasure-card-body {
  font-size: 13px;
  line-height: 1.6;
  color: #555;
}
.treasure-card-body + .treasure-card-body,
.treasure-card-body + .treasure-card-label {
  margin-top: 8px;
}
.treasure-card-label {
  font-size: 12px;
  color: #888;
  margin: 10px 0 6px;
}
.treasure-link-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #333;
  background: #fff;
}
.treasure-copy-btn {
  width: 100%;
  margin-top: 10px;
  border: 1px solid #222;
  background: #222;
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
}
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-overlay.show { display: flex; }
.auth-panel {
  width: min(360px, 100%);
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-sizing: border-box;
  overflow: visible;
}
.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.auth-title { font-size: 18px; font-weight: 700; color: #222; }
.auth-close { border: none; background: none; font-size: 24px; color: #999; cursor: pointer; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: none; }
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #f0f0f0;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.auth-tab.active { background: #2a2a2a; color: #f5e6c8; font-weight: 700; }
.auth-form { display: none; padding: 0; }
.auth-form.active { display: block; }
.auth-input-group { margin-bottom: 14px; }
.auth-input-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.auth-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-sizing: border-box;
  font-size: 15px;
  color: #222;
  background: #fff;
}
.auth-input:focus { border-color: #2a2a2a; outline: none; }
.auth-error { color: #ff4444; font-size: 12px; min-height: 18px; display: none; }
.auth-error.show { display: block; }
.auth-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #2a2a2a;
  color: #f5e6c8;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

#managePanel.page-panel,
#profilePanel.page-panel,
#referralPanel.page-panel {
  background: #f7f8f7;
}
#managePanel .panel-topbar,
#profilePanel .panel-topbar,
#referralPanel .panel-topbar {
  background: #f5f5f5;
  border-bottom: 1px solid #e8e8e8;
  padding: 8px 12px;
}
#managePanel .panel-topbar .panel-title,
#profilePanel .panel-topbar .panel-title,
#referralPanel .panel-topbar .panel-title {
  font-weight: 700;
  color: #355231;
}
