: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;
  --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;
}

.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: 0 auto 0.75rem;
  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;
}

.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(--pixel);
  font-size: 1.1rem;
  line-height: 1.35;
}

.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(--pixel);
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  line-height: 1.35;
}

.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;
}

.page-notes .px-label {
  text-align: center;
}

.page-note {
  width: 100%;
  min-height: min(55vh, 420px);
  resize: vertical;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  font: inherit;
  line-height: 1.55;
  text-align: left;
}

.page-note:focus {
  outline: 2px solid rgba(136, 192, 208, 0.4);
  outline-offset: 1px;
}

/* 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(4, 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: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;
}

.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);
}

.pin-frame {
  position: relative;
  margin-top: 0.35rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(circle at 70% 25%, rgba(136, 192, 208, 0.45), transparent 45%),
    linear-gradient(145deg, #0a1420, #ab0716 55%, #16283f);
}

.pin-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pin-shuffle {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  font-size: 0.75rem;
  backdrop-filter: blur(6px);
  background: rgba(19, 32, 51, 0.7);
}

/* 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-size: 0.88rem;
  font-weight: 600;
  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%;
  }
}
