:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --text: #18202b;
  --muted: #647084;
  --line: rgba(25, 32, 43, 0.11);
  --primary: #2176ff;
  --primary-weak: rgba(33, 118, 255, 0.11);
  --danger: #d93838;
  --danger-weak: rgba(217, 56, 56, 0.12);
  --ok: #11845b;
  --shadow: 0 18px 60px rgba(30, 50, 80, 0.16);
  --radius: 8px;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101318;
  --panel: rgba(24, 29, 38, 0.86);
  --panel-strong: #181d26;
  --text: #eef3fb;
  --muted: #9da8bb;
  --line: rgba(238, 243, 251, 0.13);
  --primary: #68a2ff;
  --primary-weak: rgba(104, 162, 255, 0.14);
  --danger: #ff6b6b;
  --danger-weak: rgba(255, 107, 107, 0.14);
  --ok: #55d69a;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

.cursor-trail-dot {
  position: fixed;
  z-index: 35;
  width: 12px;
  height: 12px;
  pointer-events: none;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(33, 118, 255, 0.72), rgba(97, 211, 148, 0.18) 62%, rgba(255, 255, 255, 0));
  transform: translate(-50%, -50%);
  animation: cursor-trail 700ms ease-out forwards;
  mix-blend-mode: multiply;
}

[data-theme="dark"] .cursor-trail-dot {
  mix-blend-mode: screen;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cursor-trail {
  from {
    opacity: 0.78;
    transform: translate(-50%, -50%) scale(0.82);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.6);
  }
}

.shell {
  min-height: 100vh;
  background-image: linear-gradient(rgba(247, 249, 251, 0.82), rgba(247, 249, 251, 0.92)), var(--page-bg);
  background-position: center;
  background-size: cover;
}

[data-theme="dark"] .shell {
  background-image: linear-gradient(rgba(16, 19, 24, 0.78), rgba(16, 19, 24, 0.92)), var(--page-bg);
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 48%, #fff7fb 100%);
}

.login-box,
.panel,
.modal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-box {
  width: min(420px, 100%);
  padding: 28px;
}

.brand-mark {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
}

.brand-mark h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.brand-mark p {
  margin: 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: var(--panel-strong);
  color: var(--text);
  outline: none;
}

.textarea {
  min-height: 132px;
  resize: vertical;
}

.btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 14px;
  background: var(--panel-strong);
  color: var(--text);
}

.btn.primary {
  border-color: transparent;
  background: var(--primary);
  color: white;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: transparent;
  background: var(--danger-weak);
  color: var(--danger);
}

.btn.icon {
  width: 40px;
  padding: 0;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-weak);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 700;
}

.identity h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.identity p {
  margin: 0;
  color: var(--muted);
}

.streak {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: right;
}

.streak strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.grid-modules {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}

.module-card {
  position: relative;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: white;
  background-image: linear-gradient(145deg, rgba(15, 23, 42, 0.32), rgba(15, 23, 42, 0.78)), var(--module-bg);
  background-size: cover;
  background-position: center;
  text-align: left;
  padding: 18px;
}

.module-card.life {
  min-height: 296px;
  grid-row: span 2;
}

.module-card h2 {
  margin: 0 0 10px;
  font-size: 21px;
}

.module-card p {
  margin: 0;
  max-width: 38ch;
  color: rgba(255, 255, 255, 0.86);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 12px;
}

.filter-summary {
  color: var(--muted);
  font-size: 14px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.record-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.record-card-clickable {
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.record-card-clickable:hover,
.record-card-clickable:focus-visible {
  border-color: rgba(33, 118, 255, 0.38);
  box-shadow: 0 12px 36px rgba(30, 50, 80, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.record-excerpt {
  margin-bottom: 0;
}

.record-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.record-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.meta,
.muted {
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.tag {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--primary-weak);
  color: var(--primary);
  font-size: 12px;
}

.task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 12px;
}

.status-pill.active {
  background: var(--primary);
  color: white;
  border-color: transparent;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.44);
}

.modal-card {
  width: min(880px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  padding: 20px;
}

.compact-modal {
  width: min(440px, 100%);
}

.editor-modal {
  width: min(920px, 100%);
}

.modal-head,
.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.step {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}

.step.active {
  background: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.filter-panel {
  display: grid;
  gap: 14px;
}

.filter-empty-hint {
  min-height: 44px;
  display: grid;
  align-items: center;
  padding: 11px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
}

.full {
  grid-column: 1 / -1;
}

.note-editor {
  display: grid;
  gap: 14px;
}

.note-editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
}

.note-title {
  font-size: 22px;
  font-weight: 700;
}

.note-body {
  min-height: min(34vh, 340px);
  line-height: 1.75;
}

.note-attachments:empty {
  display: none;
}

.note-editor-actions,
.comment-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.note-save-actions {
  display: flex;
  gap: 10px;
}

.attachment-upload {
  display: inline-grid;
  place-items: center;
}

.attachments {
  display: grid;
  gap: 10px;
}

.attachment-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.preview-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.preview-media img,
.preview-media video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.comment-section {
  margin-top: 18px;
}

.comment-compose {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.comment-compose .textarea {
  min-height: 96px;
}

.comment-timeline {
  position: relative;
  display: grid;
  gap: 14px;
  padding-left: 18px;
}

.comment-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}

.comment-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
}

.comment-dot {
  width: 10px;
  height: 10px;
  margin-top: 13px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-weak);
}

.comment-content {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

[data-theme="dark"] .comment-content {
  background: rgba(24, 29, 38, 0.72);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.comment-content p {
  margin: 10px 0 0;
  line-height: 1.7;
}

.comment-media {
  margin-top: 10px;
}

.danger-text {
  min-height: 0;
  border: 0;
  padding: 0;
  color: var(--danger);
  background: transparent;
}

.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
}

.settings-page-head {
  margin-bottom: 18px;
}

.settings-page-head h1 {
  margin: 14px 0 6px;
  font-size: 28px;
}

.settings-page {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.settings-nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.settings-nav .btn {
  text-align: left;
}

.image-picker {
  margin-top: -4px;
}

.settings-note {
  margin: -2px 0 14px;
}

.image-size-hint {
  margin: -4px 0 0;
  font-size: 12px;
}

.file-picked {
  color: var(--ok);
  font-size: 13px;
}

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

.background-card {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  display: grid;
  align-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-image: linear-gradient(145deg, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0.72)), var(--settings-bg);
  background-size: cover;
  background-position: center;
  color: white;
}

.background-card.wide {
  grid-column: 1 / -1;
  min-height: 220px;
}

.background-card-title,
.background-card-actions {
  position: relative;
  z-index: 1;
}

.background-card-title {
  display: grid;
  gap: 4px;
}

.background-card-title strong {
  font-size: 20px;
}

.background-card-title span {
  max-width: 32ch;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.background-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 20px, 1120px);
    padding-top: 14px;
  }

  .topbar,
  .toolbar,
  .record-head,
  .modal-head,
  .step-actions {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }

  .streak {
    text-align: left;
  }

  .grid-modules {
    grid-template-columns: 1fr;
  }

  .module-card.life {
    min-height: 220px;
    grid-row: auto;
  }

  .form-grid,
  .note-editor-top,
  .settings-layout,
  .background-grid {
    grid-template-columns: 1fr;
  }

  .note-editor-actions,
  .comment-compose-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .note-save-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .stepper {
    grid-template-columns: repeat(4, 1fr);
  }
}
