:root {
  --bg: #f4f3ef;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-soft: #f7f5f1;
  --surface-tint: #f1eee8;
  --border: rgba(23, 24, 29, 0.08);
  --border-strong: rgba(23, 24, 29, 0.12);
  --text: #15171b;
  --text2: #575d68;
  --text3: #8e95a3;
  --accent: #3f6df6;
  --accent-2: #6ea2ff;
  --accent-bg: rgba(63, 109, 246, 0.1);
  --accent-text: #2f5ada;
  --success: #15936d;
  --warning: #c27a21;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 10px 30px rgba(18, 26, 40, 0.05);
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 28px 80px rgba(17, 24, 39, 0.12);
  --lifestyle: #0c9b6b;
  --lifestyle-bg: rgba(12, 155, 107, 0.1);
  --coding: #4b6ef6;
  --coding-bg: rgba(75, 110, 246, 0.11);
  --workout: #c77a18;
  --workout-bg: rgba(199, 122, 24, 0.12);
  --study: #2c6de0;
  --study-bg: rgba(44, 109, 224, 0.12);
  --general: #707885;
  --general-bg: rgba(112, 120, 133, 0.12);
  --sidebar-w: 248px;
  --topbar-h: 76px;
  --ai-panel-w: 360px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --content-w: 1240px;
}

[data-theme="dark"] {
  --bg: #0d1014;
  --bg-elevated: rgba(22, 25, 31, 0.75);
  --surface: rgba(18, 21, 27, 0.82);
  --surface-strong: #151922;
  --surface-soft: #11151c;
  --surface-tint: #0f1319;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #eef2f7;
  --text2: #b4bdc9;
  --text3: #7d8795;
  --accent: #7ea2ff;
  --accent-2: #a6bfff;
  --accent-bg: rgba(126, 162, 255, 0.14);
  --accent-text: #c9d8ff;
  --success: #30b88d;
  --warning: #e0a14b;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 12px 36px rgba(0, 0, 0, 0.22);
  --shadow: 0 20px 56px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 34px 90px rgba(0, 0, 0, 0.4);
  --lifestyle-bg: rgba(12, 155, 107, 0.16);
  --coding-bg: rgba(75, 110, 246, 0.16);
  --workout-bg: rgba(199, 122, 24, 0.18);
  --study-bg: rgba(44, 109, 224, 0.18);
  --general-bg: rgba(112, 120, 133, 0.2);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "SF Pro Display", "SF Pro Text", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(126, 162, 255, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(12, 155, 107, 0.08), transparent 24%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.hidden {
  display: none !important;
}

#authScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 420px;
  gap: 36px;
  align-items: center;
}

.auth-intro {
  padding: 32px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
  backdrop-filter: blur(18px);
}

.auth-intro h1 {
  font-size: clamp(38px, 5vw, 62px);
  line-height: 0.96;
  letter-spacing: -0.05em;
  margin-bottom: 16px;
  max-width: 9ch;
}

.auth-intro p {
  font-size: 16px;
  color: var(--text2);
  max-width: 560px;
}

.auth-points {
  display: grid;
  gap: 14px;
  margin-top: 30px;
  max-width: 560px;
}

.auth-point {
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

.auth-point span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 6px;
}

.auth-point strong {
  display: block;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 34px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  animation: fadeUp 0.28s ease both;
}

.auth-logo {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
}

.auth-logo span,
.sidebar-logo span {
  color: var(--accent);
}

.auth-sub {
  font-size: 13px;
  color: var(--text3);
  text-align: center;
  margin-bottom: 26px;
  line-height: 1.6;
}

.auth-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 11px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.auth-err {
  font-size: 13px;
  color: #d14a4a;
  background: rgba(209, 74, 74, 0.08);
  border: 1px solid rgba(209, 74, 74, 0.14);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.auth-foot {
  font-size: 12px;
  color: var(--text3);
  margin-top: 14px;
  text-align: center;
  line-height: 1.6;
}

.pass-toggle {
  position: absolute;
  right: 12px;
  bottom: 11px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.18s ease;
}

.pass-toggle:hover {
  color: var(--text);
}

.app {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  inset: 18px auto 18px 18px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  z-index: 100;
}

.sidebar-top {
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.sidebar-copy {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link,
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.nav-link {
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 700;
}

.nav-link:hover,
.sidebar-user:hover {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text);
  transform: translateY(-1px);
}

.nav-link.active {
  background: var(--accent-bg);
  border-color: rgba(63, 109, 246, 0.18);
  color: var(--accent-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-bottom {
  padding: 12px 10px 14px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.ai-link {
  color: var(--accent-text);
}

.sidebar-user {
  padding: 12px;
  background: var(--surface-soft);
  border-color: var(--border);
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 10px 22px rgba(63, 109, 246, 0.24);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  display: block;
  max-width: 100%;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

.main {
  flex: 1;
  min-height: 100vh;
  margin-left: calc(var(--sidebar-w) + 36px);
  margin-right: 0;
  padding-right: 28px;
  transition: margin-right 0.3s ease, padding-right 0.3s ease;
}

.app.ai-open .main {
  margin-right: calc(var(--ai-panel-w) + 28px);
  padding-right: 22px;
}

.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(var(--content-w), 100%);
  margin: 0 auto;
  padding: 20px 4px 12px;
  background:
    linear-gradient(to bottom, var(--bg) 0%, var(--bg) 76%, rgba(244, 243, 239, 0) 100%);
  transition: width 0.3s ease, transform 0.3s ease;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-page {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.topbar-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
}

.ai-pill,
.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-xs);
}

.ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--accent-text);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.ai-pill:hover {
  background: var(--accent-bg);
  border-color: rgba(63, 109, 246, 0.22);
  transform: translateY(-1px);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.icon-btn:hover {
  color: var(--text);
  transform: translateY(-1px);
}

#pageContent {
  width: min(var(--content-w), 100%);
  margin: 0 auto;
  padding-bottom: 42px;
  transition: width 0.3s ease, transform 0.3s ease;
}

.app.ai-open .topbar,
.app.ai-open #pageContent {
  transform: translateX(-4px);
}

.page {
  animation: none;
}

.page.page-anim {
  animation: fadeUp 0.24s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.page-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-toolbar-copy {
  min-width: 0;
}

.section-title {
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.section-sub {
  font-size: 14px;
  color: var(--text3);
  margin-top: 8px;
  line-height: 1.6;
  max-width: 740px;
}

.page-title {
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.page-sub {
  font-size: 14px;
  color: var(--text3);
  margin-top: 8px;
  line-height: 1.6;
}

.page-section {
  margin-top: 26px;
}

.surface-card,
.dash-ring-row,
.goal-card,
.note-item,
.habit-item,
.empty,
.modal,
.info-box,
.dash-panel,
.dash-side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 14px 28px rgba(63, 109, 246, 0.2);
}

.btn-outline,
.btn-ghost,
.btn-danger {
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.btn-outline {
  color: var(--text);
}

.btn-outline:hover,
.btn-ghost:hover {
  background: var(--surface-soft);
}

.btn-ghost {
  color: var(--text2);
}

.btn-danger {
  color: #d14a4a;
  border-color: rgba(209, 74, 74, 0.16);
  background: rgba(209, 74, 74, 0.04);
}

.btn-danger:hover {
  background: rgba(209, 74, 74, 0.08);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12.5px;
  border-radius: 12px;
}

.btn-icon {
  min-width: 36px;
  padding-inline: 8px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none !important;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text2);
}

.form-input,
.search-input,
.ai-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  -webkit-appearance: none;
}

.notebook-body {
  min-height: 460px;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.emoji-chip {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  font-size: 18px;
}

.emoji-chip:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.form-input:focus,
.search-input:focus,
.ai-input:focus {
  outline: none;
  border-color: rgba(63, 109, 246, 0.4);
  box-shadow: 0 0 0 4px rgba(63, 109, 246, 0.08);
}

textarea.form-input {
  min-height: 120px;
  resize: vertical;
  line-height: 1.7;
}

select.form-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e95a3' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 18, 0.34);
  backdrop-filter: blur(10px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}

.modal {
  width: 100%;
  max-width: 470px;
  border-radius: 28px;
  padding: 28px;
  animation: slideUp 0.22s cubic-bezier(.22, .68, 0, 1.08);
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 18px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-lifestyle { background: var(--lifestyle-bg); color: var(--lifestyle); }
.badge-coding { background: var(--coding-bg); color: var(--coding); }
.badge-workout { background: var(--workout-bg); color: var(--workout); }
.badge-study { background: var(--study-bg); color: var(--study); }
.badge-general { background: var(--general-bg); color: var(--general); }

.prog-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-tint);
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.65s cubic-bezier(.22, .68, 0, 1);
}

.dash-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.88fr);
  gap: 24px;
  align-items: start;
}

.dash-main,
.dash-side {
  display: grid;
  gap: 18px;
}

.dash-greeting {
  margin-bottom: 2px;
}

.dash-greeting-name {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.98;
}

.dash-greeting-date {
  font-size: 14px;
  color: var(--text3);
  margin-top: 10px;
}

.dash-panel {
  border-radius: 28px;
  padding: 22px;
}

.dash-ring-row {
  border-radius: 28px;
  padding: 24px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ring-center strong {
  font-size: 16px;
  line-height: 1;
}

.ring-center span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-top: 4px;
}

.dash-ring-title,
.sec-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
}

.dash-ring-val {
  font-size: 42px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
  margin-top: 8px;
}

.dash-ring-sub {
  font-size: 14px;
  color: var(--text2);
  margin-top: 8px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.dash-stat {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.dash-stat-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
}

.dash-stat-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}

.dash-stat-val {
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.dash-stat-text {
  font-size: 13px;
  color: var(--text2);
}

.dash-side-card {
  border-radius: 24px;
  padding: 20px;
}

.dash-side-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.dash-side-copy {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.6;
  margin-top: 6px;
}

.dash-side-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.dash-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.dash-mini-row strong {
  font-size: 13px;
}

.dash-mini-row span {
  font-size: 12px;
  color: var(--text3);
}

.dash-mini-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sec-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  margin-top: 8px;
}

.sec-action {
  border: none;
  background: none;
  color: var(--accent-text);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 800;
  transition: opacity 0.16s ease;
}

.sec-action:hover {
  opacity: 0.72;
}

.habit-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  margin-bottom: 10px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.habit-item:hover,
.goal-card:hover,
.note-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.habit-item.done {
  opacity: 0.72;
}

.habit-item.done .habit-name {
  text-decoration: line-through;
  color: var(--text3);
}

.hcheck {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-strong);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  transition: all 0.22s cubic-bezier(.22, .68, 0, 1.05);
}

.hcheck:hover {
  border-color: var(--accent);
  transform: scale(1.04);
}

.hcheck.checked {
  animation: checkPop 0.3s cubic-bezier(.22, .68, 0, 1.05) both;
}

@keyframes checkPop {
  0% { transform: scale(0.76); }
  62% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

.habit-emoji {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-size: 18px;
  flex-shrink: 0;
}

.habit-info {
  flex: 1;
  min-width: 0;
}

.habit-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.habit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--warning);
}

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

.goal-card {
  border-radius: 22px;
  padding: 18px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.goal-card.done-card {
  opacity: 0.68;
}

.goal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.goal-emoji {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-size: 22px;
  margin-bottom: 12px;
}

.goal-name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.goal-prog-txt {
  font-size: 13px;
  color: var(--text2);
  margin-top: 6px;
}

.goal-pct {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.goal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.goal-complete {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--success);
}

.note-item {
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 10px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.notebook-entry {
  border-left-color: transparent !important;
}

.notes-stack {
  display: grid;
  gap: 12px;
}

.notebook-composer {
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 18px;
}

.notebook-composer-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.notebook-composer-sub {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.6;
  margin-top: 6px;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.activity-note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 18px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.activity-note-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.activity-note-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.activity-note-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.ai-page {
  border-radius: 28px;
  padding: 22px;
}

.ai-page-messages {
  min-height: 420px;
  max-height: 58vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 10px;
}

.ai-page-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.note-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.note-preview {
  font-size: 13.5px;
  color: var(--text2);
  line-height: 1.65;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.note-date {
  font-size: 11.5px;
  color: var(--text3);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.fpill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
  color: var(--text2);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.fpill:hover {
  transform: translateY(-1px);
  background: var(--surface-strong);
}

.fpill.active {
  background: var(--accent-bg);
  border-color: rgba(63, 109, 246, 0.18);
  color: var(--accent-text);
}

.search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.search-ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}

.search-input {
  padding-left: 36px;
}

.info-box {
  padding: 16px 18px;
  border-radius: 18px;
  margin-bottom: 16px;
}

.info-box-sub {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 4px;
}

.info-box-val {
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.num-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.num-row .form-input {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.num-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  color: var(--text2);
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.num-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
  transform: translateY(-1px);
}

.log-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  margin-bottom: 6px;
  font-size: 12.5px;
}

.log-date {
  color: var(--text3);
}

.log-val {
  font-weight: 800;
}

.log-note {
  color: var(--text2);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  border-radius: 28px;
  padding: 44px 28px;
  text-align: center;
}

.empty-icon {
  font-size: 34px;
  margin-bottom: 12px;
  opacity: 0.72;
}

.empty-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.empty-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text3);
  line-height: 1.7;
}

.ai-panel {
  position: fixed;
  top: 20px;
  right: 24px;
  bottom: 24px;
  width: var(--ai-panel-w);
  max-width: min(var(--ai-panel-w), calc(100vw - 48px));
  max-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  transform: translateX(calc(100% + 32px));
  transition: transform 0.28s cubic-bezier(.22, .68, 0, 1.02);
  z-index: 90;
}

.ai-panel.open {
  transform: translateX(0);
}

.ai-hd {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.ai-hd-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
}

.ai-intro {
  padding: 16px 18px 0;
}

.ai-intro-title {
  font-size: 13px;
  font-weight: 800;
}

.ai-intro-text {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.6;
  margin-top: 4px;
}

.ai-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-msg {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.65;
  animation: fadeUp 0.18s ease both;
}

.ai-msg.user {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-bottom-right-radius: 6px;
}

.ai-msg.assistant {
  align-self: flex-start;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.ai-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text3);
  animation: blink 1.2s infinite;
}

.ai-dot:nth-child(2) { animation-delay: 0.18s; }
.ai-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.28; }
  40% { opacity: 1; }
}

.ai-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
}

.ai-send {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(63, 109, 246, 0.22);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.ai-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.ai-no-key {
  padding-top: 6px;
  font-size: 12px;
  text-align: center;
  color: var(--text3);
  line-height: 1.6;
}

.ai-no-key b {
  color: var(--accent-text);
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  padding: 11px 16px;
  border-radius: 14px;
  background: rgba(19, 21, 27, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.mob-nav {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: none;
  padding: 8px;
  gap: 6px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  z-index: 200;
  overflow-x: auto;
  scrollbar-width: none;
}

.mob-nav::-webkit-scrollbar {
  display: none;
}

[data-theme="dark"] .mob-nav {
  background: rgba(18, 21, 27, 0.88);
}

.mob-tab {
  flex: 0 0 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0 7px;
  border: none;
  background: transparent;
  border-radius: 16px;
  cursor: pointer;
  color: var(--text3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.mob-tab.active {
  background: var(--accent-bg);
  color: var(--accent-text);
}

.mob-icon {
  width: 18px;
  height: 18px;
}

@media (max-width: 1180px) {
  :root {
    --sidebar-w: 226px;
    --ai-panel-w: 330px;
  }

  .dash-layout {
    grid-template-columns: 1fr;
  }

  .dash-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell {
    grid-template-columns: 1fr 400px;
  }
}

@media (max-width: 900px) {
  #authScreen {
    padding: 20px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .auth-intro {
    padding: 8px 0;
  }

  .auth-intro h1,
  .auth-intro p,
  .auth-points {
    max-width: none;
  }

  .sidebar {
    transform: translateX(-120%);
    pointer-events: none;
  }

  .main {
    margin-left: 0;
    margin-right: 0;
    padding: 0 16px;
  }

  .topbar,
  #pageContent {
    width: 100%;
  }

  .topbar {
    height: auto;
    padding: 18px 0 14px;
  }

  .topbar-page {
    font-size: 26px;
  }

  .ai-pill {
    display: none;
  }

  .mob-nav {
    display: flex;
  }

  .mob-nav.hidden {
    display: none !important;
  }

  .page {
    padding-bottom: 98px;
  }

  .app.ai-open .main {
    margin-right: 0;
    padding-right: 16px;
  }

  .app.ai-open .topbar,
  .app.ai-open #pageContent {
    transform: none;
  }

  .ai-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: none;
    height: min(78vh, 720px);
    border-radius: 28px 28px 0 0;
    transform: translateY(105%);
  }

  .ai-panel.open {
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .dash-stats,
  .dash-side,
  .grid2 {
    grid-template-columns: 1fr;
  }

  .dash-ring-row {
    grid-template-columns: 1fr;
  }

  .goal-top,
  .page-toolbar,
  .page-hd,
  .note-footer,
  .modal-footer {
    align-items: stretch;
  }

  .page-title {
    font-size: 28px;
  }

  .auth-card {
    padding: 26px 22px;
    border-radius: 24px;
  }

  .dash-panel,
  .dash-side-card,
  .goal-card,
  .habit-item,
  .note-item,
  .empty,
  .modal {
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
