/* ==========================================================================
   Pulse Habits — base design system
   Kinetic Obsidian Precision: deep slate glass, neon telemetry accents.
   ========================================================================== */

:root {
  --bg: #090d16;
  --bg-deep: #060910;
  --surface: #0f172a;
  --surface-2: #131c2e;
  --surface-3: #1e293b;
  --surface-4: #26324a;
  --surface-glass: rgba(30, 41, 59, 0.82);

  /* Theme plumbing — every translucent tint derives from this channel triple. */
  --tint-rgb: 255, 255, 255;
  --shell-grad-a: #0b101c;
  --shell-grad-b: #080c14;
  --input-bg: #080c14;
  --input-bg-focus: #0a0f1a;
  --topbar-bg: rgba(9, 13, 22, 0.74);
  --nav-bg: rgba(8, 12, 20, 0.94);
  --modal-bg: rgba(15, 23, 42, 0.97);
  --overlay-bg: rgba(3, 6, 12, 0.72);
  --overlay-bg-soft: rgba(3, 6, 12, 0.66);
  --menu-bg: rgba(23, 32, 51, 0.96);
  --tooltip-bg: rgba(15, 23, 42, 0.97);
  --tooltip-text: #dbe3f2;
  --tooltip-border: rgba(255, 255, 255, 0.14);
  --chart-track: rgba(255, 255, 255, 0.08);
  --chart-grid: rgba(255, 255, 255, 0.05);
  --shadow-hover: 0 26px 50px -30px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.03);

  --border: rgba(var(--tint-rgb), 0.07);
  --border-strong: rgba(var(--tint-rgb), 0.13);
  --border-faint: rgba(var(--tint-rgb), 0.04);

  --text: #e6eaf4;
  --text-soft: #cfd6e4;
  --muted: #aab6ca;
  --dim: #95a1b6;
  --faint: #7f8ba0;

  --accent: #10b981;
  --accent-rgb: 16, 185, 129;
  --accent-bright: #4edea3;
  --accent-soft: #6ffbbe;
  --accent-contrast: #04231a;
  --emerald: var(--accent);
  --emerald-bright: var(--accent-bright);
  --emerald-soft: var(--accent-soft);
  --indigo: #8b93f8;
  --indigo-bright: #b4bdfd;
  --cyan: #06b6d4;
  --cyan-bright: #4cd7f6;
  --amber: #f59e0b;
  --amber-bright: #fbbf24;
  --rose: #fb7185;
  --violet: #a78bfa;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-display: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;

  --shadow-card: 0 18px 40px -28px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(var(--tint-rgb), 0.035);
  --shadow-pop: 0 30px 60px -20px rgba(0, 0, 0, 0.85);
  --sidebar-w: 280px;
  --topbar-h: 64px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 560px at 82% -12%, rgba(var(--accent-rgb), 0.075), transparent 62%),
    radial-gradient(900px 520px at 12% 112%, rgba(99, 102, 241, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body.modal-open {
  overflow: hidden;
}

::selection {
  background: rgba(var(--accent-rgb), 0.28);
  color: #fff;
}

h1, h2, h3, h4, p {
  margin: 0;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.85);
  outline-offset: 2px;
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(var(--tint-rgb), 0.1);
  border-radius: 999px;
  border: 3px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--tint-rgb), 0.18);
}

/* Material Symbols ---------------------------------------------------- */

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.icons-ready .material-symbols-outlined {
  opacity: 1;
}

.material-symbols-outlined.fill {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* Typography helpers -------------------------------------------------- */

.font-display {
  font-family: var(--font-display);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.label-mono,
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.emerald { color: var(--accent-bright); }
.cyan { color: var(--cyan-bright); }
.amber { color: var(--amber-bright); }
.rose { color: var(--rose); }
.indigo { color: var(--indigo-bright); }

.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.strong { font-weight: 600; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.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;
}

/* Layout utilities ---------------------------------------------------- */

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

.row-top {
  align-items: flex-start;
}

.between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.center { text-align: center; }

.gap-2 { gap: 2px; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ==========================================================================
   Shell
   ========================================================================== */

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 18px 18px;
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(var(--accent-rgb), 0.06), transparent 70%),
    linear-gradient(180deg, var(--shell-grad-a) 0%, var(--shell-grad-b) 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-faint);
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.075), rgba(var(--tint-rgb), 0.018) 62%);
  box-shadow: inset 0 1px 0 rgba(var(--tint-rgb), 0.045);
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent-bright);
  background: linear-gradient(145deg, rgba(var(--accent-rgb), 0.2), rgba(6, 182, 212, 0.06));
  border: 1px solid rgba(var(--accent-rgb), 0.32);
  box-shadow: 0 0 26px -8px rgba(var(--accent-rgb), 0.65), inset 0 1px 0 rgba(var(--tint-rgb), 0.12);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.22em;
  color: var(--dim);
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section {
  padding: 10px 12px 4px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--faint);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: background 0.16s, color 0.16s;
}

.nav-item .material-symbols-outlined {
  font-size: 20px;
  color: var(--dim);
  transition: color 0.16s;
}

.nav-item:hover {
  background: rgba(var(--tint-rgb), 0.04);
  color: var(--text);
}

.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(var(--tint-rgb), 0.075), rgba(var(--tint-rgb), 0.025));
  box-shadow: inset 0 1px 0 rgba(var(--tint-rgb), 0.05), inset 0 0 0 1px rgba(var(--tint-rgb), 0.03);
}

.nav-item.active .material-symbols-outlined {
  color: var(--accent-bright);
}

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(var(--tint-rgb), 0.06);
  color: var(--muted);
}

.nav-item.active .nav-badge {
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-bright);
}

.sidebar-spacer {
  flex: 1;
  min-height: 12px;
}

.account-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-align: left;
  transition: background 0.16s, border-color 0.16s;
}

.account-mini:hover {
  background: rgba(var(--tint-rgb), 0.03);
  border-color: var(--border);
}

.account-mini .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.account-mini-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.account-mini-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-mini-sub {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: var(--dim);
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-mini-sub.is-email {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 9.5px;
}

.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar -------------------------------------------------------------- */

/* Sticky, but with no bar of its own: only the button group has a frosted backing, so the
   page shows through everywhere else. The empty strip doesn't catch clicks. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  background: transparent;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.topbar-right {
  padding: 5px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 10px 28px -20px rgba(0, 0, 0, 0.6);
}

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

.mobile-brand {
  display: none;
  align-items: center;
  gap: 9px;
  margin-right: 2px;
}

.mobile-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.mobile-brand .brand-name {
  font-size: 17px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  width: 300px;
  max-width: 34vw;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--dim);
  font-size: 12px;
  text-align: left;
  transition: border-color 0.16s, background 0.16s;
}

.search-trigger:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--muted);
}

.search-trigger .material-symbols-outlined {
  font-size: 18px;
}

.search-trigger span:nth-child(2) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kbd {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(var(--tint-rgb), 0.07);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), 0.09);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s;
}

.streak-chip:hover {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: rgba(var(--accent-rgb), 0.35);
}

.streak-chip .material-symbols-outlined {
  font-size: 15px;
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(var(--tint-rgb), 0.02);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.sync-chip .material-symbols-outlined {
  font-size: 16px;
}

.sync-chip.ok { color: var(--accent-bright); border-color: rgba(var(--accent-rgb), 0.25); }
.sync-chip.busy { color: var(--cyan-bright); border-color: rgba(6, 182, 212, 0.25); }
.sync-chip.err { color: var(--rose); border-color: rgba(251, 113, 133, 0.25); }

.icon-btn {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.icon-btn:hover {
  background: rgba(var(--tint-rgb), 0.05);
  color: var(--text);
  border-color: var(--border);
}

.icon-btn .material-symbols-outlined {
  font-size: 19px;
}

.avatar-btn {
  border-radius: 50%;
  padding: 0;
  line-height: 0;
  transition: transform 0.16s;
}

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

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.62), rgba(var(--accent-rgb), 0.48));
  border: 1px solid rgba(var(--tint-rgb), 0.22);
  box-shadow: 0 0 0 3px rgba(var(--tint-rgb), 0.035), inset 0 1px 0 rgba(var(--tint-rgb), 0.22);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-wrap {
  position: relative;
  display: inline-flex;
}

.avatar-status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.8);
}

.avatar-status.off {
  background: var(--faint);
  box-shadow: none;
}

/* Main view ----------------------------------------------------------- */

.view {
  flex: 1;
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 22px 32px 44px;
}

.view-enter {
  animation: view-in 0.28s var(--ease);
}

.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.page-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.page-sub {
  color: var(--muted);
  font-size: 13px;
  max-width: 620px;
  line-height: 1.6;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Components
   ========================================================================== */

.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(var(--tint-rgb), 0.024), rgba(var(--tint-rgb), 0) 42%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.card-pad {
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .material-symbols-outlined {
  font-size: 18px;
  color: var(--accent-bright);
}

.card-sub {
  color: var(--dim);
  font-size: 11.5px;
  margin-top: 3px;
}

.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

/* Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, box-shadow 0.16s, transform 0.16s, color 0.16s;
}

.btn .material-symbols-outlined {
  font-size: 18px;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 0 20px -6px rgba(var(--accent-rgb), 0.55), inset 0 1px 0 rgba(var(--tint-rgb), 0.28);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-bright);
  box-shadow: 0 0 28px -5px rgba(var(--accent-rgb), 0.7), inset 0 1px 0 rgba(var(--tint-rgb), 0.32);
}

.btn-indigo {
  background: var(--indigo);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(var(--tint-rgb), 0.2), 0 8px 22px -12px rgba(99, 102, 241, 0.8);
}

.btn-indigo:hover:not(:disabled) {
  background: #7c7ff5;
}

.btn-ghost {
  background: rgba(var(--tint-rgb), 0.03);
  border-color: var(--border);
  color: var(--text-soft);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(var(--tint-rgb), 0.07);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-quiet {
  background: transparent;
  color: var(--muted);
}

.btn-quiet:hover:not(:disabled) {
  background: rgba(var(--tint-rgb), 0.05);
  color: var(--text);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.3);
  color: #fecdd3;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(251, 113, 133, 0.2);
  border-color: rgba(251, 113, 133, 0.45);
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: 7px;
}

.btn-sm .material-symbols-outlined {
  font-size: 16px;
}

.btn-lg {
  height: 44px;
  padding: 0 20px;
  font-size: 13.5px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.btn-icon:hover {
  background: rgba(var(--tint-rgb), 0.06);
  color: var(--text);
  border-color: var(--border);
}

.btn-icon .material-symbols-outlined {
  font-size: 19px;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-rgb), 0.07)),
    var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  box-shadow:
    0 12px 26px -20px rgba(var(--accent-rgb), 0.5),
    inset 0 1px 0 rgba(var(--tint-rgb), 0.1);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.2s ease,
    transform 0.18s var(--ease);
}

.google-btn:hover:not(:disabled) {
  border-color: rgba(var(--accent-rgb), 0.55);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.24), rgba(var(--accent-rgb), 0.11)),
    var(--surface-2);
  box-shadow:
    0 16px 32px -20px rgba(var(--accent-rgb), 0.6),
    inset 0 1px 0 rgba(var(--tint-rgb), 0.12);
  transform: translateY(-1px);
}

.google-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.995);
}

.google-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.google-btn .spinner {
  margin-right: 2px;
}

.google-g {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.18s var(--ease);
}

.btn .google-g {
  width: 15px;
  height: 15px;
}

.google-btn:hover .google-g {
  transform: scale(1.06);
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(var(--tint-rgb), 0.25);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* Chips, badges, tags ------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(var(--tint-rgb), 0.05);
  color: var(--muted);
  white-space: nowrap;
}

.chip .material-symbols-outlined {
  font-size: 12px;
}

.chip-emerald {
  background: rgba(var(--accent-rgb), 0.12);
  color: #6ee7b7;
}

.chip-cyan {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan-bright);
}

.chip-indigo {
  background: rgba(99, 102, 241, 0.16);
  color: var(--indigo-bright);
}

.chip-amber {
  background: rgba(245, 158, 11, 0.13);
  color: var(--amber-bright);
}

.chip-rose {
  background: rgba(251, 113, 133, 0.13);
  color: #fda4af;
}

.chip-violet {
  background: rgba(167, 139, 250, 0.14);
  color: #c4b5fd;
}

.chip-muted {
  background: rgba(var(--tint-rgb), 0.045);
  color: var(--dim);
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}

/* Segmented controls / filter chips ----------------------------------- */

.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: rgba(var(--tint-rgb), 0.035);
  border: 1px solid var(--border);
}

.seg-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s;
}

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

.seg-btn.active {
  background: rgba(var(--tint-rgb), 0.09);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(var(--tint-rgb), 0.08);
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.filter-chip:hover {
  color: var(--text-soft);
  background: rgba(var(--tint-rgb), 0.04);
}

.filter-chip.active {
  color: var(--accent-bright);
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.22);
}

.filter-chip .material-symbols-outlined {
  font-size: 14px;
}

/* Inputs -------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.field-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid rgba(var(--tint-rgb), 0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  height: 40px;
  padding: 0 12px;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
  background: var(--input-bg-focus);
}

.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
  border-color: rgba(251, 113, 133, 0.6);
}

.input:disabled,
.select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  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='%2393a1b7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.select option {
  background: var(--surface-3);
  color: var(--text);
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .material-symbols-outlined {
  position: absolute;
  left: 11px;
  font-size: 17px;
  color: var(--dim);
  pointer-events: none;
}

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

.help {
  font-size: 11px;
  color: var(--dim);
  line-height: 1.55;
}

.field-error {
  font-size: 11px;
  color: var(--rose);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(var(--tint-rgb), 0.018);
}

.form-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.form-section-title .step-num {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent-bright);
  background: rgba(var(--accent-rgb), 0.12);
  border-radius: 4px;
  padding: 2px 5px;
}

.form-section-sub {
  font-size: 11px;
  color: var(--dim);
  line-height: 1.5;
}

/* Toggle switch ------------------------------------------------------- */

.toggle {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(var(--tint-rgb), 0.1);
  border: 1px solid rgba(var(--tint-rgb), 0.1);
  transition: background 0.18s, border-color 0.18s;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 0.18s var(--ease), background 0.18s;
}

.toggle[aria-checked='true'] {
  background: rgba(var(--accent-rgb), 0.3);
  border-color: rgba(var(--accent-rgb), 0.5);
}

.toggle[aria-checked='true']::after {
  transform: translateX(16px);
  background: var(--accent-bright);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.7);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-faint);
}

.toggle-row:last-child {
  border-bottom: 0;
}

.toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-copy strong {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
}

.toggle-copy span {
  font-size: 11px;
  color: var(--dim);
}

/* Progress / rings / charts ------------------------------------------- */

.progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(var(--tint-rgb), 0.06);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s var(--ease);
}

.ring {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.ring-svg {
  width: 100%;
  height: 100%;
}

.ring-value {
  transition: stroke-dashoffset 0.6s var(--ease);
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.ring-label small {
  font-size: 7px;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-top: 2px;
  text-transform: uppercase;
}

.donut {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.donut svg {
  width: 100%;
  height: 100%;
}

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

.donut-center strong {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.donut-center span {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.chart {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-labels {
  display: grid;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--dim);
  text-transform: uppercase;
}

.chart-labels span {
  white-space: nowrap;
}

.chart-labels span:last-child {
  text-align: right;
}

/* Completion Trend — daily columns + 7-day rolling average on a 0–100% axis.
   The y labels sit beside the plot so their percentages line up with the
   gridlines at the same offsets. */
.trend-chart {
  gap: 7px;
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

.trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trend-key {
  flex: none;
  display: inline-block;
}

.trend-key-bar {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.75;
}

.trend-key-line {
  width: 14px;
  height: 0;
  border-top: 2px solid var(--cyan-bright);
  border-radius: 2px;
}

.trend-plot {
  position: relative;
  display: flex;
  gap: 8px;
  height: var(--trend-h, 172px);
}

.trend-y {
  position: relative;
  flex: none;
  width: 28px;
}

.trend-y span {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--dim);
  white-space: nowrap;
}

.trend-area {
  position: relative;
  flex: 1;
  min-width: 0;
}

.trend-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.trend-now {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--cyan-bright);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan-bright) 24%, transparent);
}

@media (max-width: 720px) {
  .trend-plot {
    height: 150px;
  }

  .trend-y {
    width: 26px;
  }
}

.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 26px;
}

.mini-bars span {
  flex: 1;
  border-radius: 1.5px;
  opacity: 0.75;
  min-height: 3px;
}

.mini-heat {
  display: flex;
  gap: 3px;
}

.mini-heat span {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: rgba(var(--tint-rgb), 0.07);
}

.sparkline {
  width: 120px;
  height: 32px;
}

/* Heatmap ------------------------------------------------------------- */

.heatmap {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.heatmap-months {
  display: grid;
  grid-template-columns: repeat(var(--weeks), minmax(0, 1fr));
  gap: 3px;
  margin-left: 30px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-transform: uppercase;
}

.heatmap-months span {
  white-space: nowrap;
  overflow: hidden;
}

.heatmap-body {
  display: flex;
  gap: 6px;
}

.heatmap-daylabels {
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 3px;
  width: 24px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--dim);
  align-items: center;
}

.heatmap-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--weeks), minmax(0, 1fr));
  gap: 3px;
  min-width: 0;
}

.heat-week {
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.heat-cell {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 2.5px;
  background: rgba(var(--tint-rgb), 0.055);
  position: relative;
}

.heat-cell.l1 { background: rgba(var(--accent-rgb), 0.22); }
.heat-cell.l2 { background: rgba(var(--accent-rgb), 0.42); }
.heat-cell.l3 { background: rgba(var(--accent-rgb), 0.68); }
.heat-cell.l4 { background: var(--accent); }

.heat-cell.l4.over {
  background: #06b6d4;
  box-shadow: 0 0 7px rgba(6, 182, 212, 0.55);
}

.heat-cell.future {
  background: rgba(var(--tint-rgb), 0.02);
}

.heat-cell:hover {
  outline: 1px solid rgba(var(--tint-rgb), 0.55);
  outline-offset: 0;
}

.heatmap-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.heatmap-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

.heatmap-note .material-symbols-outlined {
  font-size: 14px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-transform: uppercase;
}

.heatmap-legend span {
  margin: 0 3px;
}

.heatmap-legend .heat-cell {
  width: 11px;
  height: 11px;
  aspect-ratio: auto;
}

.cadence-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 190px;
  padding-top: 18px;
}

.cadence-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  height: 100%;
  min-width: 0;
}

.cadence-value {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--dim);
  white-space: nowrap;
}

.cadence-track {
  flex: 1;
  width: 100%;
  max-width: 42px;
  display: flex;
  align-items: flex-end;
  border-radius: 4px;
  background: rgba(var(--tint-rgb), 0.025);
  overflow: hidden;
}

.cadence-track > span {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  transition: height 0.5s var(--ease);
  min-height: 2px;
}

.cadence-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.cadence-bar.is-today .cadence-label {
  color: var(--accent-bright);
}

.cadence-bar.is-today .cadence-value {
  color: var(--text-soft);
}

/* Stats --------------------------------------------------------------- */

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

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(var(--tint-rgb), 0.025), rgba(var(--tint-rgb), 0)), var(--surface);
  min-width: 0;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
}

.stat-top .material-symbols-outlined {
  font-size: 17px;
  color: var(--dim);
}

.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 27px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--dim);
}

.stat-foot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--dim);
}

.stat-foot .material-symbols-outlined {
  font-size: 13px;
}

.stat-foot.up { color: var(--accent-bright); }
.stat-foot.down { color: var(--rose); }

/* Empty state --------------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 46px 24px;
  text-align: center;
  border: 1px dashed rgba(var(--tint-rgb), 0.12);
  border-radius: var(--radius-lg);
  background: rgba(var(--tint-rgb), 0.012);
}

.empty-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  color: var(--accent-bright);
  margin-bottom: 4px;
}

.empty-icon .material-symbols-outlined {
  font-size: 22px;
}

.empty h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.empty p {
  font-size: 12px;
  color: var(--dim);
  max-width: 340px;
  line-height: 1.6;
}

.empty .btn {
  margin-top: 6px;
}

/* Modal --------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay-bg);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(var(--tint-rgb), 0.11);
  background:
    linear-gradient(180deg, rgba(var(--tint-rgb), 0.04), rgba(var(--tint-rgb), 0) 30%),
    var(--modal-bg);
  box-shadow: 0 40px 90px -24px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(var(--tint-rgb), 0.09);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.24s var(--ease);
  overflow: hidden;
}

.modal-backdrop.open .modal {
  transform: none;
}

.modal-sm { max-width: 430px; }
.modal-md { max-width: 580px; }
.modal-lg { max-width: 780px; }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 0;
  flex-shrink: 0;
}

.modal-heading {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.modal-eyebrow {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
}

.modal-close {
  margin: -4px -6px 0 0;
  flex-shrink: 0;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-body > *:first-child {
  margin-top: 0;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: rgba(var(--tint-rgb), 0.012);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.modal-foot .foot-note {
  margin-right: auto;
  font-size: 10.5px;
  color: var(--dim);
}

.confirm-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 2px 0 6px;
}

.confirm-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: var(--amber-bright);
  flex-shrink: 0;
}

.confirm-icon.danger {
  background: rgba(251, 113, 133, 0.1);
  border-color: rgba(251, 113, 133, 0.25);
  color: var(--rose);
}

.confirm-body p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  padding-top: 7px;
}

/* Toasts -------------------------------------------------------------- */
/* Raised cards centred at the bottom: a tinted icon tile, the message, an optional action
   button, and a thin bar along the bottom edge that counts down the time left. Hover to pause. */

.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 22px;
  z-index: 200;
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  --tone: var(--cyan);
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(460px, 100%);
  padding: 8px 16px 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--menu-bg);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-pop);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.toast:has(.toast-action) {
  padding-right: 8px;
}

.toast-success { --tone: var(--accent); }
.toast-error { --tone: var(--rose); }
.toast-warning { --tone: var(--amber); }
.toast-info { --tone: var(--cyan); }

.toast-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--tone) 15%, transparent);
  color: var(--tone);
}

.toast-icon .material-symbols-outlined {
  font-size: 17px;
}

.toast-text {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  color: var(--text-soft);
}

.toast-action {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 9px;
  border: 0;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-bright);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.25s var(--ease-out-back, var(--ease));
}

.toast-action:hover {
  background: rgba(var(--accent-rgb), 0.24);
}

.toast-action:active {
  transform: scale(0.96);
}

.toast-timer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  transform-origin: left;
  background: color-mix(in srgb, var(--tone) 55%, transparent);
}
/* Popover menu -------------------------------------------------------- */

.menu-pop {
  position: fixed;
  z-index: 150;
  min-width: 190px;
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--menu-bg);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.14s ease, transform 0.14s var(--ease);
}

.menu-in {
  opacity: 1;
  transform: none;
}

.menu-out {
  opacity: 0;
  transform: scale(0.97);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 12px;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.menu-item:hover {
  background: rgba(var(--tint-rgb), 0.07);
  color: var(--text);
}

.menu-item .material-symbols-outlined {
  font-size: 17px;
  color: var(--dim);
}

.menu-item.is-danger {
  color: #fda4af;
}

.menu-item.is-danger .material-symbols-outlined {
  color: #fb7185;
}

.menu-item.is-danger:hover {
  background: rgba(251, 113, 133, 0.1);
}

.menu-sep {
  height: 1px;
  background: var(--border);
  margin: 5px 4px;
}

/* Tooltips are rendered by js/tooltip.js into a floating, viewport-aware layer
   (see css/enhance.css) so they never get clipped by overflow containers. */

/* Mobile nav ---------------------------------------------------------- */

.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 2px;
  border-radius: 8px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 0;
}

.mobile-nav-item .material-symbols-outlined {
  font-size: 21px;
}

.mobile-nav-item.active {
  color: var(--accent-bright);
  background: rgba(var(--accent-rgb), 0.07);
}

/* Command palette ----------------------------------------------------- */

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14vh 20px 20px;
  background: var(--overlay-bg-soft);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.palette-backdrop.open {
  opacity: 1;
}

.palette {
  width: 100%;
  max-width: 620px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--menu-bg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  transform: translateY(-10px) scale(0.99);
  transition: transform 0.2s var(--ease);
}

.palette-backdrop.open .palette {
  transform: none;
}

.palette-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.palette-input .material-symbols-outlined {
  color: var(--accent-bright);
  font-size: 20px;
}

.palette-input input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
  color: var(--text);
}

.palette-input input::placeholder {
  color: var(--faint);
}

.palette-results {
  max-height: min(440px, 58vh);
  overflow-y: auto;
  padding: 6px;
}

.palette-group {
  padding: 9px 10px 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  text-align: left;
  color: var(--text-soft);
  font-size: 12.5px;
}

.palette-item .material-symbols-outlined {
  font-size: 18px;
  color: var(--dim);
}

.palette-item .palette-hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
  text-transform: uppercase;
}

.palette-item.active,
.palette-item:hover {
  background: rgba(var(--tint-rgb), 0.065);
  color: var(--text);
}

.palette-item.active .material-symbols-outlined {
  color: var(--accent-bright);
}

.palette-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
}

.palette-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--faint);
  text-transform: uppercase;
}

/* Animations ---------------------------------------------------------- */

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes check-pop {
  0% { transform: scale(0.82); }
  55% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes glow-pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(var(--accent-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); }
}

/* Responsive ---------------------------------------------------------- */

@media (max-width: 1280px) {
  :root {
    --sidebar-w: 250px;
  }

  .topbar {
    padding: 0 24px;
  }

  .view {
    padding: 24px 24px 44px;
  }

  .search-trigger {
    width: 260px;
  }
}

@media (max-width: 1080px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sync-chip {
    display: none;
  }
}

@media (max-width: 980px) {
  .sidebar {
    display: none;
  }

  .app-main {
    margin-left: 0;
  }

  .mobile-nav {
    display: flex;
  }

  .mobile-brand {
    display: flex;
  }

  .view {
    padding-bottom: 96px;
  }

  /* Tablets and phones: a full-width frosted bar. */
  .topbar {
    height: 66px;
    padding: 0 18px;
    background: var(--topbar-bg);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border);
    pointer-events: auto;
  }

  .topbar-right {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }

  .toast-wrap {
    bottom: 84px;
  }

  .search-trigger {
    width: 210px;
  }

  .heatmap {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .heatmap-months,
  .heatmap-body {
    min-width: 620px;
  }
}

@media (max-width: 720px) {
  .page-title {
    font-size: 25px;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }

  .view {
    padding: 20px 16px 96px;
  }

  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .search-trigger {
    width: 38px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
  }

  .search-trigger span:nth-child(2),
  .search-trigger .kbd {
    display: none;
  }

  .streak-chip {
    padding: 0 9px;
    font-size: 9.5px;
  }

  .streak-chip .streak-long {
    display: none;
  }

  .avatar {
    width: 34px;
    height: 34px;
  }

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

  .stat-card {
    padding: 13px 14px;
  }

  .stat-value {
    font-size: 23px;
  }

  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }

  .modal {
    max-height: calc(100vh - 24px);
    border-radius: 20px;
  }

  .modal-head {
    padding: 18px 18px 0;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-foot {
    padding: 14px 18px 18px;
  }

  .field-row,
  .field-row-3 {
    grid-template-columns: 1fr;
  }

  .cadence-bars {
    height: 160px;
    gap: 6px;
  }

  .cadence-value {
    font-size: 7.5px;
  }

  .toast-wrap {
    right: 12px;
    bottom: 78px;
    width: calc(100vw - 24px);
  }

  .palette-backdrop {
    padding: 8vh 12px 12px;
  }
}

@media (max-width: 420px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav-item {
    font-size: 7px;
  }

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

/* Short viewports (landscape phones, small laptops): tighten the dialog chrome
   so the body keeps room to scroll and the footer stays on screen. */
@media (min-width: 721px) and (max-height: 680px) {
  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    max-height: calc(100dvh - 20px);
  }

  .modal-head {
    padding: 16px 20px 0;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-body {
    padding: 12px 20px;
  }

  .modal-foot {
    padding: 11px 20px 13px;
  }
}

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