:root {
  --ink: #183153;
  --ink-soft: #2d4663;
  --blue: #2f7fb3;
  --blue-deep: #234c96;
  --blue-pale: #eef7ff;
  --line: rgba(69, 108, 162, 0.12);
  --paper: rgba(255, 255, 255, 0.88);
  --page: #eef7ff;
  --danger: #d76b72;
  --danger-pale: #fff4f4;
  --shadow: 0 8px 24px rgba(37, 76, 120, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(238, 247, 255, 1) 0%, rgba(236, 249, 247, 1) 55%, rgba(243, 250, 240, 1) 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea,
.rich-editor {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  transition: width 0.32s ease;
}

body.ai-panel-open .app-shell {
  width: calc(100% - 420px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(238, 249, 255, 0.34) 0%, rgba(214, 232, 238, 0.18) 44%, rgba(33, 89, 107, 0.04) 100%),
    url("assets/sidebar-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset -1px 0 0 rgba(47, 91, 145, 0.08), 18px 0 46px rgba(49, 95, 137, 0.07);
}

.sidebar-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 38px 28px 28px;
  display: flex;
  flex-direction: column;
}

.sidebar h1 {
  margin: 0 0 32px;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 36px;
  line-height: 1.18;
  letter-spacing: 0;
  color: #183153;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.62);
}

.sidebar-section {
  margin-bottom: 22px;
}

.index-section {
  margin-top: 42px;
  padding: 24px 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    0 14px 36px rgba(18, 60, 94, 0.13);
  min-height: 0;
}

.index-section h2 {
  margin: 0 0 12px;
  font-size: 24px;
  color: #1c3553;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.78);
}

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

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1c3553;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 16px;
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(245, 251, 255, 0.42);
  color: #114b8c;
  box-shadow: 0 10px 28px rgba(42, 92, 130, 0.08);
}

.nav-item:active {
  transform: translateY(1px);
}

.nav-mark {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
  color: currentColor;
  opacity: 0.86;
}

#categoryList .nav-item:not([data-category="all"]) .nav-mark {
  display: none;
}

.text-button {
  margin: 28px 0 0 16px;
  border: 0;
  background: transparent;
  color: #2e5f96;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 0;
}

.text-button::before {
  content: "⚙ ";
  font-weight: 400;
}

.month-list {
  max-height: calc(100vh - 560px);
  overflow: auto;
  padding-right: 4px;
}

.month-list .nav-item {
  min-height: 38px;
  color: #1c3553;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.78);
}

.month-list .nav-item:hover,
.month-list .nav-item.active {
  background: rgba(245, 251, 255, 0.42);
  color: #114b8c;
  box-shadow: 0 10px 28px rgba(42, 92, 130, 0.08);
}

.lotus-art {
  display: none;
}

.app-version {
  color: #183153;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.7);
}

.settings-area {
  margin: auto 16px 0;
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.settings-button {
  width: fit-content;
  min-height: 38px;
  padding: 8px 22px;
  border: 1px solid rgba(24, 49, 83, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  color: #183153;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(42, 92, 130, 0.08);
  backdrop-filter: blur(6px);
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.7);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.settings-button:hover,
.settings-button.active {
  background: rgba(245, 251, 255, 0.48);
  border-color: rgba(17, 75, 140, 0.34);
  color: #114b8c;
}

.settings-button:active {
  transform: translateY(1px);
}

.settings-menu {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  width: fit-content;
  min-width: 150px;
  max-width: 190px;
  transform: translateX(-50%);
  z-index: 10;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 32px rgba(18, 60, 94, 0.13);
}

.settings-menu.hidden,
.backup-modal.hidden {
  display: none;
}

.settings-menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #1c3553;
  min-height: 34px;
  border-radius: 9px;
  padding: 0 10px;
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.settings-menu-item:hover,
.settings-menu-item.active {
  background: rgba(245, 251, 255, 0.56);
  color: #114b8c;
}

.version-row {
  text-align: center;
  opacity: 0.72;
}

.main-content {
  min-width: 0;
  padding: 26px 48px 60px;
  overflow-y: auto;
  background: url("assets/main-bg-tile.png");
  background-repeat: repeat;
  background-size: 760px auto;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
  padding-right: 148px;
  transition: padding-right 0.24s ease;
}

.search-wrap {
  width: min(330px, 100%);
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid rgba(69, 108, 162, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: #647ca4;
  box-shadow: 0 8px 24px rgba(37, 76, 120, 0.06);
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.ai-knowledge-button {
  position: fixed;
  top: 26px;
  right: 32px;
  z-index: 16;
  min-height: 44px;
  padding: 0 24px;
  border: 1px solid #d6e9d2;
  border-radius: 999px;
  background:
    radial-gradient(circle at 88% 26%, rgba(255, 246, 201, 0.72), transparent 30px),
    linear-gradient(135deg, #dff3e8 0%, #eef8e6 52%, #fff6c9 100%);
  color: #2f5f5a;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 24px rgba(255, 246, 201, 0.45),
    0 12px 28px rgba(63, 124, 112, 0.12);
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease, right 0.32s ease;
}

.ai-knowledge-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 30px rgba(255, 246, 201, 0.58),
    0 16px 34px rgba(63, 124, 112, 0.16);
}

.ai-knowledge-button:active {
  transform: translateY(0);
}

body.ai-panel-open .ai-knowledge-button {
  right: 452px;
}

.ai-knowledge-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 18;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(247, 251, 245, 0.96) 0%, rgba(243, 250, 242, 0.9) 48%, rgba(243, 250, 242, 0.52) 100%),
    url("assets/ai-lotus-bg.png");
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  border-left: 1px solid #d8e9e2;
  box-shadow: -18px 0 46px rgba(63, 124, 112, 0.12);
  transform: translateX(100%);
  transition: transform 0.32s ease;
}

body.ai-panel-open .ai-knowledge-panel {
  transform: translateX(0);
}

.ai-panel-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid #d8e9e2;
  background: rgba(247, 251, 245, 0.88);
  backdrop-filter: blur(8px);
}

.ai-panel-title {
  display: grid;
  gap: 10px;
}

.ai-panel-header h2 {
  margin: 0;
  color: #2f5f5a;
  font-size: 18px;
  font-weight: 800;
}

.ai-panel-title p {
  margin: 0;
  color: #5f7f7a;
  font-size: 14px;
  font-weight: 700;
}

.ai-panel-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(223, 243, 232, 0.8);
  color: #2f5f5a;
  font-size: 24px;
  line-height: 1;
  transition: background 0.18s ease, transform 0.18s ease;
}

.ai-panel-close:hover {
  background: #d2eedf;
  transform: translateY(-1px);
}

.ai-panel-body {
  min-height: 0;
  padding: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background:
    linear-gradient(180deg, rgba(247, 251, 245, 0.68), rgba(243, 250, 242, 0.22)),
    url("assets/ai-lotus-bg.png");
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.ai-chat-messages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 20px 16px 18px;
}

.ai-message {
  display: flex;
  width: 100%;
}

.ai-message-user {
  justify-content: flex-end;
}

.ai-message-assistant {
  justify-content: flex-start;
}

.ai-message-bubble,
.ai-message-card {
  max-width: min(320px, 100%);
  font-size: 14px;
  line-height: 1.72;
  word-break: break-word;
}

.ai-message-bubble {
  padding: 12px 14px;
  border: 1px solid #c7e6d8;
  border-radius: 16px 16px 4px 16px;
  background: #dff3e8;
  color: #2f5f5a;
  white-space: pre-wrap;
}

.ai-message-card {
  padding: 14px 15px;
  border: 2px solid #d8e9e2;
  border-radius: 16px 16px 16px 4px;
  background: rgba(255, 255, 255, 0.9);
  color: #334a48;
  box-shadow: 0 10px 28px rgba(63, 124, 112, 0.1);
}

.ai-message-card.thinking {
  color: #5f7f7a;
}

.ai-answer-text {
  color: #254f49;
  overflow-x: auto;
}

.ai-answer-text > :first-child {
  margin-top: 0;
}

.ai-answer-text > :last-child {
  margin-bottom: 0;
}

.ai-answer-text p {
  margin: 0 0 10px;
}

.ai-answer-text h1,
.ai-answer-text h2,
.ai-answer-text h3,
.ai-answer-text h4 {
  margin: 14px 0 8px;
  color: #2f5f5a;
  font-weight: 800;
  line-height: 1.35;
}

.ai-answer-text h1 {
  font-size: 20px;
}

.ai-answer-text h2 {
  font-size: 18px;
}

.ai-answer-text h3 {
  font-size: 16px;
}

.ai-answer-text h4 {
  font-size: 15px;
}

.ai-answer-text strong {
  color: #1f4842;
  font-weight: 800;
}

.ai-answer-text em {
  font-style: italic;
}

.ai-answer-text ul,
.ai-answer-text ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}

.ai-answer-text li {
  margin: 4px 0;
}

.ai-answer-text a {
  color: #3f7c70;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ai-answer-text a:hover {
  color: #2f5f5a;
}

.ai-answer-text code {
  padding: 2px 5px;
  border: 1px solid #d8e9e2;
  border-radius: 5px;
  background: rgba(247, 251, 245, 0.92);
  color: #2f5f5a;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
}

.ai-answer-text pre {
  margin: 10px 0 12px;
  padding: 10px 12px;
  overflow-x: auto;
  border: 1px solid #d8e9e2;
  border-radius: 10px;
  background: rgba(247, 251, 245, 0.94);
}

.ai-answer-text pre code {
  display: block;
  min-width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: pre;
}

.ai-answer-text table {
  display: block;
  width: 100%;
  margin: 10px 0 12px;
  overflow-x: auto;
  border-collapse: collapse;
  white-space: nowrap;
}

.ai-answer-text th,
.ai-answer-text td {
  padding: 7px 9px;
  border: 1px solid #d8e9e2;
  text-align: left;
}

.ai-answer-text th {
  background: #dff3e8;
  color: #2f5f5a;
  font-weight: 800;
}

.ai-answer-text hr {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid #d8e9e2;
}

.ai-answer-text blockquote {
  margin: 10px 0;
  padding-left: 12px;
  border-left: 3px solid #7fbfa8;
}

.ai-references {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d8e9e2;
}

.ai-references-title {
  margin: 0 0 8px;
  color: #3f7c70;
  font-size: 13px;
  font-weight: 800;
}

.ai-reference-card {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #d8e9e2;
  border-left: 3px solid #7fbfa8;
  border-radius: 10px;
  background: #f7fbf5;
  color: #3f5f5a;
}

.ai-reference-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: #3f7c70;
  font-size: 12px;
  font-weight: 800;
}

.ai-reference-name::before {
  content: "▣";
  color: #3f7c70;
  font-size: 11px;
}

.ai-reference-content {
  margin: 0;
  color: #3f5f5a;
  font-size: 12px;
  line-height: 1.65;
}

.ai-reference-score {
  margin-top: 6px;
  color: #7f9994;
  font-size: 11px;
}

.ai-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: end;
  padding: 18px 14px 20px;
  border-top: 0;
  background: transparent;
}

.ai-chat-form textarea {
  width: 100%;
  min-height: 104px;
  max-height: 120px;
  resize: none;
  border: 1px solid #4f9d8c;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  color: #2f5f5a;
  padding: 10px 12px;
  outline: 0;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.ai-chat-form textarea::placeholder {
  color: #8aa5a0;
}

.ai-chat-send {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #5fae9c;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(63, 124, 112, 0.18);
  transition: background 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.ai-chat-send:hover {
  background: #4f9d8c;
  transform: translateY(-1px);
}

.ai-chat-send:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.composer {
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

textarea {
  width: 100%;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.85;
}

.format-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.modal-toolbar {
  margin-bottom: 10px;
}

.format-button {
  min-width: 38px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(69, 108, 162, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #183153;
}

.format-button:hover {
  background: #eef6ff;
  border-color: rgba(29, 95, 200, 0.28);
}

.color-palette {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(69, 108, 162, 0.22);
  cursor: pointer;
}

.color-swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(29, 95, 200, 0.22);
}

.color-swatch.yellow { background: #d6a600; }
.color-swatch.orange { background: #d9791f; }
.color-swatch.red { background: #c85d66; }
.color-swatch.green { background: #3f8f68; }
.color-swatch.cyan { background: #2f8fa3; }
.color-swatch.blue { background: #1d5fc8; }
.color-swatch.purple { background: #7957b8; }
.color-swatch.black { background: #183360; }

.rich-editor {
  width: 100%;
  min-height: 220px;
  outline: 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #7b90b6;
  pointer-events: none;
}

.rich-editor div,
.rich-editor p {
  margin: 0 0 0.45em;
}

textarea::placeholder,
input::placeholder {
  color: #7b90b6;
}

.composer-actions {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.draft-status {
  min-height: 22px;
  margin-top: 10px;
  color: #7088a8;
  font-size: 13px;
  text-align: right;
}

select,
.category-create input {
  min-height: 44px;
  border: 1px solid rgba(69, 108, 162, 0.24);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
  color: #183153;
  padding: 0 14px;
  outline: 0;
}

select {
  min-width: 170px;
}

.primary-button,
.secondary-button,
.danger-button,
.manager-action {
  border-radius: 9px;
  min-height: 44px;
  padding: 0 24px;
  border: 1px solid transparent;
}

.primary-button {
  background: var(--blue-deep);
  color: #fff;
  box-shadow: 0 10px 22px rgba(31, 77, 145, 0.2);
}

.primary-button:hover {
  background: #193f80;
}

.primary-button.small {
  min-width: 112px;
  padding: 0 16px;
}

.secondary-button,
.manager-action {
  background: #fff;
  color: #2f7fb3;
  border-color: rgba(47, 127, 179, 0.28);
}

.danger-button {
  background: var(--danger-pale);
  color: #c8525b;
  border-color: rgba(216, 112, 118, 0.34);
}

.composer .primary-button,
.modal-actions .primary-button {
  background: #3f8f82;
  color: #fff;
  box-shadow: 0 10px 22px rgba(63, 124, 112, 0.18);
}

.composer .primary-button:hover,
.modal-actions .primary-button:hover {
  background: #347a70;
}

.entry-tools .secondary-button {
  background: #f7fbf5;
  color: #3f7c70;
  border-color: #a8d8c7;
}

.entry-tools .secondary-button:hover {
  background: #e6f5ee;
}

.entry-tools .danger-button {
  background: #fff4f2;
  color: #d96a6a;
  border-color: #f2c4be;
}

.entry-tools .danger-button:hover {
  background: #ffe9e5;
}

.filter-note {
  min-height: 38px;
  padding: 16px 2px 0;
  color: #7088a8;
  font-size: 14px;
}

.entry-list {
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 8px 24px rgba(37, 76, 120, 0.04);
}

.entry {
  position: relative;
  padding: 30px 32px 24px;
  background: rgba(255, 255, 255, 0.58);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.entry + .entry {
  border-top: 1px solid rgba(69, 108, 162, 0.14);
}

.entry h3 {
  margin: 0 150px 8px 0;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 28px;
  line-height: 1.34;
  color: #00008B;
  letter-spacing: 0;
}

.entry-meta {
  color: #7088a8;
  font-size: 14px;
  margin-bottom: 20px;
}

.entry-body {
  max-width: 850px;
  color: #2d4663;
  white-space: pre-wrap;
  font-size: 18px;
  line-height: 1.95;
}

.entry-body p,
.entry-body div {
  margin: 0 0 0.55em;
}

.read-toggle {
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: #2f7fb3;
  font-weight: 700;
  padding: 5px 0;
}

.read-toggle:hover {
  color: #3d9ed4;
}

.entry-tools {
  position: absolute;
  top: 28px;
  right: 30px;
  display: flex;
  gap: 14px;
}

.entry-tools button {
  min-height: 40px;
  padding: 0 18px;
}

.empty-state {
  padding: 54px 32px;
  color: #7088a8;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 36, 68, 0.26);
  backdrop-filter: blur(8px);
}

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.9), transparent 34%),
    linear-gradient(135deg, rgba(235, 245, 255, 0.94), rgba(216, 232, 249, 0.94));
  backdrop-filter: blur(10px);
}

.auth-backdrop.hidden {
  display: none;
}

.auth-panel {
  width: min(420px, 100%);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(15, 46, 91, 0.2);
  padding: 30px;
}

.auth-panel h2 {
  margin: 0 0 8px;
  color: #0d275f;
  font-size: 26px;
}

.auth-panel p {
  margin: 0 0 22px;
  color: #5d749c;
  line-height: 1.7;
}

.auth-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(69, 108, 162, 0.24);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  padding: 0 14px;
  outline: 0;
}

.auth-submit {
  width: 100%;
  margin-top: 24px;
}

.auth-switch {
  width: 100%;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
  min-height: 36px;
}

.auth-switch.hidden {
  display: none;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 16px;
  background: rgba(250, 253, 255, 0.98);
  box-shadow: 0 24px 70px rgba(15, 46, 91, 0.24);
  padding: 24px;
}

.edit-panel {
  width: min(720px, 100%);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(218, 231, 247, 0.7);
  color: #31527f;
  font-size: 24px;
  line-height: 1;
}

.category-create {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 18px;
}

.user-panel {
  width: min(480px, 100%);
}

.user-note {
  margin: 0 0 18px;
  color: #4b6590;
  line-height: 1.7;
}

.user-actions {
  display: grid;
  gap: 12px;
}

.backup-panel {
  width: min(560px, 100%);
}

.backup-note {
  margin: 0 0 20px;
  color: #4b6590;
  line-height: 1.7;
}

.backup-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hidden-file-input {
  display: none;
}

.mobile-filter-bar,
.mobile-bottom-nav,
.mobile-home-link,
.mobile-compose-header,
.mobile-record-editor,
.mobile-unsaved-prompt,
.entry-more-button,
.mobile-entry-actions {
  display: none;
}

.manager-list {
  display: grid;
  gap: 10px;
}

.manager-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.manager-row input {
  min-height: 42px;
  border: 1px solid rgba(69, 108, 162, 0.2);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
}

.field-label {
  display: block;
  margin: 16px 0 8px;
  color: #4b6590;
  font-weight: 700;
}

#editText {
  min-height: 260px;
  border: 1px solid rgba(69, 108, 162, 0.18);
  border-radius: 10px;
  background: #fff;
  padding: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.changelog-panel {
  width: min(760px, 100%);
}

.changelog-content {
  max-height: 560px;
  overflow: auto;
  margin: 0;
  padding: 18px;
  border-radius: 10px;
  background: rgba(235, 245, 255, 0.72);
  color: #183360;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  body.ai-panel-open .app-shell {
    width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .sidebar-inner {
    padding: 26px 22px;
  }

  .month-list {
    max-height: none;
  }

  .lotus-art {
    display: none;
  }

  .main-content {
    padding: 22px;
  }

  .topbar {
    padding-right: 0;
    justify-content: flex-start;
  }

  .ai-knowledge-button,
  body.ai-panel-open .ai-knowledge-button {
    top: 18px;
    right: 18px;
    z-index: 16;
    min-height: 40px;
    padding: 0 18px;
  }

  .ai-knowledge-panel {
    width: 100vw;
    height: 100dvh;
  }

  .entry h3 {
    margin-right: 0;
    font-size: 24px;
  }

  .entry-tools {
    position: static;
    margin-bottom: 16px;
  }

  .settings-menu {
    bottom: calc(100% + 14px);
  }
}

@media (max-width: 620px) {
  .composer-actions,
  .category-create,
  .manager-row,
  .backup-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  select,
  .primary-button,
  .secondary-button,
  .danger-button,
  .manager-action {
    width: 100%;
  }

  .entry {
    padding: 24px 20px;
  }
}

@media (max-width: 760px) {
  body {
    min-height: 100vh;
    padding-bottom: 68px;
    background:
      linear-gradient(180deg, rgba(247, 251, 245, 0.16) 0%, rgba(247, 251, 245, 0.52) 42%, rgba(247, 251, 245, 0.9) 100%),
      url("assets/sidebar-bg.png");
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
  }

  body.mobile-write-view,
  body.ai-panel-open,
  body.mobile-record-view,
  body.mobile-editing {
    padding-bottom: 0;
  }

  body.mobile-write-view .sidebar,
  body.mobile-write-view .ai-knowledge-button {
    display: none;
  }

  body.mobile-record-view .app-shell,
  body.mobile-record-view .mobile-bottom-nav,
  body.mobile-record-view .ai-knowledge-button {
    display: none;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: relative;
    height: auto;
    min-height: 92px;
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }

  .sidebar-inner {
    height: auto;
    min-height: 92px;
    padding: 22px 18px 12px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .sidebar h1 {
    margin: 0;
    max-width: calc(100vw - 94px);
    color: #2f5f5a;
    font-size: 24px;
    line-height: 1.25;
    text-shadow: 0 1px 10px rgba(255, 255, 255, 0.78);
  }

  .sidebar-section,
  .index-section,
  .version-row {
    display: none;
  }

  .settings-area {
    margin: 0;
    position: relative;
    display: block;
  }

  .settings-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-color: rgba(216, 233, 226, 0.8);
    background: rgba(255, 255, 255, 0.58);
    color: #2f5f5a;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(63, 124, 112, 0.12);
  }

  .settings-button span:last-child {
    display: none;
  }

  .settings-menu {
    left: auto;
    right: 0;
    bottom: auto;
    top: calc(100% + 10px);
    transform: none;
    min-width: 142px;
    padding: 10px;
    border-color: rgba(216, 233, 226, 0.82);
    border-radius: 14px;
    background: rgba(247, 251, 245, 0.82);
    box-shadow: 0 14px 34px rgba(63, 124, 112, 0.16);
  }

  .settings-menu-item {
    color: #2f5f5a;
  }

  .settings-menu-item:hover,
  .settings-menu-item.active {
    background: #dff3e8;
    color: #2f5f5a;
  }

  .main-content {
    min-height: calc(100vh - 92px);
    padding: 0 14px 78px;
    overflow: visible;
    background: transparent;
  }

  .topbar {
    margin: 0 0 10px;
    padding: 0;
    justify-content: stretch;
  }

  .search-wrap {
    width: 100%;
    height: 46px;
    border-color: rgba(216, 233, 226, 0.82);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.56);
    color: #5f7f7a;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(63, 124, 112, 0.08);
  }

  .search-wrap input {
    color: #2f5f5a;
    font-size: 16px;
  }

  .mobile-filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  .mobile-filter-control {
    min-width: 0;
    min-height: 46px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid rgba(216, 233, 226, 0.82);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.56);
    color: #5f7f7a;
    font-size: 12px;
    font-weight: 800;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(63, 124, 112, 0.08);
  }

  .mobile-filter-control select {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #2f5f5a;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
  }

  .composer {
    display: none;
  }

  body.mobile-write-view .topbar,
  body.mobile-write-view .mobile-filter-bar,
  body.mobile-write-view .filter-note,
  body.mobile-write-view .entry-list {
    display: none;
  }

  body.mobile-write-view .composer {
    position: fixed;
    inset: 0;
    z-index: 42;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    background: #f7fbf5;
    box-shadow: none;
  }

  body.mobile-write-view .mobile-compose-header {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
  }

  body.mobile-write-view .format-toolbar {
    display: none;
  }

  body.mobile-write-view .composer-actions {
    order: 1;
    margin: 0 0 12px;
    display: block;
  }

  body.mobile-write-view .composer-actions select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d8e9e2;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.62);
    color: #2f5f5a;
    font-size: 15px;
    font-weight: 800;
    padding: 0 12px;
    outline: 0;
  }

  body.mobile-write-view .composer-actions .primary-button {
    display: none;
  }

  .mobile-home-link {
    width: fit-content;
    min-height: 38px;
    margin: 14px auto 0;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d8e9e2;
    border-radius: 999px;
    background: rgba(247, 251, 245, 0.82);
    color: #3f7c70;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(63, 124, 112, 0.1);
  }

  body.mobile-write-view .rich-editor {
    order: 2;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 2px 40px;
    color: #334a48;
    font-size: 18px;
    line-height: 1.85;
    word-break: break-word;
    white-space: pre-wrap;
  }

  body.mobile-write-view .rich-editor:empty::before {
    color: #8aa5a0;
  }

  body.mobile-write-view .draft-status {
    order: 3;
    min-height: 24px;
    text-align: left;
    color: #5f7f7a;
    font-size: 12px;
  }

  body.mobile-write-view .composer > .mobile-home-link {
    display: none;
  }

  .filter-note {
    min-height: auto;
    margin: 0;
    padding: 18px 18px 8px;
    border: 1px solid rgba(216, 233, 226, 0.74);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: rgba(247, 251, 245, 0.94);
    color: #2f5f5a;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 -2px 28px rgba(63, 124, 112, 0.1);
  }

  .entry-list {
    display: grid;
    gap: 12px;
    padding: 8px 12px 16px;
    border: 1px solid rgba(216, 233, 226, 0.74);
    border-top: 0;
    border-radius: 0 0 22px 22px;
    background: rgba(247, 251, 245, 0.94);
    box-shadow: 0 18px 42px rgba(63, 124, 112, 0.1);
  }

  .entry {
    position: relative;
    padding: 18px 16px;
    border: 1px solid rgba(216, 233, 226, 0.86);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 24px rgba(63, 124, 112, 0.08);
  }

  .entry + .entry {
    border-top: 1px solid rgba(216, 233, 226, 0.86);
  }

  .entry h3 {
    margin: 0 36px 7px 0;
    color: #2f5f5a;
    font-size: 19px;
    line-height: 1.35;
  }

  .entry-meta {
    margin-bottom: 10px;
    color: #5f7f7a;
    font-size: 12px;
  }

  .entry-body {
    max-height: 5.2em;
    overflow: hidden;
    color: #334a48;
    font-size: 15px;
    line-height: 1.72;
  }

  .entry-tools {
    display: none;
  }

  .entry-more-button {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid #d8e9e2;
    border-radius: 50%;
    background: rgba(247, 251, 245, 0.86);
    color: #3f7c70;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(63, 124, 112, 0.1);
  }

  .mobile-entry-actions {
    position: absolute;
    top: 48px;
    right: 12px;
    z-index: 3;
    min-width: 104px;
    padding: 8px;
    border: 1px solid #d8e9e2;
    border-radius: 14px;
    background: rgba(247, 251, 245, 0.96);
    box-shadow: 0 14px 30px rgba(63, 124, 112, 0.16);
  }

  .entry.mobile-actions-open .mobile-entry-actions {
    display: grid;
    gap: 6px;
  }

  .mobile-entry-actions button {
    width: 100%;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
  }

  .read-toggle {
    margin-top: 12px;
    color: #3f7c70;
  }

  .ai-knowledge-button {
    display: none;
  }

  .ai-knowledge-panel {
    width: 100vw;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    min-height: 64px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 7px 12px max(7px, env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid rgba(216, 233, 226, 0.9);
    border-radius: 0;
    background: rgba(247, 251, 245, 0.96);
    backdrop-filter: blur(14px);
    box-shadow: 0 -10px 30px rgba(63, 124, 112, 0.12);
  }

  body.mobile-write-view .mobile-bottom-nav,
  body.ai-panel-open .mobile-bottom-nav,
  body.mobile-record-view .mobile-bottom-nav,
  body.mobile-editing .mobile-bottom-nav {
    display: none;
  }

  .mobile-record-editor {
    position: fixed;
    inset: 0;
    z-index: 42;
    min-height: 100vh;
    display: none;
    grid-template-rows: auto auto minmax(0, 1fr);
    padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    background: #f7fbf5;
    color: #334a48;
  }

  body.mobile-record-view .mobile-record-editor:not(.hidden) {
    display: grid;
  }

  .mobile-record-header {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
  }

  .mobile-record-back,
  .mobile-record-save {
    border: 0;
    background: transparent;
    color: #2f5f5a;
    font-weight: 900;
  }

  .mobile-record-back {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 34px;
    line-height: 1;
  }

  .mobile-record-save {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    background: #3f8f82;
    color: #fff;
    box-shadow: 0 10px 22px rgba(63, 124, 112, 0.18);
  }

  .mobile-record-category {
    min-height: 44px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 12px;
    border: 1px solid #d8e9e2;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.62);
    color: #5f7f7a;
    font-size: 13px;
    font-weight: 800;
  }

  .mobile-record-category select {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #2f5f5a;
    font-size: 15px;
    font-weight: 800;
  }

  .mobile-record-text {
    min-height: 0;
    overflow-y: auto;
    outline: 0;
    padding: 14px 2px 40px;
    color: #334a48;
    font-size: 18px;
    line-height: 1.85;
    word-break: break-word;
    white-space: pre-wrap;
  }

  .mobile-record-text:empty::before {
    content: attr(data-placeholder);
    color: #8aa5a0;
    pointer-events: none;
  }

  .mobile-record-text div,
  .mobile-record-text p {
    margin: 0 0 0.55em;
  }

  .mobile-unsaved-prompt {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(47, 95, 90, 0.22);
    backdrop-filter: blur(6px);
  }

  .mobile-unsaved-prompt.hidden {
    display: none;
  }

  .mobile-unsaved-card {
    width: min(320px, 100%);
    padding: 22px;
    border: 1px solid #d8e9e2;
    border-radius: 18px;
    background: #f7fbf5;
    box-shadow: 0 22px 58px rgba(47, 95, 90, 0.22);
  }

  .mobile-unsaved-card h2 {
    margin: 0 0 18px;
    color: #2f5f5a;
    font-size: 18px;
    text-align: center;
  }

  .mobile-unsaved-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  body.ai-panel-open .ai-panel-body {
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
  }

  body.ai-panel-open .ai-chat-form {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  body.ai-panel-open .ai-chat-messages {
    padding-bottom: 18px;
    scroll-padding-bottom: 18px;
  }

  #editModal .mobile-home-link {
    margin-top: 14px;
  }

  .mobile-nav-item {
    min-width: 0;
    min-height: 44px;
    display: grid;
    gap: 2px;
    place-items: center;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: #5f7f7a;
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-nav-item.active {
    background: #dff3e8;
    color: #2f5f5a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  }

  .mobile-nav-icon {
    font-size: 16px;
    line-height: 1;
  }

  .mobile-nav-item[data-mobile-view="ai"] .mobile-nav-icon {
    position: relative;
    width: 20px;
    height: 16px;
    font-size: 0;
  }

  .mobile-nav-item[data-mobile-view="ai"] .mobile-nav-icon::before {
    content: "";
    position: absolute;
    inset: 1px 1px 3px;
    border: 2px solid currentColor;
    border-radius: 9px;
  }

  .mobile-nav-item[data-mobile-view="ai"] .mobile-nav-icon::after {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 0;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(25deg);
    background: transparent;
  }
}
