/* Apple x Zixu shared product layer. The existing module layouts remain the
   information architecture; this layer only unifies product surfaces and
   interaction semantics for pages that opt into visual-apple-fusion. */

html:has(body > .visual-apple-fusion),
body:has(> .visual-apple-fusion) {
  background: #f5f5f7;
}

body:has(> .visual-apple-fusion) {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-soft: #fafafc;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.12);
  --line-soft: rgba(0, 0, 0, 0.07);
  --accent: #0066cc;
  --accent-dark: #0055aa;
  --accent-soft: rgba(0, 102, 204, 0.08);
  --danger: #c9362b;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.visual-apple-fusion {
  --swiss-page-canvas: #f5f5f7;
  --swiss-page-surface: #ffffff;
  --swiss-topbar-surface: #000000;
  --swiss-topbar-ink: #f5f5f7;
  --swiss-topbar-muted: #a1a1a6;
  --swiss-topbar-rule: #1d1d1f;
  --swiss-topbar-blue: #2997ff;
  --swiss-topbar-blue-hover: #64b5ff;
  --swiss-topbar-blue-soft: rgba(41, 151, 255, 0.14);
  --swiss-topbar-focus: #2997ff;
  --note-paper: #f5f5f7;
  --note-surface: #ffffff;
  --note-ink: #1d1d1f;
  --note-ink-soft: #333336;
  --note-muted: #6e6e73;
  --note-faint: #86868b;
  --note-rule: rgba(0, 0, 0, 0.12);
  --note-rule-strong: #1d1d1f;
  --note-blue: #0066cc;
  --note-blue-hover: #0055aa;
  --note-blue-soft: rgba(0, 102, 204, 0.08);
  --note-red: #c9362b;
  --note-red-soft: #fff0ee;
  --note-focus: #0071e3;
  --checkin-paper: #f5f5f7;
  --checkin-surface: #ffffff;
  --checkin-ink: #1d1d1f;
  --checkin-ink-soft: #333336;
  --checkin-muted: #6e6e73;
  --checkin-faint: #86868b;
  --checkin-rule: rgba(0, 0, 0, 0.12);
  --checkin-rule-strong: #1d1d1f;
  --checkin-blue: #0066cc;
  --checkin-blue-hover: #0055aa;
  --checkin-blue-soft: rgba(0, 102, 204, 0.08);
  --checkin-red: #c9362b;
  --checkin-red-soft: #fff0ee;
  --checkin-focus: #0071e3;
  --english-paper: #f5f5f7;
  --english-surface: #ffffff;
  --english-ink: #1d1d1f;
  --english-ink-soft: #333336;
  --english-muted: #6e6e73;
  --english-faint: #86868b;
  --english-rule: rgba(0, 0, 0, 0.12);
  --english-rule-strong: #1d1d1f;
  --english-blue: #0066cc;
  --english-blue-hover: #0055aa;
  --english-blue-soft: rgba(0, 102, 204, 0.08);
  --english-red: #c9362b;
  --english-red-soft: #fff0ee;
  --english-focus: #0071e3;
  --notebook-paper: #f5f5f7;
  --notebook-surface: #ffffff;
  --notebook-ink: #1d1d1f;
  --notebook-ink-soft: #333336;
  --notebook-muted: #6e6e73;
  --notebook-faint: #86868b;
  --notebook-rule-base: rgba(0, 0, 0, 0.12);
  --notebook-rule: rgba(0, 0, 0, 0.12);
  --notebook-rule-strong: #1d1d1f;
  --notebook-blue: #0066cc;
  --notebook-blue-hover: #0055aa;
  --notebook-blue-soft: rgba(0, 102, 204, 0.08);
  --notebook-red: #c9362b;
  --notebook-red-soft: #fff0ee;
  --notebook-focus: #0071e3;
  --notebook-link: #0066cc;
  --notebook-link-hover: #0055aa;
  --reading-paper: #f5f5f7;
  --reading-surface: #ffffff;
  --reading-ink: #1d1d1f;
  --reading-ink-soft: #333336;
  --reading-muted: #6e6e73;
  --reading-faint: #86868b;
  --reading-rule: rgba(0, 0, 0, 0.12);
  --reading-rule-strong: #1d1d1f;
  --reading-blue: #0066cc;
  --reading-blue-hover: #0055aa;
  --reading-blue-soft: rgba(0, 102, 204, 0.08);
  --reading-red: #c9362b;
  --reading-red-soft: #fff0ee;
  --reading-focus: #0071e3;
  background: #f5f5f7;
  color: #1d1d1f;
}

.visual-apple-fusion :where(
  .note-editorial-layout,
  .note-archive,
  .checkin-ledger,
  .checkin-projects,
  .checkin-today,
  .english-workspace,
  .notebook-workspace,
  .notebook-reader-layout,
  .reading-shelf,
  .reading-workspace,
  .user-management-layout,
  .account-page-grid
) {
  background: transparent;
  box-shadow: none;
}

.visual-apple-fusion :where(
  .panel,
  .inline-edit-panel,
  .note-editorial-form,
  .checkin-dialog-shell,
  .notebook-dialog-shell,
  .english-dialog-shell,
  .reading-dialog-shell,
  .user-create-dialog-shell,
  .confirm-dialog-shell
) {
  border-color: rgba(0, 0, 0, 0.12);
  background: #ffffff;
  box-shadow: none;
}

.visual-apple-fusion :where(
  .note-card,
  .checkin-project-card,
  .checkin-record-card,
  .notebook-card,
  .word-card,
  .grammar-card,
  .reading-book-card,
  .managed-user-row
) {
  box-shadow: none;
}

.visual-apple-fusion :where(
  .tag,
  .tag-badge,
  .status-badge,
  .word-status,
  .note-importance,
  .checkin-status
) {
  box-shadow: none;
}

.visual-apple-fusion .button,
.visual-apple-fusion form button[type="submit"] {
  border-radius: var(--apple-control-radius, 10px) !important;
}

.visual-apple-fusion .button:not(.secondary, .danger),
.visual-apple-fusion form button[type="submit"]:not(.secondary, .danger) {
  border-color: #0066cc !important;
  background: #0066cc !important;
  color: #ffffff !important;
}

.visual-apple-fusion .button.secondary {
  border-color: #0066cc !important;
  background: transparent !important;
  color: #0066cc !important;
}

.visual-apple-fusion .button.danger {
  border-color: #c9362b !important;
  background: transparent !important;
  color: #c9362b !important;
}

body > .shell.visual-apple-fusion > .topbar :is(.top-actions-main, .topbar-system) .button.secondary {
  border-color: #424245 !important;
  background: #1d1d1f !important;
  color: #f5f5f7 !important;
}

body > .shell.visual-apple-fusion > .topbar :is(.top-actions-main, .topbar-system) .button:not(.secondary, .danger) {
  border-color: #2997ff !important;
  background: #2997ff !important;
  color: #ffffff !important;
}

.visual-apple-fusion :where(dialog, .drawer, .sheet, [role="dialog"]) {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
}

.visual-apple-fusion :where(.dialog-head, [class$="-dialog-head"], [class$="-sheet-head"]) {
  border-color: rgba(0, 0, 0, 0.12);
  background: #fafafc;
}

.visual-apple-fusion :where(.success-message, .is-success, [data-state="success"]) {
  color: #267a4a;
}

.visual-apple-fusion :where(.alert, .error-message, .is-error, [data-state="error"]) {
  color: #c9362b;
}

.visual-apple-fusion :where(.book-cover, .reading-book-cover, .shelf-book-cover, .reader-cover) img,
.visual-apple-fusion img.book-cover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.login-shell.visual-apple-fusion,
.privacy-shell.visual-apple-fusion,
.system-message-shell.visual-apple-fusion {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  background: #f5f5f7;
  color: #1d1d1f;
}

.login-shell.visual-apple-fusion {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-shell.visual-apple-fusion .login-card {
  width: min(100%, 480px);
  margin: 0;
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: none;
}

.login-shell.visual-apple-fusion .login-brand,
.privacy-shell.visual-apple-fusion h1,
.system-message-shell.visual-apple-fusion h1 {
  color: #1d1d1f;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-weight: 600;
}

.login-shell.visual-apple-fusion .login-tagline,
.privacy-shell.visual-apple-fusion :where(p, li),
.system-message-shell.visual-apple-fusion p {
  color: #6e6e73;
}

.login-shell.visual-apple-fusion .login-consent-dialog-shell {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: none;
}

.privacy-shell.visual-apple-fusion {
  padding: clamp(28px, 5vw, 64px) clamp(18px, 5vw, 72px);
}

.privacy-shell.visual-apple-fusion .privacy-page-head,
.privacy-shell.visual-apple-fusion .privacy-policy {
  width: min(100%, 980px);
  margin-inline: auto;
}

.privacy-shell.visual-apple-fusion .privacy-policy {
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0;
  background: transparent;
}

.privacy-shell.visual-apple-fusion a,
.system-message-shell.visual-apple-fusion a:not(.button) {
  color: #0066cc;
}

.system-message-shell.visual-apple-fusion {
  display: grid;
  place-items: center;
  padding: 24px;
}

.system-message-shell.visual-apple-fusion .panel {
  width: min(100%, 560px);
  padding: clamp(28px, 5vw, 48px);
  border-radius: 20px;
  text-align: center;
}

@media (min-width: 1041px) {
  body > .shell.visual-apple-fusion > .topbar {
    grid-template-columns: minmax(140px, 1fr) auto;
    gap: 24px;
    width: 100%;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 20px;
    border-bottom-color: #1d1d1f;
    background: #000000;
    box-shadow: none;
  }

  body > .shell.visual-apple-fusion > .topbar :where(h1, .module-page-title),
  body > .shell.visual-apple-fusion > .topbar.is-module-landing .module-page-title {
    color: #f5f5f7;
    font-size: 21px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
  }

  body > .shell.visual-apple-fusion > .topbar .module-page-meta,
  body > .shell.visual-apple-fusion > .topbar.is-module-landing .module-page-meta {
    color: #a1a1a6;
  }

  body > .shell.visual-apple-fusion > .topbar .topbar-side {
    flex-direction: row;
    gap: 12px;
  }

  .visual-apple-fusion > .topbar .top-actions {
    order: 1;
  }

  .visual-apple-fusion > .topbar .desktop-module-nav {
    order: 2;
  }

  .visual-apple-fusion > .topbar .account-menu {
    order: 3;
  }

  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav a {
    min-height: 44px;
    padding: 14px 10px 13px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #a1a1a6;
    font-size: 12px;
    box-shadow: none;
  }

  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav a:hover,
  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav a:focus-visible,
  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav a.is-active {
    background: transparent;
    color: #2997ff;
  }

  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav a.is-active::after {
    background: #2997ff;
  }

  body > .shell.visual-apple-fusion > .topbar .account-menu > summary {
    min-height: 44px;
    border-radius: 8px;
    background: transparent;
    color: #d2d2d7;
  }
}

@media (max-width: 1040px) {
  body > .shell.visual-apple-fusion > .topbar {
    width: 100%;
    height: 50px;
    min-height: 50px;
    margin: 0;
    padding: 3px 8px 3px 16px;
    border-bottom-color: #1d1d1f;
    background: rgba(0, 0, 0, 0.96);
    box-shadow: none;
    backdrop-filter: saturate(180%) blur(20px);
  }

  body > .shell.visual-apple-fusion > .topbar :where(h1, .module-page-title),
  body > .shell.visual-apple-fusion > .topbar.is-module-landing .module-page-title {
    color: #f5f5f7;
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
  }

  body > .shell.visual-apple-fusion > .topbar .module-page-meta,
  body > .shell.visual-apple-fusion > .topbar.is-module-landing .module-page-meta {
    color: #a1a1a6;
  }

  .login-shell.visual-apple-fusion {
    align-items: start;
    padding: 22px 14px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .login-shell.visual-apple-fusion .login-card {
    padding: 28px 20px;
    border-radius: 20px;
  }

  .privacy-shell.visual-apple-fusion {
    padding: 20px 16px 40px;
  }

  .visual-apple-fusion :where(dialog, .drawer, .sheet, [role="dialog"]) {
    border-radius: 18px 18px 0 0;
  }
}

/* Shared module navigation icons. */

.module-nav-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

.desktop-module-nav a::before,
.module-nav a::before {
  display: none !important;
  content: none !important;
}

/* Unified studio design system */

:where(.shell-notes, .shell-calendar, .shell-notebooks) .module-page-title,
:where(.shell-notes, .shell-calendar, .shell-notebooks) :where(.detail-head h2, .history-panel-head h2, .notebook-home-head h2, .notebook-document-head h1) {
  font-family: ui-serif, "Songti SC", "STSong", serif;
  font-weight: 600;
  letter-spacing: 0.025em;
}

:where(.shell-notes, .shell-calendar, .shell-notebooks) :where(.panel, .note-card, .detail-card, .history-panel, .inline-edit-panel) {
  border-color: var(--line);
  box-shadow: none;
}

:where(.shell-notes, .shell-calendar, .shell-notebooks) :where(input, select, textarea) {
  border-color: var(--line);
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 88%, white);
}

:where(.shell-notes, .shell-calendar, .shell-notebooks) :where(input, select, textarea):focus-visible {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  outline-offset: 1px;
  box-shadow: none;
}

:where(.shell-notes, .shell-calendar, .shell-notebooks) :where(.button, button) {
  border-radius: 4px;
  box-shadow: none;
}

.shell-notes .note-list {
  gap: 10px;
  border: 0;
  background: transparent;
}

.shell-notes :where(.note-date-groups, .note-date-group, .note-date-items) {
  display: contents;
}

.shell-notes .note-date-heading,
.shell-notes .note-time-short {
  display: none;
}

.shell-notes .note-inline-tags {
  display: contents;
}

.shell-notes .note-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 96%, white);
  box-shadow: var(--shadow-soft);
}

.shell-notes .note-card:last-child {
  border-bottom-color: var(--line);
}

.shell-notes .note-card.is-pinned {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--panel) 94%, var(--accent));
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--accent) 78%, transparent), var(--shadow-soft);
}

.shell-notes .note-card:hover,
.shell-notes .note-card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--panel) 88%, var(--accent-soft));
  box-shadow: 0 7px 18px rgba(32, 36, 31, 0.075);
}

.shell-notes .note-card.is-pinned:hover,
.shell-notes .note-card.is-pinned:focus-within {
  background: color-mix(in srgb, var(--panel) 88%, var(--accent));
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--accent) 82%, transparent), 0 7px 18px rgba(32, 36, 31, 0.075);
}

.shell-notes .note-excerpt {
  font-size: 16px;
  line-height: 1.6;
}

.shell-notes .note-meta {
  gap: 8px;
  margin-bottom: 10px;
}

.shell-notes .note-meta time {
  font-variant-numeric: tabular-nums;
}

.shell-notes .note-meta :where(.importance, .tag) {
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 750;
}

.shell-notes .pinned-notes,
.shell-notes :where(.note-panel, .history-panel, .detail-card),
.shell-notes .inline-edit-panel {
  border-color: var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: none;
}

.shell-notes .pinned-notes,
.shell-notes .inline-edit-panel {
  background: var(--panel-soft);
}

.shell-notes .note-inline-detail[open] > .note-card-summary {
  display: none;
  margin: 0;
}

.shell-notes .note-inline-panel {
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.shell-notes .note-inline-form {
  gap: 10px;
}

.shell-notes .note-inline-content-field {
  min-width: 0;
}

.shell-notes .note-inline-content-editor {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
}

.shell-notes .note-inline-content-editor:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: transparent;
  outline: 0;
  box-shadow: none;
}

.shell-notes .note-inline-panel .note-inline-meta-fields {
  grid-template-columns: minmax(100px, 0.65fr) minmax(0, 1.35fr);
}

.shell-notes .note-inline-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.shell-notes .note-inline-actions form {
  min-width: 0;
  margin: 0;
}

.shell-notes .note-inline-actions button {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding-inline: 4px;
  font-size: 13px;
  white-space: nowrap;
}

.shell-notes .pinned-notes {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.shell-notes .pinned-notes > summary {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  min-height: 38px;
  padding: 0 2px 10px;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.shell-notes .pinned-notes > summary:hover,
.shell-notes .pinned-notes > summary:focus-visible {
  background: transparent;
  color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 24%, transparent);
  outline-offset: 2px;
}

.shell-notes .pinned-notes[open] > summary {
  border-bottom-color: transparent;
  color: var(--text);
}

.shell-notes .pinned-notes > summary > span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.shell-notes .pinned-notes > summary > span::before {
  width: 3px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.shell-notes .pinned-notes > summary strong {
  min-width: 24px;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  line-height: 16px;
}

.shell-notes .pinned-notes > summary::after {
  width: 7px;
  height: 7px;
  margin: 0 3px 3px 1px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: rotate(45deg);
  transition: transform 140ms ease, margin 140ms ease;
}

.shell-notes .pinned-notes[open] > summary::after {
  margin-top: 4px;
  margin-bottom: 0;
  transform: rotate(225deg);
}

.shell-notes .pinned-note-list {
  gap: 10px;
  padding: 0;
  background: transparent;
}

.shell-notes .pinned-note-list .note-card {
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
}

.shell-notes .pinned-note-list .note-card.is-pinned {
  background: color-mix(in srgb, var(--panel) 94%, var(--accent));
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--accent) 78%, transparent), var(--shadow-soft);
}

.shell-notes .pinned-note-list .note-card.is-pinned:hover,
.shell-notes .pinned-note-list .note-card.is-pinned:focus-within {
  background: color-mix(in srgb, var(--panel) 88%, var(--accent));
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--accent) 82%, transparent), 0 7px 18px rgba(32, 36, 31, 0.075);
}

.shell-notes .note-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 10px 2px 0;
  color: var(--text);
  font-family: ui-serif, "Songti SC", "STSong", serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.shell-notes .note-section-heading strong {
  min-width: 24px;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
}

.shell-notes .pin-label {
  gap: 5px;
  min-height: 20px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.shell-notes .pin-label::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.shell-calendar .calendar-tabs {
  gap: 18px;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.shell-calendar .calendar-tabs a {
  position: relative;
  min-width: 72px;
  min-height: 40px;
  padding: 8px 6px 10px;
  border-radius: 0;
}

.shell-calendar .calendar-tabs a.is-active {
  background: transparent;
  color: var(--accent);
}

.shell-calendar .calendar-tabs a.is-active::after {
  position: absolute;
  right: 6px;
  bottom: -1px;
  left: 6px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.shell-calendar :where(.week-day, .calendar-long-ranges, .calendar-day-strip, .month-day) {
  border-color: var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
}

.shell-calendar .calendar-long-ranges {
  border-radius: 4px;
}

.shell-calendar .range-goal-list {
  gap: 0;
  padding: 0 12px;
}

.shell-calendar .range-goal {
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
}

.shell-calendar .range-goal:last-child {
  border-bottom: 0;
}

.shell-calendar .range-track,
.shell-calendar .range-fill {
  border-radius: 2px;
}

.shell-calendar .range-track {
  background: var(--line-soft);
}

.shell-calendar .week-board {
  gap: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.shell-calendar .week-day {
  border-width: 0 0 1px;
}

.shell-calendar .week-day:last-child {
  border-bottom: 0;
}

.shell-calendar .week-day.is-today,
.shell-calendar .month-day.is-today {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.shell-calendar .month-weekdays {
  gap: 0;
  margin: 0;
  padding: 10px 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel-soft);
}

.shell-calendar .month-grid {
  gap: 1px;
  padding: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.shell-calendar .month-day {
  min-height: 126px;
  border: 0;
}

.shell-calendar .month-day.is-outside-month {
  background: var(--panel-soft);
}

.shell-calendar .month-goal {
  border-radius: 2px;
  background: var(--panel-soft);
}

.shell-calendar .today-badge {
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 3px;
  background: var(--panel);
  color: var(--accent);
}

.shell-notebooks .notebook-layout {
  border-color: var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
}

.shell-notebooks .notebook-tree-shell,
.shell-notebooks .notebook-document-rail {
  border-color: var(--line);
  background: var(--panel-soft);
}

.shell-notebooks :where(.notebook-main, .notebook-home-panel, .notebook-editor, .notebook-preview-scroll) {
  background: var(--panel);
}

.shell-notebooks .notebook-workspace-toolbar {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: none;
}

.shell-notebooks .notebook-home-head,
.shell-notebooks .notebook-document-head {
  border-color: var(--line);
}

.shell-notebooks .notebook-home-head h2 {
  max-width: 820px;
  font-size: clamp(28px, 2.4vw, 36px);
  line-height: 1.12;
}

.shell-notebooks .notebook-home-note {
  padding: 13px 2px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
}

.shell-notebooks .notebook-home-note:hover,
.shell-notebooks .notebook-home-note:focus-visible {
  background: var(--accent-soft);
}

.shell-notebooks .notebook-home-overview,
.shell-notebooks .notebook-preview-dialog {
  border-color: var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
}

.shell-notebooks .notebook-home-overview dl div,
.shell-notebooks .notebook-preview-scroll {
  border-radius: 2px;
  background: var(--panel);
}

.shell-notebooks .notebook-editor-title input {
  font-family: ui-serif, "Songti SC", "STSong", serif;
  font-weight: 600;
}

.shell-notebooks :where(.notebook-editor-body textarea, .notebook-folder-help) {
  background: var(--panel-soft);
}

@media (min-width: 1041px) {
  .shell-notes,
  .shell-calendar {
    width: min(1440px, calc(100% - 32px));
  }

  .shell-notes .topbar,
  .shell-calendar .topbar,
  .shell-notebooks .topbar {
    grid-template-columns: minmax(110px, 1fr) auto;
    width: auto;
    min-height: 68px;
    margin: 0;
    padding: 0 18px 14px;
    border-bottom-color: var(--line);
  }

  :where(.shell-notes, .shell-calendar) {
    width: min(1440px, calc(100% - 32px));
    min-height: 100vh;
    padding: 16px 0 42px;
  }

  .shell-notebooks {
    width: min(1680px, calc(100% - 24px));
    padding-top: 16px;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .topbar {
    grid-template-columns: minmax(110px, 1fr) auto;
    gap: 28px;
    width: auto;
    min-height: 68px;
    margin: 0;
    padding: 0 18px 14px;
    border-bottom-color: var(--line);
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .module-page-title {
    font-size: 32px;
    line-height: 1;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .topbar-side {
    flex-direction: row;
    gap: 12px;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) :where(.desktop-module-nav, .topbar-system, .top-actions) {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .desktop-module-nav {
    gap: 4px;
    padding: 0;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .desktop-module-nav a {
    position: relative;
    gap: 7px;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #575b55;
    font-size: 14px;
    font-weight: 700;
    box-shadow: none;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .desktop-module-nav a::after {
    position: absolute;
    right: 10px;
    bottom: 0;
    left: 10px;
    height: 2px;
    background: transparent;
    content: "";
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .desktop-module-nav a:hover,
  :where(.shell-notes, .shell-calendar, .shell-notebooks) .desktop-module-nav a:focus-visible,
  :where(.shell-notes, .shell-calendar, .shell-notebooks) .desktop-module-nav a.is-active {
    background: transparent;
    color: var(--accent);
    box-shadow: none;
    outline: none;
    transform: none;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .desktop-module-nav a.is-active::after {
    background: var(--accent);
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .topbar-system {
    padding: 0;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions {
    gap: 4px;
    padding: 0;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions-system {
    padding-left: 0;
    border-left: 0;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions :where(.button, button) {
    min-height: 34px;
    padding: 7px 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #666a63;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions :where(.button, button):hover,
  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions :where(.button, button):focus-visible,
  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions button[aria-pressed="true"] {
    background: var(--accent-soft);
    color: var(--accent);
    outline: none;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions .top-action-primary,
  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions .top-action-primary:hover,
  :where(.shell-notes, .shell-calendar, .shell-notebooks) .top-actions .top-action-primary:focus-visible {
    min-width: 72px;
    padding-inline: 16px;
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 7px 16px rgba(36, 91, 67, 0.14);
  }

  :where(.shell-notes, .shell-calendar) > :not(.topbar) {
    margin-right: 18px;
    margin-left: 18px;
  }

  .shell-notes .note-list {
    margin-top: 24px;
    padding: 0 16px;
  }

  .shell-calendar .calendar-date-controls {
    padding-top: 8px;
  }

  .shell-calendar .calendar-tabs {
    margin-bottom: 6px;
  }

  .shell-calendar .calendar-tabs a {
    min-height: 34px;
    padding: 6px;
  }

  .shell-calendar :where(.week-controls, .month-controls) {
    margin-bottom: 6px;
  }

  .shell-notebooks .notebook-layout {
    min-height: calc(100vh - 84px);
    border-top: 0;
  }
}

@media (max-width: 1040px) {
  :where(.shell-notes, .shell-calendar, .shell-notebooks) .module-page-title {
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-weight: 600;
    letter-spacing: 0.025em;
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) :where(.top-actions, .topbar-system) {
    border-color: var(--line);
    background: var(--panel-soft);
    box-shadow: none;
  }

  .shell-notebooks .notebook-layout {
    border-radius: 0;
  }
}

@media (max-width: 1040px) {
  .goal-create-dialog {
    width: calc(100% - 16px);
    max-height: var(--goal-create-dialog-max-height, calc(100vh - 24px));
    border-radius: 12px;
  }

  .goal-create-dialog-shell {
    max-height: var(--goal-create-dialog-max-height, calc(100vh - 24px));
  }

  .goal-create-dialog-head {
    padding: 12px 14px;
  }

  .goal-create-dialog-body {
    padding: 14px;
  }

  .module-nav {
    border-top-color: var(--line);
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    box-shadow: 0 -6px 18px rgba(32, 36, 31, 0.08);
  }

  .module-nav a,
  .module-nav a.is-active {
    border-radius: 4px;
  }

  .module-nav a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .topbar.is-module-landing {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    margin-bottom: 12px;
    padding: 0 2px 10px;
    border-bottom-color: var(--line);
  }

  .topbar.is-module-landing .topbar-title {
    display: flex;
    align-items: baseline;
    gap: 9px;
    min-width: 0;
  }

  .topbar.is-module-landing .module-page-title {
    display: block;
    color: var(--text);
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 26px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.025em;
    white-space: nowrap;
  }

  .topbar.is-module-landing .module-page-meta {
    display: inline;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
  }

  .topbar.is-module-landing .topbar-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    gap: 0;
    width: auto;
    min-width: 0;
  }

  .topbar.is-module-landing .top-actions.is-mobile-menu {
    display: flex;
    align-items: center;
    width: auto;
    max-width: none;
    gap: 7px;
  }

  .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main,
  .topbar.is-module-landing .top-actions.is-mobile-menu.has-keep-action .top-actions-main {
    display: flex;
    align-items: center;
    width: auto;
    gap: 7px;
  }

  .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .button,
  .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main button {
    width: auto;
    min-width: 0;
    min-height: 40px;
    padding: 7px 10px;
    border-radius: 6px;
  }

  .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-keep {
    flex: 0 0 auto;
    width: auto;
    min-width: 50px;
    padding-inline: 10px;
  }

  .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    flex: 0 0 auto;
    order: 0;
    width: auto;
    min-width: 68px;
    padding-inline: 12px;
    gap: 4px;
    box-shadow: 0 7px 16px rgba(36, 91, 67, 0.14);
  }

  .topbar.is-module-landing .top-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
  }

  .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready .top-actions-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    grid-column: auto;
    grid-row: auto;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-color: var(--line);
    border-radius: 6px;
    background: var(--panel-soft);
    color: var(--muted);
  }

  .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-menu {
    top: calc(100% + 8px);
  }

  @media (max-width: 400px) {
    .topbar.is-module-landing {
      gap: 8px;
    }

    .topbar.is-module-landing .topbar-title {
      gap: 6px;
    }

    .topbar.is-module-landing .module-page-title {
      font-size: 24px;
    }

    .topbar.is-module-landing .module-page-meta {
      font-size: 12px;
    }

    .topbar.is-module-landing .top-actions.is-mobile-menu,
    .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main,
    .topbar.is-module-landing .top-actions.is-mobile-menu.has-keep-action .top-actions-main {
      gap: 5px;
    }

    .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-keep {
      min-width: 48px;
      padding-inline: 8px;
    }

    .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
      min-width: 64px;
      padding-inline: 10px;
    }
  }

  :where(.shell-notes, .shell-calendar, .shell-notebooks) :where(.panel, .note-card, .detail-card, .history-panel) {
    border-radius: 4px;
    box-shadow: none;
  }

  .shell-notes .note-list {
    gap: 20px;
    margin-top: 14px;
    padding: 0;
  }

  .shell-notes .pinned-notes {
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--panel) 94%, var(--accent-soft));
    overflow: hidden;
  }

  .shell-notes .pinned-notes > summary {
    min-height: 50px;
    padding: 11px 13px;
    border-bottom: 1px solid transparent;
    color: var(--accent);
    font-size: 15px;
    font-weight: 800;
  }

  .shell-notes .pinned-notes[open] > summary {
    border-bottom-color: var(--line);
    color: var(--accent);
  }

  .shell-notes .pinned-notes > summary > span {
    gap: 7px;
  }

  .shell-notes .pinned-notes > summary > span::before {
    display: none;
  }

  .shell-notes .pinned-notes > summary > span i {
    font-size: 17px;
    font-weight: 400;
  }

  .shell-notes .pinned-notes > summary strong {
    min-width: 28px;
    min-height: 28px;
    padding: 4px 8px;
    border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
    font-size: 13px;
    line-height: 18px;
  }

  .shell-notes .pinned-note-list {
    display: grid;
    gap: 0;
    padding: 0 13px;
  }

  .shell-notes .pinned-note-list .note-card,
  .shell-notes .pinned-note-list .note-card.is-pinned {
    padding: 13px 8px 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .shell-notes .pinned-note-list .note-card:last-child {
    border-bottom: 0;
  }

  .shell-notes .pinned-note-list .note-card:hover,
  .shell-notes .pinned-note-list .note-card:focus-within,
  .shell-notes .pinned-note-list .note-card.is-pinned:hover,
  .shell-notes .pinned-note-list .note-card.is-pinned:focus-within {
    background: color-mix(in srgb, var(--panel) 76%, var(--accent-soft));
    box-shadow: none;
  }

  .shell-notes .pinned-note-list .note-meta {
    gap: 8px;
    margin-bottom: 8px;
  }

  .shell-notes .pinned-note-list .note-meta time {
    order: 4;
    margin-left: auto;
    color: var(--muted);
  }

  .shell-notes .pinned-note-list .note-inline-tags {
    display: contents;
  }

  .shell-notes .pinned-note-list .note-inline-tags .tag {
    order: 3;
  }

  .shell-notes .pinned-note-list .importance {
    order: 1;
  }

  .shell-notes .pinned-note-list .pin-label {
    order: 2;
  }

  .shell-notes .note-section-heading {
    min-height: 34px;
    padding: 0 2px;
    font-size: 17px;
  }

  .shell-notes .note-date-groups,
  .shell-notes .note-date-group,
  .shell-notes .note-date-items {
    display: grid;
  }

  .shell-notes .note-date-groups {
    gap: 18px;
  }

  .shell-notes .note-date-group {
    gap: 5px;
  }

  .shell-notes .note-date-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--accent);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.02em;
  }

  .shell-notes .note-date-heading::after {
    height: 1px;
    flex: 1;
    background: var(--line);
    content: "";
  }

  .shell-notes .note-date-heading time {
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }

  .shell-notes .note-date-items {
    gap: 0;
  }

  .shell-notes .note-date-items .note-card,
  .shell-notes .note-date-items .note-card.is-date-grouped {
    padding: 12px 0;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .shell-notes .note-date-items .note-card:last-child {
    border-bottom: 0;
  }

  .shell-notes .note-date-items .note-card:hover,
  .shell-notes .note-date-items .note-card:focus-within {
    background: color-mix(in srgb, var(--panel) 62%, transparent);
    box-shadow: none;
  }

  .shell-notes .note-date-items .note-card-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
  }

  .shell-notes .note-date-items .note-card-main,
  .shell-notes .note-date-items .note-meta {
    display: contents;
  }

  .shell-notes .note-date-items .importance {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
  }

  .shell-notes .note-date-items .note-excerpt-link {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .shell-notes .note-date-items .note-meta time {
    grid-column: 3;
    grid-row: 1;
    padding-top: 3px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .shell-notes .note-date-items .note-inline-tags {
    display: flex;
    grid-column: 2 / -1;
    grid-row: 2;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
  }

  .shell-notes .note-date-items .note-time-full {
    display: none;
  }

  .shell-notes .note-date-items .note-time-short {
    display: inline;
  }

  .shell-notes .note-excerpt {
    font-size: 15px;
    line-height: 1.55;
  }

  /* Mobile notes: quiet paper cards aligned with the goals action flow */

  .shell.shell-notes {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0 0 calc(70px + env(safe-area-inset-bottom, 0px));
    background-color: #f4f3ee;
    background-image: none;
    color: #202923;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  }

  .shell-notes > .topbar.is-module-landing {
    position: sticky;
    top: 0;
    z-index: 8;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 56px;
    margin: 0;
    padding: 7px 12px 6px 16px;
    border-bottom: 1px solid #dee1da;
    background: rgba(244, 243, 238, 0.98);
    backdrop-filter: none;
  }

  .shell-notes > .topbar.is-module-landing .topbar-title {
    gap: 8px;
    align-items: baseline;
  }

  .shell-notes > .topbar.is-module-landing .module-page-title {
    color: #202923;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 27px;
    font-weight: 650;
    letter-spacing: 0.04em;
  }

  .shell-notes > .topbar.is-module-landing .module-page-meta {
    color: #7a817b;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
  }

  .shell-notes > .topbar.is-module-landing .top-actions.is-mobile-menu,
  .shell-notes > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main {
    gap: 8px;
  }

  .shell-notes > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #2d6249;
    box-shadow: none;
    color: #ffffff;
    font-size: 20px;
  }

  .shell-notes > .topbar.is-module-landing .top-action-primary span:not(.top-action-icon) {
    display: none;
  }

  .shell-notes > .topbar.is-module-landing .top-action-icon {
    font-size: 24px;
  }

  .shell-notes > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready .top-actions-more {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid #dee1da;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.34);
    color: #5f6862;
    font-size: 20px;
  }

  .shell-notes > .topbar.is-module-landing .top-actions-more-icon {
    transform: rotate(90deg);
  }

  .shell-notes > .note-panel {
    margin: 12px;
    border-radius: 8px;
    background: #faf9f5;
  }

  .shell-notes .note-list {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 12px 12px 24px;
  }

  .shell-notes .note-section-heading {
    min-height: 38px;
    padding: 4px 2px 0;
    color: #344039;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0;
  }

  .shell-notes .note-section-heading strong {
    border: 0;
    background: transparent;
    color: #7a817b;
    font-family: inherit;
    font-weight: 600;
  }

  .shell-notes .note-date-groups {
    gap: 15px;
  }

  .shell-notes .note-date-group {
    gap: 7px;
  }

  .shell-notes .note-date-heading {
    gap: 7px;
    min-height: 28px;
    padding: 0 2px;
    color: #2d6249;
    font-size: 12px;
    font-weight: 600;
  }

  .shell-notes .note-date-heading time {
    font-size: 15px;
    font-weight: 750;
  }

  .shell-notes .note-date-heading::after {
    background: #d9ddd7;
  }

  .shell-notes .note-date-items {
    gap: 8px;
  }

  .shell-notes .note-date-items .note-card,
  .shell-notes .note-date-items .note-card.is-date-grouped {
    --note-importance-color: #879188;
    padding: 13px 14px 12px 17px;
    border: 1px solid #d9ddd7;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.46);
    box-shadow: 0 1px 0 rgba(32, 41, 35, 0.025);
    overflow: hidden;
  }

  .shell-notes .note-card.note-importance-important {
    --note-importance-color: #b38a4a;
  }

  .shell-notes .note-card.note-importance-critical {
    --note-importance-color: #b85c50;
  }

  .shell-notes .note-card::before {
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 3px;
    border-radius: 0 999px 999px 0;
    background: var(--note-importance-color, #879188);
    content: "";
  }

  .shell-notes .note-date-items .note-card:last-child {
    border-bottom: 1px solid #d9ddd7;
  }

  .shell-notes .note-date-items .note-card:hover,
  .shell-notes .note-date-items .note-card:focus-within,
  .shell-notes .note-card:has(.note-inline-detail[open]) {
    border-color: color-mix(in srgb, var(--note-importance-color) 45%, #d9ddd7);
    background: #faf9f5;
    box-shadow: 0 6px 16px rgba(32, 41, 35, 0.065);
  }

  .shell-notes .note-date-items .note-card-summary {
    display: block;
  }

  .shell-notes .note-date-items .note-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .shell-notes .note-date-items .note-excerpt-link {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .shell-notes .note-date-items .note-meta {
    display: flex;
    grid-column: 1;
    grid-row: 2;
    flex-wrap: wrap;
    gap: 5px 7px;
    align-items: center;
    margin: 9px 0 0;
  }

  .shell-notes .note-date-items .importance {
    order: 1;
  }

  .shell-notes .note-date-items .pin-label {
    order: 2;
  }

  .shell-notes .note-date-items .note-inline-tags {
    display: flex;
    order: 3;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0;
  }

  .shell-notes .note-date-items .note-meta time {
    order: 10;
    margin-left: auto;
    padding: 0;
    color: #7a817b;
    font-size: 12px;
    line-height: 20px;
  }

  .shell-notes .note-excerpt {
    color: #29342d;
    font-size: 15.5px;
    font-weight: 500;
    line-height: 1.58;
  }

  .shell-notes .note-meta :where(.importance, .tag) {
    min-height: 20px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 18px;
  }

  .shell-notes .note-inline-panel {
    gap: 9px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .shell-notes .note-inline-content-editor {
    min-height: 31px;
    padding-bottom: 7px;
    font-size: 15.5px;
    line-height: 1.58;
  }

  .shell-notes .note-inline-panel .note-inline-meta-fields {
    grid-template-columns: minmax(90px, 0.7fr) minmax(0, 1.3fr);
  }

  .shell-notes .note-inline-actions {
    gap: 6px;
  }

  .shell-notes .note-inline-actions button {
    min-height: 40px;
  }

  .shell-notes .pinned-notes {
    border: 1px solid #cfd8d1;
    border-left: 3px solid #2d6249;
    border-radius: 8px;
    background: rgba(230, 235, 228, 0.58);
  }

  .shell-notes .pinned-notes > summary {
    min-height: 48px;
    padding: 10px 12px;
    border-bottom-color: transparent;
    color: #2d6249;
    font-size: 15px;
  }

  .shell-notes .pinned-notes[open] > summary {
    border-bottom-color: #d4dbd5;
  }

  .shell-notes .pinned-note-list {
    gap: 8px;
    padding: 10px;
  }

  .shell-notes .pinned-note-list .note-card,
  .shell-notes .pinned-note-list .note-card.is-pinned {
    padding: 13px 14px 12px 17px;
    border: 1px solid #d6dcd7;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.48);
    box-shadow: 0 1px 0 rgba(32, 41, 35, 0.025);
    overflow: hidden;
  }

  .shell-notes .pinned-note-list .note-card:last-child {
    border-bottom: 1px solid #d6dcd7;
  }

  .shell-notes .pinned-note-list .note-card:hover,
  .shell-notes .pinned-note-list .note-card:focus-within,
  .shell-notes .pinned-note-list .note-card.is-pinned:hover,
  .shell-notes .pinned-note-list .note-card.is-pinned:focus-within {
    border-color: color-mix(in srgb, var(--note-importance-color) 45%, #d6dcd7);
    background: #faf9f5;
    box-shadow: 0 6px 16px rgba(32, 41, 35, 0.065);
  }

  .shell-notes .pinned-note-list .note-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .shell-notes .pinned-note-list .note-excerpt-link {
    grid-row: 1;
  }

  .shell-notes .pinned-note-list .note-meta {
    display: flex;
    grid-row: 2;
    flex-wrap: wrap;
    gap: 5px 7px;
    align-items: center;
    margin: 9px 0 0;
  }

  .shell-notes .pinned-note-list .note-meta time {
    order: 10;
    margin-left: auto;
    color: #7a817b;
    font-size: 12px;
  }

  .shell-notes .pinned-note-list .note-inline-tags {
    display: flex;
    order: 3;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0;
  }

  .shell-calendar .month-day,
  .shell-notebooks .notebook-layout {
    border-radius: 0;
  }

  .shell-calendar .calendar-tabs {
    width: 100%;
  }

  .shell-notebooks .notebook-home-head {
    padding: 12px 16px;
  }

  .shell-notebooks .notebook-home-grid {
    padding: 14px 16px 20px;
  }

  .shell-notebooks .notebook-home-head h2 {
    font-size: 28px;
  }
}

@media (max-width: 1040px) {
}

/* One shared desktop header for every module */

@media (min-width: 1041px) {
  .shell {
    width: min(1440px, calc(100% - 32px));
    min-height: 100vh;
    padding-top: 8px;
  }

  .shell-notebooks {
    width: min(1680px, calc(100% - 24px));
  }

  .shell .topbar,
  .shell-notebooks .topbar {
    grid-template-columns: minmax(110px, 1fr) auto;
    gap: 24px;
    width: auto;
    min-height: 52px;
    margin: 0;
    padding: 0 18px 7px;
    border-bottom-color: var(--line);
  }

  .shell-notebooks .topbar {
    width: min(1440px, calc(100% - 8px));
    margin-right: auto;
    margin-left: auto;
  }

  .shell .module-page-title {
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.04em;
  }

  .shell .topbar-side {
    flex-direction: row-reverse;
    gap: 12px;
  }

  .shell .desktop-module-nav,
  .shell .topbar-system,
  .shell .top-actions {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .shell .desktop-module-nav {
    gap: 4px;
    padding: 0;
  }

  .shell .desktop-module-nav a {
    position: relative;
    gap: 7px;
    min-width: 0;
    min-height: 34px;
    padding: 6px 9px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #575b55;
    font-size: 14px;
    font-weight: 700;
    box-shadow: none;
  }

  .shell .desktop-module-nav a::after {
    position: absolute;
    right: 10px;
    bottom: 0;
    left: 10px;
    height: 2px;
    background: transparent;
    content: "";
  }

  .shell .desktop-module-nav a:hover,
  .shell .desktop-module-nav a:focus-visible,
  .shell .desktop-module-nav a.is-active {
    border: 0;
    background: transparent;
    color: var(--accent);
    box-shadow: none;
    outline: none;
    transform: none;
  }

  .shell .desktop-module-nav a.is-active::after {
    background: var(--accent);
  }

  .shell .topbar-system {
    padding: 0;
  }

  .shell .topbar-system .density-icon-toggle {

    width: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
  }

  .shell .topbar-system .density-icon-toggle:hover,
.shell .topbar-system .density-icon-toggle:focus-visible {
    background: var(--accent-soft);
    color: var(--accent);
    outline: none;
  }

  .shell .top-actions {
    gap: 4px;
    padding: 0;
  }

  .shell .top-actions-system {
    padding-left: 0;
    border-left: 0;
  }

  .shell .top-actions .button,
  .shell .top-actions button {
    min-height: 34px;
    padding: 7px 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #666a63;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
  }

  .shell .top-actions .button:hover,
  .shell .top-actions button:hover,
  .shell .top-actions .button:focus-visible,
  .shell .top-actions button:focus-visible,
  .shell .top-actions button[aria-pressed="true"] {
    background: var(--accent-soft);
    color: var(--accent);
    outline: none;
  }

  .shell .top-actions .top-action-primary,
  .shell .top-actions .top-action-primary:hover,
  .shell .top-actions .top-action-primary:focus-visible {
    min-width: 72px;
    padding-inline: 16px;
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 7px 16px rgba(36, 91, 67, 0.14);
  }
}

/* User system */
.responsive-title-mobile {
  display: none;
}

/* Account login and password forms. */
.login-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.login-card {
  width: min(610px, 100%);
  padding: 44px 42px 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: none;
}

.login-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 46px;
}

.login-brand {
  margin: 0;
  color: var(--accent);
  font-family: SimSun, "Songti SC", serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .06em;
}

.login-identity {
  display: grid;
  gap: 3px;
}

.login-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
}

.login-card h1 {
  margin: 0 0 31px;
  font-family: SimSun, "Songti SC", serif;
  font-size: 44px;
  font-weight: 500;
  line-height: 1.2;
}

.login-card .form {
  gap: 20px;
}

.login-card .form > label {
  gap: 9px;
  font-size: 15px;
}

.login-card input {
  min-height: 52px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
}

.login-card input::placeholder {
  font-weight: 400;
}

.login-card .form > button {
  min-height: 52px;
  margin-top: 4px;
  font-size: 17px;
}

.login-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.login-consent > input {
  flex: 0 0 auto;
  width: 19px;
  min-height: 19px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.login-consent > input[aria-invalid="true"] {
  outline: 2px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
}

.login-consent > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
  min-width: 0;
}

.login-consent label,
.login-consent a {
  cursor: pointer;
}

.login-consent a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.login-consent a:hover,
.login-consent a:focus-visible,
.login-consent-dialog-link:hover,
.login-consent-dialog-link:focus-visible {
  text-decoration: underline;
}

.login-consent-dialog {
  width: min(430px, calc(100% - 28px));
  max-width: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(24, 33, 50, 0.24);
}

.login-consent-dialog::backdrop {
  background: rgba(24, 33, 50, 0.46);
  backdrop-filter: blur(3px);
}

.login-consent-dialog-shell {
  display: grid;
  gap: 12px;
  padding: 26px;
}

.login-consent-dialog-eyebrow,
.login-consent-dialog h2,
.login-consent-dialog p {
  margin: 0;
}

.login-consent-dialog-eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
}

.login-consent-dialog h2 {
  font-family: SimSun, "Songti SC", serif;
  font-size: 25px;
  font-weight: 600;
}

.login-consent-dialog p:not(.login-consent-dialog-eyebrow) {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.login-consent-dialog-link {
  width: fit-content;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.login-consent-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.login-consent-dialog-actions button {
  width: 100%;
  min-height: 46px;
}

.password-label,
.managed-user-section > .password-label {
  display: grid;
  gap: 8px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 58px;
}

.password-field > button {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  box-shadow: none;
}

/* Shared account navigation and access state. */
.account-menu {
  position: relative;
}

.account-menu > summary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 10px 10px;
  color: #575b55;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  list-style: none;
}

.account-menu > summary::after {
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 2px;
  background: transparent;
  content: "";
}

.account-menu > summary:hover,
.account-menu > summary:focus-visible,
.account-menu[open] > summary {
  color: var(--accent);
}

.account-menu[open] > summary::after {
  background: var(--accent);
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu > summary > i:first-child {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

.account-menu-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  width: 170px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.account-menu-popover > a,
.account-menu-popover > .account-menu-companion-toggle,
.account-menu-popover .logout-form button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
  box-shadow: none;
}

.account-menu-popover > a:hover,
.account-menu-popover > .account-menu-companion-toggle:hover,
.account-menu-popover > .account-menu-companion-toggle:focus-visible,
.account-menu-popover .logout-form button:hover {
  background: var(--accent-soft);
  outline: none;
}

.logout-form button {
  gap: 8px;
}

.readonly-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}

.shell.is-readonly form[method="post"],
.shell.is-readonly a[href$="/new"],
.shell.is-readonly a[href*="/edit"],
.shell.is-readonly [data-goal-create-open],
.shell.is-readonly .goal-create-dialog,
.shell.is-readonly .wordbook-create-details,
.shell.is-readonly .add-word-dialog,
.shell.is-readonly .word-detail-actions,
.shell.is-readonly [data-notebook-sort-toggle] {
  display: none !important;
}

.shell.is-readonly .topbar form[method="post"],
.shell.is-readonly .account-menu form[method="post"] {
  display: block !important;
}

.shell.is-readonly .dictionary-save-controls {
  display: none !important;
}

.shell.is-readonly .dictionary-readonly-hint {
  display: inline;
}

.shell.is-readonly .dictionary-lookup-form .word-lookup-item > label {
  grid-template-columns: minmax(0, 1fr);
  cursor: default;
}

.shell.is-readonly .dictionary-lookup-form .word-lookup-item > label > input {
  display: none;
}

/* Account management pages. */
.shell-users {
  width: min(1440px, calc(100% - 48px));
}

.user-management-layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  min-height: calc(100vh - 120px);
  border-top: 1px solid var(--line-soft);
}

.user-management-sidebar {
  padding: 36px 24px 32px 0;
  border-right: 1px solid var(--line);
}

.managed-user-search label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
}

.managed-user-search input {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.managed-user-filters {
  display: flex;
  gap: 28px;
  margin-top: 24px;
  border-bottom: 1px solid var(--line);
}

.managed-user-filters a {
  position: relative;
  padding: 10px 12px 14px;
  color: var(--muted);
  text-decoration: none;
}

.managed-user-filters a.is-active {
  color: var(--accent);
  font-weight: 700;
}

.managed-user-filters a.is-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
}

.managed-user-list {
  margin-top: 18px;
}

.managed-user-row {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
}

.managed-user-row.is-selected {
  background: var(--accent-soft);
}

.managed-user-row.is-selected::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--accent);
  content: "";
}

.managed-user-avatar,
.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.managed-user-avatar {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

.managed-user-copy {
  display: grid;
  min-width: 0;
}

.managed-user-copy strong {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  text-overflow: ellipsis;
}

.managed-user-copy small,
.managed-user-count {
  color: var(--muted);
}

.managed-user-count {
  margin: 18px 12px;
}

.status-badge,
.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.status-badge.is-active {
  border-color: color-mix(in srgb, var(--success) 30%, var(--line));
  background: color-mix(in srgb, var(--success) 8%, transparent);
  color: var(--accent);
}

.user-management-detail {
  padding: 36px 0 32px 42px;
}

.managed-user-form,
.managed-user-embedded,
.user-detail-page {
  width: 100%;
}

.managed-user-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.managed-user-heading > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.managed-user-heading h2 {
  margin: 0 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  font-weight: 500;
  line-height: 1.2;
}

.managed-user-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.managed-user-section {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.managed-user-section h3,
.user-create-panel h2,
.account-page-grid h2 {
  margin: 0;
  font-family: SimSun, "Songti SC", serif;
  font-weight: 500;
}

.managed-user-section h3 {
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 22px;
}

.managed-user-field {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: 14px;
}

.managed-user-field input,
.managed-user-field select {
  min-height: 46px;
}

.permission-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.permission-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.permission-row {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.permission-row legend {
  margin-bottom: 8px;
  padding: 0;
}

.permission-segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.permission-segments label {
  position: relative;
  margin: 0;
}

.permission-segments label + label {
  border-left: 1px solid var(--line);
}

.permission-segments input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.permission-segments span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px;
  color: var(--muted);
  cursor: pointer;
}

.permission-segments input:checked + span {
  background: var(--accent);
  color: #fff;
}

.permission-segments input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.permission-section.is-admin .permission-segments {
  opacity: .76;
}

.managed-user-actions {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-top: 28px;
}

.managed-user-edit-actions {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: start;
}

.managed-user-edit-actions > form {
  margin: 0;
}

.managed-user-edit-actions > .reset-password-panel > summary,
.managed-user-edit-actions > form > button {
  width: auto;
}

.reset-password-panel {
  position: relative;
}

.reset-password-panel > summary {
  list-style: none;
}

.reset-password-panel > summary::-webkit-details-marker {
  display: none;
}

.reset-password-panel > form {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, 86vw);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.reset-password-panel > form > * + * {
  margin-top: 14px;
}

.user-detail-page {
  max-width: 980px;
  margin: 0 auto;
}

.user-detail-mobile-head {
  display: none;
}

.user-detail-message {
  max-width: 980px;
  margin: 0 auto 14px;
}

.user-create-panel {
  max-width: 840px;
  margin: 0 auto;
  padding: 34px;
}

.user-create-panel > header p,
.account-password-panel > header p {
  color: var(--muted);
}

.user-create-panel .managed-user-actions {
  justify-content: flex-end;
}

.user-create-dialog {
  width: min(860px, calc(100% - 32px));
  max-width: none;
  max-height: min(90vh, 820px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(24, 33, 50, 0.24);
}

.user-create-dialog::backdrop {
  background: rgba(24, 33, 50, 0.42);
  backdrop-filter: blur(3px);
}

.user-create-dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(90vh, 820px);
}

.user-create-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.user-create-dialog-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.user-create-dialog-head h2,
.user-create-dialog-head p {
  margin: 0;
}

.user-create-dialog-head h2 {
  font-size: 18px;
  line-height: 1.3;
}

.user-create-dialog-head p {
  color: var(--muted);
  font-size: 12px;
}

.user-create-dialog-head > button {
  flex: 0 0 auto;
  width: 34px;
  min-width: 34px;
  padding-inline: 0;
  font-size: 20px;
}

.user-create-dialog-body {
  min-height: 0;
  padding: 20px 24px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.user-create-dialog-form .managed-user-section:first-of-type {
  padding-top: 0;
}

.user-create-dialog-form .managed-user-actions {
  justify-content: flex-end;
}

.user-create-dialog-form .managed-user-actions > button {
  width: auto;
  min-width: 120px;
}

.user-create-error {
  margin: 0 0 16px;
}

@supports (height: 100dvh) {
  .user-create-dialog,
  .user-create-dialog-shell {
    max-height: min(90dvh, 820px);
  }
}

.account-page-grid {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 18px;
  max-width: 1040px;
  margin: 0 auto;
}

.account-page-grid > .panel {
  padding: 28px;
}

.account-overview {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-content: start;
  align-items: center;
  gap: 18px;
}

.account-overview > .button {
  grid-column: 1 / -1;
}

.account-avatar {
  width: 64px;
  height: 64px;
  font-size: 28px;
}

.account-overview p,
.account-password-panel p {
  margin: 4px 0 0;
}

.account-password-panel .form {
  margin-top: 22px;
}

/* Shared system feedback and mobile account compatibility. */
.success-message {
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--success) 8%, transparent);
  color: var(--accent);
}

.access-denied {
  max-width: 540px;
  margin: 80px auto;
  padding: 42px;
  text-align: center;
}

.access-denied > i {
  color: var(--accent);
  font-size: 36px;
}

@media (max-width: 1040px) {
  .responsive-title-desktop:has(+ .responsive-title-mobile) {
    display: none;
  }

  .responsive-title-mobile {
    display: inline;
  }

  .login-shell {
    align-items: start;
    padding-top: 11vh;
  }

  .login-card {
    padding: 28px 22px;
  }

  .login-card-head {
    margin-bottom: 30px;
  }

  .login-card h1 {
    font-size: 36px;
  }

  .mobile-account-label {
    display: inline;
  }

  .shell-users {
    width: 100%;
    padding: 0 16px 92px;
  }

  .user-management-layout {
    display: block;
    min-height: 0;
    border-top: 0;
  }

  .user-management-sidebar {
    padding: 10px 0 24px;
    border-right: 0;
  }

  .user-management-detail {
    display: none;
  }

  .user-management-layout.is-detail-view .user-management-sidebar {
    display: none;
  }

  .user-management-layout.is-detail-view .user-management-detail {
    display: block;
    padding: 10px 0 24px;
  }

  .managed-user-row {
    min-height: 82px;
  }

  .user-detail-mobile-head {
    display: block;
    margin-bottom: 20px;
  }

  .user-detail-mobile-head a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
  }

  .managed-user-heading {
    display: block;
    padding: 12px 0 26px;
  }

  .managed-user-heading h2 {
    font-size: 38px;
  }

  .managed-user-heading p {
    margin-top: 12px;
  }

  .managed-user-field {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
  }

  .permission-heading {
    display: block;
  }

  .permission-heading p {
    margin: -8px 0 16px;
  }

  .permission-list {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .permission-row {
    display: block;
    padding: 18px 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .permission-row legend {
    margin-bottom: 12px;
    font-size: 17px;
    font-weight: 700;
  }

  .permission-segments span {
    min-height: 48px;
  }

  .managed-user-actions,
  .managed-user-secondary-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0;
  }

  .managed-user-actions {
    margin-top: 18px;
  }

  .managed-user-actions button,
  .managed-user-actions .button,
  .managed-user-secondary-actions button,
  .managed-user-secondary-actions .button,
  .managed-user-secondary-actions summary {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .managed-user-secondary-actions {
    margin: 10px 0 0;
  }

  .managed-user-secondary-actions > form {
    width: 100%;
    margin: 0;
  }

  .reset-password-panel > form {
    position: static;
    width: 100%;
    margin-top: 10px;
  }

  .user-create-panel {
    padding: 20px 16px;
  }

  .user-create-panel .managed-user-field,
  .user-create-dialog .managed-user-field {
    grid-template-columns: 1fr;
  }

  .user-create-dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 24px);
    border-radius: 12px;
  }

  .user-create-dialog-shell {
    max-height: calc(100vh - 24px);
  }

  .user-create-dialog-head {
    padding: 12px 14px;
  }

  .user-create-dialog-body {
    padding: 16px;
  }

  .user-create-dialog-form .managed-user-actions > button {
    width: 100%;
  }

  @supports (height: 100dvh) {
    .user-create-dialog,
    .user-create-dialog-shell {
      max-height: calc(100dvh - 24px);
    }
  }

  .account-page-grid {
    grid-template-columns: 1fr;
  }

}

/* Compact mobile module header shared by every landing page. */

@media (max-width: 1040px) {
  .shell > .topbar.is-module-landing {
    gap: 8px;
    min-height: 50px;
    padding: 4px 10px 4px 14px;
  }

  .shell > .topbar.is-module-landing .topbar-title {
    gap: 6px;
  }

  .shell > .topbar.is-module-landing .module-page-title {
    font-size: 24px;
    line-height: 1;
  }

  .shell > .topbar.is-module-landing .module-page-meta {
    font-size: 11px;
  }

  .shell > .topbar.is-module-landing .top-actions.is-mobile-menu,
  .shell > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main,
  .shell > .topbar.is-module-landing .top-actions.is-mobile-menu.has-keep-action .top-actions-main {
    gap: 6px;
  }

  .shell > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 7px;
  }

  .shell > .topbar.is-module-landing .top-action-icon {
    font-size: 22px;
  }

  .shell > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready .top-actions-more {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 7px;
  }
}

@media (max-width: 400px) {
  .shell > .topbar.is-module-landing {
    padding-right: 8px;
    padding-left: 12px;
  }

  .shell > .topbar.is-module-landing .module-page-title {
    font-size: 23px;
  }
}

/* Mobile account and user administration aligned with the module family. */

@media (max-width: 1040px) {
  :is(.shell-account, .shell-users) {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0 0 calc(70px + env(safe-area-inset-bottom, 0px));
    background: #f4f3ee;
    color: #202923;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  }

  :is(.shell-account, .shell-users) > .topbar.is-module-landing {
    position: sticky;
    top: 0;
    z-index: 78;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    margin: 0;
    border-bottom: 1px solid #dee1da;
    background: rgba(244, 243, 238, 0.98);
    backdrop-filter: none;
  }

  :is(.shell-account, .shell-users) > .topbar.is-module-landing .topbar-title {
    display: flex;
    align-items: baseline;
    min-width: 0;
  }

  :is(.shell-account, .shell-users) > .topbar.is-module-landing .module-page-title {
    color: #202923;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-weight: 650;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }

  :is(.shell-account, .shell-users) > .topbar.is-module-landing .module-page-meta {
    display: inline;
    color: #7a817b;
    font-weight: 500;
    white-space: nowrap;
  }

  :is(.shell-account, .shell-users) > .topbar.is-module-landing .top-actions.is-mobile-menu,
  :is(.shell-account, .shell-users) > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main {
    gap: 6px;
  }

  .shell-users > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    border: 0;
    background: #2d6249;
    box-shadow: none;
    color: #ffffff;
  }

  .shell-users > .topbar.is-module-landing .top-action-primary > span {
    display: none;
  }

  :is(.shell-account, .shell-users) > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready .top-actions-more {
    border: 1px solid #dee1da;
    background: rgba(255, 255, 255, 0.34);
    color: #5f6862;
    box-shadow: none;
  }

  :is(.shell-account, .shell-users) > .topbar.is-module-landing .top-actions-more-icon {
    transform: rotate(90deg);
  }

  :is(.shell-account, .shell-users) + .module-nav {
    gap: 0;
    min-height: 62px;
    padding: 4px 8px calc(3px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #dee1da;
    background: rgba(248, 247, 242, 0.98);
    box-shadow: none;
    backdrop-filter: none;
  }

  :is(.shell-account, .shell-users) + .module-nav a {
    gap: 2px;
    min-height: 52px;
    padding: 4px 2px 3px;
    border-radius: 0;
    background: transparent;
    color: #737b75;
    font-size: 11px;
    font-weight: 600;
  }

  :is(.shell-account, .shell-users) + .module-nav .module-nav-icon {
    width: 21px;
    height: 21px;
    font-size: 20px;
  }

  /* Personal account */

  .shell-account .account-page-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: none;
    margin: 0;
    padding: 12px 12px 24px;
  }

  .shell-account .account-page-grid > .panel {
    padding: 16px;
    border: 1px solid #e0e2dc;
    border-radius: 8px;
    background: #faf9f5;
    box-shadow: none;
  }

  .shell-account .account-overview {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
  }

  .shell-account .account-avatar {
    width: 52px;
    height: 52px;
    border-color: #d8dcd6;
    background: #f4f3ee;
    color: #2d6249;
    font-size: 24px;
  }

  .shell-account .account-page-grid h2 {
    color: #202923;
    font-size: 24px;
    line-height: 1.25;
  }

  .shell-account .account-overview p,
  .shell-account .account-password-panel p {
    color: #707972;
    font-size: 13px;
    line-height: 1.5;
  }

  .shell-account .account-overview > .button {
    min-height: 40px;
    border-color: #d8dcd6;
    border-radius: 6px;
    background: #f4f3ee;
    color: #2d6249;
    box-shadow: none;
  }

  .shell-account .account-password-panel .form {
    gap: 14px;
    margin-top: 16px;
  }

  .shell-account :where(input, select, textarea) {
    border-color: #dde0da;
    border-radius: 6px;
    background: #f4f3ee;
    box-shadow: none;
  }

  .shell-account .account-password-panel .form > button[type="submit"] {
    min-height: 42px;
    border-radius: 6px;
    background: #2d6249;
    box-shadow: none;
  }

  /* User administration */

  .shell-users .user-management-layout {
    min-height: 0;
    margin: 12px;
    border: 0;
  }

  .shell-users .user-management-sidebar {
    padding: 14px;
    border: 1px solid #e0e2dc;
    border-radius: 8px;
    background: #faf9f5;
  }

  .shell-users .managed-user-search label {
    min-height: 44px;
    border-color: #dde0da;
    border-radius: 6px;
    background: #f4f3ee;
  }

  .shell-users .managed-user-filters {
    gap: 0;
    margin-top: 12px;
    border-bottom-color: #dee1da;
  }

  .shell-users .managed-user-filters a {
    flex: 1 1 0;
    padding: 10px 6px 11px;
    text-align: center;
  }

  .shell-users .managed-user-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
  }

  .shell-users .managed-user-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 72px;
    padding: 11px 10px;
    border: 1px solid #e0e2dc;
    border-radius: 7px;
    background: #f7f6f1;
  }

  .shell-users .managed-user-row.is-selected {
    border-left: 3px solid #78917f;
    background: #eef1eb;
  }

  .shell-users .managed-user-row.is-selected::before {
    display: none;
  }

  .shell-users .managed-user-avatar {
    width: 38px;
    height: 38px;
    border-color: #d8dcd6;
    color: #647068;
    font-size: 20px;
  }

  .shell-users .managed-user-copy strong {
    color: #202923;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-size: 17px;
    font-weight: 700;
  }

  .shell-users .managed-user-copy small,
  .shell-users .managed-user-count {
    color: #7a817b;
  }

  .shell-users .managed-user-count {
    margin: 14px 2px 2px;
  }

  .shell-users .user-management-layout.is-detail-view {
    margin: 12px;
  }

  .shell-users .user-management-layout.is-detail-view .user-management-detail {
    padding: 0;
  }

  .shell-users .managed-user-embedded,
  .shell-users .user-create-panel {
    padding: 16px;
    border: 1px solid #e0e2dc;
    border-radius: 8px;
    background: #faf9f5;
  }

  .shell-users .user-detail-mobile-head {
    margin: 0 0 10px;
  }

  .shell-users .user-detail-mobile-head a {
    color: #2d6249;
    font-size: 13px;
    font-weight: 700;
  }

  .shell-users .managed-user-heading {
    padding: 4px 0 18px;
  }

  .shell-users .managed-user-heading h2 {
    color: #202923;
    font-family: ui-serif, "Songti SC", "STSong", serif;
    font-size: 28px;
  }

  .shell-users .managed-user-section {
    padding: 20px 0;
    border-bottom-color: #dee1da;
  }

  .shell-users .managed-user-section h3 {
    margin-bottom: 14px;
    color: #2d6249;
    font-size: 18px;
  }

  .shell-users .managed-user-field {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 10px;
  }

  .shell-users :where(input, select, textarea) {
    border-color: #dde0da;
    border-radius: 6px;
    background: #f4f3ee;
    box-shadow: none;
  }

  .shell-users .permission-row {
    padding: 14px 0;
    border-bottom-color: #e4e6e0;
  }

  .shell-users .permission-segments {
    border-color: #d8dcd6;
    border-radius: 6px;
  }

  .shell-users .permission-segments label + label {
    border-left-color: #d8dcd6;
  }

  .shell-users .permission-segments span {
    min-height: 42px;
  }

  .shell-users .managed-user-actions :where(button, .button, summary) {
    min-height: 42px;
    border-radius: 6px;
    box-shadow: none;
  }

  .shell-users > .user-detail-mobile-head,
  .shell-users > .user-create-panel {
    margin: 12px;
  }
}

@media (max-width: 400px) {
  .shell-users .managed-user-field {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1040px) {
}

/* Keep every mobile modal inside the Android WebView visual viewport. */
@media (max-width: 1040px) {
  .login-consent-dialog,
  .user-create-dialog,
  .user-create-dialog-shell,
  .notebook-preview-dialog,
  .notebook-preview-dialog.notebook-preview-drawer,
  .notebook-image-viewer {
    max-height: var(--app-mobile-dialog-height, calc(100dvh - 24px));
  }

  .notebook-preview-dialog,
  .notebook-preview-dialog.notebook-preview-drawer,
  .notebook-image-viewer {
    height: var(--app-mobile-dialog-height, calc(100dvh - 24px));
  }

  .login-consent-dialog-shell,
  .user-create-dialog-shell {
    max-height: var(--app-mobile-dialog-height, calc(100dvh - 24px));
  }

  .login-consent-dialog-shell,
  .user-create-dialog-body,
  .notebook-preview-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .notebook-image-viewer img {
    max-height: calc(var(--app-mobile-dialog-height, 100dvh) - 74px);
  }

  .add-word-dialog,
  .reading-drawer,
  .reading-settings-dialog,
  .reading-upload-dialog,
  .reading-annotation-dialog,
  .reading-folder-dialog,
  .reading-book-metadata-dialog {
    max-height: var(--app-mobile-overlay-max-height, calc(100dvh - 12px));
  }

  .reading-drawer {
    height: var(--app-mobile-sheet-height, min(82dvh, 760px));
  }

  .add-word-dialog > form,
  .reading-settings-card,
  .reading-upload-card,
  .reading-annotation-card,
  .reading-folder-card,
  .reading-book-metadata-card {
    max-height: var(--app-mobile-overlay-max-height, calc(100dvh - 12px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .confirm-dialog {
    max-height: calc(var(--app-mobile-viewport-height, 100dvh) - 112px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Optional global Eggy companion: fixed above content, below menus and dialogs. */
.floating-companion-toggle-icon {
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}

.floating-companion-stage {
  position: fixed;
  z-index: 75;
  inset: 0;
  padding: 10px 10px 18px;
  overflow: hidden;
  pointer-events: none;
}

.floating-companion-stage[hidden],
html.floating-companion-hidden .floating-companion-stage {
  display: none;
}

.floating-companion {
  position: absolute;
  top: 0;
  left: 0;
  width: 74px;
  height: 80px;
  pointer-events: none;
  will-change: transform;
}

.floating-companion-button {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 42%;
  background: transparent;
  color: inherit;
  box-shadow: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
}

.floating-companion-button:hover,
.floating-companion-button:active {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.floating-companion-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
}

.floating-companion.is-dragging .floating-companion-button {
  cursor: grabbing;
}

.floating-companion-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 7px 8px rgba(29, 45, 37, 0.2));
  transform-origin: 50% 88%;
  animation: floating-companion-idle 3.2s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.floating-companion.is-dragging .floating-companion-image {
  animation: none;
  transform: scale(1.04);
}

.floating-companion-message {
  position: absolute;
  z-index: 2;
  bottom: calc(100% - 8px);
  left: 3px;
  width: max-content;
  max-width: min(168px, calc(100vw - 20px));
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 10px 10px 10px 3px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 8px 22px rgba(24, 33, 50, 0.14);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px) scale(0.96);
  transform-origin: left bottom;
  transition: opacity 150ms ease, transform 150ms ease;
  white-space: nowrap;
}

.floating-companion[data-bubble-side="right"] .floating-companion-message {
  right: 3px;
  left: auto;
  border-radius: 10px 10px 3px;
  transform-origin: right bottom;
}

.floating-companion.is-talking .floating-companion-message {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.floating-companion-button::after {
  position: absolute;
  top: 3px;
  right: 1px;
  color: #f25c7f;
  content: "♥";
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 5px rgba(255, 255, 255, 0.8);
}

.floating-companion.is-reacting .floating-companion-button::after {
  animation: floating-companion-heart 720ms ease-out both;
}

.floating-companion.is-reacting[data-reaction="hop"] .floating-companion-image {
  animation: floating-companion-hop 560ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-companion.is-reacting[data-reaction="wiggle"] .floating-companion-image {
  animation: floating-companion-wiggle 620ms ease-in-out;
}

.floating-companion.is-reacting[data-reaction="twirl"] .floating-companion-image {
  animation: floating-companion-twirl 680ms ease-in-out;
}

@keyframes floating-companion-idle {
  0%,
  100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

@keyframes floating-companion-hop {
  0%,
  100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-14px) scale(1.04, 0.96); }
  72% { transform: translateY(2px) scale(0.97, 1.03); }
}

@keyframes floating-companion-wiggle {
  0%,
  100% { transform: rotate(0); }
  25% { transform: rotate(-8deg); }
  55% { transform: rotate(8deg); }
  78% { transform: rotate(-4deg); }
}

@keyframes floating-companion-twirl {
  0%,
  100% { transform: rotate(0) scale(1); }
  45% { transform: rotate(12deg) scale(1.06); }
  72% { transform: rotate(-6deg) scale(0.98); }
}

@keyframes floating-companion-heart {
  0% { opacity: 0; transform: translateY(7px) scale(0.6); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-17px) scale(1.18); }
}

@media (max-width: 1040px) {
  .floating-companion-stage {
    padding: 6px 6px calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .floating-companion {
    width: 62px;
    height: 67px;
  }

  .floating-companion-message {
    bottom: calc(100% - 6px);
    padding: 5px 8px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-companion-image,
  .floating-companion.is-reacting .floating-companion-image,
  .floating-companion.is-reacting .floating-companion-button::after {
    animation: none !important;
  }

  .floating-companion-message {
    transition: none;
  }
}

/* Account typography: one interface family with a clear four-step hierarchy. */

.shell-account .account-page-grid {
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

.shell-account .account-page-grid :where(.eyebrow, h2, p, label, .button, button, input) {
  font-family: inherit;
}

.shell-account .account-page-grid .eyebrow {
  margin: 0;
  color: var(--apple-muted, #6e6e73);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

.shell-account .account-page-grid h2 {
  margin-top: 4px;
  color: var(--apple-ink, #1d1d1f);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}

.shell-account .account-overview p:not(.eyebrow),
.shell-account .account-advisor-panel header > p:not(.eyebrow),
.shell-account .account-password-panel header > p:not(.eyebrow) {
  margin-top: 6px;
  color: var(--apple-muted, #6e6e73);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
}

.shell-account .account-page-grid .password-label {
  color: var(--apple-ink-soft, #3a3a3c);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.shell-account .account-page-grid :where(.button, button) {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

@media (max-width: 1040px) {
  .shell-account .account-page-grid h2 {
    font-size: 20px;
  }

  .shell-account .account-overview p:not(.eyebrow),
  .shell-account .account-advisor-panel header > p:not(.eyebrow),
  .shell-account .account-password-panel header > p:not(.eyebrow) {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eggy-game-entry > img,
  .eggy-parkour-touch-controls,
  .eggy-parkour-touch-controls button i,
  .eggy-parkour-overlay {
    transition: none;
  }
}

/* Swiss Archive shared product topbar
   Goals, notes and check-ins use one stable brand/account/navigation contract.
   Module-specific actions may vary, but they sit before the shared account/nav group. */

:is(.shell-goals, .shell-notes, .shell-checkins) {
  --swiss-page-canvas: #f5f5f7;
  --swiss-page-surface: #ffffff;
  --swiss-topbar-surface: #ffffff;
  --swiss-topbar-ink: #15171a;
  --swiss-topbar-muted: #6c7178;
  --swiss-topbar-rule: #d2d3d0;
  --swiss-topbar-blue: #1455cc;
  --swiss-topbar-blue-hover: #0b43a8;
  --swiss-topbar-blue-soft: #e8eef9;
  --swiss-topbar-focus: #7aa4ff;
  background: var(--swiss-page-canvas);
}

html:has(.shell-goals),
html:has(.shell-notes),
html:has(.shell-checkins),
body:has(.shell-goals),
body:has(.shell-notes),
body:has(.shell-checkins) {
  background: #f5f5f7;
}

.shell-goals :is(.focus-layout, .goal-category-index, .goal-overview, .focus-rail) {
  background: var(--swiss-page-canvas);
}

@media (min-width: 1041px) {
  :is(.shell.shell-goals, .shell.shell-notes, .shell.shell-checkins) {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    padding-top: 0;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing {
    grid-template-columns: minmax(160px, 1fr) auto;
    gap: 28px;
    width: 100%;
    height: 68px;
    min-height: 68px;
    margin: 0;
    border-bottom: 1px solid var(--swiss-topbar-rule);
    background: var(--swiss-topbar-surface);
    box-sizing: border-box;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .topbar-title {
    gap: 4px;
    align-items: center;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .module-page-title {
    color: var(--swiss-topbar-ink);
    font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
    font-size: 30px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .module-page-meta {
    color: var(--swiss-topbar-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .topbar-side {
    flex-direction: row;
    gap: 14px;
    align-items: center;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .top-actions {
    order: 0;
    margin: 0;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .topbar-system {
    order: 1;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .account-menu {
    order: 3;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav {
    order: 2;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing :is(.desktop-module-nav, .topbar-system, .top-actions) {
    gap: 2px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .account-menu > summary {
    min-height: 44px;
    padding: 11px 10px 12px;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: var(--swiss-topbar-muted);
    font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    box-shadow: none;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .account-menu > summary:hover,
  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .account-menu > summary:focus-visible,
  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .account-menu[open] > summary {
    color: var(--swiss-topbar-blue);
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .account-menu > summary:focus-visible {
    outline: 2px solid var(--swiss-topbar-focus);
    outline-offset: 1px;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .account-menu[open] > summary::after {
    right: 10px;
    bottom: 5px;
    left: 10px;
    height: 2px;
    background: var(--swiss-topbar-blue);
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav {
    gap: 2px;
    min-height: 44px;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav .module-nav-icon,
  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav a::before {
    display: none;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav a {
    position: relative;
    gap: 7px;
    min-width: 0;
    min-height: 44px;
    padding: 11px 9px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--swiss-topbar-muted);
    font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    box-shadow: none;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav a::after {
    position: absolute;
    right: 9px;
    bottom: 5px;
    left: 9px;
    height: 2px;
    border-radius: 0;
    background: transparent;
    content: "";
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav a:hover,
  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav a:focus-visible,
  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav a.is-active {
    border: 0;
    background: transparent;
    color: var(--swiss-topbar-blue);
    outline: 0;
    box-shadow: none;
    transform: none;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav a:focus-visible {
    outline: 2px solid var(--swiss-topbar-focus);
    outline-offset: 1px;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .desktop-module-nav a.is-active::after {
    background: var(--swiss-topbar-blue);
  }
}

@media (max-width: 1040px) {
  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing {
    position: sticky;
    top: 0;
    z-index: 78;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
    height: 50px;
    min-height: 50px;
    margin: 0;
    padding: 3px 8px 3px 16px;
    border-bottom: 1px solid var(--swiss-topbar-rule);
    background: rgb(255 255 255 / 98%);
    box-sizing: border-box;
    backdrop-filter: none;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .topbar-title {
    gap: 6px;
    align-items: center;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .module-page-title {
    color: var(--swiss-topbar-ink);
    font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .module-page-meta {
    color: var(--swiss-topbar-muted);
    font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .top-actions.is-mobile-menu,
  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main {
    gap: 6px;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--swiss-topbar-blue);
    border-radius: 2px;
    background: var(--swiss-topbar-blue);
    color: #fff;
    font-size: 20px;
    box-shadow: none;
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary:hover,
  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary:focus-visible {
    border-color: var(--swiss-topbar-blue-hover);
    background: var(--swiss-topbar-blue-hover);
  }

  :is(.shell-goals, .shell-notes, .shell-checkins) > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready .top-actions-more {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--swiss-topbar-rule);
    border-radius: 2px;
    background: transparent;
    color: var(--swiss-topbar-muted);
    font-size: 20px;
    box-shadow: none;
  }
}

/* Apple x Zixu shared visual mode.
   Pages opt in through renderAppShell({ visualMode: "apple-fusion" }) so the
   staged migration cannot restyle modules that have not been reviewed yet. */

@media (prefers-reduced-motion: no-preference) and (min-width: 1041px) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-group(root),
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }

  ::view-transition-group(zixu-topbar) {
    animation-duration: 60ms;
    animation-timing-function: ease-out;
  }

  ::view-transition-old(zixu-topbar) {
    animation-duration: 120ms;
    animation-name: none;
  }

  ::view-transition-new(zixu-topbar) {
    animation-duration: 60ms;
    animation-name: zixu-topbar-reveal;
    animation-timing-function: step-end;
  }
}

.inline-editor-placeholder {
  margin: 0;
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.inline-editor-placeholder a {
  color: currentColor;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes zixu-topbar-reveal {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

html:has(.visual-apple-fusion),
body:has(.visual-apple-fusion) {
  background: #f5f5f7;
}

.visual-apple-fusion {
  --apple-primary: #0066cc;
  --apple-primary-focus: #0071e3;
  --apple-primary-on-dark: #2997ff;
  --apple-canvas: #ffffff;
  --apple-canvas-parchment: #f5f5f7;
  --apple-surface-pearl: #fafafc;
  --apple-ink: #1d1d1f;
  --apple-ink-soft: #333336;
  --apple-muted: #6e6e73;
  --apple-faint: #86868b;
  --apple-hairline: rgba(0, 0, 0, 0.1);
  --apple-hairline-soft: rgba(0, 0, 0, 0.06);
  --apple-danger: #c9362b;
  --apple-danger-soft: #fff0ee;
  --apple-success: #267a4a;
  --apple-low: #8e8e93;
  --apple-control-radius: 10px;
  --apple-control-radius-compact: 8px;
  --apple-disabled-surface: #e8e8ed;
  --apple-disabled-border: #c7c7cc;
  --apple-disabled-ink: #5e5e63;
  --apple-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding-top: 0;
  background: var(--apple-canvas-parchment);
  color: var(--apple-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-variant-numeric: lining-nums tabular-nums;
}

.visual-apple-fusion > .topbar {
  position: relative;
  z-index: 100;
  border-bottom: 0;
  background: #000000;
  color: #ffffff;
  box-shadow: none;
  view-transition-name: zixu-topbar;
}

.visual-apple-fusion > .topbar h1,
.visual-apple-fusion > .topbar .module-page-title {
  color: #ffffff;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.visual-apple-fusion > .topbar .module-page-meta {
  color: #a1a1a6;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 400;
}

.visual-apple-fusion > .topbar .desktop-module-nav a {
  color: #a1a1a6;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  font-weight: 400;
}

.visual-apple-fusion > .topbar .desktop-module-nav a:hover,
.visual-apple-fusion > .topbar .desktop-module-nav a:focus-visible {
  color: #ffffff;
}

.visual-apple-fusion > .topbar .desktop-module-nav a.is-active {
  color: var(--apple-primary-on-dark);
}

.visual-apple-fusion > .topbar .desktop-module-nav a.is-active::after {
  background: var(--apple-primary-on-dark);
}

.visual-apple-fusion > .topbar .account-menu > summary {
  color: #d2d2d7;
}

.visual-apple-fusion > .topbar .account-menu > summary:hover,
.visual-apple-fusion > .topbar .account-menu > summary:focus-visible,
.visual-apple-fusion > .topbar .account-menu[open] > summary {
  background: #1d1d1f;
  color: #ffffff;
}

.visual-apple-fusion > .topbar .account-menu-popover {
  border: 1px solid var(--apple-hairline);
  border-radius: 12px;
  background: rgba(250, 250, 252, 0.96);
  box-shadow: none;
  backdrop-filter: saturate(180%) blur(20px);
}

.visual-apple-fusion > .topbar .account-menu-popover :where(a, button) {
  color: var(--apple-ink);
}

body > .shell.visual-apple-fusion > .topbar .account-menu-popover > :is(a, .account-menu-companion-toggle) {
  min-height: 44px;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--apple-ink) !important;
}

body > .shell.visual-apple-fusion > .topbar .account-menu-popover > :is(a, .account-menu-companion-toggle) > i {
  width: 18px;
  flex: 0 0 18px;
  font-size: 16px;
  text-align: center;
}

body > .shell.visual-apple-fusion > .topbar .account-menu-popover > :is(a, .account-menu-companion-toggle):focus-visible {
  background: rgba(0, 102, 204, 0.08) !important;
  color: var(--apple-primary-focus) !important;
  outline: 2px solid var(--apple-primary-focus);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  body > .shell.visual-apple-fusion > .topbar .account-menu-popover > :is(a, .account-menu-companion-toggle):hover {
    background: rgba(0, 102, 204, 0.08) !important;
    color: var(--apple-primary-focus) !important;
  }
}

.visual-apple-fusion :where(.button, button) {
  /* Keep the shared touch target invariant above legacy compact-control rules. */
  min-height: 44px !important;
  box-shadow: none;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease,
    transform 120ms var(--apple-ease-out);
}

.visual-apple-fusion :where(.button, button):active {
  transform: scale(0.97);
}

.visual-apple-fusion :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--apple-primary-focus);
  outline-offset: 2px;
}

.visual-apple-fusion :where(.button, button):not(.secondary, .danger, [data-reading-sidebar-tab]) {
  border-color: var(--apple-primary);
  border-radius: var(--apple-control-radius);
  background: var(--apple-primary);
  color: #ffffff;
}

.visual-apple-fusion :where(.button, button):not(.secondary, .danger, [data-reading-sidebar-tab]):hover,
.visual-apple-fusion :where(.button, button):not(.secondary, .danger, [data-reading-sidebar-tab]):focus-visible {
  border-color: var(--apple-primary-focus);
  background: var(--apple-primary-focus);
  color: #ffffff;
}

.shell-notebooks.visual-apple-fusion .notebook-tree-search {
  grid-template-columns: minmax(0, 1fr) 44px 44px;
}

.shell-notebooks.visual-apple-fusion .notebook-tree-search > :where(button, a) {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: var(--apple-control-radius, 10px) !important;
}

.visual-apple-fusion :where(.button.secondary, button.secondary) {
  border: 1px solid var(--apple-primary);
  border-radius: var(--apple-control-radius);
  background: transparent;
  color: var(--apple-primary);
}

.visual-apple-fusion :where(.button.secondary, button.secondary):hover,
.visual-apple-fusion :where(.button.secondary, button.secondary):focus-visible,
.visual-apple-fusion :where(.button.secondary, button.secondary)[aria-pressed="true"] {
  border-color: var(--apple-primary-focus);
  background: rgba(0, 102, 204, 0.08);
  color: var(--apple-primary-focus);
}

.visual-apple-fusion :where(.button.danger, button.danger) {
  border: 1px solid var(--apple-danger);
  border-radius: var(--apple-control-radius);
  background: transparent;
  color: var(--apple-danger);
}

.visual-apple-fusion :where(.button.danger, button.danger):hover,
.visual-apple-fusion :where(.button.danger, button.danger):focus-visible {
  background: var(--apple-danger-soft);
}

.visual-apple-fusion :where(.button, button):disabled,
.visual-apple-fusion :where(.button, button)[aria-disabled="true"] {
  border-color: var(--apple-disabled-border) !important;
  background: var(--apple-disabled-surface) !important;
  color: var(--apple-disabled-ink) !important;
  opacity: 1 !important;
}

.visual-apple-fusion :where(input:not([type="checkbox"], [type="radio"]), select, textarea) {
  min-height: 44px;
  border: 1px solid var(--apple-hairline);
  border-radius: 12px;
  background: var(--apple-canvas);
  color: var(--apple-ink);
  box-shadow: none;
  font: inherit;
}

.shell-goals.visual-apple-fusion :where(
  .button,
  button,
  input:not([type="checkbox"], [type="radio"]),
  select,
  textarea
) {
  min-height: 44px;
}

.visual-apple-fusion :where(input:not([type="checkbox"], [type="radio"]), select, textarea):focus-visible {
  border-color: var(--apple-primary);
  outline: 2px solid var(--apple-primary-focus);
  outline-offset: 1px;
  box-shadow: none;
}

.visual-apple-fusion :where(.panel, .detail-card, .history-panel, .inline-edit-panel) {
  border-color: var(--apple-hairline);
  background: var(--apple-canvas);
  box-shadow: none;
}

.visual-apple-fusion :where(dialog, .confirm-dialog) {
  border: 1px solid var(--apple-hairline);
  background: var(--apple-canvas);
  color: var(--apple-ink);
  box-shadow: none;
}

.visual-apple-fusion :where(dialog, .confirm-dialog)::backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
}

.visual-apple-fusion + .module-nav {
  border-top: 1px solid #1d1d1f;
  background: rgba(250, 250, 252, 0.92);
  box-shadow: none;
  backdrop-filter: saturate(180%) blur(20px);
}

.visual-apple-fusion + .module-nav a,
.visual-apple-fusion + .module-nav a.is-active {
  background: transparent;
  color: #1d1d1f;
  font-weight: 400;
}

.visual-apple-fusion + .module-nav a.is-active {
  color: #1d1d1f;
}

.visual-apple-fusion + .module-nav a.is-active::after {
  background: #1d1d1f;
}

.visual-apple-fusion + .module-nav .module-nav-icon {
  width: 21px;
  height: 21px;
  font-size: 20px;
}

html:not(.reading-night-mode) .shell-reading.visual-apple-fusion:has(> .reading-reader) + .module-nav {
  border-top-color: #e5e5e5;
  background: rgba(255, 255, 255, 0.96);
}

html.reading-night-mode .shell-reading.visual-apple-fusion + .module-nav {
  border-top-color: #262626;
  background: rgba(0, 0, 0, 0.96);
}

html.reading-night-mode .shell-reading.visual-apple-fusion + .module-nav a,
html.reading-night-mode .shell-reading.visual-apple-fusion + .module-nav a.is-active {
  color: #a1a1a6;
}

html.reading-night-mode .shell-reading.visual-apple-fusion + .module-nav a.is-active {
  color: #b0b0b0;
}

html.reading-night-mode .shell-reading.visual-apple-fusion + .module-nav a.is-active::after {
  background: #b0b0b0;
}

/* Shared module subnavigation must ship with every routed module stylesheet. */
.module-subnav {
  display: none;
}

@media (max-width: 1040px) {
  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu {
    gap: 4px;
  }

  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary,
  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready > .top-actions-more {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0 !important;
    border-radius: 9999px !important;
    box-shadow: none !important;
  }

  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #64b5ff !important;
  }

  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary:focus-visible {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #8fc9ff !important;
  }

  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready > .top-actions-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    font-size: 20px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #d2d2d7 !important;
  }

  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready > .top-actions-more:focus-visible {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
  }

  body > .shell.visual-apple-fusion > .topbar.is-module-landing :is(.top-action-icon, .top-actions-more-icon) {
    font-size: 22px;
    line-height: 1;
  }
}

@media (max-width: 1040px) and (hover: hover) and (pointer: fine) {
  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main .top-action-primary:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #8fc9ff !important;
  }

  body > .shell.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu.is-menu-ready > .top-actions-more:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
  }
}

@media (min-width: 1041px) {
  .module-subnav-mobile-action {
    display: none !important;
  }

  body > .shell.visual-apple-fusion > .topbar {
    grid-template-columns: minmax(140px, 1fr) auto;
    gap: 24px;
    height: 44px;
    min-height: 44px;
    padding: 0 20px;
  }

  .visual-apple-fusion > .topbar h1,
  .visual-apple-fusion > .topbar .module-page-title {
    font-size: 21px;
    line-height: 1;
  }

  .visual-apple-fusion > .topbar .topbar-side {
    gap: 12px;
  }

  :where(.shell-calendar.visual-apple-fusion, .shell-goals.visual-apple-fusion:not(:has(> .goal-apple-fusion))) > .topbar .top-actions {
    display: flex;
    order: 1;
  }

  :where(.shell-calendar.visual-apple-fusion, .shell-goals.visual-apple-fusion:not(:has(> .goal-apple-fusion))) > .topbar .desktop-module-nav {
    order: 2;
  }

  :where(.shell-calendar.visual-apple-fusion, .shell-goals.visual-apple-fusion:not(:has(> .goal-apple-fusion))) > .topbar .account-menu {
    order: 3;
  }

  .visual-apple-fusion > .topbar .desktop-module-nav {
    gap: 2px;
    min-height: 44px;
  }

  .visual-apple-fusion > .topbar .desktop-module-nav a {
    min-height: 44px;
    padding: 14px 10px 13px;
    border-radius: 0;
    font-size: 12px;
    letter-spacing: -0.01em;
  }

  .visual-apple-fusion > .topbar .desktop-module-nav a::after {
    right: 10px;
    bottom: 4px;
    left: 10px;
    height: 2px;
    border-radius: 9999px;
  }

  .visual-apple-fusion > .topbar .account-menu > summary {
    min-height: 44px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 12px;
  }

  .visual-apple-fusion > .topbar :where(.top-actions-main, .topbar-system) {
    gap: 6px;
  }

  .visual-apple-fusion > .topbar :where(.top-actions-main, .topbar-system) :where(.button, button) {
    min-height: 44px;
    padding: 8px 13px;
    font-size: 12px;
  }

  .visual-apple-fusion > .topbar :where(.top-actions-main, .topbar-system) :where(.button.secondary, button.secondary) {
    border-color: #424245;
    background: #1d1d1f;
    color: #f5f5f7;
  }

  .visual-apple-fusion > .topbar :where(.top-actions-main, .topbar-system) :where(.button.secondary, button.secondary):hover,
  .visual-apple-fusion > .topbar :where(.top-actions-main, .topbar-system) :where(.button.secondary, button.secondary):focus-visible,
  .visual-apple-fusion > .topbar :where(.top-actions-main, .topbar-system) :where(.button.secondary, button.secondary)[aria-pressed="true"] {
    border-color: var(--apple-primary-on-dark);
    background: rgba(41, 151, 255, 0.14);
    color: var(--apple-primary-on-dark);
  }

  /* Module tools share the black navigation plane instead of forming a row of pills. */
  body > .shell.visual-apple-fusion > .topbar :is(.top-actions-main, .topbar-system) :is(.button, button) {
    height: 44px;
    min-height: 44px;
    padding: 0 7px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none;
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 1.2;
    white-space: nowrap;
  }

  body > .shell.visual-apple-fusion > .topbar :is(.top-actions-main, .topbar-system) :is(.button.secondary, button.secondary) {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #86868b !important;
  }

  body > .shell.visual-apple-fusion > .topbar :is(.top-actions-main, .topbar-system) :is(.button.secondary, button.secondary):hover,
  body > .shell.visual-apple-fusion > .topbar :is(.top-actions-main, .topbar-system) :is(.button.secondary, button.secondary):focus-visible {
    background: transparent !important;
    color: #f5f5f7 !important;
  }

  body > .shell.visual-apple-fusion > .topbar .top-actions-main :is(.button, button).top-action-primary {
    min-width: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #86868b !important;
    font-weight: 400 !important;
  }

  body > .shell.visual-apple-fusion > .topbar .top-actions-main :is(.button, button).top-action-primary:hover,
  body > .shell.visual-apple-fusion > .topbar .top-actions-main :is(.button, button).top-action-primary:focus-visible {
    background: transparent !important;
    color: #d2d2d7 !important;
  }

  body > .shell.visual-apple-fusion > .topbar .top-actions-main :is(.button, button):focus-visible {
    outline: 2px solid var(--apple-primary-on-dark);
    outline-offset: -3px;
  }

  /* Keep the shared desktop topbar identical across modules and account pages. */
  body > .shell.visual-apple-fusion > .topbar .topbar-side {
    gap: 12px;
    align-items: center;
  }

  body > .shell.visual-apple-fusion > .topbar .top-actions {
    order: 0 !important;
  }

  body > .shell.visual-apple-fusion > .topbar .topbar-system {
    order: 1 !important;
  }

  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav {
    order: 2 !important;
    gap: 2px;
    min-height: 44px;
  }

  body > .shell.visual-apple-fusion > .topbar .module-subnav {
    order: 2 !important;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0;
    width: auto;
    min-height: 44px;
    margin: 0 2px 0 0;
    padding: 0 10px 0 0;
    border: 0;
    border-right: 1px solid #424245;
    background: transparent;
  }

  body > .shell.visual-apple-fusion > .topbar .module-subnav > a {
    position: relative;
    display: inline-flex;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    align-items: center;
    padding: 0 7px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #86868b;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: none;
  }

  body > .shell.visual-apple-fusion > .topbar .module-subnav > a::after {
    position: absolute;
    right: 7px;
    bottom: 4px;
    left: 7px;
    height: 2px;
    border-radius: 9999px;
    background: transparent;
    content: "";
  }

  body > .shell.visual-apple-fusion > .topbar .module-subnav > a:is(:focus-visible, .is-active) {
    color: #f5f5f7;
  }

  body > .shell.visual-apple-fusion > .topbar .module-subnav > a:focus-visible {
    outline: 2px solid var(--apple-primary-on-dark);
    outline-offset: -3px;
  }

  body > .shell.visual-apple-fusion > .topbar .module-subnav > a.is-active::after {
    background: var(--apple-primary-on-dark);
  }

  body > .shell.visual-apple-fusion > .topbar .module-subnav > a:active {
    transform: scale(0.97);
  }

  @media (hover: hover) and (pointer: fine) {
    body > .shell.visual-apple-fusion > .topbar .module-subnav > a:not(.is-active):hover {
      color: #d2d2d7;
    }
  }

  body > .shell.visual-apple-fusion > .topbar .account-menu {
    order: 3 !important;
  }

  body > .shell.visual-apple-fusion > .topbar :is(.top-actions-main, .topbar-system) {
    gap: 2px;
  }

  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav > a {
    position: relative;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 8px !important;
    gap: 5px !important;
    border: 0;
    border-radius: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 1.2;
    box-sizing: border-box;
  }

  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav > a::after {
    position: absolute;
    right: 8px;
    bottom: 4px;
    left: 8px;
    height: 2px;
    border-radius: 9999px;
    background: transparent;
    content: "";
  }

  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav > a.is-active::after {
    background: var(--apple-primary-on-dark);
  }

  body > .shell.visual-apple-fusion > .topbar .desktop-module-nav > a .module-nav-icon {
    display: inline-flex !important;
    flex: 0 0 18px;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 17px;
    line-height: 1;
  }

  body > .shell.visual-apple-fusion > .topbar .account-menu > summary {
    height: 44px !important;
    min-height: 44px !important;
    padding: 11px 10px 12px !important;
    font-size: 14px !important;
    font-weight: 650 !important;
    line-height: 1.2 !important;
    box-sizing: border-box;
  }

  body > .shell.visual-apple-fusion > .topbar .account-menu > summary > span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .shell-calendar.visual-apple-fusion {
    padding-bottom: 40px;
  }

  .shell-calendar.visual-apple-fusion > :not(.topbar, .readonly-banner) {
    width: calc(100% - 64px);
  }

  .shell-calendar.visual-apple-fusion .calendar-range-strip {
    margin-top: 20px;
  }
}

@media (max-width: 1040px) {
  .module-subnav {
    display: none !important;
  }

  .visual-apple-fusion {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  .visual-apple-fusion > .topbar {
    height: 50px;
    min-height: 50px;
    padding: 3px 8px 3px 16px;
    background: rgba(0, 0, 0, 0.96);
    backdrop-filter: saturate(180%) blur(20px);
  }

  .visual-apple-fusion > .topbar h1,
  .visual-apple-fusion > .topbar .module-page-title {
    font-size: 24px;
  }

  .visual-apple-fusion > .topbar .module-page-meta {
    color: #a1a1a6;
  }

  .visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--apple-primary);
    border-radius: 9999px;
    background: var(--apple-primary);
    color: #ffffff;
  }

  .visual-apple-fusion > .topbar .top-actions.is-mobile-menu.is-menu-ready .top-actions-more {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid #424245;
    border-radius: 9999px;
    background: #1d1d1f;
    color: #f5f5f7;
  }

  .shell-calendar.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu .top-actions-main :where(.button, button),
  .shell-calendar.visual-apple-fusion > .topbar.is-module-landing .top-actions.is-mobile-menu > .top-actions-more {
    min-height: 44px;
  }

  .visual-apple-fusion + .module-nav {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    min-height: 62px;
    padding: 4px 8px calc(3px + env(safe-area-inset-bottom, 0px));
  }

  body > .shell.visual-apple-fusion + .module-nav > a,
  body > .shell.visual-apple-fusion + .module-nav > a.is-active {
    position: relative;
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 52px;
    padding: 4px 2px 3px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #1d1d1f;
    font-size: 11px;
    font-weight: 400;
    line-height: 1;
    box-shadow: none;
  }

  body > .shell.visual-apple-fusion + .module-nav > a.is-active::after {
    position: absolute;
    right: 34%;
    bottom: 1px;
    left: 34%;
    height: 2px;
    border-radius: 9999px;
    background: #1d1d1f;
    content: "";
  }

  .shell-goals.visual-apple-fusion:not(:has(> .goal-apple-fusion)) > :not(.topbar, .readonly-banner) {
    width: calc(100% - 24px);
  }

  .shell-goals.visual-apple-fusion :where(.history-panel, .panel, .goal-detail-desktop) {
    border-radius: 14px;
  }

  .shell-goals.visual-apple-fusion .goal-detail-page {
    width: 100% !important;
    margin-inline: 0 !important;
  }

  /* Every mobile module uses the same light action popover on top of the black
     navigation plane, so menu rows must not inherit module button skins. */
  body > .shell.visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-menu {
    gap: 0;
    padding: 6px;
    border-color: var(--apple-hairline);
    border-radius: 12px;
    background: rgba(250, 250, 252, 0.98);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  }

  body > .shell.visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-menu :is(.button, button) {
    min-height: 44px;
    border: 0 !important;
    border-bottom: 1px solid var(--apple-hairline) !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--apple-ink) !important;
  }

  body > .shell.visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-menu > :last-child,
  body > .shell.visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-menu > :last-child :is(.button, button) {
    border-bottom-color: transparent !important;
  }

  body > .shell.visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-menu .top-actions-menu-icon {
    color: var(--apple-muted);
  }

  body > .shell.visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-menu :is(.button, button):focus-visible {
    background: rgba(0, 102, 204, 0.08) !important;
    color: var(--apple-primary-focus) !important;
  }

  @media (hover: hover) and (pointer: fine) {
    body > .shell.visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-menu :is(.button, button):hover {
      background: rgba(0, 102, 204, 0.08) !important;
      color: var(--apple-primary-focus) !important;
    }
  }

  /* The detail route is part of the current shared shell: black navigation,
     one continuous reading surface, and a white maintenance sheet. */
  .shell-goals.visual-apple-fusion .goal-reading-topbar {
    min-height: 50px;
    padding: 3px 8px;
    border-bottom: 0;
    background: rgba(0, 0, 0, 0.96);
    color: #ffffff;
    backdrop-filter: saturate(180%) blur(20px);
  }

  .shell-goals.visual-apple-fusion .goal-reading-topbar > strong {
    color: #ffffff;
    font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
    font-size: 16px;
    letter-spacing: 0.06em;
  }

  .shell-goals.visual-apple-fusion .goal-reading-topbar :where(.goal-reading-back, .goal-reading-more) {
    width: 44px;
    height: 44px;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--apple-primary-on-dark) !important;
  }

  .shell-goals.visual-apple-fusion .goal-reading-paper {
    min-height: calc(100svh - 50px);
    padding: 24px 16px 56px;
    border: 0;
    background: var(--apple-canvas);
  }

  .shell-goals.visual-apple-fusion .goal-detail-sheet-panel {
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
    background: var(--apple-surface-pearl);
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.16);
  }

  .shell-goals.visual-apple-fusion .goal-detail-sheet-head {
    background: transparent;
  }

  .shell-goals.visual-apple-fusion .goal-sheet-edit {
    padding: 12px 0 6px;
  }

  .shell-goals.visual-apple-fusion .goal-sheet-edit .goal-compact-form {
    gap: 12px;
  }

  .shell-goals.visual-apple-fusion .goal-sheet-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
  }

  .shell-goals.visual-apple-fusion .goal-sheet-actions form {
    min-width: 0;
  }

  .shell-goals.visual-apple-fusion .goal-sheet-actions:has(> form:nth-child(3)) > form:last-child {
    grid-column: 1 / -1;
  }

  .shell-goals.visual-apple-fusion .goal-sheet-actions .goal-sheet-action,
  .shell-goals.visual-apple-fusion .goal-sheet-actions button.goal-sheet-action {
    justify-content: center;
    min-height: 44px;
    padding-inline: 10px;
    border: 1px solid var(--apple-hairline) !important;
    border-radius: var(--apple-control-radius) !important;
    background: var(--apple-canvas) !important;
    color: var(--apple-ink) !important;
    font-size: 14px;
    text-align: center;
  }

  .shell-goals.visual-apple-fusion .goal-sheet-actions .goal-sheet-action i {
    width: auto;
    color: var(--apple-primary);
  }

  .shell-goals.visual-apple-fusion .goal-sheet-actions .goal-sheet-action.danger,
  .shell-goals.visual-apple-fusion .goal-sheet-actions button.goal-sheet-action.danger,
  .shell-goals.visual-apple-fusion .goal-sheet-actions .goal-sheet-action.danger i {
    border-color: rgba(201, 54, 43, 0.28) !important;
    background: transparent !important;
    color: var(--apple-danger) !important;
  }

  .goals-sort-mode .shell-goals.visual-apple-fusion .goal-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .goals-sort-mode .shell-goals.visual-apple-fusion .goal-drag-handle {
    display: inline-grid;
    align-self: center;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px;
    min-height: 44px !important;
    padding: 0;
    place-items: center;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--apple-muted) !important;
    box-shadow: none;
  }

  .goals-sort-mode .shell-goals.visual-apple-fusion .goal-drag-handle:focus-visible {
    background: rgba(0, 102, 204, 0.08) !important;
    color: var(--apple-primary-focus) !important;
  }

  .shell-calendar.visual-apple-fusion > :not(.topbar, .readonly-banner) {
    width: calc(100% - 24px);
  }

  .shell-calendar.visual-apple-fusion .calendar-range-strip {
    margin-top: 12px;
  }

  .shell-calendar.visual-apple-fusion .calendar-date-controls {
    border-radius: 14px;
  }

  .shell-calendar.visual-apple-fusion :where(.calendar-long-ranges, .week-board, .calendar-day-detail) {
    border-radius: 14px;
  }

  .shell-calendar.visual-apple-fusion .month-weekdays {
    border-radius: 14px 14px 0 0;
  }

  .shell-calendar.visual-apple-fusion .month-grid {
    border-radius: 0 0 14px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .visual-apple-fusion :where(.button, button) {
    transition-duration: 0.01ms !important;
  }

  .visual-apple-fusion :where(.button, button):active {
    transform: none;
  }
}

/* Product controls use restrained rounded rectangles. Semantic chips, tab
   controls, and genuinely circular icon buttons retain their own geometry. */
.visual-apple-fusion :where(button, .button):not(
  .tag-choice,
  .note-load-more,
  [data-reading-sidebar-tab]
) {
  border-radius: var(--apple-control-radius) !important;
}

.shell-notebooks.visual-apple-fusion .notebook-tree-toggle {
  color: var(--apple-muted) !important;
  opacity: 1 !important;
}

/* Hierarchy controls sit outside the heading text, so keep their full hit area
   without turning the collapse chevron into a primary action. */
.shell-notebooks.visual-apple-fusion .notebook-hierarchy-heading {
  align-items: center;
}

.shell-notebooks.visual-apple-fusion .notebook-hierarchy-toggle,
.shell-notebooks.visual-apple-fusion .notebook-hierarchy-toggle:hover,
.shell-notebooks.visual-apple-fusion .notebook-hierarchy-toggle:focus-visible {
  top: 50%;
  border-color: transparent !important;
  background: transparent !important;
  color: var(--notebook-blue, var(--apple-primary)) !important;
  box-shadow: none !important;
  transform: translateY(-50%);
}

.shell-notebooks.visual-apple-fusion .notebook-hierarchy-toggle:active {
  transform: translateY(-50%) scale(0.97);
}

/* The directory reveal is a quiet workspace affordance, not a primary
   action. Preserve its positional transform during press feedback so the
   narrow edge control never appears to jump vertically. */
.shell-notebooks.visual-apple-fusion .notebook-sidebar-hide {
  border-color: var(--notebook-rule) !important;
  background: var(--notebook-surface) !important;
  color: var(--notebook-muted) !important;
  box-shadow: none !important;
  transform: translateY(-50%) !important;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, opacity 160ms ease, visibility 160ms ease;
}

.shell-notebooks.visual-apple-fusion .notebook-sidebar-hide:hover,
.shell-notebooks.visual-apple-fusion .notebook-sidebar-hide:focus-visible {
  border-color: var(--notebook-rule-strong) !important;
  background: var(--notebook-surface) !important;
  color: var(--notebook-ink) !important;
}

.shell-notebooks.visual-apple-fusion .notebook-sidebar-hide:active {
  transform: translateY(-50%) !important;
}

.shell-notebooks.visual-apple-fusion .notebook-sidebar-show {
  border-color: var(--notebook-rule) !important;
  background: var(--notebook-surface) !important;
  color: var(--notebook-muted) !important;
  box-shadow: none !important;
  transform: translateY(-50%) !important;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.shell-notebooks.visual-apple-fusion .notebook-sidebar-show:hover,
.shell-notebooks.visual-apple-fusion .notebook-sidebar-show:focus-visible {
  border-color: var(--notebook-rule-strong) !important;
  background: var(--notebook-surface) !important;
  color: var(--notebook-ink) !important;
}

.shell-notebooks.visual-apple-fusion .notebook-sidebar-show:active {
  transform: translateY(-50%) !important;
}

@media (max-width: 1040px) {
  .shell-notebooks.visual-apple-fusion .notebook-sidebar-show,
  .shell-notebooks.visual-apple-fusion .notebook-sidebar-show:active {
    transform: none !important;
  }

  .shell-notebooks.visual-apple-fusion .notebook-sidebar-hide,
  .shell-notebooks.visual-apple-fusion .notebook-sidebar-hide:active {
    border-color: transparent !important;
    background: transparent !important;
    transform: none !important;
  }
}

.shell-goals.visual-apple-fusion .goal-detail-sheet-head > button,
.visual-apple-fusion :where(
  .goal-create-dialog-close,
  .top-actions-more
),
.visual-apple-fusion > .topbar .top-actions.is-mobile-menu .top-actions-main .top-action-primary {
  border-radius: 9999px !important;
}

/* Login / Quiet dual-field visual direction. */
html:has(body > .login-shell:not(.register-shell)),
body:has(> .login-shell:not(.register-shell)) {
  scrollbar-gutter: auto;
  background: #fbfbfd;
}

.login-shell.visual-apple-fusion {
  --login-action: #0a6edf;
  --login-action-hover: #075fc3;
  display: grid;
  grid-template-columns: 40% minmax(0, 60%);
  min-height: 100dvh;
  padding: 0;
  place-items: stretch;
  overflow: hidden;
  background: #fbfbfd;
  color: #17181a;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

.login-shell.visual-apple-fusion .login-brand-panel {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 64px clamp(40px, 6vw, 86px);
  border-right: 1px solid #e1e4ea;
  background-color: #f7faff;
}

.login-shell.visual-apple-fusion .login-brand-mark {
  display: none;
}

.login-shell.visual-apple-fusion .login-brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.login-shell.visual-apple-fusion .login-brand-mark-halo {
  fill: #eef5fd;
  stroke: #cfe2fa;
  stroke-width: 1;
}

.login-shell.visual-apple-fusion .login-brand-mark-motion {
  transform-box: view-box;
  transform-origin: center;
  animation: login-brand-orbit 12s linear infinite;
}

.login-shell.visual-apple-fusion .login-brand-mark-orbit {
  fill: none;
  stroke: #79afea;
  stroke-width: 1.4;
  stroke-dasharray: 10 7;
}

.login-shell.visual-apple-fusion .login-brand-earth {
  fill: #0a6edf;
  stroke: #075fc3;
  stroke-width: 0.8;
}

.login-shell.visual-apple-fusion .login-brand-earth-land {
  fill: #c4ddfa;
  stroke: none;
}

.login-shell.visual-apple-fusion .login-brand-moon {
  fill: #fbfcfe;
  stroke: #6f8dad;
  stroke-width: 0.9;
}

.login-shell.visual-apple-fusion .login-brand-moon-crater {
  fill: #c7d4e2;
  stroke: none;
}

.login-shell.visual-apple-fusion .login-brand-copy {
  display: grid;
  gap: 10px;
}

.login-shell.visual-apple-fusion .login-identity {
  gap: 10px;
}

.login-shell.visual-apple-fusion .login-brand {
  margin: 0;
  color: #111214;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: clamp(52px, 5vw, 72px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0.08em;
}

.login-shell.visual-apple-fusion .login-tagline {
  margin: 0;
  color: #777c85;
  font-size: clamp(16px, 1.4vw, 20px);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.login-shell.visual-apple-fusion .login-card {
  align-self: center;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: clamp(30px, 5vh, 64px) clamp(50px, 5.15vw, 74px);
  border: 0;
  border-radius: 0;
  background: #fbfbfd;
  box-shadow: none;
}

.login-shell.visual-apple-fusion .login-card h1 {
  margin: 0 0 clamp(30px, 4.5vh, 54px);
  color: #111214;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: clamp(46px, 4vw, 58px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.03em;
}

.login-shell.visual-apple-fusion .login-card .alert {
  margin: -24px 0 28px;
}

.login-shell.visual-apple-fusion .login-card .form {
  gap: clamp(22px, 3.2vh, 40px);
}

.login-shell.visual-apple-fusion .login-card .form > label {
  gap: 12px;
  color: #5f646d;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.login-shell.visual-apple-fusion .login-card input:not([type="checkbox"], [type="radio"]) {
  min-height: 72px;
  padding: 0 20px;
  border: 1px solid #cbd0d8;
  border-radius: 12px;
  background: #ffffff;
  color: #17181a;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  box-shadow: none;
}

.login-shell.visual-apple-fusion .login-card input:not([type="checkbox"], [type="radio"])::placeholder {
  color: #8a909a;
  opacity: 1;
}

.login-shell.visual-apple-fusion .login-card input:not([type="checkbox"], [type="radio"]):focus-visible {
  border-color: var(--login-action);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(10, 110, 223, 0.13);
}

.login-shell.visual-apple-fusion .password-field input {
  padding-right: 64px;
}

.login-shell.visual-apple-fusion .password-field > button {
  right: 12px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 0 !important;
  border-radius: 10px;
  background: transparent !important;
  color: #777d87;
  font-size: 22px;
  box-shadow: none;
}

.login-shell.visual-apple-fusion .password-field > button:hover,
.login-shell.visual-apple-fusion .password-field > button:focus-visible {
  background: #eef4fc !important;
  color: var(--login-action) !important;
}

.login-shell.visual-apple-fusion .login-consent {
  gap: 12px;
  align-items: center;
  margin: -2px 0 2px;
  color: #696f78;
  font-size: 14px;
  line-height: 1.5;
}

.login-shell.visual-apple-fusion .login-consent > input {
  width: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: var(--login-action);
}

.login-shell.visual-apple-fusion .login-consent a {
  color: var(--login-action);
  font-weight: 600;
}

.login-shell.visual-apple-fusion .login-card .form > button[type="submit"] {
  min-height: 72px !important;
  margin-top: 14px;
  border: 0;
  border-color: var(--login-action) !important;
  border-radius: 11px !important;
  background: var(--login-action) !important;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: none;
}

.login-shell.visual-apple-fusion .login-card .form > button[type="submit"]:hover,
.login-shell.visual-apple-fusion .login-card .form > button[type="submit"]:focus-visible {
  border-color: var(--login-action-hover) !important;
  background: var(--login-action-hover) !important;
}

.login-shell.visual-apple-fusion .login-alternate-action {
  margin: 24px 0 0;
  color: #777d87;
  font-size: 14px;
  text-align: center;
}

.login-shell.visual-apple-fusion .login-alternate-action a {
  color: var(--login-action);
  font-weight: 600;
}

.register-shell.visual-apple-fusion {
  min-height: 100dvh;
  overflow-y: auto;
}

.register-shell.visual-apple-fusion .register-card {
  padding-top: clamp(28px, 4vh, 44px);
  padding-bottom: clamp(28px, 4vh, 44px);
}

.register-shell.visual-apple-fusion .register-heading {
  margin-bottom: 26px;
}

.register-shell.visual-apple-fusion .register-heading .eyebrow {
  margin: 0 0 8px;
  color: var(--login-action);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
}

.register-shell.visual-apple-fusion .register-heading h1 {
  margin: 0 0 10px;
  font-size: clamp(38px, 3.2vw, 48px);
}

.register-shell.visual-apple-fusion .register-heading > p:last-child {
  margin: 0;
  color: #717781;
  font-size: 14px;
  line-height: 1.65;
}

.register-shell.visual-apple-fusion .register-card .alert {
  margin: 0 0 20px;
}

.register-shell.visual-apple-fusion .register-card .register-form {
  gap: 18px;
}

.register-shell.visual-apple-fusion .register-card .register-form > label {
  gap: 7px;
  font-size: 14px;
}

.register-shell.visual-apple-fusion .register-card .register-form input:not([type="checkbox"], [type="radio"]),
.register-shell.visual-apple-fusion .register-card .register-form > button[type="submit"] {
  min-height: 56px !important;
}

.register-shell.visual-apple-fusion .register-card .register-form > button[type="submit"] {
  margin-top: 2px;
}

.register-shell.visual-apple-fusion .registration-invite-field {
  position: relative;
}

.register-shell.visual-apple-fusion .registration-invite-field.is-from-link > span:first-child,
.register-shell.visual-apple-fusion .registration-invite-field.is-from-link > input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.register-shell.visual-apple-fusion .registration-invite-status {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid #b7dfc7;
  border-radius: 11px;
  background: #f1fbf5;
  color: #177747;
  font-size: 14px;
  font-weight: 600;
}

.register-shell.visual-apple-fusion .registration-invite-status i {
  margin-right: 8px;
  font-size: 19px;
}

.privacy-preview-dialog {
  width: min(920px, calc(100% - 40px));
  height: min(820px, calc(100dvh - 64px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dfe3e9;
  border-radius: 20px;
  background: #ffffff;
  color: #17181a;
  box-shadow: 0 28px 80px rgba(24, 33, 48, 0.24);
}

.privacy-preview-dialog::backdrop {
  background: rgba(17, 24, 39, 0.36);
  backdrop-filter: blur(6px);
}

.privacy-preview-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  background: #ffffff;
}

.privacy-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 22px;
  border-bottom: 1px solid #e8eaee;
  background: rgba(255, 255, 255, 0.96);
}

.privacy-preview-head .eyebrow {
  margin: 0 0 3px;
  color: #6f7580;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.privacy-preview-head h2 {
  margin: 0;
  color: #17181a;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.25;
}

.privacy-preview-head .icon-only {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #dfe3e9;
  border-radius: 12px;
  place-items: center;
  background: #f7f8fa;
  color: #4f5661;
  font-size: 21px;
  box-shadow: none;
}

.privacy-preview-head .icon-only:hover,
.privacy-preview-head .icon-only:focus-visible {
  border-color: #b9d4f5;
  background: #eef5fd;
  color: #0a6edf;
}

.privacy-preview-body {
  position: relative;
  min-height: 0;
  background: #ffffff;
}

.privacy-preview-content {
  width: 100%;
  height: 100%;
  padding: 24px 28px 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transition: opacity 160ms ease;
}

.privacy-preview-content.is-loaded {
  opacity: 1;
}

.privacy-preview-content:focus-visible {
  outline: 3px solid rgba(10, 110, 223, 0.24);
  outline-offset: -3px;
}

.privacy-preview-content.privacy-policy {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 26px clamp(28px, 5vw, 52px) 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.privacy-preview-loading {
  position: absolute;
  inset: 0;
  display: grid;
  margin: 0;
  place-items: center;
  color: #737984;
  font-size: 14px;
}

.privacy-preview-loading[hidden] {
  display: none;
}

.privacy-preview-error {
  position: absolute;
  top: 50%;
  right: 24px;
  left: 24px;
  margin: 0;
  transform: translateY(-50%);
  text-align: center;
}

.privacy-preview-error a {
  margin-left: 4px;
}

.privacy-shell.is-embedded.visual-apple-fusion {
  min-height: 0;
  padding: 24px 28px 40px;
  background: #ffffff;
}

.privacy-shell.is-embedded.visual-apple-fusion .privacy-policy {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.registration-invitation-page {
  display: grid;
  gap: 20px;
  width: min(920px, 100%);
  margin: 0 auto;
}

.registration-invite-result,
.registration-invite-create-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.registration-invite-result {
  padding: 24px;
  border: 1px solid #b9d7ff;
  border-radius: 18px;
  background: linear-gradient(135deg, #f3f8ff, #fff);
}

.registration-invite-result-icon {
  display: grid;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  place-items: center;
  background: #0a6edf;
  color: #fff;
  font-size: 22px;
}

.registration-invite-result h2,
.registration-invite-create-panel h2,
.registration-invite-history h2 {
  margin: 3px 0 8px;
}

.registration-invite-result p,
.registration-invite-create-panel p {
  margin-top: 0;
  color: var(--muted);
}

.registration-invite-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 16px;
}

.registration-invite-copy-row input {
  min-width: 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.registration-invite-copy-row button.is-copied {
  background: #177747;
}

.registration-invite-create-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 28px;
}

.registration-invite-create-panel form {
  margin: 0;
}

.registration-invite-history {
  padding: 0;
  overflow: hidden;
}

.registration-invite-history > header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--border);
}

.registration-invite-history > header > span {
  color: var(--muted);
  font-size: 12px;
}

.registration-invitation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
}

.registration-invitation-row:last-child {
  border-bottom: 0;
}

.registration-invitation-main {
  min-width: 0;
}

.registration-invitation-main > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.registration-invitation-main p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.registration-invitation-status {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3f9;
  color: #65707e;
  font-size: 11px;
  font-weight: 700;
}

.registration-invitation-status.is-active {
  background: #e8f7ee;
  color: #177747;
}

.registration-invitation-status.is-consumed {
  background: #eaf3ff;
  color: #0a5dbb;
}

.registration-invite-history .empty {
  margin: 0;
  padding: 34px 28px;
}

@media (min-width: 1041px) {
  .login-shell.visual-apple-fusion .login-identity {
    display: grid;
    grid-template-columns: clamp(88px, 7.5vw, 108px) minmax(0, 1fr);
    align-items: center;
    gap: clamp(20px, 2vw, 28px);
    transform: translateY(-40px);
  }

  .login-shell.visual-apple-fusion .login-brand-mark {
    display: grid;
    width: clamp(88px, 7.5vw, 108px);
    height: clamp(88px, 7.5vw, 108px);
    place-items: center;
  }

  .login-shell.visual-apple-fusion .login-brand-panel {
    background-image: url("/public/assets/login-brand-atmosphere-v1.svg");
    background-position: center;
    background-size: cover;
  }
}

@media (max-width: 1040px) {
  .login-shell.visual-apple-fusion {
    align-content: safe center;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: max-content max-content;
    min-height: 100dvh;
    padding: 0 24px calc(24px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
  }

  .login-shell.visual-apple-fusion .login-brand-panel {
    width: min(100%, 520px);
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top, 0px)) 0 8px;
    border: 0;
    background: #fbfbfd;
  }

  .login-shell.visual-apple-fusion .login-identity {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .login-shell.visual-apple-fusion .login-brand-mark {
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
  }

  .login-shell.visual-apple-fusion .login-brand-mark svg {
    width: 48px;
    height: 48px;
  }

  .login-shell.visual-apple-fusion .login-brand-copy {
    gap: 1px;
  }

  .login-shell.visual-apple-fusion .login-brand {
    font-size: 25px;
    line-height: 1.2;
    letter-spacing: 0.08em;
  }

  .login-shell.visual-apple-fusion .login-tagline {
    font-size: 12px;
    letter-spacing: 0.05em;
  }

  .login-shell.visual-apple-fusion .login-card {
    align-self: start;
    width: min(100%, 520px);
    margin: 0 auto;
    padding: 16px 0 40px;
  }

  .login-shell.visual-apple-fusion .login-card h1 {
    margin: 0 0 30px;
    font-size: 40px;
  }

  .login-shell.visual-apple-fusion .login-card .alert {
    margin: -12px 0 22px;
  }

  .login-shell.visual-apple-fusion .login-card .form {
    gap: 22px;
  }

  .login-shell.visual-apple-fusion .login-card .form > label {
    gap: 8px;
    font-size: 15px;
  }

  .login-shell.visual-apple-fusion .login-card input:not([type="checkbox"], [type="radio"]),
  .login-shell.visual-apple-fusion .login-card .form > button[type="submit"] {
    min-height: 58px !important;
  }

  .login-shell.visual-apple-fusion .login-card input:not([type="checkbox"], [type="radio"]) {
    padding-inline: 16px;
    border-radius: 10px;
  }

  .login-shell.visual-apple-fusion .password-field input {
    padding-right: 60px;
  }

  .login-shell.visual-apple-fusion .login-card .form > button[type="submit"] {
    border-radius: 10px !important;
    margin-top: 4px;
    font-size: 17px;
  }

  .register-shell.visual-apple-fusion .login-brand-panel {
    padding-top: 24px;
  }

  .register-shell.visual-apple-fusion .register-card {
    padding-top: 12px;
  }

  .register-shell.visual-apple-fusion .register-heading {
    margin-bottom: 20px;
  }

  .register-shell.visual-apple-fusion .register-heading h1 {
    margin-bottom: 8px;
    font-size: 36px;
  }

  .register-shell.visual-apple-fusion .register-card .register-form {
    gap: 16px;
  }

  .privacy-preview-dialog {
    width: 100%;
    height: var(--app-mobile-dialog-height, calc(100dvh - 24px));
    max-height: var(--app-mobile-dialog-height, calc(100dvh - 24px));
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .privacy-preview-head {
    padding: 15px 16px;
  }

  .privacy-preview-head h2 {
    font-size: 23px;
  }

  .privacy-shell.is-embedded.visual-apple-fusion,
  .privacy-preview-content.privacy-policy {
    padding: 20px 16px 32px;
  }

  .registration-invite-result,
  .registration-invite-create-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .registration-invite-result-icon {
    display: none;
  }

  .registration-invite-create-panel form,
  .registration-invite-create-panel button {
    width: 100%;
  }

  .registration-invite-copy-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .registration-invite-copy-row button {
    width: 100%;
  }

  .registration-invitation-row {
    align-items: flex-start;
    padding: 18px 20px;
  }

  .registration-invite-history > header {
    padding: 22px 20px 16px;
  }
}

@keyframes login-brand-orbit {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell.visual-apple-fusion .login-brand-mark-motion {
    animation: none;
  }

  .privacy-preview-content {
    transition: none;
  }
}
