html[data-mybook-theme="ocean"] {
  --magenta: #197d8c;
  --deep: #173b43;
  --ink: #203b40;
  --muted: #648187;
  --pale: #f1f9f8;
  --line: #cfe3e1;
  --rose: #d8eeee;
  --theme-surface: #fbfefd;
  --theme-surface-soft: #e8f4f2;
  --theme-wash: #d8eeee;
  --theme-visual-start: #d9f2ee;
  --theme-visual-mid: #a9ded9;
  --theme-visual-end: #73b9b8;
  --theme-petal-primary: #36aebc;
  --theme-petal-secondary: #90d4ce;
  --theme-petal-shadow: rgba(25, 125, 140, .26);
  --theme-focus: #197d8c;
  --theme-danger: #bd5048;
}

html[data-mybook-theme="forest"] {
  --magenta: #477b52;
  --deep: #253d2b;
  --ink: #304336;
  --muted: #718272;
  --pale: #f4f8f1;
  --line: #d9e3d2;
  --rose: #e3eddc;
  --theme-surface: #fcfef9;
  --theme-surface-soft: #ebf2e6;
  --theme-wash: #e3eddc;
  --theme-visual-start: #e5f0da;
  --theme-visual-mid: #c4d9aa;
  --theme-visual-end: #8cae77;
  --theme-petal-primary: #62945e;
  --theme-petal-secondary: #a5c987;
  --theme-petal-shadow: rgba(71, 123, 82, .25);
  --theme-focus: #477b52;
  --theme-danger: #ac543d;
}

html[data-mybook-theme="sunset"] {
  --magenta: #c45b45;
  --deep: #462b27;
  --ink: #49352f;
  --muted: #90756b;
  --pale: #fff7f0;
  --line: #efddd0;
  --rose: #f8e2d2;
  --theme-surface: #fffdfa;
  --theme-surface-soft: #fff0e3;
  --theme-wash: #f8e2d2;
  --theme-visual-start: #ffe5d2;
  --theme-visual-mid: #ffc59f;
  --theme-visual-end: #e88869;
  --theme-petal-primary: #f27b56;
  --theme-petal-secondary: #ffc06f;
  --theme-petal-shadow: rgba(196, 91, 69, .28);
  --theme-focus: #c45b45;
  --theme-danger: #a83e32;
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) body {
  background: var(--pale);
  color: var(--ink);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .site-shell,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .workspace,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .app-view {
  background: var(--pale);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .visual-panel {
  background: linear-gradient(155deg, var(--theme-visual-start), var(--theme-visual-mid) 55%, var(--theme-visual-end));
}

html[data-mybook-theme="ocean"] .hero-image { filter: hue-rotate(190deg) saturate(.72); }
html[data-mybook-theme="forest"] .hero-image { filter: hue-rotate(145deg) saturate(.72); }
html[data-mybook-theme="sunset"] .hero-image { filter: hue-rotate(38deg) saturate(.82); }
html[data-mybook-theme="ocean"] .brand-wordmark { filter: hue-rotate(190deg) saturate(.72); }
html[data-mybook-theme="forest"] .brand-wordmark { filter: hue-rotate(145deg) saturate(.72); }
html[data-mybook-theme="sunset"] .brand-wordmark { filter: hue-rotate(38deg) saturate(.82); }

html[data-mybook-theme]:not([data-mybook-theme="default"]) .petal {
  background: var(--theme-petal-primary);
  box-shadow: 0 0 9px var(--theme-petal-shadow);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .petal:nth-child(even) {
  background: var(--theme-petal-secondary);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .eyebrow,
html[data-mybook-theme]:not([data-mybook-theme="default"]) a,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .logout-button span,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .stats-row strong,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .live-clock,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-chevron,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .quote-mark,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .mood-icon {
  color: var(--magenta);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .visual-content .eyebrow,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .visual-content h1,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .visual-content p {
  color: #fff;
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .visual-content h1 em {
  color: var(--theme-wash);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .login-card,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-modal,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .notification-group,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .about-card,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .checkin-widget,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .note,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .appearance-theme-option,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-popover {
  border-color: var(--line);
  background-color: var(--theme-surface);
  color: var(--ink);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-modal {
  background-image: linear-gradient(145deg, var(--theme-surface), var(--pale));
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .modal-header,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-tabs {
  border-color: var(--line);
  background-color: var(--theme-surface-soft);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .modal-header {
  background: linear-gradient(135deg, var(--theme-surface-soft), var(--theme-surface));
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .modal-header,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-panel h3,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .checkin-widget h3,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .calendar-selected-events h3,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .note h3,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .about-card h3,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .welcome strong {
  color: var(--deep);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .login-view,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .register-view,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .reset-view,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .two-factor-login {
  background: var(--pale);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) input:not([type="checkbox"]):not([type="radio"]),
html[data-mybook-theme]:not([data-mybook-theme="default"]) textarea,
html[data-mybook-theme]:not([data-mybook-theme="default"]) select,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .note-filter-bar input,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .note-filter-bar select {
  border-color: var(--line);
  background-color: var(--theme-surface);
  color: var(--ink);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) input:focus,
html[data-mybook-theme]:not([data-mybook-theme="default"]) textarea:focus,
html[data-mybook-theme]:not([data-mybook-theme="default"]) select:focus,
html[data-mybook-theme]:not([data-mybook-theme="default"]) :focus-visible {
  border-color: var(--magenta);
  outline-color: var(--theme-focus);
  box-shadow: 0 0 0 3px var(--theme-wash);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .primary-button,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .language-switch,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .modal-close {
  border-color: var(--magenta);
  background-color: var(--magenta);
  color: #fff;
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .outline-button {
  border-color: var(--magenta);
  color: var(--magenta);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .outline-button:hover,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .language-switch:hover,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .modal-close:hover {
  background: var(--magenta);
  color: #fff;
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .danger-button {
  border-color: var(--theme-danger);
  background: color-mix(in srgb, var(--theme-danger) 10%, var(--theme-surface));
  color: var(--theme-danger);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .nav-item:hover,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .nav-item.active,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-trigger:hover,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-tab.active,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-tab:hover,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-popover button:hover {
  background: var(--rose);
  color: var(--magenta);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-popover button,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .nav-item,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-tab,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .welcome,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .lead,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .content-page p,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .checkin-widget > p,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-panel > p {
  color: var(--muted);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .quote-card,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .live-clock,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .empty-state,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-trigger .mini-avatar,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .large-avatar,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-tab:before,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .file-picker,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .calendar-event {
  background: var(--theme-wash);
  color: var(--magenta);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .stats-row,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .note,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .nav-bottom,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .calendar-selected-events,
html[data-mybook-theme]:not([data-mybook-theme="default"]) .timeline-entry {
  border-color: var(--line);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .calendar-day {
  border-color: var(--line);
  background: var(--theme-surface);
  color: var(--ink);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .calendar-day[aria-pressed="true"] {
  border-color: var(--magenta);
  background: var(--theme-wash);
  color: var(--magenta);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-tab:before {
  background: var(--theme-petal-secondary);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-tab.active:before {
  background: var(--magenta);
  box-shadow: 0 0 0 4px var(--theme-wash);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .quote-mark {
  color: var(--magenta);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .visual-mark span.active {
  background-color: var(--magenta);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .profile-modal:before {
  background: linear-gradient(90deg, var(--deep), var(--magenta), var(--theme-petal-secondary));
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .settings-tab.active:before {
  background: var(--rose);
  color: var(--magenta);
}

.appearance-theme-form {
  margin-top: 1rem;
}

.appearance-theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
  margin-bottom: .9rem;
}

.appearance-theme-option {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .7rem;
  background: #fff;
  cursor: pointer;
}

.appearance-theme-option:has(input:checked) {
  border-color: var(--magenta);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--magenta) 16%, transparent);
}

.appearance-theme-option input {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  accent-color: var(--magenta);
}

.appearance-theme-swatch {
  flex: 0 0 auto;
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 50%;
}

.appearance-theme-copy {
  min-width: 0;
  font-size: .8rem;
  overflow-wrap: anywhere;
}

.swatch-default { background: linear-gradient(135deg, #b72f7c 0 50%, #f6d4e3 50%); }
.swatch-ocean { background: linear-gradient(135deg, #197d8c 0 50%, #d8eeee 50%); }
.swatch-forest { background: linear-gradient(135deg, #477b52 0 50%, #e3eddc 50%); }
.swatch-sunset { background: linear-gradient(135deg, #c45b45 0 50%, #f8e2d2 50%); }

.note-workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin: .25rem 0 .75rem;
}

.note-count {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
}

.note-create-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.55rem;
  border: 1px solid var(--magenta);
  border-radius: 7px;
  padding: .4rem .8rem;
  background: var(--magenta);
  color: #fff;
  font: 700 .76rem "DM Sans", sans-serif;
  cursor: pointer;
  transition: filter .18s ease, transform .18s ease;
}

.note-create-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.note-create-button:focus-visible {
  outline: 2px solid var(--magenta);
  outline-offset: 3px;
}

.note-create-plus {
  font-size: 1.2rem;
  line-height: 1;
}

.note-form:not(.hidden) {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 1rem;
  background: var(--theme-surface-soft, var(--pale));
}

.note-filter-bar {
  display: flex;
  gap: .55rem;
  margin: 0 0 .8rem;
}

.note-filter-bar input,
.note-filter-bar select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .6rem .75rem;
  background: var(--theme-surface, #fff);
  color: var(--ink);
  font: inherit;
  font-size: .77rem;
}

.note-filter-bar input { flex: 1; }
.note-filter-bar select { max-width: 42%; }
.note-tag-status { margin: -.35rem 0 .65rem; color: var(--muted); font-size: .72rem; }

.note-tag-dialog .attention-dialog-content label {
  color: var(--deep);
  font-size: .76rem;
  font-weight: 700;
}

.note-tag-dialog .attention-dialog-content input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .7rem .8rem;
  background: var(--theme-surface, #fff);
  color: var(--ink);
  font: inherit;
}

.note-tag-dialog .attention-dialog-content input:focus {
  border-color: var(--magenta);
  outline: 2px solid var(--theme-wash, var(--rose));
  outline-offset: 1px;
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .45rem;
}

.note-tags span {
  border-radius: 999px;
  padding: .18rem .5rem;
  background: var(--rose);
  color: var(--magenta);
  font-size: .68rem;
}

.checkin-widget {
  margin: 0 0 1.5rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.checkin-widget h3,
.calendar-selected-events h3 {
  margin: 0 0 .35rem;
  color: var(--ink);
  font: 700 1.15rem "Playfair Display", serif;
}

.checkin-widget > p,
.calendar-selected-events > p {
  margin: 0 0 .8rem;
  color: var(--muted);
  font-size: .78rem;
}

.checkin-widget fieldset {
  min-width: 0;
  border: 0;
  margin: .8rem 0;
}

.checkin-widget legend {
  margin-bottom: .45rem;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 700;
}

.checkin-moods,
.checkin-habits {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.checkin-moods legend,
.checkin-habits legend { width: 100%; }

.checkin-moods label,
.checkin-habits label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .4rem .55rem;
  color: var(--muted);
  font-size: .72rem;
  cursor: pointer;
}

.checkin-moods input,
.checkin-habits input { accent-color: var(--magenta); }
.mood-icon { color: var(--magenta); font-size: 1rem; }
.danger-button { justify-self: start; border: 1px solid #bd4d4d; border-radius: 6px; padding: .6rem .8rem; background: #fff4f2; color: #a33535; font: 700 .75rem "DM Sans"; cursor: pointer; }

.timeline-entry {
  position: relative;
  margin: 0 0 .8rem .45rem;
  border-left: 2px solid var(--line);
  padding: .15rem 0 .8rem 1rem;
}

.timeline-entry::before {
  position: absolute;
  top: .3rem;
  left: -.36rem;
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  background: var(--magenta);
  content: "";
}

.timeline-entry time { color: var(--muted); font-size: .7rem; }
.timeline-entry h3 { margin: .15rem 0; color: var(--ink); font-size: .95rem; }
.timeline-entry p { color: var(--muted); font-size: .78rem; white-space: pre-wrap; }
.timeline-privacy-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; color: var(--muted); font-size: .72rem; }
.timeline-privacy-controls select { border: 1px solid var(--line); border-radius: 7px; padding: .4rem .5rem; background: #fff; color: var(--ink); font: inherit; }

.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; }
.calendar-toolbar .outline-button { min-width: 2.4rem; padding: .35rem; font-size: 1.1rem; }
.calendar-toolbar strong { color: var(--ink); font-size: 1rem; text-align: center; }
.calendar-weekdays,.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.calendar-weekdays { margin-bottom: .3rem; color: var(--muted); font-size: .65rem; text-align: center; }
.calendar-day { position: relative; aspect-ratio: 1; min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: 600 .75rem "DM Sans"; cursor: pointer; }
.calendar-day[aria-pressed="true"] { border-color: var(--magenta); background: var(--rose); color: var(--magenta); }
.calendar-day.has-events::after { position: absolute; right: .22rem; bottom: .2rem; width: .3rem; height: .3rem; border-radius: 50%; background: var(--magenta); content: ""; }
.calendar-day-empty { border-color: transparent; background: transparent; }
.calendar-selected-events { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.calendar-event { margin: .35rem 0; border-radius: 6px; padding: .5rem .65rem; background: var(--rose); color: var(--ink); font-size: .75rem; }
.calendar-event-form { display: grid; gap: .55rem; margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.calendar-event-form h3 { margin: 0; color: var(--ink); font-size: .95rem; }
.calendar-event-form input,.calendar-event-form textarea,.calendar-event-form select,#noteVisibility,#momentVisibility,#checkinVisibility { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .62rem .72rem; background: #fff; color: var(--ink); font: inherit; }
.calendar-event-form .primary-button { justify-self: start; }
.calendar-event-holiday { border: 1px solid #efd1df; background: #fff8fb; }
.calendar-event .edit-note,.calendar-event .delete-note { float: right; margin-left: .35rem; border: 0; background: transparent; color: var(--magenta); cursor: pointer; font: 700 1rem "DM Sans"; }
.shared-timeline-entry img { display: block; max-width: min(100%, 32rem); max-height: 28rem; margin-top: .65rem; border-radius: 10px; object-fit: contain; }
.uploaded-moment { display: grid; overflow: hidden; background: #fff; }
.uploaded-moment img { display: block; width: 100%; height: 100%; min-height: 9rem; object-fit: cover; }
.uploaded-moment figcaption { padding: .45rem .55rem; color: var(--muted); font-size: .72rem; }
.uploaded-moment figcaption { display: grid; gap: .4rem; }
.uploaded-moment figcaption input,.uploaded-moment figcaption select { min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: .45rem; background: #fff; color: var(--ink); font: inherit; }
.uploaded-moment figcaption .outline-button { justify-self: start; padding: .4rem .6rem; }
.friend-search-result { margin-top: .6rem; }
.calendar-event-form label { color: var(--muted); font-size: .75rem; }
.profile-name-notice { border: 1px solid #edc9dc; border-radius: 9px; padding: .65rem .8rem; background: #fff5fa; color: #77355e; font-size: .78rem; line-height: 1.5; }
.identity-two-factor { letter-spacing: .2em; }
.settings-panel#settings-privacy .danger-button { margin-top: .8rem; }

.note-list {
  display: grid;
  gap: .55rem;
  margin-top: .55rem;
}

.note {
  display: grid;
  gap: .45rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--magenta);
  border-radius: 8px;
  padding: .8rem .9rem;
  background: var(--theme-surface, #fff);
}

.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
}

.note-header time {
  color: var(--muted);
  font-size: .68rem;
}

.note h3 {
  margin: 0;
  color: var(--deep);
  font: 700 1.05rem "Playfair Display", serif;
  overflow-wrap: anywhere;
}

.note > p {
  margin: 0;
  color: var(--ink);
  font-size: .8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-actions {
  display: flex;
  gap: .3rem;
}

.note-actions button {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--theme-surface, #fff);
  color: var(--magenta);
  cursor: pointer;
}

.note-actions button:hover {
  border-color: var(--magenta);
  background: var(--theme-wash, var(--rose));
}

.login-device.is-current {
  border-color: var(--magenta);
  border-left: 4px solid var(--magenta);
  background: var(--theme-wash, var(--rose));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--magenta) 12%, transparent);
}

.login-device-current {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .2rem .55rem;
  background: var(--magenta);
  color: #fff;
  font-size: .64rem;
  font-weight: 700;
  white-space: nowrap;
}

.device-history-clear {
  margin: .25rem 0 .1rem;
}

.device-history-clear:disabled {
  cursor: wait;
  opacity: .65;
}

.attention-dialog {
  width: min(440px, calc(100vw - 2rem));
  max-width: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--theme-surface, #fff);
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(34, 20, 29, .3);
}

.attention-dialog::backdrop {
  background: rgba(35, 21, 31, .56);
  backdrop-filter: blur(4px);
}

.attention-dialog-content {
  display: grid;
  justify-items: start;
  gap: .7rem;
  padding: 1.4rem;
}

.device-report-dialog {
  width: min(520px, calc(100vw - 2rem));
}

.device-report-dialog label {
  color: var(--ink);
  font-size: .78rem;
  font-weight: 700;
}

.device-report-dialog textarea {
  width: 100%;
  min-height: 7rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--theme-surface, #fff);
  padding: .75rem .85rem;
  color: var(--ink);
  font: 400 .82rem/1.5 "DM Sans", sans-serif;
}

.device-report-dialog textarea:focus {
  outline: 0;
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(183,47,124,.12);
}

.device-report-counter {
  justify-self: end;
  color: var(--muted);
  font-size: .68rem;
}

.device-report-context {
  border-left: 3px solid var(--magenta);
  padding-left: .7rem;
  color: var(--deep) !important;
  font-weight: 700;
}

.login-device-report-note {
  display: grid !important;
  justify-content: stretch !important;
  gap: .25rem !important;
}

.login-device-report-note strong {
  text-align: left !important;
  white-space: pre-wrap;
}

.attention-dialog-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid var(--magenta);
  border-radius: 50%;
  background: var(--theme-wash, var(--rose));
  color: var(--magenta);
  font: 800 1.2rem "DM Sans", sans-serif;
}

.attention-dialog h2 {
  margin: .15rem 0 0;
  color: var(--deep);
  font: 700 1.35rem "Playfair Display", serif;
}

.attention-dialog-content > p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.6;
}

.attention-dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .55rem;
  width: 100%;
  margin-top: .35rem;
}

.attention-dialog-actions button {
  min-height: 2.5rem;
  padding: .55rem .8rem;
}

.attention-dialog-actions button:disabled {
  cursor: wait;
  opacity: .65;
}

#logoutHistoryConfirmMessage:not(:empty) {
  color: var(--theme-danger, #a83e32);
}

.two-factor-qr-panel {
  display: grid;
  justify-items: center;
  gap: .45rem;
  margin: .75rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .8rem;
  background: var(--theme-wash, var(--rose));
}

.two-factor-qr-image {
  display: block;
  width: min(100%, 220px);
  aspect-ratio: 1;
  padding: .55rem;
  border-radius: 6px;
  background: #fff;
  image-rendering: pixelated;
}

.two-factor-qr-message {
  margin: 0;
  color: var(--muted);
  font-size: .7rem;
  text-align: center;
}

.two-factor-manual-label {
  margin: .7rem 0 .25rem;
  color: var(--deep);
  font-size: .76rem;
  font-weight: 700;
}

.two-factor-copy-secret {
  justify-self: start;
  margin: .45rem 0 .2rem;
}

#calendarView .calendar-weekdays,
#calendarView .calendar-grid {
  width: min(100%, 420px);
}

#calendarView .calendar-day {
  width: min(100%, 3rem);
  justify-self: center;
}

.checkin-launcher {
  margin: 0 0 1.2rem;
}

.checkin-open-button {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: .8rem;
  row-gap: .15rem;
  width: min(100%, 530px);
  min-height: 4.6rem;
  border: 1px solid color-mix(in srgb, var(--magenta) 20%, var(--line));
  border-radius: 12px;
  padding: .7rem .9rem;
  background: linear-gradient(110deg, var(--theme-wash, #fff1f7), var(--theme-surface, #fff) 78%);
  color: var(--ink);
  text-align: left;
  font: 600 .84rem "DM Sans", sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(64, 29, 49, .07);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.checkin-open-button:hover {
  border-color: var(--magenta);
  box-shadow: 0 12px 26px rgba(64, 29, 49, .12);
  transform: translateY(-2px);
}

.checkin-open-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--magenta) 35%, transparent);
  outline-offset: 3px;
}

.checkin-open-button::after {
  grid-column: 3;
  grid-row: 1 / span 2;
  content: "›";
  color: var(--magenta);
  font: 400 1.7rem/1 "DM Sans", sans-serif;
  transition: transform .18s ease;
}

.checkin-open-button:hover::after {
  transform: translateX(3px);
}

.checkin-plus {
  display: grid;
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 9px;
  background: var(--magenta);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--magenta) 25%, transparent);
  transition: transform .18s ease;
}

.checkin-open-button:hover .checkin-plus {
  transform: rotate(90deg);
}

.checkin-open-label {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  color: var(--deep);
  font-weight: 700;
}

.checkin-summary {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: .73rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
}

.checkin-status { margin: .3rem 0 0; }

.checkin-dialog {
  width: min(680px, calc(100vw - 2rem));
  max-width: none;
  max-height: min(820px, calc(100dvh - 2rem));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--theme-surface, #fff);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(31, 21, 28, .24);
}

.checkin-dialog::backdrop {
  background: rgba(35, 25, 31, .48);
  backdrop-filter: blur(3px);
}

.checkin-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 1.4rem .9rem;
  background: var(--theme-surface-soft, var(--pale));
}

.checkin-dialog-header h2 {
  margin: 0;
  color: var(--deep);
  font: 700 1.5rem "Playfair Display", serif;
}

.checkin-dialog-header p {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .78rem;
}

.checkin-dialog-close {
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--theme-surface, #fff);
  color: var(--magenta);
  font: 1.35rem/1 "DM Sans", sans-serif;
  cursor: pointer;
}

#checkinForm {
  display: grid;
  gap: .85rem;
  overflow-y: auto;
  max-height: calc(100dvh - 7.5rem);
  padding: 1rem 1.4rem 1.25rem;
}

#checkinForm > fieldset {
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}

.checkin-writing-fields {
  display: grid;
  gap: .4rem;
}

.checkin-writing-fields label {
  color: var(--deep);
  font-size: .78rem;
  font-weight: 700;
}

.checkin-writing-fields textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .7rem .8rem;
  background: var(--theme-surface, #fff);
  color: var(--ink);
  font: 400 .78rem/1.65 "DM Sans", sans-serif;
}

.checkin-writing-fields textarea:focus {
  border-color: var(--magenta);
  outline: 3px solid color-mix(in srgb, var(--magenta) 15%, transparent);
}

.checkin-writing-fields textarea::placeholder { color: var(--muted); }
.checkin-character-count { justify-self: end; color: var(--muted); font-size: .65rem; }
.timeline-checkin-text { white-space: pre-wrap; }
.timeline-checkin-story {
  padding: .75rem .9rem;
  border-left: 3px solid var(--magenta);
  border-radius: 0 7px 7px 0;
  background: var(--theme-surface-soft, var(--pale));
  white-space: pre-wrap;
}

#checkinForm legend {
  margin-bottom: .45rem;
  color: var(--deep);
  font-size: .78rem;
  font-weight: 700;
}

.checkin-moods {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.checkin-moods legend { width: 100%; }

.checkin-moods label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .35rem .5rem;
  background: var(--theme-surface, #fff);
  color: var(--ink);
  font-size: .72rem;
  cursor: pointer;
}

.checkin-moods input,
.checkin-activity-group input { accent-color: var(--magenta); }

.checkin-activity-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, .55fr);
  gap: .55rem;
  margin-bottom: .6rem;
}

.checkin-activity-tools input,
.checkin-activity-tools select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .6rem .7rem;
  background: var(--theme-surface, #fff);
  color: var(--ink);
  font: inherit;
  font-size: .75rem;
}

.checkin-activity-list {
  display: grid;
  gap: .5rem;
  max-height: 270px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem;
  background: var(--pale);
  overscroll-behavior: contain;
}

.checkin-activity-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .35rem;
  min-width: 0;
  border: 0;
  margin: 0;
  padding: .25rem;
}

.checkin-activity-group legend {
  grid-column: 1 / -1;
  width: 100%;
  margin-bottom: .25rem;
  color: var(--magenta);
  font-size: .7rem;
}

.checkin-activity-group label {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
  border-radius: 6px;
  padding: .35rem .4rem;
  color: var(--ink);
  font-size: .7rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.checkin-activity-group label:has(input:checked) {
  background: var(--theme-wash, var(--rose));
  color: var(--magenta);
}

.checkin-activity-group input { flex: 0 0 auto; }
#checkinForm .primary-button { justify-self: start; padding: .75rem 1rem; }
#checkinModalMessage { margin: 0; }

html[data-mybook-theme]:not([data-mybook-theme="default"]) .checkin-dialog {
  border-color: var(--line);
  background: var(--theme-surface);
}

html[data-mybook-theme]:not([data-mybook-theme="default"]) .checkin-open-button {
  border-color: color-mix(in srgb, var(--magenta) 20%, var(--line));
  background: linear-gradient(110deg, var(--theme-wash), var(--theme-surface) 78%);
  color: var(--ink);
}

@media (max-width: 560px) {
  .appearance-theme-options {
    grid-template-columns: minmax(0, 1fr);
  }
  .note-workspace-toolbar { margin-top: .15rem; }
  .note-create-button { min-height: 2.4rem; padding-inline: .65rem; }
  .note-filter-bar { flex-direction: column; }
  .note-filter-bar select { max-width: none; }
  .checkin-widget { padding: .85rem; }
  .calendar-weekdays,.calendar-grid { gap: .2rem; }
  .checkin-dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); }
  .checkin-dialog-header { padding: 1rem; }
  #checkinForm { max-height: calc(100dvh - 6.5rem); padding: .85rem 1rem 1rem; }
  .checkin-activity-tools { grid-template-columns: minmax(0, 1fr); }
  .checkin-activity-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #calendarView .calendar-weekdays,
  #calendarView .calendar-grid { width: min(100%, 350px); }
  .attention-dialog-content { padding: 1.1rem; }
  .attention-dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.app-nav .nav-item {
  position: relative;
  display: flex;
  min-height: 2.8rem;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: .65rem .75rem;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.app-nav .nav-item:hover,
.app-nav .nav-item.active {
  border-color: color-mix(in srgb, var(--magenta) 14%, var(--line));
  background: linear-gradient(110deg, var(--theme-wash, var(--rose)), var(--theme-surface, #fff));
  color: var(--magenta);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--magenta) 8%, transparent);
}

.app-nav .nav-icon {
  flex: 0 0 25px;
  color: var(--magenta);
  text-align: center;
}

.checkin-open-button {
  min-height: 5rem;
  border-radius: 14px;
  box-shadow: 0 9px 24px color-mix(in srgb, var(--magenta) 10%, transparent);
}

.checkin-open-button:hover {
  box-shadow: 0 14px 30px color-mix(in srgb, var(--magenta) 16%, transparent);
}

#calendarView {
  width: min(100%, 490px);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: clamp(.85rem, 2vw, 1.25rem);
  background: linear-gradient(155deg, var(--theme-surface, #fff), var(--theme-surface-soft, var(--pale)));
  box-shadow: 0 12px 30px rgba(70, 37, 55, .07);
}

.calendar-toolbar {
  min-height: 2.8rem;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calendar-toolbar .outline-button {
  display: grid;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-color: color-mix(in srgb, var(--magenta) 24%, var(--line));
  border-radius: 9px;
  padding: 0;
  background: var(--theme-surface, #fff);
  box-shadow: 0 3px 9px rgba(70, 37, 55, .06);
  font-size: 1.4rem;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.calendar-toolbar .outline-button:hover {
  transform: translateY(-1px);
  background: var(--magenta);
  color: #fff;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--magenta) 20%, transparent);
}

.calendar-toolbar strong {
  font: 700 1.05rem "Playfair Display", serif;
  text-transform: capitalize;
}

#calendarView .calendar-weekdays,
#calendarView .calendar-grid {
  width: 100%;
  gap: clamp(.2rem, 1vw, .42rem);
}

.calendar-weekdays {
  align-items: center;
  margin-bottom: .45rem;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .03em;
}

#calendarView .calendar-day {
  width: min(100%, 3.2rem);
  aspect-ratio: 1;
  border-color: transparent;
  border-radius: 11px;
  background: transparent;
  font-size: .78rem;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

#calendarView .calendar-day:not(.calendar-day-empty):hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--magenta) 30%, var(--line));
  background: var(--theme-surface, #fff);
  box-shadow: 0 5px 13px color-mix(in srgb, var(--magenta) 12%, transparent);
}

#calendarView .calendar-day.is-today {
  border-color: color-mix(in srgb, var(--magenta) 40%, var(--line));
  color: var(--magenta);
  font-weight: 800;
}

#calendarView .calendar-day[aria-pressed="true"] {
  border-color: var(--magenta);
  background: var(--magenta);
  color: #fff;
  box-shadow: 0 5px 13px color-mix(in srgb, var(--magenta) 23%, transparent);
}

#calendarView .calendar-day[aria-pressed="true"]::after {
  background: #fff;
}

.calendar-selected-events {
  margin-top: 1.15rem;
  border-color: color-mix(in srgb, var(--magenta) 16%, var(--line));
  border-radius: 0 0 9px 9px;
  padding-top: .9rem;
}

.calendar-selected-events h3 {
  margin: 0 0 .6rem;
  color: var(--deep);
  font: 700 .95rem "Playfair Display", serif;
  text-transform: capitalize;
}

.calendar-selected-events > p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .73rem;
  line-height: 1.5;
}

.calendar-event {
  border: 1px solid color-mix(in srgb, var(--magenta) 12%, var(--line));
}

.profile-modal .settings-tab {
  position: relative;
  min-height: 2.7rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .65rem .75rem;
  text-align: left;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.profile-modal .settings-tab:hover {
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--magenta) 16%, var(--line));
  background: var(--theme-surface-soft, #fff1f7);
  color: var(--magenta);
}

.profile-modal .settings-tab.active {
  border-color: color-mix(in srgb, var(--magenta) 20%, var(--line));
  background: linear-gradient(110deg, var(--theme-wash, #fff1f7), var(--theme-surface, #fff));
  color: var(--magenta);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--magenta) 9%, transparent);
}

.profile-modal .settings-panel .outline-button,
.profile-modal .settings-panel .danger-button,
.profile-modal .settings-panel .primary-button {
  display: inline-flex;
  min-height: 2.55rem;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: 8px;
  padding: .6rem .9rem;
  font: 700 .74rem "DM Sans", sans-serif;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}

.profile-modal .settings-panel .outline-button {
  border-color: color-mix(in srgb, var(--magenta) 35%, var(--line));
  background: var(--theme-surface, #fff);
  box-shadow: 0 3px 9px rgba(70, 37, 55, .05);
}

.profile-modal .settings-panel .outline-button:hover {
  transform: translateY(-1px);
  background: var(--magenta);
  color: #fff;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--magenta) 18%, transparent);
}

.profile-modal .settings-panel .danger-button {
  border-color: color-mix(in srgb, var(--theme-danger, #a33535) 35%, var(--line));
  background: color-mix(in srgb, var(--theme-danger, #a33535) 7%, var(--theme-surface, #fff));
  color: var(--theme-danger, #a33535);
}

.profile-modal .settings-panel .danger-button:hover {
  transform: translateY(-1px);
  background: var(--theme-danger, #a33535);
  color: #fff;
}

.profile-modal .modal-close {
  border: 1px solid color-mix(in srgb, var(--magenta) 18%, var(--line));
  box-shadow: 0 3px 9px rgba(70, 37, 55, .07);
  transition: transform .18s ease, background .18s ease, color .18s ease;
}

.profile-modal .modal-close:hover {
  transform: rotate(90deg);
  background: var(--magenta);
  color: #fff;
}

.profile-modal .password-toggle {
  min-height: 1.9rem;
  border-radius: 6px;
  padding: .35rem .55rem;
  background: var(--theme-surface-soft, #fff1f7);
  transition: background .18s ease, color .18s ease;
}

.profile-modal .password-toggle:hover {
  background: var(--magenta);
  color: #fff;
}

@media (max-width: 600px) {
  #calendarView {
    width: 100%;
    padding: .8rem;
  }

  #calendarView .calendar-day {
    width: min(100%, 2.7rem);
    border-radius: 9px;
  }

  .profile-modal .settings-tab:hover {
    transform: none;
  }
}
