:root {
  --bg: #fffaf7;
  --panel: rgba(255, 255, 255, 0.92);
  --primary: #ff6a6a;
  --primary-dark: #e95555;
  --primary-soft: #fff1ee;
  --text: #1c1c1d;
  --muted: #667085;
  --line: #f2dfdb;
  --success: #17a15a;
  --warning: #f4972e;
  --danger: #d94c52;
  --shadow: 0 16px 38px rgba(31, 21, 17, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 106, 106, 0.12), transparent 18%),
    linear-gradient(180deg, #fff8f4 0%, #fff 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  padding: 32px 18px 40px;
}

button, input, select {
  font: inherit;
}

.page-shell {
  max-width: 1250px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  filter: drop-shadow(0 9px 14px rgba(217, 31, 61, .18));
}

.brand-copy {
  min-width: 0;
}

.brand-copy .eyebrow {
  margin-bottom: 3px;
}

.brand-copy h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 2.8vw, 3rem);
  line-height: 1.2;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 106, 106, 0.12);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.form-panel,
.result-panel,
.history-panel {
  padding: 22px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header h2,
.result-header h2,
.history-header h3 {
  margin: 0;
}

.field-group {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  transition: 0.2s ease;
}

textarea {
  resize: vertical;
  min-height: 84px;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(255, 106, 106, 0.8);
  outline: none;
  box-shadow: 0 0 0 4px rgba(255, 106, 106, 0.08);
}

.compact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cta-row {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

button {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.copy-btn,
.favorite-btn,
.history-item button {
  padding: 10px 14px;
  font-weight: 600;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, #ff8b74 100%);
  color: #fff;
  flex: 1;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(255, 106, 106, 0.16);
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.78;
  transform: none;
}

.btn-spinner {
  display: none;
  width: 13px;
  height: 13px;
  margin-left: 7px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
}

.primary-btn.is-loading .btn-spinner {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.secondary-btn {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.ghost-btn {
  background: #f7f3f2;
  color: var(--text);
}

.template-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}

.template-selector-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.custom-template-btn {
  margin: -8px 0 18px;
  padding: 8px 12px;
  border: 1px dashed var(--primary);
  background: #fff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.custom-template-panel {
  display: grid;
  gap: 10px;
  margin: -8px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf8;
}

.custom-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.custom-template-panel[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .custom-template-grid {
    grid-template-columns: 1fr;
  }
}

.template-selector-label {
  margin-bottom: 9px;

  .brand-logo {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.template-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.template-chip.active {
  background: var(--primary-soft);
  border-color: rgba(255, 106, 106, 0.2);
  color: var(--primary-dark);
}

.trend-board {
  margin: -2px 0 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, #fffdfb 0%, #fff6f2 100%);
}

.trend-board-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.trend-board-header .section-kicker {
  margin-bottom: 4px;
}

.trend-board-header h3 {
  margin: 0;
  font-size: 16px;
}

.trend-updated {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.trend-ranking {
  display: grid;
  gap: 5px;
}

.trend-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 6px;
  text-align: left;
  background: transparent;
  border-radius: 9px;
}

.trend-row:hover {
  background: #fff;
}

.trend-rank {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.trend-rank.top-rank {
  color: var(--primary-dark);
}

.trend-word,
.trend-heat {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.trend-word strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.trend-word small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-heat {
  color: var(--primary-dark);
  text-align: right;
}

.trend-heat b {
  font-size: 13px;
}

.trend-heat small {
  color: var(--success);
  font-size: 10px;
}

.trend-empty {
  padding: 14px 4px;
  color: var(--muted);
  font-size: 12px;
}

.settings-box {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf8;
}

.export-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.status-badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 90px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.neutral {
  background: #f3f4f6;
  color: var(--muted);
}

.status-badge.success {
  background: rgba(23, 161, 90, 0.1);
  color: var(--success);
}

.status-badge.warning {
  background: rgba(244, 151, 46, 0.12);
  color: var(--warning);
}

.auth-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.android-download-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.auth-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  font-size: 14px;
}

.auth-user > span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(28, 28, 29, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal-card {
  width: 320px;
  padding: 24px;
}

.auth-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.auth-modal-header button {
  background: none;
  font-size: 20px;
  line-height: 1;
  padding: 2px 8px;
}

.auth-error {
  color: var(--danger);
  font-size: 13px;
  margin: -8px 0 14px;
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 126px;
  gap: 10px;
}

.captcha-image-btn {
  min-height: 46px;
  padding: 0;
  overflow: hidden;
  background: var(--primary-soft);
}

.captcha-image-btn img {
  display: block;
  width: 100%;
  height: 46px;
  object-fit: cover;
}

.slider-verify {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f3f2;
  overflow: hidden;
}

.slider-verify input {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  opacity: 0;
  cursor: ew-resize;
}

.slider-verify span {
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.slider-verify.is-verified {
  border-color: rgba(23, 161, 90, 0.45);
  background: rgba(23, 161, 90, 0.1);
}

.slider-verify.is-verified span {
  color: var(--success);
}

.auth-switch-btn {
  width: 100%;
  margin-top: 12px;
}

.ticket-hint {
  color: var(--muted);
  font-size: 13px;
}

.ticket-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.ticket-form-actions {
  display: flex;
  gap: 10px;
}

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-list-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f3f2;
  cursor: pointer;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.ticket-detail-panel {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.ticket-detail-panel .ticket-message {
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7f3f2;
  margin-bottom: 8px;
  font-size: 13.5px;
}

.ticket-detail-panel .ticket-message.is-self {
  background: var(--primary-soft);
}

.upgrade-qr-wrap {
  text-align: center;
  margin: 14px 0;
}

.upgrade-qr-wrap img {
  border-radius: 12px;
  border: 1px solid var(--line);
}

.upgrade-manual-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.history-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-section-header h4 {
  margin: 0;
}

.trash-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.trash-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
}

.empty-state {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, #fffdfd 0%, #fff7f5 100%);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 22px;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text);
}

.result-list {
  display: grid;
  gap: 16px;
}

.topic-card {
  background: #fff;
  border: 1px solid rgba(255, 106, 106, 0.14);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 20px rgba(30, 25, 23, 0.04);
}

.topic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.topic-index {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topic-score {
  background: rgba(255, 106, 106, 0.12);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.topic-title {
  margin: 0 0 12px;
  font-size: clamp(1.1rem, 1.6vw, 1.5rem);
  line-height: 1.5;
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f5f6f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.pill.risk-low {
  background: rgba(23, 161, 90, 0.12);
  color: var(--success);
}

.pill.risk-medium {
  background: rgba(244, 151, 46, 0.12);
  color: var(--warning);
}

.pill.risk-high {
  background: rgba(217, 76, 82, 0.12);
  color: var(--danger);
}

.topic-card p {
  margin: 0;
  line-height: 1.7;
  color: #38404a;
}

.content-advice {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  background: #fffaf8;
  border: 1px solid rgba(255, 106, 106, 0.12);
}

.advice-block {
  display: grid;
  gap: 5px;
  color: #38404a;
  font-size: 13px;
  line-height: 1.65;
}

.advice-block strong,
.advice-risk strong {
  color: var(--primary-dark);
  font-size: 12px;
}

.advice-block ol {
  margin: 0;
  padding-left: 20px;
}

.advice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.advice-hook {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.advice-risk {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.advice-tags {
  display: flex;
  gap: 8px;
  color: var(--primary-dark);
  font-size: 12px;
  line-height: 1.6;
}

.advice-tags strong {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .template-bar {
    grid-template-columns: 1fr 1fr;
  }

  .advice-grid {
    grid-template-columns: 1fr;
  }
}

.score-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.score-breakdown span {
  background: #f9f5f2;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
}

.topic-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.copy-btn,
.favorite-btn {
  background: #f7f4f2;
  color: var(--text);
}

.note-btn {
  background: var(--primary);
  color: #fff;
}

.note-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.favorite-btn.active {
  background: rgba(255, 106, 106, 0.12);
  color: var(--primary-dark);
}

.full-note {
  display: none;
  margin-top: 14px;
  padding: 16px;
  border-radius: 14px;
  background: #fffdfb;
  border: 1px solid var(--line);
  color: #38404a;
  line-height: 1.75;
}

.full-note:not(:empty) {
  display: block;
}

.full-note.is-loading {
  display: block;
}

.full-note.is-loading {
  min-height: 72px;
}

.full-note.is-loading::before {
  content: 'AI 正在把选题扩写成完整笔记...';
  color: var(--primary-dark);
}

.full-note.is-loading > * {
  visibility: hidden;
}

.full-note-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--primary-dark);
}

.note-copy-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.copy-note-btn {
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
}

.full-note-header span {
  color: var(--muted);
  font-size: 12px;
}

.note-tabs {
  display: flex;
  gap: 6px;
  margin: 12px 0;
  border-bottom: 1px solid var(--line);
}

.note-tab {
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
  border-bottom: 2px solid transparent;
}

.note-tab.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.note-editor {
  display: grid;
  gap: 10px;
}

.note-field {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.note-field input,
.note-field textarea {
  display: block;
  margin-top: 5px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
}

.note-section-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.note-workflow-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.save-note-btn {
  padding: 9px 14px;
  border-radius: 9px;
  background: var(--success);
  color: #fff;
  font-weight: 700;
}

.note-save-status {
  color: var(--success);
  font-size: 12px;
}

.note-preview[hidden],
.note-editor[hidden] {
  display: none;
}

.note-preview {
  padding: 18px 8px 24px;
  background: #f2f3f5;
  border-radius: 10px;
}

.phone-preview {
  width: min(100%, 390px);
  height: 720px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 8px solid #171717;
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(28, 28, 29, .2);
}

.phone-status-bar {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 9px 18px 5px;
  color: #111;
  font-size: 10px;
  font-weight: 700;
}

.phone-navigation {
  flex: 0 0 38px;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  padding: 0 8px;
  border-bottom: 1px solid #f1f1f1;
  text-align: center;
}

.phone-navigation strong {
  font-size: 13px;
}

.phone-navigation button {
  padding: 0;
  background: transparent;
  color: #111;
  font-size: 20px;
}

.phone-cover {
  position: relative;
  flex: 0 0 285px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 24px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .1), rgba(0, 0, 0, .42)),
    linear-gradient(135deg, #f44f61 0%, #f7a55a 50%, #3b967b 100%);
  color: #fff;
}

.phone-cover::before {
  content: '';
  position: absolute;
  inset: 18px 20px auto auto;
  width: 74px;
  height: 96px;
  border: 1px solid rgba(255, 255, 255, .62);
  transform: rotate(7deg);
}

.phone-cover > * {
  position: relative;
  z-index: 1;
}

.phone-cover span {
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, .7);
  font-size: 9px;
}

.phone-cover strong {
  max-width: 280px;
  font-size: 25px;
  line-height: 1.25;
}

.phone-cover small {
  opacity: .82;
  font-size: 10px;
}

.phone-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 22px;
  color: #252525;
  scrollbar-width: thin;
}

.phone-author {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.phone-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #222;
  color: #fff;
  font-size: 12px;
}

.phone-author div {
  display: grid;
  gap: 1px;
}

.phone-author strong {
  font-size: 12px;
}

.phone-author small {
  color: #999;
  font-size: 9px;
}

.phone-author button {
  padding: 5px 11px;
  border: 1px solid #ff2442;
  border-radius: 5px;
  background: #fff;
  color: #ff2442;
  font-size: 10px;
}

.phone-content h4 {
  margin-bottom: 9px;
  font-size: 17px;
  line-height: 1.4;
}

.phone-content h5 {
  margin: 13px 0 4px;
  font-size: 13px;
}

.phone-content p {
  margin: 0 0 8px;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.75;
}

.phone-content .note-tags {
  color: #245d9b;
  font-size: 12px;
  line-height: 1.7;
}

.phone-published-at {
  margin-top: 14px;
  color: #aaa;
  font-size: 9px;
}

.phone-action-bar {
  flex: 0 0 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #eee;
  background: #fff;
}

.phone-action-bar span {
  overflow: hidden;
  padding: 8px 11px;
  border-radius: 18px;
  background: #f4f4f4;
  color: #999;
  font-size: 10px;
  white-space: nowrap;
}

.phone-action-bar button {
  padding: 4px 2px;
  background: transparent;
  color: #444;
  font-size: 10px;
}

@media (max-width: 480px) {
  .note-preview {
    padding: 8px 0 14px;
    background: transparent;
  }

  .phone-preview {
    height: 680px;
    border-width: 5px;
    border-radius: 24px;
  }
}

.saved-note-workspace {
  margin-top: 16px;
}

.full-note h4 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 18px;
}

.full-note h5 {
  margin: 14px 0 4px;
  color: var(--text);
}

.full-note p {
  margin-bottom: 8px;
}

.note-cover {
  padding: 9px 10px;
  background: var(--primary-soft);
  border-radius: 10px;
  color: var(--primary-dark);
}

.note-tags {
  margin-top: 10px;
  color: var(--primary-dark);
  font-size: 13px;
}

.note-images {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.note-error {
  color: var(--danger) !important;
}

.note-audit {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.audit-summary {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.audit-summary.pass { background: rgba(23, 161, 90, .12); color: var(--success); }
.audit-summary.warn { background: rgba(244, 151, 46, .12); color: var(--warning); }

.audit-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
}

.audit-item b { min-width: 70px; color: var(--text); }
.audit-item span { color: var(--muted); }
.audit-item.warn b { color: var(--warning); }

.history-panel {
  margin-top: 22px;
}

.workspace-tools {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  margin-top: 22px;
}

.tool-panel {
  padding: 18px;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.tool-header h3 { margin: 0; }
.tool-header .section-kicker { margin-bottom: 4px; }
.calendar-date-control { display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; color: var(--muted); font-size: 11px; }
.calendar-date-control input { width: auto; min-width: 138px; padding: 7px 9px; font-size: 11px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-day { min-height: 100px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fffdfb; font-size: 11px; }
.calendar-day > strong { display: block; margin-bottom: 8px; color: var(--primary-dark); }
.calendar-day > span { color: var(--muted); }
.calendar-item { display: block; width: 100%; margin-top: 5px; padding: 6px; border-radius: 6px; background: var(--primary-soft); color: var(--text); overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.calendar-item.is-published { background: #e8f6ee; color: var(--success); text-decoration: line-through; }
.calendar-detail { display: none; gap: 5px; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.calendar-detail:not(:empty) { display: grid; }
.calendar-detail > strong { font-size: 12px; }
.calendar-detail > span { color: var(--muted); font-size: 10px; }
.calendar-detail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.calendar-detail-actions button { padding: 6px 8px; border-radius: 6px; background: #f3f4f6; color: var(--text); font-size: 10px; }
.calendar-detail-actions .calendar-remove-btn { color: var(--danger); }
.trend-history-list { max-height: 250px; overflow: auto; display: grid; gap: 7px; }
.history-trend-row { display: grid; gap: 2px; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.history-trend-row strong { font-size: 12px; }
.history-trend-row span { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.analytics-form { margin-bottom: 10px; }
.analytics-form input { padding: 9px 10px; }
.metrics-summary { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.calendar-btn { background: #eef7f2; color: var(--success); padding: 10px 14px; font-weight: 600; }
.calendar-btn:disabled { opacity: .7; cursor: default; }

@media (max-width: 900px) {
  .workspace-tools { grid-template-columns: 1fr; }
  .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.history-header {
  margin-bottom: 16px;
}

.history-section + .history-section {
  margin-top: 20px;
}

.history-section h4 {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--muted);
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.history-item .label {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.history-item .time {
  font-size: 11px;
  color: var(--muted);
}

.history-item button {
  background: transparent;
  color: var(--primary-dark);
  padding: 0;
  font-size: 12px;
}

.empty-list {
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fffaf8;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .auth-area,
  .auth-user {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .quick-actions .secondary-btn {
    min-width: 0;
    text-align: center;
  }

  .compact-grid {
    grid-template-columns: 1fr;
  }

  .cta-row {
    flex-direction: column;
  }
}
