@font-face {
  font-family: "AmazDooMLeft";
  src: url("fonts/AmazDooMLeft.ttf") format("truetype");
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

:root {
  --ink: #f2f4f8;
  --ink-dim: rgba(242, 244, 248, 0.58);
  --ink-soft: rgba(242, 244, 248, 0.78);
  --bg: #050608;
  --navy: #0f1c2e;
  --navy-mid: #16283f;
  --navy-deep: #0a1420;
  --card: rgba(8, 10, 14, 0.88);
  --card-soft: rgba(12, 14, 18, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --red: #e11d2e;
  --blue: #3b82f6;
  --accent: #5eb8ff;
  --accent-soft: rgba(59, 130, 246, 0.22);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.42);
  --glass-blur: 12px;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --heading: "AmazDooMLeft", "Press Start 2P", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --radius: 22px;
  --radius-sm: 8px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.62) 100%),
    url("assets/bg-chrome.png") center / cover no-repeat,
    #050608;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.dither {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    linear-gradient(90deg, rgba(229, 228, 241, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(229, 228, 241, 0.12) 1px, transparent 1px);
  background-size: 4px 4px;
}

.shell {
  position: relative;
  z-index: 2;
  width: min(1080px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.cloud-bar {
  width: min(920px, 100%);
  margin: 1rem auto 0;
  padding: 0.45rem 0.85rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.sync-status {
  font-family: var(--pixel);
  font-size: 0.42rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
}

.sync-status[data-kind="err"] { color: #ebcb8b; }
.sync-status[data-kind="pending"] { color: var(--ink-dim); }
.sync-status[data-kind="local"] { color: var(--ink-dim); }

.auth-email-label {
  color: var(--ink-soft);
  margin-left: auto;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-logout {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.page-data {
  width: min(760px, 100%);
  margin: 0 auto;
}

.data-safety {
  display: grid;
  gap: 1rem;
}

.data-hero {
  text-align: center;
  padding: 1rem 0 0.4rem;
}

.data-hero h2 {
  margin: 0;
  font-family: var(--heading);
  font-size: clamp(3rem, 9vw, 5.8rem);
  font-weight: 400;
  line-height: 0.9;
}

.data-hero p {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.data-grid {
  display: grid;
  gap: 0.55rem;
}

.data-row {
  min-height: 3.2rem;
  display: grid;
  grid-template-columns: minmax(7rem, 0.45fr) 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(5, 6, 8, 0.46);
}

.data-row span {
  color: var(--ink-dim);
  font-family: var(--pixel);
  font-size: 0.48rem;
  text-transform: uppercase;
}

.data-row strong {
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.data-row.warn strong {
  color: #ebcb8b;
}

.data-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.data-cloud-backups {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(5, 6, 8, 0.38);
}

.data-cloud-backups header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  justify-content: space-between;
}

.data-cloud-backups h3,
.data-cloud-backups p {
  margin: 0;
}

.data-cloud-backups h3 {
  font-family: var(--pixel);
  font-size: 0.58rem;
  text-transform: uppercase;
}

.data-cloud-backups p {
  color: var(--ink-dim);
}

.data-cloud-backups ul {
  display: grid;
  gap: 0.42rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.data-cloud-backups li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.data-cloud-backups em {
  color: var(--ink-dim);
  font-style: normal;
  text-align: right;
}

.auth-gate {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-gate[hidden] {
  display: none !important;
}

.auth-card {
  width: min(400px, 100%);
  padding: 1.4rem 1.25rem 1.35rem;
  border-radius: var(--radius);
  text-align: left;
}

.auth-title {
  margin: 0.2rem 0 0.55rem;
  font-family: var(--heading);
  font-size: clamp(1.15rem, 4.5vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.auth-text {
  margin: 0 0 1rem;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-form {
  display: grid;
  gap: 0.55rem;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  font: inherit;
}

.auth-status {
  margin: 0.85rem 0 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  color: var(--accent);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.auth-actions .btn.solid {
  flex: 1;
}

.auth-code-block {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.15rem;
}

.auth-alt {
  margin-top: 0.85rem;
  color: var(--ink-dim);
  font-size: 0.82rem;
}

.auth-alt summary {
  cursor: pointer;
  color: var(--accent);
  list-style: none;
}

.auth-alt summary::-webkit-details-marker {
  display: none;
}

.auth-alt-form {
  margin-top: 0.65rem;
}

.auth-setup-btn {
  margin-top: 0.85rem;
  width: 100%;
}

.setup-gate {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.setup-gate[hidden] {
  display: none !important;
}

.setup-card {
  width: min(460px, 100%);
  padding: 1.25rem 1.15rem 1.15rem;
  border-radius: var(--radius);
}

.setup-progress {
  margin: 0 0 0.75rem;
  font-family: var(--pixel);
  font-size: 0.42rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.setup-title {
  margin: 0.15rem 0 0.55rem;
  font-family: var(--pixel);
  font-size: 0.72rem;
  line-height: 1.45;
}

.setup-text {
  margin: 0 0 0.45rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}

.setup-hint {
  margin: 0 0 0.9rem;
  color: var(--ink-dim);
  font-size: 0.82rem;
  line-height: 1.4;
}

.setup-field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.setup-field input,
.setup-sql {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--ink);
  padding: 0.75rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
}

.setup-sql {
  resize: vertical;
  min-height: 140px;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
  margin-bottom: 0.55rem;
}

.setup-link {
  display: inline-block;
  margin: 0.35rem 0 0.75rem;
  color: var(--accent);
  font-size: 0.88rem;
}

.setup-actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.setup-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
  align-items: center;
}

.setup-nav .btn.solid {
  margin-left: auto;
}

.setup-toast {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: #ebcb8b;
  min-height: 1.2em;
}

.view-home {
  display: grid;
  gap: 0.85rem;
}

.view-home.is-active {
  display: grid;
}

.view[hidden] {
  display: none !important;
}

.view.is-active {
  animation: viewIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— FOLDER PAGE —— */
.view-page.is-active {
  display: block;
}

.page {
  position: relative;
  min-height: calc(100vh - 2rem);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem 2.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-back {
  appearance: none;
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(8, 10, 14, 0.72);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.page-back:hover {
  border-color: rgba(94, 184, 255, 0.5);
  background: rgba(59, 130, 246, 0.14);
  transform: translateX(-2px);
  box-shadow: 0 0 18px rgba(225, 29, 46, 0.2);
}

.page-inner {
  width: min(520px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 1.6rem;
  justify-items: center;
  text-align: center;
  padding-top: 0.35rem;
}

.page-head {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
  width: 100%;
}

.page-kicker {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.48rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-family: var(--heading);
  font-size: clamp(1.55rem, 5vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: 0.05em;
}

#page-title.page-title {
  font-family: var(--heading);
}

.page-text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 1rem;
  max-width: 28rem;
}

.page-path {
  margin: 0.15rem 0 0;
  color: var(--ink-dim);
  font-size: 0.78rem;
}

.page-path code {
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.78rem;
}

.page-body {
  display: grid;
  gap: 1rem;
  width: 100%;
  justify-items: center;
}

.page-section {
  display: grid;
  gap: 0.75rem;
  width: 100%;
  justify-items: stretch;
}

.page-section[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.notes-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  align-items: start;
}

.notes-sections {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  width: 100%;
  position: relative;
  padding-top: 3.1rem;
}

.notes-section-list {
  display: grid;
  gap: 0.7rem;
  max-height: min(58vh, 560px);
  overflow-y: auto;
  padding-right: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.notes-section-list::-webkit-scrollbar {
  display: none;
}

.notes-section-tab,
.notes-add-section,
.notes-icon-btn,
.notes-entry-add {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.notes-section-tab:hover,
.notes-add-section:hover,
.notes-icon-btn:hover,
.notes-entry-add:hover {
  border-color: rgba(136, 192, 208, 0.42);
  background: rgba(136, 192, 208, 0.08);
}

.notes-entry-add.active {
  border-color: rgba(229, 228, 241, 0.34);
  background: rgba(229, 228, 241, 0.16);
}

.notes-section-tab:active,
.notes-add-section:active,
.notes-icon-btn:active,
.notes-entry-add:active {
  transform: translateY(1px);
}

.notes-section-tab {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0.26rem;
  align-content: center;
  align-items: center;
  justify-items: center;
  width: 100%;
  border-radius: 8px;
  padding: 1.28rem 1.2rem 1.18rem;
  text-align: center;
  min-height: 96px;
}

.notes-section-tab.active {
  border-color: rgba(229, 228, 241, 0.52);
  background: rgba(229, 228, 241, 0.12);
}

.notes-section-tab span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--heading);
  font-size: clamp(2rem, 6vw, 3.35rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.notes-section-tab small {
  display: block;
  max-width: 100%;
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.notes-add-section,
.notes-entry-add,
.notes-icon-btn {
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
}

.notes-add-section {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  height: 44px;
  z-index: 2;
}

.notes-icon-btn.is-confirm {
  min-width: 74px;
  padding: 0 0.7rem;
  border-color: rgba(255, 128, 128, 0.42);
  background: rgba(255, 128, 128, 0.12);
  color: var(--ink);
  font-size: 0.82rem;
}

.notes-workspace {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.page-notes.is-section-list .notes-workspace {
  display: none;
}

.page-notes.is-detail .notes-sections,
.page-notes.is-item .notes-sections {
  display: none;
}

.notes-workspace-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  align-items: center;
  position: relative;
  min-height: 84px;
}

.notes-section-title,
.notes-entry-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font: inherit;
}

.notes-section-title {
  min-height: 44px;
  padding: 0.6rem 6.5rem;
  font-family: var(--heading);
  font-size: clamp(1.8rem, 5vw, 3.1rem);
  text-align: center;
  letter-spacing: 0;
  grid-column: 1 / -1;
}

.notes-workspace-head .notes-icon-btn,
.notes-workspace-head .notes-entry-add {
  position: relative;
  z-index: 1;
  grid-row: 1;
}

.notes-workspace-head .notes-icon-btn {
  grid-column: 2;
}

.notes-workspace-head .notes-entry-add {
  grid-column: 3;
}

.notes-section-title[readonly] {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.notes-section-title.is-editing {
  border-color: rgba(136, 192, 208, 0.52);
  background: rgba(255, 255, 255, 0.035);
}

.notes-entry-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)),
    rgba(12, 14, 20, 0.5);
  padding: 0.45rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.notes-format-toggle {
  display: inline-flex;
  justify-self: center;
  gap: 0.16rem;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  padding: 0.18rem;
}

.notes-format-toggle button {
  min-width: 42px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0.32rem 0.7rem;
}

.notes-format-toggle button:hover,
.notes-format-toggle button:focus-visible,
.notes-format-toggle button.active {
  border-color: rgba(229, 228, 241, 0.22);
  background: rgba(229, 228, 241, 0.18);
  color: var(--ink);
}

.notes-entry-input {
  min-height: 92px;
  resize: vertical;
  border: 0;
  background: transparent;
  padding: 0.8rem 0.9rem;
  line-height: 1.58;
}

.page-notes.is-item .notes-entry-form,
.page-notes.is-item .notes-item-list,
.page-notes.is-item .notes-entry-add {
  display: none;
}

.notes-item-editor {
  display: grid;
  gap: 0.55rem;
  width: 100%;
}

.notes-item-editor[hidden] {
  display: none !important;
}

.notes-item-editor-text {
  width: 100%;
  min-height: min(58vh, 520px);
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)),
    rgba(12, 14, 20, 0.5);
  color: var(--ink);
  padding: 1rem;
  font: inherit;
  line-height: 1.6;
}

.notes-item-editor-text:focus {
  outline: 2px solid rgba(136, 192, 208, 0.52);
  outline-offset: 2px;
}

.notes-structured-editor {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  min-height: min(58vh, 520px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)),
    rgba(12, 14, 20, 0.5);
  padding: 0.9rem;
  align-content: start;
}

.notes-structured-editor[hidden] {
  display: none !important;
}

.notes-structured-row {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
}

.notes-structured-row.is-done .notes-structured-text {
  color: var(--muted);
  text-decoration: line-through;
}

.notes-structured-num {
  padding-top: 0.28rem;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.notes-structured-text {
  width: 100%;
  min-height: 2.1rem;
  resize: vertical;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
  padding: 0.28rem 0.35rem;
  overflow-wrap: anywhere;
}

.notes-structured-text:focus {
  outline: 1px solid rgba(136, 192, 208, 0.34);
  background: rgba(255, 255, 255, 0.04);
}

.notes-section-title:focus,
.notes-entry-input:focus,
.notes-section-tab:focus-visible,
.notes-add-section:focus-visible,
.notes-icon-btn:focus-visible,
.notes-entry-add:focus-visible {
  outline: 2px solid rgba(136, 192, 208, 0.52);
  outline-offset: 2px;
}

.notes-item-list {
  display: grid;
  gap: 0.55rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.notes-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.notes-check {
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: 0.1rem;
  border: 2px solid rgba(229, 228, 241, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.notes-check:checked {
  border-color: var(--accent);
  background: rgba(136, 192, 208, 0.16);
}

.notes-check:checked::after {
  content: "✓";
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}

.notes-type {
  display: inline-grid;
  place-items: center;
  width: 24px;
  min-height: 24px;
  color: var(--accent);
  font-weight: 700;
}

.notes-type.is-empty {
  color: transparent;
}

.notes-item-body {
  min-width: 0;
  color: var(--ink);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.notes-item-body.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

.notes-item-body p {
  margin: 0;
  white-space: pre-wrap;
}

.notes-link {
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.notes-link:hover {
  text-decoration: underline;
}

.notes-list {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding-left: 1.15rem;
}

.notes-checklist {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.notes-checklist li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
}

.notes-checklist span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notes-checklist li.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}

.notes-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.notes-undo {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  transform: translateX(-50%);
  max-width: calc(100vw - 2rem);
  border: 1px solid rgba(229, 228, 241, 0.36);
  border-radius: 8px;
  background: rgba(15, 20, 29, 0.94);
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

.notes-undo button {
  min-width: 44px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(136, 192, 208, 0.12);
  color: var(--ink);
  cursor: pointer;
}

.page-finance {
  width: min(920px, 100%);
  margin: 0 auto;
}

.money-shell {
  display: grid;
  gap: 0.8rem;
}

.money-hero,
.money-card,
.money-split,
.money-plan,
.money-entry,
.money-advice,
.money-history {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.025)),
    rgba(6, 8, 12, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.money-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1.1rem;
}

.money-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: auto;
  bottom: 0;
  width: var(--buffer, 0%);
  height: 3px;
  background: var(--accent);
}

.money-hero span,
.money-card span,
.money-split h2,
.money-plan h2,
.money-entry h2,
.money-advice h2,
.money-history h2 {
  margin: 0;
  color: var(--ink-dim);
  font-family: var(--pixel);
  font-size: 0.52rem;
  line-height: 1.4;
  text-transform: uppercase;
}

.money-hero strong {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--heading);
  font-size: clamp(3rem, 9vw, 5.4rem);
  font-weight: 400;
  line-height: 0.86;
}

.money-hero em {
  display: block;
  margin-top: 0.4rem;
  color: var(--ink-soft);
  font-style: normal;
}

.money-pulse {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0 0.75rem;
  border: 1px solid rgba(136, 192, 208, 0.25);
  border-radius: 8px;
  background: rgba(136, 192, 208, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.money-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.money-card {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  min-height: 88px;
  padding: 0.8rem;
}

.money-card strong,
.money-history header strong,
.money-bars strong {
  font-size: 1.15rem;
  line-height: 1.2;
}

.money-amount-input,
.money-plan-row input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 0.45rem 0.55rem;
}

.money-split,
.money-plan,
.money-entry,
.money-advice,
.money-history {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
}

.money-split header,
.money-plan header,
.money-entry header,
.money-advice header,
.money-history header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.money-split p {
  margin: 0.25rem 0 0;
  color: var(--ink-dim);
}

.money-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.money-bars div,
.money-plan-row {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.money-bars div {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
}

.money-bars i,
.money-plan-row i {
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(var(--w), 100%);
  height: 3px;
  background: var(--accent);
}

.money-plan-list {
  display: grid;
  gap: 0.5rem;
}

.money-plan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 92px;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem;
}

.money-plan-row span,
.money-tx span {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.money-plan-row em {
  color: var(--ink-dim);
  font-style: normal;
  text-align: right;
}

.money-entry textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
  padding: 0.8rem;
}

.money-add,
.money-reset,
.money-tx button {
  min-width: 44px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.money-add {
  padding: 0 0.9rem;
  background: rgba(136, 192, 208, 0.14);
}

.money-reset {
  padding: 0 0.75rem;
  color: var(--ink-dim);
}

.money-advice div {
  display: grid;
  gap: 0.45rem;
}

.money-advice p,
.money-empty {
  margin: 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink-soft);
}

.money-tx {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.58rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.money-tx p {
  min-width: 0;
  margin: 0;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}

.money-tx button {
  width: 40px;
  padding: 0;
}

/* habit editor cards */
.habit-editor-list {
  display: grid;
  gap: 0.55rem;
  width: 100%;
}

.habit-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.25s ease;
}

.habit-card:hover {
  border-color: rgba(136, 192, 208, 0.28);
}

.habit-card.is-open {
  border-color: rgba(136, 192, 208, 0.42);
  background: rgba(136, 192, 208, 0.06);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.habit-card-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: stretch;
}

.habit-card-summary {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.85rem 0.95rem 0.85rem 0.35rem;
  text-align: left;
  font: inherit;
}

.habit-card-summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.habit-card-handle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  cursor: grab;
  width: 28px;
  margin: 0.55rem 0 0.55rem 0.45rem;
  padding: 0;
  display: grid;
  place-items: center;
  letter-spacing: -0.12em;
  font-size: 0.95rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  user-select: none;
  touch-action: none;
  align-self: center;
}

.habit-card-handle:hover {
  color: var(--accent);
  background: rgba(136, 192, 208, 0.1);
}

.habit-card-handle:active,
.habit-card.is-dragging .habit-card-handle {
  cursor: grabbing;
}

.habit-card.is-dragging {
  opacity: 0.45;
  border-style: dashed;
}

.habit-card.drag-over-before {
  box-shadow: inset 0 2px 0 0 var(--accent);
}

.habit-card.drag-over-after {
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.habit-card-ico {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: rgba(136, 192, 208, 0.12);
  overflow: hidden;
}

.habit-card-ico .apple-emoji,
.habit-card-ico .apple-emoji img {
  width: 22px;
  height: 22px;
}

.habit-card-copy {
  min-width: 0;
}

.habit-card-copy strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
}

.habit-card-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.habit-card-chevron {
  color: var(--ink-dim);
  font-size: 1.1rem;
  transition: transform 0.25s ease;
}

.habit-card.is-open .habit-card-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

.habit-card-editor {
  display: grid;
  gap: 0.75rem;
  padding: 0 0.95rem 0.95rem;
  text-align: left;
  animation: habitEditorIn 0.28s ease both;
}

@keyframes habitEditorIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.habit-card-editor input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  font: inherit;
}

.habit-card-editor input[type="text"]:focus {
  outline: 2px solid rgba(136, 192, 208, 0.4);
  outline-offset: 1px;
}

.habit-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  margin-top: 0.15rem;
}

.habit-add-tile {
  appearance: none;
  width: 100%;
  border: 1px dashed rgba(136, 192, 208, 0.35);
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  font: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.habit-add-tile span {
  font-size: 1.35rem;
  line-height: 1;
  color: var(--accent);
}

.habit-add-tile em {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.habit-add-tile:hover {
  border-color: rgba(136, 192, 208, 0.55);
  background: rgba(136, 192, 208, 0.06);
  color: var(--ink);
}

.habit-add-tile[hidden] {
  display: none !important;
}

/* Habby-style stats */
.page-inner:has(#page-habits:not([hidden])) {
  width: min(640px, 100%);
}

.habit-stats {
  width: 100%;
  display: grid;
  gap: 0.85rem;
  text-align: left;
  margin-bottom: 0.35rem;
}

.habit-stats-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
}

.habit-stat-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  border-radius: var(--radius);
  padding: 0.65rem 0.55rem;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  text-align: center;
}

.habit-stat-value {
  font-family: var(--pixel);
  font-size: 0.72rem;
  color: var(--ink);
  line-height: 1.3;
}

.habit-stat-value.is-accent {
  color: var(--accent);
}

.habit-stat-label {
  font-size: 0.68rem;
  color: var(--ink-dim);
}

.habit-heat-wrap {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  padding: 0.75rem 0.8rem 0.7rem;
  display: grid;
  gap: 0.55rem;
}

.habit-heat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.habit-heat-head .px-label {
  margin: 0;
}

.habit-heat-legend {
  font-size: 0.7rem;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.habit-heat-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.habit-heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  justify-content: start;
}

.habit-heat-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.habit-heat-cell.lv1 { background: rgba(171, 7, 22, 0.28); }
.habit-heat-cell.lv2 { background: rgba(171, 7, 22, 0.45); }
.habit-heat-cell.lv3 { background: rgba(136, 192, 208, 0.45); }
.habit-heat-cell.lv4 { background: rgba(136, 192, 208, 0.72); }
.habit-heat-cell.is-today {
  outline: 1px solid rgba(229, 228, 241, 0.55);
  outline-offset: 1px;
}

.habit-week-bars {
  display: grid;
  gap: 0.4rem;
}

.habit-week-row {
  display: grid;
  grid-template-columns: 28px 1fr 36px;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.habit-week-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.habit-week-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(171, 7, 22, 0.7), rgba(136, 192, 208, 0.85));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 560px) {
  .habit-stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.glass {
  position: relative;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.07) 0%,
      rgba(255, 255, 255, 0.02) 24%,
      rgba(8, 10, 14, 0.82) 48%,
      rgba(225, 29, 46, 0.1) 78%,
      rgba(59, 130, 246, 0.1) 100%
    ),
    rgba(6, 8, 12, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(59, 130, 246, 0.1),
    0 0 24px rgba(225, 29, 46, 0.06),
    0 0 28px rgba(59, 130, 246, 0.07);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
  overflow: hidden;
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(90deg, rgba(225, 29, 46, 0.08), transparent 35%, rgba(59, 130, 246, 0.08));
  opacity: 0.85;
  z-index: 0;
}

.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.glass > * {
  position: relative;
  z-index: 2;
}

.glass > .habits-progress-fill {
  position: absolute;
  z-index: 0;
}

.glass > .page-back {
  position: absolute;
  z-index: 3;
}

.px-label {
  margin: 0 0 0.35rem;
  font-family: var(--pixel);
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
}

.panel {
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.panel-title {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.78rem;
  line-height: 1.35;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.88rem;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.solid {
  background: var(--red);
  color: var(--ink);
}

/* —— HABITS —— */
.habits-panel {
  position: relative;
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 0.5rem 0.85rem 0.55rem;
  overflow: hidden;
  isolation: isolate;
}

.habits-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--habits-pct, 0%);
  max-width: 100%;
  background: linear-gradient(
    105deg,
    rgba(171, 7, 22, 0.28) 0%,
    rgba(171, 7, 22, 0.14) 38%,
    rgba(136, 192, 208, 0.26) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(136, 192, 208, 0.08);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 0;
}

.habits-progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 28px;
  background: linear-gradient(90deg, transparent, rgba(229, 228, 241, 0.08));
  opacity: 0.7;
}

.habits-panel > *:not(.habits-progress-fill) {
  position: relative;
  z-index: 1;
}

.habits-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  align-items: center;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.1rem 0 0.3rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(136, 192, 208, 0.4) transparent;
}

.habits-row::-webkit-scrollbar {
  height: 5px;
}

.habits-row::-webkit-scrollbar-track {
  background: transparent;
}

.habits-row::-webkit-scrollbar-thumb {
  background: rgba(136, 192, 208, 0.4);
  border-radius: 999px;
}

.habit-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(10, 20, 32, 0.35);
  backdrop-filter: blur(4px);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.5rem 0.28rem 0.32rem;
  flex: 0 0 auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition:
    border-color 0.2s ease,
    background 0.25s ease,
    opacity 0.3s ease,
    filter 0.3s ease,
    box-shadow 0.25s ease;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.habits-head {
  align-items: center;
  margin-bottom: 0.35rem;
}

.habits-head-right {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.habits-panel .px-label {
  margin-bottom: 0;
  font-size: 0.42rem;
}

.habits-progress-label {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.48rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.habits-clock {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.58rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.habits-add {
  display: grid;
  gap: 0.55rem;
  margin: 0.75rem 0 0.85rem;
}

.habits-add input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font: inherit;
}

.habits-add input:focus {
  outline: 2px solid rgba(136, 192, 208, 0.45);
  outline-offset: 1px;
}

.icon-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-start;
}

.icon-opt {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}

.icon-opt.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.habit-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.habit-field input {
  width: 64px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  font: inherit;
}

.days-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.day-opt {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.day-opt.active {
  background: rgba(171, 7, 22, 0.35);
  border-color: rgba(171, 7, 22, 0.55);
  color: var(--ink);
}

.habit-chip .habit-progress {
  font-family: var(--pixel);
  font-size: 0.34rem;
  color: var(--accent);
  opacity: 0.9;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.sheet-habit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.sheet-habit-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.92rem;
}

.sheet-habit-list button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 1rem;
}

.sheet-habit-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-dim);
  margin-top: 0.15rem;
}

.sheet-habit-list .sheet-habit-ico {
  font-size: 1.1rem;
}

.todo-add {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.todo-add input {
  width: min(220px, 42vw);
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font: inherit;
}

.todo-add input:focus {
  outline: 2px solid rgba(136, 192, 208, 0.45);
  outline-offset: 1px;
}

.habit-chip:hover {
  border-color: rgba(136, 192, 208, 0.42);
  background: rgba(136, 192, 208, 0.08);
  box-shadow: 0 0 0 1px rgba(136, 192, 208, 0.08);
}

.habit-chip:active {
  transform: scale(0.97);
}

.habit-chip .habit-ico {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  line-height: 1;
  background: rgba(136, 192, 208, 0.14);
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.25s ease;
  overflow: hidden;
}

.habit-chip .habit-ico .apple-emoji,
.habit-chip .habit-ico .apple-emoji img {
  width: 14px;
  height: 14px;
}

.habit-chip .habit-name {
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  line-height: 1.15;
  white-space: nowrap;
  max-width: 9.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-chip .habit-check {
  width: 13px;
  height: 13px;
  border: 1.5px solid rgba(229, 228, 241, 0.45);
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 0.1rem;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}

.habit-chip .habit-check::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s ease;
}

.habit-chip.done {
  background: rgba(136, 192, 208, 0.08);
  border-color: rgba(136, 192, 208, 0.28);
  opacity: 0.62;
}

.habit-chip.done .habit-check {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}

.habit-chip.done .habit-check::after {
  background: var(--navy-deep);
  clip-path: polygon(14% 48%, 0 62%, 42% 100%, 100% 18%, 84% 4%, 40% 68%);
  inset: 2.5px;
}

.habit-chip.done .habit-name {
  text-decoration: line-through;
  text-decoration-color: rgba(136, 192, 208, 0.45);
  opacity: 0.85;
}

.habit-chip.done .habit-ico {
  filter: grayscale(0.35);
  background: rgba(136, 192, 208, 0.08);
}

.habit-chip.pop {
  animation: habitPop 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.habit-chip.completing {
  animation: habitComplete 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.habit-chip.completing .habit-ico,
.habit-chip.ico-flash .habit-ico {
  animation: icoGlow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.habit-chip.entering {
  animation: habitEnter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.habit-chip .habit-del {
  position: absolute;
  top: 4px;
  right: 6px;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}

@keyframes habitPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes habitComplete {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.35); box-shadow: 0 0 0 4px rgba(136, 192, 208, 0.18); }
  100% { filter: brightness(1); box-shadow: none; }
}

@keyframes icoGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(136, 192, 208, 0);
    background: rgba(136, 192, 208, 0.14);
  }
  35% {
    transform: scale(1.22);
    box-shadow:
      0 0 0 4px rgba(136, 192, 208, 0.35),
      0 0 18px rgba(136, 192, 208, 0.55),
      0 0 8px rgba(171, 7, 22, 0.25);
    background: rgba(136, 192, 208, 0.35);
    filter: brightness(1.25);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(136, 192, 208, 0);
    background: rgba(136, 192, 208, 0.14);
    filter: none;
  }
}

@keyframes habitEnter {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* —— MAIN ROW: folders | todo | right —— */
.main-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(280px, 2fr) minmax(160px, 1fr);
  gap: 0.85rem;
  align-items: start;
  width: min(920px, 100%);
  margin: 0 auto;
}

/* folders — ears with names, heavy overlap, hover up */
.folder-rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 240px;
  justify-self: start;
  padding-top: 8px;
}

.f-tab {
  --tab-bg: rgba(17, 17, 17, 0.55);
  --tab-fg: var(--ink);
  appearance: none;
  border: 0;
  cursor: pointer;
  position: relative;
  width: 100%;
  margin: 0;
  margin-top: -52px;
  padding: 0;
  text-align: left;
  background: transparent;
  transform: translateY(0);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.28));
}

.f-tab:first-child {
  margin-top: 0;
}

.f-ear {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  max-width: 78%;
  min-height: 34px;
  padding: 0.45rem 0.85rem 0.4rem;
  background: var(--tab-bg);
  color: var(--tab-fg);
  border-radius: 12px 16px 0 0;
  clip-path: polygon(0 0, 86% 0, 100% 100%, 0 100%);
  font-family: var(--pixel);
  font-size: 0.48rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  position: relative;
  z-index: 2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
}

.f-ear-name {
  white-space: nowrap;
}

.f-ear i {
  font-style: normal;
  opacity: 0.75;
  flex-shrink: 0;
}

.f-body {
  display: block;
  width: 100%;
  height: 72px;
  margin-top: -1px;
  background: var(--tab-bg);
  border-radius: 0 14px 12px 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
}

.f-tab[data-folder="music"] { --tab-bg: rgba(10, 10, 10, 0.72); }
.f-tab[data-folder="todos"] { --tab-bg: rgba(10, 28, 48, 0.78); }
.f-tab[data-folder="finance"] { --tab-bg: rgba(225, 29, 46, 0.72); }
.f-tab[data-folder="goals"] { --tab-bg: rgba(28, 52, 84, 0.78); }
.f-tab[data-folder="habits"] { --tab-bg: rgba(48, 18, 26, 0.78); }
.f-tab[data-folder="sport"] { --tab-bg: rgba(94, 184, 255, 0.72); --tab-fg: #0f1c2e; }
.f-tab[data-folder="notebook"] { --tab-bg: rgba(229, 228, 241, 0.78); --tab-fg: #0f1c2e; }
.f-tab[data-folder="data"] { --tab-bg: rgba(43, 48, 58, 0.82); }

.f-tab:nth-child(1) { z-index: 1; }
.f-tab:nth-child(2) { z-index: 2; }
.f-tab:nth-child(3) { z-index: 3; }
.f-tab:nth-child(4) { z-index: 4; }
.f-tab:nth-child(5) { z-index: 5; }
.f-tab:nth-child(6) { z-index: 6; }
.f-tab:nth-child(7) { z-index: 7; }

.f-tab:hover,
.f-tab:focus-visible {
  transform: translateY(-18px);
  z-index: 40;
  outline: none;
}

/* TODO center */
.todo-panel {
  min-height: 280px;
  justify-self: stretch;
}

.todo-panel .todo-add {
  margin-bottom: 0.75rem;
}

.todo-panel .todo-add input,
.inbox-panel .todo-add input {
  flex: 1;
  width: auto;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.65rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.task-item.done .task-text {
  text-decoration: line-through;
  opacity: 0.55;
}

.task-item.leaving {
  opacity: 0;
  transform: translateX(12px) scale(0.98);
}

.task-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  background: transparent;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
  padding: 0;
}

.task-item.done .task-check {
  background: var(--accent);
  border-color: var(--accent);
}

.task-text {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  width: 100%;
  text-align: left;
  padding: 0;
  cursor: text;
}

.task-text:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.35rem;
}

.task-actions {
  display: flex;
  gap: 0.25rem;
}

.task-actions button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
}

.task-actions button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

/* RIGHT column */
.right-col {
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.cal-panel,
.pin-panel {
  min-height: 210px;
}

.pin-panel {
  padding: 0;
  overflow: hidden;
  display: flex;
}

.pin-panel img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  display: block;
}

.cal-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.4rem;
  align-items: center;
  margin: 0.4rem 0 0.55rem;
}

.cal-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.2rem;
}

.cal-now { text-align: center; }

.cal-weekday {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.55rem;
  color: var(--accent);
}

.cal-date {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.cal-today {
  width: 100%;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.cal-cell {
  appearance: none;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  border-radius: 8px;
  aspect-ratio: 1;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
}

.cal-cell:hover { border-color: rgba(136, 192, 208, 0.35); }
.cal-cell.muted { opacity: 0.35; }
.cal-cell.selected {
  background: rgba(171, 7, 22, 0.35);
  border-color: rgba(171, 7, 22, 0.55);
  color: var(--ink);
}
.cal-cell.today-mark {
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* INBOX */
.inbox-panel {
  width: min(920px, 100%);
  margin: 0 auto;
  min-height: 200px;
}

.inbox-panel .todo-add {
  margin-bottom: 0.75rem;
}

.foot {
  width: min(920px, 100%);
  margin: 0 auto;
  border-radius: 18px;
  padding: 0.7rem 1.1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.dlg {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.05), rgba(8, 10, 14, 0.94) 42%, rgba(225, 29, 46, 0.08)),
    rgba(4, 5, 8, 0.94);
  color: var(--ink);
  padding: 1.05rem 1.15rem 1.1rem;
  max-width: min(360px, calc(100vw - 1.5rem));
  width: 100%;
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 28px rgba(59, 130, 246, 0.1);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

.dlg::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.dlg .px-label {
  margin: 0;
}

.dlg-text {
  margin: 0.45rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.dlg menu {
  display: flex;
  gap: 0.45rem;
  justify-content: flex-end;
  margin: 0.95rem 0 0;
  padding: 0;
}

.move-picked {
  margin-top: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid rgba(136, 192, 208, 0.28);
  background: rgba(136, 192, 208, 0.08);
  font-family: var(--pixel);
  font-size: 0.58rem;
  line-height: 1.45;
  color: var(--accent);
  text-align: center;
}

.move-quicks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.7rem;
}

.move-quick {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.move-quick:hover {
  border-color: rgba(136, 192, 208, 0.4);
  color: var(--ink);
}

.move-quick.active {
  background: rgba(171, 7, 22, 0.32);
  border-color: rgba(171, 7, 22, 0.55);
  color: var(--ink);
}

.move-cal {
  margin-top: 0.75rem;
  padding: 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.move-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.move-cal-title {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.68rem;
  line-height: 1.35;
  text-transform: capitalize;
}

.move-cal-dows {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
  margin-bottom: 0.25rem;
  text-align: center;
  font-size: 0.68rem;
  color: var(--ink-dim);
}

.move-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.move-cal-cell {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: var(--radius-sm);
  aspect-ratio: 1;
  min-height: 34px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.move-cal-cell:hover:not(:disabled) {
  background: rgba(136, 192, 208, 0.12);
}

.move-cal-cell:disabled {
  opacity: 0.25;
  cursor: default;
}

.move-cal-cell.is-today {
  box-shadow: inset 0 0 0 1px rgba(136, 192, 208, 0.45);
}

.move-cal-cell.is-selected {
  background: rgba(171, 7, 22, 0.55);
  color: var(--ink);
  font-weight: 700;
}

.move-cal-cell.is-selected.is-today {
  box-shadow: none;
}

.move-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-top: 0.85rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.move-mode {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.move-mode.active {
  background: rgba(136, 192, 208, 0.16);
  color: var(--ink);
}

.move-horizon-kinds {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.3rem;
  margin-top: 0.85rem;
  padding: 0.22rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.move-horizon-kind {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 0.4rem 0.35rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.move-horizon-kind.active {
  background: rgba(136, 192, 208, 0.16);
  color: var(--ink);
}

.move-horizon-hint {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-dim);
  line-height: 1.35;
}

.move-horizons {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.move-horizon {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink-soft);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.move-horizon:hover {
  border-color: rgba(136, 192, 208, 0.35);
}

.move-horizon.active {
  border-color: rgba(171, 7, 22, 0.55);
  background: rgba(171, 7, 22, 0.28);
  color: var(--ink);
}

.move-period-picks {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
  max-height: min(42vh, 320px);
  overflow: auto;
  padding-right: 0.15rem;
}

.move-period-pick {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink-soft);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 0.15rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.move-period-pick span {
  font-size: 0.9rem;
}

.move-period-pick small {
  font-size: 0.72rem;
  color: var(--ink-dim);
}

.move-period-pick:hover {
  border-color: rgba(136, 192, 208, 0.35);
}

.move-period-pick.active {
  border-color: rgba(171, 7, 22, 0.55);
  background: rgba(171, 7, 22, 0.28);
  color: var(--ink);
}

.move-period-pick.active small {
  color: rgba(236, 239, 244, 0.72);
}

.page-inner:has(#page-todos:not([hidden])) {
  width: min(640px, 100%);
}

.todos-board {
  width: 100%;
  display: grid;
  gap: 0.75rem;
  text-align: left;
}

.todos-shelf {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 0.75rem 0.85rem 0.85rem;
  display: grid;
  gap: 0.55rem;
}

.todos-shelf-head {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label count"
    "title count";
  gap: 0.15rem 0.5rem;
  align-items: center;
}

.todos-shelf-head .px-label {
  grid-area: label;
  margin: 0;
}

.todos-shelf-head strong {
  grid-area: title;
  font-size: 0.95rem;
}

.todos-shelf-count {
  grid-area: count;
  font-family: var(--pixel);
  font-size: 0.55rem;
  color: var(--accent);
}

.task-main {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.task-tag {
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.85;
}

.task-tag.is-remind {
  color: #ebcb8b;
  opacity: 1;
}

.task-item.is-system {
  border-color: rgba(136, 192, 208, 0.28);
  background: rgba(136, 192, 208, 0.08);
}

.task-item.is-system .task-text {
  font-weight: 600;
  color: var(--accent);
}

/* —— Apple emoji —— */
.apple-emoji {
  display: inline-grid;
  place-items: center;
  width: var(--emoji-size, 22px);
  height: var(--emoji-size, 22px);
  line-height: 1;
  flex-shrink: 0;
}

.apple-emoji img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.apple-emoji.is-native {
  font-size: calc(var(--emoji-size, 22px) * 0.85);
}

.icon-pick-open {
  display: grid;
}

.icon-pick-btn {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.icon-pick-btn:hover {
  border-color: rgba(136, 192, 208, 0.4);
  background: rgba(136, 192, 208, 0.08);
  color: var(--ink);
}

.emoji-dlg {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(560px, calc(100vw - 1.5rem));
  width: 100%;
}

.emoji-dlg::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.emoji-dlg-card {
  background: var(--navy-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(280px, 52vh) auto;
}

.emoji-dlg-head {
  padding: 0.9rem 1rem 0.7rem;
  display: grid;
  gap: 0.55rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.emoji-dlg-head .px-label {
  margin: 0;
  text-align: left;
}

.emoji-dlg-close {
  appearance: none;
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

#emoji-search {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font: inherit;
}

#emoji-search:focus {
  outline: 2px solid rgba(136, 192, 208, 0.4);
  outline-offset: 1px;
}

.emoji-skins {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.emoji-skin {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card-soft);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}

.emoji-skin.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.emoji-cats {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
}

.emoji-cat {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-dim);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
}

.emoji-cat.active {
  background: rgba(136, 192, 208, 0.14);
  border-color: rgba(136, 192, 208, 0.4);
  color: var(--ink);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  overflow-y: auto;
  align-content: start;
}

.emoji-cell {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0.2rem;
}

.emoji-cell:hover {
  background: rgba(136, 192, 208, 0.12);
}

.emoji-cell .apple-emoji {
  width: 28px;
  height: 28px;
}

.emoji-cell .apple-emoji img {
  width: 28px;
  height: 28px;
}

.emoji-dlg-status {
  margin: 0;
  padding: 0.45rem 0.9rem 0.7rem;
  font-size: 0.75rem;
  color: var(--ink-dim);
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .main-row {
    grid-template-columns: 1fr;
  }

  .folder-rail {
    max-width: none;
    order: 3;
  }

  .todo-panel { order: 1; }
  .right-col { order: 2; }

  .habits-panel,
  .inbox-panel,
  .main-row,
  .foot {
    width: 100%;
  }
}

/* —— MUSIC STUDIO —— */
.page-inner:has(#page-music:not([hidden])) {
  width: min(920px, 100%);
  text-align: left;
  justify-items: stretch;
}

.page-inner:has(#page-music:not([hidden])) .page-head {
  justify-items: start;
  text-align: left;
}

.page-music {
  gap: 1rem;
}

.music-focus {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 0.65rem 0.8rem;
  display: grid;
  gap: 0.3rem;
}

.music-focus-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 0.15rem 0;
}

.music-focus-input::placeholder {
  color: var(--ink-dim);
  font-weight: 500;
}

.music-week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.music-dow {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-soft);
  border-radius: 12px;
  padding: 0.45rem 0.2rem;
  display: grid;
  gap: 0.15rem;
  cursor: pointer;
  font: inherit;
}

.music-dow span {
  font-family: var(--pixel);
  font-size: 0.42rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.music-dow em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.music-dow:hover {
  border-color: rgba(94, 184, 255, 0.4);
}

.music-dow.active {
  border-color: rgba(171, 7, 22, 0.55);
  background: rgba(171, 7, 22, 0.22);
  color: var(--ink);
}

.music-dow.active em {
  color: rgba(236, 239, 244, 0.78);
}

.music-studio {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 0.9rem;
  align-items: start;
}

.music-schedule,
.music-pool {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 0.7rem;
  display: grid;
  gap: 0.55rem;
  min-height: 100%;
}

.music-col-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  align-items: end;
}

.music-col-head .px-label {
  margin: 0;
  grid-column: 1;
}

.music-col-head strong {
  grid-column: 1 / -1;
  font-size: 0.95rem;
}

#music-pool-progress {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--pixel);
  font-size: 0.5rem;
  color: var(--accent);
}

.music-slots {
  display: grid;
  gap: 0.32rem;
}

.music-slots-gap {
  height: 0.55rem;
  border-top: 1px dashed rgba(236, 239, 244, 0.14);
  margin: 0.05rem 0.1rem 0;
}

.music-slot {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem;
  align-items: center;
  min-height: 2.15rem;
  padding: 0.28rem 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.music-slot.is-empty {
  border-style: dashed;
  opacity: 0.72;
}

.music-slot.is-active {
  border-color: rgba(94, 184, 255, 0.35);
  background: rgba(59, 130, 246, 0.1);
}

.music-slot.is-done {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.music-slot-num {
  font-family: var(--pixel);
  font-size: 0.38rem;
  color: var(--ink-dim);
  width: 0.9rem;
}

.music-slot-empty {
  color: var(--ink-dim);
  font-size: 0.78rem;
}

.music-slot-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
}

.music-slot-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-slot.is-done .music-slot-title {
  text-decoration: line-through;
  color: var(--ink-soft);
  font-weight: 500;
}

.music-slot-actions {
  display: inline-flex;
  gap: 0.22rem;
}

.music-slot-btn {
  appearance: none;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}

.music-slot-btn.is-ok:hover {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.18);
}

.music-slot-btn.is-skip:hover {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.16);
}

.music-pool-hint {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.82rem;
  line-height: 1.4;
}

.music-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
}

.music-pill {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.5rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  max-width: 100%;
  line-height: 1.2;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.music-pill b {
  color: var(--accent);
  font-weight: 700;
}

.music-pill small {
  color: var(--ink-dim);
  font-size: 0.66rem;
}

.music-pill:hover:not(:disabled) {
  border-color: rgba(94, 184, 255, 0.5);
  background: rgba(59, 130, 246, 0.14);
  transform: translateY(-1px);
}

.music-pill.is-empty,
.music-pill:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.music-pool-empty {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.88rem;
}

@media (max-width: 820px) {
  .music-studio {
    grid-template-columns: 1fr;
  }
}

@keyframes music-slot-in {
  from {
    opacity: 0.35;
    transform: translateX(18px) scale(0.92);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
  60% {
    box-shadow: 0 0 22px rgba(59, 130, 246, 0.45);
  }
  to {
    opacity: 1;
    transform: none;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

@keyframes music-done-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.4), 0 0 28px rgba(34, 197, 94, 0.55);
    transform: scale(1.03);
    filter: brightness(1.15);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes music-slot-vacate {
  from {
    background: rgba(251, 191, 36, 0.18);
    border-color: rgba(251, 191, 36, 0.45);
  }
  to {
    background: rgba(0, 0, 0, 0.18);
    border-color: var(--line);
  }
}

@keyframes music-pill-pick {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.9);
    box-shadow: 0 0 14px rgba(94, 184, 255, 0.45);
    border-color: rgba(94, 184, 255, 0.65);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes music-pill-return {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
    border-color: rgba(251, 191, 36, 0.55);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes music-progress-pop {
  0%,
  100% {
    transform: scale(1);
    color: var(--accent);
  }
  50% {
    transform: scale(1.12);
    color: #4ade80;
  }
}

.music-slot.fx-assign {
  animation: music-slot-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  border-color: rgba(94, 184, 255, 0.7);
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.28);
}

.music-slot.fx-done {
  animation: music-done-glow 0.65s ease;
  border-color: rgba(34, 197, 94, 0.65) !important;
}

.music-slot.fx-skip {
  animation: music-slot-vacate 0.38s ease;
}

.music-pill.fx-pill-pick {
  animation: music-pill-pick 0.32s ease;
}

.music-pill.fx-pill-return {
  animation: music-pill-return 0.4s ease;
}

#music-pool-progress.fx-progress {
  animation: music-progress-pop 0.42s ease;
  display: inline-block;
}

@media (prefers-reduced-motion: reduce) {
  .music-slot.fx-assign,
  .music-slot.fx-done,
  .music-slot.fx-skip,
  .music-pill.fx-pill-pick,
  .music-pill.fx-pill-return,
  #music-pool-progress.fx-progress {
    animation: none;
  }
}


.task-empty {
  color: var(--ink-dim);
  font-size: 0.9rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.todos-empty-overview {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.92rem;
}

.undo-toast {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  max-width: calc(100vw - 2rem);
  padding: 0.72rem 0.82rem 0.72rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(18, 20, 24, 0.94);
  color: var(--ink);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.undo-toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.undo-toast button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  padding: 0.42rem 0.62rem;
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.undo-toast button:hover,
.undo-toast button:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

@media (max-width: 720px) {
  .habit-stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-row {
    gap: 0.7rem;
  }

  .folder-rail {
    order: 0;
    position: sticky;
    top: 0.35rem;
    z-index: 45;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(78px, 1fr);
    gap: 0.4rem;
    width: 100%;
    max-width: none;
    padding: 0.35rem 0 0.4rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .folder-rail::-webkit-scrollbar {
    display: none;
  }

  .f-tab,
  .f-tab:first-child {
    margin-top: 0;
    min-width: 78px;
    filter: none;
  }

  .f-tab:hover,
  .f-tab:focus-visible {
    transform: translateY(-2px);
  }

  .f-ear {
    width: 100%;
    max-width: none;
    min-height: 34px;
    justify-content: center;
    padding: 0.45rem 0.5rem 0.38rem;
    border-radius: 8px 8px 0 0;
    clip-path: none;
    font-size: 0.44rem;
  }

  .f-ear i {
    display: none;
  }

  .f-body {
    height: 10px;
    border-radius: 0 0 8px 8px;
  }

  .todo-panel { order: 1; }
  .right-col { order: 2; }

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

  .notes-section-list {
    display: grid;
    gap: 0.55rem;
    max-height: none;
    padding-right: 0;
  }

  .notes-section-tab {
    width: 100%;
    min-width: 0;
    min-height: 86px;
    padding: 1.25rem 1rem 1.05rem;
  }

  .notes-section-title {
    font-size: clamp(1.55rem, 10vw, 2.45rem);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    grid-column: 1 / -1;
  }

  .notes-workspace-head {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.4rem;
  }

  .notes-workspace-head .notes-icon-btn {
    grid-column: 2;
    grid-row: 2;
  }

  .notes-workspace-head .notes-entry-add {
    grid-column: 3;
    grid-row: 2;
  }

  .notes-entry-add {
    width: 44px;
  }

  .notes-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 0.65rem;
  }

  .money-hero,
  .money-grid,
  .money-bars {
    grid-template-columns: 1fr;
  }

  .money-pulse {
    justify-self: start;
  }

  .money-plan-row {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  .money-plan-row em {
    grid-column: 1 / -1;
    text-align: left;
  }

  .money-tx {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .money-tx p {
    grid-column: 1 / -1;
  }

  .notes-undo {
    left: 1rem;
    right: 1rem;
    transform: none;
    justify-content: space-between;
  }

  .undo-toast {
    left: 1rem;
    right: 1rem;
    justify-content: space-between;
  }
}

